use of org.onap.so.db.catalog.beans.PnfResourceCustomization in project so by onap.
the class CatalogDbClientTest method getPnfResourceCustomizationFromJoinTable_validServiceUuid_expectedOutput.
@Test
public void getPnfResourceCustomizationFromJoinTable_validServiceUuid_expectedOutput() {
List<PnfResourceCustomization> pnfResourceCustomizationList = client.getPnfResourceCustomizationByModelUuid("5df8b6de-2083-11e7-93ae-92361f002676");
assertEquals(1, pnfResourceCustomizationList.size());
PnfResourceCustomization pnfResourceCustomization = pnfResourceCustomizationList.get(0);
assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
PnfResource pnfResource = pnfResourceCustomization.getPnfResources();
assertNotNull(pnfResource);
assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680", pnfResource.getModelInvariantUUID());
assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
}
use of org.onap.so.db.catalog.beans.PnfResourceCustomization in project so by onap.
the class CatalogDbClientTest method getPnfResourceCustomizationByModelCustomizationUUID_invalidUuid_nullOutput.
@Test
public void getPnfResourceCustomizationByModelCustomizationUUID_invalidUuid_nullOutput() {
PnfResourceCustomization pnfResourceCustomization = client.getPnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
assertNull(pnfResourceCustomization);
}
use of org.onap.so.db.catalog.beans.PnfResourceCustomization in project so by onap.
the class CatalogDbClientTest method getPnfResourceCustomizationByModelCustomizationUUID_validUuid_expectedOutput.
@Test
public void getPnfResourceCustomizationByModelCustomizationUUID_validUuid_expectedOutput() {
PnfResourceCustomization pnfResourceCustomization = client.getPnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002680");
assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
assertTrue("skip post instantiation configuration", pnfResourceCustomization.getSkipPostInstConf());
PnfResource pnfResource = pnfResourceCustomization.getPnfResources();
assertNotNull(pnfResource);
assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680", pnfResource.getModelInvariantUUID());
assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
}
use of org.onap.so.db.catalog.beans.PnfResourceCustomization in project so by onap.
the class ToscaResourceInstaller method createPnfResourceCustomization.
/**
* Construct the {@link PnfResourceCustomization} from {@link IEntityDetails} object.
*/
private PnfResourceCustomization createPnfResourceCustomization(IEntityDetails entityDetails, PnfResource pnfResource) {
PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization();
Metadata metadata = entityDetails.getMetadata();
Map<String, Property> properties = entityDetails.getProperties();
pnfResourceCustomization.setModelCustomizationUUID(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
pnfResourceCustomization.setModelInstanceName(entityDetails.getName());
pnfResourceCustomization.setNfFunction(getStringValue(properties.get(SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)));
pnfResourceCustomization.setNfNamingCode(getStringValue(properties.get(SdcPropertyNames.PROPERTY_NAME_NFCODE)));
pnfResourceCustomization.setNfRole(getStringValue(properties.get(SdcPropertyNames.PROPERTY_NAME_NFROLE)));
pnfResourceCustomization.setNfType(getStringValue(properties.get(SdcPropertyNames.PROPERTY_NAME_NFTYPE)));
pnfResourceCustomization.setMultiStageDesign(getStringValue(properties.get(MULTI_STAGE_DESIGN)));
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.setDefaultSoftwareVersion(extractDefaultSoftwareVersionFromSwVersions(properties));
pnfResourceCustomization.setPnfResources(pnfResource);
return pnfResourceCustomization;
}
use of org.onap.so.db.catalog.beans.PnfResourceCustomization in project so by onap.
the class ASDCControllerITTest method treatNotification_ValidPnfResource_With_Software_Version_ExpectedOutput.
/**
* Test with service-Ericservice-csar.csar to test software_vesrions field.
*/
@Test
public void treatNotification_ValidPnfResource_With_Software_Version_ExpectedOutput() {
/**
* service UUID/invariantUUID from global metadata in service-PnfServiceTestCds-template.yml.
*/
// "77cf276e-905c-43f6-8d54-dda474be2f2e";
String serviceUuid = "8e7b2bd7-6901-4cc2-b3fb-3b6a1d5631e3";
// "913e6776-4bc3-49b9-b399-b5bb4690f0c7";
String serviceInvariantUuid = "9a5f99c8-0492-4691-b29a-7360d9c3aae3";
initMockAaiServer(serviceUuid, serviceInvariantUuid);
NotificationDataImpl notificationData = new NotificationDataImpl();
notificationData.setServiceUUID(serviceUuid);
notificationData.setDistributionID(distributionId);
notificationData.setServiceInvariantUUID(serviceInvariantUuid);
notificationData.setServiceVersion("1.0");
ResourceInfoImpl resourceInfo = constructPnfResourceInfoWithSWV1();
List<ResourceInfoImpl> resourceInfoList = new ArrayList<>();
resourceInfoList.add(resourceInfo);
notificationData.setResources(resourceInfoList);
ArtifactInfoImpl artifactInfo = constructPnfServiceArtifactWithSWV();
List<ArtifactInfoImpl> artifactInfoList = new ArrayList<>();
artifactInfoList.add(artifactInfo);
notificationData.setServiceArtifacts(artifactInfoList);
try {
asdcController.treatNotification(notificationData);
logger.info("Checking the database for PNF ingestion");
/**
* Check the tosca csar entity, it should be the same as provided from NotficationData.
*/
ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid).orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found"));
assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID());
assertEquals("tosca csar name", "service-Ericservice-csar.csar", toscaCsar.getName());
assertEquals("tosca csar version", "1.0", toscaCsar.getVersion());
assertNull("tosca csar descrption", toscaCsar.getDescription());
assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum());
assertEquals("toscar csar URL", "/download/service-Ericservice-csar.csar", toscaCsar.getUrl());
/**
* Check the service entity, it should be the same as global metadata information in
* service-Testservice140-template.yml inside csar.
*/
Service service = serviceRepository.findById(serviceUuid).orElseThrow(() -> new EntityNotFoundException("Service: " + serviceUuid + " not found"));
/**
* Check PNF resource, it should be the same as metadata in the topology template in
* service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml
*/
String pnfResourceKey = "7a90f80b-a6f6-4597-8c48-80bda26b4823";
/**
* Check PNF resource customization, it should be the same as metadata in the topology template in
* service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml
*/
// "9f01263a-eaf7-4d98-a37b-3785f751903e";
String pnfCustomizationKey = "05660370-41ed-4720-a42b-d6def010c326";
PnfResourceCustomization pnfCustomization = pnfCustomizationRepository.findById(pnfCustomizationKey).orElseThrow(() -> new EntityNotFoundException("PNF resource customization: " + pnfCustomizationKey + " not found"));
assertEquals("model customizationUUID", pnfCustomizationKey, pnfCustomization.getModelCustomizationUUID());
assertEquals("model instance name", "demo-PNF 0", pnfCustomization.getModelInstanceName());
assertEquals("NF type", "", pnfCustomization.getNfType());
assertEquals("NF Role", "", pnfCustomization.getNfRole());
assertEquals("NF function", "", pnfCustomization.getNfFunction());
assertEquals("NF naming code", "", pnfCustomization.getNfNamingCode());
assertEquals("PNF resource model UUID", pnfResourceKey, pnfCustomization.getPnfResources().getModelUUID());
assertEquals("Multi stage design", "", pnfCustomization.getMultiStageDesign());
assertNull("resource input", pnfCustomization.getResourceInput());
assertEquals("cds blueprint name(sdnc_model_name property)", "pm_control", pnfCustomization.getBlueprintName());
assertEquals("cds blueprint version(sdnc_model_version property)", "1.0.0", pnfCustomization.getBlueprintVersion());
assertEquals("default software version", "foo-123", pnfCustomization.getDefaultSoftwareVersion());
assertTrue("skip post instantiation configuration", pnfCustomization.getSkipPostInstConf());
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());
}
}
Aggregations