From e8689688629582187b2484eda21524ee70abbb9f Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Wed, 20 Mar 2019 16:19:39 -0400 Subject: [PATCH] Corrected hibernate for cfvc customization table fix two tests that did not ignore some properties fix schema sql file that was missing fields Properly wire hibernate entities, clean up db tables Update schema.sql files to be consistent add junit for customization linked to same cvnfc Change-Id: I4bc0a83cb3908f5b34224416e75446b6cd166b9e Issue-ID: SO-1689 Signed-off-by: Benjamin, Max (mb388a) --- .../db/migration/V5.6__Fix_CVNFC_Customization.sql | 23 ++++ .../catalogrest/CvnfcCatalogDbQueryTest.java | 91 ++----------- .../installer/heat/ToscaResourceInstaller.java | 19 +-- .../onap/so/asdc/util/ASDCNotificationLogging.java | 59 ++++++++ asdc-controller/src/test/resources/schema.sql | 86 +++++++----- .../tasks/BBInputSetupUtils.java | 2 +- .../workflow/tasks/WorkflowActionBBTasks.java | 49 +++---- .../src/test/resources/logback-test.xml | 2 +- .../src/test/resources/schema.sql | 148 +++++++++++++-------- .../so/db/catalog/beans/CvnfcCustomization.java | 5 +- ...VnfVfmoduleCvnfcConfigurationCustomization.java | 10 +- .../onap/so/db/catalog/client/CatalogDbClient.java | 30 +++-- ...eCvnfcConfigurationCustomizationRepository.java | 12 +- .../CvnfcCustomizationRepositoryTest.java | 2 + ...fcConfigurationCustomizationRepositoryTest.java | 133 ------------------ mso-catalog-db/src/test/resources/data.sql | 8 +- mso-catalog-db/src/test/resources/logback-test.xml | 7 +- mso-catalog-db/src/test/resources/schema.sql | 112 ++++++++-------- 18 files changed, 370 insertions(+), 428 deletions(-) create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql delete mode 100644 mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql new file mode 100644 index 0000000000..f09c7362d5 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql @@ -0,0 +1,23 @@ +use catalogdb; + +DROP TABLE vnf_vfmodule_cvnfc_configuration_customization; + +CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) NULL, + `CONFIGURATION_ROLE` VARCHAR(200) NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, + `POLICY_NAME` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `CVNFC_CUSTOMIZATION_ID` INT(11) DEFAULT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), + + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = 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 89f4824492..898e8eadf1 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 @@ -89,7 +89,7 @@ public class CvnfcCatalogDbQueryTest { CvnfcCustomization found = foundCvnfcCustomization.get(0); CvnfcCustomization templateCvnfcCustomization = new CvnfcCustomization(); - BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization"); + BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization", "vfModuleCustomization", "vnfcCustomization", "vnfResourceCustomization"); assertThat(cvnfcCustomization, sameBeanAs(templateCvnfcCustomization) .ignoring("id") @@ -99,86 +99,23 @@ public class CvnfcCatalogDbQueryTest { } @Test - public void getLinkedVnfVfmoduleCvnfcConfigurationCustomizationTest() { + public void cVnfcByCustomizationUUID_Test() { - CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization("0c042562-2bac-11e9-b210-d663bd873d93"); - - VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); - vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459"); - cvnfcCustomization.setVnfcCustomization(vnfcCustomization); - - ConfigurationResource configurationResource = new ConfigurationResource(); - configurationResource.setToscaNodeType("FabricConfiguration"); - configurationResource.setModelInvariantUUID("modelInvariantUUID"); - configurationResource.setModelUUID("modelUUID"); - configurationResource.setModelName("modelName"); - configurationResource.setModelVersion("modelVersion"); - configurationResource.setDescription("description"); - configurationResource.setToscaNodeType("toscaNodeTypeFC"); - - VnfResource vnfResource = new VnfResource(); - vnfResource.setModelUUID("6f19c5fa-2b19-11e9-b210-d663bd873d93"); - vnfResource.setModelVersion("modelVersion"); - vnfResource.setOrchestrationMode("orchestrationMode"); + CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization("dadc2c8c-2bab-11e9-b210-d663bd873d93"); + + CvnfcCustomization found = client.getCvnfcCustomizationByCustomizationUUID("dadc2c8c-2bab-11e9-b210-d663bd873d93"); + assertNotNull(found); - VfModule vfModule = new VfModule(); - vfModule.setModelUUID("98aa2a6e-2b18-11e9-b210-d663bd873d93"); - vfModule.setModelInvariantUUID("9fe57860-2b18-11e9-b210-d663bd873d93"); - vfModule.setIsBase(true); - vfModule.setModelName("modelName"); - vfModule.setModelVersion("modelVersion"); - vfModule.setVnfResources(vnfResource); + CvnfcCustomization templateCvnfcCustomization = new CvnfcCustomization(); + BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization", "vfModuleCustomization", "vnfcCustomization", "vnfResourceCustomization"); - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - vfModuleCustomization.setModelCustomizationUUID("bdbf984a-2b16-11e9-b210-d663bd873d93"); - vfModuleCustomization.setVfModule(vfModule); - cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); - - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - vnfResourceCustomization.setModelCustomizationUUID("6912dd02-2b16-11e9-b210-d663bd873d93"); - vnfResourceCustomization.setModelInstanceName("testModelInstanceName"); - vnfResourceCustomization.setVnfResources(vnfResource); - cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization); - - VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization(); - vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("configurationFunction"); - vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("64627fec-2b1b-11e9-b210-d663bd873d93"); - vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource); - vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization); - vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName"); - vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(vfModuleCustomization); - vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(vnfResourceCustomization); - - Set vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet(); - vnfVfmoduleCvnfcConfigurationCustomizationSet.add(vnfVfmoduleCvnfcConfigurationCustomization); - cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet); - - vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization); - - cvnfcCustomizationRepository.save(cvnfcCustomization); - - List foundCvnfcCustomization = client.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("6912dd02-2b16-11e9-b210-d663bd873d93","bdbf984a-2b16-11e9-b210-d663bd873d93"); - assertNotNull(foundCvnfcCustomization); - assertTrue(foundCvnfcCustomization.size() > 0); - CvnfcCustomization found = foundCvnfcCustomization.get(0); - - Set vnfVfmoduleCvnfcConfigurationCustomizations = found.getVnfVfmoduleCvnfcConfigurationCustomization(); - if (vnfVfmoduleCvnfcConfigurationCustomizations.size() > 0){ - for(VnfVfmoduleCvnfcConfigurationCustomization customization : vnfVfmoduleCvnfcConfigurationCustomizations) { - Assert.assertTrue(customization.getConfigurationResource().getToscaNodeType().equalsIgnoreCase("toscaNodeTypeFC")); - } - } 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()); + assertThat(cvnfcCustomization, sameBeanAs(templateCvnfcCustomization) + .ignoring("id") + .ignoring("created") + .ignoring("vnfVfmoduleCvnfcConfigurationCustomization") + .ignoring("vnfResourceCusteModelCustomizationUUID")); } + protected CvnfcCustomization setUpCvnfcCustomization(String id){ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); 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 ef0b4921e4..5af427a81a 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 @@ -1487,8 +1487,6 @@ public class ToscaResourceInstaller { List cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CVFC); for(NodeTemplate cvfcTemplate : cvfcList) { - - CvnfcCustomization existingCvnfcCustomization = findExistingCvfc(existingCvnfcSet, cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); if(vfModuleMemberName != null && vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName())){ @@ -1529,13 +1527,8 @@ public class ToscaResourceInstaller { // This check is needed incase the VFC subcategory is something other than Abstract. In that case we want to skip adding that record to our DB. if(vnfcCustomization.getModelCustomizationUUID() != null){ - CvnfcCustomization cvnfcCustomization = null; - - if(existingCvnfcCustomization != null){ - cvnfcCustomization = existingCvnfcCustomization; - } - else{ - + CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); + cvnfcCustomization = new CvnfcCustomization(); cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName()); @@ -1562,7 +1555,6 @@ public class ToscaResourceInstaller { cvnfcCustomizations.add(cvnfcCustomization); existingCvnfcSet.add(cvnfcCustomization); - } //***************************************************************************************************************************************** //* Extract Fabric Configuration @@ -1586,18 +1578,15 @@ public class ToscaResourceInstaller { VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = createVfCnvfConfigCustomization(fabricTemplate, toscaResourceStructure, vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig, vfTemplate, vfModuleMemberName); - vnfVfmoduleCvnfcConfigurationCustomizations.add(vnfVfmoduleCvnfcConfigurationCustomization); } - + cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizations); } } } - } - vfModuleCustomization.setCvnfcCustomization(cvnfcCustomizations); vfModuleCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizations); @@ -1609,7 +1598,7 @@ public class ToscaResourceInstaller { ConfigurationResource configResource, NodeTemplate vfTemplate, String vfModuleMemberName) { Metadata fabricMetadata = fabricTemplate.getMetaData(); - + VnfVfmoduleCvnfcConfigurationCustomization vfModuleToCvnfc = new VnfVfmoduleCvnfcConfigurationCustomization(); vfModuleToCvnfc.setConfigurationResource(configResource); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java index de28ca2446..0d75c56c58 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java @@ -323,9 +323,67 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); } + buffer.append(System.lineSeparator()); + buffer.append("VF Module Customization Properties:"); + buffer.append(System.lineSeparator()); + buffer.append("Model Customization UUID:"); + buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID))); + buffer.append(System.lineSeparator()); } + List vfConfigList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CONFIGURATION); + + if(vfConfigList != null){ + for (NodeTemplate configNodeTemplate : vfConfigList) { + + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + buffer.append("Fabric Configuration Properties:"); + buffer.append(System.lineSeparator()); + + buffer.append("Model Name:"); + buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + buffer.append(System.lineSeparator()); + buffer.append("Model UUID:"); + buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + buffer.append(System.lineSeparator()); + buffer.append("Description:"); + buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + buffer.append(System.lineSeparator()); + buffer.append("Version:"); + buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + buffer.append(System.lineSeparator()); + buffer.append("InvariantUuid:"); + buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + buffer.append(System.lineSeparator()); + buffer.append("Tosca Node Type:"); + buffer.append(configNodeTemplate.getType()); + + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + buffer.append("Fabric Configuration Customization Properties:"); + buffer.append(System.lineSeparator()); + + buffer.append("Model Customization UUID:"); + buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + buffer.append(System.lineSeparator()); + buffer.append("Model Instance Name:"); + buffer.append(configNodeTemplate.getName()); + buffer.append(System.lineSeparator()); + buffer.append("NFFunction:"); + buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + buffer.append(System.lineSeparator()); + buffer.append("NFRole:"); + buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + buffer.append(System.lineSeparator()); + buffer.append("NFType:"); + buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + buffer.append(System.lineSeparator()); + + } + } + List cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CVFC); for(NodeTemplate cvfcTemplate : cvfcList) { @@ -523,6 +581,7 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); } + List groupList = toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(crNode, "org.openecomp.groups.NetworkCollection"); diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index 5f78c85c98..aef33c3aed 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -801,38 +801,62 @@ UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = l CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization ( - `ID` INT(11) NOT NULL AUTO_INCREMENT, - `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, - `CONFIGURATION_TYPE` VARCHAR(200) NULL, - `CONFIGURATION_ROLE` VARCHAR(200) NULL, - `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, - `POLICY_NAME` VARCHAR(200) NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, - PRIMARY KEY (`ID`), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), - UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), - CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) - REFERENCES `configuration` (`MODEL_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1; + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) NULL, + `CONFIGURATION_ROLE` VARCHAR(200) NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, + `POLICY_NAME` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `CVNFC_CUSTOMIZATION_ID` INT(11) DEFAULT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), + + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1; + +CREATE TABLE IF NOT EXISTS `pnf_resource` ( + `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT', + `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; --------START Request DB SCHEMA -------- CREATE DATABASE requestdb; USE requestdb; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 36a6bf37d9..88ed5d37d9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -146,7 +146,7 @@ public class BBInputSetupUtils { } public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String vnfCustomizationUuid, - String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) { + String vfModuleCustomizationUuid, String cvnfcCustomizationUuid){ return catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfCustomizationUuid, vfModuleCustomizationUuid, cvnfcCustomizationUuid); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 482957e006..242f125bde 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -375,38 +375,23 @@ public class WorkflowActionBBTasks { List vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC); for(Vnfc vnfc : vnfcs) { String modelCustomizationId = vnfc.getModelCustomizationId(); - List cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID); - CvnfcCustomization cvnfcCustomization = null; - for(CvnfcCustomization cvnfc : cvnfcCustomizations) { - if(cvnfc.getModelCustomizationUUID().equalsIgnoreCase(modelCustomizationId)) { - cvnfcCustomization = cvnfc; - } - } - if(cvnfcCustomization != null) { - VnfVfmoduleCvnfcConfigurationCustomization fabricConfig = null; - for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfcCustomization.getVnfVfmoduleCvnfcConfigurationCustomization()){ - if(customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)){ - if(fabricConfig == null) { - fabricConfig = customization; - } else { - throw new Exception("Multiple Fabric configs found for this vnfc"); - } - } - } - if(fabricConfig != null) { - String configurationId = UUID.randomUUID().toString(); - ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); - configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId); - configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID); - configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID); - configurationResourceKeys.setVnfcName(vnfc.getVnfcName()); - ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys); - ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys); - flowsToExecute.add(assignConfigBB); - flowsToExecute.add(activateConfigBB); - execution.setVariable("flowsToExecute", flowsToExecute); - execution.setVariable("completed", false); - } + VnfVfmoduleCvnfcConfigurationCustomization fabricConfig = + catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfCustomizationUUID, vfModuleCustomizationUUID, modelCustomizationId); + if(fabricConfig != null && fabricConfig.getConfigurationResource() != null + && fabricConfig.getConfigurationResource().getToscaNodeType() != null + && fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) { + String configurationId = UUID.randomUUID().toString(); + ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); + configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId); + configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID); + configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID); + configurationResourceKeys.setVnfcName(vnfc.getVnfcName()); + ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys); + ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys); + flowsToExecute.add(assignConfigBB); + flowsToExecute.add(activateConfigBB); + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("completed", false); } else { logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml index 4da57a15f9..5e6b88c039 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml @@ -38,4 +38,4 @@ - \ No newline at end of file + diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql index fddd7adbf4..e46996181e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql @@ -776,61 +776,105 @@ AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; CREATE TABLE IF NOT EXISTS cvnfc_customization ( -`ID` INT(11) NOT NULL AUTO_INCREMENT, -`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, -`MODEL_UUID` VARCHAR(200) NOT NULL, -`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, -`MODEL_VERSION` VARCHAR(20) NOT NULL, -`MODEL_NAME` VARCHAR(200) NOT NULL, -`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, -`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, -`NFC_FUNCTION` VARCHAR(200) NULL, -`NFC_NAMING_CODE` VARCHAR(200) NULL, -`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `MODEL_UUID` VARCHAR(200) NOT NULL, + `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, + `MODEL_VERSION` VARCHAR(20) NOT NULL, + `MODEL_NAME` VARCHAR(200) NOT NULL, + `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, + `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, + `NFC_FUNCTION` VARCHAR(200) NULL, + `NFC_NAMING_CODE` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_cvnfc_customization__vf_module_customization1_idx` ( + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnfc_customization1_idx` ( + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + UNIQUE INDEX `UK_cvnfc_customization` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, + `MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), + CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY ( + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY ( + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization ( - `ID` INT(11) NOT NULL AUTO_INCREMENT, - `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, - `CONFIGURATION_TYPE` VARCHAR(200) NULL, - `CONFIGURATION_ROLE` VARCHAR(200) NULL, - `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, - `POLICY_NAME` VARCHAR(200) NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, - PRIMARY KEY (`ID`), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), - UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), - CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) - REFERENCES `configuration` (`MODEL_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1; + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) NULL, + `CONFIGURATION_ROLE` VARCHAR(200) NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, + `POLICY_NAME` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `CVNFC_CUSTOMIZATION_ID` INT(11) DEFAULT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), + + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1; + +CREATE TABLE IF NOT EXISTS `pnf_resource` ( + `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT', + `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; --------START Request DB SCHEMA -------- CREATE DATABASE requestdb; USE requestdb; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java index b1ad0de5ca..9f081ccd34 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java @@ -121,7 +121,7 @@ public class CvnfcCustomization implements Serializable { @Override public int hashCode() { - return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + return new HashCodeBuilder().append(modelCustomizationUUID).append(vfModuleCustomization).append(vnfcCustomization).append(vnfResourceCustomization).toHashCode(); } @Override @@ -249,6 +249,7 @@ public class CvnfcCustomization implements Serializable { this.created = created; } + @LinkedResource public VfModuleCustomization getVfModuleCustomization() { return vfModuleCustomization; } @@ -257,6 +258,7 @@ public class CvnfcCustomization implements Serializable { this.vfModuleCustomization = vfModuleCustomization; } + @LinkedResource public VnfcCustomization getVnfcCustomization() { return vnfcCustomization; } @@ -265,6 +267,7 @@ public class CvnfcCustomization implements Serializable { this.vnfcCustomization = vnfcCustomization; } + @LinkedResource public VnfResourceCustomization getVnfResourceCustomization() { return vnfResourceCustomization; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java index 7ce657c5c7..e425ebbc64 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java @@ -31,6 +31,7 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; import javax.persistence.PrePersist; import javax.persistence.Table; @@ -74,7 +75,8 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable private String configurationFunction; @Column(name = "POLICY_NAME") - private String policyName; + private String policyName; + @Column(name = "CREATION_TIMESTAMP", updatable = false) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") @@ -87,7 +89,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable @BusinessKey @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) - @JoinColumn(name = "CVNFC_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID") + @JoinColumn(name = "CVNFC_CUSTOMIZATION_ID") private CvnfcCustomization cvnfcCustomization; @BusinessKey @@ -98,7 +100,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable @BusinessKey @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") - private VnfResourceCustomization vnfResourceCustomization; + private VnfResourceCustomization vnfResourceCustomization; @Override public boolean equals(final Object other) { @@ -222,6 +224,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable this.cvnfcCustomization = cvnfcCustomization; } + @LinkedResource public VfModuleCustomization getVfModuleCustomization() { return vfModuleCustomization; } @@ -230,6 +233,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable this.vfModuleCustomization = vfModuleCustomization; } + @LinkedResource public VnfResourceCustomization getVnfResourceCustomization() { return vnfResourceCustomization; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java index f73044747c..2faac31f2d 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -234,8 +234,6 @@ public class CatalogDbClient { private final Client controllerSelectionReferenceClient; - private final Client vnfVfmoduleCvnfcConfigurationCustomizationClient; - private final Client pnfResourceClient; private final Client pnfResourceCustomizationClient; @@ -365,7 +363,6 @@ public class CatalogDbClient { cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class); controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class); externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class); - vnfVfmoduleCvnfcConfigurationCustomizationClient = clientFactory.create(VnfVfmoduleCvnfcConfigurationCustomization.class); pnfResourceClient = clientFactory.create(PnfResource.class); pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class); } @@ -415,7 +412,6 @@ public class CatalogDbClient { cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class); controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class); externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class); - vnfVfmoduleCvnfcConfigurationCustomizationClient = clientFactory.create(VnfVfmoduleCvnfcConfigurationCustomization.class); pnfResourceClient = clientFactory.create(PnfResource.class); pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class); } @@ -801,12 +797,24 @@ public class CatalogDbClient { .queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString())); } - public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(String vnfCustomizationUuid, - String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) { - return this.getSingleResource(vnfVfmoduleCvnfcConfigurationCustomizationClient, getUri(UriBuilder - .fromUri(endpoint + "/vnfVfmoduleCvnfcConfigurationCustomization/search/findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization") - .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUuid) - .queryParam("VF_MODULE_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUuid) - .queryParam("CVNFC_MODEL_CUSTOMIZATION_UUID", cvnfcCustomizationUuid).build().toString())); + public CvnfcCustomization getCvnfcCustomizationByCustomizationUUID(String cvnfcCustomizationUuid){ + return this.getSingleResource(cvnfcCustomizationClient,getUri(UriBuilder + .fromUri(endpoint + "/cvnfcCustomization/search/findOneByModelCustomizationUUID").queryParam("modelCustomizationUuid", cvnfcCustomizationUuid) + .build().toString())); + } + + //fetch all VnfVfmoduleCvnfcConfigurationCustomization underneath a vnfc + //find the VnfVfmoduleCvnfcConfigurationCustomization that is related to our vnf and our vf-module, filter all others. + public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid( + String vnfCustomizationUuid, String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) { + CvnfcCustomization cvnfc = getCvnfcCustomizationByCustomizationUUID(cvnfcCustomizationUuid); + for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfModuleCvnfcCust: cvnfc.getVnfVfmoduleCvnfcConfigurationCustomization()){ + if(vnfVfModuleCvnfcCust.getVnfResourceCustomization().getModelCustomizationUUID().equals(vnfCustomizationUuid) && + vnfVfModuleCvnfcCust.getVfModuleCustomization().getModelCustomizationUUID().equals(vfModuleCustomizationUuid)){ + return vnfVfModuleCvnfcCust; + } + } + return null; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java index aad75a15be..8664c1e2bc 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java @@ -20,21 +20,11 @@ package org.onap.so.db.catalog.data.repository; -import java.util.List; - import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "vnfVfmoduleCvnfcConfigurationCustomization", path = "vnfVfmoduleCvnfcConfigurationCustomization") public interface VnfVfmoduleCvnfcConfigurationCustomizationRepository extends JpaRepository { - List findByModelCustomizationUUID(String modelCustomizationUUID); - - @Query(value = "SELECT * FROM vnf_vfmodule_cvnfc_configuration_customization WHERE VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID = ?1 AND VF_MODULE_MODEL_CUSTOMIZATION_UUID = ?2 AND CVNFC_MODEL_CUSTOMIZATION_UUID = ?3", nativeQuery = true) - VnfVfmoduleCvnfcConfigurationCustomization findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization ( - @Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomizationUuid, - @Param("VF_MODULE_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomizationUuid, - @Param("CVNFC_MODEL_CUSTOMIZATION_UUID") String cvnfcCustomizationUuid); + } \ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java index 8de5366ff3..4b6598427e 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java @@ -309,6 +309,8 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { Set vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet(); vnfVfmoduleCvnfcConfigurationCustomizationSet.add(vnfVfmoduleCvnfcConfigurationCustomization); cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet); + vfModuleCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet); + vnfResourceCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet); cvnfcCustomizationRepository.save(cvnfcCustomization); diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java deleted file mode 100644 index a953fc8a3c..0000000000 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.catalog.data.repository; - -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.onap.so.db.catalog.BaseTest; -import org.onap.so.db.catalog.beans.ConfigurationResource; -import org.onap.so.db.catalog.beans.CvnfcCustomization; -import org.onap.so.db.catalog.beans.VfModule; -import org.onap.so.db.catalog.beans.VfModuleCustomization; -import org.onap.so.db.catalog.beans.VnfResource; -import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; -import org.onap.so.db.catalog.beans.VnfcCustomization; -import org.onap.so.db.catalog.exceptions.NoEntityFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; - -public class VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest extends BaseTest { - @Autowired - private VnfVfmoduleCvnfcConfigurationCustomizationRepository vnfVfmoduleCvnfcConfigurationCustomizationRepository; - @Autowired - private CvnfcCustomizationRepository cvnfcCustomizationRepository; - - @Test - public void findAllTest() throws Exception { - List vnfVfmoduleCvnfcConfigurationCustomizationList = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findAll(); - Assert.assertFalse(CollectionUtils.isEmpty(vnfVfmoduleCvnfcConfigurationCustomizationList)); - - VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = - vnfVfmoduleCvnfcConfigurationCustomizationRepository.findById(1).orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation")); - - - Assert.assertTrue(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equalsIgnoreCase("testConfigurationFunction")); - } - - @Test - @Transactional - public void createAndGetTest() throws Exception { - - VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization(); - vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); - vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("testModelInstanceName"); - vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationType("testConfigurationType"); - vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationRole("testConfigurationRole"); - vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("testConfigurationFunction"); - vnfVfmoduleCvnfcConfigurationCustomization.setPolicyName("testPolicyName"); - - ConfigurationResource configurationResource = new ConfigurationResource(); - configurationResource.setModelUUID("98b42780-9f13-11e8-98d0-529269fb1459"); - configurationResource.setModelInvariantUUID("c9338d1a-9f13-11e8-98d0-529269fb1459"); - configurationResource.setModelVersion("testModelVertsion"); - configurationResource.setModelName("testModelName"); - configurationResource.setToscaNodeType("testToscaNodeType"); - configurationResource.setDescription("testConfigurationDescription"); - vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource); - - CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization(); - cvnfcCustomization.setModelCustomizationUUID("0c3a8b76-3f5b-11e9-b210-d663bd873d93"); - - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); - - VfModule vFModule = setUpVfModule(); - VnfResource vnfResource = setUpVnfResource(); - - vFModule.setVnfResources(vnfResource); - vfModuleCustomization.setVfModule(vFModule); - cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); - - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); - vnfResourceCustomization.setModelInstanceName("testModelInstanceName"); - - List vnfResourceCustomizations = new ArrayList(); - vnfResourceCustomizations.add(vnfResourceCustomization); - vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); - vnfResourceCustomization.setVnfResources(vnfResource); - - cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization); - - VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); - vnfcCustomization.setModelCustomizationUUID("0aa015ea-9ff3-11e8-98d0-529269fb1459"); - cvnfcCustomization.setVnfcCustomization(vnfcCustomization); - - cvnfcCustomizationRepository.save(cvnfcCustomization); - - vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization); - vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(vfModuleCustomization); - vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(vnfResourceCustomization); - - vnfVfmoduleCvnfcConfigurationCustomizationRepository.save(vnfVfmoduleCvnfcConfigurationCustomization); - - VnfVfmoduleCvnfcConfigurationCustomization foundVnfVfmoduleCvnfcConfigurationCustomization = - vnfVfmoduleCvnfcConfigurationCustomizationRepository.findById(1).orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation")); - - - if(foundVnfVfmoduleCvnfcConfigurationCustomization == null) - fail("should not be null"); - - VnfVfmoduleCvnfcConfigurationCustomization foundOneVnfVfmoduleCvnfcConfigurationCustomization = - vnfVfmoduleCvnfcConfigurationCustomizationRepository.findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization("cf9f6efc-9f14-11e8-98d0-529269fb1459", "cf9f6efc-9f14-11e8-98d0-529269fb1459", "0c3a8b76-3f5b-11e9-b210-d663bd873d93"); - - if(foundOneVnfVfmoduleCvnfcConfigurationCustomization == null) - fail("should not be null"); - Assert.assertTrue(foundOneVnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equalsIgnoreCase("testConfigurationFunction")); - } -} \ No newline at end of file diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql index a59137d023..ffd126545d 100644 --- a/mso-catalog-db/src/test/resources/data.sql +++ b/mso-catalog-db/src/test/resources/data.sql @@ -736,9 +736,7 @@ VALUES ( '1', INSERT INTO vnf_vfmodule_cvnfc_configuration_customization (id, model_customization_uuid, - vnf_resource_cust_model_customization_uuid, - vf_module_model_customization_uuid, - cvnfc_model_customization_uuid, + CVNFC_CUSTOMIZATION_ID, model_instance_name, configuration_type, configuration_role, @@ -748,9 +746,7 @@ INSERT INTO vnf_vfmodule_cvnfc_configuration_customization configuration_model_uuid) VALUES ( '1', '7bcce658-9b37-11e8-98d0-529269fb1450', - '68dc9a92-214c-11e7-93ae-92361f002671', - 'cb82ffd8-252a-11e7-93ae-92361f002671', - '9bcce658-9b37-11e8-98d0-529269fb1459', + '1', 'testModelInstanceName', 'testConfigurationType', 'testConfigurationRole', diff --git a/mso-catalog-db/src/test/resources/logback-test.xml b/mso-catalog-db/src/test/resources/logback-test.xml index 0bf39bdad1..68e4fcf64d 100644 --- a/mso-catalog-db/src/test/resources/logback-test.xml +++ b/mso-catalog-db/src/test/resources/logback-test.xml @@ -39,9 +39,14 @@ - + + + + + + diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql index 6bd9baee80..d53d8925e2 100644 --- a/mso-catalog-db/src/test/resources/schema.sql +++ b/mso-catalog-db/src/test/resources/schema.sql @@ -893,61 +893,67 @@ AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; CREATE TABLE IF NOT EXISTS cvnfc_customization ( -`ID` INT(11) NOT NULL AUTO_INCREMENT, -`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, -`MODEL_UUID` VARCHAR(200) NOT NULL, -`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, -`MODEL_VERSION` VARCHAR(20) NOT NULL, -`MODEL_NAME` VARCHAR(200) NOT NULL, -`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, -`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, -`NFC_FUNCTION` VARCHAR(200) NULL, -`NFC_NAMING_CODE` VARCHAR(200) NULL, -`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; - + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `MODEL_UUID` VARCHAR(200) NOT NULL, + `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, + `MODEL_VERSION` VARCHAR(20) NOT NULL, + `MODEL_NAME` VARCHAR(200) NOT NULL, + `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, + `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, + `NFC_FUNCTION` VARCHAR(200) NULL, + `NFC_NAMING_CODE` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_cvnfc_customization__vf_module_customization1_idx` ( + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnfc_customization1_idx` ( + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + UNIQUE INDEX `UK_cvnfc_customization` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, + `MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), + CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY ( + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY ( + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization ( - `ID` INT(11) NOT NULL AUTO_INCREMENT, - `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, - `CONFIGURATION_TYPE` VARCHAR(200) NULL, - `CONFIGURATION_ROLE` VARCHAR(200) NULL, - `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, - `POLICY_NAME` VARCHAR(200) NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, - PRIMARY KEY (`ID`), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), - UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), - CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) - REFERENCES `configuration` (`MODEL_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1; + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) NULL, + `CONFIGURATION_ROLE` VARCHAR(200) NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, + `POLICY_NAME` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `CVNFC_CUSTOMIZATION_ID` INT(11) DEFAULT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), + + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1; CREATE TABLE IF NOT EXISTS `pnf_resource` ( `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT', -- 2.16.6