aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller/src')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java8
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java5
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java56
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java205
-rw-r--r--asdc-controller/src/test/resources/download/service-pnfservice.csarbin0 -> 27525 bytes
-rw-r--r--asdc-controller/src/test/resources/download/service-vnfservice.csarbin0 -> 27602 bytes
-rw-r--r--asdc-controller/src/test/resources/schema.sql11
8 files changed, 229 insertions, 58 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index 37f6462bba..f64adfd760 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -688,7 +688,7 @@ public class ASDCController {
iNotif.getDistributionID());
logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Database concurrency exception: ", "ASDC", "treatNotification",
- ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e);
+ ErrorCode.BusinessProcessError.getValue(), "RuntimeException in treatNotification", e);
} catch (Exception e) {
logger.error("", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
@@ -823,7 +823,7 @@ public class ASDCController {
} catch (ASDCDownloadException | UnsupportedEncodingException e) {
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during Installation of artifact", "ASDC", "processResourceNotification",
- ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e);
+ ErrorCode.BusinessProcessError.getValue(), "Exception in processResourceNotification", e);
}
}
@@ -869,7 +869,7 @@ public class ASDCController {
} catch (Exception e) {
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during processCsarServiceArtifacts", "ASDC",
- "processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(),
+ "processCsarServiceArtifacts", ErrorCode.BusinessProcessError.getValue(),
"Exception in processCsarServiceArtifacts", e);
}
} else if (artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOW)) {
@@ -890,7 +890,7 @@ public class ASDCController {
logger.info("Whats the error {}", e.getMessage());
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during processCsarServiceArtifacts", "ASDC",
- "processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(),
+ "processCsarServiceArtifacts", ErrorCode.BusinessProcessError.getValue(),
"Exception in processCsarServiceArtifacts", e);
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
index 24e1887847..a9d06d8e82 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
@@ -138,7 +138,7 @@ public class ASDCRestInterface {
logger.info("Error caught " + e.getMessage());
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION.toString(),
"Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService",
- ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e);
+ ErrorCode.BusinessProcessError.getValue(), "Exception in invokeASDCService", e);
}
return null;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
index c49cb3e50f..dcb49478f4 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
@@ -25,7 +25,6 @@ package org.onap.so.asdc.installer;
import java.io.File;
import java.nio.file.Paths;
import java.util.List;
-import org.onap.so.logger.LoggingAnchor;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
@@ -52,10 +51,10 @@ import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
public class ToscaResourceStructure {
@@ -152,7 +151,7 @@ public class ToscaResourceStructure {
logger.debug(e.getMessage(), e);
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC",
- "processResourceNotification", ErrorCode.BusinessProcesssError.getValue(),
+ "processResourceNotification", ErrorCode.BusinessProcessError.getValue(),
"Exception in " + "processResourceNotification", e);
throw new ASDCDownloadException("Exception caught when passing the csar file to the parser ", e);
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 8d51d5b894..240bb83862 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
@@ -182,6 +182,12 @@ public class ToscaResourceInstaller {
protected static final String SKIP_POST_INST_CONF = "skip_post_instantiation_configuration";
+ private static final String CONTROLLER_ACTOR = "controller_actor";
+
+ private static final String CDS_MODEL_NAME = "cds_model_name";
+
+ private static final String CDS_MODEL_VERSION = "cds_model_version";
+
@Autowired
protected ServiceRepository serviceRepo;
@@ -577,7 +583,7 @@ public class ToscaResourceInstaller {
String resourceSeqStr = resouceSequence.stream().collect(Collectors.joining(","));
service.setResourceOrder(resourceSeqStr);
- logger.debug(" resourceSeq for service uuid(" + service.getModelUUID() + ") : " + resourceSeqStr);
+ logger.debug(" resourceSeq for service uuid {}: {}", service.getModelUUID(), resourceSeqStr);
}
@@ -638,8 +644,7 @@ public class ToscaResourceInstaller {
String jsonStr = objectMapper.writeValueAsString(resouceRequest);
jsonStr = jsonStr.replace("\"", "\\\"");
- logger.debug(
- "resource request for resource customization id (" + resourceCustomizationUuid + ") : " + jsonStr);
+ logger.debug("resource request for resource customization id {}: {}", resourceCustomizationUuid, jsonStr);
return jsonStr;
} catch (JsonProcessingException e) {
logger.error("resource input could not be deserialized for resource customization id ("
@@ -682,8 +687,8 @@ public class ToscaResourceInstaller {
networkCustomization.setResourceInput(
getResourceInput(toscaResourceStruct, networkCustomization.getModelCustomizationUUID()));
service.getNetworkCustomizations().add(networkCustomization);
- logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for "
- + networkResourceModelName);
+ logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for {}",
+ networkResourceModelName);
}
}
@@ -975,8 +980,8 @@ public class ToscaResourceInstaller {
pnfResourceCustomization.setBlueprintName(getStringValue(properties.get(SDNC_MODEL_NAME)));
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.setPnfResources(pnfResource);
-
return pnfResourceCustomization;
}
@@ -1008,25 +1013,25 @@ public class ToscaResourceInstaller {
String vfCustomizationCategory =
vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
- logger.debug("VF Category is : " + vfCustomizationCategory);
+ logger.debug("VF Category is: {} ", vfCustomizationCategory);
String vfCustomizationUUID =
vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
+ logger.debug("VFCustomizationUUID= {}", vfCustomizationUUID);
IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance();
// Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before
// comparing their VF Modules UUID's
- logger.debug("Checking if Notification VF ResourceCustomizationUUID: "
- + vfNotificationResource.getResourceCustomizationUUID() + " matches Tosca VF Customization UUID: "
- + vfCustomizationUUID);
+ logger.debug(
+ "Checking if Notification VF ResourceCustomizationUUID: {} matches Tosca VF Customization UUID: {}",
+ vfNotificationResource.getResourceCustomizationUUID(), vfCustomizationUUID);
if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) {
- logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
- + " matches vfNotificationResource CustomizationUUID");
+ logger.debug("vfCustomizationUUID: {} matches vfNotificationResource CustomizationUUID ",
+ vfCustomizationUUID);
VnfResourceCustomization vnfResource = createVnfResource(vfEntityDetails, toscaResourceStruct, service);
@@ -1038,7 +1043,7 @@ public class ToscaResourceInstaller {
for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
- logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
+ logger.debug("vfModuleStructure: {}", vfModuleStructure);
List<IEntityDetails> vfModuleEntityList =
getEntityDetails(toscaResourceStruct,
@@ -1087,7 +1092,7 @@ public class ToscaResourceInstaller {
if (!CollectionUtils.isEmpty(seqResult)) {
String resultStr = seqResult.stream().collect(Collectors.joining(","));
vnfResource.setVnfcInstanceGroupOrder(resultStr);
- logger.debug("vnfcGroupOrder result for service uuid(" + service.getModelUUID() + ") : " + resultStr);
+ logger.debug("vnfcGroupOrder result for service uuid {}: {}", service.getModelUUID(), resultStr);
}
// add this vnfResource with existing vnfResource for this service
addVnfCustomization(service, vnfResource);
@@ -1197,7 +1202,7 @@ public class ToscaResourceInstaller {
watchdogDistributionStatusRepository.saveAndFlush(distributionStatus);
} catch (ObjectOptimisticLockingFailureException e) {
- logger.debug("ObjectOptimisticLockingFailureException in processWatchdog : " + e.toString());
+ logger.debug("ObjectOptimisticLockingFailureException in processWatchdog : {} ", e);
throw e;
}
}
@@ -1401,7 +1406,6 @@ public class ToscaResourceInstaller {
ResourceStructure resourceStructure) {
Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
-
List<Service> services =
serviceRepo.findByModelUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
Service service;
@@ -1438,6 +1442,10 @@ public class ToscaResourceInstaller {
generateNamingValue = "true".equalsIgnoreCase(generateNaming);
}
service.setOnapGeneratedNaming(generateNamingValue);
+ service.setBlueprintName(serviceMetadata.getValue(CDS_MODEL_NAME));
+ service.setBlueprintVersion(serviceMetadata.getValue(CDS_MODEL_VERSION));
+ service.setSkipPostInstConf(Boolean.valueOf(serviceMetadata.getValue(SKIP_POST_INST_CONF)));
+ service.setControllerActor(serviceMetadata.getValue(CONTROLLER_ACTOR));
}
@@ -2028,8 +2036,8 @@ public class ToscaResourceInstaller {
ObjectMapper objectMapper = new ObjectMapper();
jsonStr = objectMapper.writeValueAsString(resouceRequest);
jsonStr = jsonStr.replace("\"", "\\\"");
- logger.debug("vfcResource request for resource customization id (" + resourceCustomizationUuid + ") : "
- + jsonStr);
+ logger.debug("vfcResource request for resource customization id {}: {}", resourceCustomizationUuid,
+ jsonStr);
} catch (JsonProcessingException e) {
logger.debug("Json Exception: {}", e.getMessage());
logger.error("Exception occurred", e);
@@ -2382,6 +2390,14 @@ public class ToscaResourceInstaller {
if (minInstances != null && minInstances.length() > 0) {
vfModuleCustomization.setMinInstances(Integer.valueOf(minInstances));
}
+
+ String skipPostInstConfText = getLeafPropertyValue(vfModuleEntityDetails, SKIP_POST_INST_CONF);
+
+ if (skipPostInstConfText != null) {
+ vfModuleCustomization.setSkipPostInstConf(
+ Boolean.parseBoolean(getLeafPropertyValue(vfModuleEntityDetails, SKIP_POST_INST_CONF)));
+ }
+
return vfModuleCustomization;
}
@@ -2576,7 +2592,7 @@ public class ToscaResourceInstaller {
Boolean.parseBoolean(getLeafPropertyValue(entityDetails, SKIP_POST_INST_CONF)));
}
-
+ vnfResourceCustomization.setControllerActor(getLeafPropertyValue(entityDetails, CONTROLLER_ACTOR));
vnfResourceCustomization.setVnfResources(vnfResource);
vnfResourceCustomization.setAvailabilityZoneMaxCount(Integer.getInteger(
entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)));
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 0c7f97759b..3db017cac5 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
@@ -1,15 +1,20 @@
-/*
- * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
- * Foundation. ================================================================================ Licensed under the
- * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
- * obtain a copy of the License at
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions and limitations under the
- * License.
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.so.asdc.client;
@@ -20,6 +25,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Collections;
@@ -29,7 +35,6 @@ import java.util.UUID;
import javax.persistence.EntityNotFoundException;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@@ -64,7 +69,10 @@ import org.springframework.transaction.annotation.Transactional;
* This is used to run some basic integration test(BIT) for ASDC controller. It will test the csar install and all the
* testing csar files are located underneath src/main/resources/download folder,
*
- * PNF csar: service-Testservice140-csar.csar VNF csar: service-Svc140-VF-csar.csar
+ * PNF csar: service-pnfservice.csar VNF csar: service-Svc140-VF-csar.csar
+ *
+ * All the csar files are cleaned, i.e, removing the comments and most of the description to avoid violation of
+ * security.
*/
@Transactional
public class ASDCControllerITTest extends BaseTest {
@@ -141,13 +149,149 @@ public class ASDCControllerITTest extends BaseTest {
* Mock the AAI using wireshark.
*/
private void initMockAaiServer(final String serviceUuid, final String serviceInvariantUuid) {
- String modelEndpoint = "/aai/v15/service-design-and-creation/models/model/" + serviceInvariantUuid
+ String modelEndpoint = "/aai/v17/service-design-and-creation/models/model/" + serviceInvariantUuid
+ "/model-vers/model-ver/" + serviceUuid + "?depth=0";
wireMockServer.stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok()));
}
/**
+ * Test with service-pnfservice.csar.
+ */
+ @Test
+ public void treatNotification_ValidPnfResource_ExpectedOutput() {
+
+ /**
+ * service UUID/invariantUUID from global metadata in service-PnfServiceTestCds-template.yml.
+ */
+ String serviceUuid = "77cf276e-905c-43f6-8d54-dda474be2f2e";
+ String serviceInvariantUuid = "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 = constructPnfResourceInfo();
+ List<ResourceInfoImpl> resourceInfoList = new ArrayList<>();
+ resourceInfoList.add(resourceInfo);
+ notificationData.setResources(resourceInfoList);
+
+ ArtifactInfoImpl artifactInfo = constructPnfServiceArtifact();
+ 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-pnfservice.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-pnfservice.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"));
+ assertEquals("model UUID", serviceUuid, service.getModelUUID());
+ assertEquals("model name", "PNF Service Test CDS", service.getModelName());
+ assertEquals("model invariantUUID", serviceInvariantUuid, service.getModelInvariantUUID());
+ assertEquals("model version", "1.0", service.getModelVersion());
+ assertEquals("description", "123123", service.getDescription().trim());
+ assertEquals("tosca csar artifact UUID", artifactUuid, service.getCsar().getArtifactUUID());
+ assertEquals("service type", "", service.getServiceType());
+ assertEquals("service role", "", service.getServiceRole());
+ assertEquals("environment context", "General_Revenue-Bearing", service.getEnvironmentContext());
+ assertEquals("service category", "Network L1-3", service.getCategory());
+ assertNull("workload context", service.getWorkloadContext());
+ assertEquals("resource order", "PNF CDS Test", service.getResourceOrder());
+ assertEquals("CDS blueprint name", "Blueprint140", service.getBlueprintName());
+ assertEquals("CDS blueprint version", "v1.4.0", service.getBlueprintVersion());
+ assertEquals("controller actor", "SO-REF-DATA", service.getControllerActor());
+
+ /**
+ * 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 = "aa5d0562-80e7-43e9-af74-3085e57ab09f";
+ PnfResource pnfResource = pnfResourceRepository.findById(pnfResourceKey)
+ .orElseThrow(() -> new EntityNotFoundException("PNF resource:" + pnfResourceKey + " not found"));
+ assertNull("orchestration mode", pnfResource.getOrchestrationMode());
+ assertEquals("Description", "123123", pnfResource.getDescription().trim());
+ assertEquals("model UUID", pnfResourceKey, pnfResource.getModelUUID());
+ assertEquals("model invariant UUID", "17d9d183-cee5-4a46-b5c4-6d5203f7d2e8",
+ pnfResource.getModelInvariantUUID());
+ assertEquals("model version", "1.0", pnfResource.getModelVersion());
+ assertEquals("model name", "PNF CDS Test", pnfResource.getModelName());
+ assertEquals("tosca node type", "org.openecomp.resource.pnf.PnfCdsTest", pnfResource.getToscaNodeType());
+ assertEquals("resource category", "Application L4+", pnfResource.getCategory());
+ assertEquals("resource sub category", "Firewall", pnfResource.getSubCategory());
+
+ /**
+ * 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 = "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", "PNF CDS Test 0", pnfCustomization.getModelInstanceName());
+ assertEquals("NF type", "", pnfCustomization.getNfType());
+ assertEquals("NF Role", "nf", pnfCustomization.getNfRole());
+ assertEquals("NF function", "nf", 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)", "Blueprint140",
+ pnfCustomization.getBlueprintName());
+ assertEquals("cds blueprint version(sdnc_model_version property)", "v1.4.0",
+ pnfCustomization.getBlueprintVersion());
+ 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());
+ }
+ }
+
+ /**
* Test to check RequestId is being set using the DistributionID.
*/
@Test
@@ -179,8 +323,8 @@ public class ASDCControllerITTest extends BaseTest {
private ArtifactInfoImpl constructPnfServiceArtifact() {
ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl();
artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR);
- artifactInfo.setArtifactURL("/download/service-Testservice140-csar.csar");
- artifactInfo.setArtifactName("service-Testservice140-csar.csar");
+ artifactInfo.setArtifactURL("/download/service-pnfservice.csar");
+ artifactInfo.setArtifactName("service-pnfservice.csar");
artifactInfo.setArtifactVersion("1.0");
artifactInfo.setArtifactUUID(artifactUuid);
return artifactInfo;
@@ -192,13 +336,13 @@ public class ASDCControllerITTest extends BaseTest {
*/
private ResourceInfoImpl constructPnfResourceInfo() {
ResourceInfoImpl resourceInfo = new ResourceInfoImpl();
- resourceInfo.setResourceInstanceName("Test140PNF");
- resourceInfo.setResourceInvariantUUID("d832a027-75f3-455d-9de4-f02fcdee7e7e");
+ resourceInfo.setResourceInstanceName("PNF CDS Test");
+ resourceInfo.setResourceInvariantUUID("17d9d183-cee5-4a46-b5c4-6d5203f7d2e8");
resourceInfo.setResoucreType("PNF");
resourceInfo.setCategory("Application L4+");
- resourceInfo.setSubcategory("Call Control");
- resourceInfo.setResourceUUID("9c54e269-122b-4e8a-8b2a-6eac849b441a");
- resourceInfo.setResourceCustomizationUUID("428a3d73-f962-4cc2-ba62-2483c45d6b12");
+ resourceInfo.setSubcategory("Firewall");
+ resourceInfo.setResourceUUID("aa5d0562-80e7-43e9-af74-3085e57ab09f");
+ resourceInfo.setResourceCustomizationUUID("9f01263a-eaf7-4d98-a37b-3785f751903e");
resourceInfo.setResourceVersion("1.0");
return resourceInfo;
}
@@ -207,7 +351,6 @@ public class ASDCControllerITTest extends BaseTest {
* Testing with the service-Svc140-VF-csar.csar.
*/
@Test
- @Ignore
public void treatNotification_ValidVnfResource_ExpectedOutput() {
/**
@@ -244,11 +387,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-Svc140-VF-csar.csar", toscaCsar.getName());
+ assertEquals("tosca csar name", "service-vnfservice.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-Svc140-VF-csar.csar", toscaCsar.getUrl());
+ assertEquals("toscar csar URL", "/download/service-vnfservice.csar", toscaCsar.getUrl());
/**
* Check the service entity, it should be the same as global metadata information in
@@ -268,6 +411,9 @@ public class ASDCControllerITTest extends BaseTest {
assertEquals("service category", "Network Service", service.getCategory());
assertNull("workload context", service.getWorkloadContext());
assertEquals("resource order", "TestVF140", service.getResourceOrder());
+ assertEquals("CDS blueprint name", "BP140", service.getBlueprintName());
+ assertEquals("CDS blueprint version", "v1.4.0", service.getBlueprintVersion());
+ assertEquals("controller actor", "SO-REF-DATA", service.getControllerActor());
/**
* Check VNF resource, it should be the same as metadata in the topology template in
@@ -304,11 +450,12 @@ public class ASDCControllerITTest extends BaseTest {
assertNull("NF naming code", vnfCustomization.getNfNamingCode());
assertEquals("VNF resource model UUID", vnfResourceKey, vnfCustomization.getVnfResources().getModelUUID());
assertEquals("Multi stage design", "false", vnfCustomization.getMultiStageDesign());
- assertNull("resource input", vnfCustomization.getResourceInput());
- assertEquals("cds blueprint name(sdnc_model_name property)", vnfCustomization.getBlueprintName(),
- vnfCustomization.getBlueprintName());
- assertEquals("cds blueprint version(sdnc_model_version property)", vnfCustomization.getBlueprintVersion(),
+ assertNotNull("resource input", vnfCustomization.getResourceInput());
+ assertEquals("cds blueprint name(sdnc_model_name property)", "BP140", vnfCustomization.getBlueprintName());
+ assertEquals("cds blueprint version(sdnc_model_version property)", "v1.4.0",
vnfCustomization.getBlueprintVersion());
+ assertEquals("controller actor", "SO-REF-DATA", vnfCustomization.getControllerActor());
+
/**
* Check the vnf resource customization with service mapping
*/
@@ -335,8 +482,8 @@ public class ASDCControllerITTest extends BaseTest {
private ArtifactInfoImpl constructVnfServiceArtifact() {
ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl();
artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR);
- artifactInfo.setArtifactURL("/download/service-Svc140-VF-csar.csar");
- artifactInfo.setArtifactName("service-Svc140-VF-csar.csar");
+ artifactInfo.setArtifactURL("/download/service-vnfservice.csar");
+ artifactInfo.setArtifactName("service-vnfservice.csar");
artifactInfo.setArtifactVersion("1.0");
artifactInfo.setArtifactUUID(artifactUuid);
return artifactInfo;
diff --git a/asdc-controller/src/test/resources/download/service-pnfservice.csar b/asdc-controller/src/test/resources/download/service-pnfservice.csar
new file mode 100644
index 0000000000..89d24a18ee
--- /dev/null
+++ b/asdc-controller/src/test/resources/download/service-pnfservice.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/download/service-vnfservice.csar b/asdc-controller/src/test/resources/download/service-vnfservice.csar
new file mode 100644
index 0000000000..25d2ebd6c6
--- /dev/null
+++ b/asdc-controller/src/test/resources/download/service-vnfservice.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index d138d9e236..0821ebc97c 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -738,6 +738,8 @@ CREATE TABLE `orchestration_flow_reference` (
`SEQ_NO` int(11) NOT NULL,
`FLOW_NAME` varchar(200) NOT NULL,
`FLOW_VERSION` double NOT NULL,
+ `SCOPE` varchar(200) DEFAULT NULL,
+ `ACTION` varchar(200) DEFAULT NULL,
`NB_REQ_REF_LOOKUP_ID` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_orchestration_flow_reference` (`COMPOSITE_ACTION`,`FLOW_NAME`,`SEQ_NO`,`NB_REQ_REF_LOOKUP_ID`),
@@ -809,6 +811,10 @@ CREATE TABLE `service` (
`OVERALL_DISTRIBUTION_STATUS` varchar(45),
`ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL,
`NAMING_POLICY` varchar(200) DEFAULT NULL,
+ `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
+ `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -963,6 +969,7 @@ CREATE TABLE `vf_module_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VF_MODULE_MODEL_UUID` varchar(200) NOT NULL,
`VNF_RESOURCE_CUSTOMIZATION_ID` int(13) DEFAULT NULL,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
PRIMARY KEY (`ID`),
KEY `fk_vf_module_customization__vf_module1_idx` (`VF_MODULE_MODEL_UUID`),
KEY `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID`),
@@ -1113,7 +1120,8 @@ CREATE TABLE `vnf_resource_customization` (
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
`VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
- `NF_DATA_VALID` tinyint(1) DEFAULT '0',
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
+ `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
@@ -1195,6 +1203,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
`SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
+ `CONTROLLER_ACTOR` varchar(200) 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