diff options
231 files changed, 3540 insertions, 2369 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index 076e03b6b3..d036468808 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -72,11 +72,11 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ public static final String OOF_DIRECTIVES = "oof_directives"; public static final String SDNC_DIRECTIVES = "sdnc_directives"; - public static final String GENERIC_VNF_ID = "generic_vnf_id"; + public static final String VNF_ID = "vnf_id"; public static final String VF_MODULE_ID = "vf_module_id"; public static final String TEMPLATE_TYPE = "template_type"; public static final List<String> MULTICLOUD_INPUTS = - Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, GENERIC_VNF_ID, VF_MODULE_ID, TEMPLATE_TYPE); + Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, TEMPLATE_TYPE); private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class); @@ -157,18 +157,29 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ for (String key: MULTICLOUD_INPUTS) { if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) { - if ( key == OOF_DIRECTIVES) {oofDirectives = (String) stackInputs.get(key);} - if ( key == SDNC_DIRECTIVES) {sdncDirectives = (String) stackInputs.get(key);} - if ( key == GENERIC_VNF_ID) {genericVnfId = (String) stackInputs.get(key);} - if ( key == VF_MODULE_ID) {vfModuleId = (String) stackInputs.get(key);} - if ( key == TEMPLATE_TYPE) {templateType = (String) stackInputs.get(key);} - if (logger.isDebugEnabled()) { + if (key == OOF_DIRECTIVES) { + oofDirectives = (String) stackInputs.get(key); + } + if (key == SDNC_DIRECTIVES) { + sdncDirectives = (String) stackInputs.get(key); + } + if (key == TEMPLATE_TYPE) { + templateType = (String) stackInputs.get(key); + } + if (logger.isDebugEnabled()) { logger.debug(String.format("Found %s: %s", key, stackInputs.get(key))); } stackInputs.remove(key); } } + if (!stackInputs.isEmpty() && stackInputs.containsKey(VF_MODULE_ID)){ + vfModuleId = (String) stackInputs.get(VF_MODULE_ID); + } + if (!stackInputs.isEmpty() && stackInputs.containsKey(VNF_ID)){ + genericVnfId = (String) stackInputs.get(VNF_ID); + } + // create the multicloud payload CreateStackParam stack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java index eaf3e125a1..36e00ad599 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java @@ -73,6 +73,7 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ToscaCsar; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfRecipe; import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; @@ -116,6 +117,7 @@ import java.util.List; public class CatalogDbAdapterRest { protected static Logger logger = LoggerFactory.getLogger(CatalogDbAdapterRest.class); private static final boolean IS_ARRAY = true; + private static final String NETWORK_SERVICE = "network service"; @Autowired private VnfCustomizationRepository vnfCustomizationRepo; @@ -563,15 +565,32 @@ public class CatalogDbAdapterRest { if (rmUuid != null && !"".equals(rmUuid)) { logger.debug("Query recipe by resource model uuid: {}", rmUuid); //check vnf and network and ar, the resource could be any resource. + Recipe recipe = null; + VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid); - Recipe recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndAction(vnf.getModelName(), action); + if (vnf != null) { + recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndActionAndVersionStr(vnf.getModelName(), action, vnf.getModelVersion()); + + // for network service fetch the default recipe + if (recipe == null && vnf.getSubCategory().equalsIgnoreCase(NETWORK_SERVICE)) { + recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndAction("NS_DEFAULT", action); + } + } + + if (null == recipe) { NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid); - recipe = networkRecipeRepo.findFirstByModelNameAndAction(nResource.getModelName(), action); + recipe = networkRecipeRepo.findFirstByModelNameAndActionAndVersionStr(nResource.getModelName(), action, vnf.getModelVersion()); + + // for network fetch the default recipe + if (recipe == null) { + recipe = networkRecipeRepo.findFirstByModelNameAndAction("SDNC_DEFAULT", action); + } } + if (null == recipe) { AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid); - recipe = arRecipeRepo.findByModelNameAndAction(arResource.getModelName(), action); + recipe = arRecipeRepo.findByModelNameAndActionAndVersion(arResource.getModelName(), action, arResource.getModelVersion()); } if (recipe != null) { QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe); diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.13__UpdateBBOrchestrationStatusAutoScaleOut.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.13__UpdateBBOrchestrationStatusAutoScaleOut.sql new file mode 100644 index 0000000000..04fc68da75 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.13__UpdateBBOrchestrationStatusAutoScaleOut.sql @@ -0,0 +1,26 @@ +use catalogdb; + +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'ACTIVE', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'ASSIGNED', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'CREATED', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'INVENTORIED', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'PENDING', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VNF', 'PRECREATED', 'CUSTOM', 'CONTINUE'); + + +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'ACTIVE', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'ASSIGNED', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'CREATED', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'INVENTORIED', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'PENDING', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'); +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES('VF_MODULE', 'PRECREATED', 'CUSTOM', 'CONTINUE'); + +update building_block_detail set resource_type = "VNF" where building_block_name = "GenericVnfHealthCheckBB"; + +update building_block_detail set resource_type = "VF_MODULE" where building_block_name = "ConfigurationScaleOutBB";
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14__RemoveRetryFromRainyDayHandlingTable.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14__RemoveRetryFromRainyDayHandlingTable.sql new file mode 100644 index 0000000000..e4b599a044 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14__RemoveRetryFromRainyDayHandlingTable.sql @@ -0,0 +1,18 @@ +use catalogdb; + +UPDATE rainy_day_handler_macro SET POLICY = 'Rollback' WHERE FLOW_NAME = 'CreateNetworkBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Rollback' WHERE FLOW_NAME = 'CreateNetworkCollectionBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Rollback' WHERE FLOW_NAME = 'CreateVfModuleBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Rollback' WHERE FLOW_NAME = 'CreateVolumeGroupBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'DeleteNetworkBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'DeleteNetworkCollectionBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'DeleteVfModuleBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'DeleteVolumeGroupBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignNetwork1802BB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignNetworkBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignServiceInstanceBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignVfModuleBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignVnfBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UnassignVolumeGroupBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'UpdateNetworkBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'VnfAdapterBB';
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.15__UpdateRainyDayHandlerMacroForScaleOut.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.15__UpdateRainyDayHandlerMacroForScaleOut.sql new file mode 100644 index 0000000000..75a8c20352 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.15__UpdateRainyDayHandlerMacroForScaleOut.sql @@ -0,0 +1,4 @@ +use catalogdb; + +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'GenericVnfHealthCheckBB'; +UPDATE rainy_day_handler_macro SET POLICY = 'Abort' WHERE FLOW_NAME = 'ConfigurationScaleOutBB';
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java index 0606848b04..eb2d3753d9 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java @@ -63,14 +63,14 @@ public class CloudConfigTest { headers.set("Content-Type",MediaType.APPLICATION_JSON); CloudSite cloudSite = new CloudSite(); - cloudSite.setId("MTN6"); + cloudSite.setId("MTN7"); cloudSite.setClli("TESTCLLI"); cloudSite.setRegionId("regionId"); cloudSite.setCloudVersion("VERSION"); cloudSite.setPlatform("PLATFORM"); CloudIdentity cloudIdentity = new CloudIdentity(); - cloudIdentity.setId("RANDOMID"); + cloudIdentity.setId("RANDOMID-test"); cloudIdentity.setIdentityUrl("URL"); cloudIdentity.setMsoId("MSO_ID"); cloudIdentity.setMsoPass("MSO_PASS"); @@ -81,7 +81,7 @@ public class CloudConfigTest { cloudSite.setIdentityService(cloudIdentity); String uri = "/cloudSite"; UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://localhost:"+ port + uri); - HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers); + HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers); ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, request, String.class); assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatusCode().value()); @@ -96,4 +96,6 @@ public class CloudConfigTest { } + + } diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index 5e2bd82776..c85a4c28f5 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -413,6 +413,7 @@ public class CatalogDbClientTest { Assert.assertEquals("regionId", getCloudSite.getRegionId()); Assert.assertEquals("RANDOMID", getCloudSite.getIdentityServiceId()); } + @Test public void testGetServiceByModelName() { Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 269acb9d6f..d37342323f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -999,10 +999,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } } } - if (multicloudInputs) { - goldenInputs.put(MsoMulticloudUtils.GENERIC_VNF_ID, genericVnfId); - goldenInputs.put(MsoMulticloudUtils.VF_MODULE_ID, vfModuleId); - } LOGGER.debug("Ignoring extra inputs: " + extraInputs); } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index f77a48a1f8..c8f7f05436 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -347,38 +347,47 @@ public class ToscaResourceInstaller { } } - protected void processNetworks(ToscaResourceStructure toscaResourceStruct, Service service) - throws ArtifactInstallerException { - List<NodeTemplate> nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper().getServiceVlList(); - - if (nodeTemplatesVLList != null) { - for (NodeTemplate vlNode : nodeTemplatesVLList) { - String networkResourceModelName = vlNode.getMetaData() - .getValue(SdcPropertyNames.PROPERTY_NAME_NAME); - - TempNetworkHeatTemplateLookup tempNetworkLookUp = tempNetworkLookupRepo.findFirstBynetworkResourceModelName(networkResourceModelName); - - if (tempNetworkLookUp != null ) { - HeatTemplate heatTemplate = heatRepo.findByArtifactUuid(tempNetworkLookUp.getHeatTemplateArtifactUuid()); - if (heatTemplate != null ) { - NetworkResourceCustomization networkCustomization = createNetwork(vlNode, toscaResourceStruct, heatTemplate,tempNetworkLookUp.getAicVersionMax(), - tempNetworkLookUp.getAicVersionMin(),service); - service.getNetworkCustomizations() - .add(networkCustomization); - } - else{ - throw new ArtifactInstallerException( - "No HeatTemplate found for artifactUUID: " - + tempNetworkLookUp.getHeatTemplateArtifactUuid()); - } - } else { - throw new ArtifactInstallerException( - "No NetworkResourceName found in TempNetworkHeatTemplateLookup for " - + networkResourceModelName); - } - - } - } + protected void processNetworks (ToscaResourceStructure toscaResourceStruct, + Service service) throws ArtifactInstallerException { + List <NodeTemplate> nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper ().getServiceVlList (); + + if (nodeTemplatesVLList != null) { + for (NodeTemplate vlNode : nodeTemplatesVLList) { + String networkResourceModelName = vlNode.getMetaData ().getValue (SdcPropertyNames.PROPERTY_NAME_NAME); + + TempNetworkHeatTemplateLookup tempNetworkLookUp = + tempNetworkLookupRepo.findFirstBynetworkResourceModelName (networkResourceModelName); + + if (tempNetworkLookUp != null) { + HeatTemplate heatTemplate = + heatRepo.findByArtifactUuid (tempNetworkLookUp.getHeatTemplateArtifactUuid ()); + if (heatTemplate != null) { + NetworkResourceCustomization networkCustomization = + createNetwork (vlNode, + toscaResourceStruct, + heatTemplate, + tempNetworkLookUp.getAicVersionMax (), + tempNetworkLookUp.getAicVersionMin (), + service); + service.getNetworkCustomizations ().add (networkCustomization); + } else { + throw new ArtifactInstallerException ("No HeatTemplate found for artifactUUID: " + + tempNetworkLookUp.getHeatTemplateArtifactUuid ()); + } + } else { + NetworkResourceCustomization networkCustomization = createNetwork (vlNode, + toscaResourceStruct, + null, + null, + null, + service); + service.getNetworkCustomizations().add (networkCustomization); + logger.debug ("No NetworkResourceName found in TempNetworkHeatTemplateLookup for " + + networkResourceModelName); + } + + } + } } protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service, @@ -1170,27 +1179,7 @@ public class ToscaResourceInstaller { return vfcInstanceGroupCustom; } - - protected VFCInstanceGroup findExistingVnfcInstanceGroup(VnfResourceCustomization vnfResourceCustomization, - String modelUUID) { - VFCInstanceGroup vfcInstanceGroup = null; - List<VnfcInstanceGroupCustomization> vnfInstanceGroupCustomizations = vnfResourceCustomization - .getVnfcInstanceGroupCustomizations(); - if(vnfInstanceGroupCustomizations != null){ - for (VnfcInstanceGroupCustomization vnfcInstanceGroupCustom : vnfResourceCustomization - .getVnfcInstanceGroupCustomizations()) { - if (vnfcInstanceGroupCustom.getInstanceGroup() != null - && vnfcInstanceGroupCustom.getInstanceGroup().getModelUUID().equals(modelUUID)) { - vfcInstanceGroup = (VFCInstanceGroup)vnfcInstanceGroupCustom.getInstanceGroup(); - } - } - } - if (vfcInstanceGroup == null) - vfcInstanceGroup = (VFCInstanceGroup) instanceGroupRepo.findByModelUUID(modelUUID); - - return vfcInstanceGroup; - } - + protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, Set<CvnfcCustomization> existingCvnfcSet, Set<VnfcCustomization> existingVnfcSet) { @@ -1606,16 +1595,10 @@ public class ToscaResourceInstaller { for (Group group : groupList) { - VFCInstanceGroup vfcInstanceGroup = findExistingVnfcInstanceGroup(vnfResourceCustomization, - group.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - if(vfcInstanceGroup == null){ - VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = createVNFCInstanceGroup( - vfNodeTemplate, group, vnfResourceCustomization); - - vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization); - } - } - + VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = createVNFCInstanceGroup(vfNodeTemplate, group, vnfResourceCustomization); + + vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization); + } } return vnfResourceCustomization; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java index dcfeb10845..7b769bd532 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java @@ -25,6 +25,7 @@ import java.net.URL; import org.onap.so.client.aai.AAIProperties; import org.onap.so.client.aai.AAIVersion; +import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; public class AaiClientPropertiesImpl implements AAIProperties { diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java index 9a7240c830..74f0d60596 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java @@ -27,8 +27,8 @@ import org.junit.runner.RunWith; import org.onap.so.asdc.installer.ToscaResourceStructure; import org.onap.so.asdc.installer.VfResourceStructure; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; -import org.onap.so.asdc.tenantIsolation.SpringContextHelper; import org.onap.so.asdc.tenantIsolation.WatchdogDistribution; +import org.onap.so.spring.SpringContextHelper; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer; import org.springframework.boot.test.context.SpringBootTest; diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 456b8ae074..926e09c498 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -293,12 +293,12 @@ <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-lib</artifactId> - <version>1.3.0</version> + <version>1.4.0</version> </dependency> <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-kit</artifactId> - <version>1.3.0</version> + <version>1.4.0</version> </dependency> <dependency> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index 00bd8e9ef8..9e71313e09 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -694,32 +694,6 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess } /** - * Constructs a workflow message callback URL for the specified message type and correlator. - * This type of callback URL is used when a workflow wants an MSO adapter (like the SDNC - * adapter) to call it back. In other words, this is for callbacks internal to the MSO - * complex. Use <code>createWorkflowMessageAdapterCallbackURL</code> if the callback - * will come from outside the MSO complex. - * @param endpoint endpoint address to contruct URL from - * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse) - * @param correlator the correlator value (e.g. a request ID) - */ - public String createCallbackURL(String endpoint, String messageType, String correlator) { - if (endpoint == null || endpoint.isEmpty()) { - ExceptionUtil exceptionUtil = new ExceptionUtil() - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, - 'mso:workflow:message:endpoint was not passed in') - } - - while (endpoint.endsWith('/')) { - endpoint = endpoint.substring(0, endpoint.length()-1) - } - - return endpoint + - '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + - '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') - } - - /** * * Constructs a workflow message callback URL for the specified message type and correlator. * This type of callback URL is used when a workflow wants a system outside the MSO complex diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy index e4bc5f8fa2..c337a21987 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -137,7 +137,7 @@ class AllottedResourceUtils { try { AAIResourcesClient client = new AAIResourcesClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId) - AaiUtil aaiUtil = new AaiUtil() + AaiUtil aaiUtil = new AaiUtil(taskProcessor) arLink = aaiUtil.createAaiUri(uri) } catch (NotFoundException e) { msoLogger.debug("GET AR received a Not Found (404) Response") @@ -323,5 +323,25 @@ class AllottedResourceUtils { msoLogger.trace("Exit BuildAAIErrorResponse Process") throw new BpmnError("MSOWorkflowException") } + + public String createARUrl(DelegateExecution execution, AAIResourceUri uri, String allottedResourceId) { + AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) + AAIResourceUri siResourceLink= uri + + String siUri = "" + + if(siResourceLink != null) { + msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink.build().toString()) + } + else + { + String msg = "Parent Service Link in AAI is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + AAIResourceUri arUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId) + + return aaiUriUtil.createAaiUri(arUri) + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index f9ddd0d430..9a3e1b7349 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -939,7 +939,8 @@ class MsoUtils { if (moduleIndexList == null || moduleIndexList.size() == 0) { return "0" } - def sortedModuleIndexList = moduleIndexList.sort { a, b -> a.compareTo b } + + def sortedModuleIndexList = moduleIndexList.sort{ a, b -> a as Integer <=> b as Integer} for (i in 0..sortedModuleIndexList.size()-1) { if (Integer.parseInt(sortedModuleIndexList[i]) != i) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index aa0d8ace6a..c50ef3530e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -18,13 +18,11 @@ * ============LICENSE_END========================================================= */ package org.onap.so.bpmn.common.scripts + import org.onap.so.bpmn.core.UrnPropertiesReader import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AaiUtil -import org.onap.so.bpmn.common.scripts.ExceptionUtil - import org.onap.so.bpmn.core.domain.InventoryType import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ResourceType @@ -32,15 +30,17 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.Subscriber import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.db.catalog.beans.AuthenticationType import org.onap.so.db.catalog.beans.CloudIdentity import org.onap.so.db.catalog.beans.CloudSite +import org.onap.so.db.catalog.beans.ServerType import org.onap.so.rest.APIResponse import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.json.JSONArray import org.json.JSONObject +import org.springframework.web.util.UriUtils import static org.onap.so.bpmn.common.scripts.GenericUtils.* @@ -213,17 +213,12 @@ class OofHoming extends AbstractServiceTaskProcessor { for (int j = 0; j < arrSol.length(); j++) { JSONObject placement = arrSol.getJSONObject(j) utils.log("DEBUG", "****** Placement Solution is: " + placement + " *****", "true") - String jsonServiceResourceId = placement.getString("serviceResourceId") - String jsonResourceModuleName = placement.getString("resourceModuleName") + String jsonServiceResourceId = jsonUtil.getJsonValue( placement.toString(), "serviceResourceId") + utils.log("DEBUG", "****** homing serviceResourceId is: " + jsonServiceResourceId + " *****", "true") for (Resource resource : resourceList) { String serviceResourceId = resource.getResourceId() - String resourceModuleName = "" - if (resource.getResourceType() == ResourceType.ALLOTTED_RESOURCE || - resource.getResourceType() == ResourceType.VNF) { - resourceModuleName = resource.getNfFunction() - } - if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId) || - resourceModuleName.equalsIgnoreCase(jsonResourceModuleName)) { + utils.log("DEBUG", "****** decomp serviceResourceId is: " + serviceResourceId + " *****", "true") + if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { JSONObject solution = placement.getJSONObject("solution") String solutionType = solution.getString("identifierType") String inventoryType = "" @@ -232,43 +227,79 @@ class OofHoming extends AbstractServiceTaskProcessor { } else { inventoryType = "cloud" } + utils.log("DEBUG", "****** homing inventoryType is: " + inventoryType + " *****", "true") resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") + utils.log("DEBUG", "****** assignmentInfo is: " + assignmentArr.toString() + " *****", "true") + + Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, + assignmentArr.toString(), "key", "value") String oofDirectives = null - assignmentArr.each { element -> - JSONObject jsonObject = new JSONObject(element.toString()) - if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "oof_directives") { - oofDirectives = jsonUtil.getJsonRawValue(jsonObject.toString(), "value") + assignmentMap.each { key, value -> + utils.log("DEBUG", "****** element: " + key + " *****", "true") + if (key == "oof_directives") { + oofDirectives = value + utils.log("DEBUG", "****** homing oofDirectives: " + oofDirectives + " *****", "true") } } - Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, - assignmentArr.toString(), "key", "value") String cloudOwner = assignmentMap.get("cloudOwner") + utils.log("DEBUG", "****** homing cloudOwner: " + cloudOwner + " *****", "true") String cloudRegionId = assignmentMap.get("locationId") + utils.log("DEBUG", "****** homing cloudRegionId: " + cloudRegionId + " *****", "true") resource.getHomingSolution().setCloudOwner(cloudOwner) resource.getHomingSolution().setCloudRegionId(cloudRegionId) - CloudSite cloudSite = new CloudSite(); + CloudSite cloudSite = new CloudSite() cloudSite.setId(cloudRegionId) cloudSite.setRegionId(cloudRegionId) String orchestrator = execution.getVariable("orchestrator") - if ((orchestrator != null) || (orchestrator != "")) { + if ((orchestrator != null) && (orchestrator != "")) { cloudSite.setOrchestrator(orchestrator) + utils.log("DEBUG", "****** orchestrator: " + orchestrator + " *****", "true") + } else { + cloudSite.setOrchestrator("multicloud") } - CloudIdentity cloudIdentity = new CloudIdentity(); - cloudIdentity.setId(cloudRegionId); - cloudIdentity.setIdentityUrl("/api/multicloud /v1/" + cloudOwner + "/" + cloudRegionId + "/infra_workload") - cloudSite.setIdentityService(cloudIdentity); + CloudIdentity cloudIdentity = new CloudIdentity() + cloudIdentity.setId(cloudRegionId) + cloudIdentity.setIdentityServerType(ServerType."KEYSTONE") + cloudIdentity.setAdminTenant("service") + cloudIdentity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD) + String msoMulticloudUserName = UrnPropertiesReader + .getVariable("mso.multicloud.api.password", execution, + "apih") + String msoMulticloudPassword = UrnPropertiesReader + .getVariable("mso.multicloud.api.password", execution, + "abc123") + cloudIdentity.setMsoId(msoMulticloudUserName) + cloudIdentity.setMsoPass(msoMulticloudPassword) + // Get MSB Url + String msbHost = oofUtils.getMsbHost(execution) + String multicloudApiEndpoint = UrnPropertiesReader + .getVariable("mso.multicloud.api.endpoint", execution, + "/api/multicloud-titaniumcloud/v1") + cloudIdentity.setIdentityUrl(msbHost + multicloudApiEndpoint + + "/" + cloudOwner + "/" + + cloudRegionId + "/infra_workload") + utils.log("DEBUG", "****** Cloud IdentityUrl: " + msbHost + multicloudApiEndpoint + + "/" + cloudOwner + "/" + + cloudRegionId + "/infra_workload" + + " *****", "true") + utils.log("DEBUG", "****** CloudIdentity: " + cloudIdentity.toString() + + " *****", "true") + cloudSite.setIdentityService(cloudIdentity) + utils.log("DEBUG", "****** CloudSite: " + cloudSite.toString() + + " *****", "true") // Set cloudsite in catalog DB here - oofUtils.createCloudSiteCatalogDb(cloudSite) + // TODO Get cloudsite and compare, set if not present + oofUtils.createCloudSiteCatalogDb(cloudSite, execution) if (oofDirectives != null && oofDirectives != "") { resource.getHomingSolution().setOofDirectives(oofDirectives) execution.setVariable("oofDirectives", oofDirectives) - utils.log("DEBUG", "***** OofDirectives is: " + oofDirectives + + utils.log("DEBUG", "***** OofDirectives set to: " + oofDirectives + " *****", "true") } @@ -279,6 +310,12 @@ class OofHoming extends AbstractServiceTaskProcessor { resource.getHomingSolution().setVnf(vnf) resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString()) } + } else { + utils.log("DEBUG", "ProcessHomingSolution Exception: no matching serviceResourceIds returned in " + + "homing solution", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - " + + "Occurred in Homing ProcessHomingSolution: no matching serviceResourceIds returned") + } } } @@ -308,8 +345,10 @@ class OofHoming extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled) } catch (BpmnError b) { + utils.log("DEBUG", "ProcessHomingSolution Error: " + b, isDebugEnabled) throw b } catch (Exception e) { + utils.log("DEBUG", "ProcessHomingSolution Exception: " + e, isDebugEnabled) msoLogger.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution") } @@ -338,4 +377,37 @@ class OofHoming extends AbstractServiceTaskProcessor { */ public void preProcessRequest(DelegateExecution execution) {} // Not Implemented Method + + /** + * Constructs a workflow message callback URL for the specified message type and correlator. + * This type of callback URL is used when a workflow wants an MSO adapter (like the SDNC + * adapter) to call it back. In other words, this is for callbacks internal to the MSO + * complex. Use <code>createWorkflowMessageAdapterCallbackURL</code> if the callback + * will come from outside the MSO complex. + * @param endpoint endpoint address to contruct URL from + * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse) + * @param correlator the correlator value (e.g. a request ID) + */ + public String createHomingCallbackURL(String endpoint, String messageType, String correlator) { + try { + if (endpoint == null || endpoint.isEmpty()) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, + 'mso:workflow:message:endpoint was not passed in') + } + + utils.log("DEBUG", "passed in endpoint: " + endpoint + " *****", "true") + + while (endpoint.endsWith('/')) { + endpoint = endpoint.substring(0, endpoint.length() - 1) + } + utils.log("DEBUG", "processed endpoint: " + endpoint + " *****", "true") + + return endpoint + + '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + + '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') + } catch (Exception ex) { + utils.log("DEBUG", "createCallbackURL Exception: " + ex + " *****", "true") + } + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index b1da7cf49b..19d19b8cea 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -33,22 +33,18 @@ import org.onap.so.bpmn.core.domain.ServiceInstance import org.onap.so.bpmn.core.domain.Subscriber import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.db.catalog.beans.CloudIdentity import org.onap.so.db.catalog.beans.CloudSite +import org.onap.so.db.catalog.client.CatalogDbClient import org.onap.so.rest.APIResponse import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig import org.springframework.http.HttpEntity import org.springframework.http.HttpHeaders -import org.springframework.http.HttpMethod -import org.springframework.http.ResponseEntity -import org.springframework.http.client.BufferingClientHttpRequestFactory -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory -import org.springframework.web.client.RestTemplate import org.springframework.web.util.UriComponentsBuilder import javax.ws.rs.core.MediaType -import javax.ws.rs.core.Response -import javax.xml.ws.http.HTTPException +import javax.ws.rs.core.UriBuilder import static org.onap.so.bpmn.common.scripts.GenericUtils.* @@ -89,138 +85,152 @@ class OofUtils { utils.log("DEBUG", "Started Building OOF Request", isDebugEnabled) String callbackEndpoint = UrnPropertiesReader.getVariable("mso.oof.callbackEndpoint", execution) utils.log("DEBUG", "mso.oof.callbackEndpoint is: " + callbackEndpoint, isDebugEnabled) - def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(callbackEndpoint, "oofResponse", requestId) - def transactionId = requestId - //ServiceInstance Info - ServiceInstance serviceInstance = decomposition.getServiceInstance() - def serviceInstanceId = "" - def serviceName = "" - - serviceInstanceId = execution.getVariable("serviceInstanceId") - serviceName = execution.getVariable("subscriptionServiceType") - - if (serviceInstanceId == null || serviceInstanceId == "null") { - utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + - "obtain Service Instance Id, execution.getVariable(\"serviceInstanceId\") is null") - } - if (serviceName == null || serviceName == "null") { - utils.log("DEBUG", "Unable to obtain Service Name", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + - "obtain Service Name, execution.getVariable(\"subscriptionServiceType\") is null") - } - //Model Info - ModelInfo model = decomposition.getModelInfo() - String modelType = model.getModelType() - String modelInvariantId = model.getModelInvariantUuid() - String modelVersionId = model.getModelUuid() - String modelName = model.getModelName() - String modelVersion = model.getModelVersion() - //Subscriber Info - String subscriberId = "" - String subscriberName = "" - String commonSiteId = "" - if (subscriber != null){ - subscriberId = subscriber.getGlobalId() - subscriberName = subscriber.getName() - commonSiteId = subscriber.getCommonSiteId() - } - - //Determine RequestType - //TODO Figure out better way to determine this - String requestType = "create" - List<Resource> resources = decomposition.getServiceResources() - for(Resource r:resources){ - HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution() - if(currentSolution != null){ - requestType = "speed changed" + try { + def callbackUrl = utils.createHomingCallbackURL(callbackEndpoint, "oofResponse", requestId) + utils.log("DEBUG", "callbackUrl is: " + callbackUrl, isDebugEnabled) + + + def transactionId = requestId + utils.log("DEBUG", "transactionId is: " + transactionId, isDebugEnabled) + //ServiceInstance Info + ServiceInstance serviceInstance = decomposition.getServiceInstance() + def serviceInstanceId = "" + def serviceName = "" + + serviceInstanceId = execution.getVariable("serviceInstanceId") + utils.log("DEBUG", "serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + serviceName = execution.getVariable("subscriptionServiceType") + utils.log("DEBUG", "serviceName is: " + serviceName, isDebugEnabled) + + if (serviceInstanceId == null || serviceInstanceId == "null") { + utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + + "obtain Service Instance Id, execution.getVariable(\"serviceInstanceId\") is null") + } + if (serviceName == null || serviceName == "null") { + utils.log("DEBUG", "Unable to obtain Service Name", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + + "obtain Service Name, execution.getVariable(\"subscriptionServiceType\") is null") + } + //Model Info + ModelInfo model = decomposition.getModelInfo() + utils.log("DEBUG", "ModelInfo: " + model.toString(), isDebugEnabled) + String modelType = model.getModelType() + String modelInvariantId = model.getModelInvariantUuid() + String modelVersionId = model.getModelUuid() + String modelName = model.getModelName() + String modelVersion = model.getModelVersion() + //Subscriber Info + String subscriberId = "" + String subscriberName = "" + String commonSiteId = "" + if (subscriber != null) { + subscriberId = subscriber.getGlobalId() + subscriberName = subscriber.getName() + commonSiteId = subscriber.getCommonSiteId() } - } - //Demands - String placementDemands = "" - StringBuilder sb = new StringBuilder() - List<AllottedResource> allottedResourceList = decomposition.getAllottedResources() - List<VnfResource> vnfResourceList = decomposition.getVnfResources() + //Determine RequestType + //TODO Figure out better way to determine this + String requestType = "create" + List<Resource> resources = decomposition.getServiceResources() + for (Resource r : resources) { + HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution() + if (currentSolution != null) { + requestType = "speed changed" + } + } - if (allottedResourceList == null || allottedResourceList.isEmpty() ) { - utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", - isDebugEnabled) - allottedResourceList = decomposition.getVnfResources() - } + //Demands + String placementDemands = "" + StringBuilder sb = new StringBuilder() + List<AllottedResource> allottedResourceList = decomposition.getAllottedResources() + List<VnfResource> vnfResourceList = decomposition.getVnfResources() - if (allottedResourceList == null || allottedResourceList.isEmpty()) { - utils.log("DEBUG", "Resources List is Empty", isDebugEnabled) - } else { - for (AllottedResource resource : allottedResourceList) { - utils.log("DEBUG", "Allotted Resource: " + resource.toString(), + if (allottedResourceList == null || allottedResourceList.isEmpty()) { + utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", isDebugEnabled) - def serviceResourceId = resource.getResourceId() - def resourceModelInvariantId = resource.getModelInfo().getModelInvariantUuid() - def resourceModelVersionId = resource.getModelInfo().getModelUuid() - def resourceModelName = resource.getModelInfo().getModelName() - def resourceModelVersion = resource.getModelInfo().getModelVersion() - def resourceModelType = resource.getModelInfo().getModelType() - def tenantId = execution.getVariable("tenantId") - def requiredCandidatesJson = "" - - requiredCandidatesJson = createCandidateJson( - existingCandidates, - excludedCandidates, - requiredCandidates) - - String demand = - " {\n" + - " \"resourceModuleName\": \"${resourceModelName}\",\n" + - " \"serviceResourceId\": \"${serviceResourceId}\",\n" + - " \"tenantId\": \"${tenantId}\",\n" + - " \"resourceModelInfo\": {\n" + - " \"modelInvariantId\": \"${resourceModelInvariantId}\",\n" + - " \"modelVersionId\": \"${resourceModelVersionId}\",\n" + - " \"modelName\": \"${resourceModelName}\",\n" + - " \"modelType\": \"${resourceModelType}\",\n" + - " \"modelVersion\": \"${resourceModelVersion}\",\n" + - " \"modelCustomizationName\": \"\"\n" + - " }" + requiredCandidatesJson + "\n" + - " }," - - placementDemands = sb.append(demand) + } else { + for (AllottedResource resource : allottedResourceList) { + utils.log("DEBUG", "Allotted Resource: " + resource.toString(), + isDebugEnabled) + def serviceResourceId = resource.getResourceId() + def toscaNodeType = resource.getToscaNodeType() + def resourceModuleName = toscaNodeType.substring(toscaNodeType.lastIndexOf(".") + 1) + def resourceModelInvariantId = resource.getModelInfo().getModelInvariantUuid() + def resourceModelVersionId = resource.getModelInfo().getModelUuid() + def resourceModelName = resource.getModelInfo().getModelName() + def resourceModelVersion = resource.getModelInfo().getModelVersion() + def resourceModelType = resource.getModelInfo().getModelType() + def tenantId = execution.getVariable("tenantId") + def requiredCandidatesJson = "" + + requiredCandidatesJson = createCandidateJson( + existingCandidates, + excludedCandidates, + requiredCandidates) + + String demand = + " {\n" + + " \"resourceModuleName\": \"${resourceModuleName}\",\n" + + " \"serviceResourceId\": \"${serviceResourceId}\",\n" + + " \"tenantId\": \"${tenantId}\",\n" + + " \"resourceModelInfo\": {\n" + + " \"modelInvariantId\": \"${resourceModelInvariantId}\",\n" + + " \"modelVersionId\": \"${resourceModelVersionId}\",\n" + + " \"modelName\": \"${resourceModelName}\",\n" + + " \"modelType\": \"${resourceModelType}\",\n" + + " \"modelVersion\": \"${resourceModelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }" + requiredCandidatesJson + "\n" + + " }," + + placementDemands = sb.append(demand) + } } - for (VnfResource vnfResource : vnfResourceList) { - utils.log("DEBUG", "VNF Resource: " + vnfResource.toString(), + + if (vnfResourceList == null || vnfResourceList.isEmpty()) { + utils.log("DEBUG", "VNF Resources List is empty", isDebugEnabled) - ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() - def serviceResourceId = vnfResource.getResourceId() - def resourceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() - def resourceModelName = vnfResourceModelInfo.getModelName() - def resourceModelVersion = vnfResourceModelInfo.getModelVersion() - def resourceModelVersionId = vnfResourceModelInfo.getModelUuid() - def resourceModelType = vnfResourceModelInfo.getModelType() - def tenantId = execution.getVariable("tenantId") - def requiredCandidatesJson = "" - - - String placementDemand = - " {\n" + - " \"resourceModuleName\": \"${resourceModelName}\",\n" + - " \"serviceResourceId\": \"${serviceResourceId}\",\n" + - " \"tenantId\": \"${tenantId}\",\n" + - " \"resourceModelInfo\": {\n" + - " \"modelInvariantId\": \"${resourceModelInvariantId}\",\n" + - " \"modelVersionId\": \"${resourceModelVersionId}\",\n" + - " \"modelName\": \"${resourceModelName}\",\n" + - " \"modelType\": \"${resourceModelType}\",\n" + - " \"modelVersion\": \"${resourceModelVersion}\",\n" + - " \"modelCustomizationName\": \"\"\n" + - " }" + requiredCandidatesJson + "\n" + - " }," - - placementDemands = sb.append(placementDemand) + } else { + + for (VnfResource vnfResource : vnfResourceList) { + utils.log("DEBUG", "VNF Resource: " + vnfResource.toString(), + isDebugEnabled) + ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() + def toscaNodeType = vnfResource.getToscaNodeType() + def resourceModuleName = toscaNodeType.substring(toscaNodeType.lastIndexOf(".") + 1) + def serviceResourceId = vnfResource.getResourceId() + def resourceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() + def resourceModelName = vnfResourceModelInfo.getModelName() + def resourceModelVersion = vnfResourceModelInfo.getModelVersion() + def resourceModelVersionId = vnfResourceModelInfo.getModelUuid() + def resourceModelType = vnfResourceModelInfo.getModelType() + def tenantId = execution.getVariable("tenantId") + def requiredCandidatesJson = "" + + + String placementDemand = + " {\n" + + " \"resourceModuleName\": \"${resourceModuleName}\",\n" + + " \"serviceResourceId\": \"${serviceResourceId}\",\n" + + " \"tenantId\": \"${tenantId}\",\n" + + " \"resourceModelInfo\": {\n" + + " \"modelInvariantId\": \"${resourceModelInvariantId}\",\n" + + " \"modelVersionId\": \"${resourceModelVersionId}\",\n" + + " \"modelName\": \"${resourceModelName}\",\n" + + " \"modelType\": \"${resourceModelType}\",\n" + + " \"modelVersion\": \"${resourceModelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }" + requiredCandidatesJson + "\n" + + " }," + + placementDemands = sb.append(placementDemand) + } + placementDemands = placementDemands.substring(0, placementDemands.length() - 1) } - placementDemands = placementDemands.substring(0, placementDemands.length() - 1) - } - /* Commenting Out Licensing as OOF doesn't support for Beijing + /* Commenting Out Licensing as OOF doesn't support for Beijing String licenseDemands = "" sb = new StringBuilder() if (vnfResourceList.isEmpty() || vnfResourceList == null) { @@ -265,50 +275,53 @@ class OofUtils { licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1) }*/ - String request = - "{\n" + - " \"requestInfo\": {\n" + - " \"transactionId\": \"${transactionId}\",\n" + - " \"requestId\": \"${requestId}\",\n" + - " \"callbackUrl\": \"${callbackUrl}\",\n" + - " \"sourceId\": \"so\",\n" + - " \"requestType\": \"${requestType}\"," + - " \"numSolutions\": 1,\n" + - " \"optimizers\": [\"placement\"],\n" + - " \"timeout\": 600\n" + - " },\n" + - " \"placementInfo\": {\n" + - " \"requestParameters\": {\n" + - " \"customerLatitude\": \"${customerLocation.customerLatitude}\",\n" + - " \"customerLongitude\": \"${customerLocation.customerLongitude}\",\n" + - " \"customerName\": \"${customerLocation.customerName}\"\n" + - " }," + - " \"subscriberInfo\": { \n" + - " \"globalSubscriberId\": \"${subscriberId}\",\n" + - " \"subscriberName\": \"${subscriberName}\",\n" + - " \"subscriberCommonSiteId\": \"${commonSiteId}\"\n" + - " },\n" + - " \"placementDemands\": [\n" + - " ${placementDemands}\n" + - " ]\n" + - " },\n" + - " \"serviceInfo\": {\n" + - " \"serviceInstanceId\": \"${serviceInstanceId}\",\n" + - " \"serviceName\": \"${serviceName}\",\n" + - " \"modelInfo\": {\n" + - " \"modelType\": \"${modelType}\",\n" + - " \"modelInvariantId\": \"${modelInvariantId}\",\n" + - " \"modelVersionId\": \"${modelVersionId}\",\n" + - " \"modelName\": \"${modelName}\",\n" + - " \"modelVersion\": \"${modelVersion}\",\n" + - " \"modelCustomizationName\": \"\"\n" + - " }\n" + - " }\n" + - "}" - - - utils.log("DEBUG", "Completed Building OOF Request", isDebugEnabled) - return request + String request = + "{\n" + + " \"requestInfo\": {\n" + + " \"transactionId\": \"${transactionId}\",\n" + + " \"requestId\": \"${requestId}\",\n" + + " \"callbackUrl\": \"${callbackUrl}\",\n" + + " \"sourceId\": \"so\",\n" + + " \"requestType\": \"${requestType}\"," + + " \"numSolutions\": 1,\n" + + " \"optimizers\": [\"placement\"],\n" + + " \"timeout\": 600\n" + + " },\n" + + " \"placementInfo\": {\n" + + " \"requestParameters\": {\n" + + " \"customerLatitude\": \"${customerLocation.customerLatitude}\",\n" + + " \"customerLongitude\": \"${customerLocation.customerLongitude}\",\n" + + " \"customerName\": \"${customerLocation.customerName}\"\n" + + " }," + + " \"subscriberInfo\": { \n" + + " \"globalSubscriberId\": \"${subscriberId}\",\n" + + " \"subscriberName\": \"${subscriberName}\",\n" + + " \"subscriberCommonSiteId\": \"${commonSiteId}\"\n" + + " },\n" + + " \"placementDemands\": [\n" + + " ${placementDemands}\n" + + " ]\n" + + " },\n" + + " \"serviceInfo\": {\n" + + " \"serviceInstanceId\": \"${serviceInstanceId}\",\n" + + " \"serviceName\": \"${serviceName}\",\n" + + " \"modelInfo\": {\n" + + " \"modelType\": \"${modelType}\",\n" + + " \"modelInvariantId\": \"${modelInvariantId}\",\n" + + " \"modelVersionId\": \"${modelVersionId}\",\n" + + " \"modelName\": \"${modelName}\",\n" + + " \"modelVersion\": \"${modelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }\n" + + " }\n" + + "}" + + + utils.log("DEBUG", "Completed Building OOF Request", isDebugEnabled) + return request + } catch (Exception ex) { + utils.log("DEBUG", "buildRequest Exception: " + ex, isDebugEnabled) + } } /** @@ -486,31 +499,29 @@ class OofUtils { * @return void */ Void createCloudSiteCatalogDb(CloudSite cloudSite, DelegateExecution execution) { - + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String endpoint = UrnPropertiesReader.getVariable("mso.catalog.db.spring.endpoint", execution) String auth = UrnPropertiesReader.getVariable("mso.db.auth", execution) - String uri = "/cloudSite" - - HttpHeaders headers = new HttpHeaders() - - headers.set(HttpHeaders.AUTHORIZATION, auth) - headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) - headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + CloudSite getCloudsite = null + + CatalogDbClient catalogDbClient = new CatalogDbClient(endpoint, auth) + try { + getCloudsite = catalogDbClient.getCloudSite(cloudSite.getId().toString()) + } catch (Exception e) { + e = null + utils.log("DEBUG", "Could not find cloudsite : " + cloudSite.getId(), isDebugEnabled) + utils.log("DEBUG", "Creating cloudSite: " + cloudSite.toString(), isDebugEnabled) + } + if (getCloudsite?.getId() != cloudSite.getId()) { + catalogDbClient.postCloudSite(cloudSite) + } + } - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(endpoint + uri) - HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers) - RESTConfig config = new RESTConfig(endpoint + uri) - RESTClient client = new RESTClient(config).addAuthorizationHeader(auth). - addHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON).addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - APIResponse response = client.httpPost(request.getBody().toString()) + String getMsbHost(DelegateExecution execution) { + String msbHost = UrnPropertiesReader.getVariable("mso.msb.host", execution, "msb-iag.onap") - int responseCode = response.getStatusCode() - logDebug("CatalogDB response code is: " + responseCode, isDebugEnabled) - String syncResponse = response.getResponseBodyAsString() - logDebug("CatalogDB response is: " + syncResponse, isDebugEnabled) + Integer msbPort = UrnPropertiesReader.getVariable("mso.msb.port", execution, "80").toInteger() - if(responseCode != 202){ - exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.") - } + return UriBuilder.fromPath("").host(msbHost).port(msbPort).scheme("http").build().toString() } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index d463fde09c..1e77c35ee3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -22,6 +22,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; @@ -84,6 +85,8 @@ import org.springframework.stereotype.Component; @Component("BBInputSetupMapperLayer") public class BBInputSetupMapperLayer { + private static final String USER_PARAM_NAME_KEY = "name"; + private static final String USER_PARAM_VALUE_KEY = "value"; private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetupMapperLayer.class); @@ -332,6 +335,10 @@ public class BBInputSetupMapperLayer { if (null != requestParameters) { context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); context.setRequestParameters(this.mapRequestParameters(requestDetails.getRequestParameters())); + context.setUserParams(this.mapNameValueUserParams(requestDetails.getRequestParameters())); + } + if (requestDetails.getConfigurationParameters() != null) { + context.setConfigurationParameters(requestDetails.getConfigurationParameters()); } return context; } @@ -344,6 +351,20 @@ public class BBInputSetupMapperLayer { requestParams.setPayload(requestParameters.getPayload()); return requestParams; } + + protected HashMap<String,String> mapNameValueUserParams(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { + HashMap<String,String> userParamsResult = new HashMap<String,String>(); + if (requestParameters.getUserParams() != null) { + List<Map<String, Object>> userParams = requestParameters.getUserParams(); + for (Map<String, Object> userParamsMap : userParams) { + if ( userParamsMap.containsKey(USER_PARAM_NAME_KEY) && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String) + && userParamsMap.containsKey(USER_PARAM_VALUE_KEY) && (userParamsMap.get(USER_PARAM_VALUE_KEY) instanceof String)) { + userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), (String) userParamsMap.get(USER_PARAM_VALUE_KEY)); + } + } + } + return userParamsResult; + } protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) { OrchestrationContext context = new OrchestrationContext(); diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml deleted file mode 100644 index 33c8cb1ac0..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ============LICENSE_START======================================================= - ONAP SO - ================================================================================ - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ============LICENSE_END========================================================= - --> - -<process-application - xmlns="http://www.camunda.org/schema/1.0/ProcessApplication" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - <process-archive name="MSOCommonBPMN"> - <properties> - <property name="isDeleteUponUndeploy">false</property> - <property name="isScanForProcessDefinitions">true</property> - </properties> - </process-archive> - -</process-application> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy new file mode 100644 index 0000000000..5058961992 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy @@ -0,0 +1,39 @@ +package org.onap.so.bpmn.common.scripts + +import static org.junit.Assert.assertEquals +import static org.mockito.Matchers.eq +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.when + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake +import org.junit.Test +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.springframework.core.env.Environment + +class AllottedResourceUtilsTest { + + + @Test + public void createARUrlTest() { + AllottedResourceUtils utils = new AllottedResourceUtils(mock(AbstractServiceTaskProcessor.class)) + DelegateExecution execution = new DelegateExecutionFake() + String allottedResourceId = "my-id" + UrnPropertiesReader reader = new UrnPropertiesReader() + Environment env = mock(Environment.class); + + when(env.getProperty(eq("mso.workflow.global.default.aai.version"))).thenReturn("14") + when(env.getProperty(eq("aai.endpoint"))).thenReturn("http://localhost:8080") + + + reader.setEnvironment(env) + + + AAIResourceUri uri = mock(AAIResourceUri.class) + when(uri.build()).thenReturn(new URI("/business/customers/customer/1/service-subscriptions/service-subscription/2/service-instances/service-instance/3")) + String actual = utils.createARUrl(execution, uri, allottedResourceId) + + assertEquals("http://localhost:8080/aai/v14/business/customers/customer/1/service-subscriptions/service-subscription/2/service-instances/service-instance/3/allotted-resources/allotted-resource/my-id", actual) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy index 1b76f5cb3f..5a01c83a80 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy @@ -77,7 +77,7 @@ class ConfirmVolumeGroupTenantTest extends MsoGroovyTest { when(mockExecution.getVariable("aicCloudRegion")).thenReturn('aicCloudRegion') when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner') when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') @@ -89,17 +89,17 @@ class ConfirmVolumeGroupTenantTest extends MsoGroovyTest { /* Mockito.verify(mockExecution, times(5)).setVariable(captor.capture(), captor.capture())*/ verify(mockExecution).setVariable("prefix", "CVGT_") verify(mockExecution).setVariable("queryVolumeGroupResponseCode", 200) - verify(mockExecution).setVariable("queryAAIVolumeGroupResponse", "<volume-group xmlns=\"http://org.openecomp.aai.inventory/v10\"><volume-group-id>17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c</volume-group-id><volume-group-name>MSOTESTVOL103a-vSAMP12_base_module-0_vol</volume-group-name><heat-stack-id>9d1f53e3-3158-44f8-8032-a6bf40bbc9db</heat-stack-id><vnf-type>pcrf-capacity</vnf-type><orchestration-status>Active</orchestration-status><resource-version>0000020</resource-version><relationship-list><relationship><related-to>tenant</related-to><relationship-data><relationship-key>cloud-region.cloud-owner</relationship-key><relationship-value>att-aic</relationship-value></relationship-data><relationship-data><relationship-key>cloud-region.cloud-region-id</relationship-key><relationship-value>RegionOne</relationship-value></relationship-data><relationship-data><relationship-key>tenant.tenant-id</relationship-key><relationship-value>22eb191dd41a4f3c9be370fc638322f4</relationship-value></relationship-data></relationship></relationship-list></volume-group>") + verify(mockExecution).setVariable("queryAAIVolumeGroupResponse", "<volume-group xmlns=\"http://org.openecomp.aai.inventory/v10\"><volume-group-id>17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c</volume-group-id><volume-group-name>MSOTESTVOL103a-vSAMP12_base_module-0_vol</volume-group-name><heat-stack-id>9d1f53e3-3158-44f8-8032-a6bf40bbc9db</heat-stack-id><vnf-type>pcrf-capacity</vnf-type><orchestration-status>Active</orchestration-status><resource-version>0000020</resource-version><relationship-list><relationship><related-to>tenant</related-to><relationship-data><relationship-key>cloud-region.cloud-owner</relationship-key><relationship-value>CloudOwner</relationship-value></relationship-data><relationship-data><relationship-key>cloud-region.cloud-region-id</relationship-key><relationship-value>RegionOne</relationship-value></relationship-data><relationship-data><relationship-key>tenant.tenant-id</relationship-key><relationship-value>22eb191dd41a4f3c9be370fc638322f4</relationship-value></relationship-data></relationship></relationship-list></volume-group>") verify(mockExecution).setVariable("tenantIdsMatch", false) verify(mockExecution).setVariable("groupNamesMatch", false) } private void mockData() { - stubFor(get(urlMatching("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/aicCloudRegion/volume-groups/volume-group/testVolumeGroupId")) + stubFor(get(urlMatching("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/aicCloudRegion/volume-groups/volume-group/testVolumeGroupId")) .willReturn(aResponse() .withStatus(200) - .withBody("<volume-group xmlns=\"http://org.openecomp.aai.inventory/v10\"><volume-group-id>17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c</volume-group-id><volume-group-name>MSOTESTVOL103a-vSAMP12_base_module-0_vol</volume-group-name><heat-stack-id>9d1f53e3-3158-44f8-8032-a6bf40bbc9db</heat-stack-id><vnf-type>pcrf-capacity</vnf-type><orchestration-status>Active</orchestration-status><resource-version>0000020</resource-version><relationship-list><relationship><related-to>tenant</related-to><relationship-data><relationship-key>cloud-region.cloud-owner</relationship-key><relationship-value>att-aic</relationship-value></relationship-data><relationship-data><relationship-key>cloud-region.cloud-region-id</relationship-key><relationship-value>RegionOne</relationship-value></relationship-data><relationship-data><relationship-key>tenant.tenant-id</relationship-key><relationship-value>22eb191dd41a4f3c9be370fc638322f4</relationship-value></relationship-data></relationship></relationship-list></volume-group>"))) + .withBody("<volume-group xmlns=\"http://org.openecomp.aai.inventory/v10\"><volume-group-id>17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c</volume-group-id><volume-group-name>MSOTESTVOL103a-vSAMP12_base_module-0_vol</volume-group-name><heat-stack-id>9d1f53e3-3158-44f8-8032-a6bf40bbc9db</heat-stack-id><vnf-type>pcrf-capacity</vnf-type><orchestration-status>Active</orchestration-status><resource-version>0000020</resource-version><relationship-list><relationship><related-to>tenant</related-to><relationship-data><relationship-key>cloud-region.cloud-owner</relationship-key><relationship-value>CloudOwner</relationship-value></relationship-data><relationship-data><relationship-key>cloud-region.cloud-region-id</relationship-key><relationship-value>RegionOne</relationship-value></relationship-data><relationship-data><relationship-key>tenant.tenant-id</relationship-key><relationship-value>22eb191dd41a4f3c9be370fc638322f4</relationship-value></relationship-data></relationship></relationship-list></volume-group>"))) } private ExecutionEntity setupMock() { diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy index dfcf69a931..968a694e11 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy @@ -287,5 +287,13 @@ class MsoUtilsTest { } } - + @Test + public void testGetLowestUnusedIndex() { + def responseAsString = getFile("vfModuleCount.xml") + def index = utils.getLowestUnusedIndex(responseAsString) + println " lowest module count test: " + println " actual - " + index + println " expected - " + "14" + assertEquals("expected vs actual", "14", index) + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java index 38be9f3790..79b0d33062 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java @@ -505,7 +505,7 @@ public class StubResponseAAI { } public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegion)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") @@ -529,7 +529,7 @@ public class StubResponseAAI { } public static void MockGetNetworkCloudRegion_404(String cloudRegion) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegion)) .willReturn(aResponse() .withStatus(404))); } @@ -722,12 +722,12 @@ public class StubResponseAAI { .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21/volume-groups/volume-group/78987")) + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/MDTWNJ21/volume-groups/volume-group/78987")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/VolumeGroup.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/78987")) + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/volume-groups/volume-group/78987")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") @@ -757,7 +757,7 @@ public class StubResponseAAI { */ public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId)) + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") @@ -772,7 +772,7 @@ public class StubResponseAAI { } public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int responseCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) .willReturn(aResponse() .withStatus(responseCode) .withHeader("Content-Type", "text/xml") @@ -780,7 +780,7 @@ public class StubResponseAAI { } public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) + stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") @@ -788,7 +788,7 @@ public class StubResponseAAI { } public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") @@ -796,19 +796,19 @@ public class StubResponseAAI { } public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) { - stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(statusCode))); } public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) { - stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) + stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) .willReturn(aResponse() .withStatus(404))); } public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) { - stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(200))); } @@ -913,7 +913,7 @@ public class StubResponseAAI { } public static void MockGetDefaultCloudRegionByCloudRegionId(String cloudRegionId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegionId + ".*")) + stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegionId + ".*")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/json; charset=utf-8") diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index 94dbbf427c..1babac68ca 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -23,6 +23,8 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; @@ -33,7 +35,6 @@ import java.util.List; import java.util.Map; import org.junit.Test; -import org.mockito.InjectMocks; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -636,4 +637,20 @@ public class BBInputSetupMapperLayerTest { assertThat(actual, sameBeanAs(expected)); } + + @Test + public void testMapNameValueUserParams() throws IOException { + RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class); + HashMap<String,String> actual = bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters()); + + assertTrue(actual.containsKey("name1")); + assertTrue(actual.containsValue("value1")); + assertTrue(actual.get("name1").equals("value1")); + assertTrue(actual.containsKey("name2")); + assertTrue(actual.containsValue("value2")); + assertTrue(actual.get("name2").equals("value2")); + assertFalse(actual.containsKey("ignore")); + assertFalse(actual.containsValue("ignore")); + } + } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index eed4b1411f..0db2f9fc12 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -118,7 +118,7 @@ public class BBInputSetupTest { private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; protected ObjectMapper mapper = new ObjectMapper(); - private static final String CLOUD_OWNER = "att-aic"; + private static final String CLOUD_OWNER = "CloudOwner"; @Spy private BBInputSetup SPY_bbInputSetup = new BBInputSetup(); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json index 60dd880040..a53ed4dfde 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json @@ -1,6 +1,7 @@ { "requestContext": { "source": "VID", + "user-params": {}, "mso-request-id": "requestId", "action": "createInstance", "requestParameters": { @@ -14,7 +15,7 @@ }, "cloudRegion": { "lcp-cloud-region-id" : "myRegionId", - "cloud-owner": "att-aic" + "cloud-owner": "CloudOwner" }, "userInput": null, "customer": { diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json index cf65143c9a..5eb9a26901 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json @@ -5,12 +5,35 @@ "requestor-id": "requestorId", "mso-request-id": "requestId", "subscription-service-type": "subscriptionServiceType", - "user-params": null, + "user-params": { + "name1": "value1", + "name2": "value2" + }, "action": "createInstance", "callback-url": "callbackURL", "requestParameters": { - "subscriptionServiceType": "subscriptionServiceType" - } + "subscriptionServiceType": "subscriptionServiceType", + "userParams": [ + { + "name": "name1", + "value": "value1" + }, + { + "name": "name2", + "value": "value2" + }, + { + "ignore": "false", + "skip": "ignore" + } + ] + }, + "configurationParameters": [ + { + "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] }, "orchContext": { "is-rollback-enabled": false diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json index 6f82a9dd75..906903e0b2 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json @@ -2,11 +2,34 @@ "product-family-id": "productFamilyId", "source": "source", "requestor-id": "requestorId", - "subscription-service-type": "subscriptionServiceType", - "user-params": null, + "subscription-service-type": "subscriptionServiceType", "action": null, "callback-url": "callbackURL", + "user-params": { + "name1": "value1", + "name2": "value2" + }, "requestParameters": { - "subscriptionServiceType": "subscriptionServiceType" - } + "subscriptionServiceType": "subscriptionServiceType", + "userParams": [ + { + "name": "name1", + "value": "value1" + }, + { + "name": "name2", + "value": "value2" + }, + { + "ignore": "false", + "skip": "ignore" + } + ] + }, + "configurationParameters": [ + { + "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json index e91875135b..9afbdd9150 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json @@ -7,7 +7,28 @@ "requestorId": "requestorId" }, "requestParameters": { - "subscriptionServiceType": "subscriptionServiceType" - } + "subscriptionServiceType": "subscriptionServiceType", + "userParams": [ + { + "name": "name1", + "value": "value1" + }, + { + "name": "name2", + "value": "value2" + }, + { + "ignore": "false", + "skip": "ignore" + } + ] + + }, + "configurationParameters": [ + { + "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml index 4167e2e87d..dff05c908a 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml @@ -11,7 +11,7 @@ <tns:related-to>tenant</tns:related-to> <tns:relationship-data> <tns:relationship-key>cloud-region.cloud-owner</tns:relationship-key> - <tns:relationship-value>att-aic</tns:relationship-value> + <tns:relationship-value>CloudOwner</tns:relationship-value> </tns:relationship-data> <tns:relationship-data> <tns:relationship-key>cloud-region.cloud-region-id</tns:relationship-key> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json index 21bacbd5ce..e3d830e978 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json @@ -547,11 +547,11 @@ }, { "related-to": "cloud-region", - "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtcnj2", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtcnj2", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -567,11 +567,11 @@ }, { "related-to": "oam-network", - "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -591,11 +591,11 @@ }, { "related-to": "oam-network", - "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -615,11 +615,11 @@ }, { "related-to": "oam-network", - "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -639,11 +639,11 @@ }, { "related-to": "availability-zone", - "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/vfModuleCount.xml b/bpmn/MSOCommonBPMN/src/test/resources/vfModuleCount.xml new file mode 100644 index 0000000000..b7dee68a77 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/vfModuleCount.xml @@ -0,0 +1,44 @@ +<vfModules> + <vf-module> + <module-index>0</module-index> + </vf-module> + <vf-module> + <module-index>1</module-index> + </vf-module> + <vf-module> + <module-index>2</module-index> + </vf-module> + <vf-module> + <module-index>3</module-index> + </vf-module> + <vf-module> + <module-index>4</module-index> + </vf-module> + <vf-module> + <module-index>5</module-index> + </vf-module> + <vf-module> + <module-index>6</module-index> + </vf-module> + <vf-module> + <module-index>7</module-index> + </vf-module> + <vf-module> + <module-index>8</module-index> + </vf-module> + <vf-module> + <module-index>9</module-index> + </vf-module> + <vf-module> + <module-index>10</module-index> + </vf-module> + <vf-module> + <module-index>11</module-index> + </vf-module> + <vf-module> + <module-index>12</module-index> + </vf-module> + <vf-module> + <module-index>13</module-index> + </vf-module> +</vfModules>
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java index 968c8c1590..750cd241e8 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java @@ -69,6 +69,10 @@ public class UrnPropertiesReader { return variableValue; } + public static String getVariable(String variableName, DelegateExecution execution, String defaultValue) { + return Optional.ofNullable(getVariable(variableName, execution)).orElse(defaultValue); + } + /** * Return the URN property value from the environment object * @param variableName URN property name diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java index ee53148e44..35f76908e3 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java @@ -927,7 +927,7 @@ public class JsonUtils { for (int i = 0; i < arr.length(); i++){ JSONObject jo = arr.getJSONObject(i); String key = jo.getString(keyNode); - String value = jo.getString(valueNode); + String value = jo.get(valueNode).toString(); map.put(key, value); } msoLogger.debug("Completed Entry Array To Map Util Method"); @@ -954,7 +954,7 @@ public class JsonUtils { for(int i = 0; i < arr.length(); i++){ JSONObject jo = arr.getJSONObject(i); String key = jo.getString(keyNode); - String value = jo.getString(valueNode); + String value = jo.get(valueNode).toString(); map.put(key, value); } msoLogger.debug("Completed Entry Array To Map Util Method"); diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java index 07523ca931..067ae9806d 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java @@ -69,7 +69,7 @@ public class JsonUtilsTest { JSONObject homingDataJson = arr.getJSONObject(0); JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); Map<String, String> map = utils.entryArrayToMap(execution, assignmentInfo.toString(), "variableName", "variableValue"); - assertEquals(map.get("cloudOwner"), "att-aic"); + assertEquals(map.get("cloudOwner"), "CloudOwner"); } @Test public void entryArrayToMapStringTest() throws IOException { @@ -80,8 +80,20 @@ public class JsonUtilsTest { JSONObject homingDataJson = arr.getJSONObject(0); JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); Map<String, String> map = utils.entryArrayToMap(assignmentInfo.toString(), "variableName", "variableValue"); - assertEquals(map.get("cloudOwner"), "att-aic"); - } + assertEquals(map.get("cloudOwner"), "CloudOwner"); + } + @Test + public void entryArrayToMapStringTestOof() throws IOException { + JsonUtils utils = new JsonUtils(); + String response = this.getJson("OofExample.json"); + String entry = JsonUtils.getJsonValue(response, "solutions.placementSolutions"); + JSONArray arr = new JSONArray(entry); + JSONArray arr2 = arr.getJSONArray(0); + JSONObject homingDataJson = arr2.getJSONObject(0); + JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); + Map<String, String> map = utils.entryArrayToMap(assignmentInfo.toString(), "key", "value"); + assertEquals(map.get("cloudOwner"), "HPA-cloud"); + } @Test public void getJsonRootPropertyTest() throws IOException { String response = this.getJson("SDNCServiceResponseExample.json"); diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/OofExample.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/OofExample.json new file mode 100644 index 0000000000..127748a5e8 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/OofExample.json @@ -0,0 +1,110 @@ +{ + "requestStatus":"completed", + "statusMessage":"", + "solutions":{ + "placementSolutions":[ + [ + { + "serviceResourceId":"78976677-bca7-446a-8b31-52b83e9aa925", + "resourceModuleName":"7400fd06C75f4a44A68f", + "solution":{ + "identifierType":"cloudRegionId", + "cloudOwner":"HPA-cloud", + "identifiers":[ + "Cloud-region3" + ] + }, + "assignmentInfo":[ + { + "value":"false", + "key":"isRehome" + }, + { + "value":"att_aic", + "key":"locationType" + }, + { + "value":"Cloud-region3", + "key":"locationId" + }, + { + "value":{ + "directives":[ + { + "directives":[ + { + "attributes":[ + { + "attribute_value":"Flavor31", + "attribute_name":"label_1" + } + ], + "type":"flavor_directives" + }, + { + "attributes":[ + { + "attribute_value":"direct", + "attribute_name":"oof_returned_vnic_type_for_firewall_protected" + } + ], + "type":"sriovNICNetwork_directives" + } + ], + "type":"vnfc", + "id":"vfw_1" + }, + { + "directives":[ + { + "attributes":[ + { + "attribute_value":"Flavor32", + "attribute_name":"label_2" + } + ], + "type":"flavor_directives" + } + ], + "type":"vnfc", + "id":"vfw_2" + }, + { + "directives":[ + { + "attributes":[ + { + "attribute_value":"Flavor32", + "attribute_name":"label_3" + } + ], + "type":"flavor_directives" + } + ], + "type":"vnfc", + "id":"vfw_3" + } + ] + }, + "key":"oof_directives" + }, + { + "value":"DLLSTX233", + "key":"cloudClli" + }, + { + "value":"75919", + "key":"aic_version" + }, + { + "value":"HPA-cloud", + "key":"cloudOwner" + } + ] + } + ] + ] + }, + "transactionId":"", + "requestId":"05da4f90-15f7-4128-8ac4-e06dc3cc06f9" +}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json index 838bcd85a7..f952302cdb 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json @@ -23,7 +23,7 @@ "variableName": "aicVersion" }, { - "variableValue": "att-aic", + "variableValue": "CloudOwner", "variableName": "cloudOwner" } ], @@ -48,7 +48,7 @@ "variableName": "aicVersion" }, { - "variableValue": "att-aic", + "variableValue": "CloudOwner", "variableName": "cloudOwner" }, { @@ -73,7 +73,7 @@ "variableName": "aicVersion" }, { - "variableValue": "att-aic", + "variableValue": "CloudOwner", "variableName": "cloudOwner" } ], @@ -94,7 +94,7 @@ "variableName": "aicVersion" }, { - "variableValue": "att-aic", + "variableValue": "CloudOwner", "variableName": "cloudOwner" } ], @@ -119,7 +119,7 @@ "variableName": "aicVersion" }, { - "variableValue": "att-aic", + "variableValue": "CloudOwner", "variableName": "cloudOwner" }, { @@ -144,7 +144,7 @@ "variableName": "aicVersion" }, { - "variableValue": "att-aic", + "variableValue": "CloudOwner", "variableName": "cloudOwner" } ], diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml index 0959173ead..911aabdaec 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml @@ -4,6 +4,7 @@ aai: timeout: '30000' endpoint: http://localhost:8443 workflowAaiDistributionDelay: PT30S + pnfEntryNotificationTimeout: P14D camunda: bpm: admin-user: @@ -15,7 +16,16 @@ camunda: core-pool-size: 3 entitymanager: packagesToScan: com - +pnf: + dmaap: + host: message-router + port: 3904 + protocol: http + uriPathPrefix: events + topicName: pnfReady + consumerGroup: consumerGroup + consumerId: consumerId + topicListenerDelayInSeconds: 5 mso: correlation: timeout: 60 @@ -127,7 +137,7 @@ mso: route-table-reference: uri: /aai/v11/network/route-table-references/route-table-reference tenant: - uri: /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + uri: /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant vce: uri: /aai/v11/network/vces/vce vpn-binding: @@ -148,14 +158,14 @@ mso: route-table-reference: uri: /aai/v8/network/route-table-references/route-table-reference tenant: - uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant vce: uri: /aai/v8/network/vces/vce vpn-binding: uri: /aai/v8/network/vpn-bindings/vpn-binding v9: cloud-region: - uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner generic-vnf: uri: /aai/v9/network/generic-vnfs/generic-vnf retry: diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java index d2dbde4843..0c88b58b72 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java @@ -468,7 +468,7 @@ public class OofHomingIT extends BaseIntegrationTest { //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId()); assertEquals(homingSolutionService("service", "service-instance-01234", - "MDTNJ01", "test-resource-id-000","att-aic", + "MDTNJ01", "test-resource-id-000","CloudOwner", "mtmnj1a", "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"", diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java index 748552623e..398efb972f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java @@ -478,7 +478,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { //logger.debug("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId()); assertEquals(homingSolutionService("service", "service-instance-01234", - "MDTNJ01", "test-resource-id-000","att-aic", + "MDTNJ01", "test-resource-id-000","CloudOwner", "mtmnj1a", "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"", diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java index f780b694aa..f3f950746c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java @@ -280,7 +280,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""), sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", "")); - assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "att-aic", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString); + assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "CloudOwner", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString); } @Test diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VfModularity/VfModule-supercool.xml index 5a2b7300b1..2d1ce54f9d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VfModularity/VfModule-supercool.xml +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -12,7 +12,7 @@ <related-to>volume-group</related-to> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VfModularity/VolumeGroup.xml index 7e913dd418..ff33ca3e07 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VfModularity/VolumeGroup.xml +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -10,7 +10,7 @@ <related-to>tenant</related-to> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml index 8a5ade6fb6..167c2fa44b 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml @@ -115,14 +115,14 @@ mso: route-table-reference: uri: /aai/v8/network/route-table-references/route-table-reference tenant: - uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant vce: uri: /aai/v8/network/vces/vce vpn-binding: uri: /aai/v8/network/vpn-bindings/vpn-binding v9: cloud-region: - uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner generic-vnf: uri: /aai/v9/network/generic-vnfs/generic-vnf global: diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml index 72462bd092..3a41801d4a 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml @@ -28,7 +28,6 @@ <property name="transactionManager" ref="transactionManager" /> <property name="databaseSchemaUpdate" value="true" /> <property name="jobExecutorActivate" value="false" /> - <!--<property name="deploymentResources" value="classpath*:*.bpmn" />--> </bean> <bean id="processEngine" class="org.camunda.bpm.engine.spring.ProcessEngineFactoryBean"> @@ -49,22 +48,21 @@ <bean id="aaiConnection" class="org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl"/> - <bean id="checkAaiForCorrelationIdDelegate" class="org.onap.so.bpmn.infrastructure.pnf.delegate.CheckAaiForCorrelationIdDelegate"> + <bean id="CheckAaiForCorrelationIdDelegate" class="org.onap.so.bpmn.infrastructure.pnf.delegate.CheckAaiForCorrelationIdDelegate"> <property name="aaiConnection" ref="aaiConnection"/> </bean> - <bean id="createAaiEntryWithPnfIdDelegate" class="org.onap.so.bpmn.infrastructure.pnf.delegate.CreateAaiEntryWithPnfIdDelegate"> + <bean id="CreateAaiEntryWithPnfIdDelegate" class="org.onap.so.bpmn.infrastructure.pnf.delegate.CreateAaiEntryWithPnfIdDelegate"> <property name="aaiConnection" ref="aaiConnection"/> </bean> - <bean id="informDmaapClient" class="org.onap.so.bpmn.infrastructure.pnf.delegate.InformDmaapClient"> - <property name="dmaapClient" ref="dmaapClient"/> + <bean id="InformDmaapClient" class="org.onap.so.bpmn.infrastructure.pnf.delegate.InformDmaapClient"> + <property name="dmaapClient" ref="DmaapClient"/> </bean> - <bean id="dmaapClient" class="org.onap.so.bpmn.infrastructure.pnf.delegate.DmaapClientTestImpl"/> + <bean id="DmaapClient" class="org.onap.so.bpmn.infrastructure.pnf.delegate.DmaapClientTestImpl"/> - - <bean id="pnfCheckInputs" class="org.onap.so.bpmn.infrastructure.pnf.delegate.PnfCheckInputs"> - <property name="defaultTimeout" value="PT1S"/> + <bean id="PnfCheckInputs" class="org.onap.so.bpmn.infrastructure.pnf.delegate.PnfCheckInputs"> + <constructor-arg value="PT1S"></constructor-arg> </bean> </beans> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn index 3355e627c3..9118b0ab5e 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn @@ -28,9 +28,11 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1jwsja5" sourceRef="Task_CreateVnf" targetRef="Task_createPlatform" /> <bpmn:sequenceFlow id="SequenceFlow_1nle8kc" sourceRef="Task_createInstanceGroups" targetRef="ExclusiveGateway_02tchpp" /> - <bpmn:sequenceFlow id="SequenceFlow_11jum90" name="no" sourceRef="ExclusiveGateway_02tchpp" targetRef="ExclusiveGateway_1blf52g" /> + <bpmn:sequenceFlow id="SequenceFlow_11jum90" name="no" sourceRef="ExclusiveGateway_02tchpp" targetRef="ExclusiveGateway_1blf52g"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("callHoming") == false}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1uiok7v" name="yes" sourceRef="ExclusiveGateway_02tchpp" targetRef="Task_callHoming"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("callHoming")}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("callHoming") == true}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0v8d14a" sourceRef="Task_callHoming" targetRef="ExclusiveGateway_1blf52g" /> <bpmn:callActivity id="Task_callHoming" name="Call Homing" calledElement="HomingBB"> @@ -65,7 +67,7 @@ <bpmn:sequenceFlow id="SequenceFlow_1i52a7x" sourceRef="StartEvent_1c3cyuv" targetRef="EndEvent_1bywujf" /> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_14mpqit" sourceRef="ExclusiveGateway_1blf52g" targetRef="Task_SDNCAdapterVnfTopologyAssign" /> - <bpmn:inclusiveGateway id="ExclusiveGateway_02tchpp" name="Call Homing?" default="SequenceFlow_11jum90"> + <bpmn:inclusiveGateway id="ExclusiveGateway_02tchpp" name="Call Homing?"> <bpmn:incoming>SequenceFlow_1nle8kc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_11jum90</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_1uiok7v</bpmn:outgoing> @@ -218,7 +220,7 @@ <bpmndi:BPMNShape id="InclusiveGateway_0x0c3kk_di" bpmnElement="ExclusiveGateway_02tchpp"> <dc:Bounds x="679" y="109" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="732" y="128" width="64" height="12" /> + <dc:Bounds x="731" y="128" width="67" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="InclusiveGateway_0ijggth_di" bpmnElement="ExclusiveGateway_1blf52g"> @@ -229,4 +231,4 @@ </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn index 344b7d8761..f775c96db0 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn @@ -1,22 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="HomingBB" name="Homing" isExecutable="true"> <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_1x9usa6</bpmn2:outgoing> </bpmn2:startEvent> - <bpmn2:scriptTask id="callSniro" name=" Call Sniro/Oof " scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0lc15i7</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* -if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")).getVariable("homingService") == "oof"){ - OofHoming oofHoming = new OofHoming() - oofHoming.callOof(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) -}else{ - SniroHomingV2 sniroHoming = new SniroHomingV2() - SniroHoming.callSniro(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) -}</bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="callSniro" /> + <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="task" /> <bpmn2:subProcess id="bpmnErrorSubprocess" name="Error Handling Subprocess" triggeredByEvent="true"> <bpmn2:endEvent id="EndEvent_07tjq3v"> <bpmn2:incoming>SequenceFlow_1rf4vs8</bpmn2:incoming> @@ -29,9 +17,9 @@ if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecu <bpmn2:scriptTask id="processMsoWorkflowException" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_00nlh7l</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1rf4vs8</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() -ex.processSubflowsBPMNException(execution)</bpmn2:script> +ex.processSubflowsBPMNException(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1rf4vs8" sourceRef="processMsoWorkflowException" targetRef="EndEvent_07tjq3v" /> <bpmn2:sequenceFlow id="SequenceFlow_00nlh7l" sourceRef="StartEvent_1qiitb2" targetRef="processMsoWorkflowException" /> @@ -40,9 +28,9 @@ ex.processSubflowsBPMNException(execution)</bpmn2:script> <bpmn2:scriptTask id="processJavaException" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0kamg53</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1o7154s</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution)</bpmn2:script> +ex.processJavaException(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:startEvent id="StartEvent_1fbpeuw"> <bpmn2:outgoing>SequenceFlow_0kamg53</bpmn2:outgoing> @@ -55,18 +43,6 @@ ex.processJavaException(execution)</bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_0kamg53" name="" sourceRef="StartEvent_1fbpeuw" targetRef="processJavaException" /> <bpmn2:sequenceFlow id="SequenceFlow_1o7154s" name="" sourceRef="processJavaException" targetRef="EndEvent_0jbvnr0" /> </bpmn2:subProcess> - <bpmn2:scriptTask id="processSniroHomingSolution" name=" Process Solution " scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1fipbmk</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_01apjvo</bpmn2:outgoing> - <bpmn2:script>import org.onap.so.bpmn.common.scripts.* -if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")).getVariable("homingService") == "oof"){ - OofHoming oofHoming = new OofHoming() - oofHoming.processHomingSolution(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) -}else{ - SniroHomingV2 sniroHoming = new SniroHomingV2 () - sniroHoming.processSolution(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), asyncResponse) -}</bpmn2:script> - </bpmn2:scriptTask> <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage"> <bpmn2:extensionElements> <camunda:in source="true" target="isDebugLogEnabled" /> @@ -76,32 +52,37 @@ if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecu <camunda:in source="asyncTimeout" target="RCVWFMSG_timeout" /> <camunda:out source="WorkflowResponse" target="asyncCallbackResponse" /> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0lc15i7</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1a2sya6</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1fipbmk</bpmn2:outgoing> </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_1fipbmk" sourceRef="receiveAsyncCallback" targetRef="processSniroHomingSolution" /> - <bpmn2:sequenceFlow id="SequenceFlow_01apjvo" sourceRef="processSniroHomingSolution" targetRef="EndEvent_0rrbz2a" /> + <bpmn2:sequenceFlow id="SequenceFlow_1fipbmk" sourceRef="receiveAsyncCallback" targetRef="ServiceTask_1smgtjf" /> <bpmn2:endEvent id="EndEvent_0rrbz2a"> - <bpmn2:incoming>SequenceFlow_01apjvo</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1yfelf5</bpmn2:incoming> <bpmn2:terminateEventDefinition /> </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_0lc15i7" sourceRef="callSniro" targetRef="receiveAsyncCallback" /> + <bpmn2:serviceTask id="task" name="Call Homing" camunda:expression="${HomingV2.callHoming(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1a2sya6</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_1a2sya6" sourceRef="task" targetRef="receiveAsyncCallback" /> + <bpmn2:serviceTask id="ServiceTask_1smgtjf" name="Process Solution" camunda:expression="${HomingV2.processSolution(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), asyncCallbackResponse)}"> + <bpmn2:incoming>SequenceFlow_1fipbmk</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1yfelf5</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_1yfelf5" sourceRef="ServiceTask_1smgtjf" targetRef="EndEvent_0rrbz2a" /> </bpmn2:process> <bpmn2:error id="Error_10hit0u" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1lwpypa" name="Java Lang Exception" errorCode="java.lang.Exception" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Homing"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="HomingBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> <dc:Bounds x="147" y="275" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0qmfpdr_di" bpmnElement="callSniro"> - <dc:Bounds x="313" y="253" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1x9usa6_di" bpmnElement="SequenceFlow_1x9usa6"> - <di:waypoint x="183" y="293" /> - <di:waypoint x="313" y="293" /> + <di:waypoint xsi:type="dc:Point" x="183" y="293" /> + <di:waypoint xsi:type="dc:Point" x="285" y="293" /> <bpmndi:BPMNLabel> - <dc:Bounds x="203" y="278" width="90" height="0" /> + <dc:Bounds x="189" y="278" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_16p12qo_di" bpmnElement="bpmnErrorSubprocess" isExpanded="true"> @@ -141,53 +122,43 @@ if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecu </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1rf4vs8_di" bpmnElement="SequenceFlow_1rf4vs8"> - <di:waypoint x="506" y="541" /> - <di:waypoint x="579" y="541" /> + <di:waypoint xsi:type="dc:Point" x="506" y="541" /> + <di:waypoint xsi:type="dc:Point" x="579" y="541" /> <bpmndi:BPMNLabel> <dc:Bounds x="498" y="526" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_00nlh7l_di" bpmnElement="SequenceFlow_00nlh7l"> - <di:waypoint x="335" y="541" /> - <di:waypoint x="363" y="541" /> - <di:waypoint x="363" y="541" /> - <di:waypoint x="406" y="541" /> + <di:waypoint xsi:type="dc:Point" x="335" y="541" /> + <di:waypoint xsi:type="dc:Point" x="363" y="541" /> + <di:waypoint xsi:type="dc:Point" x="363" y="541" /> + <di:waypoint xsi:type="dc:Point" x="406" y="541" /> <bpmndi:BPMNLabel> <dc:Bounds x="333" y="541" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kamg53_di" bpmnElement="SequenceFlow_0kamg53"> - <di:waypoint x="354" y="720" /> - <di:waypoint x="410" y="720" /> + <di:waypoint xsi:type="dc:Point" x="354" y="720" /> + <di:waypoint xsi:type="dc:Point" x="410" y="720" /> <bpmndi:BPMNLabel> <dc:Bounds x="337" y="705" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1o7154s_di" bpmnElement="SequenceFlow_1o7154s"> - <di:waypoint x="510" y="720" /> - <di:waypoint x="567" y="720" /> + <di:waypoint xsi:type="dc:Point" x="510" y="720" /> + <di:waypoint xsi:type="dc:Point" x="567" y="720" /> <bpmndi:BPMNLabel> <dc:Bounds x="494" y="705" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1aapkvq_di" bpmnElement="processSniroHomingSolution"> - <dc:Bounds x="597" y="253" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_031b5m3_di" bpmnElement="receiveAsyncCallback"> <dc:Bounds x="455" y="253" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1fipbmk_di" bpmnElement="SequenceFlow_1fipbmk"> - <di:waypoint x="555" y="293" /> - <di:waypoint x="597" y="293" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="531" y="272" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_01apjvo_di" bpmnElement="SequenceFlow_01apjvo"> - <di:waypoint x="697" y="293" /> - <di:waypoint x="860" y="293" /> + <di:waypoint xsi:type="dc:Point" x="555" y="293" /> + <di:waypoint xsi:type="dc:Point" x="625" y="293" /> <bpmndi:BPMNLabel> - <dc:Bounds x="778.5" y="272" width="0" height="12" /> + <dc:Bounds x="545" y="272" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_07i1a5x_di" bpmnElement="EndEvent_0rrbz2a"> @@ -196,13 +167,26 @@ if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecu <dc:Bounds x="877.17" y="315" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0lc15i7_di" bpmnElement="SequenceFlow_0lc15i7"> - <di:waypoint x="413" y="293" /> - <di:waypoint x="455" y="293" /> + <bpmndi:BPMNShape id="ServiceTask_06dtzr3_di" bpmnElement="task"> + <dc:Bounds x="285" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1a2sya6_di" bpmnElement="SequenceFlow_1a2sya6"> + <di:waypoint xsi:type="dc:Point" x="385" y="293" /> + <di:waypoint xsi:type="dc:Point" x="455" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="420" y="271" width="0" height="13" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1smgtjp_di" bpmnElement="ServiceTask_1smgtjf"> + <dc:Bounds x="625" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1yfelf5_di" bpmnElement="SequenceFlow_1yfelf5"> + <di:waypoint xsi:type="dc:Point" x="725" y="293" /> + <di:waypoint xsi:type="dc:Point" x="860" y="293" /> <bpmndi:BPMNLabel> - <dc:Bounds x="434" y="272" width="0" height="12" /> + <dc:Bounds x="792.5" y="271.5" width="0" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn2:definitions> +</bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index 8cda1d7c7b..3b24ba390b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true"> <bpmn:startEvent id="Start_WorkflowActionBB" name="start"> <bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing> @@ -17,6 +17,9 @@ <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="retryCount" target="retryCount" /> <camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" /> + <camunda:in source="aLaCarte" target="aLaCarte" /> + <camunda:in source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" /> + <camunda:out source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming> <bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java new file mode 100644 index 0000000000..ea0fb95702 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.job; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.execute; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; + +public class BuildingBlockValidatorRunnerTest extends BaseBPMNTest{ + @Test + public void sunnyDayActivateNetwork_Test() throws InterruptedException { + variables.put("flowToBeCalled","CreateVolumeGroupBB"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("BuildingBlockValidatorRunnerTest", variables); + assertThat(pi).isNotNull(); + + execute(job()); + execute(job()); + assertThat(pi).isStarted().hasPassedInOrder("ServiceTask_1","ServiceTask_2","ServiceTask_3"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/resources/META-INF/processes.xml b/bpmn/so-bpmn-building-blocks/src/test/resources/META-INF/processes.xml new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/resources/META-INF/processes.xml diff --git a/bpmn/so-bpmn-building-blocks/src/test/resources/subprocess/BuildingBlock/BuildingBlockValidatorRunnerTest.bpmn b/bpmn/so-bpmn-building-blocks/src/test/resources/subprocess/BuildingBlock/BuildingBlockValidatorRunnerTest.bpmn new file mode 100644 index 0000000000..446dfe3104 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/resources/subprocess/BuildingBlock/BuildingBlockValidatorRunnerTest.bpmn @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> + <bpmn:process id="BuildingBlockValidatorRunnerTest" name="BuildingBlockValidatorRunnerTest" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1"> + <bpmn:outgoing>SequenceFlow_0vof4nz</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="ServiceTask_1" name="PreValidate" camunda:expression="${BuildingBlockValidatorRunner.preValidate(flowToBeCalled, InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0vof4nz</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14nr57b</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="ServiceTask_2" name="PreValidate" camunda:expression="${BuildingBlockValidatorRunner.preValidate(flowToBeCalled, InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1vsqhv8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_04xg7yh</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0vof4nz" sourceRef="StartEvent_1" targetRef="ServiceTask_1" /> + <bpmn:endEvent id="EndEvent_1wyjfsw"> + <bpmn:incoming>SequenceFlow_06wt67a</bpmn:incoming> + </bpmn:endEvent> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1" name="RetryTimer"> + <bpmn:incoming>SequenceFlow_14nr57b</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vsqhv8</bpmn:outgoing> + <bpmn:timerEventDefinition> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT10S</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_14nr57b" sourceRef="ServiceTask_1" targetRef="IntermediateCatchEvent_1" /> + <bpmn:sequenceFlow id="SequenceFlow_1vsqhv8" sourceRef="IntermediateCatchEvent_1" targetRef="ServiceTask_2" /> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_2" name="RetryTimer"> + <bpmn:incoming>SequenceFlow_04xg7yh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0w8ajcb</bpmn:outgoing> + <bpmn:timerEventDefinition> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT10S</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:intermediateCatchEvent> + <bpmn:serviceTask id="ServiceTask_3" name="PreValidate" camunda:expression="${BuildingBlockValidatorRunner.preValidate(flowToBeCalled, InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0w8ajcb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_06wt67a</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_04xg7yh" sourceRef="ServiceTask_2" targetRef="IntermediateCatchEvent_2" /> + <bpmn:sequenceFlow id="SequenceFlow_0w8ajcb" sourceRef="IntermediateCatchEvent_2" targetRef="ServiceTask_3" /> + <bpmn:sequenceFlow id="SequenceFlow_06wt67a" sourceRef="ServiceTask_3" targetRef="EndEvent_1wyjfsw" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="BuildingBlockValidatorRunnerTest"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="320" y="131" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="293" y="167" width="90" height="20" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0k9j83h_di" bpmnElement="ServiceTask_1"> + <dc:Bounds x="435" y="109" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_06izmow_di" bpmnElement="ServiceTask_2"> + <dc:Bounds x="685" y="109" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0vof4nz_di" bpmnElement="SequenceFlow_0vof4nz"> + <di:waypoint xsi:type="dc:Point" x="356" y="149" /> + <di:waypoint xsi:type="dc:Point" x="435" y="149" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="395.5" y="128" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1wyjfsw_di" bpmnElement="EndEvent_1wyjfsw"> + <dc:Bounds x="1106" y="131" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1079" y="171" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_1xxf97p_di" bpmnElement="IntermediateCatchEvent_1"> + <dc:Bounds x="596" y="131" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="587" y="106" width="55" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_14nr57b_di" bpmnElement="SequenceFlow_14nr57b"> + <di:waypoint xsi:type="dc:Point" x="535" y="149" /> + <di:waypoint xsi:type="dc:Point" x="596" y="149" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="565.5" y="128" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1vsqhv8_di" bpmnElement="SequenceFlow_1vsqhv8"> + <di:waypoint xsi:type="dc:Point" x="632" y="149" /> + <di:waypoint xsi:type="dc:Point" x="685" y="149" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="658.5" y="128" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_1hx48zh_di" bpmnElement="IntermediateCatchEvent_2"> + <dc:Bounds x="853" y="131" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="844" y="106" width="55" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_059dhj6_di" bpmnElement="ServiceTask_3"> + <dc:Bounds x="943" y="109" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_04xg7yh_di" bpmnElement="SequenceFlow_04xg7yh"> + <di:waypoint xsi:type="dc:Point" x="785" y="149" /> + <di:waypoint xsi:type="dc:Point" x="853" y="149" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="819" y="128" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0w8ajcb_di" bpmnElement="SequenceFlow_0w8ajcb"> + <di:waypoint xsi:type="dc:Point" x="889" y="149" /> + <di:waypoint xsi:type="dc:Point" x="943" y="149" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="916" y="128" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_06wt67a_di" bpmnElement="SequenceFlow_06wt67a"> + <di:waypoint xsi:type="dc:Point" x="1043" y="149" /> + <di:waypoint xsi:type="dc:Point" x="1106" y="149" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1074.5" y="128" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy index f640aa74f7..64de29eaa9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -29,8 +29,10 @@ import org.onap.so.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MsoLogger /** @@ -47,6 +49,8 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -147,13 +151,13 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${msoUtils.xmlEncode(operType)}</operType> - <operationId>${msoUtils.xmlEncode(operationId)}</operationId> - <progress>${msoUtils.xmlEncode(progress)}</progress> - <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId> - <status>${msoUtils.xmlEncode(status)}</status> - <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEscape(operType)}</operType> + <operationId>${msoUtils.xmlEscape(operationId)}</operationId> + <progress>${msoUtils.xmlEscape(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEscape(ServiceInstanceId)}</serviceId> + <status>${msoUtils.xmlEscape(status)}</status> + <statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -162,7 +166,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } @@ -227,44 +231,44 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> - <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <vnf-id>${msoUtils.xmlEncode(networkInstanceId)}</vnf-id> + <vnf-id>${msoUtils.xmlEscape(networkInstanceId)}</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </vnf-information> <vnf-request-input> @@ -287,45 +291,45 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <allotted-resource-information> <!-- TODO: to be filled as per the request input --> - <allotted-resource-id>${msoUtils.xmlEncode(networkInstanceId)}</allotted-resource-id> + <allotted-resource-id>${msoUtils.xmlEscape(networkInstanceId)}</allotted-resource-id> <allotted-resource-type></allotted-resource-type> <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> @@ -342,43 +346,43 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> <!-- TODO: to be filled by response from create --> - <network-id>${msoUtils.xmlEncode(networkInstanceId)}</network-id> + <network-id>${msoUtils.xmlEscape(networkInstanceId)}</network-id> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index cd583f77ef..afd67c37f5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,18 +29,23 @@ import groovy.xml.XmlUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.ExternalAPIUtil -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.aai.domain.yang.SpPartner import org.onap.so.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder -import org.onap.so.rest.APIResponse +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import java.util.Map import java.util.UUID +import javax.ws.rs.core.Response import org.onap.so.logger.MsoLogger import org.camunda.bpm.engine.runtime.Execution @@ -48,13 +53,11 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64 -import org.springframework.web.util.UriUtils -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig + /** * This groovy class supports the <class>Create3rdONAPE2EServiceInstance.bpmn</class> process. - * flow for Create E2EServiceInstance in 3rdONAP + * flow for Create E2EServiceInstance in 3rdONAP */ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor { @@ -82,10 +85,10 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String resourceInputPrameters = resourceInputObj.getResourceParameters() String inputParametersJson = JsonUtils.getJsonValue(resourceInputPrameters, "requestInputs") JSONObject inputParameters = new JSONObject(inputParametersJson) - + // set local resourceInput execution.setVariable(Prefix + "ResourceInput", resourceInputObj) - + boolean is3rdONAPExist = false if(inputParameters.has("sppartner_url")) @@ -123,7 +126,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String msg = "sppartner providingServiceInvarianteUuid is blank." msoLogger.debug(msg) } - + if(inputParameters.has("sppartner_handoverMode")) { String handoverMode = inputParameters.get("sppartner_handoverMode") @@ -141,21 +144,19 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) - } catch (BpmnError e) { - throw e } catch (Exception ex){ String msg = "Exception in checkSPPartnerInfo " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void checkLocallCall (DelegateExecution execution) { msoLogger.info(" ***** Started checkLocallCall *****") try { - + //Get ResourceInput Object - ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") //uuiRequest String incomingRequest = resourceInputObj.getRequestsInputs() @@ -163,7 +164,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") JSONObject inputParameters = new JSONObject(requestInputs) execution.setVariable(Prefix + "ServiceParameters", inputParameters) - + // CallSource is added only when ONAP SO calling 3rdONAP(External API) SO(Remote call) boolean isLocalCall = true String callSource = "UUI" @@ -174,17 +175,17 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String sppartnerId = inputParameters.get("SppartnerServiceId") execution.setVariable(Prefix + "SppartnerServiceId", sppartnerId) isLocalCall = false - } + } } execution.setVariable(Prefix + "CallSource", callSource) msoLogger.debug("callSource is: " + callSource ) - + execution.setVariable("IsLocalCall", isLocalCall) } catch (Exception ex){ String msg = "Exception in checkLocallCall " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -211,7 +212,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable("serviceType", serviceType) msoLogger.info("serviceType:" + serviceType) - + String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" @@ -219,11 +220,11 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable("resourceName", resourceName) msoLogger.info("resourceName:" + resourceName) - + int beginIndex = resourceName.indexOf("_") + 1 String serviceInstanceName = resourceName.substring(beginIndex) execution.setVariable("serviceInstanceName", serviceInstanceName) - + String serviceInstanceId = resourceInputObj.getServiceInstanceId() if (isBlank(serviceInstanceId)) { msg = "Input serviceInstanceId is null" @@ -239,7 +240,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid) msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) - + String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() if (isBlank(resourceModelUuid)) { msg = "Input resourceModelUuid is null" @@ -247,7 +248,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid) msoLogger.info("resourceModelUuid:" + resourceModelUuid) - + String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceModelCustomizationUuid)) { msg = "Input resourceModelCustomizationUuid is null" @@ -256,12 +257,10 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "ResourceModelCustomizationUuid", resourceModelCustomizationUuid) msoLogger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid) - } catch (BpmnError e) { - throw e } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -300,7 +299,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void allocateCrossONAPResource(DelegateExecution execution) { msoLogger.info(" ***** Started allocateCrossONAPResource *****") - + //get TP links from AAI for SOTN handoverMode only String handoverMode = execution.getVariable(Prefix + "HandoverMode") if("SOTN".equalsIgnoreCase(handoverMode)) { @@ -318,7 +317,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso crossTPs.put("remote-access-topology-id", inputParameters.get("local-access-topology-id")); crossTPs.put("remote-access-node-id", inputParameters.get("local-access-node-id")); crossTPs.put("remote-access-ltp-id", inputParameters.get("local-access-ltp-id")); - + inputParameters.put("local-access-provider-id", crossTPs.get("local-access-provider-id")); inputParameters.put("local-access-client-id", crossTPs.get("local-access-client-id")); inputParameters.put("local-access-topology-id", crossTPs.get("local-access-topology-id")); @@ -336,17 +335,17 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso msoLogger.error("No allocated CrossONAPResource found in ServiceParameters") } } - + msoLogger.info("Exit " + allocateCrossONAPResource) } public void prepare3rdONAPRequest(DelegateExecution execution) { msoLogger.info(" ***** Started prepare3rdONAPRequest *****") - + String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String extAPIPath = sppartnerUrl + '/serviceOrder' execution.setVariable("ExternalAPIURL", extAPIPath) - + // ExternalAPI message format String externalId = execution.getVariable("resourceName") String category = "E2E Service" @@ -363,7 +362,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceState = "active" String serviceName = execution.getVariable("serviceInstanceName") String serviceUuId = execution.getVariable(Prefix + "SppartnerUUID") - + Map<String, String> valueMap = new HashMap<>() valueMap.put("externalId", '"' + externalId + '"') valueMap.put("category", '"' + category + '"') @@ -381,30 +380,30 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("serviceId", "null") //null for add valueMap.put("serviceName", '"' + serviceName + '"') valueMap.put("serviceUuId", '"' + serviceUuId + '"') - + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() - - // insert CallSource='ExternalAPI' to uuiRequest + + // insert CallSource='ExternalAPI' to uuiRequest Map<String, String> requestInputsMap = new HashMap<>() requestInputsMap.put("inputName", '"CallSource"') requestInputsMap.put("inputValue", '"ExternalAPI"') String _requestInputs_ = externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) - + requestInputsMap.clear() String serviceInstanceId = execution.getVariable(Prefix + "ServiceInstanceId") requestInputsMap.put("inputName", '"SppartnerServiceId"') requestInputsMap.put("inputValue", '"' + serviceInstanceId + '"') _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) - + requestInputsMap.clear() String serviceType = execution.getVariable("serviceType") requestInputsMap.put("inputName", '"serviceType"') requestInputsMap.put("inputValue", '"' + serviceType + '"') _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) - + // Transfer all uuiRequest incomeParameters to ExternalAPI format JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters") - for(String key : inputParameters.keySet()) { + for(String key : inputParameters.keySet()) { String inputName = key String inputValue = inputParameters.opt(key) requestInputsMap.clear() @@ -413,7 +412,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) } valueMap.put("_requestInputs_", _requestInputs_) - + String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) execution.setVariable(Prefix + "Payload", payload) msoLogger.info("Exit " + prepare3rdONAPRequest) @@ -421,29 +420,30 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void doCreateE2ESIin3rdONAP(DelegateExecution execution) { msoLogger.info(" ***** Started doCreateE2ESIin3rdONAP *****") - + try { String extAPIPath = execution.getVariable("ExternalAPIURL") String payload = execution.getVariable(Prefix + "Payload") msoLogger.debug("doCreateE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) msoLogger.debug("doCreateE2ESIin3rdONAP payload is: " + payload) - + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() + execution.setVariable("ServiceOrderId", "") - APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) + Response response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) - int responseCode = response.getStatusCode() + int responseCode = response.getStatus() execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode) msoLogger.debug("Post ServiceOrder response code is: " + responseCode) - String extApiResponse = response.getResponseBodyAsString() + String extApiResponse = response.readEntity(String.class) JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse) - + msoLogger.debug("doCreateE2ESIin3rdONAP response body is: " + extApiResponse) - + //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED + //200 OK 201 CREATED 202 ACCEPTED { msoLogger.debug("Post ServiceOrder Received a Good Response") String serviceOrderId = responseObj.get("id") @@ -455,32 +455,36 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) // exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") } - + }catch(Exception e){ + msoLogger.error("doCreateE2ESIin3rdONAP exception:" + e.getMessage()) + } + msoLogger.info("Exit " + doCreateE2ESIin3rdONAP) } - + public void getE2ESIProgressin3rdONAP(DelegateExecution execution) { msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****") - + try { + String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") - utils.log("DEBUG", "getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath, isDebugEnabled) - + msoLogger.debug("getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() - APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) + Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) - int responseCode = response.getStatusCode() + int responseCode = response.getStatus() execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode) msoLogger.debug("Get ServiceOrder response code is: " + responseCode) - String extApiResponse = response.getResponseBodyAsString() + String extApiResponse = response.readEntity(String.class) JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse) - + msoLogger.debug("getE2ESIProgressin3rdONAP create response body is: " + extApiResponse) - + //Process Response //200 OK 201 CREATED 202 ACCEPTED if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { @@ -511,7 +515,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceOrderState = item.get("state") execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable("ServiceOrderState", serviceOrderState) - + // Get serviceOrder State and process progress if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 15) @@ -539,17 +543,23 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("statusDescription", "Create Service Order Status is unknown") } } - else{ + else{ msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Get Create ServiceOrder Received a bad response") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Create ServiceOrder Received a bad response from 3rdONAP External API") - } - +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Create ServiceOrder Received a bad response from 3rdONAP External API") + } + + }catch(Exception e){ + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Get Create ServiceOrder Exception") + msoLogger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage()) + } msoLogger.info("Exit " + getE2ESIProgressin3rdONAP) } - + /** * delay 5 sec */ @@ -562,8 +572,8 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void saveSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started saveSPPartnerInAAI *****") - + msoLogger.info(" ***** Started saveSPPartnerInAAI *****") + try { String sppartnerId = execution.getVariable(Prefix + "SppartnerServiceId") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String callSource = execution.getVariable(Prefix + "CallSource") @@ -574,65 +584,33 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String resourceModelUuid = execution.getVariable(Prefix + "ResourceModelUuid") String resourceModelCustomizationUuid = execution.getVariable(Prefix + "ResourceModelCustomizationUuid") - AaiUtil aaiUriUtil = new AaiUtil() - String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution) - String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - - String payload = - """<sp-partner xmlns=\"${namespace}\"> - <id>${sppartnerId}</id> - <url>${sppartnerUrl}</url> - <callsource>${callSource}</callsource> - <model-invariant-id>${resourceModelInvariantUuid}</model-invariant-id> - <model-version-id>${resourceModelUuid}</model-version-id> - <model-customization-id>${resourceModelCustomizationUuid}</model-customization-id> - <relationship-list> - <relationship> - <related-to>service-instance</related-to> - <related-link>/aai/v14/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId}</related-link> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>${serviceInstanceId}</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </sp-partner>""".trim() - utils.logAudit(payload) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(sppartnerId,"UTF-8") - - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) - int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "PutSppartnerResponseCode", responseCode) - msoLogger.debug("Put sppartner response code is: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable(Prefix + "PutSppartnerResponse", aaiResponse) - - //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED - { - msoLogger.debug("PUT sppartner Received a Good Response") - execution.setVariable(Prefix + "SuccessIndicator", true) - } - else - { - msoLogger.debug("Put sppartner Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - + SpPartner partner = new SpPartner() + partner.setSpPartnerId(sppartnerId) + partner.setUrl(sppartnerUrl) + partner.setCallsource(callSource) + partner.setModelInvariantId(resourceModelInvariantUuid) + partner.setModelVersionId(resourceModelUuid) + partner.setModelCustomizationId(resourceModelCustomizationUuid) + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId) + client.create(uri, partner) + + AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + client.connect(uri, siUri) + } catch (Exception ex) { + String msg = "Exception in Create3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage() + msoLogger.info(msg) +// throw new BpmnError("MSOWorkflowException") + } msoLogger.info("Exit " + saveSPPartnerInAAI) } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) - } + } public void postProcess(DelegateExecution execution){ msoLogger.info(" ***** Started postProcess *****") @@ -657,7 +635,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } msoLogger.debug(" ***** Exit sendSyncResopnse *****") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy index 89a6239be7..ff9a119d6d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,28 +26,26 @@ import org.json.XML; import static org.apache.commons.lang3.StringUtils.*; import groovy.xml.XmlUtil import groovy.json.* -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.recipe.ResourceInput; -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig -import org.onap.so.rest.APIResponse; -import org.onap.so.bpmn.common.scripts.AaiUtil +import org.apache.commons.codec.binary.Base64 + /** * This groovy class supports the <class>CreateDeviceResource.bpmn</class> process. @@ -56,18 +54,18 @@ import org.onap.so.bpmn.common.scripts.AaiUtil public class CreateDeviceResource extends AbstractServiceTaskProcessor { String Prefix="CREDEVRES_" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateDeviceResource.class) public void preProcessRequest(DelegateExecution execution){ msoLogger.info(" ***** Started preProcessRequest *****") String msg = "" - try { - + try { + //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") @@ -90,10 +88,10 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { // String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") // JSONObject serviceInputParameters = new JSONObject(requestInputs) // execution.setVariable(Prefix + "ServiceParameters", serviceInputParameters) - + //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceName = resourceInputObj.getResourceInstanceName() + String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" msoLogger.error(msg) @@ -108,7 +106,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid) msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) - + String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() if (isBlank(resourceModelUuid)) { msg = "Input resourceModelUuid is null" @@ -116,7 +114,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid) msoLogger.info("resourceModelUuid:" + resourceModelUuid) - + String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceModelCustomizationUuid)) { msg = "Input resourceModelCustomizationUuid is null" @@ -127,46 +125,40 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) - - } catch (BpmnError e) { - throw e; + } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - + public void checkDevType(DelegateExecution execution){ msoLogger.info(" ***** Started checkDevType *****") try { JSONObject resourceInputParameters = execution.getVariable(Prefix + "ResourceRequestInputs") String devType = resourceInputParameters.get("device_class") - + if(StringUtils.isBlank(devType)) { devType = "OTHER" } - // support VNF as PNF, to modify - else if(StringUtils.equalsIgnoreCase(devType, "VNF")) { - devType = "PNF" - } - + execution.setVariable("device_class", devType) } catch (Exception ex){ String msg = "Exception in checkDevType " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - + private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } - + public void prepareUpdateProgress(DelegateExecution execution) { msoLogger.info(" ***** Started prepareUpdateProgress *****") ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") @@ -199,8 +191,8 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { setProgressUpdateVariables(execution, body) msoLogger.info(" ***** Exit prepareUpdateProgress *****") } - - public void getVNFTemplatefromSDC(DelegateExecution execution){ + + private void getVNFTemplatefromSDC(DelegateExecution execution){ msoLogger.info(" ***** Started getVNFTemplatefromSDC *****") try { // To do @@ -209,23 +201,110 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in getVNFTemplatefromSDC " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - - public void postVNFInfoProcess(DelegateExecution execution){ - msoLogger.info(" ***** Started postVNFInfoProcess *****") - try { - // To do + public void prepareVnfAndModulesCreate(DelegateExecution execution) { + try { + msoLogger.trace("Inside prepareVnfAndModulesCreate of CreateDeviceResource ") + + JSONObject resourceInputParameters = execution.getVariable(Prefix + "ResourceRequestInputs") + String devType = resourceInputParameters.get("device_type") + String devVersion = resourceInputParameters.get("device_version") + + //get vnf model from SDC + getVNFTemplatefromSDC(execution) + + VnfResource vnf = execution.getVariable("vnfResource") + Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") + String vnfModelInfoString = null; + + if (vnf != null) { + msoLogger.debug("getting model info for vnf # " + vnfsCreatedCount) + ModelInfo vnfModelInfo = vnf.getModelInfo() + vnfModelInfoString = vnfModelInfo.toString() + } else { + msoLogger.debug("vnf is null") + vnfModelInfoString = execution.getVariable("vnfModelInfo") + } + + msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + + // extract cloud configuration +// String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, +// "requestDetails.cloudConfiguration.lcpCloudRegionId") +// def cloudRegion = vimId.split("_") +// execution.setVariable("cloudOwner", cloudRegion[0]) +// msoLogger.debug("cloudOwner: "+ cloudRegion[0]) +// execution.setVariable("cloudRegionId", cloudRegion[1]) +// msoLogger.debug("cloudRegionId: "+ cloudRegion[1]) +// execution.setVariable("lcpCloudRegionId", cloudRegion[1]) +// msoLogger.debug("lcpCloudRegionId: "+ cloudRegion[1]) +// String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, +// "requestDetails.cloudConfiguration.tenantId") +// execution.setVariable("tenantId", tenantId) +// msoLogger.debug("tenantId: " + tenantId) + + + execution.setVariable("cloudOwner", "") + + execution.setVariable("cloudRegionId", "") + + execution.setVariable("lcpCloudRegionId", "") + + execution.setVariable("tenantId", "") + + String sdncVersion = execution.getVariable("sdncVersion") + msoLogger.debug("sdncVersion: " + sdncVersion) + + msoLogger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfCreate(DelegateExecution execution) { + + try { + msoLogger.trace("Inside validateVnfCreate of CreateDeviceResource ") + + //Update Relationship between VNF to Device + addVNFAAIRelationShip(execution) + + Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") + vnfsCreatedCount++ + + execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount) + + msoLogger.debug(" ***** Completed validateVnfCreate of CreateDeviceResource ***** " + " vnf # " + vnfsCreatedCount) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + } + } + + public void addVNFAAIRelationShip(DelegateExecution execution) { + + try { + msoLogger.trace("Inside addVNFAAIRelationShip of CreateDeviceResource ") + + + + msoLogger.debug(" ***** Completed addVNFAAIRelationShip of CreateDeviceResource ***** ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method addVNFAAIRelationShip() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + } + } - } catch (Exception ex){ - String msg = "Exception in postVNFInfoProcess " + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - public void sendSyncResponse (DelegateExecution execution) { msoLogger.debug(" *** sendSyncResponse *** ") @@ -240,7 +319,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } utils.log("DEBUG"," ***** Exit sendSyncResopnse *****") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy index 9763960bfd..848785e5f3 100755 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy @@ -165,6 +165,10 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString()) inputMap.put(userParam.name, userParam.value) } + if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { + execution.setVariable("orchestrator", userParam.value) + inputMap.put("orchestrator", userParam.value) + } } } @@ -344,6 +348,10 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString()) inputMap.put(userParam.name, userParam.value) } + if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { + execution.setVariable("orchestrator", userParam.value) + inputMap.put("orchestrator", userParam.value) + } } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 47b3cc351f..d0a3dddba9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,14 +25,21 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject import org.json.XML +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aai.domain.yang.ServiceInstances import org.onap.so.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectPlurals +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse import static org.apache.commons.lang3.StringUtils.* @@ -49,8 +56,10 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution){ - + msoLogger.info(" ***** Started preProcessRequest *****") try { @@ -208,27 +217,20 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName" String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName) - AaiUtil aaiUtil = new AaiUtil(this) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String customerUri = aaiUtil.getBusinessCustomerUri(execution) + "/" + customer - String aai_service_query_url = aai_endpoint + customerUri + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances?service-instance-name=" + parentServiceName + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer, serviceType).queryParam("service-instance-name", parentServiceName) + ServiceInstances sis = client.get(uri).asBean(ServiceInstances.class).get() + ServiceInstance si = sis.getServiceInstance().get(0) - APIResponse aaiResponse = aaiUtil.executeAAIGetCall(execution, aai_service_query_url) - def parentServiceInstanceId = getParentServiceInstnaceId(aaiResponse) - execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) - break + def parentServiceInstanceId = si.getServiceInstanceId() + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + break default: break } } - private String getParentServiceInstnaceId(APIResponse aaiResponse) { - String response = aaiResponse.getResponseBodyAsString() - def xmlResp = new XmlParser().parseText(response) - return "${xmlResp?."service-instance"[0]?."service-instance-id"[0]?.text()}" - } - /** * Pre Process the BPMN Flow Request * Includes: @@ -277,44 +279,44 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> - <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> <vnf-id></vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </vnf-information> <vnf-request-input> @@ -336,34 +338,34 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> - <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <allotted-resource-information> <!-- TODO: to be filled as per the request input --> @@ -371,11 +373,11 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <allotted-resource-type></allotted-resource-type> <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> @@ -388,44 +390,44 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { // for SDWANConnectivity and SOTNConnectivity: default: sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> @@ -450,7 +452,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } @@ -473,13 +475,13 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${msoUtils.xmlEncode(operType)}</operType> - <operationId>${msoUtils.xmlEncode(operationId)}</operationId> - <progress>${msoUtils.xmlEncode(progress)}</progress> - <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId> - <status>${msoUtils.xmlEncode(status)}</status> - <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEscape(operType)}</operType> + <operationId>${msoUtils.xmlEscape(operationId)}</operationId> + <progress>${msoUtils.xmlEscape(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEscape(ServiceInstanceId)}</serviceId> + <status>${msoUtils.xmlEscape(status)}</status> + <statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -506,13 +508,13 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${msoUtils.xmlEncode(operType)}</operType> - <operationId>${msoUtils.xmlEncode(operationId)}</operationId> - <progress>${msoUtils.xmlEncode(progress)}</progress> - <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId> - <status>${msoUtils.xmlEncode(status)}</status> - <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEscape(operType)}</operType> + <operationId>${msoUtils.xmlEscape(operationId)}</operationId> + <progress>${msoUtils.xmlEscape(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEscape(ServiceInstanceId)}</serviceId> + <status>${msoUtils.xmlEscape(status)}</status> + <statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 26f12831bd..e3702f1014 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,24 +18,23 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.*; - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig import groovy.json.* +import javax.ws.rs.core.Response +import org.onap.so.utils.TargetEntity /** * This groovy class supports the <class>DoCreateVFCNetworkServiceInstance.bpmn</class> process. @@ -46,9 +45,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { String vfcUrl = "/vfc/rest/v1/vfcadapter" - + String host = "http://mso.mso.testlab.openecomp.org:8080" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -116,7 +115,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { execution.setVariable("nsOperationKey", nsOperationKey); execution.setVariable("nsParameters", nsParameters) execution.setVariable("nsServiceModelUUID", nsServiceModelUUID); - + } catch (BpmnError e) { throw e; @@ -150,9 +149,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { "additionalParamForNs":${requestInputs} } }""" - APIResponse apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String nsInstanceId = ""; if(returnCode== "200" || returnCode == "201"){ nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId") @@ -178,9 +177,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { }""" String nsInstanceId = execution.getVariable("nsInstanceId") String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate" - APIResponse apiResponse = postRequest(execution, url, reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, url, reqBody) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String jobId = ""; if(returnCode== "200"|| returnCode == "201"){ jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") @@ -197,9 +196,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); String url = host + vfcUrl + "/jobs/" + jobId - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String operationStatus = "error" if(returnCode== "200"|| returnCode == "201"){ operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") @@ -209,12 +208,12 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { } /** - * delay 5 sec + * delay 5 sec */ public void timeDelay(DelegateExecution execution) { try { Thread.sleep(5000); - } catch(InterruptedException e) { + } catch(InterruptedException e) { msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e , "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); } } @@ -232,53 +231,17 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable("serviceInstanceId") - String addRelationPayload = """<relationship xmlns="http://org.openecomp.aai.inventory/v11"> - <related-to>service-instance</related-to> - <related-link>/aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId}</related-link> - <relationship-data> - <relationship-key>customer.global-customer-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(globalSubscriberId)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-subscription.service-type</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(serviceType)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(nsInstanceId)}</relationship-value> - </relationship-data> - </relationship>""" - String endpoint = execution.getVariable("URN_aai_endpoint") - msoLogger.info("Add Relationship req:\n" + addRelationPayload) - String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship" - APIResponse aaiRsp = executeAAIPutCall(execution, url, addRelationPayload) - msoLogger.info("aai response status code:" + aaiRsp.getStatusCode()) - msoLogger.info("aai response content:" + aaiRsp.getResponseBodyAsString()) - msoLogger.info(" *****Exit addNSRelationship *****") - } - - public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ - msoLogger.trace("Started Execute AAI Put Process ") - APIResponse apiResponse = null + + AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,nsInstanceId) + AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,serviceId) + try{ - String uuid = utils.getRequestID() - msoLogger.info("Generated uuid is: " + uuid) - msoLogger.info("URL to be used is: " + url) - String userName = execution.getVariable("URN_aai_auth") - String password = execution.getVariable("URN_mso_msoKey") - String basicAuthCred = utils.getBasicAuth(userName,password) - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpPut(payload) - msoLogger.trace("Completed Execute AAI Put Process ") + getAAIClient().connect(nsUri,relatedServiceUri) + msoLogger.info("NS relationship to Service added successfully") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while Creating NS relationship.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage(),e); throw new BpmnError("MSOWorkflowException") } - return apiResponse } /** @@ -286,23 +249,29 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ msoLogger.trace("Started Execute VFC adapter Post Process ") msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) - APIResponse apiResponse = null + Response apiResponse = null try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); - apiResponse = client.httpPost(requestBody) - msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + + URL url = new URL(urlString); + + HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + + apiResponse = httpClient.post(requestBody) + + msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) msoLogger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); throw new BpmnError("MSOWorkflowException") - } + } return apiResponse } - + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy index f13141751b..6ab03b9769 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy @@ -27,8 +27,10 @@ import org.onap.so.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MsoLogger /** @@ -44,6 +46,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution) { @@ -165,44 +169,44 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> - <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> <vnf-id>$resourceInstnaceId</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </vnf-information> <vnf-request-input> @@ -223,33 +227,33 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> <subscriber-name></subscriber-name> </service-information> <allotted-resource-information> @@ -257,11 +261,11 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor <allotted-resource-type></allotted-resource-type> <parent-service-instance-id></parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> @@ -275,42 +279,42 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> <network-id>$resourceInstnaceId</network-id> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> @@ -352,13 +356,13 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${msoUtils.xmlEncode(operType)}</operType> - <operationId>${msoUtils.xmlEncode(operationId)}</operationId> - <progress>${msoUtils.xmlEncode(progress)}</progress> - <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId> - <status>${msoUtils.xmlEncode(status)}</status> - <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEscape(operType)}</operType> + <operationId>${msoUtils.xmlEscape(operationId)}</operationId> + <progress>${msoUtils.xmlEscape(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEscape(serviceInstanceId)}</serviceId> + <status>${msoUtils.xmlEscape(status)}</status> + <statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -367,13 +371,14 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } public void postDeactivateSDNCCall(DelegateExecution execution) { - msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") + msoLogger.info(" ***** Started prepareSDNCRequest *****") + String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy index 56e5be04a5..052b28dd04 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,39 +20,32 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.json.JSONArray -import org.json.JSONObject -import org.json.XML +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response +import org.apache.commons.lang3.StringUtils import static org.apache.commons.lang3.StringUtils.* -import groovy.xml.XmlUtil +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject +import org.onap.aai.domain.yang.SpPartner +import org.onap.so.bpmn.common.recipe.ResourceInput +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.ExternalAPIUtil -import org.onap.so.bpmn.common.scripts.AaiUtil -import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.common.recipe.ResourceInput -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder -import org.onap.so.rest.APIResponse -import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory -import java.util.UUID +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MsoLogger -import org.camunda.bpm.engine.runtime.Execution -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64 -import org.springframework.web.util.UriUtils -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig - /** * This groovy class supports the <class>Delete3rdONAPE2EServiceInstance.bpmn</class> process. - * flow for Delete 3rdONAPE2EServiceInstance in 3rdONAP + * flow for Delete 3rdONAPE2EServiceInstance in 3rdONAP */ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor { @@ -79,50 +72,41 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) // set local resourceInput execution.setVariable(Prefix + "ResourceInput", resourceInputObj) - + String resourceInstanceId = resourceInputObj.getResourceInstancenUuid() String sppartnerId = resourceInstanceId execution.setVariable(Prefix + "SppartnerId", sppartnerId) - + // Get Sppartner from AAI - AaiUtil aaiUriUtil = new AaiUtil() - String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution) - String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(sppartnerId,"UTF-8") - execution.setVariable(Prefix + "ServiceAaiPath", serviceAaiPath) - getSPPartnerInAAI(execution) - + String callSource = "UUI" String sppartnerUrl = "" if(execution.hasVariable(Prefix + "CallSource")) { callSource = execution.getVariable(Prefix + "CallSource") sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") } - - boolean is3rdONAPExist = false - if(!isBlank(sppartnerUrl)) { + + boolean is3rdONAPExist = false + if(!isBlank(sppartnerUrl)) { is3rdONAPExist = true } - + execution.setVariable("Is3rdONAPExist", is3rdONAPExist) execution.setVariable(Prefix + "ServiceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) - } catch (BpmnError e) { - throw e } catch (Exception ex){ String msg = "Exception in checkSPPartnerInfoFromAAI " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void checkLocallCall (DelegateExecution execution) { msoLogger.info(" ***** Started checkLocallCall *****") - + boolean isLocalCall = true String callSource = execution.getVariable(Prefix + "CallSource") if("ExternalAPI".equalsIgnoreCase(callSource)) { @@ -136,7 +120,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String msg = "" try { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String globalSubscriberId = resourceInputObj.getGlobalSubscriberId() if (isBlank(globalSubscriberId)) { @@ -154,15 +138,15 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable("serviceType", serviceType) msoLogger.info( "serviceType:" + serviceType) - - String operationId = resourceInputObj.getOperationId() + + String operationId = resourceInputObj.getOperationId() if (isBlank(operationId)) { msg = "Input operationId is null" msoLogger.error( msg) } execution.setVariable("operationId", operationId) msoLogger.info( "operationId:" + operationId) - + String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" @@ -170,7 +154,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable("resourceName", resourceName) msoLogger.info("resourceName:" + resourceName) - + String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceTemplateId)) { msg = "Input resourceTemplateId is null" @@ -179,12 +163,10 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("resourceTemplateId", resourceTemplateId) msoLogger.info( "resourceTemplateId:" + resourceTemplateId) - } catch (BpmnError e) { - throw e } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -223,11 +205,11 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void prepare3rdONAPRequest(DelegateExecution execution) { msoLogger.info(" ***** Started prepare3rdONAPRequest *****") - + String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String extAPIPath = sppartnerUrl + '/serviceOrder' execution.setVariable("ExternalAPIURL", extAPIPath) - + // ExternalAPI message format String externalId = execution.getVariable("resourceName") String category = "E2E Service" @@ -245,10 +227,10 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceName = "" String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable(Prefix + "SppartnerId") - + queryServicefrom3rdONAP(execution) - String serviceSpecificationId = execution.getVariable(Prefix + "ServiceSpecificationId") - + String serviceSpecificationId = execution.getVariable(Prefix + "ServiceSpecificationId") + Map<String, String> valueMap = new HashMap<>() valueMap.put("externalId", '"' + externalId + '"') valueMap.put("category", '"' + category + '"') @@ -266,20 +248,21 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("serviceId", '"' + serviceId + '"') valueMap.put("serviceName", "null") valueMap.put("serviceUuId", '"' + serviceSpecificationId + '"') - + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() - + valueMap.put("_requestInputs_", "") - + String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) execution.setVariable(Prefix + "Payload", payload) msoLogger.info( "Exit " + prepare3rdONAPRequest) } - + private void queryServicefrom3rdONAP(DelegateExecution execution) { msoLogger.info(" ***** Started queryServicefrom3rdONAP *****") - + try { + String globalSubscriberId = execution.getVariable("globalSubscriberId") String SppartnerServiceId = execution.getVariable(Prefix + "SppartnerId") @@ -290,17 +273,17 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() - APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) + Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) - int responseCode = response.getStatusCode() + int responseCode = response.getStatus() execution.setVariable(Prefix + "GetServiceResponseCode", responseCode) msoLogger.debug("Get Service response code is: " + responseCode) - String extApiResponse = response.getResponseBodyAsString() + String extApiResponse = response.readEntity(String.class) - execution.setVariable(Prefix + "GetServiceResponse", extApiResponse) + execution.setVariable(Prefix + "GetServiceResponse", extApiResponse) msoLogger.debug("queryServicefrom3rdONAP response body is: " + extApiResponse) - + //Process Response //200 OK 201 CREATED 202 ACCEPTED if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { @@ -320,27 +303,30 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso msoLogger.error("Get Service Received a Bad Response Code. Response Code is: " + responseCode) // exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API") } - + }catch(Exception e) { + msoLogger.error("queryServicefrom3rdONAP exception:" + e.getMessage()) + } msoLogger.info( "Exit " + queryServicefrom3rdONAP) } public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) { msoLogger.info(" ***** Started doDeleteE2ESIin3rdONAP *****") - + try { String extAPIPath = execution.getVariable("ExternalAPIURL") String payload = execution.getVariable(Prefix + "Payload") msoLogger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) msoLogger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload) - + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() + execution.setVariable("ServiceOrderId", "") - APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) + Response response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) - int responseCode = response.getStatusCode() + int responseCode = response.getStatus() execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode) msoLogger.debug("Post ServiceOrder response code is: " + responseCode) - String extApiResponse = response.getResponseBodyAsString() + String extApiResponse = response.readEntity(String.class) JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse) @@ -358,33 +344,36 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } else{ msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") + } + }catch(Exception e) { + msoLogger.error("doDeleteE2ESIin3rdONAP exception:" + e.getMessage()) } - msoLogger.info( "Exit " + doDeleteE2ESIin3rdONAP) } - + public void getE2ESIProgressin3rdONAP(DelegateExecution execution) { msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****") - + try { + String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") msoLogger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath) - + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() - APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) + Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) - int responseCode = response.getStatusCode() + int responseCode = response.getStatus() execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode) msoLogger.debug("Get ServiceOrder response code is: " + responseCode) - String extApiResponse = response.getResponseBodyAsString() + String extApiResponse = response.readEntity(String.class) JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse) - - utils.log("DEBUG", "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse, isDebugEnabled) + + utils.log("DEBUG", "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse) //Process Response //200 OK 201 CREATED 202 ACCEPTED if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) @@ -443,17 +432,22 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("statusDescription", "Delete Service Order Status is unknown") } } - else{ + else{ msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Get Delete ServiceOrder Received a bad response") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Delete ServiceOrder Received a bad response from 3rdONAP External API") - } - +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Delete ServiceOrder Received a bad response from 3rdONAP External API") + } + }catch(Exception e) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Get Delete ServiceOrder Exception") + msoLogger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage()) + } msoLogger.info( "Exit " + getE2ESIProgressin3rdONAP) } - + /** * delay 5 sec */ @@ -466,94 +460,65 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } private void getSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started getSPPartnerInAAI *****") - - AaiUtil aaiUriUtil = new AaiUtil() - String serviceAaiPath = execution.getVariable(Prefix + "ServiceAaiPath") - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) - int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "GetSppartnerResponseCode", responseCode) - msoLogger.debug(" Get sppartner response code is: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - aaiResponse = aaiResponse.replaceAll("&", "&") - execution.setVariable(Prefix + "GetSppartnerResponse", aaiResponse) + msoLogger.info(" ***** Started getSPPartnerInAAI *****") + try { + String id = execution.getVariable(Prefix + "SppartnerId") + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, id) + SpPartner sp = client.get(uri).asBean(SpPartner.class).get() + + msoLogger.debug("GET sppartner Received a Good Response") + execution.setVariable(Prefix + "SuccessIndicator", true) + execution.setVariable(Prefix + "FoundIndicator", true) + +// String sppartnerId = sp.getSpPartnerId() +// execution.setVariable(Prefix + "SppartnerId", sppartnerId) +// msoLogger.debug(" SppartnerId is: " + sppartnerId) + String sppartnerUrl = sp.getUrl() + execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) + msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl) + String callSource = sp.getCallsource() + execution.setVariable(Prefix + "CallSource", callSource) + msoLogger.debug(" CallSource is: " + callSource) + String sppartnerVersion = sp.getResourceVersion() + execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion) + msoLogger.debug(" Resource Version is: " + sppartnerVersion) + } catch (Exception ex) { + String msg = "Exception in Delete3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage() + msoLogger.debug(msg) +// throw new BpmnError("MSOWorkflowException") + } - //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED - { - msoLogger.debug("GET sppartner Received a Good Response") - execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable(Prefix + "FoundIndicator", true) - - String sppartnerId = utils.getNodeText1(aaiResponse, "sp-partner-id") - execution.setVariable(Prefix + "SppartnerId", sppartnerId) - msoLogger.debug(" SppartnerId is: " + sppartnerId) - String sppartnerUrl = utils.getNodeText1(aaiResponse, "url") - execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) - msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl) - String callSource = utils.getNodeText1(aaiResponse, "callsource") - execution.setVariable(Prefix + "CallSource", callSource) - msoLogger.debug(" CallSource is: " + callSource) - String sppartnerVersion = utils.getNodeText1(aaiResponse, "resource-version") - execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion) - msoLogger.debug(" Resource Version is: " + sppartnerVersion) - } - else - { - msoLogger.debug("Get sppartner Received a Bad Response Code. Response Code is: " + responseCode) -// exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) -// throw new BpmnError("MSOWorkflowException") - } - msoLogger.info( "Exit " + getSPPartnerInAAI) } - + public void deleteSPPartnerInAAI(DelegateExecution execution) { msoLogger.info(" ***** Started deleteSPPartnerInAAI *****") - - String sppartnerId = execution.getVariable(Prefix + "SppartnerId") - String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") - String sppartnerVersion = execution.getVariable(Prefix + "SppartnerVersion") - - AaiUtil aaiUriUtil = new AaiUtil() - String serviceAaiPath = execution.getVariable(Prefix + "ServiceAaiPath") + "?resource-version=${sppartnerVersion}" - APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath) - int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "DeleteSppartnerResponseCode", responseCode) - msoLogger.debug(" Get sppartner response code is: " + responseCode) + try { - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable(Prefix + "DeleteSppartnerResponse", aaiResponse) + String sppartnerId = execution.getVariable(Prefix + "SppartnerId") - //Process Response - if(responseCode == 200 || responseCode == 204 ) - { - msoLogger.debug("Delete sppartner Received a Good Response") - execution.setVariable(Prefix + "SuccessIndicator", true) - } - else if(responseCode == 404){ - msoLogger.debug(" Delete sppartner Received a Not Found (404) Response") - execution.setVariable(Prefix + "FoundIndicator", false) - } - else - { - msoLogger.debug("Delete sppartner Received a Bad Response Code. Response Code is: " + responseCode) -// exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) -// throw new BpmnError("MSOWorkflowException") - } + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId) + client.delete(uri) + msoLogger.debug("Delete sppartner Received a Good Response") + execution.setVariable(Prefix + "SuccessIndicator", true) + } catch (Exception ex) { + String msg = "Exception in Delete3rdONAPE2EServiceInstance.deleteSPPartnerInAAI. " + ex.getMessage() + msoLogger.debug(msg) +// throw new BpmnError("MSOWorkflowException") + } + msoLogger.info( "Exit " + deleteSPPartnerInAAI) } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) - } + } public void postProcess(DelegateExecution execution){ msoLogger.info(" ***** Started postProcess *****") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy index cbbc5189f4..519f064802 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy @@ -33,6 +33,7 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MsoLogger import org.springframework.web.util.UriUtils; @@ -351,7 +352,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) serviceId = UriUtils.encode(serviceId,"UTF-8") - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy index 71ce28d7d3..28297976ff 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,26 +27,30 @@ import static org.apache.commons.lang3.StringUtils.*; import groovy.xml.XmlUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.aai.domain.yang.Device import org.onap.so.bpmn.common.recipe.ResourceInput; import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.onap.so.client.HttpClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import java.util.UUID; - +import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig -import org.onap.so.rest.APIResponse; -import org.onap.so.bpmn.common.scripts.AaiUtil +import javax.ws.rs.core.MediaType +import org.apache.commons.codec.binary.Base64 +import org.onap.so.utils.TargetEntity + /** * This groovy class supports the <class>DeleteDeviceResource.bpmn</class> process. @@ -95,53 +99,31 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) - } catch (BpmnError e) { - throw e; } catch (Exception ex){ String msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } private void getDeviceInAAI(DelegateExecution execution) { msoLogger.info(" ***** Started getDeviceInAAI *****") - + try { String deviceId = execution.getVariable(Prefix + "DeviceId") - AaiUtil aaiUriUtil = new AaiUtil() - String aai_uri = aaiUriUtil.getNetworkDeviceUri(execution) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(deviceId,"UTF-8") - execution.setVariable(Prefix + "ServiceAaiPath", serviceAaiPath) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) - int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "GetDeviceResponseCode", responseCode) - msoLogger.debug(" Get device response code is: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - aaiResponse = aaiResponse.replaceAll("&", "&") - execution.setVariable(Prefix + "GetDeviceResponse", aaiResponse) - - //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED - { - msoLogger.debug("GET Device Received a Good Response") - execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable(Prefix + "FoundIndicator", true) - - String devClass = utils.getNodeText1(aaiResponse, "device_class") - execution.setVariable(Prefix + "DeviceClass", devClass) - msoLogger.debug(" DeviceClass is: " + devClass) - - } - else - { - msoLogger.debug("Get DeviceInAAI Received a Bad Response Code. Response Code is: " + responseCode) - - } + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.DEVICE, deviceId) + Device dev = client.get(uri).asBean(Device.class).get() + + String devClass = dev.getClass () + execution.setVariable(Prefix + "DeviceClass", devClass) + msoLogger.debug(" DeviceClass is: " + devClass) + + } catch (Exception ex){ + String msg = "Exception in getDeviceInAAI " + ex.getMessage() + msoLogger.debug(msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } msoLogger.info(" ***** Exit getDeviceInAAI *****") } @@ -161,12 +143,12 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in checkDevType " + ex.getMessage() msoLogger.debug( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } @@ -213,7 +195,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in getVNFTemplatefromSDC " + ex.getMessage() msoLogger.debug( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -226,7 +208,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in postVNFInfoProcess " + ex.getMessage() msoLogger.debug( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -244,7 +226,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() msoLogger.debug( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } msoLogger.debug(" ***** Exit sendSyncResopnse *****") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy index b43a96bdb0..ec2fed50c3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy @@ -200,6 +200,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro try { String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") String source = execution.getVariable("source") String msoCompletionRequest = """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" @@ -209,8 +210,9 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro <action>DELETE</action> <source>${MsoUtils.xmlEscape(source)}</source> </request-info> - <aetgt:status-message>Service Instance was deleted successfully.</aetgt:status-message> - <aetgt:mso-bpel-name>DeleteGenericALaCarteServiceInstance</aetgt:mso-bpel-name> + <status-message>Service Instance was deleted successfully.</status-message> + <serviceInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceInstanceId> + <mso-bpel-name>DeleteGenericALaCarteServiceInstance</mso-bpel-name> </aetgt:MsoCompletionRequest>""" // Format Response diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 3519bd7484..6456fc3a5d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -27,8 +27,10 @@ import org.onap.so.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MsoLogger import static org.apache.commons.lang3.StringUtils.* @@ -47,6 +49,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution){ msoLogger.info(" ***** Started preProcessRequest *****") @@ -191,44 +195,44 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> - <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> <vnf-id>$resourceInstnaceId</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </vnf-information> <vnf-request-input> @@ -249,33 +253,33 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> <subscriber-name></subscriber-name> </service-information> <allotted-resource-information> @@ -283,11 +287,11 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { <allotted-resource-type></allotted-resource-type> <parent-service-instance-id></parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> @@ -301,42 +305,42 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> <network-id>$resourceInstnaceId</network-id> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEncode(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> @@ -361,7 +365,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } @@ -384,13 +388,13 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${msoUtils.xmlEncode(operType)}</operType> - <operationId>${msoUtils.xmlEncode(operationId)}</operationId> - <progress>${msoUtils.xmlEncode(progress)}</progress> - <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId> - <status>${msoUtils.xmlEncode(status)}</status> - <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEscape(operType)}</operType> + <operationId>${msoUtils.xmlEscape(operationId)}</operationId> + <progress>${msoUtils.xmlEscape(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEscape(serviceInstanceId)}</serviceId> + <status>${msoUtils.xmlEscape(status)}</status> + <statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -417,13 +421,13 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${msoUtils.xmlEncode(operType)}</operType> - <operationId>${msoUtils.xmlEncode(operationId)}</operationId> - <progress>${msoUtils.xmlEncode(progress)}</progress> - <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId> - <status>${msoUtils.xmlEncode(status)}</status> - <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEscape(operType)}</operType> + <operationId>${msoUtils.xmlEscape(operationId)}</operationId> + <progress>${msoUtils.xmlEscape(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEscape(serviceInstanceId)}</serviceId> + <status>${msoUtils.xmlEscape(status)}</status> + <statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy index 98605fea8b..75db5db0dc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy @@ -40,9 +40,6 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.common.scripts.CatalogDbUtils; import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.rest.APIResponse; -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig import java.util.List; import java.util.UUID; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index ebd622ca51..40049515db 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -28,7 +28,6 @@ import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.ServiceInstance -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.CatalogDbUtils; import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -46,7 +45,7 @@ import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse + import org.springframework.web.util.UriUtils import org.onap.so.bpmn.core.UrnPropertiesReader @@ -461,10 +460,10 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest); execution.setVariable("uuiRequest", uuiRequest) execution.setVariable("serviceDecomposition", serviceDecomposition) - + msoLogger.trace("======== COMPLETED doProcessSiteLocation Process ======== ") } - + // Allocate cross link TPs(terminal points) for sotn network only public void doTPResourcesAllocation(DelegateExecution execution){ msoLogger.trace("======== Start doTPResourcesAllocation Process ======== ") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy index 82355beed2..4f00a64ecb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy @@ -32,9 +32,6 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.rest.APIResponse; -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig import org.onap.so.logger.MsoLogger import org.onap.so.logger.MessageEnum import org.onap.so.bpmn.common.scripts.ExceptionUtil; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index 2167025e18..afdc5702d9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -261,7 +261,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction) if (resourceRecipe != null) { - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://bpmn-infra:8081") + resourceRecipe.getString("orchestrationUri") int recipeTimeOut = resourceRecipe.getInt("recipeTimeout") String recipeParamXsd = resourceRecipe.get("paramXSD") HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index 38836c3650..6d41923bdf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -94,6 +94,12 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { try { String requestId = execution.getVariable("msoRequestId") execution.setVariable("prefix", Prefix) + + def rollbackData = execution.getVariable("rollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() + } + execution.setVariable("rollbackData", rollbackData) setBasicDBAuthHeader(execution, isDebugEnabled) //Inputs @@ -409,7 +415,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex) { //start rollback set up - RollbackData rollbackData = new RollbackData() + def rollbackData = execution.getVariable("rollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() + } def disableRollback = execution.getVariable("disableRollback") rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") @@ -506,11 +515,13 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { def sdncRequestId3 = UUID.randomUUID().toString() String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId2}<", ">${sdncRequestId3}<") def rollbackData = execution.getVariable("rollbackData") - rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate) - rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete) - execution.setVariable("rollbackData", rollbackData) + if (rollbackData != null) { + rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate) + rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete) + execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + } } catch (BpmnError e) { throw e; @@ -541,8 +552,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { msoLogger.debug("Good response from SDNC Adapter for service-instance topology assign: \n" + response) def rollbackData = execution.getVariable("rollbackData") - rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true") - execution.setVariable("rollbackData", rollbackData) + if (rollbackData != null) { + rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true") + execution.setVariable("rollbackData", rollbackData) + } }else{ msoLogger.debug("Bad Response from SDNC Adapter for service-instance assign") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 10f6acd403..a3c30dcb50 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,25 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.*; - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig + +import org.onap.so.utils.TargetEntity import groovy.json.* +import javax.ws.rs.core.Response /** * This groovy class supports the <class>DoCreateVFCNetworkServiceInstance.bpmn</class> process. @@ -46,9 +45,9 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVFCNetworkServiceInstance.class); String vfcUrl = "/vfc/rest/v1/vfcadapter" - + String host = "http://mso.mso.testlab.openecomp.org:8080" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -100,7 +99,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces }""" execution.setVariable("nsOperationKey", nsOperationKey); execution.setVariable("nsParameters", nsParameters) - + } catch (BpmnError e) { throw e; @@ -127,9 +126,9 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces "nsOperationKey":${nsOperationKey}, "nsParameters":${nsParameters} }""" - APIResponse apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String nsInstanceId = ""; if(returnCode== "200" || returnCode == "201"){ nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId") @@ -155,9 +154,9 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces }""" String nsInstanceId = execution.getVariable("nsInstanceId") String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate" - APIResponse apiResponse = postRequest(execution, url, reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, url, reqBody) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String jobId = ""; if(returnCode== "200"|| returnCode == "201"){ jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") @@ -174,9 +173,9 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); String url = host + vfcUrl + "/jobs/" + jobId - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String operationStatus = "error" if(returnCode== "200"|| returnCode == "201"){ operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") @@ -186,12 +185,12 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces } /** - * delay 5 sec + * delay 5 sec */ public void timeDelay(DelegateExecution execution) { try { Thread.sleep(5000); - } catch(InterruptedException e) { + } catch(InterruptedException e) { msoLogger.debug("Time Delay exception" + e ) } } @@ -209,53 +208,17 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable("serviceId") - String addRelationPayload = """<relationship xmlns="http://org.openecomp.aai.inventory/v11"> - <related-to>service-instance</related-to> - <related-link>/aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId}</related-link> - <relationship-data> - <relationship-key>customer.global-customer-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(globalSubscriberId)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-subscription.service-type</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(serviceType)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(nsInstanceId)}</relationship-value> - </relationship-data> - </relationship>""" - String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - msoLogger.debug("Add Relationship req:\n" + addRelationPayload) - String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship" - APIResponse aaiRsp = executeAAIPutCall(execution, url, addRelationPayload) - msoLogger.debug("aai response status code:" + aaiRsp.getStatusCode()) - msoLogger.debug("aai response content:" + aaiRsp.getResponseBodyAsString()) - msoLogger.trace("Exit addNSRelationship") - } - - public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ - msoLogger.trace("Started Execute AAI Put Process") - APIResponse apiResponse = null + + AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,nsInstanceId) + AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,serviceId) + try{ - String uuid = utils.getRequestID() - msoLogger.debug("Generated uuid is: " + uuid) - msoLogger.debug("URL to be used is: " + url) - String userName = UrnPropertiesReader.getVariable("aai.auth", execution) - String password = UrnPropertiesReader.getVariable("mso.msoKey", execution) - String basicAuthCred = utils.getBasicAuth(userName,password) - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpPut(payload) - msoLogger.trace("Completed Execute AAI Put Process") + getAAIClient().connect(nsUri,relatedServiceUri) + msoLogger.info("NS relationship to Service added successfully") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") } - return apiResponse } /** @@ -263,20 +226,26 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ msoLogger.trace("Started Execute VFC adapter Post Process") - msoLogger.debug("url:"+url +"\nrequestBody:"+ requestBody) - APIResponse apiResponse = null + msoLogger.debug("url:"+urlString +"\nrequestBody:"+ requestBody) + Response apiResponse = null try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); - apiResponse = client.httpPost(requestBody) - msoLogger.debug("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + + URL url = new URL(urlString); + + HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + + apiResponse = httpClient.post(requestBody) + + msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) msoLogger.trace("Completed Execute VF-C adapter Post Process") }catch(Exception e){ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") - } + } return apiResponse } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index 238ac82c01..b30929d6bd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -503,7 +503,9 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" } } - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 21bf0f2c5c..59ea5c236f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -20,27 +20,29 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.aai.domain.yang.AllottedResource + +import javax.ws.rs.core.UriBuilder + import static org.apache.commons.lang3.StringUtils.*; import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray; -import org.json.JSONObject; import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse; + import org.springframework.web.util.UriUtils; import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.json.JSONObject @@ -371,19 +373,15 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce if (StringUtils.equalsIgnoreCase(relatedTo, "allotted-resource")) { msoLogger.info("allotted-resource exists ") - String aaiArRsp = getAaiAr(execution, relatedLink) + Optional<AllottedResource> aaiArRsp = getAaiAr(execution, relatedLink) msoLogger.info("aaiArRsp: " + aaiArRsp) - if (! isBlank(aaiArRsp)) { - def type = utils.getNodeText(aaiArRsp, "type") - def id = utils.getNodeText(aaiArRsp, "id") - def role = utils.getNodeText(aaiArRsp, "role") - def resourceVersion = utils.getNodeText(aaiArRsp, "resource-version") + if (aaiArRsp.isPresent()) { JSONObject jObject = new JSONObject() - jObject.put("resourceType", type) - jObject.put("resourceInstanceId", id) - jObject.put("resourceRole", role) - jObject.put("resourceVersion", resourceVersion) + jObject.put("resourceType", aaiArRsp.get().getType()) + jObject.put("resourceInstanceId", aaiArRsp.get().getId()) + jObject.put("resourceRole", aaiArRsp.get().getRole()) + jObject.put("resourceVersion", aaiArRsp.get().getResourceVersion()) allResources.put(jObject) msoLogger.info("allResources: " + allResources) @@ -577,27 +575,11 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce msoLogger.info("Exited " + method) } - private String getAaiAr(DelegateExecution execution, String relink) { + private Optional<AllottedResource> getAaiAr(DelegateExecution execution, String relink) { def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' msoLogger.info("Entered " + method) - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = execution.getVariable("URN_aai_endpoint") + relink - - msoLogger.debug("get AR info " + aaiEndpoint) - APIResponse response = aaiUtil.executeAAIGetCall(execution, aaiEndpoint) - - int responseCode = response.getStatusCode() - msoLogger.debug("get AR info responseCode:" + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - msoLogger.debug("get AR info " + aaiResponse) - - if(responseCode < 200 || responseCode >= 300 || isBlank(aaiResponse)) { - return null - } - - msoLogger.info("Exited " + method) - return aaiResponse + AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build()) + return getAAIClient().get(AllottedResource.class,uri) } /** * prepare Decompose next resource to create request @@ -930,12 +912,10 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://org.onap.so/requestsdb"> @@ -1002,7 +982,8 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } } } - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 66bd1ece90..a981abf011 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.scripts import static org.apache.commons.lang3.StringUtils.*; +import javax.ws.rs.core.Response import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory @@ -29,16 +30,19 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject -import org.onap.so.bpmn.common.scripts.AaiUtil + import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.rest.APIResponse +import org.onap.so.bpmn.core.UrnPropertiesReader + +import org.onap.so.utils.TargetEntity import org.onap.so.bpmn.core.json.JsonUtils -import org.springframework.web.util.UriUtils; +import org.onap.so.client.HttpClient +import org.springframework.web.util.UriUtils import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node @@ -207,7 +211,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } execution.setVariable("serviceRelationShip", jArray.toString()) - + // //test(siData) // NodeList nodeList = serviceXml.getElementsByTagName("relationship") // JSONArray jArray = new JSONArray() @@ -276,8 +280,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { // } // // for SP-Partner // }else if (e.equals("sp-partner")){ -// -// } +// +// } // } // } // execution.setVariable("serviceRelationShip", jArray.toString()) @@ -311,16 +315,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) } - + private JSONObject getRelationShipData(node, isDebugEnabled){ JSONObject jObj = new JSONObject() - + def relation = utils.nodeToString(node) def rt = utils.getNodeText(relation, "related-to") - + def rl = utils.getNodeText(relation, "related-link") utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled) - + def rl_datas = utils.getIdenticalChildren(node, "relationship-data") for(def rl_data : rl_datas) { def eKey = utils.getChildNodeText(rl_data, "relationship-key") @@ -398,7 +402,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } private void generateRelatedResourceInfo(String response, JSONObject jObj){ - + def xml = new XmlSlurper().parseText(response) def rtn = xml.childNodes() while (rtn.hasNext()) { @@ -408,26 +412,30 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { jObj.put(key, value) } } - + private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started getRelatedResourceInAAI *****", isDebugEnabled) - - AaiUtil aaiUriUtil = new AaiUtil() - String aai_endpoint = execution.getVariable("URN_aai_endpoint") + utils.log("INFO"," ***** Started getRelatedResourceInAAI *****", isDebugEnabled) + +// AaiUtil aaiUriUtil = new AaiUtil() +// String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) String urlLink = jObj.get("resourceLinkUrl") String serviceAaiPath = "${aai_endpoint}${urlLink}" - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) - int responseCode = response.getStatusCode() + + URL url = new URL(serviceAaiPath) + HttpClient client = new HttpClient(url, "application/xml", TargetEntity.AAI) + + + Response response = client.get() + int responseCode = response.getStatus() execution.setVariable(Prefix + "GeRelatedResourceResponseCode", responseCode) utils.log("DEBUG", " Get RelatedResource code is: " + responseCode, isDebugEnabled) - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - aaiResponse = aaiResponse.replaceAll("&", "&") + String aaiResponse = response.readEntity(String.class) execution.setVariable(Prefix + "GetRelatedResourceResponse", aaiResponse) - + //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED @@ -435,9 +443,9 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG", "GET RelatedResource Received a Good Response", isDebugEnabled) execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable(Prefix + "FoundIndicator", true) - + generateRelatedResourceInfo(aaiResponse, jObj) - + //get model-invariant-uuid and model-uuid String modelInvariantId = "" String modelUuid = "" @@ -447,19 +455,19 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { modelUuid = jObj.get("model-version-id") modelCustomizationId = jObj.get("model-customization-id") } - - jObj.put("modelInvariantId", modelInvariantId) - jObj.put("modelVersionId", modelUuid) + + jObj.put("modelInvariantId", modelInvariantId) + jObj.put("modelVersionId", modelUuid) jObj.put("modelCustomizationId", modelCustomizationId) } else { - utils.log("ERROR", "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + utils.log("ERROR", "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) } - + utils.log("INFO", " ***** Exit getRelatedResourceInAAI *****", isDebugEnabled) - return jObj; - + return jObj; + } public void postDecomposeService(DelegateExecution execution) { @@ -491,7 +499,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { relationShipList.each { JSONObject obj = getRelatedResourceInAAI(execution, (JSONObject)it) - + for (Resource resource : deleteResourceList) { String modelName = resource.getModelInfo().getModelName() @@ -508,10 +516,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } } } - } + } // only delete real existing resources execution.setVariable("deleteResourceList", deleteRealResourceList) + + boolean isDeleteResourceListValid = false + if(deleteRealResourceList.size() > 0) { + isDeleteResourceListValid = true + } + execution.setVariable("isDeleteResourceListValid", isDeleteResourceListValid) utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled) } catch (Exception ex) { @@ -547,8 +561,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } - - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -575,6 +589,53 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) } + + public void prepareUpdateServiceOperationStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ======== STARTED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String userId = "" + String result = execution.getVariable("result") + String progress = execution.getVariable("progress") + String reason = "" + String operationContent = execution.getVariable("operationContent") + + serviceId = UriUtils.encode(serviceId,"UTF-8") + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> + <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> + <operationType>DELETE</operationType> + <userId>${MsoUtils.xmlEscape(userId)}</userId> + <result>${MsoUtils.xmlEscape(result)}</result> + <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> + <progress>${MsoUtils.xmlEscape(progress)}</progress> + <reason>${MsoUtils.xmlEscape(reason)}</reason> + </ns:updateServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled) + } /** * post config request. diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index cf0bd3f6fe..122cc08e89 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -39,6 +39,7 @@ import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.infrastructure.properties.BPMNProperties import org.onap.so.logger.MsoLogger @@ -213,14 +214,19 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") int currentIndex = execution.getVariable("currentResourceIndex") - Resource curResource = sequencedResourceList.get(currentIndex); - - String resourceInstanceUUID = curResource.getResourceId() - String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() - execution.setVariable("resourceInstanceId", resourceInstanceUUID) - execution.setVariable("currentResource", curResource) - utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " - + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled) + if(sequencedResourceList != null && sequencedResourceList.size() > currentIndex){ + Resource curResource = sequencedResourceList.get(currentIndex); + + String resourceInstanceUUID = curResource.getResourceId() + String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() + execution.setVariable("resourceInstanceId", resourceInstanceUUID) + execution.setVariable("currentResource", curResource) + utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled) + } + else { + execution.setVariable("resourceInstanceId", "") + } utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled) } @@ -320,7 +326,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { </soapenv:Body> </soapenv:Envelope>"""; - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index 0069bf4f0a..d855479694 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,25 +18,22 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig - -import groovy.json.* +import org.onap.so.utils.TargetEntity +import javax.ws.rs.core.Response /** * This groovy class supports the <class>DoDeleteVFCNetworkServiceInstance.bpmn</class> process. * flow for E2E ServiceInstance Delete @@ -44,11 +41,11 @@ import groovy.json.* public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVFCNetworkServiceInstance.class); - + String vfcUrl = "/vfc/rest/v1/vfcadapter" - + String host = "http://mso.mso.testlab.openecomp.org:8080" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -110,55 +107,14 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable("serviceId") - String deleteRelationPayload = """<relationship xmlns="http://org.openecomp.aai.inventory/v11"> - <related-to>service-instance</related-to> - <related-link>/aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId}</related-link> - <relationship-data> - <relationship-key>customer.global-customer-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(globalSubscriberId)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-subscription.service-type</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(serviceType)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(nsInstanceId)}</relationship-value> - </relationship-data> - </relationship>""" - String endpoint = execution.getVariable("URN_aai_endpoint") - utils.log("INFO","Delete Relationship req:\n" + deleteRelationPayload, isDebugEnabled) - String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship" - - APIResponse aaiRsp = executeAAIDeleteCall(execution, url, deleteRelationPayload) - utils.log("INFO","aai response status code:" + aaiRsp.getStatusCode(), isDebugEnabled) - utils.log("INFO","aai response content:" + aaiRsp.getResponseBodyAsString(), isDebugEnabled) - utils.log("INFO"," *****Exit deleteNSRelationship *****", isDebugEnabled) - } - - public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - String uuid = utils.getRequestID() - utils.log("INFO","Generated uuid is: " + uuid, isDebugEnabled) - utils.log("INFO","URL to be used is: " + url, isDebugEnabled) - String userName = execution.getVariable("URN_aai_auth") - String password = execution.getVariable("URN_mso_msoKey") - String basicAuthCred = utils.getBasicAuth(userName,password) - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpDelete(payload) - utils.log("INFO","======== Completed Execute AAI Delete Process ======== ", isDebugEnabled) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceId) + AAIResourceUri nsServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nsInstanceId) + try { + getAAIClient().disconnect(serviceInstanceUri, nsServiceInstanceUri) }catch(Exception e){ - utils.log("ERROR","Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") + exceptionUtil.buildAndThrowWorkflowException(execution,25000,"Exception occured while NS disconnect call: " + e.getMessage()) } - return apiResponse + utils.log("INFO"," *****Exit deleteNSRelationship *****", isDebugEnabled) } /** @@ -168,16 +124,15 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces msoLogger.trace("deleteNetworkService start ") String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") - APIResponse apiResponse = deleteRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String apiResponseAsString = apiResponse.getResponseBodyAsString() + String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + Response apiResponse = deleteRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatus() String operationStatus = "error"; if(returnCode== "200" || returnCode== "202"){ operationStatus = "finished" } execution.setVariable("operationStatus", operationStatus) - + msoLogger.trace("deleteNetworkService end ") } @@ -187,16 +142,16 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces public void terminateNetworkService(DelegateExecution execution) { msoLogger.trace("terminateNetworkService start ") - String nsOperationKey = execution.getVariable("nsOperationKey") + String nsOperationKey = execution.getVariable("nsOperationKey") String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate" - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String jobId = ""; if(returnCode== "200" || returnCode== "202"){ jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") } - execution.setVariable("jobId", jobId) + execution.setVariable("jobId", jobId) msoLogger.trace("terminateNetworkService end ") } @@ -208,10 +163,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces msoLogger.trace("queryNSProgress start ") String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/jobs/" + execution.getVariable("jobId") - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String apiResponseAsString = apiResponse.getResponseBodyAsString() + String url = host + vfcUrl + "/jobs/" + execution.getVariable("jobId") + Response apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatus() + String apiResponseAsString = apiResponse.readEntity(String.class) String operationProgress = "100" if(returnCode== "200"){ operationProgress = jsonUtil.getJsonValue(apiResponseAsString, "responseDescriptor.progress") @@ -221,12 +176,12 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces } /** - * delay 5 sec + * delay 5 sec */ public void timeDelay(DelegateExecution execution) { try { Thread.sleep(5000); - } catch(InterruptedException e) { + } catch(InterruptedException e) { msoLogger.info("Time Delay exception" + e) } } @@ -243,21 +198,27 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ - msoLogger.trace("Started Execute VFC adapter Post Process ") - msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) - APIResponse apiResponse = null - try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk");; - apiResponse = client.httpPost(requestBody) - msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) - msoLogger.trace("Completed Execute VF-C adapter Post Process ") - }catch(Exception e){ + msoLogger.trace("Started Execute VFC adapter Post Process ") + msoLogger.info("url:"+urlString +"\nrequestBody:"+ requestBody) + Response apiResponse = null + try{ + URL url = new URL(urlString); + + HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + + apiResponse = httpClient.post(requestBody) + + msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) + + msoLogger.trace("Completed Execute VF-C adapter Post Process ") + }catch(Exception e){ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") - } + } return apiResponse } /** @@ -265,21 +226,24 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces * url: the url of the request * requestBody: the body of the request */ - private APIResponse deleteRequest(DelegateExecution execution, String url, String requestBody){ + private Response deleteRequest(DelegateExecution execution, String url, String requestBody){ - msoLogger.trace("Started Execute VFC adapter Delete Process ") + msoLogger.trace("Started Execute VFC adapter Delete Process ") msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) - APIResponse apiResponse = null + Response r try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); - apiResponse = client.httpDelete(requestBody) - msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) - msoLogger.trace("Completed Execute VF-C adapter Delete Process ") + + URL Url = new URL(url) + HttpClient httpClient = new HttpClient(Url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + r = httpClient.delete(requestBody) + + msoLogger.trace("Completed Execute VF-C adapter Delete Process ") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") - } - return apiResponse + } + return r } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index e06e5238c6..a99f6e993e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,12 +31,10 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution import com.fasterxml.jackson.databind.ObjectMapper - -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig -import org.onap.so.rest.APIResponse; +import javax.ws.rs.core.Response import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleResource +import org.onap.so.client.HttpClient import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleNsByStepsData import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleNsData @@ -47,6 +45,7 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.NsParameters import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.onap.so.utils.TargetEntity @@ -114,10 +113,10 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess String url = host + scaleUrl.replaceAll("\\{nsInstanceId\\}", nsInstanceId) - APIResponse apiResponse = postRequest(execution, url, reqBody) + Response apiResponse = postRequest(execution, url, reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String jobId = "" if (returnCode == "200" || returnCode == "202") { jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") @@ -156,10 +155,10 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess nsOperationKey.setOperationId(execution.getVariable("operationId")) String queryReqBody = objectToJsonStr(nsOperationKey) - APIResponse apiResponse = postRequest(execution,url, queryReqBody) + Response apiResponse = postRequest(execution,url, queryReqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String operationStatus = "error" @@ -195,16 +194,19 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ msoLogger.trace("Started Execute VFC adapter Post Process ") - msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) - APIResponse apiResponse = null + msoLogger.info("url:"+urlString +"\nrequestBody:"+ requestBody) + Response apiResponse = null try{ - RESTConfig config = new RESTConfig(url) - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") -// RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") - apiResponse = client.httpPost(requestBody) - msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + URL url = new URL(urlString); + + HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + + apiResponse = httpClient.post(requestBody) + + msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) msoLogger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VFC Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index 5b7fdb2c22..2c539a1022 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -17,14 +17,16 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri; import static org.apache.commons.lang3.StringUtils.*; import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.aai.domain.yang.ServiceInstance; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -167,7 +169,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy index 3a309cf5a2..687ac215a5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -29,6 +29,7 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.utils.UUIDChecker @@ -259,7 +260,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 20ced72002..4127c3a913 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -36,6 +36,7 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.AAIResultWrapper @@ -152,8 +153,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationType", "update") execution.setVariable("hasResourcetoUpdate", false) - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -247,7 +246,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) @@ -308,11 +307,10 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://org.onap.so/requestsdb"> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index b7f31d7823..0f9a0ad292 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -29,10 +29,13 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VfModuleBase import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse -import org.springframework.web.util.UriUtils class UpdateVfModuleVolume extends VfModuleBase { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleVolume.class); @@ -172,14 +175,15 @@ class UpdateVfModuleVolume extends VfModuleBase { try { def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') - def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + - '/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/' + UriUtils.encode(aicCloudRegion, "UTF-8") + - '/volume-groups/volume-group/' + UriUtils.encode(volumeGroupId, "UTF-8") + + AaiUtil aaiUtil = new AaiUtil(this) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId) + String endPoint = aaiUtil.createAaiUri(uri) + msoLogger.debug('Sending GET to AAI endpoint \'' + endPoint + '\'') msoLogger.debug("UpdateVfModuleVolume sending GET for quering AAI endpoint: " + endPoint) - AaiUtil aaiUtil = new AaiUtil(this) APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) def int statusCode = response.getStatusCode() def responseData = response.getResponseBodyAsString() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index beac679691..187189c694 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -176,17 +176,30 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("subscriberInfo", subscriberInfo) msoLogger.debug("Incoming subscriberInfo is: " + subscriberInfo) - // extract cloud configuration, split vid_ID into cloudOwner and cloudRegionId + // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") - def cloudRegion = vimId.split("_") - def cloudOwner = cloudRegion[0].toString() - def cloudRegionId = cloudRegion[1].toString() - execution.setVariable("cloudOwner", cloudOwner) - utils.log("DEBUG","cloudOwner: " + cloudOwner, isDebugEnabled) - execution.setVariable("cloudRegionId", cloudRegionId) - utils.log("DEBUG","cloudRegionId: " + cloudRegionId, isDebugEnabled) - + if (vimId.contains("_") && vimId.split("_").length == 2 ) { + def cloudRegion = vimId.split("_") + def cloudOwner = cloudRegion[0] + def cloudRegionId = cloudRegion[1] + execution.setVariable("cloudOwner", cloudOwner) + msoLogger.debug("cloudOwner: " + cloudOwner) + execution.setVariable("cloudRegionId", cloudRegionId) + msoLogger.debug("cloudRegionId: " + cloudRegionId) + } else { + msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") + String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.cloudOwner") + if (!cloudOwner?.empty && cloudOwner != "") + { + execution.setVariable("cloudOwner", cloudOwner) + msoLogger.debug("cloudOwner: " + cloudOwner) + } + def cloudRegionId = vimId + execution.setVariable("cloudRegionId", cloudRegionId) + msoLogger.debug("cloudRegionId: " + cloudRegionId) + } /* * Extracting User Parameters from incoming Request and converting into a Map */ @@ -237,6 +250,10 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("callHoming", true) inputMap.put("Homing_Solution", userParam.value) } + if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { + execution.setVariable("orchestrator", userParam.value) + inputMap.put("orchestrator", userParam.value) + } } } @@ -592,16 +609,32 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) - // extract cloud configuration + // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") - def cloudRegion = vimId.split("_") - execution.setVariable("cloudOwner", cloudRegion[0]) - msoLogger.debug("cloudOwner: "+ cloudRegion[0]) - execution.setVariable("cloudRegionId", cloudRegion[1]) - msoLogger.debug("cloudRegionId: "+ cloudRegion[1]) - execution.setVariable("lcpCloudRegionId", cloudRegion[1]) - msoLogger.debug("lcpCloudRegionId: "+ cloudRegion[1]) + if (vimId.contains("_") && vimId.split("_").length == 2 ) { + def cloudRegion = vimId.split("_") + execution.setVariable("cloudOwner", cloudRegion[0]) + msoLogger.debug("cloudOwner: " + cloudRegion[0]) + execution.setVariable("cloudRegionId", cloudRegion[1]) + msoLogger.debug("cloudRegionId: " + cloudRegion[1]) + execution.setVariable("lcpCloudRegionId", cloudRegion[1]) + msoLogger.debug("lcpCloudRegionId: " + cloudRegion[1]) + } else { + msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") + String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.cloudOwner") + if (!cloudOwner?.empty && cloudOwner != "") + { + execution.setVariable("cloudOwner", cloudOwner) + msoLogger.debug("cloudOwner: " + cloudOwner) + } + execution.setVariable("cloudRegionId", vimId) + msoLogger.debug("cloudRegionId: " + vimId) + execution.setVariable("lcpCloudRegionId", vimId) + msoLogger.debug("lcpCloudRegionId: " + vimId) + } + String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId") execution.setVariable("tenantId", tenantId) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 3c08779513..723bfd54d7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -240,11 +240,9 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ if(obj.has("result-data")){ JSONObject ob = obj.getJSONArray("result-data").getJSONObject(0) String resourceLink = ob.getString("resource-link") + AAIResourceUri siUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, new URI(resourceLink)) - String[] split = resourceLink.split("/aai/") - String siRelatedLink = "/aai/" + split[1] - - execution.setVariable("PSI_resourceLink", resourceLink) + execution.setVariable("PSI_resourceLink", siUri) }else{ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") } @@ -277,27 +275,11 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ //AAI PUT AaiUtil aaiUriUtil = new AaiUtil(this) - String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String siResourceLink= execution.getVariable("PSI_resourceLink") - - String siUri = "" - msoLogger.debug("PSI_resourceLink:" + siResourceLink) - - if(!isBlank(siResourceLink)) { - msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - siUri = "/aai/" + split[1] - } - else - { - msg = "Parent Service Link in AAI is null" - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink") + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + arUrl = arUtils.createARUrl(execution, siResourceLink, allottedResourceId) execution.setVariable("aaiARPath", arUrl) - msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl) + msoLogger.debug("PUT AllottedResource AAI URL is:\n" + arUrl) String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index 5f9b4b8ecd..ef5660c081 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -20,23 +20,22 @@ package org.onap.so.bpmn.vcpe.scripts; +import static org.apache.commons.lang3.StringUtils.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.*; -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.core.RollbackData -import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.rest.APIResponse - -import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils; -import static org.apache.commons.lang3.StringUtils.* - +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse /** * This groovy class supports the <class>DoCreateAllottedResourceTXC.bpmn</class> process. @@ -204,27 +203,11 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ //AAI PUT AaiUtil aaiUriUtil = new AaiUtil(this) - String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String siResourceLink= execution.getVariable("PSI_resourceLink") - - String siUri = "" - msoLogger.debug("PSI_resourceLink:" + siResourceLink) - - if(!isBlank(siResourceLink)) { - msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - siUri = "/aai/" + split[1] - } - else - { - msg = "Parent Service Link in AAI is null" - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink") + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + arUrl = arUtils.createARUrl(execution, siResourceLink, allottedResourceId) execution.setVariable("aaiARPath", arUrl) - msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl) + msoLogger.debug("PUT AllottedResource AAI URL is:\n" + arUrl) String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java index a92fad2e5f..8bba435d0c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java @@ -25,7 +25,9 @@ import java.util.UUID; import org.onap.aai.domain.yang.Pnf; import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; import org.onap.so.client.aai.AAIRestClientImpl; +import org.springframework.stereotype.Component; +@Component public class AaiConnectionImpl implements AaiConnection { @Override diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java index a10267e666..05109abc84 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java @@ -24,7 +24,9 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +@Component public class CancelDmaapSubscription implements JavaDelegate { private DmaapClient dmaapClient; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java index 12ddf8465e..b49c4211b1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java @@ -20,12 +20,10 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; import java.io.IOException; -import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.common.scripts.ExceptionUtil; @@ -34,6 +32,7 @@ import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiResponse; import org.onap.so.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /** * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn @@ -46,6 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired; * - aaiContainsInfoAboutIp - local Boolean */ +@Component public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, CheckAaiForCorrelationIdDelegate.class); private CheckAaiForCorrelationIdImplementation implementation = new CheckAaiForCorrelationIdImplementation(); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java index ec1ef21028..a8754cd4a0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java @@ -27,6 +27,7 @@ import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.aai.domain.yang.Pnf; import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /** * Implementation of "Create AAI entry with pnf-id = correlation_id" task in CreateAndActivatePnfResource.bpmn @@ -34,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired; * Inputs: * - correlationId - String */ +@Component public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate { private AaiConnection aaiConnection; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java index 61b1ca4cae..1a75b0998c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -25,7 +25,9 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +@Component public class InformDmaapClient implements JavaDelegate { private DmaapClient dmaapClient; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java index d210e5e64f..164f51f579 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -27,13 +27,22 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +@Component public class PnfCheckInputs implements JavaDelegate { private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class); private String defaultTimeout; + @Autowired + public PnfCheckInputs(@Value("${aai.pnfEntryNotificationTimeout}") String defaultTimeout) { + this.defaultTimeout = defaultTimeout; + } + @Override public void execute(DelegateExecution execution) { String correlationId = (String) execution.getVariable(CORRELATION_ID); @@ -51,7 +60,4 @@ public class PnfCheckInputs implements JavaDelegate { } } - public void setDefaultTimeout(String defaultTimeout) { - this.defaultTimeout = defaultTimeout; - } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java index 90b48ab2c1..159298b4ad 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,41 +33,32 @@ import java.util.Spliterator; public final class JsonUtilForCorrelationId { - private static final String JSON_HEADER = "pnfRegistrationFields"; private static final String JSON_CORRELATION_ID_FIELD_NAME = "correlationId"; static List<String> parseJsonToGelAllCorrelationId(String json) { - List<String> list = new ArrayList<>(); JsonElement je = new JsonParser().parse(json); - if (je.isJsonObject()) { - getCorrelationIdFromJsonObject(je.getAsJsonObject()).ifPresent(corr -> list.add(corr)); - } else { - JsonArray array = je.getAsJsonArray(); - Spliterator<JsonElement> spliterator = array.spliterator(); - spliterator.forEachRemaining(jsonElement -> { - parseJsonElementToJsonObject(jsonElement) - .ifPresent(jsonObject -> getCorrelationIdFromJsonObject(jsonObject) - .ifPresent(correlationId -> list.add(correlationId))); - }); - } + JsonArray array = je.getAsJsonArray(); + List<String> list = new ArrayList<>(); + Spliterator<JsonElement> spliterator = array.spliterator(); + spliterator.forEachRemaining(jsonElement -> { + handleEscapedCharacters(jsonElement) + .ifPresent(jsonObject -> getCorrelationId(jsonObject) + .ifPresent(correlationId -> list.add(correlationId))); + }); return list; } - private static Optional<JsonObject> parseJsonElementToJsonObject(JsonElement jsonElement) { + private static Optional<JsonObject> handleEscapedCharacters(JsonElement jsonElement) { if (jsonElement.isJsonObject()) { return Optional.ofNullable(jsonElement.getAsJsonObject()); } return Optional.ofNullable(new JsonParser().parse(jsonElement.getAsString()).getAsJsonObject()); } - private static Optional<String> getCorrelationIdFromJsonObject(JsonObject jsonObject) { - if (jsonObject.has(JSON_HEADER)) { - JsonObject jo = jsonObject.getAsJsonObject(JSON_HEADER); - if (jo.has(JSON_CORRELATION_ID_FIELD_NAME)) { - return Optional.ofNullable(jo.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString()); - } + private static Optional<String> getCorrelationId(JsonObject jsonObject) { + if (jsonObject.has(JSON_CORRELATION_ID_FIELD_NAME)) { + return Optional.ofNullable(jsonObject.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString()); } return Optional.empty(); } - } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java index 70323b726c..373e84bb9d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -21,16 +23,13 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; import java.io.IOException; -import java.net.URI; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; - import javax.ws.rs.core.UriBuilder; - import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; @@ -38,43 +37,35 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component -@Scope("prototype") public class PnfEventReadyDmaapClient implements DmaapClient { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class); + private static final MsoLogger LOGGER = MsoLogger + .getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class); - private final Environment env; private HttpClient httpClient; - private String dmaapHost; - private int dmaapPort; - private String dmaapProtocol; - private String dmaapUriPathPrefix; - private String dmaapTopicName; - private String consumerId; - private String consumerGroup; private Map<String, Runnable> pnfCorrelationIdToThreadMap; private HttpGet getRequest; - private int dmaapClientDelayInSeconds; + private int topicListenerDelayInSeconds; private volatile ScheduledThreadPoolExecutor executor; private volatile boolean dmaapThreadListenerIsRunning; @Autowired public PnfEventReadyDmaapClient(Environment env) { - this.env = env; - } - - public void init() { httpClient = HttpClientBuilder.create().build(); pnfCorrelationIdToThreadMap = new ConcurrentHashMap<>(); - dmaapHost = env.getProperty("pnf.dmaap.host"); - dmaapPort = env.getProperty("pnf.dmaap.port", Integer.class); + topicListenerDelayInSeconds = env.getProperty("pnf.dmaap.topicListenerDelayInSeconds", Integer.class); executor = null; - getRequest = new HttpGet(buildURI()); + getRequest = new HttpGet(UriBuilder.fromUri(env.getProperty("pnf.dmaap.uriPathPrefix")) + .scheme(env.getProperty("pnf.dmaap.protocol")) + .host(env.getProperty("pnf.dmaap.host")) + .port(env.getProperty("pnf.dmaap.port", Integer.class)) + .path(env.getProperty("pnf.dmaap.topicName")) + .path(env.getProperty("pnf.dmaap.consumerGroup")) + .path(env.getProperty("pnf.dmaap.consumerId")).build()); } @Override @@ -102,7 +93,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient { executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0, - dmaapClientDelayInSeconds, TimeUnit.SECONDS); + topicListenerDelayInSeconds, TimeUnit.SECONDS); dmaapThreadListenerIsRunning = true; } } @@ -115,38 +106,6 @@ public class PnfEventReadyDmaapClient implements DmaapClient { } } - private URI buildURI() { - return UriBuilder.fromUri(dmaapUriPathPrefix) - .scheme(dmaapProtocol) - .host(dmaapHost) - .port(dmaapPort).path(dmaapTopicName) - .path(consumerGroup).path(consumerId).build(); - } - - public void setDmaapProtocol(String dmaapProtocol) { - this.dmaapProtocol = dmaapProtocol; - } - - public void setDmaapUriPathPrefix(String dmaapUriPathPrefix) { - this.dmaapUriPathPrefix = dmaapUriPathPrefix; - } - - public void setDmaapTopicName(String dmaapTopicName) { - this.dmaapTopicName = dmaapTopicName; - } - - public void setConsumerId(String consumerId) { - this.consumerId = consumerId; - } - - public void setConsumerGroup(String consumerGroup) { - this.consumerGroup = consumerGroup; - } - - public void setDmaapClientDelayInSeconds(int dmaapClientDelayInSeconds) { - this.dmaapClientDelayInSeconds = dmaapClientDelayInSeconds; - } - class DmaapTopicListenerThread implements Runnable { @Override diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java index 60f109a81f..0d7c4abeee 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.properties; import java.util.Arrays; import java.util.List; +import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.logger.MsoLogger; @@ -37,7 +38,7 @@ public class BPMNProperties { } public static List<String> getResourceSequenceProp(String input) { - String resourceSequence = getProperty("mso.workflow.custom." + input + ".resource.sequence", null); + String resourceSequence = UrnPropertiesReader.getVariable("mso.workflow.custom."+ input + ".resource.sequence"); if (resourceSequence != null) { return Arrays.asList(resourceSequence.split(",")); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy index 0a1f8f2859..11dbf7d2ee 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy @@ -1126,10 +1126,10 @@ String queryIdAIIResponse_SRIOV = <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn16/tenants/tenant/6accefef3cb442ff9e644d589fb04107</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn16/tenants/tenant/6accefef3cb442ff9e644d589fb04107</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -1146,10 +1146,10 @@ String queryIdAIIResponse_SRIOV = </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn16</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn16</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -1238,7 +1238,7 @@ String queryIdAIIResponse_SRIOV = <relationship-list> <relationship> <related-to>cloud-region</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/ + <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/ </related-link> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -1246,7 +1246,7 @@ String queryIdAIIResponse_SRIOV = </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <related-to-property> <property-key>cloud-region.owner-defined-type</property-key> @@ -1255,7 +1255,7 @@ String queryIdAIIResponse_SRIOV = </relationship> <relationship> <related-to>tenant</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/</related-link> + <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>4ae1d3446a4c48b2bec44b6cfba06d68 @@ -1263,7 +1263,7 @@ String queryIdAIIResponse_SRIOV = </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -3623,9 +3623,9 @@ String sdncAdapterWorkflowAssignResponse = when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedvIPRNetworkRequest) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") // when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") @@ -3659,9 +3659,9 @@ String sdncAdapterWorkflowAssignResponse = when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedvIPRNetworkRequest) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") // when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") @@ -3695,9 +3695,9 @@ String sdncAdapterWorkflowAssignResponse = when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - //old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + //old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") // when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy index 1a2d16d9d0..7f55eb3dcb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy @@ -730,10 +730,10 @@ String aaiWorkflowException = </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/</related-link> + <related-link>cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RDM2WAGPLCP/</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -1697,9 +1697,9 @@ String sdncAdapterWorkflowFormattedResponse_404 = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("RDM2WAGPLCP") when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -1727,9 +1727,9 @@ String sdncAdapterWorkflowFormattedResponse_404 = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestCloudRegionNotFound) when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("MDTWNJ21") when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -1759,9 +1759,9 @@ String sdncAdapterWorkflowFormattedResponse_404 = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("RDM2WAGPLCP") when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") // when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy index de3db5b5a8..14dd10fc49 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy @@ -736,7 +736,7 @@ String expectedNetworkInputsMissingNetworkId = <relationship-list> <relationship> <related-to>cloud-region</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/ + <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/ </related-link> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -744,7 +744,7 @@ String expectedNetworkInputsMissingNetworkId = </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <related-to-property> <property-key>cloud-region.owner-defined-type</property-key> @@ -753,7 +753,7 @@ String expectedNetworkInputsMissingNetworkId = </relationship> <relationship> <related-to>tenant</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/</related-link> + <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>4ae1d3446a4c48b2bec44b6cfba06d68 @@ -761,7 +761,7 @@ String expectedNetworkInputsMissingNetworkId = </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -2148,7 +2148,7 @@ String rollbackNetworkRequest = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -2181,7 +2181,7 @@ String rollbackNetworkRequest = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -2214,7 +2214,7 @@ String rollbackNetworkRequest = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy index 67b1c23ae1..6ed9dbd2bd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy @@ -84,7 +84,7 @@ class DoUpdateVfModuleTest { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("att-aic") + when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("CloudOwner") when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region") when(mockExecution.getVariable("mso.workflow.default.aai.cloud-region.version")).thenReturn("8") when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") @@ -94,7 +94,7 @@ class DoUpdateVfModuleTest { DoUpdateVfModule obj = new DoUpdateVfModule() obj.prepConfirmVolumeGroupTenant(mockExecution) - Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionRequest", "http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionRequest", "http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionReturnCode", "200") Mockito.verify(mockExecution).setVariable(prefix + "cloudRegionForVolume", "AAIAIC25") Mockito.verify(mockExecution).setVariable(prefix + "isCloudRegionGood", true) @@ -295,7 +295,7 @@ class DoUpdateVfModuleTest { } private static void mockData() { - stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic")) + stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner")) .willReturn(aResponse() .withStatus(200).withHeader("Content-Type", "text/xml") .withBodyFile("DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml"))) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy index 84da045450..d0ded39146 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy @@ -31,6 +31,7 @@ import org.junit.Test import org.junit.Ignore import org.mockito.MockitoAnnotations import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.HomingSolution import org.onap.so.bpmn.mock.FileUtil @@ -195,7 +196,53 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) } - + + @Test + @Ignore + public void preProcessRequest_vimId() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + UrnPropertiesReader + + def req = request + .replace('"mdt1"', '"CloudOwner_CloudRegion1"') + + when(mex.getVariable("bpmnRequest")).thenReturn(req) + when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S") + when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S") + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.preProcessRequest(mex) + + verify(mex).setVariable("cloudRegionId", "CloudRegion1") + verify(mex).setVariable("cloudOwner", "CloudOwner") + } + + @Test + @Ignore + public void preProcessRequest_noVimId() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + def req = request + .replace('"mdt1"', '"CloudRegion1_"') + + when(mex.getVariable("bpmnRequest")).thenReturn(req) + when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(60) + when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S") + when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S") + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.preProcessRequest(mex) + + verify(mex).setVariable("cloudRegionId", "CloudRegion1_") + verify(mex).setVariable("cloudOwner", "my-cloud-owner") + + } + + @Test // @Ignore public void preProcessRequest_BpmnError() { @@ -579,6 +626,45 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { verify(mex).setVariable("cloudOwner", "my-cloud-owner") verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") } + + @Test + public void prepareVnfAndModulesCreate_noVimId() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesCreate(mex) + + def req = request + .replace('"mdt1"', '"CloudRegion1_"') + + when(mex.getVariable("createVcpeServiceRequest")).thenReturn(req) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) + + verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + verify(mex).setVariable("cloudRegionId", "CloudRegion1_") + verify(mex).setVariable("lcpCloudRegionId", "CloudRegion1_") + verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") + } + + @Test + public void prepareVnfAndModulesCreate_vimId() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesCreate(mex) + + def req = request + .replace('"mdt1"', '"CloudOwner_CloudRegion1"') + + when(mex.getVariable("createVcpeServiceRequest")).thenReturn(req) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) + + verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + verify(mex).setVariable("cloudOwner", "CloudOwner") + verify(mex).setVariable("cloudRegionId", "CloudRegion1") + verify(mex).setVariable("lcpCloudRegionId", "CloudRegion1") + verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") + } @Test // @Ignore diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java index aab289fd90..2e8fb4be78 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java @@ -30,55 +30,52 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.junit.Before; import org.junit.Test; public class PnfCheckInputsTest { - private PnfCheckInputs delegate; - - @Before - public void setUp() throws Exception { - delegate = new PnfCheckInputs(); - } + private static final String DEFAULT_TIMEOUT = "P1D"; private DelegateExecution mockDelegateExecution() { + new PnfCheckInputs(DEFAULT_TIMEOUT); DelegateExecution delegateExecution = mock(DelegateExecution.class); when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); return delegateExecution; } @Test - public void shouldThrowException_whenPnfIdNotSet() throws Exception { + public void shouldThrowException_whenPnfIdNotSet() { // given + PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); DelegateExecution delegateExecution = mockDelegateExecution(); // when, then - assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } private DelegateExecution mockDelegateExecutionWithCorrelationId() { + new PnfCheckInputs(DEFAULT_TIMEOUT); DelegateExecution delegateExecution = mockDelegateExecution(); when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId"); return delegateExecution; } @Test - public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() throws Exception { + public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() { // given + PnfCheckInputs testedObject = new PnfCheckInputs(null); DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); // when, then - assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } @Test - public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() throws Exception { + public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() { // given - String defaultTimeout = "T1D"; - delegate.setDefaultTimeout(defaultTimeout); + PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); // when - delegate.execute(delegateExecution); + testedObject.execute(delegateExecution); // then - verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(defaultTimeout)); + verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(DEFAULT_TIMEOUT)); } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java index 24d1810ac6..fde112b009 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -24,30 +26,18 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.List; import org.junit.Test; -import org.onap.so.bpmn.infrastructure.pnf.dmaap.JsonUtilForCorrelationId; public class JsonUtilForCorrelationIdTest { - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"corrTest1\",\n" - + " \"value\" : \"value1\"\n" - + " }\n" - + " },\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"corrTest2\",\n" - + " \"value\" : \"value2\"\n" - + " }\n" - + " }\n" - + "]"; + private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"corrTest1\"," + + "\"key1\":\"value1\"},{\"correlationId\": \"corrTest2\",\"key2\":\"value2\"}]"; + + private static final String JSON_WITH_ONE_CORRELATION_ID = "[{\"correlationId\":\"corrTest3\"}]"; + + private static final String JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS = + "[\"{\\\"correlationId\\\":\\\"corrTest4\\\"}\", \"{\\\"correlationId\\\":\\\"corrTest5\\\"}\"]"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID2 = "{\"pnfRegistrationFields\":{\"correlationId\":\"corrTest3\"}}"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID3 = "[\"{\\\"pnfRegistrationFields\\\":" - + "{\\\"correlationId\\\":\\\"corrTest4\\\"}}\", \"{\\\"pnfRegistrationFields\\\":" - + "{\\\"correlationId\\\":\\\"corrTest5\\\"}}\"]"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID4 = "{\"header\":{\"key\":\"value\"}}"; + private static final String JSON_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; @Test public void parseJsonSuccessful() { @@ -56,21 +46,21 @@ public class JsonUtilForCorrelationIdTest { assertThat(expectedResult).containsExactly("corrTest1", "corrTest2"); List<String> expectedResult2 = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID2); + .parseJsonToGelAllCorrelationId(JSON_WITH_ONE_CORRELATION_ID); assertThat(expectedResult2).containsExactly("corrTest3"); } @Test public void parseJsonWithEscapeCharacters_Successful() { List<String> expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID3); + .parseJsonToGelAllCorrelationId(JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS); assertThat(expectedResult).containsExactly("corrTest4", "corrTest5"); } @Test public void parseJson_emptyListReturnedWhenNothingFound() { List<String> expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID4); + .parseJsonToGelAllCorrelationId(JSON_WITH_NO_CORRELATION_ID); assertThat(expectedResult).isEmpty(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java index 9ae7ad9bdc..1b0169d6d3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,7 +35,6 @@ import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import org.apache.http.HttpEntity; @@ -47,7 +48,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.onap.so.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread; @@ -57,22 +57,10 @@ public class PnfEventReadyDmaapClientTest { private static final String CORRELATION_ID = "corrTestId"; private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"%s\",\n" - + " \"value\" : \"value1\"\n" - + " }\n" - + " },\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"corr\",\n" - + " \"value\" : \"value2\"\n" - + " }\n" - + " }\n" - + "]"; - private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = - "{\"pnfRegistrationFields\":{\"field\":\"value\"}}"; + private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"%s\"," + + "\"value\":\"value1\"},{\"correlationId\": \"corr\",\"value\":\"value2\"}]"; + + private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; private static final String HOST = "hostTest"; private static final int PORT = 1234; @@ -81,6 +69,8 @@ public class PnfEventReadyDmaapClientTest { private static final String EVENT_TOPIC_TEST = "eventTopicTest"; private static final String CONSUMER_ID = "consumerTestId"; private static final String CONSUMER_GROUP = "consumerGroupTest"; + private static final int TOPIC_LISTENER_DELAY_IN_SECONDS = 5; + @Mock private Environment env; private PnfEventReadyDmaapClient testedObject; @@ -92,16 +82,16 @@ public class PnfEventReadyDmaapClientTest { @Before public void init() throws NoSuchFieldException, IllegalAccessException { - testedObject = new PnfEventReadyDmaapClient(env); when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT); when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST); - testedObject.setDmaapProtocol(PROTOCOL); - testedObject.setDmaapUriPathPrefix(URI_PATH_PREFIX); - testedObject.setDmaapTopicName(EVENT_TOPIC_TEST); - testedObject.setConsumerId(CONSUMER_ID); - testedObject.setConsumerGroup(CONSUMER_GROUP); - testedObject.setDmaapClientDelayInSeconds(1); - testedObject.init(); + when(env.getProperty(eq("pnf.dmaap.protocol"))).thenReturn(PROTOCOL); + when(env.getProperty(eq("pnf.dmaap.uriPathPrefix"))).thenReturn(URI_PATH_PREFIX); + when(env.getProperty(eq("pnf.dmaap.topicName"))).thenReturn(EVENT_TOPIC_TEST); + when(env.getProperty(eq("pnf.dmaap.consumerId"))).thenReturn(CONSUMER_ID); + when(env.getProperty(eq("pnf.dmaap.consumerGroup"))).thenReturn(CONSUMER_GROUP); + when(env.getProperty(eq("pnf.dmaap.topicListenerDelayInSeconds"), eq(Integer.class))) + .thenReturn(TOPIC_LISTENER_DELAY_IN_SECONDS); + testedObject = new PnfEventReadyDmaapClient(env); testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread(); httpClientMock = mock(HttpClient.class); threadMockToNotifyCamundaFlow = mock(Runnable.class); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json index a4190a76ee..b234df5364 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mdt1", "cloud-type": "openstack", "owner-defined-type": "lcp", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json index f0936d6648..0ad0f054b0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json @@ -72,11 +72,11 @@ { "related-to": "vserver", "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -99,11 +99,11 @@ { "related-to": "vserver", "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -126,11 +126,11 @@ { "related-to": "vserver", "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json index 4b1f69aacf..892e41a429 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json @@ -17,11 +17,11 @@ "relationship": [ { "relatedTo": "vserver", - "relatedLink": "/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/8862-tenantl-LB1113/vservers/vserver/8862-Lvserver-LB1113", + "relatedLink": "/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/8862-tenantl-LB1113/vservers/vserver/8862-Lvserver-LB1113", "relationshipData": [ { "relationshipKey": "cloud-region.cloud-owner", - "relationshipValue": "att-aic" + "relationshipValue": "CloudOwner" }, { "relationshipKey": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json index d5d234cbf6..e052360c6c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json @@ -107,11 +107,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -127,11 +127,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json index aa6320801e..84ce037a2d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json @@ -102,11 +102,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -122,11 +122,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json index 5addff2d70..0185d56d06 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mtn6", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json index fadbf9c244..d850e51593 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mtn6", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json index 97611c1d62..ab98fa4b70 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "ERROR", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json index 181494dff2..5432133631 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json @@ -73,11 +73,11 @@ { "related-to": "cloud-region", "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DYH1A", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -94,11 +94,11 @@ { "related-to": "tenant", "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json index b22f389c40..81f9a78e86 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json @@ -73,11 +73,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -91,11 +91,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml index 6dd91c64c9..5e1e2f62a3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml @@ -68,10 +68,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -84,10 +84,10 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json index f076c9044c..a99d25bdc9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json @@ -73,11 +73,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml index 92fec2dc64..8b70a139e6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml @@ -71,10 +71,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -87,10 +87,10 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml index 9b651f25e3..ca29b22424 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>3.0</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml index be820b83b1..eb2ed36edc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml @@ -35,14 +35,14 @@ <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-conexus-e2e.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/396d61752cf04c3b8ca2afcb4ee049e9/</related-link> + <related-link>https://aai-conexus-e2e.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/396d61752cf04c3b8ca2afcb4ee049e9/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>396d61752cf04c3b8ca2afcb4ee049e9</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml index 96e906f9bf..b653da6e0e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml @@ -9,14 +9,14 @@ <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/e444c311b27a45dc9522f2370d70f90f/</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/e444c311b27a45dc9522f2370d70f90f/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>e444c311b27a45dc9522f2370d70f90f</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml index 7e2a676283..f4a9f3e9ba 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml @@ -20,14 +20,14 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -40,14 +40,14 @@ </relationship> <relationship> <related-to>vf-module</related-to> - <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>vf-module.vf-module-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml index 9b651f25e3..ca29b22424 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>3.0</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml index c12bcd49c9..a34574fd83 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml @@ -45,10 +45,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/</related-link> + <related-link>cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RDM2WAGPLCP/</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml index fd10548cef..b0203db2d0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -20,14 +20,14 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml index 20b5462729..d8c52084e0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml @@ -110,7 +110,7 @@ <generic-vnf-service> <cloud-region-id>FRN1</cloud-region-id> <outer-vlan-tag>4027</outer-vlan-tag> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <service-ecomp-model-information> <model-uuid>b73c6911-be64-448a-bb4b-7b7a7006507a</model-uuid> <model-version>5.0</model-version> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml index 20b5462729..d8c52084e0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml @@ -110,7 +110,7 @@ <generic-vnf-service> <cloud-region-id>FRN1</cloud-region-id> <outer-vlan-tag>4027</outer-vlan-tag> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <service-ecomp-model-information> <model-uuid>b73c6911-be64-448a-bb4b-7b7a7006507a</model-uuid> <model-version>5.0</model-version> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml index 03d63f9f05..e36fbe1e04 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -9,14 +9,14 @@ <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml index 4087ab8f5f..f89b24b615 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml @@ -10,10 +10,10 @@ <relationship-list> <relationship> <related-to>volume-group</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/volume-groups/volume-group/064bd1c6-e377-4009-a744-e958eec6e727/</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/volume-groups/volume-group/064bd1c6-e377-4009-a744-e958eec6e727/</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml index 49513f1eac..8186a6d075 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -12,7 +12,7 @@ <related-to>volume-group</related-to> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml index df84706ec5..59ef3e267b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -10,7 +10,7 @@ <related-to>tenant</related-to> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn index 89d66bfdb6..e0b14ab0db 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn @@ -27,15 +27,15 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForCorrelationId" /> - <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${pnfCheckInputs}"> + <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${PnfCheckInputs}"> <bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="CancelDmaapClientSubscription" name="Cancel DmaapClient subscription" camunda:delegateExpression="${cancelDmaapSubscription}"> + <bpmn:serviceTask id="CancelDmaapClientSubscription" name="Cancel DmaapClient subscription" camunda:delegateExpression="${CancelDmaapSubscription}"> <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${informDmaapClient}"> + <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${InformDmaapClient}"> <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing> </bpmn:serviceTask> @@ -44,7 +44,7 @@ <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming> <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing> </bpmn:intermediateThrowEvent> - <bpmn:serviceTask id="CreateAndActivatePnf_CreateAaiEntry" name="Create AAI entry with pnf-id = correlation_id" camunda:delegateExpression="${createAaiEntryWithPnfIdDelegate}"> + <bpmn:serviceTask id="CreateAndActivatePnf_CreateAaiEntry" name="Create AAI entry with pnf-id = correlation_id" camunda:delegateExpression="${CreateAaiEntryWithPnfIdDelegate}"> <bpmn:incoming>SequenceFlow_0v5ffpe</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1qr6cmf</bpmn:outgoing> </bpmn:serviceTask> @@ -53,7 +53,7 @@ <bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${checkAaiForCorrelationIdDelegate}"> + <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${CheckAaiForCorrelationIdDelegate}"> <bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn index 3c7be0937f..5fd2c69608 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn @@ -33,7 +33,7 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:outgoing>SequenceFlow_1rwaeun</bpmn:outgoing> </bpmn:startEvent> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1caax8u" name="GoTo StartCreateDevinSDNC"> - <bpmn:incoming>SequenceFlow_1ylvnxq</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming> <bpmn:linkEventDefinition name="StartCreateDevinSDNC" /> </bpmn:intermediateThrowEvent> <bpmn:scriptTask id="ScriptTask_00y93jj" name="Check DevType" scriptFormat="groovy"> @@ -53,7 +53,7 @@ dcsi.checkDevType(execution)]]></bpmn:script> <bpmn:incoming>SequenceFlow_0h4378g</bpmn:incoming> <bpmn:linkEventDefinition name="StartCreateDevinSDNC" /> </bpmn:intermediateThrowEvent> - <bpmn:sequenceFlow id="SequenceFlow_1ss02ik" name="VNF" sourceRef="ExclusiveGateway_0kba700" targetRef="ScriptTask_02rli65"> + <bpmn:sequenceFlow id="SequenceFlow_1ss02ik" name="VNF" sourceRef="ExclusiveGateway_0kba700" targetRef="IntermediateThrowEvent_1caax8u"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("device_class" ) == "VNF" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1hp2h5t" sourceRef="ScriptTask_00y93jj" targetRef="ExclusiveGateway_0kba700" /> @@ -74,39 +74,6 @@ dcsi.preProcessRequest(execution)]]></bpmn:script> <bpmn:linkEventDefinition name="StartCreateDevinSDNC" /> </bpmn:intermediateCatchEvent> <bpmn:sequenceFlow id="SequenceFlow_1gu13by" sourceRef="IntermediateCatchEvent_0slgrxw" targetRef="Task_0bga3e8" /> - <bpmn:callActivity id="CallActivity_0pyrfca" name="call CreateVNF" calledElement="DoCreateVNF"> - <bpmn:extensionElements> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="requestAction" target="requestAction" /> - <camunda:in source="recipeParams" target="recipeParams" /> - <camunda:in source="resourceInput" target="resourceInput" /> - <camunda:in source="recipeParamXsd" target="recipeParamXsd" /> - <camunda:in source="operationId" target="operationId" /> - <camunda:in source="svcAction" target="svcAction" /> - <camunda:in source="requestAction" target="requestAction" /> - <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> - <camunda:in source="networkRequest" target="networkRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0pg3072</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0pkp4ce</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_0pkp4ce" sourceRef="CallActivity_0pyrfca" targetRef="ScriptTask_0u1piih" /> - <bpmn:scriptTask id="ScriptTask_02rli65" name="Get VNF Template fom SDC" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0pg3072</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new CreateDeviceResource() -dcsi.getVNFTemplatefromSDC(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0pg3072" sourceRef="ScriptTask_02rli65" targetRef="CallActivity_0pyrfca" /> - <bpmn:scriptTask id="ScriptTask_0u1piih" name="Post VNF info process " scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0pkp4ce</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ylvnxq</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new CreateDeviceResource() -dcsi.postVNFInfoProcess(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1ylvnxq" sourceRef="ScriptTask_0u1piih" targetRef="IntermediateThrowEvent_1caax8u" /> <bpmn:scriptTask id="ScriptTask_0p4b5vu" name="Prepare Create resource progress" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0b5nrig</bpmn:incoming> <bpmn:outgoing>SequenceFlow_09s5dfc</bpmn:outgoing> @@ -203,9 +170,9 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ss02ik_di" bpmnElement="SequenceFlow_1ss02ik"> <di:waypoint xsi:type="dc:Point" x="384" y="-127" /> - <di:waypoint xsi:type="dc:Point" x="480" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="1026" y="-127" /> <bpmndi:BPMNLabel> - <dc:Bounds x="420.94444444444446" y="-148" width="23" height="12" /> + <dc:Bounds x="696.8437500000002" y="-148" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1hp2h5t_di" bpmnElement="SequenceFlow_1hp2h5t"> @@ -252,36 +219,6 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <dc:Bounds x="-75.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_0pyrfca_di" bpmnElement="CallActivity_0pyrfca"> - <dc:Bounds x="662" y="-167" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0pkp4ce_di" bpmnElement="SequenceFlow_0pkp4ce"> - <di:waypoint xsi:type="dc:Point" x="762" y="-127" /> - <di:waypoint xsi:type="dc:Point" x="849" y="-127" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="760.5" y="-148" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_02rli65_di" bpmnElement="ScriptTask_02rli65"> - <dc:Bounds x="480" y="-167" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0pg3072_di" bpmnElement="SequenceFlow_0pg3072"> - <di:waypoint xsi:type="dc:Point" x="580" y="-127" /> - <di:waypoint xsi:type="dc:Point" x="662" y="-127" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="621" y="-148" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0u1piih_di" bpmnElement="ScriptTask_0u1piih"> - <dc:Bounds x="849" y="-167" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ylvnxq_di" bpmnElement="SequenceFlow_1ylvnxq"> - <di:waypoint xsi:type="dc:Point" x="949" y="-127" /> - <di:waypoint xsi:type="dc:Point" x="1026" y="-127" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="987.5" y="-148" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0p4b5vu_di" bpmnElement="ScriptTask_0p4b5vu"> <dc:Bounds x="309" y="-290" width="100" height="80" /> </bpmndi:BPMNShape> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn index f0baac0254..73d38b383c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn @@ -33,7 +33,7 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:outgoing>SequenceFlow_1rwaeun</bpmn:outgoing> </bpmn:startEvent> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1caax8u" name="GoTo StartDeleteDevinSDNC"> - <bpmn:incoming>SequenceFlow_1ylvnxq</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming> <bpmn:linkEventDefinition name="StartDeleteDevinSDNC" /> </bpmn:intermediateThrowEvent> <bpmn:scriptTask id="ScriptTask_00y93jj" name="Check DevType from AAI" scriptFormat="groovy"> @@ -53,7 +53,7 @@ dcsi.checkDevType(execution)]]></bpmn:script> <bpmn:incoming>SequenceFlow_0h4378g</bpmn:incoming> <bpmn:linkEventDefinition name="StartDeleteDevinSDNC" /> </bpmn:intermediateThrowEvent> - <bpmn:sequenceFlow id="SequenceFlow_1ss02ik" name="VNF" sourceRef="ExclusiveGateway_0kba700" targetRef="ScriptTask_02rli65"> + <bpmn:sequenceFlow id="SequenceFlow_1ss02ik" name="VNF" sourceRef="ExclusiveGateway_0kba700" targetRef="IntermediateThrowEvent_1caax8u"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("device_class" ) == "VNF" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1hp2h5t" sourceRef="ScriptTask_00y93jj" targetRef="ExclusiveGateway_0kba700" /> @@ -74,39 +74,6 @@ dcsi.preProcessRequest(execution)]]></bpmn:script> <bpmn:linkEventDefinition name="StartDeleteDevinSDNC" /> </bpmn:intermediateCatchEvent> <bpmn:sequenceFlow id="SequenceFlow_1gu13by" sourceRef="IntermediateCatchEvent_0slgrxw" targetRef="Task_0bga3e8" /> - <bpmn:callActivity id="CallActivity_0pyrfca" name="call DeleteVNF" calledElement="DoDeleteVNF"> - <bpmn:extensionElements> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="requestAction" target="requestAction" /> - <camunda:in source="recipeParams" target="recipeParams" /> - <camunda:in source="resourceInput" target="resourceInput" /> - <camunda:in source="recipeParamXsd" target="recipeParamXsd" /> - <camunda:in source="operationId" target="operationId" /> - <camunda:in source="svcAction" target="svcAction" /> - <camunda:in source="requestAction" target="requestAction" /> - <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> - <camunda:in source="networkRequest" target="networkRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0pg3072</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0pkp4ce</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_0pkp4ce" sourceRef="CallActivity_0pyrfca" targetRef="ScriptTask_0u1piih" /> - <bpmn:scriptTask id="ScriptTask_02rli65" name="Get VNF ID" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0pg3072</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DeleteDeviceResource() -dcsi.getVNFTemplatefromSDC(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0pg3072" sourceRef="ScriptTask_02rli65" targetRef="CallActivity_0pyrfca" /> - <bpmn:scriptTask id="ScriptTask_0u1piih" name="Post VNF info process " scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0pkp4ce</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ylvnxq</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DeleteDeviceResource() -dcsi.postVNFInfoProcess(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1ylvnxq" sourceRef="ScriptTask_0u1piih" targetRef="IntermediateThrowEvent_1caax8u" /> <bpmn:scriptTask id="ScriptTask_14oc86m" name="Prepare Create resource progress" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1g6azih</bpmn:incoming> <bpmn:outgoing>SequenceFlow_003svcq</bpmn:outgoing> @@ -203,9 +170,9 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ss02ik_di" bpmnElement="SequenceFlow_1ss02ik"> <di:waypoint xsi:type="dc:Point" x="384" y="-127" /> - <di:waypoint xsi:type="dc:Point" x="480" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="1026" y="-127" /> <bpmndi:BPMNLabel> - <dc:Bounds x="420.94444444444446" y="-148" width="23" height="12" /> + <dc:Bounds x="696.8437500000002" y="-148" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1hp2h5t_di" bpmnElement="SequenceFlow_1hp2h5t"> @@ -252,36 +219,6 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <dc:Bounds x="-75.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_0pyrfca_di" bpmnElement="CallActivity_0pyrfca"> - <dc:Bounds x="662" y="-167" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0pkp4ce_di" bpmnElement="SequenceFlow_0pkp4ce"> - <di:waypoint xsi:type="dc:Point" x="762" y="-127" /> - <di:waypoint xsi:type="dc:Point" x="849" y="-127" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="760.5" y="-148" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_02rli65_di" bpmnElement="ScriptTask_02rli65"> - <dc:Bounds x="480" y="-167" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0pg3072_di" bpmnElement="SequenceFlow_0pg3072"> - <di:waypoint xsi:type="dc:Point" x="580" y="-127" /> - <di:waypoint xsi:type="dc:Point" x="662" y="-127" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="621" y="-148" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0u1piih_di" bpmnElement="ScriptTask_0u1piih"> - <dc:Bounds x="849" y="-167" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ylvnxq_di" bpmnElement="SequenceFlow_1ylvnxq"> - <di:waypoint xsi:type="dc:Point" x="949" y="-127" /> - <di:waypoint xsi:type="dc:Point" x="1026" y="-127" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="987.5" y="-148" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_14oc86m_di" bpmnElement="ScriptTask_14oc86m"> <dc:Bounds x="309" y="-281" width="100" height="80" /> </bpmndi:BPMNShape> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index a975ebdee0..17f6c66e4a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> <bpmn:process id="DoDeleteE2EServiceInstance" name="All Resources Deleted" isExecutable="true"> <bpmn:startEvent id="StartEvent_0212h2r" name="Start Flow"> <bpmn:outgoing>SequenceFlow_0vz7cd9</bpmn:outgoing> @@ -24,6 +24,7 @@ ddsi.postProcessAAIGET(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="ScriptTask_01erufg" name=" AAI Delete (svc instance) " scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1cevtpy</bpmn:incoming> + <bpmn:incoming>SequenceFlow_12rr1yy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0e7inkl</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCustomDeleteE2EServiceInstance() @@ -99,11 +100,6 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_1j08ko3" sourceRef="ServiceTask_00tg69u" targetRef="Task_1f5dlsv" /> <bpmn:sequenceFlow id="SequenceFlow_0fo5vw5" sourceRef="Task_1ldvug1" targetRef="Task_0mhdfuu" /> <bpmn:sequenceFlow id="SequenceFlow_0orw2f8" sourceRef="Task_0mhdfuu" targetRef="Task_1yx1n05" /> - <bpmn:sequenceFlow id="SequenceFlow_0ha8ix9" sourceRef="Task_1yx1n05" targetRef="IntermediateThrowEvent_0ve5ukt" /> - <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0ve5ukt" name="Go to Delete Resources"> - <bpmn:incoming>SequenceFlow_0ha8ix9</bpmn:incoming> - <bpmn:linkEventDefinition name="StartDeleteResource" /> - </bpmn:intermediateThrowEvent> <bpmn:intermediateCatchEvent id="startDeleteResources" name="Start Delete Resources"> <bpmn:outgoing>SequenceFlow_1961633</bpmn:outgoing> <bpmn:linkEventDefinition name="StartDeleteResource" /> @@ -133,7 +129,7 @@ dcsi.prepareDecomposeService(execution)]]></bpmn:script> </bpmn:callActivity> <bpmn:scriptTask id="Task_1yx1n05" name="Post Decompose Service" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0orw2f8</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ha8ix9</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_013rime</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoDeleteE2EServiceInstance() dcsi.postDecomposeService(execution)]]></bpmn:script> @@ -167,6 +163,63 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> <bpmn:linkEventDefinition name="DecomposeService" /> </bpmn:intermediateThrowEvent> <bpmn:sequenceFlow id="SequenceFlow_0vi0sv6" sourceRef="ScriptTask_1rtnsh8" targetRef="StartEvent_1qh5a34" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_00pyc0n" name="Start Delete Resources"> + <bpmn:incoming>SequenceFlow_1fozgqz</bpmn:incoming> + <bpmn:linkEventDefinition name="StartDeleteResource" /> + </bpmn:intermediateThrowEvent> + <bpmn:exclusiveGateway id="ExclusiveGateway_156mc3h" name="Valid Resource List?" default="SequenceFlow_1ncja2b"> + <bpmn:incoming>SequenceFlow_013rime</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1fozgqz</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1ncja2b</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1g4uc66" name="End Delete Process"> + <bpmn:incoming>SequenceFlow_1ncja2b</bpmn:incoming> + <bpmn:linkEventDefinition name="EndDeleteProcess" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_1fozgqz" name="Yes" sourceRef="ExclusiveGateway_156mc3h" targetRef="IntermediateThrowEvent_00pyc0n"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("isDeleteResourceListValid" ) == true)}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1ncja2b" sourceRef="ExclusiveGateway_156mc3h" targetRef="IntermediateThrowEvent_1g4uc66" /> + <bpmn:sequenceFlow id="SequenceFlow_013rime" sourceRef="Task_1yx1n05" targetRef="ExclusiveGateway_156mc3h" /> + <bpmn:serviceTask id="ServiceTask_1lsic7i" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1ab3vex</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12rr1yy</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="ScriptTask_0f3tjbn" name="prepare update service operation status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0h5c1bd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ab3vex</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("progress", "100") +execution.setVariable("result", "finished") +execution.setVariable("operationContent", "No actual resoure in service instance") +def csi= new DoDeleteE2EServiceInstance() +csi.prepareUpdateServiceOperationStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0hrkmxb" name="End Delete Process"> + <bpmn:outgoing>SequenceFlow_0h5c1bd</bpmn:outgoing> + <bpmn:linkEventDefinition name="EndDeleteProcess" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_1ab3vex" sourceRef="ScriptTask_0f3tjbn" targetRef="ServiceTask_1lsic7i" /> + <bpmn:sequenceFlow id="SequenceFlow_0h5c1bd" sourceRef="IntermediateCatchEvent_0hrkmxb" targetRef="ScriptTask_0f3tjbn" /> + <bpmn:sequenceFlow id="SequenceFlow_12rr1yy" sourceRef="ServiceTask_1lsic7i" targetRef="ScriptTask_01erufg" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteE2EServiceInstance"> @@ -192,7 +245,7 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> <dc:Bounds x="254" y="450" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1u8zt9i_di" bpmnElement="SubProcess_1u8zt9i" isExpanded="true"> - <dc:Bounds x="-166" y="672" width="467" height="193" /> + <dc:Bounds x="-161" y="980" width="467" height="193" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0vz7cd9_di" bpmnElement="SequenceFlow_0vz7cd9"> <di:waypoint xsi:type="dc:Point" x="-501" y="-33" /> @@ -220,32 +273,32 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_0sf5lpt_di" bpmnElement="StartEvent_0sf5lpt"> - <dc:Bounds x="-98" y="739" width="36" height="36" /> + <dc:Bounds x="-93" y="1047" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-170" y="780" width="90" height="12" /> + <dc:Bounds x="-165" y="1088" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_06utmg4_di" bpmnElement="EndEvent_06utmg4"> - <dc:Bounds x="195" y="739" width="36" height="36" /> + <dc:Bounds x="200" y="1047" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="123" y="780" width="90" height="12" /> + <dc:Bounds x="128" y="1088" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0nha3pr_di" bpmnElement="ScriptTask_0nha3pr"> - <dc:Bounds x="6" y="717" width="100" height="80" /> + <dc:Bounds x="11" y="1025" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1921mo3_di" bpmnElement="SequenceFlow_1921mo3"> - <di:waypoint xsi:type="dc:Point" x="-62" y="757" /> - <di:waypoint xsi:type="dc:Point" x="6" y="757" /> + <di:waypoint xsi:type="dc:Point" x="-57" y="1065" /> + <di:waypoint xsi:type="dc:Point" x="11" y="1065" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-118" y="742" width="90" height="12" /> + <dc:Bounds x="-113" y="1050" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18vlzfo_di" bpmnElement="SequenceFlow_18vlzfo"> - <di:waypoint xsi:type="dc:Point" x="106" y="757" /> - <di:waypoint xsi:type="dc:Point" x="195" y="757" /> + <di:waypoint xsi:type="dc:Point" x="111" y="1065" /> + <di:waypoint xsi:type="dc:Point" x="200" y="1065" /> <bpmndi:BPMNLabel> - <dc:Bounds x="62" y="742" width="90" height="12" /> + <dc:Bounds x="67" y="1050" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_146jt8v_di" bpmnElement="ScriptTask_146jt8v"> @@ -298,21 +351,6 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> <dc:Bounds x="-79" y="192" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ha8ix9_di" bpmnElement="SequenceFlow_0ha8ix9"> - <di:waypoint xsi:type="dc:Point" x="147" y="198" /> - <di:waypoint xsi:type="dc:Point" x="181" y="198" /> - <di:waypoint xsi:type="dc:Point" x="181" y="198" /> - <di:waypoint xsi:type="dc:Point" x="246" y="198" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="151" y="192" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateThrowEvent_15myvzx_di" bpmnElement="IntermediateThrowEvent_0ve5ukt"> - <dc:Bounds x="246" y="180" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="233" y="220" width="64" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_1jcfnjr_di" bpmnElement="startDeleteResources"> <dc:Bounds x="-537" y="472" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -373,6 +411,80 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> <dc:Bounds x="-16" y="-39" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_00pyc0n_di" bpmnElement="IntermediateThrowEvent_00pyc0n"> + <dc:Bounds x="398" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="389" y="220" width="57" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_156mc3h_di" bpmnElement="ExclusiveGateway_156mc3h" isMarkerVisible="true"> + <dc:Bounds x="279" y="173" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266" y="145" width="75" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1g4uc66_di" bpmnElement="IntermediateThrowEvent_1g4uc66"> + <dc:Bounds x="286" y="270" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="279" y="308" width="53" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fozgqz_di" bpmnElement="SequenceFlow_1fozgqz"> + <di:waypoint xsi:type="dc:Point" x="329" y="198" /> + <di:waypoint xsi:type="dc:Point" x="398" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="356.5" y="176" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ncja2b_di" bpmnElement="SequenceFlow_1ncja2b"> + <di:waypoint xsi:type="dc:Point" x="304" y="223" /> + <di:waypoint xsi:type="dc:Point" x="304" y="270" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="274" y="240.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_013rime_di" bpmnElement="SequenceFlow_013rime"> + <di:waypoint xsi:type="dc:Point" x="147" y="198" /> + <di:waypoint xsi:type="dc:Point" x="279" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="213" y="177" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1lsic7i_di" bpmnElement="ServiceTask_1lsic7i"> + <dc:Bounds x="-121" y="697" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0f3tjbn_di" bpmnElement="ScriptTask_0f3tjbn"> + <dc:Bounds x="-399" y="697" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0hrkmxb_di" bpmnElement="IntermediateCatchEvent_0hrkmxb"> + <dc:Bounds x="-531" y="719" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-539" y="759" width="53" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ab3vex_di" bpmnElement="SequenceFlow_1ab3vex"> + <di:waypoint xsi:type="dc:Point" x="-299" y="737" /> + <di:waypoint xsi:type="dc:Point" x="-121" y="737" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-255" y="715" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0h5c1bd_di" bpmnElement="SequenceFlow_0h5c1bd"> + <di:waypoint xsi:type="dc:Point" x="-495" y="737" /> + <di:waypoint xsi:type="dc:Point" x="-399" y="737" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-492" y="715" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_12rr1yy_di" bpmnElement="SequenceFlow_12rr1yy"> + <di:waypoint xsi:type="dc:Point" x="-21" y="737" /> + <di:waypoint xsi:type="dc:Point" x="117" y="737" /> + <di:waypoint xsi:type="dc:Point" x="117" y="490" /> + <di:waypoint xsi:type="dc:Point" x="254" y="490" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="132" y="607.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions>
\ No newline at end of file +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json index a4190a76ee..b234df5364 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mdt1", "cloud-type": "openstack", "owner-defined-type": "lcp", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json index f0936d6648..0ad0f054b0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json @@ -72,11 +72,11 @@ { "related-to": "vserver", "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -99,11 +99,11 @@ { "related-to": "vserver", "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -126,11 +126,11 @@ { "related-to": "vserver", "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_pserverByVnfId.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_pserverByVnfId.json index 4b1f69aacf..892e41a429 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_pserverByVnfId.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/AAI/AAI_pserverByVnfId.json @@ -17,11 +17,11 @@ "relationship": [ { "relatedTo": "vserver", - "relatedLink": "/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/8862-tenantl-LB1113/vservers/vserver/8862-Lvserver-LB1113", + "relatedLink": "/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/8862-tenantl-LB1113/vservers/vserver/8862-Lvserver-LB1113", "relationshipData": [ { "relationshipKey": "cloud-region.cloud-owner", - "relationshipValue": "att-aic" + "relationshipValue": "CloudOwner" }, { "relationshipKey": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json index d5d234cbf6..e052360c6c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json @@ -107,11 +107,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -127,11 +127,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json index aa6320801e..84ce037a2d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json @@ -102,11 +102,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -122,11 +122,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json index 5addff2d70..0185d56d06 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mtn6", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json index fadbf9c244..d850e51593 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mtn6", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json index 97611c1d62..ab98fa4b70 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "ERROR", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json index 181494dff2..5432133631 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json @@ -73,11 +73,11 @@ { "related-to": "cloud-region", "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DYH1A", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -94,11 +94,11 @@ { "related-to": "tenant", "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json index b22f389c40..81f9a78e86 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json @@ -73,11 +73,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -91,11 +91,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml index 6dd91c64c9..5e1e2f62a3 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml @@ -68,10 +68,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -84,10 +84,10 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json index f076c9044c..a99d25bdc9 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json @@ -73,11 +73,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml index 92fec2dc64..8b70a139e6 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml @@ -71,10 +71,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -87,10 +87,10 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml index 9b651f25e3..ca29b22424 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>3.0</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml index be820b83b1..eb2ed36edc 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml @@ -35,14 +35,14 @@ <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-conexus-e2e.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/396d61752cf04c3b8ca2afcb4ee049e9/</related-link> + <related-link>https://aai-conexus-e2e.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/396d61752cf04c3b8ca2afcb4ee049e9/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>396d61752cf04c3b8ca2afcb4ee049e9</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml index 96e906f9bf..b653da6e0e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml @@ -9,14 +9,14 @@ <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/e444c311b27a45dc9522f2370d70f90f/</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/e444c311b27a45dc9522f2370d70f90f/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>e444c311b27a45dc9522f2370d70f90f</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml index 7e2a676283..f4a9f3e9ba 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml @@ -20,14 +20,14 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -40,14 +40,14 @@ </relationship> <relationship> <related-to>vf-module</related-to> - <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>vf-module.vf-module-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml index 9b651f25e3..ca29b22424 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>3.0</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml index c12bcd49c9..a34574fd83 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml @@ -45,10 +45,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/</related-link> + <related-link>cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RDM2WAGPLCP/</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml index fd10548cef..b0203db2d0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -20,14 +20,14 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml index 20b5462729..d8c52084e0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml @@ -110,7 +110,7 @@ <generic-vnf-service> <cloud-region-id>FRN1</cloud-region-id> <outer-vlan-tag>4027</outer-vlan-tag> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <service-ecomp-model-information> <model-uuid>b73c6911-be64-448a-bb4b-7b7a7006507a</model-uuid> <model-version>5.0</model-version> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml index 20b5462729..d8c52084e0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml @@ -110,7 +110,7 @@ <generic-vnf-service> <cloud-region-id>FRN1</cloud-region-id> <outer-vlan-tag>4027</outer-vlan-tag> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <service-ecomp-model-information> <model-uuid>b73c6911-be64-448a-bb4b-7b7a7006507a</model-uuid> <model-version>5.0</model-version> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml index 03d63f9f05..e36fbe1e04 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -9,14 +9,14 @@ <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml index 4087ab8f5f..f89b24b615 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml @@ -10,10 +10,10 @@ <relationship-list> <relationship> <related-to>volume-group</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/volume-groups/volume-group/064bd1c6-e377-4009-a744-e958eec6e727/</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/volume-groups/volume-group/064bd1c6-e377-4009-a744-e958eec6e727/</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-supercool.xml index 49513f1eac..8186a6d075 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-supercool.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -12,7 +12,7 @@ <related-to>volume-group</related-to> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VolumeGroup.xml index df84706ec5..59ef3e267b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VolumeGroup.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -10,7 +10,7 @@ <related-to>tenant</related-to> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java new file mode 100644 index 0000000000..612051f903 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2018 Bell Canada. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.so.bpmn.buildingblock; + +import java.util.Map; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class HomingV2 { + + @Autowired + private OofHomingV2 oofHomingV2; + @Autowired + private SniroHomingV2 sniroHomingV2; + + private static final String HOMINGSOLUTION = "Homing_Solution"; + + public void callHoming(BuildingBlockExecution execution) { + if (isOof(execution)) { + oofHomingV2.callOof(execution); + } else { + sniroHomingV2.callSniro(execution); + } + } + + public void processSolution(BuildingBlockExecution execution, String asyncResponse) { + if (isOof(execution)) { + oofHomingV2.processSolution(execution, asyncResponse); + } else { + sniroHomingV2.processSolution(execution, asyncResponse); + } + } + + // Default solution is SNIRO. OOF gets called only if specified. + private boolean isOof(BuildingBlockExecution execution) { + for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters() + .getUserParams()) { + if (params.containsKey(HOMINGSOLUTION) && params.get(HOMINGSOLUTION).equals("oof")) { + return true; + } + } + return false; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 87c04d7ecc..38261c0f1a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -54,6 +54,7 @@ import org.springframework.stereotype.Component; @Component public class AAIUpdateTasks { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIUpdateTasks.class); + private static final String ALACARTE = "aLaCarte"; private static final String MULTI_STAGE_DESIGN_OFF = "false"; private static final String MULTI_STAGE_DESIGN_ON = "true"; @Autowired @@ -196,7 +197,8 @@ public class AAIUpdateTasks { if (vnf.getModelInfoGenericVnf() != null) { multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign(); } - if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) { + boolean aLaCarte = (boolean) execution.getVariable(ALACARTE); + if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION); } else { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java index d13c5db871..615b7279dc 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java @@ -37,6 +37,7 @@ import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -95,10 +96,13 @@ public class ConfigurationScaleOut { for (Map.Entry<String,String> entry : param.entrySet()) { key = entry.getKey(); paramValue = entry.getValue(); - configScaleOutParam = JsonPath.parse(sdncVfModuleQueryResponse).read(paramValue); - if(configScaleOutParam != null){ - paramsMap.put(key, configScaleOutParam); + try{ + configScaleOutParam = JsonPath.parse(sdncVfModuleQueryResponse).read(paramValue); + }catch(ClassCastException e){ + configScaleOutParam = null; + msoLogger.warnSimple("Incorrect JSON path. Path points to object rather than value causing: ", e); } + paramsMap.put(key, configScaleOutParam); } } } @@ -107,7 +111,6 @@ public class ConfigurationScaleOut { configPayload.setConfigurationParameters(paramsMap); configPayload.setRequestParameters(requestParameters); configScaleOutPayloadString = mapper.writeValueAsString(configPayload); - configScaleOutPayloadString = configScaleOutPayloadString.replaceAll("\"", "\\\\\""); execution.setVariable(ACTION, actionCategory); execution.setVariable(MSO_REQUEST_ID, gBBInput.getRequestContext().getMsoRequestId()); @@ -122,6 +125,9 @@ public class ConfigurationScaleOut { } public void callAppcClient(BuildingBlockExecution execution) { + msoLogger.trace("Start runAppcCommand "); + String appcCode = "1002"; + String appcMessage = ""; try{ Action commandAction = Action.valueOf(execution.getVariable(ACTION)); String msoRequestId = execution.getVariable(MSO_REQUEST_ID); @@ -135,10 +141,22 @@ public class ConfigurationScaleOut { HashMap<String, String> payloadInfo = new HashMap<>(); payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME)); payloadInfo.put(VFMODULE_ID,execution.getVariable(VFMODULE_ID)); + msoLogger.debug("Running APP-C action: " + commandAction.toString()); + msoLogger.debug("VNFID: " + vnfId); //PayloadInfo contains extra information that adds on to payload before making request to appc appCClient.runAppCCommand(commandAction, msoRequestId, vnfId, payloadString, payloadInfo, controllerType); - }catch(Exception ex){ - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + appcCode = appCClient.getErrorCode(); + appcMessage = appCClient.getErrorMessage(); + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + appcMessage = e.getMessage(); + } + msoLogger.error("Error Message: " + appcMessage); + msoLogger.error("ERROR CODE: " + appcCode); + msoLogger.trace("End of runAppCommand "); + if (appcCode != null && !appcCode.equals("0")) { + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java index 61162f4d85..2dae820e95 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java @@ -32,6 +32,7 @@ import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -78,7 +79,9 @@ public class GenericVnfHealthCheck { } public void callAppcClient(BuildingBlockExecution execution) { - + msoLogger.trace("Start runAppcCommand "); + String appcCode = "1002"; + String appcMessage = ""; try { Action action = null; action = Action.valueOf(execution.getVariable("action")); @@ -95,11 +98,23 @@ public class GenericVnfHealthCheck { payloadInfo.put("vfModuleId",execution.getVariable("vfModuleId")); payloadInfo.put("oamIpAddress",execution.getVariable("oamIpAddress")); payloadInfo.put("vnfHostIpAddress",execution.getVariable("vnfHostIpAddress")); + + msoLogger.debug("Running APP-C action: " + action.toString()); + msoLogger.debug("VNFID: " + vnfId); //PayloadInfo contains extra information that adds on to payload before making request to appc appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + appcCode = appCClient.getErrorCode(); + appcMessage = appCClient.getErrorMessage(); - } catch (Exception ex) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + appcMessage = e.getMessage(); + } + msoLogger.error("Error Message: " + appcMessage); + msoLogger.error("ERROR CODE: " + appcCode); + msoLogger.trace("End of runAppCommand "); + if (appcCode != null && !appcCode.equals("0")) { + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); + } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java index 88ae3746ab..b0063c1da1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java @@ -45,6 +45,7 @@ public class OrchestrationStatusValidator { private static final String UNKNOWN_RESOURCE_TYPE = "Building Block (%s) not set up correctly in Orchestration_Status_Validation table in CatalogDB. ResourceType=(%s), TargetAction=(%s)"; private static final String ORCHESTRATION_VALIDATION_FAIL = "Orchestration Status Validation failed. ResourceType=(%s), TargetAction=(%s), OrchestrationStatus=(%s)"; private static final String ORCHESTRATION_STATUS_VALIDATION_RESULT = "orchestrationStatusValidationResult"; + private static final String ALACARTE = "aLaCarte"; private static final String MULTI_STAGE_DESIGN_OFF = "false"; private static final String MULTI_STAGE_DESIGN_ON = "true"; @@ -62,8 +63,10 @@ public class OrchestrationStatusValidator { execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null); - String buildingBlockFlowName = execution.getFlowToBeCalled(); + boolean aLaCarte = (boolean) execution.getVariable(ALACARTE); + String buildingBlockFlowName = execution.getFlowToBeCalled(); + BuildingBlockDetail buildingBlockDetail = catalogDbClient.getBuildingBlockDetail(buildingBlockFlowName); if (buildingBlockDetail == null) { @@ -112,7 +115,7 @@ public class OrchestrationStatusValidator { } OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = catalogDbClient.getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(), orchestrationStatus, buildingBlockDetail.getTargetAction()); - if(ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType()) && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction()) && + if(aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType()) && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction()) && OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) { org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution, previousOrchestrationStatusValidationResult, @@ -138,11 +141,11 @@ public class OrchestrationStatusValidator { private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(BuildingBlockExecution execution, OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult, org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf, OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) { if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult.equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) { - String multiStageDesign = "false"; + String multiStageDesign = MULTI_STAGE_DESIGN_OFF; if (genericVnf.getModelInfoGenericVnf() != null) { multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign(); } - if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase("true")) { + if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) { orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 24246273e8..e9dcdade9f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -81,6 +81,7 @@ public class WorkflowAction { private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage"; private static final String SERVICE_INSTANCES = "serviceInstances"; + private static final String VF_MODULES = "vfModules"; private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI = "WorkflowAction was unable to verify if the instance name already exist in AAI."; private static final String G_ORCHESTRATION_FLOW = "gOrchestrationFlow"; private static final String G_ACTION = "requestAction"; @@ -162,18 +163,6 @@ public class WorkflowAction { execution.setVariable("resourceId", resourceId); execution.setVariable("resourceType", resourceType); - if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { - List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters() - .getUserParams(); - for (Map<String, Object> params : userParams) { - if (params.containsKey(HOMINGSOLUTION)) { - execution.setVariable("homing", true); - execution.setVariable("callHoming", true); - execution.setVariable("homingSolution", params.get(HOMINGSOLUTION)); - } - } - } - if (aLaCarte) { if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); @@ -268,9 +257,10 @@ public class WorkflowAction { logger.info("Sorting for Vlan Tagging"); flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction); } + // By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE if (resourceType == WorkflowType.SERVICE - && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE)) - && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) { + && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE)) + && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) { execution.setVariable("homing", true); execution.setVariable("calledHoming", false); } @@ -281,6 +271,20 @@ public class WorkflowAction { } } + // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, enable it. + if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams(); + for (Map<String, Object> params : userParams) { + if (params.containsKey(HOMINGSOLUTION)) { + if (params.get(HOMINGSOLUTION).equals("none")) { + execution.setVariable("homing", false); + } else { + execution.setVariable("homing", true); + } + } + } + } + if (flowsToExecute.isEmpty()) { throw new IllegalStateException("Macro did not come up with a valid execution path."); } @@ -664,35 +668,38 @@ public class WorkflowAction { } protected Resource extractResourceIdAndTypeFromUri(String uri) { - Pattern patt = Pattern.compile( - "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$"); - Matcher m = patt.matcher(uri); - Boolean generated = false; - - if (m.find()) { - logger.debug("found match on {} : {} " , uri , m); - String type = m.group("type"); - String id = m.group("id"); - String action = m.group("action"); - if (type == null) { - throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri); - } - if (action == null) { - if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) { - id = UUID.randomUUID().toString(); - generated = true; - } - } else { - if (action.matches(supportedTypes)) { - id = UUID.randomUUID().toString(); - generated = true; - type = action; - } - } - return new Resource(WorkflowType.fromString(convertTypeFromPlural(type)), id, generated); - } else { - throw new IllegalArgumentException("Uri could not be parsed: " + uri); - } + Pattern patt = Pattern.compile( + "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$"); + Matcher m = patt.matcher(uri); + Boolean generated = false; + + if (m.find()) { + logger.debug("found match on {} : {} " , uri , m); + String type = m.group("type"); + String id = m.group("id"); + String action = m.group("action"); + if (type == null) { + throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri); + } + if (action == null) { + if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) { + id = UUID.randomUUID().toString(); + generated = true; + }else if (type.equals(VF_MODULES) && id.equals("scaleOut")) { + id = UUID.randomUUID().toString(); + generated = true; + } + } else { + if (action.matches(supportedTypes)) { + id = UUID.randomUUID().toString(); + generated = true; + type = action; + } + } + return new Resource(WorkflowType.fromString(convertTypeFromPlural(type)), id, generated); + } else { + throw new IllegalArgumentException("Uri could not be parsed: " + uri); + } } protected String validateResourceIdInAAI(String generatedResourceId, WorkflowType type, String instanceName, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index 57c760b01f..79a75c532a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -27,6 +27,7 @@ import java.util.Map; import java.util.Optional; import java.util.UUID; +import org.apache.commons.lang3.StringUtils; import org.modelmapper.ModelMapper; import org.modelmapper.PropertyMap; import org.onap.so.adapters.nwrest.ContrailNetwork; @@ -129,7 +130,12 @@ public class NetworkAdapterObjectMapper { deleteNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance)); deleteNetworkRequest.setNetworkId(l3Network.getNetworkId()); - deleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId()); + if (!StringUtils.isEmpty(l3Network.getHeatStackId())){ + deleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId()); + } + else { + deleteNetworkRequest.setNetworkStackId(l3Network.getNetworkName()); + } deleteNetworkRequest.setNetworkType(l3Network.getNetworkType()); deleteNetworkRequest.setSkipAAI(true); deleteNetworkRequest.setTenantId(cloudRegion.getTenantId()); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 560f2a91bf..1a302c29a7 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -169,6 +169,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ @Test public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleNoMultiStageTest() throws Exception { + execution.setVariable("aLaCarte", true); ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); modelInfoGenericVnf.setMultiStageDesign("false"); genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); @@ -179,7 +180,20 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ } @Test + public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleMultiStageButNotAlacarteTest() throws Exception { + execution.setVariable("aLaCarte", false); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setMultiStageDesign("true"); + genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution); + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + assertEquals("", vfModule.getHeatStackId()); + } + + @Test public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleWithMultiStageTest() throws Exception { + execution.setVariable("aLaCarte", true); ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); modelInfoGenericVnf.setMultiStageDesign("true"); genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); @@ -191,6 +205,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ @Test public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleExceptionTest() throws Exception { + execution.setVariable("aLaCarte", true); doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); expectedException.expect(BpmnError.class); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java index dabdc6811c..85915bd4b4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -34,6 +35,7 @@ import java.util.Map; import java.util.Optional; import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; import org.onap.appc.client.lcm.model.Action; @@ -79,9 +81,9 @@ public class ConfigurationScaleOutTest extends BaseTaskTest { controllerSelectionReference.setActionCategory("testAction"); controllerSelectionReference.setVnfType("testVnfType"); String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientGetResponse.json"))); - String expectedPayload = "{\\\"request-parameters\\\":{\\\"vnf-host-ip-address\\\":\\\"10.222.22.2\\\"," - + "\\\"vf-module-id\\\":\\\"testVfModuleId1\\\"},\\\"configuration-parameters\\\"" - + ":{\\\"vnf-id\\\":\\\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\\\",\\\"availability-zone\\\":\\\"AZ-MN02\\\"}}"; + String expectedPayload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\"," + + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\"" + + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}"; execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse); doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.ConfigScaleOut.toString()); @@ -101,9 +103,9 @@ public class ConfigurationScaleOutTest extends BaseTaskTest { Action action = Action.ConfigScaleOut; String vnfId = genericVnf.getVnfId(); String controllerType = "testType"; - String payload = "{\\\"request-parameters\\\":{\\\"vnf-host-ip-address\\\":\\\"10.222.22.2\\\"," - + "\\\"vf-module-id\\\":\\\"testVfModuleId1\\\"},\\\"configuration-parameters\\\"" - + ":{\\\"vnf-id\\\":\\\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\\\",\\\"availability-zone\\\":\\\"AZ-MN02\\\"}}"; + String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\"," + + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\"" + + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}"; HashMap<String, String> payloadInfo = new HashMap<String, String>(); payloadInfo.put("vnfName", "testVnfName"); payloadInfo.put("vfModuleId", "testVfModuleId"); @@ -121,5 +123,54 @@ public class ConfigurationScaleOutTest extends BaseTaskTest { configurationScaleOut.callAppcClient(execution); verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); } + @Test + public void setParamsForConfigurationScaleOutBadPathTest() throws Exception { + ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference(); + controllerSelectionReference.setControllerName("testName"); + controllerSelectionReference.setActionCategory("testAction"); + controllerSelectionReference.setVnfType("testVnfType"); + String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientResponseIncorrectPath.json"))); + String expectedPayload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\"," + + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\"" + + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":null}}"; + execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse); + + doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.ConfigScaleOut.toString()); + + configurationScaleOut.setParamsForConfigurationScaleOut(execution); + + assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId")); + assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName")); + assertEquals("ConfigScaleOut", execution.getVariable("action")); + assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId")); + assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType")); + assertEquals(vfModule.getVfModuleId(), execution.getVariable("vfModuleId")); + assertEquals(expectedPayload, execution.getVariable("payload")); + } + @Test + public void callAppcClientExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + Action action = Action.ConfigScaleOut; + String vnfId = genericVnf.getVnfId(); + String controllerType = "testType"; + String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\"," + + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\"" + + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}"; + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + payloadInfo.put("vfModuleId", "testVfModuleId"); + + execution.setVariable("action", Action.ConfigScaleOut.toString()); + execution.setVariable("msoRequestId", msoRequestId); + execution.setVariable("controllerType", controllerType); + execution.setVariable("vnfId", "testVnfId1"); + execution.setVariable("vnfName", "testVnfName"); + execution.setVariable("vfModuleId", "testVfModuleId"); + execution.setVariable("payload", payload); + + doThrow(Exception.class).when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + configurationScaleOut.callAppcClient(execution); + verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java index 9f0bb910e6..e5e092aace 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -29,6 +30,7 @@ import java.util.HashMap; import java.util.Optional; import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; import org.onap.appc.client.lcm.model.Action; @@ -100,4 +102,33 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest { genericVnfHealthCheck.callAppcClient(execution); verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); } + + @Test + public void callAppcClientExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + Action action = Action.HealthCheck; + String vnfId = genericVnf.getVnfId(); + String payload = "{\"testName\":\"testValue\",}"; + String controllerType = "testType"; + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + payloadInfo.put("vfModuleId", "testVfModuleId"); + payloadInfo.put("oamIpAddress", "testOamIpAddress"); + payloadInfo.put("vnfHostIpAddress", "testOamIpAddress"); + execution.setVariable("action", Action.HealthCheck.toString()); + execution.setVariable("msoRequestId", msoRequestId); + execution.setVariable("controllerType", controllerType); + execution.setVariable("vnfId", "testVnfId1"); + execution.setVariable("vnfName", "testVnfName"); + execution.setVariable("vfModuleId", "testVfModuleId"); + execution.setVariable("oamIpAddress", "testOamIpAddress"); + execution.setVariable("vnfHostIpAddress", "testOamIpAddress"); + execution.setVariable("payload", payload); + + doThrow(Exception.class).when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + + + genericVnfHealthCheck.callAppcClient(execution); + verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java index fa5081da2f..5ef020d6ed 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java @@ -51,7 +51,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { public void test_validateOrchestrationStatus() throws Exception { String flowToBeCalled = "AssignServiceInstanceBB"; setServiceInstance().setOrchestrationStatus(OrchestrationStatus.PRECREATED); - + execution.setVariable("aLaCarte", true); execution.setVariable("flowToBeCalled", flowToBeCalled); BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); @@ -91,6 +91,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { si.setConfigurations(configurations); execution.setVariable("flowToBeCalled", flowToBeCalled); + execution.setVariable("aLaCarte", true); BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); buildingBlockDetail.setBuildingBlockName("UnassignFabricConfigurationBB"); @@ -188,6 +189,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { String flowToBeCalled = "UnassignServiceInstanceBB"; execution.setVariable("flowToBeCalled", flowToBeCalled); + execution.setVariable("aLaCarte", true); BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); buildingBlockDetail.setBuildingBlockName("UnassignServiceInstanceBB"); @@ -209,7 +211,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { String flowToBeCalled = "CreateVfModuleBB"; execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS); - + execution.setVariable("aLaCarte", true); execution.setVariable("flowToBeCalled", flowToBeCalled); GenericVnf genericVnf = buildGenericVnf(); @@ -246,7 +248,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { String flowToBeCalled = "CreateVfModuleBB"; execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.CONTINUE); - + execution.setVariable("aLaCarte", true); execution.setVariable("flowToBeCalled", flowToBeCalled); GenericVnf genericVnf = buildGenericVnf(); @@ -282,7 +284,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { String flowToBeCalled = "CreateVfModuleBB"; execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS); - + execution.setVariable("aLaCarte", true); execution.setVariable("flowToBeCalled", flowToBeCalled); GenericVnf genericVnf = buildGenericVnf(); @@ -318,7 +320,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { String flowToBeCalled = "CreateVfModuleBB"; execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS); - + execution.setVariable("aLaCarte", true); execution.setVariable("flowToBeCalled", flowToBeCalled); GenericVnf genericVnf = buildGenericVnf(); @@ -354,7 +356,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { String flowToBeCalled = "CreateVfModuleBB"; execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS); - + execution.setVariable("aLaCarte", true); execution.setVariable("flowToBeCalled", flowToBeCalled); GenericVnf genericVnf = buildGenericVnf(); @@ -384,4 +386,40 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest { assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult")); } + + @Test + public void test_validateOrchestrationStatusSecondStageOfMultiStageWrongAlacarteValueVfModule() throws Exception { + String flowToBeCalled = "CreateVfModuleBB"; + + execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS); + execution.setVariable("aLaCarte", false); + execution.setVariable("flowToBeCalled", flowToBeCalled); + + GenericVnf genericVnf = buildGenericVnf(); + ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf(); + modelInfoGenericVnf.setMultiStageDesign("true"); + setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf); + setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION); + + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); + buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB"); + buildingBlockDetail.setId(1); + buildingBlockDetail.setResourceType(ResourceType.VF_MODULE); + buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE); + + doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS); + orchestrationStatusStateTransitionDirective.setId(1); + orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION); + orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE); + orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ACTIVATE); + + doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + + assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult")); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 65d16adb40..c27b5dd655 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -1318,7 +1318,7 @@ public class WorkflowActionTest extends BaseTaskTest { String uri5 = "'/v6/serviceInstances/123/vnfs"; String uri6 = "/v6/serviceInstances/123/vnfs/1234/someAction"; String uri7 = "/v6/serviceInstances/123/vnfs/1234/vfModules/5678/replace"; - + String uri8 = "/v6/serviceInstances/123/vnfs/1234/vfModules/scaleOut"; Resource expected1 = new Resource(WorkflowType.SERVICE, "123", true); Resource expected2 = new Resource(WorkflowType.VNF, "1234", false); Resource expected3 = new Resource(WorkflowType.VNF, "1234", false); @@ -1344,6 +1344,10 @@ public class WorkflowActionTest extends BaseTaskTest { result = workflowAction.extractResourceIdAndTypeFromUri(uri7); assertEquals(expected4.getResourceId(),result.getResourceId()); assertEquals(expected4.getResourceType(),result.getResourceType()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri8); + assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length()); + assertEquals("VfModule", result.getResourceType().toString()); + } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index 8f0d00ff86..1283d3ab1a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -301,6 +301,42 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ } @Test + public void deleteNetworkRequestNoHeatIdMapperTest() throws Exception { + DeleteNetworkRequest expectedDeleteNetworkRequest = new DeleteNetworkRequest(); + + String messageId = "messageId"; + expectedDeleteNetworkRequest.setMessageId(messageId); + doReturn(messageId).when(SPY_networkAdapterObjectMapper).getRandomUuid(); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + l3Network.setModelInfoNetwork(modelInfoNetwork); + modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid"); + expectedDeleteNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID()); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedDeleteNetworkRequest.setMsoRequest(msoRequest); + + expectedDeleteNetworkRequest.setNetworkId(l3Network.getNetworkId()); + + l3Network.setNetworkName("heatStackId"); + expectedDeleteNetworkRequest.setNetworkStackId("heatStackId"); + + expectedDeleteNetworkRequest.setNetworkType(l3Network.getNetworkType()); + + expectedDeleteNetworkRequest.setSkipAAI(true); + + expectedDeleteNetworkRequest.setTenantId(cloudRegion.getTenantId()); + + expectedDeleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + + DeleteNetworkRequest deleteNetworkRequest = SPY_networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network); + + assertThat(expectedDeleteNetworkRequest, sameBeanAs(deleteNetworkRequest)); + } + + @Test public void buildOpenstackSubnetListTest() throws Exception { ObjectMapper omapper = new ObjectMapper(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java index 04397c499d..f492ba3ead 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java @@ -27,7 +27,10 @@ import static org.junit.Assert.assertNull; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.junit.Rule; import org.junit.Test; @@ -40,6 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; @@ -80,8 +84,8 @@ public class VfModuleTopologyOperationRequestMapperTest { customer.getServiceSubscription().getServiceInstances().add(serviceInstance); // RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); + HashMap<String,String> userParams = new HashMap<String,String>(); + userParams.put("key1", "value1"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); @@ -108,7 +112,7 @@ public class VfModuleTopologyOperationRequestMapperTest { modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); vfModule.setModelInfoVfModule(modelInfoVfModule); HashMap<String, String> cloudParams = new HashMap<String, String>(); - userParams.put("key2", "value2"); + cloudParams.put("key2", "value2"); vfModule.setCloudParams(cloudParams); VolumeGroup volumeGroup = new VolumeGroup(); @@ -189,9 +193,14 @@ public class VfModuleTopologyOperationRequestMapperTest { customer.getServiceSubscription().getServiceInstances().add(serviceInstance); // RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - requestContext.setUserParams(userParams); + RequestParameters requestParameters = new RequestParameters(); + HashMap<String,Object> userParams1 = new HashMap<String,Object>(); + userParams1.put("key1", "value1"); + List<Map<String,Object>> userParams = new ArrayList<Map<String,Object>>(); + userParams.add(userParams1); + + requestParameters.setUserParams(userParams); + requestContext.setRequestParameters(requestParameters); requestContext.setProductFamilyId("productFamilyId"); GenericVnf vnf = new GenericVnf(); @@ -225,7 +234,7 @@ public class VfModuleTopologyOperationRequestMapperTest { assertNull(vfModuleSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); assertEquals("vnfModelCustomizationUuid", vfModuleSDNCrequest.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid()); - assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid()); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json index d5d234cbf6..e052360c6c 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json @@ -107,11 +107,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -127,11 +127,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json index aa6320801e..84ce037a2d 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json @@ -102,11 +102,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -122,11 +122,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json index 5addff2d70..0185d56d06 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mtn6", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json index fadbf9c244..d850e51593 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mtn6", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json index 97611c1d62..ab98fa4b70 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "ERROR", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json index 181494dff2..5432133631 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json @@ -73,11 +73,11 @@ { "related-to": "cloud-region", "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DYH1A", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -94,11 +94,11 @@ { "related-to": "tenant", "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json index b22f389c40..81f9a78e86 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json @@ -73,11 +73,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -91,11 +91,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml index 6dd91c64c9..5e1e2f62a3 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml @@ -68,10 +68,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -84,10 +84,10 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json index f076c9044c..a99d25bdc9 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json @@ -73,11 +73,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml index 92fec2dc64..8b70a139e6 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml @@ -71,10 +71,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -87,10 +87,10 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json index 4817dfb74d..6c6981b96a 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json @@ -133,7 +133,7 @@ }, "cloudRegion" : { "lcp-cloud-region-id" : "DYH1A", - "cloud-owner" : "att-aic", + "cloud-owner" : "CloudOwner", "tenant-id" : "7f3db563322146a688601ade1294a749", "complex" : "c1", "cloud-region-version" : "aic3.0" diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json index 36bc04b6c6..2a5a18f613 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json @@ -73,11 +73,11 @@ { "related-to": "cloud-region", "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DYH1A", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -94,11 +94,11 @@ { "related-to": "tenant", "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/7f3db563322146a688601ade1294a749", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DYH1A/tenants/tenant/7f3db563322146a688601ade1294a749", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json index b22f389c40..81f9a78e86 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json @@ -73,11 +73,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -91,11 +91,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json index 5addff2d70..0185d56d06 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mtn6", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf index 9159d80c43..f1ba9c52fe 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf @@ -15,7 +15,7 @@ "assignmentInfo": [ { "variableName": "cloudOwner", - "variableValue": "att-aic" + "variableValue": "CloudOwner" }, { "variableName": "vnfHostName", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientResponseIncorrectPath.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientResponseIncorrectPath.json new file mode 100644 index 0000000000..7e263b4465 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientResponseIncorrectPath.json @@ -0,0 +1,29 @@ +{ + "vnf-topology": { + "tenant": "0422ffb57ba042c0800a29dc85ca70f8", + "vnf-topology-identifier-structure": { + "vnf-id": "66dac89b-2a5b-4cb9-b22e-a7e4488fb3db", + "vnf-type": "InfraMSO_vSAMP10a_Service/InfraMSO_vSAMP10a-2 0", + "vnf-name": "MSO-DEV-VNF-1806HF1-InfraMSO_vSAMP10a-1XXX-GR_21" + }, + "aic-clli": "AUSTTXGR", + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + { + "test":"AZ-MN02" + } + ], + "max-count": 1 + } + }, + "aic-cloud-region": "mtn6", + "onap-model-information": { + "model-customization-uuid": "034226ae-879a-46b5-855c-d02babcb6cb6", + "model-uuid": "cb79c25f-b30d-4d95-afb5-97be4021f3db", + "model-invariant-uuid": "e93d3a7a-446d-486b-ae48-d474a9156064", + "model-name": "InfraMSO_vSAMP10a-2", + "model-version": "1.0" + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml index 5a2b7300b1..2d1ce54f9d 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -12,7 +12,7 @@ <related-to>volume-group</related-to> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml index 7e913dd418..ff33ca3e07 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -10,7 +10,7 @@ <related-to>tenant</related-to> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml index 6f67a9ccc4..d9ad1363e4 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml +++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml @@ -1,6 +1,7 @@ aai: auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 endpoint: http://localhost:${wiremock.server.port} + pnfEntryNotificationTimeout: P14D appc: client: key: iaEMAfjsVsZnraBP @@ -29,6 +30,16 @@ log: sdncAdapter: 'true' vnfAdapterCreateV1: 'true' vnfAdapterRestV1: 'true' +pnf: + dmaap: + host: hostTest + port: 1234 + protocol: http + uriPathPrefix: events + topicName: pnfReady + consumerGroup: consumerGroup + consumerId: consumerId + topicListenerDelayInSeconds: 5 mso: adapters: requestDb: diff --git a/common/pom.xml b/common/pom.xml index 8b0f19cfc4..a68b3f0403 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -44,12 +44,12 @@ <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-kit</artifactId> - <version>1.3.0</version> + <version>1.4.0</version> </dependency> <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-lib</artifactId> - <version>1.3.0</version> + <version>1.4.0</version> </dependency> <dependency> <groupId>org.springframework</groupId> @@ -139,6 +139,11 @@ <artifactId>logging-slf4j</artifactId> <version>1.2.2</version> </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> <resources> @@ -152,6 +157,36 @@ <include>**/*.java</include> </includes> </resource> - </resources> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <goals> + <goal>test</goal> + </goals> + <configuration> + <includes> + <include>**/NonSpringSuite.java</include> + </includes> + </configuration> + </execution> + <execution> + <id>spring-tests</id> + <goals> + <goal>test</goal> + </goals> + <configuration> + <includes> + <include>**/SpringSuite.java</include> + </includes> + </configuration> + </execution> + </executions> + </plugin> + </plugins> </build> </project> diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java index 0e50818f0f..51d09006db 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java @@ -49,6 +49,8 @@ import org.onap.aai.domain.yang.Pserver; import org.onap.aai.domain.yang.RouteTableReferences; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.ServiceSubscription; +import org.onap.aai.domain.yang.SpPartner; +import org.onap.aai.domain.yang.Device; import org.onap.aai.domain.yang.Subnet; import org.onap.aai.domain.yang.Tenant; import org.onap.aai.domain.yang.TunnelXconnect; @@ -108,6 +110,8 @@ public enum AAIObjectType implements GraphInventoryObjectType { CONNECTOR(AAINamespaceConstants.BUSINESS, Connector.class), NETWORK_TECHNOLOGY(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, NetworkTechnology.class), SUBNET(AAIObjectType.L3_NETWORK.uriTemplate(), Subnet.class), + SP_PARTNER(AAINamespaceConstants.BUSINESS, SpPartner.class), + DEVICE(AAINamespaceConstants.NETWORK, Device.class), EXT_AAI_NETWORK(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class), UNKNOWN("", ""); diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java index 9b5acc5bee..76413c2594 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java @@ -34,6 +34,8 @@ import org.onap.so.client.graphinventory.entities.uri.SimpleUri; public class AAISimpleUri extends SimpleUri implements AAIResourceUri { + private static final long serialVersionUID = -6397024057188453229L; + protected AAISimpleUri(AAIObjectType type, Object... values) { super(type, values); diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java index 3589075ee5..77c61089a4 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java @@ -25,6 +25,7 @@ import java.net.URI; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; + public class AAIUriFactory { /** @@ -53,7 +54,12 @@ public class AAIUriFactory { return new NodesUri(type, values); } - + + public static AAIResourceUri createNodesUri(AAIObjectPlurals type) { + return new NodesUri(type); + + } + /** * This method should only be used to wrap a URI retrieved from A&AI contained within an object response * @@ -64,7 +70,21 @@ public class AAIUriFactory { public static AAIResourceUri createResourceFromExistingURI(AAIObjectType type, URI uri) { return new AAISimpleUri(type, uri); } - + + + /** + * creates an AAIResourceUri from a parentUri + * + * @param parentUri + * @param childType + * @param childValues + * @return + */ + public static AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) { + + return new AAISimpleUri(parentUri, childType, childValues); + } + /** * Creates a uri for a plural type e.g. /cloud-infrastructure/pservers * @@ -88,4 +108,4 @@ public class AAIUriFactory { return new AAISimpleUri(type, values); } -} +}
\ No newline at end of file diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java index 091d0c9e97..329471243b 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java @@ -30,6 +30,7 @@ import org.onap.so.client.aai.AAIResourcesClient; public class AllottedResourceLookupUri extends HttpLookupUri { + private static final long serialVersionUID = -9212594383876793188L; protected AllottedResourceLookupUri(Object... values) { super(AAIObjectType.ALLOTTED_RESOURCE, values); } diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java index 3c9ca0ed7f..6ffc6ecd9b 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java @@ -29,6 +29,8 @@ import org.onap.so.client.graphinventory.GraphInventoryObjectType; public class NodesUri extends AAISimpleUri { + private static final long serialVersionUID = 8818689895730182042L; + protected NodesUri(AAIObjectType type, Object... values) { super(type, values); } diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java index 00a213b264..324193dc84 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java @@ -30,6 +30,7 @@ import org.onap.so.client.aai.AAIResourcesClient; public class ServiceInstanceUri extends HttpLookupUri { + private static final long serialVersionUID = 2248914170527514548L; protected ServiceInstanceUri(Object... values) { super(AAIObjectType.SERVICE_INSTANCE, values); } diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java index 026f1c3929..874b06e192 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java @@ -20,6 +20,10 @@ package org.onap.so.client.graphinventory.entities.uri; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.net.URI; import java.nio.charset.StandardCharsets; @@ -29,18 +33,19 @@ import java.util.Map; import javax.ws.rs.core.UriBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.onap.so.client.graphinventory.Format; import org.onap.so.client.aai.entities.uri.AAIUri; -import org.onap.so.client.graphinventory.entities.uri.Depth; -import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser; -import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl; +import org.onap.so.client.graphinventory.Format; import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; import org.onap.so.client.graphinventory.GraphInventoryObjectType; +import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser; +import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl; import org.springframework.web.util.UriUtils; -public class SimpleUri implements GraphInventoryResourceUri { +public class SimpleUri implements GraphInventoryResourceUri, Serializable { - protected UriBuilder internalURI; + private static final long serialVersionUID = -337701171277616439L; + + protected transient UriBuilder internalURI; protected final static String relationshipAPI = "/relationship-list/relationship"; protected final static String relatedTo = "/related-to"; protected final Object[] values; @@ -89,6 +94,9 @@ public class SimpleUri implements GraphInventoryResourceUri { this.values = childValues; } + protected void setInternalURI(UriBuilder builder) { + this.internalURI = builder; + } @Override public SimpleUri relationshipAPI() { this.internalURI = internalURI.path(relationshipAPI); @@ -236,4 +244,14 @@ public class SimpleUri implements GraphInventoryResourceUri { return type.uriTemplate(); } + private void writeObject(ObjectOutputStream oos) throws IOException { + oos.defaultWriteObject(); + oos.writeUTF(this.internalURI.toTemplate()); + } + + private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { + ois.defaultReadObject(); + String uri = ois.readUTF(); + this.setInternalURI(UriBuilder.fromUri(uri)); + } } diff --git a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java index be79c8b927..b11003ed1e 100644 --- a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java +++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java @@ -47,6 +47,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class SDNOValidatorImpl implements SDNOValidator { private final static String clientName = "MSO"; + private final static String HEALTH_DIAGNOSTIC_CODE_DEFAULT = "default"; @Override public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception { @@ -99,6 +100,7 @@ public class SDNOValidatorImpl implements SDNOValidator { request.setRequestNodeIp(vnf.getIpv4OamAddress()); //generic-vnf oam ip request.setRequestUserId(requestingUserId); //mech id? request.setRequestId(uuid.toString()); //something to identify this request by for polling + request.setHealthDiagnosticCode(HEALTH_DIAGNOSTIC_CODE_DEFAULT); input.setRequestHealthDiagnostic(request); diff --git a/common/src/main/java/org/onap/so/constants/Defaults.java b/common/src/main/java/org/onap/so/constants/Defaults.java index 06c6fae467..13a378eadb 100644 --- a/common/src/main/java/org/onap/so/constants/Defaults.java +++ b/common/src/main/java/org/onap/so/constants/Defaults.java @@ -20,19 +20,35 @@ package org.onap.so.constants; +import java.util.Optional; + +import org.onap.so.spring.SpringContextHelper; +import org.springframework.context.ApplicationContext; + public enum Defaults { - CLOUD_OWNER("att-aic"); - - - private final String value; + CLOUD_OWNER("org.onap.so.cloud-owner", "CloudOwner"); - private Defaults(String value) { - this.value = value; + private final String propName; + private final String defaultValue; + + private Defaults(String propName, String defaultValue) { + this.defaultValue = defaultValue; + this.propName = propName; } @Override public String toString() { - return this.value; + Optional<ApplicationContext> context = getAppContext(); + if (context.isPresent()) { + return context.get().getEnvironment().getProperty(this.propName, this.defaultValue); + } else { + return this.defaultValue; + } + + } + + protected Optional<ApplicationContext> getAppContext() { + return Optional.ofNullable(SpringContextHelper.getAppContext()); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java b/common/src/main/java/org/onap/so/spring/SpringContextHelper.java index edc544d939..1fae5f3e23 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java +++ b/common/src/main/java/org/onap/so/spring/SpringContextHelper.java @@ -18,9 +18,8 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common; +package org.onap.so.spring; -import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; @@ -31,7 +30,7 @@ public class SpringContextHelper implements ApplicationContextAware { private static ApplicationContext context; @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + public void setApplicationContext(ApplicationContext applicationContext) { context = applicationContext; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/SpringContextHelper.java b/common/src/test/java/org/onap/so/NonSpringSuite.java index 5f30edd8d9..86bb421123 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/SpringContextHelper.java +++ b/common/src/test/java/org/onap/so/NonSpringSuite.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,24 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.asdc.tenantIsolation; +package org.onap.so; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Component; +import org.junit.runner.RunWith; +import org.onap.so.test.categories.SpringAware; -@Component -public class SpringContextHelper implements ApplicationContextAware { +import com.googlecode.junittoolbox.ExcludeCategories; +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; - private static ApplicationContext context; +@RunWith(WildcardPatternSuite.class) +@ExcludeCategories({SpringAware.class}) +@SuiteClasses({"**/*Test.class"}) +public class NonSpringSuite { - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - context = applicationContext; - } - - public static ApplicationContext getAppContext() { - return context; - } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java b/common/src/test/java/org/onap/so/SpringSuite.java index 6d61d3bb34..93d4d31f5c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java +++ b/common/src/test/java/org/onap/so/SpringSuite.java @@ -2,9 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,23 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.apihandlerinfra; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Component; +package org.onap.so; -@Component -public class SpringContextHelper implements ApplicationContextAware { +import org.junit.runner.RunWith; +import org.onap.so.test.categories.SpringAware; - private static ApplicationContext context; +import com.googlecode.junittoolbox.IncludeCategories; +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; - @Override - public void setApplicationContext(ApplicationContext applicationContext) { - context = applicationContext; - } +@RunWith(WildcardPatternSuite.class) +@IncludeCategories({SpringAware.class}) +@SuiteClasses({"**/*Test.class"}) +public class SpringSuite { - public static ApplicationContext getAppContext() { - return context; - } } diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java index fcf054f489..2a0e9df9ed 100644 --- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java +++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java @@ -21,15 +21,24 @@ package org.onap.so.client.aai.entities.uri; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.collection.IsIterableContainingInOrder.contains; import static org.hamcrest.collection.IsEmptyCollection.empty; +import static org.hamcrest.collection.IsIterableContainingInOrder.contains; import static org.junit.Assert.assertEquals; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.util.Map; import org.junit.Test; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.so.client.graphinventory.entities.uri.SimpleUri; public class AAISimpleUriTest { @@ -83,4 +92,31 @@ public class AAISimpleUriTest { assertEquals("my value", keys.get("service-type")); } + + @Test + public void serializeTest() throws IOException, ClassNotFoundException { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); + + uri.depth(Depth.ONE); + uri.limit(1); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + ObjectOutputStream objectOutputStream + = new ObjectOutputStream(bos); + objectOutputStream.writeObject(uri); + objectOutputStream.flush(); + objectOutputStream.close(); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + + ObjectInputStream objectInputStream + = new ObjectInputStream(bis); + AAIResourceUri e2 = (AAIResourceUri) objectInputStream.readObject(); + objectInputStream.close(); + + uri.queryParam("test", "value"); + e2.queryParam("test", "value"); + + assertEquals(e2.build().toString(), uri.build().toString()); + } } diff --git a/common/src/test/java/org/onap/so/constants/DefaultsTest.java b/common/src/test/java/org/onap/so/constants/DefaultsTest.java new file mode 100644 index 0000000000..6383d0ea4c --- /dev/null +++ b/common/src/test/java/org/onap/so/constants/DefaultsTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.constants; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; +import org.onap.so.spring.SpringContextHelper; +import org.onap.so.test.categories.SpringAware; +import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = SpringContextHelper.class, initializers = ConfigFileApplicationContextInitializer.class) +@ActiveProfiles("test") +@Category(SpringAware.class) +public class DefaultsTest { + + @Test + public void checkValue() { + + assertEquals("my-custom-owner", Defaults.CLOUD_OWNER.toString()); + } +} diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java b/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java index 5af84fdb86..946214efa4 100644 --- a/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java +++ b/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java @@ -56,7 +56,7 @@ public class ServiceInstanceBeansTest { cloudConfiguration.setLcpCloudRegionId("myRegionId"); ObjectMapper mapper = new ObjectMapper(); - assertEquals("{\"cloudOwner\":\"att-aic\",\"lcpCloudRegionId\":\"myRegionId\"}", mapper.writeValueAsString(cloudConfiguration)); + assertEquals("{\"cloudOwner\":\"CloudOwner\",\"lcpCloudRegionId\":\"myRegionId\"}", mapper.writeValueAsString(cloudConfiguration)); } diff --git a/common/src/test/java/org/onap/so/test/categories/SpringAware.java b/common/src/test/java/org/onap/so/test/categories/SpringAware.java new file mode 100644 index 0000000000..21035fcd4d --- /dev/null +++ b/common/src/test/java/org/onap/so/test/categories/SpringAware.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.test.categories; + +public interface SpringAware { + /* category marker */ +} diff --git a/common/src/test/resources/__files/aai/resources/e2e-complex.json b/common/src/test/resources/__files/aai/resources/e2e-complex.json index 21bacbd5ce..e3d830e978 100644 --- a/common/src/test/resources/__files/aai/resources/e2e-complex.json +++ b/common/src/test/resources/__files/aai/resources/e2e-complex.json @@ -547,11 +547,11 @@ }, { "related-to": "cloud-region", - "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtcnj2", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtcnj2", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -567,11 +567,11 @@ }, { "related-to": "oam-network", - "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -591,11 +591,11 @@ }, { "related-to": "oam-network", - "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -615,11 +615,11 @@ }, { "related-to": "oam-network", - "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -639,11 +639,11 @@ }, { "related-to": "availability-zone", - "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/common/src/test/resources/application-test.yaml b/common/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..1a3e97c451 --- /dev/null +++ b/common/src/test/resources/application-test.yaml @@ -0,0 +1,4 @@ +org: + onap: + so: + cloud-owner: my-custom-owner
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java index 5675588f62..1ea77acf95 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java @@ -23,9 +23,9 @@ package org.onap.so.apihandlerinfra.tenantisolation; import java.net.MalformedURLException; import java.net.URL; -import org.onap.so.apihandlerinfra.SpringContextHelper; import org.onap.so.client.aai.AAIProperties; import org.onap.so.client.aai.AAIVersion; +import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; public class AaiClientPropertiesImpl implements AAIProperties { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java index 58a7cb2bff..f83e707258 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java @@ -25,8 +25,8 @@ import java.net.URL; import javax.ws.rs.core.MediaType; -import org.onap.so.apihandlerinfra.SpringContextHelper; import org.onap.so.client.grm.GRMProperties; +import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; public class GrmClientPropertiesImpl implements GRMProperties { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java index 0e26178e56..813299c370 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java @@ -23,8 +23,8 @@ package org.onap.so.apihandlerinfra.tenantisolation.dmaap; import java.util.HashMap; import java.util.Map; -import org.onap.so.apihandlerinfra.SpringContextHelper; import org.onap.so.client.dmaap.DmaapProperties; +import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; public class DmaapPropertiesImpl implements DmaapProperties { diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java index d66e378146..951f02e5d8 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java @@ -172,6 +172,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); final Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class); + InfraActiveRequests infraActiveRequests = null; if (instanceName != null && !instanceName.equals("")) { @@ -229,18 +230,17 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep } } } - - predicates.add(tableRoot.get(REQUEST_STATUS) + if(!predicates.isEmpty()){ + predicates.add(tableRoot.get(REQUEST_STATUS) .in(Arrays.asList("PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK"))); - final Order order = cb.desc(tableRoot.get(START_TIME)); - - final List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order); - - InfraActiveRequests infraActiveRequests = null; - - if (dupList != null && !dupList.isEmpty()) { - infraActiveRequests = dupList.get(0); + final Order order = cb.desc(tableRoot.get(START_TIME)); + + final List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order); + + if (dupList != null && !dupList.isEmpty()) { + infraActiveRequests = dupList.get(0); + } } return infraActiveRequests; diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java index b7eb7642a2..4097aee7d5 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java @@ -22,6 +22,7 @@ package org.onap.so.db.request.data.repository; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.ACTION; import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.REQUEST_ID; @@ -181,4 +182,12 @@ public class InfraActiveRequestsRepositoryImplTest { objUnderTest.getInfraActiveRequests(null, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, MAX_LIMIT); assertTrue(actualRequests.isEmpty()); } + + @Test + public void checkInstanceNameDuplicateNullInstanceNameTest(){ + Map<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "e05864f0-ab35-47d0-8be4-56fd9619ba3b"); + InfraActiveRequests results = objUnderTest.checkInstanceNameDuplicate((HashMap<String, String>)instanceIdMap, null, "vnf"); + assertNull(results); + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java index b1c81cf8d8..e6d02c6836 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java @@ -23,6 +23,7 @@ package org.onap.so.db.catalog.beans; import com.fasterxml.jackson.annotation.JsonProperty; import com.openpojo.business.annotation.BusinessKey; import org.apache.commons.lang3.builder.HashCodeBuilder; + import java.util.Date; import org.apache.commons.lang3.builder.EqualsBuilder; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkRecipe.java index 73056e2f8c..51bcd54ae1 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkRecipe.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkRecipe.java @@ -59,6 +59,9 @@ public class NetworkRecipe implements Serializable, Recipe { @Column(name = "RECIPE_TIMEOUT") private Integer recipeTimeout; + @Column(name = "VERSION_STR") + private String versionStr; + @BusinessKey @Column(name = "SERVICE_TYPE") private String serviceType; @@ -171,4 +174,12 @@ public class NetworkRecipe implements Serializable, Recipe { sb.append(",networkParamXSD=" + paramXsd); return sb.toString(); } + + public String getVersionStr() { + return versionStr; + } + + public void setVersionStr(String versionStr) { + this.versionStr = versionStr; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java index aef2ac5e74..ab2eb622c1 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java @@ -71,6 +71,9 @@ public class VnfRecipe implements Serializable, Recipe { @Column(name = "RECIPE_TIMEOUT") private Integer recipeTimeout; + @Column(name = "VERSION_STR") + private String versionStr; + @BusinessKey @Column(name = "SERVICE_TYPE") private String serviceType; @@ -184,4 +187,12 @@ public class VnfRecipe implements Serializable, Recipe { public Date getCreated() { return created; } + + public String getVersionStr() { + return versionStr; + } + + public void setVersionStr(String versionStr) { + this.versionStr = versionStr; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java index 4f070e71c9..8a61102322 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -590,7 +590,6 @@ public class CatalogDbClient { this.postSingleResource(cloudSiteClient, cloudSite); } - public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){ return this.getSingleResource(cloudSiteClient, getUri(UriBuilder .fromUri(findByClliAndCloudVersion) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java index 1241dac4ee..22f3ccbead 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java @@ -28,4 +28,5 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource; public interface ArRecipeRepository extends JpaRepository<ArRecipe, String> { ArRecipe findByModelNameAndAction(String modelName, String action); + ArRecipe findByModelNameAndActionAndVersion(String modelName, String action, String version); } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java index 10290b5877..c74fade8e3 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java @@ -27,4 +27,5 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "networkRecipe", path = "networkRecipe") public interface NetworkRecipeRepository extends JpaRepository<NetworkRecipe, String> { NetworkRecipe findFirstByModelNameAndAction(String modelName, String action); + NetworkRecipe findFirstByModelNameAndActionAndVersionStr(String modelName, String action, String versionStr); }
\ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java index dbc86cbb8f..b99e2bd4b6 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,4 +29,6 @@ public interface VnfRecipeRepository extends JpaRepository<VnfRecipe, String> { VnfRecipe findVnfRecipeByServiceTypeAndAction(String serviceType, String action); VnfRecipe findFirstVnfRecipeByNfRoleAndAction(String nfRole, String action); + + VnfRecipe findFirstVnfRecipeByNfRoleAndActionAndVersionStr(String nfRole, String action, String versionStr); }
\ No newline at end of file diff --git a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml index d1d2d00e94..8235c7480a 100644 --- a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml +++ b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml @@ -6,12 +6,13 @@ ssl-enable: false camunda: rest: api: - url: http://bpmn-infra:8081/engine-rest/engine/ + url: http://so-bpmn-infra.onap:8081/sobpmnengine/engine/ engine: default - auth: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== + auth: Basic YXBpaEJwbW46cGFzc3dvcmQxJA== mso: database: rest: api: - url: http://so-request-db-adapter:8083/infraActiveRequests/ + url: http://so-request-db-adapter.onap:8083/infraActiveRequests/ auth: Basic YnBlbDpwYXNzd29yZDEk + diff --git a/version.properties b/version.properties index a254b216d6..fb21064ed9 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=3 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} |