aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8__AddSoftwareVersionToPnfCustomization.sql6
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java4
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java192
-rw-r--r--asdc-controller/src/test/resources/download/service-Testserviceforpnf-csar.csarbin0 -> 96641 bytes
-rw-r--r--asdc-controller/src/test/resources/schema.sql1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java17
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy52
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy53
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy24
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn8
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql1
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java14
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql1
21 files changed, 304 insertions, 124 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8__AddSoftwareVersionToPnfCustomization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8__AddSoftwareVersionToPnfCustomization.sql
new file mode 100644
index 0000000000..5578d3e590
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8__AddSoftwareVersionToPnfCustomization.sql
@@ -0,0 +1,6 @@
+use catalogdb;
+
+ALTER TABLE pnf_resource_customization
+ADD DEFAULT_SOFTWARE_VERSION varchar(4000) null;
+
+
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 7efc397e30..73b825dc78 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
@@ -46,6 +46,7 @@ import org.onap.sdc.api.notification.IResourceInstance;
import org.onap.sdc.api.notification.IStatusData;
import org.onap.sdc.tosca.parser.api.IEntityDetails;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.tosca.parser.elements.EntityDetails;
import org.onap.sdc.tosca.parser.elements.queries.EntityQuery;
import org.onap.sdc.tosca.parser.elements.queries.EntityQuery.EntityQueryBuilder;
import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery;
@@ -133,6 +134,8 @@ public class ToscaResourceInstaller {
private static final String CDS_MODEL_VERSION = "cds_model_version";
+ private static final String DEFAULT_SOFTWARE_VERSION = "default_software_version";
+
@Autowired
protected ServiceRepository serviceRepo;
@@ -932,6 +935,7 @@ 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.setPnfResources(pnfResource);
return pnfResourceCustomization;
}
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 3db017cac5..eafb42a3d9 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
@@ -320,33 +320,6 @@ public class ASDCControllerITTest extends BaseTest {
}
}
- private ArtifactInfoImpl constructPnfServiceArtifact() {
- ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl();
- artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR);
- artifactInfo.setArtifactURL("/download/service-pnfservice.csar");
- artifactInfo.setArtifactName("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.
- */
- private ResourceInfoImpl constructPnfResourceInfo() {
- ResourceInfoImpl resourceInfo = new ResourceInfoImpl();
- resourceInfo.setResourceInstanceName("PNF CDS Test");
- resourceInfo.setResourceInvariantUUID("17d9d183-cee5-4a46-b5c4-6d5203f7d2e8");
- resourceInfo.setResoucreType("PNF");
- resourceInfo.setCategory("Application L4+");
- resourceInfo.setSubcategory("Firewall");
- resourceInfo.setResourceUUID("aa5d0562-80e7-43e9-af74-3085e57ab09f");
- resourceInfo.setResourceCustomizationUUID("9f01263a-eaf7-4d98-a37b-3785f751903e");
- resourceInfo.setResourceVersion("1.0");
- return resourceInfo;
- }
-
/**
* Testing with the service-Svc140-VF-csar.csar.
*/
@@ -479,6 +452,144 @@ public class ASDCControllerITTest extends BaseTest {
}
}
+ /**
+ * Test with service-pnfservice.csar.
+ */
+ @Test
+ public void treatNotification_ValidPnfResource_With_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";
+
+ initMockAaiServer(serviceUuid, serviceInvariantUuid);
+
+ NotificationDataImpl notificationData = new NotificationDataImpl();
+ notificationData.setServiceUUID(serviceUuid);
+ notificationData.setDistributionID(distributionId);
+ notificationData.setServiceInvariantUUID(serviceInvariantUuid);
+ notificationData.setServiceVersion("1.0");
+
+ ResourceInfoImpl resourceInfo = constructPnfResourceInfoWithSWV();
+ 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-Testserviceforpnf-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());
+
+ /**
+ * 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 = "72a2c44c-bb8a-4086-824b-0662d40bcd68";
+
+ /**
+ * 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";
+ 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("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", "4.0.0", 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();
+ artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR);
+ artifactInfo.setArtifactURL("/download/service-pnfservice.csar");
+ artifactInfo.setArtifactName("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.
+ */
+ private ResourceInfoImpl constructPnfResourceInfo() {
+ ResourceInfoImpl resourceInfo = new ResourceInfoImpl();
+ resourceInfo.setResourceInstanceName("PNF CDS Test");
+ resourceInfo.setResourceInvariantUUID("17d9d183-cee5-4a46-b5c4-6d5203f7d2e8");
+ resourceInfo.setResoucreType("PNF");
+ resourceInfo.setCategory("Application L4+");
+ resourceInfo.setSubcategory("Firewall");
+ resourceInfo.setResourceUUID("aa5d0562-80e7-43e9-af74-3085e57ab09f");
+ resourceInfo.setResourceCustomizationUUID("9f01263a-eaf7-4d98-a37b-3785f751903e");
+ resourceInfo.setResourceVersion("1.0");
+ return resourceInfo;
+ }
+
private ArtifactInfoImpl constructVnfServiceArtifact() {
ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl();
artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR);
@@ -505,4 +616,31 @@ public class ASDCControllerITTest extends BaseTest {
resourceInfo.setArtifacts(Collections.EMPTY_LIST);
return resourceInfo;
}
+
+ 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.setArtifactVersion("1.0");
+ artifactInfo.setArtifactUUID(artifactUuid);
+ return artifactInfo;
+ }
+
+ /**
+ * Construct the PnfResourceInfo based on the resource-Test140Pnf-template.yml from
+ * service-Testservice140-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.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.setResourceVersion("1.0");
+ return resourceInfo;
+ }
}
diff --git a/asdc-controller/src/test/resources/download/service-Testserviceforpnf-csar.csar b/asdc-controller/src/test/resources/download/service-Testserviceforpnf-csar.csar
new file mode 100644
index 0000000000..d061012e62
--- /dev/null
+++ b/asdc-controller/src/test/resources/download/service-Testserviceforpnf-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index f94f74da97..1260461b1b 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -1205,6 +1205,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
`SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
`CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
+ `DEFAULT_SOFTWARE_VERSION` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java
index d966528f6c..c18680afae 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java
@@ -20,23 +20,24 @@
package org.onap.so.bpmn.appc.payload;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Optional;
+import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersDistributeTraffic;
+import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersHealthCheck;
import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersQuiesce;
import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersResumeTraffic;
-import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersDistributeTraffic;
import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersUpgrade;
+import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficAction;
+import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficCheckAction;
import org.onap.so.bpmn.appc.payload.beans.HealthCheckAction;
import org.onap.so.bpmn.appc.payload.beans.QuiesceTrafficAction;
import org.onap.so.bpmn.appc.payload.beans.RequestParametersHealthCheck;
import org.onap.so.bpmn.appc.payload.beans.ResumeTrafficAction;
-import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficAction;
-import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficCheckAction;
import org.onap.so.bpmn.appc.payload.beans.SnapshotAction;
import org.onap.so.bpmn.appc.payload.beans.StartStopAction;
import org.onap.so.bpmn.appc.payload.beans.UpgradeAction;
import org.onap.so.bpmn.core.json.JsonUtils;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
public class PayloadClient {
@@ -122,6 +123,12 @@ public class PayloadClient {
RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck();
requestParams.setHostIpAddress(vnfHostIpAddress);
payloadResult.setRequestParameters(requestParams);
+
+ ConfigurationParametersHealthCheck configurationParametersHealthCheck =
+ new ConfigurationParametersHealthCheck();
+ configurationParametersHealthCheck.setVnfName(vnfName);
+ payloadResult.setConfigurationParameters(configurationParametersHealthCheck);
+
return Optional.of((mapper.writeValueAsString(payloadResult)));
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java
index 2ecf741869..2e16572069 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 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.
@@ -66,7 +66,8 @@ public class PayloadClientTest {
@Test
public void healthCheckFormatTest() throws Exception {
- String payloadResult = "{\"request-parameters\":{\"host-ip-address\":\"hostIpAddress1\"}}";
+ String payloadResult =
+ "{\"request-parameters\":{\"host-ip-address\":\"hostIpAddress1\"},\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";
Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "hostIpAddress1");
assertEquals(payloadResult, payloadClient.get());
}
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 1d8de352fb..da9584771c 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
@@ -55,7 +55,7 @@ import org.onap.aai.domain.yang.ServiceInstance
import org.onap.aai.domain.yang.SliceProfile
import org.onap.aai.domain.yang.SliceProfiles
import org.onap.aai.domain.yang.Relationship
-
+import com.google.gson.Gson
class AnNssmfUtils {
@@ -193,7 +193,7 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
ANNF_sliceProfileInstance.setServiceType(serviceType)
String serviceStatus = "deactivated"
ANNF_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
- String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "pLMNIdList")
+ String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
ANNF_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
String serviceRole = "slice-profile-instance"
ANNF_sliceProfileInstance.setServiceRole(serviceRole)
@@ -213,7 +213,7 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
serviceType = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "sST")
TNFH_sliceProfileInstance.setServiceType(serviceType)
TNFH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
- serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "pLMNIdList")
+ serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "plmnIdList")
TNFH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
TNFH_sliceProfileInstance.setServiceRole(serviceRole)
TNFH_sliceProfileInstance.setEnvironmentContext(snssai)
@@ -230,7 +230,7 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
serviceType = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "sST")
TNMH_sliceProfileInstance.setServiceType(serviceType)
TNMH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
- serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "pLMNIdList")
+ serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "plmnIdList")
TNMH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
TNMH_sliceProfileInstance.setServiceRole(serviceRole)
TNMH_sliceProfileInstance.setEnvironmentContext(snssai)
@@ -268,7 +268,7 @@ 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,
+ profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, plmnIdList, cSReliabilityMeanTime,
//msgSizeByte, maxNumberofPDUSessions,overallUserDensity,transferIntervalTarget
result.setJitter(profile.get("jitter"))
result.setLatency(profile.get("latency"))
@@ -286,14 +286,14 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
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) //pending fields - maxBandwidth, sST, plmnIdList
result.setJitter(profile.get("jitter"))
result.setLatency(profile.get("latency"))
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)//pending fields - maxBandwidth, sST, plmnIdList
result.setJitter(profile.get("jitter"))
result.setLatency(profile.get("latency"))
result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
@@ -342,16 +342,17 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
public String buildCreateNSSMFRequest(DelegateExecution execution, String domainType, String action) {
JsonObject esrInfo = new JsonObject()
- esrInfo.addProperty("networkType", "tn")
- esrInfo.addProperty("vendor", "ONAP_internal")
+ esrInfo.addProperty("networkType", "tn")
+ esrInfo.addProperty("vendor", "ONAP_internal")
JsonObject response = new JsonObject()
JsonObject allocateTnNssi = new JsonObject()
JsonObject serviceInfo = new JsonObject()
JsonArray transportSliceNetworksList = new JsonArray()
JsonArray connectionLinksList = new JsonArray()
JsonObject connectionLinks = new JsonObject()
+ Gson jsonConverter = new Gson()
if(action.equals("allocate")){
- Map<String, String> endpoints
+ JsonObject endpoints = new JsonObject()
if(domainType.equals("TN_FH")) {
serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid"))
serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid"))
@@ -359,12 +360,10 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class)
sliceProfile.put("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
- String sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
- allocateTnNssi.addProperty("sliceProfile", sliceProfileString)
- endpoints.put("transportEndpointA", execution.getVariable("tranportEp_ID_RU"))
- endpoints.put("transportEndpointB", execution.getVariable("tranportEp_ID_DUIN"))
- String endpointsString = objectMapper.writeValueAsString(endpoints)
- connectionLinksList.add(endpointsString)
+ allocateTnNssi.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
+ endpoints.addProperty("transportEndpointA", execution.getVariable("tranportEp_ID_RU"))
+ endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_DUIN"))
+ connectionLinksList.add(endpoints)
}else if(domainType.equals("TN_MH")) {
serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid"))
serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid"))
@@ -372,41 +371,32 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
sliceProfile.put("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
- String sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
- allocateTnNssi.addProperty("sliceProfile", sliceProfileString)
- endpoints.put("transportEndpointA", execution.getVariable("tranportEp_ID_DUEG"))
- endpoints.put("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN"))
- String endpointsString = objectMapper.writeValueAsString(endpoints)
- connectionLinksList.add(endpointsString)
+ allocateTnNssi.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
+ endpoints.addProperty("transportEndpointA", execution.getVariable("tranportEp_ID_DUEG"))
+ endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN"))
+ connectionLinksList.add(endpoints)
}
//Connection links
connectionLinks.add("connectionLinks", connectionLinksList)
transportSliceNetworksList.add(connectionLinks)
allocateTnNssi.add("transportSliceNetworks", transportSliceNetworksList)
- allocateTnNssi.addProperty("nssiId", null)
- serviceInfo.addProperty("nssiId", null)
}else if(action.equals("modify-allocate")) {
if(domainType.equals("TN_FH")) {
- serviceInfo.addProperty("serviceInvariantUuid", null)
- serviceInfo.addProperty("serviceUuid", null)
- allocateTnNssi.addProperty("nsstId", null)
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
allocateTnNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
}else if(domainType.equals("TN_MH")) {
- serviceInfo.addProperty("serviceInvariantUuid", null)
- serviceInfo.addProperty("serviceUuid", null)
- allocateTnNssi.addProperty("nsstId", null)
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
allocateTnNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
}
}
+ JsonParser parser = new JsonParser()
String nsiInfo = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "nsiInfo")
- allocateTnNssi.addProperty("nsiInfo", nsiInfo)
+ allocateTnNssi.add("nsiInfo",(JsonObject) parser.parse(nsiInfo))
allocateTnNssi.addProperty("scriptName", "TN1")
serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
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 05996d3671..37e3df1505 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
@@ -142,20 +142,15 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor {
String status,
String progress,
String statusDescription) {
- String serviceId = execution.getVariable("sliceServiceInstanceId")
+ String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
+ String modelUuid = execution.getVariable("modelUuid")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
String operType = execution.getVariable("actionType")
+ ResourceOperationStatus roStatus = tnNssmfUtils.buildRoStatus(modelUuid, ssInstanceId,
+ jobId, nsiId, operType, status, progress, statusDescription)
- ResourceOperationStatus roStatus = new ResourceOperationStatus()
- roStatus.setServiceId(serviceId)
- roStatus.setOperationId(jobId)
- roStatus.setResourceTemplateUUID(nsiId)
- roStatus.setOperType(operType)
- roStatus.setProgress(progress)
- roStatus.setStatus(status)
- roStatus.setStatusDescription(statusDescription)
requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
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 e1719aa5d6..33724bd011 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
@@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory
import java.util.List
import static org.apache.commons.lang3.StringUtils.isBlank
import com.google.gson.JsonObject
+import com.google.gson.Gson
import com.fasterxml.jackson.databind.ObjectMapper
import com.google.gson.JsonArray
import com.google.gson.JsonParser
@@ -98,8 +99,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("sliceProfile", sliceProfile)
}
String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
- def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "sNSSAI"))
- def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "pLMNIdList"))
+ def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "snssaiList"))
+ def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "plmnIdList"))
def coverageAreaTAList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList"))
if (isBlank(sliceProfileId) || (snssaiList.empty) || (plmnIdList.empty)
@@ -577,7 +578,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
def createSdnrRequest = { DelegateExecution execution ->
logger.debug(Prefix+"createSdnrRequest method start")
String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId")
- String sdnrRequest = buildSdnrAllocateRequest(execution, "allocate", "InstantiateRANSlice", callbackUrl)
+ String sdnrRequest = buildSdnrAllocateRequest(execution, "allocate", "instantiateRANSlice", callbackUrl)
execution.setVariable("createNSSI_sdnrRequest", sdnrRequest)
execution.setVariable("createNSSI_timeout", "PT10M")
execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId"))
@@ -697,12 +698,12 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
}
def createFhAllocateNssiJobQuery = { DelegateExecution execution ->
- logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+ logger.debug(Prefix+"createFhAllocateNssiJobQuery method start")
createTnAllocateNssiJobQuery(execution, "TN_FH")
}
def createMhAllocateNssiJobQuery = { DelegateExecution execution ->
- logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+ logger.debug(Prefix+"createMhAllocateNssiJobQuery method start")
createTnAllocateNssiJobQuery(execution, "TN_MH")
}
@@ -712,7 +713,6 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
esrInfo.addProperty("vendor", "ONAP_internal")
execution.setVariable("esrInfo", esrInfo.toString())
JsonObject serviceInfo = new JsonObject()
- serviceInfo.addProperty("nssiId", null)
serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
serviceInfo.addProperty("sST", sST)
@@ -736,14 +736,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
logger.debug(Prefix+"processJobStatusRsp method start")
String jobResponse = execution.getVariable("TNFH_jobResponse")
logger.debug("Job status response "+jobResponse)
- String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
- String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+ String status = jsonUtil.getJsonValue(jobResponse, "status")
+ String nssi = jsonUtil.getJsonValue(jobResponse, "nssiId")
if(status.equalsIgnoreCase("finished")) {
execution.setVariable("TNFH_NSSI", nssi)
logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
}
else {
- String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+ String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription")
logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
}
@@ -753,14 +753,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
logger.debug(Prefix+"processJobStatusRsp method start")
String jobResponse = execution.getVariable("TNMH_jobResponse")
logger.debug("Job status response "+jobResponse)
- String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
- String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+ String status = jsonUtil.getJsonValue(jobResponse, "status")
+ String nssi = jsonUtil.getJsonValue(jobResponse, "nssiId")
if(status.equalsIgnoreCase("finished")) {
execution.setVariable("TNMH_NSSI", nssi)
logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
}
else {
- String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+ String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription")
logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
}
@@ -770,13 +770,13 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
logger.debug(Prefix+"processJobStatusRsp method start")
String jobResponse = execution.getVariable("jobResponse")
logger.debug("Job status response "+jobResponse)
- String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
- String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+ String status = jsonUtil.getJsonValue(jobResponse, "status")
+ String nssi = jsonUtil.getJsonValue(jobResponse, "nssiId")
if(status.equalsIgnoreCase("finished")) {
logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
}
else {
- String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+ String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription")
logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
}
@@ -899,29 +899,30 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions"))
sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL"))
sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL"))
- String sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+
JsonObject response = new JsonObject()
JsonObject body = new JsonObject()
JsonObject input = new JsonObject()
JsonObject commonHeader = new JsonObject()
JsonObject payload = new JsonObject()
JsonObject payloadInput = new JsonObject()
- commonHeader.addProperty("TimeStamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss", TimeZone.getDefault()))
- commonHeader.addProperty("APIver", "1.0")
- commonHeader.addProperty("RequestID", requestId)
- commonHeader.addProperty("SubRequestID", "1")
- commonHeader.add("RequestTrack", new JsonObject())
- commonHeader.add("Flags", new JsonObject())
- payloadInput.addProperty("sliceProfile", sliceProfileString)
+ commonHeader.addProperty("TimeStamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault()))
+ commonHeader.addProperty("api-ver", "1.0")
+ commonHeader.addProperty("request-id", requestId)
+ commonHeader.addProperty("sub-request-id", "1")
+ commonHeader.add("request-track", new JsonObject())
+ commonHeader.add("flags", new JsonObject())
+ Gson jsonConverter = new Gson()
+ payloadInput.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
payloadInput.addProperty("RANNSSIId", execution.getVariable("RANServiceInstanceId"))
payloadInput.addProperty("NSIID", execution.getVariable("nsiId"))
payloadInput.addProperty("RANNFNSSIId", execution.getVariable("RANNFServiceInstanceId"))
payloadInput.addProperty("callbackURL", callbackUrl)
payloadInput.add("additionalproperties", new JsonObject())
payload.add("input", payloadInput)
- input.add("CommonHeader", commonHeader)
- input.addProperty("Action", action)
- input.addProperty("Payload", payload.toString())
+ input.add("common-header", commonHeader)
+ input.addProperty("action", action)
+ input.addProperty("payload", payload.toString())
body.add("input", input)
response.add("body", body)
response.addProperty("version", "1.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 4eb70a5302..0b028e6c13 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
@@ -34,6 +34,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import static org.apache.commons.lang3.StringUtils.isBlank
+
class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger(DoCreateTnNssiInstance.class);
@@ -109,15 +111,18 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance()
ss.setServiceInstanceId(ssInstanceId)
String sliceInstanceName = execution.getVariable("sliceServiceInstanceName")
+ if (isBlank(sliceInstanceName)) {
+ logger.error("ERROR: createServiceInstance: sliceInstanceName is null")
+ sliceInstanceName = ssInstanceId
+ }
ss.setServiceInstanceName(sliceInstanceName)
ss.setServiceType(serviceType)
- String serviceStatus = "activated"
+ String serviceStatus = "deactivated"
ss.setOrchestrationStatus(serviceStatus)
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelUuid = execution.getVariable("modelUuid")
- //TODO: need valid model ID from the caller, as AAI does not accept invalid IDs
- //ss.setModelInvariantId(modelInvariantUuid)
- //ss.setModelVersionId(modelUuid)
+ ss.setModelInvariantId(modelInvariantUuid)
+ ss.setModelVersionId(modelUuid)
String serviceInstanceLocationid = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr)
ss.setServiceInstanceLocationId(serviceInstanceLocationid)
String snssai = tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr)
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 c817eaad61..a8622b9253 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
@@ -25,7 +25,6 @@ import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aaiclient.client.aai.AAIObjectType
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
@@ -150,18 +149,15 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
String status,
String progress,
String statusDescription) {
- String serviceId = execution.getVariable("sliceServiceInstanceId")
+ String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
+ String modelUuid = execution.getVariable("modelUuid")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
- ResourceOperationStatus roStatus = new ResourceOperationStatus()
- roStatus.setServiceId(serviceId)
- roStatus.setOperationId(jobId)
- roStatus.setResourceTemplateUUID(nsiId)
- roStatus.setOperType("Deallocate")
- roStatus.setProgress(progress)
- roStatus.setStatus(status)
- roStatus.setStatusDescription(statusDescription)
+ ResourceOperationStatus roStatus = tnNssmfUtils.buildRoStatus(modelUuid, ssInstanceId,
+ jobId, nsiId, "deallocate", status, progress, statusDescription)
+
+ logger.debug("DoDeallocateTnNssi: roStatus={}", roStatus)
requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
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 88db2161f7..deeec94b74 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
@@ -72,7 +72,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
String additionalPropJsonStr = execution.getVariable("sliceParams")
- String tnNssiId = execution.getVariable("serviceInstanceID")
+ String tnNssiId = jsonUtil.getJsonValue(additionalPropJsonStr, "serviceInstanceID") //for debug
if (isBlank(tnNssiId)) {
tnNssiId = UUID.randomUUID().toString()
}
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 d97f416db9..cfee1aa0cf 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
@@ -32,6 +32,7 @@ import org.onap.so.bpmn.core.RollbackData
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.db.request.beans.ResourceOperationStatus
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -122,7 +123,7 @@ class TnNssmfUtils {
}
String sdncRequest =
- """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
<sdncadapter:RequestHeader>
@@ -332,4 +333,25 @@ class TnNssmfUtils {
createRelationShipInAAI(execution, aaiResourceUri, relationship)
}
+
+ ResourceOperationStatus buildRoStatus(String nsstId,
+ String nssiId,
+ String jobId,
+ String nsiId,
+ String action,
+ String status,
+ String progress,
+ String statusDescription) {
+ ResourceOperationStatus roStatus = new ResourceOperationStatus()
+ roStatus.setResourceTemplateUUID(nsstId)
+ roStatus.setResourceInstanceID(nssiId)
+ roStatus.setServiceId(nsiId)
+ roStatus.setOperationId(jobId)
+ roStatus.setOperType(action)
+ roStatus.setProgress(progress)
+ roStatus.setStatus(status)
+ roStatus.setStatusDescription(statusDescription)
+
+ return roStatus
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn
index 8ff1a1efec..a12d8fef34 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn
@@ -415,4 +415,4 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn:definitions>
+</bpmn:definitions> \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn
index 9c12200657..9b449013b1 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn
@@ -193,7 +193,7 @@ nss.prepareDecomposeService(execution)</bpmn:script>
<camunda:in source="esrInfo" target="esrInfo" />
<camunda:in source="serviceInfo" target="serviceInfo" />
<camunda:in source="TNFH_jobId" target="jobId" />
- <camunda:out source="jobResponse" target="TNFH_jobResponse" />
+ <camunda:out source="responseDescriptor" target="TNFH_jobResponse" />
<camunda:in source="responseId" target="responseId" />
<camunda:in source="job_timeout" target="timeout" />
</bpmn:extensionElements>
@@ -206,7 +206,7 @@ nss.prepareDecomposeService(execution)</bpmn:script>
<camunda:in source="esrInfo" target="esrInfo" />
<camunda:in source="serviceInfo" target="serviceInfo" />
<camunda:in source="TNMH_jobId" target="jobId" />
- <camunda:out source="jobResponse" target="TNMH_jobResponse" />
+ <camunda:out source="responseDescriptor" target="TNMH_jobResponse" />
<camunda:in source="responseId" target="responseId" />
<camunda:in source="job_timeout" target="timeout" />
</bpmn:extensionElements>
@@ -318,7 +318,7 @@ nss.prepareModifyAccessNssiInputs(execution)</bpmn:script>
<camunda:in source="esrInfo" target="esrInfo" />
<camunda:in source="serviceInfo" target="serviceInfo" />
<camunda:in source="modifyRanNssiJobId" target="jobId" />
- <camunda:out source="jobResponse" target="jobResponse" />
+ <camunda:out source="responseDescriptor" target="jobResponse" />
<camunda:in source="responseId" target="responseId" />
<camunda:in source="job_timeout" target="timeout" />
</bpmn:extensionElements>
@@ -435,7 +435,7 @@ nss.updateAaiWithRANInstances(execution)</bpmn:script>
<bpmn:sequenceFlow id="Flow_1exjm0h" sourceRef="Activity_0pa8al6" targetRef="Event_15zn4zi" />
<bpmn:sequenceFlow id="Flow_0bd6dhi" sourceRef="Activity_0zn4e4n" targetRef="Activity_0vf28ld" />
<bpmn:sequenceFlow id="Flow_0kcvava" sourceRef="Activity_0vf28ld" targetRef="Event_0u9308h" />
- <bpmn:scriptTask id="Activity_0vf28ld" name="update AAI relationships">
+ <bpmn:scriptTask id="Activity_0vf28ld" name="update AAI relationships" scriptFormat="groovy">
<bpmn:incoming>Flow_0bd6dhi</bpmn:incoming>
<bpmn:outgoing>Flow_0kcvava</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
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 4f83c872a1..f3bd700d9a 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
@@ -164,7 +164,7 @@ css.prepareOofSelection(execution)</bpmn:script>
<bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-execution.setVariable("orchestrationStatus", "activated")
+execution.setVariable("orchestrationStatus", "deactivated")
def runScript = new TnAllocateNssi()
runScript.updateAAIOrchStatus(execution)</bpmn:script>
</bpmn:scriptTask>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn
index bd759caffd..9dbc9909fc 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn
@@ -29,7 +29,7 @@ ex.processJavaException(execution)</bpmn:script>
<bpmn:incoming>SequenceFlow_1jygjln</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def runScript = new TnAllocateNssi()
+def runScript = new DoDeallocateTnNssi()
runScript.prepareUpdateJobStatus(execution,"finished","100","Deallocated TN NSSI successfully")</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index fd8c273b57..11f2d4b2c3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -1200,6 +1200,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
`CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
+ `DEFAULT_SOFTWARE_VERSION` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
index 2e4623d25d..122a20fea9 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
@@ -88,6 +88,9 @@ public class PnfResourceCustomization implements Serializable {
@Column(name = "CONTROLLER_ACTOR")
private String controllerActor;
+ @Column(name = "DEFAULT_SOFTWARE_VERSION")
+ private String defaultSoftwareVersion;
+
@Override
public String toString() {
return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
@@ -95,7 +98,8 @@ public class PnfResourceCustomization implements Serializable {
.append("nfFunction", nfFunction).append("nfType", nfType).append("nfRole", nfRole)
.append("nfNamingCode", nfNamingCode).append("multiStageDesign", multiStageDesign)
.append("pnfResources", pnfResources).append("blueprintName", blueprintName)
- .append("blueprintVersion", blueprintVersion).append("controllerActor", controllerActor).toString();
+ .append("blueprintVersion", blueprintVersion).append("controllerActor", controllerActor)
+ .append("defaultSoftwareVersion", defaultSoftwareVersion).toString();
}
@Override
@@ -234,4 +238,12 @@ public class PnfResourceCustomization implements Serializable {
public void setControllerActor(String controllerActor) {
this.controllerActor = controllerActor;
}
+
+ public String getDefaultSoftwareVersion() {
+ return defaultSoftwareVersion;
+ }
+
+ public void setDefaultSoftwareVersion(String defaultSoftwareVersion) {
+ this.defaultSoftwareVersion = defaultSoftwareVersion;
+ }
}
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 68f272cca0..335c49ee8a 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -1204,6 +1204,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
`SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
`CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
+ `DEFAULT_SOFTWARE_VERSION` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE