diff options
Diffstat (limited to 'adapters')
14 files changed, 269 insertions, 177 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.3__AddBluePrintNameVersion.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.3__AddBluePrintNameVersion.sql new file mode 100644 index 0000000000..97397df290 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.3__AddBluePrintNameVersion.sql @@ -0,0 +1,8 @@ +use catalogdb; + +ALTER TABLE vnf_resource_customization +ADD CDS_BLUEPRINT_NAME varchar(200) null; + +ALTER TABLE vnf_resource_customization +ADD CDS_BLUEPRINT_VERSION varchar(20) null; + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.4__AddPnfResourceAndCustomization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.4__AddPnfResourceAndCustomization.sql new file mode 100644 index 0000000000..5571bf89ee --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.4__AddPnfResourceAndCustomization.sql @@ -0,0 +1,39 @@ +use catalogdb; + +CREATE TABLE IF NOT EXISTS `pnf_resource` ( + `ORCHESTRATION_MODE` varchar(20) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) DEFAULT NULL, + `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `pnf_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `NF_TYPE` varchar(200) DEFAULT NULL, + `NF_ROLE` varchar(200) DEFAULT NULL, + `NF_FUNCTION` varchar(200) DEFAULT NULL, + `NF_NAMING_CODE` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL, + `RESOURCE_INPUT` varchar(2000) DEFAULT NULL, + CDS_BLUEPRINT_NAME varchar(200) DEFAULT NULL, + CDS_BLUEPRINT_VERSION varchar(20) 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 +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1;
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java index b08b93eb87..89f4824492 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java @@ -170,6 +170,14 @@ public class CvnfcCatalogDbQueryTest { } else { Assert.fail("No linked VnfVfmoduleCvnfcConfigurationCustomization found for CvnfcCustomization"); } + + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomizationFound = client. + getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid( + "6912dd02-2b16-11e9-b210-d663bd873d93", + "bdbf984a-2b16-11e9-b210-d663bd873d93", + "0c042562-2bac-11e9-b210-d663bd873d93"); + assertNotNull(vnfVfmoduleCvnfcConfigurationCustomizationFound); + System.out.println(vnfVfmoduleCvnfcConfigurationCustomizationFound.getModelCustomizationUUID()); } protected CvnfcCustomization setUpCvnfcCustomization(String id){ @@ -198,4 +206,4 @@ public class CvnfcCatalogDbQueryTest { vnfcCustomization.setDescription("testVnfcCustomizationDescription"); return vnfcCustomization; } -} +}
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index 4479e1ba4a..d28784bb93 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -7,9 +7,9 @@ * 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. @@ -22,6 +22,7 @@ package org.onap.so.db.catalog.client; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.when; import java.util.List; @@ -42,6 +43,8 @@ import org.onap.so.db.catalog.beans.ExternalServiceToInternalService; import org.onap.so.db.catalog.beans.HomingInstance; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.PnfResource; +import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; @@ -59,6 +62,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.security.core.parameters.P; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; @@ -68,31 +72,36 @@ import com.fasterxml.jackson.databind.ObjectMapper; @SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") public class CatalogDbClientTest { + public static final String MTN13 = "mtn13"; - + @LocalServerPort private int port; @Value("${mso.db.auth}") private String msoAdaptersAuth; - + @Autowired CatalogDbClientPortChanger client; @Before - public void initialize(){ - client.wiremockPort= String.valueOf(port); + public void initialize() { + client.wiremockPort = String.valueOf(port); } @Test - public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(){ - RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "*", "*", "*", "*"); + public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep() { + RainyDayHandlerStatus rainyDayHandlerStatus = client + .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( + "AssignServiceInstanceBB", "*", "*", "*", "*"); Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy()); } @Test - public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound(){ - RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(UUID.randomUUID().toString(), "*", "*", "*", "*"); + public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound() { + RainyDayHandlerStatus rainyDayHandlerStatus = client + .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( + UUID.randomUUID().toString(), "*", "*", "*", "*"); Assert.assertNull(rainyDayHandlerStatus); } @@ -184,7 +193,8 @@ public class CatalogDbClientTest { @Test public void testGetVnfResourceCustomizationByModelCustomizationUUID() { - VnfResourceCustomization vnfResourceCustomization = client.getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671"); + VnfResourceCustomization vnfResourceCustomization = client + .getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671"); Assert.assertNotNull(vnfResourceCustomization); Assert.assertEquals("vSAMP", vnfResourceCustomization.getNfRole()); Assert.assertNotNull(vnfResourceCustomization.getModelCustomizationUUID()); @@ -196,7 +206,8 @@ public class CatalogDbClientTest { @Test public void testGetVnfResourceCustomizationByModelCustomizationUUINotFound() { - VnfResourceCustomization vnfResourceCustomization = client.getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString()); + VnfResourceCustomization vnfResourceCustomization = client + .getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString()); Assert.assertNull(vnfResourceCustomization); } @@ -205,12 +216,14 @@ public class CatalogDbClientTest { InstanceGroup instanceGroup = client.getInstanceGroupByModelUUID("0c8692ef-b9c0-435d-a738-edf31e71f38b"); Assert.assertNotNull(instanceGroup); Assert.assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName()); - Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806", instanceGroup.getToscaNodeType().toString()); + Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806", + instanceGroup.getToscaNodeType().toString()); } @Test public void testGetVfModuleCustomizationByModelCuztomizationUUID() { - VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671"); + VfModuleCustomization vfModuleCustomization = client + .getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671"); Assert.assertNotNull(vfModuleCustomization); Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID()); Assert.assertEquals("base", vfModuleCustomization.getLabel()); @@ -218,13 +231,15 @@ public class CatalogDbClientTest { @Test public void testGetVfModuleCustomizationByModelCuztomizationUUIDNotFound() { - VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString()); + VfModuleCustomization vfModuleCustomization = client + .getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString()); Assert.assertNull(vfModuleCustomization); } @Test public void testGetNetworkResourceCustomizationByModelCustomizationUUID() { - NetworkResourceCustomization networkResourceCustomization = client.getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac"); + NetworkResourceCustomization networkResourceCustomization = client + .getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac"); Assert.assertNotNull(networkResourceCustomization); Assert.assertNotNull(networkResourceCustomization.getModelCustomizationUUID()); Assert.assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName()); @@ -233,13 +248,16 @@ public class CatalogDbClientTest { @Test public void testGetNetworkResourceCustomizationByModelCustomizationUUIDNotFound() { - NetworkResourceCustomization networkResourceCustomization = client.getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString()); + NetworkResourceCustomization networkResourceCustomization = client + .getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString()); Assert.assertNull(networkResourceCustomization); } @Test public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID() { - VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID("cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672"); + VfModuleCustomization vfModuleCustomization = client + .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID( + "cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672"); Assert.assertNotNull(vfModuleCustomization); Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID()); Assert.assertNotNull(vfModuleCustomization.getVfModule()); @@ -248,29 +266,35 @@ public class CatalogDbClientTest { @Test public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUIDNotFound() { - VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID("cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString()); + VfModuleCustomization vfModuleCustomization = client + .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID( + "cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString()); Assert.assertNull(vfModuleCustomization); } @Test public void testGetFirstByServiceModelUUIDAndAction() { - ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance"); + ServiceRecipe serviceRecipe = client + .getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance"); Assert.assertNotNull(serviceRecipe); Assert.assertNotNull(serviceRecipe.getServiceModelUUID()); Assert.assertNotNull(serviceRecipe.getAction()); - Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri()); + Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", + serviceRecipe.getOrchestrationUri()); Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription()); } @Test public void testGetFirstByServiceModelUUIDAndActionNotFound() { - ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671", UUID.randomUUID().toString()); + ServiceRecipe serviceRecipe = client + .getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671", UUID.randomUUID().toString()); Assert.assertNull(serviceRecipe); } - + @Test public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersion() { - VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0"); + VnfResource vnfResource = client + .getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0"); Assert.assertNotNull(vnfResource); Assert.assertNotNull(vnfResource.getModelInvariantId()); Assert.assertNotNull(vnfResource.getModelVersion()); @@ -281,7 +305,9 @@ public class CatalogDbClientTest { @Test public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersionNotFound() { - VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", UUID.randomUUID().toString()); + VnfResource vnfResource = client + .getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", + UUID.randomUUID().toString()); Assert.assertNull(vnfResource); } @@ -289,12 +315,15 @@ public class CatalogDbClientTest { public void testGetFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources() { VnfResource vnfr = new VnfResource(); vnfr.setModelUUID("ff2ae348-214a-11e7-93ae-92361f002671"); - VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources = client.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr); + VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources = client + .getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr); Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources); Assert.assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole()); - Assert.assertEquals("vSAMP10a 1", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName()); + Assert.assertEquals("vSAMP10a 1", + firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName()); Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources()); - Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations()); + Assert + .assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations()); } @Test @@ -315,7 +344,9 @@ public class CatalogDbClientTest { @Test public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction() { - VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction("20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance"); + VnfComponentsRecipe vnfComponentsRecipe = client + .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction( + "20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance"); Assert.assertNotNull(vnfComponentsRecipe); Assert.assertNotNull(vnfComponentsRecipe.getAction()); Assert.assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID()); @@ -328,23 +359,28 @@ public class CatalogDbClientTest { @Test public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndActionNotFound() { - VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(UUID.randomUUID().toString(), "volumeGroup", "createInstance"); + VnfComponentsRecipe vnfComponentsRecipe = client + .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(UUID.randomUUID().toString(), + "volumeGroup", "createInstance"); Assert.assertNull(vnfComponentsRecipe); } @Test public void testGetFirstVnfComponentsRecipeByVnfComponentTypeAndAction() { - VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance"); + VnfComponentsRecipe vnfComponentsRecipe = client + .getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance"); Assert.assertNotNull(vnfComponentsRecipe); Assert.assertNotNull(vnfComponentsRecipe.getAction()); Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType()); Assert.assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription()); - Assert.assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri()); + Assert + .assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri()); } @Test public void testGetServiceByModelVersionAndModelInvariantUUID() { - Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671"); + Service service = client + .getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671"); Assert.assertNotNull(service); Assert.assertNotNull(service.getModelVersion()); Assert.assertNotNull(service.getModelInvariantUUID()); @@ -360,7 +396,8 @@ public class CatalogDbClientTest { @Test public void testGetVfModuleByModelInvariantUUIDAndModelVersion() { - VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2"); + VfModule vfModule = client + .getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2"); Assert.assertNotNull(vfModule); Assert.assertNotNull(vfModule.getModelVersion()); Assert.assertNotNull(vfModule.getModelInvariantUUID()); @@ -373,10 +410,11 @@ public class CatalogDbClientTest { VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion(UUID.randomUUID().toString(), "2"); Assert.assertNull(vfModule); } - + @Test public void testGetServiceByModelInvariantUUIDOrderByModelVersionDesc() { - List<Service> serviceList = client.getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671"); + List<Service> serviceList = client + .getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671"); Assert.assertFalse(serviceList.isEmpty()); Assert.assertEquals(2, serviceList.size()); Service service = serviceList.get(0); @@ -385,22 +423,25 @@ public class CatalogDbClientTest { @Test public void testGetServiceByModelInvariantUUIDOrderByModelVersionDescNotFound() { - List<Service> serviceList = client.getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString()); + List<Service> serviceList = client + .getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString()); Assert.assertTrue(serviceList.isEmpty()); } @Test public void testGetVfModuleByModelInvariantUUIDOrderByModelVersionDesc() { - List<VfModule> moduleList = client.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671"); + List<VfModule> moduleList = client + .getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671"); Assert.assertFalse(moduleList.isEmpty()); Assert.assertEquals(2, moduleList.size()); VfModule module = moduleList.get(0); - Assert.assertEquals("vSAMP10a DEV Base",module.getDescription()); + Assert.assertEquals("vSAMP10a DEV Base", module.getDescription()); } @Test public void testPostCloudSite() { - CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger("http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort); + CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger( + "http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort); CloudSite cloudSite = new CloudSite(); cloudSite.setId("MTN6"); cloudSite.setClli("TESTCLLI"); @@ -438,60 +479,61 @@ public class CatalogDbClientTest { @Test public void testPostHomingInstance() { - CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger("http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort); + CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger( + "http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort); HomingInstance homingInstance = new HomingInstance(); homingInstance.setServiceInstanceId("5df8d6be-2083-11e7-93ae-92361f232671"); homingInstance.setCloudOwner("CloudOwner-1"); homingInstance.setCloudRegionId("CloudRegionOne"); homingInstance.setOofDirectives("{\n" + - "\"directives\": [\n" + - "{\n" + - "\"directives\": [\n" + - "{\n" + - "\"attributes\": [\n" + - "{\n" + - "\"attribute_value\": \"onap.hpa.flavor31\",\n" + - "\"attribute_name\": \"firewall_flavor_name\"\n" + - "}\n" + - "],\n" + - "\"type\": \"flavor_directives\"\n" + - "}\n" + - "],\n" + - "\"type\": \"vnfc\",\n" + - "\"id\": \"vfw\"\n" + - "},\n" + - "{\n" + - "\"directives\": [\n" + - "{\n" + - "\"attributes\": [\n" + - "{\n" + - "\"attribute_value\": \"onap.hpa.flavor32\",\n" + - "\"attribute_name\": \"packetgen_flavor_name\"\n" + - "}\n" + - "],\n" + - "\"type\": \"flavor_directives\"\n" + - "}\n" + - "],\n" + - "\"type\": \"vnfc\",\n" + - "\"id\": \"vgenerator\"\n" + - "},\n" + - "{\n" + - "\"directives\": [\n" + - "{\n" + - "\"attributes\": [\n" + - "{\n" + - "\"attribute_value\": \"onap.hpa.flavor31\",\n" + - "\"attribute_name\": \"sink_flavor_name\"\n" + - "}\n" + - "],\n" + - "\"type\": \"flavor_directives\"\n" + - "}\n" + - "],\n" + - "\"type\": \"vnfc\",\n" + - "\"id\": \"vsink\"\n" + - "}\n" + - "]\n" + - "}"); + "\"directives\": [\n" + + "{\n" + + "\"directives\": [\n" + + "{\n" + + "\"attributes\": [\n" + + "{\n" + + "\"attribute_value\": \"onap.hpa.flavor31\",\n" + + "\"attribute_name\": \"firewall_flavor_name\"\n" + + "}\n" + + "],\n" + + "\"type\": \"flavor_directives\"\n" + + "}\n" + + "],\n" + + "\"type\": \"vnfc\",\n" + + "\"id\": \"vfw\"\n" + + "},\n" + + "{\n" + + "\"directives\": [\n" + + "{\n" + + "\"attributes\": [\n" + + "{\n" + + "\"attribute_value\": \"onap.hpa.flavor32\",\n" + + "\"attribute_name\": \"packetgen_flavor_name\"\n" + + "}\n" + + "],\n" + + "\"type\": \"flavor_directives\"\n" + + "}\n" + + "],\n" + + "\"type\": \"vnfc\",\n" + + "\"id\": \"vgenerator\"\n" + + "},\n" + + "{\n" + + "\"directives\": [\n" + + "{\n" + + "\"attributes\": [\n" + + "{\n" + + "\"attribute_value\": \"onap.hpa.flavor31\",\n" + + "\"attribute_name\": \"sink_flavor_name\"\n" + + "}\n" + + "],\n" + + "\"type\": \"flavor_directives\"\n" + + "}\n" + + "],\n" + + "\"type\": \"vnfc\",\n" + + "\"id\": \"vsink\"\n" + + "}\n" + + "]\n" + + "}"); localClient.postHomingInstance(homingInstance); HomingInstance getHomingInstance = this.client.getHomingInstance("5df8d6be-2083-11e7-93ae-92361f232671"); Assert.assertNotNull(getHomingInstance); @@ -501,7 +543,7 @@ public class CatalogDbClientTest { Assert.assertEquals("CloudRegionOne", getHomingInstance.getCloudRegionId()); } - @Test + @Test public void testGetServiceByModelName() { Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service"); Assert.assertNotNull(service); @@ -534,39 +576,44 @@ public class CatalogDbClientTest { } @Test - public void testGetNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(){ - NorthBoundRequest northBoundRequest = new NorthBoundRequest(); - northBoundRequest.setAction("createService"); - northBoundRequest.setRequestScope("service"); - northBoundRequest.setIsAlacarte(true); - northBoundRequest.setCloudOwner("my-custom-cloud-owner"); - client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true, "my-custom-cloud-owner"); - Assert.assertNotNull(northBoundRequest); - Assert.assertEquals("createService",northBoundRequest.getAction()); - Assert.assertEquals("service",northBoundRequest.getRequestScope()); - Assert.assertEquals(true,northBoundRequest.getIsAlacarte() ); - Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner()); + public void testGetNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner() { + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + northBoundRequest.setAction("createService"); + northBoundRequest.setRequestScope("service"); + northBoundRequest.setIsAlacarte(true); + northBoundRequest.setCloudOwner("my-custom-cloud-owner"); + client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true, + "my-custom-cloud-owner"); + Assert.assertNotNull(northBoundRequest); + Assert.assertEquals("createService", northBoundRequest.getAction()); + Assert.assertEquals("service", northBoundRequest.getRequestScope()); + Assert.assertEquals(true, northBoundRequest.getIsAlacarte()); + Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner()); } - + @Test public void testFindServiceRecipeByActionAndServiceModelUUID() { - ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance","4694a55f-58b3-4f17-92a5-796d6f5ffd0d" ); + ServiceRecipe serviceRecipe = client + .findServiceRecipeByActionAndServiceModelUUID("createInstance", "4694a55f-58b3-4f17-92a5-796d6f5ffd0d"); Assert.assertNotNull(serviceRecipe); Assert.assertNotNull(serviceRecipe.getServiceModelUUID()); Assert.assertNotNull(serviceRecipe.getAction()); - Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri()); + Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", + serviceRecipe.getOrchestrationUri()); Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription()); } @Test public void testFindServiceRecipeByActionAndServiceModelUUIDNotFound() { - ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("not_found","5df8b6de-2083-11e7-93ae-test" ); + ServiceRecipe serviceRecipe = client + .findServiceRecipeByActionAndServiceModelUUID("not_found", "5df8b6de-2083-11e7-93ae-test"); Assert.assertNull(serviceRecipe); } @Test public void testFindExternalToInternalServiceByServiceName() { - ExternalServiceToInternalService externalServiceToInternalService = client.findExternalToInternalServiceByServiceName("MySpecialServiceName"); + ExternalServiceToInternalService externalServiceToInternalService = client + .findExternalToInternalServiceByServiceName("MySpecialServiceName"); Assert.assertNotNull(externalServiceToInternalService); Assert.assertNotNull(externalServiceToInternalService.getServiceName()); Assert.assertNotNull(externalServiceToInternalService.getServiceModelUUID()); @@ -575,7 +622,51 @@ public class CatalogDbClientTest { @Test public void testFindExternalToInternalServiceByServiceNameNotFound() { - ExternalServiceToInternalService externalServiceToInternalService = client.findExternalToInternalServiceByServiceName("Not_Found"); + ExternalServiceToInternalService externalServiceToInternalService = client + .findExternalToInternalServiceByServiceName("Not_Found"); Assert.assertNull(externalServiceToInternalService); } + + @Test + public void getPnfResourceByModelUUID_validUuid_expectedOutput() { + PnfResource pnfResource = client.getPnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002680"); + Assert.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()); + } + + @Test + public void getPnfResourceByModelUUID_invalidUuid_NullOutput() { + PnfResource pnfResource = client.getPnfResourceByModelUUID(UUID.randomUUID().toString()); + Assert.assertNull(pnfResource); + } + + @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()); + 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()); + + } + + @Test + public void getPnfResourceCustomizationByModelCustomizationUUID_invalidUuid_nullOutput() { + PnfResourceCustomization pnfResourceCustomization = client + .getPnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString()); + Assert.assertNull(pnfResourceCustomization); + } + } diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql index 1223080e59..91deab8fff 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -293,3 +293,15 @@ VALUES ( '1', '68dc9a92-214c-11e7-93ae-92361f002671', 'cb82ffd8-252a-11e7-93ae-92361f002671', '9bcce658-9b37-11e8-98d0-529269fb1459'); + +insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values +('5df8b6de-2083-11e7-93ae-92361f002676', 'PNF_routing_service', '9647dfc4-2083-11e7-93ae-92361f002676', '1.0', 'PNF service', '2019-03-08 12:00:29', null, 'NA', 'NA', 'Luna', 'Oxygen'); + +insert into pnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, model_invariant_uuid, model_version, model_name, tosca_node_type) values +('', 'PNF routing', '2019-03-08 12:00:28', 'ff2ae348-214a-11e7-93ae-92361f002680', '2fff5b20-214b-11e7-93ae-92361f002680', '1.0', 'PNF resource', null); + +insert into pnf_resource_customization(model_customization_uuid, model_instance_name, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, pnf_resource_model_uuid, multi_stage_design, cds_blueprint_name, cds_blueprint_version) values +('68dc9a92-214c-11e7-93ae-92361f002680', 'PNF routing', 'routing', 'routing', 'routing', 'routing', '2019-03-08 12:00:29', 'ff2ae348-214a-11e7-93ae-92361f002680', null, "test_configuration_restconf", "1.0.0"); + +insert into pnf_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values +('5df8b6de-2083-11e7-93ae-92361f002676', '68dc9a92-214c-11e7-93ae-92361f002680');
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index 80333d6c7e..25d8e564da 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -129,7 +129,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String error; MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("CreateNetworkA"); logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -252,10 +251,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - String serviceName = "UpdateNetworkA"; - MsoLogger.setServiceName (serviceName); MsoLogger.setLogContext (msoRequest); logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId); @@ -292,9 +288,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { msoRequest, subnetIdMap, networkRollback); - MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { - MsoLogger.setServiceName (serviceName); logger.debug ("Got a NetworkException on updateNetwork: ", e); MsoExceptionCategory exCat = null; String eMsg = null; @@ -351,8 +345,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String error; MsoLogger.setLogContext (msoRequest); - String serviceName = "QueryNetworkA"; - MsoLogger.setServiceName (serviceName); logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} "; @@ -378,9 +370,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { status, vlans, subnetIdMap); - MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { - MsoLogger.setServiceName (serviceName); logger.debug (NETWORK_EXCEPTION_MSG, e); MsoExceptionCategory exCat = null; String eMsg = null; @@ -453,7 +443,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String error; MsoLogger.setLogContext (msoRequest); String serviceName = "DeleteNetworkA"; - MsoLogger.setServiceName (serviceName); logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -464,9 +453,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { try { networkAdapter.deleteNetwork (cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, msoRequest, networkDeleted); - MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { - MsoLogger.setServiceName (serviceName); logger.debug (NETWORK_EXCEPTION_MSG, e); MsoExceptionCategory exCat = null; String eMsg = null; @@ -513,9 +500,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { */ @Override public void rollbackNetworkA (NetworkRollback rollback, String messageId, String notificationUrl) { - String error; - String serviceName = "RollbackNetworkA"; - MsoLogger.setServiceName (serviceName); // rollback may be null (e.g. if network already existed when Create was called) if (rollback == null) { logger.warn("{} {} Rollback is null", MessageEnum.RA_ROLLBACK_NULL, @@ -530,9 +514,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { try { networkAdapter.rollbackNetwork (rollback); - MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { - MsoLogger.setServiceName (serviceName); logger.debug ("Got a NetworkException on rollbackNetwork: ", e); // Build and send Asynchronous error response MsoExceptionCategory exCat = null; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index 79966577f8..bcb6b1be42 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -267,8 +267,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (CREATE_NETWORK_CONTEXT); - logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -715,7 +713,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (UPDATE_NETWORK_CONTEXT); logger.debug("***UPDATE Network adapter with Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); @@ -1151,7 +1148,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <List <RouteTarget>> routeTargets, Holder <Map <String, String>> subnetIdMap) throws NetworkException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("QueryNetwork"); logger.debug("*** QUERY Network with Network: {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -1290,7 +1286,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { MsoRequest msoRequest, Holder <Boolean> networkDeleted) throws NetworkException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteNetwork"); logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -1382,7 +1377,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { */ @Override public void rollbackNetwork (NetworkRollback rollback) throws NetworkException { - MsoLogger.setServiceName ("RollbackNetwork"); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java index db9226bb19..a937bd9499 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java @@ -89,7 +89,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { Holder <String> tenantId, Holder <TenantRollback> rollback) throws TenantException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (CREATE_TENANT); logger.debug("Call to MSO createTenant adapter. Creating Tenant: {} in {}", tenantName, cloudSiteId); @@ -154,7 +153,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { Holder <String> tenantName, Holder <Map <String, String>> metadata) throws TenantException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (QUERY_TENANT); logger.debug ("Querying Tenant {} in {}", tenantNameOrId, cloudSiteId); MsoTenantUtils tUtils; @@ -199,7 +197,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { MsoRequest msoRequest, Holder <Boolean> tenantDeleted) throws TenantException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (DELETE_TENANT); logger.debug ("Deleting Tenant {} in {}", tenantId, cloudSiteId); @@ -230,7 +227,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { */ @Override public void rollbackTenant (TenantRollback rollback) throws TenantException { - MsoLogger.setServiceName (ROLLBACK_TENANT); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { logger.warn("{} {} rollbackTenant, rollback is null", MessageEnum.RA_ROLLBACK_NULL, diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index 2c9d3776a7..b445dc8a26 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -132,10 +132,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - String serviceName = "CreateVnfA"; MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (serviceName); logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF); // Use the synchronous method to perform the actual Create MsoVnfAdapter vnfAdapter = vnfImpl; @@ -160,9 +157,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfId, outputs, vnfRollback); - MsoLogger.setServiceName (serviceName); } catch (VnfException e) { - MsoLogger.setServiceName (serviceName); logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; @@ -218,9 +213,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - String serviceName = "UpdateVnfA"; - MsoLogger.setServiceName (serviceName); MsoLogger.setLogContext (msoRequest); logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF); @@ -234,9 +226,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback); - MsoLogger.setServiceName (serviceName); } catch (VnfException e) { - MsoLogger.setServiceName (serviceName); logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; @@ -301,7 +291,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String notificationUrl) { String error; String serviceName = "QueryVnfA"; - MsoLogger.setServiceName (serviceName); MsoLogger.setLogContext (msoRequest); logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF); @@ -316,9 +305,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs); - MsoLogger.setServiceName (serviceName); } catch (VnfException e) { - MsoLogger.setServiceName (serviceName); logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; @@ -391,7 +378,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String notificationUrl) { String error; String serviceName = "DeleteVnfA"; - MsoLogger.setServiceName (serviceName); MsoLogger.setLogContext (msoRequest); logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF); @@ -400,9 +386,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { vnfAdapter.deleteVnf (cloudSiteId, tenantId, vnfName, msoRequest); - MsoLogger.setServiceName (serviceName); } catch (VnfException e) { - MsoLogger.setServiceName (serviceName); logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; @@ -451,9 +435,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { */ @Override public void rollbackVnfA (VnfRollback rollback, String messageId, String notificationUrl) { - String serviceName = "RollbackVnfA"; - MsoLogger.setServiceName (serviceName); - String error; // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { logger.info("{} rollbackVnfA: Empty Rollback: No action to perform", MessageEnum.RA_ROLLBACK_NULL); @@ -468,9 +449,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { vnfAdapter.rollbackVnf (rollback); - MsoLogger.setServiceName (serviceName); } catch (VnfException e) { - MsoLogger.setServiceName (serviceName); logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java index ce060abee8..a1d7698ad1 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java @@ -275,7 +275,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Holder <VnfRollback> rollback) throws VnfException { // As of 1707 - this method should no longer be called MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ()); - MsoLogger.setServiceName ("UpdateVnf"); logger.debug("UpdateVnf called?? This should not be called any longer - update vfModule"); } @@ -304,7 +303,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Holder <VnfStatus> status, Holder <Map <String, String>> outputs) throws VnfException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("QueryVnf"); logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -364,7 +362,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String vnfName, MsoRequest msoRequest) throws VnfException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteVnf"); logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -401,7 +398,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { @Override public void rollbackVnf (VnfRollback rollback) throws VnfException { long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("RollbackVnf"); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { logger.info(MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); @@ -605,7 +601,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } } MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("CreateVfModule"); String requestTypeString = ""; if (requestType != null && !"".equals(requestType)) { requestTypeString = requestType; @@ -1377,7 +1372,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String methodName = "updateVfModule"; MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ()); String serviceName = VNF_ADAPTER_SERVICE_NAME + methodName; - MsoLogger.setServiceName (serviceName); StringBuilder sbInit = new StringBuilder(); sbInit.append("updateVfModule: \n"); @@ -1505,7 +1499,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { throw new VnfException (me); } if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) { - MsoLogger.setServiceName (serviceName); String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error); @@ -1538,7 +1531,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { throw new VnfException (me); } if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) { - MsoLogger.setServiceName (serviceName); String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; logger.error ("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, tenantId, error, "OpenStack", diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index b0601e9264..bba960cddf 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -207,7 +207,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { throws VnfException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("QueryVnfCloudify"); logger.debug ("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -266,7 +265,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String vnfName, MsoRequest msoRequest) throws VnfException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteVnf"); // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules. logger.debug("DeleteVNF command attempted but not supported"); @@ -285,7 +283,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { @Override public void rollbackVnf (VnfRollback rollback) throws VnfException { long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("RollbackVnf"); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { logger.info ("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf", MsoLogger @@ -580,7 +577,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { long startTime = System.currentTimeMillis (); MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("CreateVfModule"); // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { @@ -1184,7 +1180,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { MsoRequest msoRequest, Holder <Map <String, String>> outputs) throws VnfException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteVf"); logger.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index cb1e350774..704d54c918 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -226,7 +226,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { throws VnfException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("QueryVnf"); logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -283,7 +282,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String vnfName, MsoRequest msoRequest) throws VnfException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteVnf"); // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules. logger.debug("DeleteVNF command attempted but not supported"); @@ -302,7 +300,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { @Override public void rollbackVnf (VnfRollback rollback) throws VnfException { long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("RollbackVnf"); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { logger.info("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf", @@ -622,7 +619,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { long startTime = System.currentTimeMillis (); MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("CreateVfModule"); // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { @@ -1170,7 +1166,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { Holder <Map <String, String>> outputs) throws VnfException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteVfModule"); logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql index e9f2a09860..ac08f8b645 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql @@ -384,6 +384,8 @@ create table `vnf_resource_customization` ( `vnf_resource_model_uuid` varchar(200) not null, `multi_stage_design` varchar(20) default null, `resource_input` varchar(20000) default null, + `cds_blueprint_name` varchar(200), + `cds_blueprint_version` varchar(200), primary key (`model_customization_uuid`), key `fk_vnf_resource_customization__vnf_resource1_idx` (`vnf_resource_model_uuid`), constraint `fk_vnf_resource_customization__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java index 62233273b1..d0973d3c44 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java @@ -66,7 +66,6 @@ public class SDNCServiceRequestTask { public void runRequest(SDNCServiceRequest request,String msoRequestId,String msoServiceInstanceId,String myUrlSuffix) { MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId); - MsoLogger.setServiceName(getClass().getSimpleName()); String sdncRequestId = request.getSdncRequestId(); String sdncService = request.getSdncService(); |