aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-11 21:14:32 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-11 21:14:46 -0500
commita85dc14805068ac6ab6eab7efd5d10459ee3ebc2 (patch)
tree534d0ff4078ec82b21e4fe21c639722ebf4ac1a0 /asdc-controller
parentde5958dddd97b086ec8b603974f434fd814386ac (diff)
Service Proxy Consolidation
- Updated ServiceProxyResourceCustomization to remove the ID column - Removed setConfigurationResourceCustomization from serviceProxyResource since that relationship doesn't exist anymore - Updated ServiceProxy resource to remove the object dependencies between ServiceProxyCustomization and ConfigurationResourceCustomization - Removed the delete statement since this is causing the test to fail because the service table doesn't exist yet - Updated configuration_customization to drop the serviceProxyCustomization FK - Added migration script to consolidate the ServiceProxy and ServiceProxyCustomization into a single table and migrate the data. - Code changes to support consolidating the ServiceProxy and ServiceProxyCustomization table into a single table Change-Id: I1e49cb22c8b667f157dd1c349b5e36fd06236630 Issue-ID: SO-1380 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'asdc-controller')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java13
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java45
-rw-r--r--asdc-controller/src/test/resources/schema.sql63
3 files changed, 43 insertions, 78 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
index 72aa3c7f5b..179dac3c35 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
@@ -42,7 +42,6 @@ import org.onap.so.db.catalog.beans.NetworkInstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.ServiceProxyResource;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup;
import org.onap.so.db.catalog.beans.ToscaCsar;
@@ -83,9 +82,7 @@ public class ToscaResourceStructure {
private CollectionResourceCustomization catalogCollectionResourceCustomization;
private NetworkCollectionResourceCustomization catalogNetworkCollectionResourceCustomization;
-
- private ServiceProxyResource catalogServiceProxyResource;
-
+
private ServiceProxyResourceCustomization catalogServiceProxyResourceCustomization;
private ConfigurationResource catalogConfigurationResource;
@@ -443,14 +440,6 @@ public class ToscaResourceStructure {
this.catalogNetworkCollectionResourceCustomization = catalogNetworkCollectionResourceCustomization;
}
- public ServiceProxyResource getCatalogServiceProxyResource() {
- return catalogServiceProxyResource;
- }
-
- public void setCatalogServiceProxyResource(ServiceProxyResource catalogServiceProxyResource) {
- this.catalogServiceProxyResource = catalogServiceProxyResource;
- }
-
public ServiceProxyResourceCustomization getCatalogServiceProxyResourceCustomization() {
return catalogServiceProxyResourceCustomization;
}
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 bde43b0845..722e1599b6 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
@@ -73,7 +73,6 @@ import org.onap.so.db.catalog.beans.NetworkInstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.ServiceProxyResource;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.SubType;
import org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup;
@@ -99,7 +98,6 @@ import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceProxyResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.ServiceProxyResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository;
import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
@@ -147,10 +145,7 @@ public class ToscaResourceInstaller {
@Autowired
protected ServiceProxyResourceCustomizationRepository serviceProxyCustomizationRepo;
-
- @Autowired
- protected ServiceProxyResourceRepository serviceProxyRepo;
-
+
@Autowired
protected CollectionResourceRepository collectionRepo;
@@ -401,7 +396,7 @@ public class ToscaResourceInstaller {
for (NodeTemplate spNode : serviceProxyResourceList) {
serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct);
- ServiceProxyResource serviceProxyResource = findExistingServiceProxyResource(serviceProxyList, serviceProxy.getServiceProxyResource().getModelUUID());
+ ServiceProxyResourceCustomization serviceProxyResource = findExistingServiceProxyResource(serviceProxyList, serviceProxy.getModelCustomizationUUID());
if(serviceProxyResource == null){
@@ -751,28 +746,22 @@ public class ToscaResourceInstaller {
Metadata spMetadata = nodeTemplate.getMetaData();
- ServiceProxyResource spResource = new ServiceProxyResource();
-
- spResource.setModelName(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- spResource.setModelInvariantUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- spResource.setModelUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- spResource.setModelVersion(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- spResource.setDescription(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
-
ServiceProxyResourceCustomization spCustomizationResource = new ServiceProxyResourceCustomization();
Set<ServiceProxyResourceCustomization> serviceProxyCustomizationSet = new HashSet<>();
+ spCustomizationResource.setModelName(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ spCustomizationResource.setModelInvariantUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ spCustomizationResource.setModelUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ spCustomizationResource.setModelVersion(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ spCustomizationResource.setDescription(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+
spCustomizationResource.setModelCustomizationUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
spCustomizationResource.setModelInstanceName(nodeTemplate.getName());
spCustomizationResource.setToscaNodeType(nodeTemplate.getType());
spCustomizationResource.setSourceService(service);
- spCustomizationResource.setServiceProxyResource(spResource);
spCustomizationResource.setToscaNodeType(nodeTemplate.getType());
- spCustomizationResource.setServiceProxyResource(spResource);
serviceProxyCustomizationSet.add(spCustomizationResource);
-
- toscaResourceStructure.setCatalogServiceProxyResource(spResource);
toscaResourceStructure.setCatalogServiceProxyResourceCustomization(spCustomizationResource);
@@ -802,7 +791,7 @@ public class ToscaResourceInstaller {
configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
- configCustomizationResource.setServiceProxyResourceCustomization(spResourceCustomization);
+ configCustomizationResource.setServiceProxyResourceCustomizationUUID(spResourceCustomization.getModelCustomizationUUID());
configCustomizationResource.setConfigResourceCustomization(configCustomizationResource);
configCustomizationResource.setConfigurationResource(configResource);
configResourceCustomizationSet.add(configCustomizationResource);
@@ -1388,18 +1377,18 @@ public class ToscaResourceInstaller {
return configResource;
}
- protected ServiceProxyResource findExistingServiceProxyResource(List<ServiceProxyResourceCustomization> serviceProxyList, String modelUUID) {
- ServiceProxyResource serviceProxyResource = null;
+ protected ServiceProxyResourceCustomization findExistingServiceProxyResource(List<ServiceProxyResourceCustomization> serviceProxyList, String modelCustomizationUUID) {
+ ServiceProxyResourceCustomization serviceProxyResourceCustomization = null;
for(ServiceProxyResourceCustomization serviceProxyResourceCustom : serviceProxyList){
- if (serviceProxyResourceCustom.getServiceProxyResource() != null
- && serviceProxyResourceCustom.getServiceProxyResource().getModelUUID().equals(modelUUID)) {
- serviceProxyResource = serviceProxyResourceCustom.getServiceProxyResource();
+ if (serviceProxyResourceCustom != null
+ && serviceProxyResourceCustom.getModelCustomizationUUID().equals(modelCustomizationUUID)) {
+ serviceProxyResourceCustomization = serviceProxyResourceCustom;
}
}
- if(serviceProxyResource==null)
- serviceProxyResource = serviceProxyRepo.findResourceByModelUUID(modelUUID);
+ if(serviceProxyResourceCustomization==null)
+ serviceProxyResourceCustomization = serviceProxyCustomizationRepo.findResourceByModelCustomizationUUID(modelCustomizationUUID);
- return serviceProxyResource;
+ return serviceProxyResourceCustomization;
}
protected VfModuleCustomization findExistingVfModuleCustomization(VnfResourceCustomization vnfResource,
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index a84b02db63..b17fb5d47c 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -517,36 +517,29 @@ default character set = latin1;
engine = innodb auto_increment = 20654
default character set = latin1;
- create table if not exists `service_proxy` (
- `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,
- `description` varchar(1200) null,
- `creation_timestamp` datetime not null default current_timestamp,
- primary key (`model_uuid`))
- engine = innodb auto_increment = 20654
- default character set = latin1;
-
-create table if not exists `service_proxy_customization` (
-`model_customization_uuid` varchar(200) not null,
-`model_instance_name` varchar(200) not null,
-`tosca_node_type` varchar(200) not null,
-`source_service_model_uuid` varchar(200) not null,
-`creation_timestamp` datetime not null default current_timestamp,
-`service_proxy_model_uuid` varchar(200) not null,
-primary key (`model_customization_uuid`),
-index `fk_service_proxy_customization__service_proxy1_idx` (`service_proxy_model_uuid` asc),
-index `fk_service_proxy_customization__service1_idx` (`source_service_model_uuid` asc),
-constraint`fk_spr_customization__service_proxy_resource1`
-foreign key (`service_proxy_model_uuid`) references `service_proxy` (`model_uuid`)
-on delete cascade on update cascade,
-constraint `fk_service_proxy_resource_customization__service1`
-foreign key (`source_service_model_uuid`) references `service`
-(`model_uuid`) on delete cascade on update cascade)
-engine = innodb
-auto_increment = 20654
-default character set = latin1;
+CREATE TABLE IF NOT EXISTS `service_proxy_customization` (
+ `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,
+ `SOURCE_SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
+ INDEX `fk_service_proxy_customization__service1_idx` (`SOURCE_SERVICE_MODEL_UUID` ASC),
+ UNIQUE INDEX `UK_service_proxy_customization` (`MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_service_proxy_customization__serv_prox_to_serv` (`MODEL_CUSTOMIZATION_UUID` ASC),
+ CONSTRAINT `fk_service_proxy_resource_customization__service1`
+ FOREIGN KEY (`SOURCE_SERVICE_MODEL_UUID`)
+ REFERENCES `service` (`MODEL_UUID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+AUTO_INCREMENT = 20654
+DEFAULT CHARACTER SET = latin1;
create table if not exists `configuration_customization` (
`model_customization_uuid` varchar(200) not null,
@@ -560,19 +553,13 @@ create table if not exists `configuration_customization` (
`configuration_customization_model_customization_uuid` varchar(200) null,
primary key (`model_customization_uuid`),
index `fk_configuration_customization__configuration_idx` (`configuration_model_uuid` asc),
-index `fk_configuration_customization__service_proxy_customization_idx`
-(`service_proxy_customization_model_customization_uuid` asc),
index `fk_configuration_customization__configuration_customization_idx`
(`configuration_customization_model_customization_uuid` asc),
constraint `fk_configuration_resource_customization__configuration_resour1`
foreign key (`configuration_model_uuid`) references `configuration` (`model_uuid`)
on delete cascade on update cascade,
-constraint `fk_configuration_customization__service_proxy_customization1` foreign
-key (`service_proxy_customization_model_customization_uuid`) references
-`service_proxy_customization` (`model_customization_uuid`)
-on delete cascade on update cascade, constraint
-`fk_configuration_customization__configuration_customization1` foreign
-key (`configuration_customization_model_customization_uuid`) references
+constraint `fk_configuration_customization__configuration_customization1`
+foreign key (`configuration_customization_model_customization_uuid`) references
`configuration_customization` (`model_customization_uuid`)
on delete cascade on update cascade)
engine = innodb