diff options
15 files changed, 364 insertions, 103 deletions
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 56ec77cdee..da7aad4319 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 @@ -986,11 +986,30 @@ public class ToscaResourceInstaller { pnfResourceCustomization.setBlueprintVersion(getStringValue(properties.get(SDNC_MODEL_VERSION))); pnfResourceCustomization.setSkipPostInstConf(getBooleanValue(properties.get(SKIP_POST_INST_CONF))); pnfResourceCustomization.setControllerActor(getStringValue(properties.get(CONTROLLER_ACTOR))); - pnfResourceCustomization.setDefaultSoftwareVersion(getStringValue(properties.get(DEFAULT_SOFTWARE_VERSION))); + pnfResourceCustomization.setDefaultSoftwareVersion(extractDefaultSoftwareVersionFromSwVersions(properties)); pnfResourceCustomization.setPnfResources(pnfResource); return pnfResourceCustomization; } + private String extractDefaultSoftwareVersionFromSwVersions(Map<String, Property> properties) { + final String SOFTWARE_VERSIONS = "software_versions"; + final String EMPTY_STRING = ""; + String defaultSoftwareVersionValue = getStringValue(properties.get(DEFAULT_SOFTWARE_VERSION)); + if (defaultSoftwareVersionValue != null && !defaultSoftwareVersionValue.isEmpty()) { + return defaultSoftwareVersionValue; + } + if (properties.containsKey(SOFTWARE_VERSIONS) && properties.get(SOFTWARE_VERSIONS).getValue() != null) { + if (properties.get(SOFTWARE_VERSIONS).getValue() instanceof List) { + List<String> propertyValueList = (List) properties.get(SOFTWARE_VERSIONS).getValue(); + return propertyValueList.get(0); + } else if (properties.get(SOFTWARE_VERSIONS).getValue() instanceof String) { + return getStringValue(properties.get(SOFTWARE_VERSIONS)); + } + } + + return EMPTY_STRING; + } + /** * Get value from {@link Property} and cast to boolean value. Return true if property is null. */ diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java index eafb42a3d9..bf2b8ad7bc 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java @@ -19,9 +19,7 @@ package org.onap.so.asdc.client; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; @@ -38,6 +36,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.asdc.BaseTest; import org.onap.so.asdc.client.exceptions.ASDCControllerException; @@ -149,8 +148,8 @@ public class ASDCControllerITTest extends BaseTest { * Mock the AAI using wireshark. */ private void initMockAaiServer(final String serviceUuid, final String serviceInvariantUuid) { - String modelEndpoint = "/aai/v17/service-design-and-creation/models/model/" + serviceInvariantUuid - + "/model-vers/model-ver/" + serviceUuid + "?depth=0"; + String modelEndpoint = "/aai/" + AAIVersion.LATEST + "/service-design-and-creation/models/model/" + + serviceInvariantUuid + "/model-vers/model-ver/" + serviceUuid + "?depth=0"; wireMockServer.stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok())); } @@ -453,16 +452,16 @@ public class ASDCControllerITTest extends BaseTest { } /** - * Test with service-pnfservice.csar. + * Test with service-Ericservice-csar.csar to test default_software_version field. */ @Test - public void treatNotification_ValidPnfResource_With_Software_Version_ExpectedOutput() { + public void treatNotification_ValidPnfResource_With_Default_Software_Version_ExpectedOutput() { /** * service UUID/invariantUUID from global metadata in service-PnfServiceTestCds-template.yml. */ - String serviceUuid = "888d93bd-ef31-4ab8-9d9e-3935e9a71845";// "77cf276e-905c-43f6-8d54-dda474be2f2e"; - String serviceInvariantUuid = "e5c5fd11-392f-4aa7-aeeb-b340c596d4bd";// "913e6776-4bc3-49b9-b399-b5bb4690f0c7"; + String serviceUuid = "8e7b2bd7-6901-4cc2-b3fb-3b6a1d5631e3";// "77cf276e-905c-43f6-8d54-dda474be2f2e"; + String serviceInvariantUuid = "9a5f99c8-0492-4691-b29a-7360d9c3aae3";// "913e6776-4bc3-49b9-b399-b5bb4690f0c7"; initMockAaiServer(serviceUuid, serviceInvariantUuid); @@ -493,11 +492,11 @@ public class ASDCControllerITTest extends BaseTest { ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid) .orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found")); assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID()); - assertEquals("tosca csar name", "service-Testserviceforpnf-csar.csar", toscaCsar.getName()); + assertEquals("tosca csar name", "service-Ericservice-csar.csar", toscaCsar.getName()); assertEquals("tosca csar version", "1.0", toscaCsar.getVersion()); assertNull("tosca csar descrption", toscaCsar.getDescription()); assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum()); - assertEquals("toscar csar URL", "/download/service-Testserviceforpnf-csar.csar", toscaCsar.getUrl()); + assertEquals("toscar csar URL", "/download/service-Ericservice-csar.csar", toscaCsar.getUrl()); /** * Check the service entity, it should be the same as global metadata information in @@ -510,18 +509,18 @@ public class ASDCControllerITTest extends BaseTest { * Check PNF resource, it should be the same as metadata in the topology template in * service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml */ - String pnfResourceKey = "72a2c44c-bb8a-4086-824b-0662d40bcd68"; + String pnfResourceKey = "7a90f80b-a6f6-4597-8c48-80bda26b4823"; /** * Check PNF resource customization, it should be the same as metadata in the topology template in * service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml */ - String pnfCustomizationKey = "96642e60-17cd-48c1-875d-b00b08fdb37b";// "9f01263a-eaf7-4d98-a37b-3785f751903e"; + String pnfCustomizationKey = "c850a53b-b63e-4043-ab10-53aabda78d37";// "9f01263a-eaf7-4d98-a37b-3785f751903e"; PnfResourceCustomization pnfCustomization = pnfCustomizationRepository.findById(pnfCustomizationKey) .orElseThrow(() -> new EntityNotFoundException( "PNF resource customization: " + pnfCustomizationKey + " not found")); assertEquals("model customizationUUID", pnfCustomizationKey, pnfCustomization.getModelCustomizationUUID()); - assertEquals("model instance name", "VSP_WithPNFD 1", pnfCustomization.getModelInstanceName()); + assertEquals("model instance name", "demo-PNF 1", pnfCustomization.getModelInstanceName()); assertEquals("NF type", "", pnfCustomization.getNfType()); assertEquals("NF Role", "", pnfCustomization.getNfRole()); assertEquals("NF function", "", pnfCustomization.getNfFunction()); @@ -562,6 +561,115 @@ public class ASDCControllerITTest extends BaseTest { } } + /** + * Test with service-Ericservice-csar.csar to test software_vesrions field. + */ + @Test + public void treatNotification_ValidPnfResource_With_Software_Version_ExpectedOutput() { + + /** + * service UUID/invariantUUID from global metadata in service-PnfServiceTestCds-template.yml. + */ + String serviceUuid = "8e7b2bd7-6901-4cc2-b3fb-3b6a1d5631e3";// "77cf276e-905c-43f6-8d54-dda474be2f2e"; + String serviceInvariantUuid = "9a5f99c8-0492-4691-b29a-7360d9c3aae3";// "913e6776-4bc3-49b9-b399-b5bb4690f0c7"; + + initMockAaiServer(serviceUuid, serviceInvariantUuid); + + NotificationDataImpl notificationData = new NotificationDataImpl(); + notificationData.setServiceUUID(serviceUuid); + notificationData.setDistributionID(distributionId); + notificationData.setServiceInvariantUUID(serviceInvariantUuid); + notificationData.setServiceVersion("1.0"); + + ResourceInfoImpl resourceInfo = constructPnfResourceInfoWithSWV1(); + List<ResourceInfoImpl> resourceInfoList = new ArrayList<>(); + resourceInfoList.add(resourceInfo); + notificationData.setResources(resourceInfoList); + + ArtifactInfoImpl artifactInfo = constructPnfServiceArtifactWithSWV(); + List<ArtifactInfoImpl> artifactInfoList = new ArrayList<>(); + artifactInfoList.add(artifactInfo); + notificationData.setServiceArtifacts(artifactInfoList); + + try { + asdcController.treatNotification(notificationData); + + logger.info("Checking the database for PNF ingestion"); + + /** + * Check the tosca csar entity, it should be the same as provided from NotficationData. + */ + ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid) + .orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found")); + assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID()); + assertEquals("tosca csar name", "service-Ericservice-csar.csar", toscaCsar.getName()); + assertEquals("tosca csar version", "1.0", toscaCsar.getVersion()); + assertNull("tosca csar descrption", toscaCsar.getDescription()); + assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum()); + assertEquals("toscar csar URL", "/download/service-Ericservice-csar.csar", toscaCsar.getUrl()); + + /** + * Check the service entity, it should be the same as global metadata information in + * service-Testservice140-template.yml inside csar. + */ + Service service = serviceRepository.findById(serviceUuid) + .orElseThrow(() -> new EntityNotFoundException("Service: " + serviceUuid + " not found")); + + /** + * Check PNF resource, it should be the same as metadata in the topology template in + * service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml + */ + String pnfResourceKey = "7a90f80b-a6f6-4597-8c48-80bda26b4823"; + + /** + * Check PNF resource customization, it should be the same as metadata in the topology template in + * service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml + */ + String pnfCustomizationKey = "05660370-41ed-4720-a42b-d6def010c326";// "9f01263a-eaf7-4d98-a37b-3785f751903e"; + PnfResourceCustomization pnfCustomization = pnfCustomizationRepository.findById(pnfCustomizationKey) + .orElseThrow(() -> new EntityNotFoundException( + "PNF resource customization: " + pnfCustomizationKey + " not found")); + assertEquals("model customizationUUID", pnfCustomizationKey, pnfCustomization.getModelCustomizationUUID()); + assertEquals("model instance name", "demo-PNF 0", pnfCustomization.getModelInstanceName()); + assertEquals("NF type", "", pnfCustomization.getNfType()); + assertEquals("NF Role", "", pnfCustomization.getNfRole()); + assertEquals("NF function", "", pnfCustomization.getNfFunction()); + assertEquals("NF naming code", "", pnfCustomization.getNfNamingCode()); + assertEquals("PNF resource model UUID", pnfResourceKey, pnfCustomization.getPnfResources().getModelUUID()); + assertEquals("Multi stage design", "", pnfCustomization.getMultiStageDesign()); + assertNull("resource input", pnfCustomization.getResourceInput()); + assertEquals("cds blueprint name(sdnc_model_name property)", "pm_control", + pnfCustomization.getBlueprintName()); + assertEquals("cds blueprint version(sdnc_model_version property)", "1.0.0", + pnfCustomization.getBlueprintVersion()); + assertEquals("default software version", "foo-123", pnfCustomization.getDefaultSoftwareVersion()); + assertTrue("skip post instantiation configuration", pnfCustomization.isSkipPostInstConf()); + assertEquals("controller actor", "SO-REF-DATA", pnfCustomization.getControllerActor()); + + /** + * Check the pnf resource customization with service mapping + */ + List<PnfResourceCustomization> pnfCustList = service.getPnfCustomizations(); + assertEquals("PNF resource customization entity", 1, pnfCustList.size()); + assertEquals(pnfCustomizationKey, pnfCustList.get(0).getModelCustomizationUUID()); + + /** + * Check the watchdog for component distribution status + */ + List<WatchdogComponentDistributionStatus> distributionList = + watchdogCDStatusRepository.findByDistributionId(this.distributionId); + assertNotNull(distributionList); + assertEquals(1, distributionList.size()); + WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0); + assertEquals("COMPONENT_DONE_OK", distributionStatus.getComponentDistributionStatus()); + assertEquals("SO", distributionStatus.getComponentName()); + + + } catch (Exception e) { + logger.info(e.getMessage(), e); + fail(e.getMessage()); + } + } private ArtifactInfoImpl constructPnfServiceArtifact() { ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl(); @@ -620,26 +728,41 @@ public class ASDCControllerITTest extends BaseTest { private ArtifactInfoImpl constructPnfServiceArtifactWithSWV() { ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl(); artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR); - artifactInfo.setArtifactURL("/download/service-Testserviceforpnf-csar.csar");// service-pnfservice.csar"); - artifactInfo.setArtifactName("service-Testserviceforpnf-csar.csar");// "service-pnfservice.csar"); + artifactInfo.setArtifactURL("/download/service-Ericservice-csar.csar");// service-pnfservice.csar"); + artifactInfo.setArtifactName("service-Ericservice-csar.csar");// "service-pnfservice.csar"); artifactInfo.setArtifactVersion("1.0"); artifactInfo.setArtifactUUID(artifactUuid); return artifactInfo; } /** - * Construct the PnfResourceInfo based on the resource-Test140Pnf-template.yml from - * service-Testservice140-csar.csar. + * Construct the PnfResourceInfo based on the resource-DemoPnf-template.yml from service-Ericservice-csar.csar. */ private ResourceInfoImpl constructPnfResourceInfoWithSWV() { ResourceInfoImpl resourceInfo = new ResourceInfoImpl(); - resourceInfo.setResourceInstanceName("PNF CDS Test"); - resourceInfo.setResourceInvariantUUID("bf150ca9-b8d3-4450-b50a-d80382a12462");// "17d9d183-cee5-4a46-b5c4-6d5203f7d2e8"); + resourceInfo.setResourceInstanceName("demo-PNF"); + resourceInfo.setResourceInvariantUUID("e688fe35-21c2-41be-9fd2-c5ae830a5031"); resourceInfo.setResoucreType("PNF"); - resourceInfo.setCategory("Application L4+"); - resourceInfo.setSubcategory("Firewall"); - resourceInfo.setResourceUUID("72a2c44c-bb8a-4086-824b-0662d40bcd68");// "aa5d0562-80e7-43e9-af74-3085e57ab09f"); - resourceInfo.setResourceCustomizationUUID("96642e60-17cd-48c1-875d-b00b08fdb37b");// "9f01263a-eaf7-4d98-a37b-3785f751903e"); + resourceInfo.setCategory("Network L4+"); + resourceInfo.setSubcategory("Common Network Resources"); + resourceInfo.setResourceUUID("7a90f80b-a6f6-4597-8c48-80bda26b4823"); + resourceInfo.setResourceCustomizationUUID("c850a53b-b63e-4043-ab10-53aabda78d37");// "9f01263a-eaf7-4d98-a37b-3785f751903e"); + resourceInfo.setResourceVersion("1.0"); + return resourceInfo; + } + + /** + * Construct the PnfResourceInfo based on the resource-DemoPnf-template.yml from service-Ericservice-csar.csar. + */ + private ResourceInfoImpl constructPnfResourceInfoWithSWV1() { + ResourceInfoImpl resourceInfo = new ResourceInfoImpl(); + resourceInfo.setResourceInstanceName("demo-PNF"); + resourceInfo.setResourceInvariantUUID("e688fe35-21c2-41be-9fd2-c5ae830a5031"); + resourceInfo.setResoucreType("PNF"); + resourceInfo.setCategory("Network L4+"); + resourceInfo.setSubcategory("Common Network Resources"); + resourceInfo.setResourceUUID("7a90f80b-a6f6-4597-8c48-80bda26b4823"); + resourceInfo.setResourceCustomizationUUID("05660370-41ed-4720-a42b-d6def010c326");// "9f01263a-eaf7-4d98-a37b-3785f751903e"); resourceInfo.setResourceVersion("1.0"); return resourceInfo; } diff --git a/asdc-controller/src/test/resources/download/service-Ericservice-csar.csar b/asdc-controller/src/test/resources/download/service-Ericservice-csar.csar Binary files differnew file mode 100644 index 0000000000..de8691eb76 --- /dev/null +++ b/asdc-controller/src/test/resources/download/service-Ericservice-csar.csar diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy index da9584771c..75006365f2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy @@ -268,34 +268,39 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe Map<String,Object> profile switch(domainType) { case "AN-NF": - profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, plmnIdList, cSReliabilityMeanTime, - //msgSizeByte, maxNumberofPDUSessions,overallUserDensity,transferIntervalTarget + profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - cSReliabilityMeanTime, cSAvailabilityTarget, terminalDensity, msgSizeByte result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) + result.setMaxBandwidth(profile.get("maxbandwidth")) result.setResourceSharingLevel(profile.get("resourceSharingLevel")) result.setUeMobilityLevel(profile.get("uEMobilityLevel")) result.setMaxNumberOfUEs(profile.get("maxNumberofUEs")) result.setActivityFactor(profile.get("activityFactor")) - result.setCoverageAreaTAList(profile.get("coverageAreaTAList")) + result.setCoverageAreaTAList(profile.get("coverageAreaTAList").toString()) result.setExpDataRateDL(profile.get("expDataRateDL")) result.setExpDataRateUL(profile.get("expDataRateUL")) result.setSurvivalTime(profile.get("survivalTime")) + result.setMaxNumberOfPDUSession(profile.get("maxNumberOfPDUSession")) result.setAreaTrafficCapDL(profile.get("areaTrafficCapDL")) result.setAreaTrafficCapUL(profile.get("areaTrafficCapUL")) + result.setOverallUserDensity(profile.get("overallUserDensity")) + result.setTransferIntervalTarget(profile.get("transferIntervalTarget")) result.setExpDataRate(profile.get("expDataRate")) result.setProfileId(execution.getVariable("ANNF_sliceProfileId")) break case "TN-FH": - profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) //pending fields - maxBandwidth, sST, plmnIdList + profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) + result.setMaxBandwidth(profile.get("maxbandwidth")) result.setResourceSharingLevel(profile.get("resourceSharingLevel")) result.setProfileId(execution.getVariable("TNFH_sliceProfileId")) break case "TN-MH": - profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, plmnIdList + profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class) result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) + result.setMaxBandwidth(profile.get("maxbandwidth")) result.setResourceSharingLevel(profile.get("resourceSharingLevel")) result.setProfileId(execution.getVariable("TNMH_sliceProfileId")) break @@ -356,6 +361,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe if(domainType.equals("TN_FH")) { serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid")) serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid")) + serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_modelName")) allocateTnNssi.addProperty("nsstId", execution.getVariable("TNFH_modelUuid")) allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName")) Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) @@ -367,6 +373,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe }else if(domainType.equals("TN_MH")) { serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid")) serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid")) + serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_modelName")) allocateTnNssi.addProperty("nsstId", execution.getVariable("TNMH_modelUuid")) allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName")) Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy index ff7b0a3b6d..515990ac1a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy @@ -37,6 +37,9 @@ import org.onap.so.db.request.beans.ResourceOperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory +import static org.apache.commons.lang3.StringUtils.isBlank +import static org.apache.commons.lang3.StringUtils.isEmpty + public class DoActivateTnNssi extends AbstractServiceTaskProcessor { String Prefix = "TNACT_" @@ -63,7 +66,9 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor { String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelUuid = execution.getVariable("modelUuid") - //here modelVersion is not set, we use modelUuid to decompose the service. + if (isEmpty(modelUuid)) { + modelUuid = tnNssmfUtils.getModelUuidFromServiceInstance(execution.getVariable("serviceInstanceID")) + } def isDebugLogEnabled = true execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) String serviceModelInfo = """{ @@ -83,7 +88,13 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor { String actionType = operationType.equals("activateInstance") ? "activate" : "deactivate" execution.setVariable("actionType", actionType) - tnNssmfUtils.setEnableSdncConfig(execution) + String additionalPropJsonStr = execution.getVariable("sliceParams") + if (isBlank(additionalPropJsonStr) || + isBlank(tnNssmfUtils.setExecVarFromJsonIfExists(execution, + additionalPropJsonStr, + "enableSdnc", "enableSdnc"))) { + tnNssmfUtils.setEnableSdncConfig(execution) + } logger.debug("Finish preProcessRequest") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy index 33724bd011..567c703496 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy @@ -323,7 +323,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { execution.setVariable("isRspRanNssi", true) }else { JsonObject newNSISolution = sol.get("newNSISolution").getAsJsonObject() - JsonArray sliceProfiles = newNSISolution.get("slice_profiles").getAsJsonArray() + JsonArray sliceProfiles = newNSISolution.get("sliceProfiles").getAsJsonArray() logger.debug("RanConstituentSliceProfiles list from OOF "+sliceProfiles) execution.setVariable("RanConstituentSliceProfiles", sliceProfiles.toString()) } @@ -354,14 +354,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { execution.setVariable("modifySliceParams", modifySliceParams.toString()) //create operation status in request db - String serviceId = execution.getVariable("RANServiceInstanceId") String nsiId = execution.getVariable("nsiId") - logger.debug("Generated new job for Service Instance serviceId:" + serviceId + "jobId:" + jobId) + String modelUuid = execution.getVariable("modelUuid") + logger.debug("Generated new job for Service Instance serviceId:" + nsiId + "jobId:" + jobId) ResourceOperationStatus initStatus = new ResourceOperationStatus() - initStatus.setServiceId(serviceId) + initStatus.setServiceId(nsiId) initStatus.setOperationId(jobId) - initStatus.setResourceTemplateUUID(nsiId) + initStatus.setResourceTemplateUUID(modelUuid) initStatus.setOperType("Modify") requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus) } @@ -613,13 +613,17 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { ANServiceInstance.setServiceType(serviceType) String serviceStatus = "deactivated" ANServiceInstance.setOrchestrationStatus(serviceStatus) - String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "pLMNIdList") + String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList") ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid) String serviceRole = "nssi" ANServiceInstance.setServiceRole(serviceRole) List<String> snssaiList = execution.getVariable("snssaiList") String snssai = snssaiList.get(0) ANServiceInstance.setEnvironmentContext(snssai) + String modelInvariantUuid = execution.getVariable("modelInvariantUuid") + String modelUuid = execution.getVariable("modelUuid") + ANServiceInstance.setModelInvariantId(modelInvariantUuid) + ANServiceInstance.setModelVersionId(modelUuid) ANServiceInstance.setWorkloadContext("AN") String serviceFunctionAn = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "resourceSharingLevel") ANServiceInstance.setServiceFunction(serviceFunctionAn) @@ -630,12 +634,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { ANNFServiceInstance.setServiceInstanceName(sliceInstanceName) ANNFServiceInstance.setServiceType(serviceType) ANNFServiceInstance.setOrchestrationStatus(serviceStatus) - serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "pLMNIdList") + serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList") ANNFServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid) ANNFServiceInstance.setServiceRole(serviceRole) snssaiList = execution.getVariable("snssaiList") snssai = snssaiList.get(0) ANNFServiceInstance.setEnvironmentContext(snssai) + ANNFServiceInstance.setModelInvariantId(execution.getVariable("ANNF_modelInvariantUuid")) + ANNFServiceInstance.setModelVersionId(execution.getVariable("ANNF_modelUuid")) ANNFServiceInstance.setWorkloadContext("AN-NF") String serviceFunctionAnnf = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "resourceSharingLevel") ANNFServiceInstance.setServiceFunction(serviceFunctionAnnf) @@ -852,16 +858,16 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { def prepareOperationStatusUpdate = { DelegateExecution execution -> logger.debug(Prefix + "prepareOperationStatusUpdate Start") - String serviceId = execution.getVariable("dummyServiceId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") + String modelUuid = execution.getVariable("modelUuid") String nssiId = execution.getVariable("RANServiceInstanceId") - logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId) + logger.debug("Service Instance serviceId:" + nsiId + " jobId:" + jobId) ResourceOperationStatus updateStatus = new ResourceOperationStatus() - updateStatus.setServiceId(serviceId) + updateStatus.setServiceId(nsiId) updateStatus.setOperationId(jobId) - updateStatus.setResourceTemplateUUID(nsiId) + updateStatus.setResourceTemplateUUID(modelUuid) updateStatus.setResourceInstanceID(nssiId) updateStatus.setOperType("Allocate") updateStatus.setProgress("100") @@ -874,16 +880,16 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { def prepareFailedOperationStatusUpdate = { DelegateExecution execution -> logger.debug(Prefix + "prepareFailedOperationStatusUpdate Start") - String serviceId = execution.getVariable("dummyServiceId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") + String modelUuid = execution.getVariable("modelUuid") String nssiId = execution.getVariable("RANServiceInstanceId") - logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId) + logger.debug("Service Instance serviceId:" + nsiId + " jobId:" + jobId) ResourceOperationStatus updateStatus = new ResourceOperationStatus() - updateStatus.setServiceId(serviceId) + updateStatus.setServiceId(nsiId) updateStatus.setOperationId(jobId) - updateStatus.setResourceTemplateUUID(nsiId) + updateStatus.setResourceTemplateUUID(modelUuid) updateStatus.setResourceInstanceID(nssiId) updateStatus.setOperType("Allocate") updateStatus.setProgress("0") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy index 04f07b66d4..c06e313c4c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy @@ -35,6 +35,7 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory import static org.apache.commons.lang3.StringUtils.isBlank +import static org.apache.commons.lang3.StringUtils.isNotBlank class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { @@ -63,7 +64,9 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { }""" execution.setVariable("serviceModelInfo", serviceModelInfo) - tnNssmfUtils.setEnableSdncConfig(execution) + if (isBlank(execution.getVariable("enableSdnc"))) { + tnNssmfUtils.setEnableSdncConfig(execution) + } logger.trace("Exit preProcessRequest") } @@ -110,6 +113,12 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { String ssInstanceId = execution.getVariable("sliceServiceInstanceId") String sliceProfileStr = execution.getVariable("sliceProfile") try { + if (sliceProfileStr == null || sliceProfileStr.isEmpty()) { + String msg = "ERROR: createServiceInstance: sliceProfile is null" + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance() ss.setServiceInstanceId(ssInstanceId) String sliceInstanceName = execution.getVariable("sliceServiceInstanceName") @@ -125,12 +134,18 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { String modelUuid = execution.getVariable("modelUuid") ss.setModelInvariantId(modelInvariantUuid) ss.setModelVersionId(modelUuid) - String serviceInstanceLocationid = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr) - ss.setServiceInstanceLocationId(serviceInstanceLocationid) + String serviceInstanceLocationId = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr) + ss.setServiceInstanceLocationId(serviceInstanceLocationId) String snssai = tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr) //ss.setEnvironmentContext(snssai) ss.setEnvironmentContext("tn") ss.setServiceRole(serviceRole) + + String domainTypeStr = jsonUtil.getJsonValue(sliceProfileStr, "domainType") + if (isNotBlank(domainTypeStr)) { + ss.setWorkloadContext(domainTypeStr) + } + AAIResourcesClient client = getAAIClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() @@ -280,25 +295,30 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr) for (String linkStr : linkStrList) { - String logicalLinkId = UUID.randomUUID().toString() + String linkName = jsonUtil.getJsonValue(linkStr, "name") + if (isBlank(linkName)) { + linkName = "tn-nssmf-" + UUID.randomUUID().toString() + } + logger.debug("createLogicalLinksForAllocatedResource: linkName=" + linkName) + String epA = jsonUtil.getJsonValue(linkStr, "transportEndpointA") String epB = jsonUtil.getJsonValue(linkStr, "transportEndpointB") String modelInvariantId = execution.getVariable("modelInvariantUuid") String modelVersionId = execution.getVariable("modelUuid") org.onap.aai.domain.yang.LogicalLink resource = new org.onap.aai.domain.yang.LogicalLink() - resource.setLinkId(logicalLinkId) - resource.setLinkName(epA) + resource.setLinkName(linkName) + resource.setLinkId(epA) resource.setLinkName2(epB) resource.setLinkType("TsciConnectionLink") resource.setInMaint(false) //epA is link-name AAIResourceUri logicalLinkUri = - AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(epA)) + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(linkName)) getAAIClient().create(logicalLinkUri, resource) - tnNssmfUtils.attachLogicalLinkToAllottedResource(execution, AAI_VERSION, allottedResourceUri, epA); + tnNssmfUtils.attachLogicalLinkToAllottedResource(execution, AAI_VERSION, allottedResourceUri, linkName); } } catch (BpmnError e) { throw e diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy index a715e7799d..b09161d5cd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy @@ -38,6 +38,9 @@ import org.onap.so.db.request.beans.ResourceOperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory +import static org.apache.commons.lang3.StringUtils.isBlank +import static org.apache.commons.lang3.StringUtils.isEmpty + class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { String Prefix = "TNDEALLOC_" @@ -68,10 +71,11 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { String sliceServiceInstanceName = execution.getVariable("servicename") execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName) - String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelUuid = execution.getVariable("modelUuid") - //here modelVersion is not set, we use modelUuid to decompose the service. + if (isEmpty(modelUuid)) { + modelUuid = tnNssmfUtils.getModelUuidFromServiceInstance(execution.getVariable("serviceInstanceID")) + } def isDebugLogEnabled = true execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) String serviceModelInfo = """{ @@ -81,7 +85,13 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { }""" execution.setVariable("serviceModelInfo", serviceModelInfo) - tnNssmfUtils.setEnableSdncConfig(execution) + String additionalPropJsonStr = execution.getVariable("sliceParams") + if (isBlank(additionalPropJsonStr) || + isBlank(tnNssmfUtils.setExecVarFromJsonIfExists(execution, + additionalPropJsonStr, + "enableSdnc", "enableSdnc"))) { + tnNssmfUtils.setEnableSdncConfig(execution) + } logger.debug("Finish preProcessRequest") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy index 4ff15a58c5..45af88d253 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy @@ -120,6 +120,11 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor { } else { execution.setVariable("nsiInfo", nsiInfo) } + + if (isBlank(tnNssmfUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr, + "enableSdnc", "enableSdnc"))) { + tnNssmfUtils.setEnableSdncConfig(execution) + } } catch (BpmnError e) { throw e } catch (Exception ex) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy index 74c9a49911..7bb451164c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy @@ -20,11 +20,9 @@ package org.onap.so.bpmn.infrastructure.scripts -import com.fasterxml.jackson.databind.ObjectMapper import groovy.json.JsonSlurper import org.json.JSONObject import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.beans.nsmf.JobStatusRequest import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils @@ -45,7 +43,8 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{ try{ String requestId = execution.getVariable("msoRequestId") logger.debug("RequestId :" + requestId) - String jobId = execution.getVariable("jobId") + String responseId = execution.getVariable("responseId") + String jobId = execution.getVariable("jobId") def jsonSlurper = new JsonSlurper() HashMap<String,?> esrInfo = jsonSlurper.parseText(execution.getVariable("esrInfo")) @@ -53,7 +52,7 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{ HashMap<String,?> serviceInfo = jsonSlurper.parseText(execution.getVariable("serviceInfo")) logger.debug("serviceInfo" + serviceInfo.toString()) - + execution.setVariable("esrInfo", esrInfo) execution.setVariable("serviceInfo", serviceInfo) @@ -61,9 +60,10 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{ String endPoint = String.format("/api/rest/provMns/v1/NSS/jobs/%s", jobId) String url = nssmfEndpoint + endPoint execution.setVariable("NSSMF_AdapterEndpoint", url) - + String payload = """ { + "responseId": "${responseId}", "esrInfo": ${execution.getVariable("esrInfo") as JSONObject}, "serviceInfo": ${execution.getVariable("serviceInfo") as JSONObject} } @@ -72,7 +72,7 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{ execution.setVariable("NSSMF_AdapterRequest", payload.replaceAll("\\s+", "")) execution.setVariable("startTime", System.currentTimeMillis()) logger.debug("Outgoing NSSMF_AdapterRequest: \n" + payload) - }catch(Exception e){ + }catch(Exception ex){ String msg = "Exception in QueryJobStatus.preProcessRequest " + ex.getMessage() logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) @@ -107,7 +107,7 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{ responseDescriptorMap.put("statusDescription","Exception while querying job status") String responseDescriptor = """ { - "responseDescriptor": "${responseDescriptorMap}", + "responseDescriptor": "${responseDescriptorMap as JSONObject}" } """ execution.setVariable("JobStatusCompleted", "TRUE") @@ -123,7 +123,7 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{ responseDescriptorMap.put("statusDescription","timeout") String responseDescriptor = """ { - "responseDescriptor": "${responseDescriptorMap}", + "responseDescriptor": ${responseDescriptorMap as JSONObject} } """ execution.setVariable("JobStatusCompleted", "TRUE") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy index deeec94b74..019e836514 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy @@ -116,10 +116,10 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { execution.setVariable("nsiInfo", nsiInfoStr) } - //nsiId is passed in from caller bpmn - //String nsiIdStr = jsonUtil.getJsonValue(nsiInfo, "nsiId") - //execution.setVariable("nsiId", nsiIdStr) - + if (isBlank(tnNssmfUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr, + "enableSdnc", "enableSdnc"))) { + tnNssmfUtils.setEnableSdncConfig(execution) + } } catch (BpmnError e) { throw e } catch (Exception ex) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy index 009b0a1941..4877a236f3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy @@ -23,8 +23,11 @@ package org.onap.so.bpmn.infrastructure.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance import org.onap.aaiclient.client.aai.AAIResourcesClient import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils @@ -368,4 +371,62 @@ class TnNssmfUtils { execution.setVariable("enableSdnc", enableSdnc) } -} + + String setExecVarFromJsonIfExists(DelegateExecution execution, + String jsonStr, String jsonKey, String varName) { + return setExecVarFromJsonStr(execution, jsonStr, jsonKey, varName, false) + } + + String setExecVarFromJsonStr(DelegateExecution execution, + String jsonStr, String jsonKey, String varName, + boolean exceptionOnErr) { + String msg = "" + String valueStr = jsonUtil.getJsonValue(jsonStr, jsonKey) + if (isBlank(valueStr)) { + if (exceptionOnErr) { + msg = "cannot find " + jsonKey + " in " + jsonStr + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } else { + execution.setVariable(varName, valueStr) + } + + return valueStr + } + + ServiceInstance getServiceInstanceFromAai(String serviceInstanceId) { + if (isBlank(serviceInstanceId)) { + logger.error("ERROR: getServiceInstanceFromAai: serviceInstanceId is blank") + return null + } + + ServiceInstance nssi = null + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.Types.SERVICE_INSTANCE + .getFragment(serviceInstanceId)) + Optional<ServiceInstance> nssiOpt = client.get(ServiceInstance.class, uri) + + if (nssiOpt.isPresent()) { + nssi = nssiOpt.get() + return nssi + } else { + String msg = String.format("ERROR: getServiceInstanceFromAai: NSSI %s not found in AAI", serviceInstanceId) + logger.error(msg) + } + + return nssi; + } + + String getModelUuidFromServiceInstance(String serviceInstanceId) { + ServiceInstance si = getServiceInstanceFromAai(serviceInstanceId) + if (si == null) { + String msg = String.format("ERROR: getModelUuidFromServiceInstance: getServiceInstanceFromAai() failed. " + + "serviceInstanceId=%s", serviceInstanceId) + logger.error(msg) + return null + } + + return si.modelVersionId() + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn index 124b75cbe8..82efc97e92 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn @@ -131,6 +131,7 @@ css.prepareOofSelection(execution)</bpmn:script> <camunda:in source="operationId" target="operationId" /> <camunda:in source="sliceProfile" target="sliceProfile" /> <camunda:in source="transportSliceNetworks" target="transportSliceNetworks" /> + <camunda:in source="enableSdnc" target="enableSdnc" /> <camunda:in source="nsiInfo" target="nsiInfo" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:out source="rollbackData" target="rollbackData" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn index b2b6c031f9..8cafea75f5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn @@ -31,7 +31,7 @@ qjs.preProcessRequest(execution)</bpmn:script> </camunda:connector> </bpmn:extensionElements> <bpmn:incoming>Flow_0qhl0m8</bpmn:incoming> - <bpmn:incoming>Flow_1qqqckj</bpmn:incoming> + <bpmn:incoming>Flow_0akup2t</bpmn:incoming> <bpmn:outgoing>Flow_18di8yy</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_16nxw2f" sourceRef="StartEvent_1" targetRef="Activity_0cd23fy" /> @@ -64,17 +64,23 @@ qjs.updateJobStatusDetails(execution)</bpmn:script> <bpmn:incoming>Flow_0qqltc9</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="Flow_0qqltc9" sourceRef="Activity_0rtwx97" targetRef="Event_0p00z2s" /> - <bpmn:sequenceFlow id="Flow_1qqqckj" name="No" sourceRef="Gateway_1ruy0j9" targetRef="Activity_1aivult"> + <bpmn:sequenceFlow id="Flow_1qqqckj" name="No" sourceRef="Gateway_1ruy0j9" targetRef="Event_0dp6trf"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("JobStatusCompleted") == "FALSE"}</bpmn:conditionExpression> </bpmn:sequenceFlow> + <bpmn:intermediateCatchEvent id="Event_0dp6trf" name="TimeDelay"> + <bpmn:incoming>Flow_1qqqckj</bpmn:incoming> + <bpmn:outgoing>Flow_0akup2t</bpmn:outgoing> + <bpmn:timerEventDefinition id="TimerEventDefinition_0ncw0aa"> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT10S</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="Flow_0akup2t" sourceRef="Event_0dp6trf" targetRef="Activity_1aivult" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="QueryJobStatus"> <bpmndi:BPMNEdge id="Flow_1qqqckj_di" bpmnElement="Flow_1qqqckj"> <di:waypoint x="880" y="152" /> - <di:waypoint x="880" y="280" /> - <di:waypoint x="550" y="280" /> - <di:waypoint x="550" y="167" /> + <di:waypoint x="880" y="222" /> <bpmndi:BPMNLabel> <dc:Bounds x="892" y="163" width="15" height="14" /> </bpmndi:BPMNLabel> @@ -106,6 +112,11 @@ qjs.updateJobStatusDetails(execution)</bpmn:script> <di:waypoint x="215" y="127" /> <di:waypoint x="310" y="127" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0akup2t_di" bpmnElement="Flow_0akup2t"> + <di:waypoint x="862" y="240" /> + <di:waypoint x="570" y="240" /> + <di:waypoint x="570" y="167" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> <dc:Bounds x="179" y="109" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -136,6 +147,13 @@ qjs.updateJobStatusDetails(execution)</bpmn:script> <dc:Bounds x="1160" y="152" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0wfgoh7_di" bpmnElement="Event_0dp6trf"> + <dc:Bounds x="862" y="222" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="896" y="252" width="53" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> + @@ -80,15 +80,15 @@ </properties> <distributionManagement> <repository> - <id>ecomp-releases</id> + <id>onap-releases</id> <url>${nexusproxy}/${releaseNexusPath}</url> </repository> <snapshotRepository> - <id>ecomp-snapshots</id> + <id>onap-snapshots</id> <url>${nexusproxy}/${snapshotNexusPath}</url> </snapshotRepository> <site> - <id>ecomp-site</id> + <id>onap-site</id> <url>dav:${nexusproxy}${siteNexusPath}</url> </site> </distributionManagement> @@ -125,21 +125,21 @@ <url>http://maven.restlet.com</url> </pluginRepository> <pluginRepository> - <id>ecomp-public</id> + <id>onap-public</id> <url>${nexusproxy}/${publicNexusPath}</url> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> <pluginRepository> - <id>ecomp-release</id> + <id>onap-release</id> <url>${nexusproxy}/${releaseNexusPath}</url> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> <pluginRepository> - <id>ecomp-snapshots</id> + <id>onap-snapshots</id> <url>${nexusproxy}/${snapshotNexusPath}</url> <releases> <enabled>false</enabled> @@ -148,27 +148,13 @@ </pluginRepositories> <repositories> <repository> - <id>ecomp-public</id> + <id>onap-public</id> <url>https://nexus.onap.org/content/repositories/public/</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> - <id>ecomp-releases</id> - <url>https://nexus.onap.org/content/repositories/releases/</url> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - <repository> - <id>ecomp-snapshots</id> - <url>https://nexus.onap.org/content/repositories/snapshots/</url> - <releases> - <enabled>false</enabled> - </releases> - </repository> - <repository> <id>camunda-bpm</id> <url>https://app.camunda.com/nexus/content/repositories/camunda-bpm/</url> </repository> @@ -177,7 +163,6 @@ <url>https://app.camunda.com/nexus/content/groups/public</url> </repository> <repository> - <!-- TODO: remove from ONAP environemnt --> <id>onap-releases</id> <url>https://nexus.onap.org/content/repositories/releases/</url> <snapshots> @@ -185,7 +170,6 @@ </snapshots> </repository> <repository> - <!-- TODO: remove from ONAP environemnt --> <id>onap-snapshots</id> <url>https://nexus.onap.org/content/repositories/snapshots/</url> <releases> @@ -216,10 +200,6 @@ </resource> </resources> <plugins> - <!-- <plugin> <groupId>org.sonatype.plugins</groupId> <artifactId>nexus-staging-maven-plugin</artifactId> - <version>1.6.7</version> <extensions>true</extensions> <configuration> <nexusUrl>${nexusproxy}</nexusUrl> - <stagingProfileId>176c31dfe190a</stagingProfileId> <serverId>ecomp-staging</serverId> - </configuration> </plugin> --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> |