summaryrefslogtreecommitdiffstats
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/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.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
9 files changed, 192 insertions, 29 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/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/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