From fa2918d945c6fad84055caca8912d2efe242ed6f Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Sun, 16 Feb 2020 15:23:45 +0200 Subject: Limit vfmodule tenant and region dictation to "create" Other flows (e.g. Delete) are expected to have literal designation. Verified in API test "delete1VnfWithVfModulesAndCreate1VnfFromService". Issue-ID: VID-758 Change-Id: Ib543ff98ecf96e1df0e5741fbdbba2e64e602528 Signed-off-by: Ittay Stern --- .../src/main/java/org/onap/vid/job/command/VnfCommand.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'vid-app-common/src/main/java') diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt index b008c1306..cada6055d 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt @@ -12,7 +12,6 @@ import org.onap.vid.model.serviceInstantiation.Vnf import org.onap.vid.mso.RestMsoImplementation import org.onap.vid.properties.Features import org.onap.vid.services.AsyncInstantiationBusinessLogic -import org.onap.vid.utils.isNotActive import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope @@ -77,7 +76,7 @@ class VnfCommand @Autowired constructor( .map { childVfModuleWithVnfRegionAndTenant(it) } internal fun childVfModuleWithVnfRegionAndTenant(vfModule: VfModule): VfModule { - if (featureManager.isNotActive(Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF)) { + if (!shouldEntailRegionAndTenantToVfModule(vfModule)) { return vfModule } @@ -86,6 +85,10 @@ class VnfCommand @Autowired constructor( return vfModule.cloneWith(vnfLcpCloudRegionId, vnfTenantId) } + private fun shouldEntailRegionAndTenantToVfModule(vfModule: VfModule) = + vfModule.action == Action.Create + && featureManager.isActive(Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF) + private fun filterModuleByNeedToCreateBase(vfModule: VfModule): Boolean { return needToCreateBaseModule == commandUtils.isVfModuleBaseModule( -- cgit 1.2.3-korg