diff options
author | 2021-03-26 09:57:35 -0400 | |
---|---|---|
committer | 2021-03-26 09:57:35 -0400 | |
commit | 3e68599d1433c0200d20332c6bda3b2cfcf2dd93 (patch) | |
tree | a4b78bf4ae416e41215751d8e6ab2cfc36e33064 /ms/generic-resource-api/src/main | |
parent | 32bcdd700561be5457bbc0658fc27a87e1419f36 (diff) |
Refactor CRUD to new table structure
Refactor operations on config tree to use new table structure
for service/network/vnf/vf-module data.
Change-Id: I2e673dfb7bd335e48a3bcf212399d021d37dd9ee
Issue-ID: SDNC-1481
Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'ms/generic-resource-api/src/main')
10 files changed, 886 insertions, 3580 deletions
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java index 2cef1a0..7508eb8 100644 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java @@ -20,24 +20,61 @@ package org.onap.sdnc.apps.ms.gra.controllers; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; + import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; + import org.onap.ccsdk.apps.services.RestApplicationException; import org.onap.ccsdk.apps.services.RestException; -import org.onap.ccsdk.apps.services.RestProtocolError; import org.onap.ccsdk.apps.services.RestProtocolException; +import org.onap.sdnc.apps.ms.gra.controllers.ServiceDataHelper.ServiceDataTransaction; +import org.onap.sdnc.apps.ms.gra.data.ConfigContrailRouteAllottedResources; +import org.onap.sdnc.apps.ms.gra.data.ConfigContrailRouteAllottedResourcesRepository; +import org.onap.sdnc.apps.ms.gra.data.ConfigNetworksRepository; +import org.onap.sdnc.apps.ms.gra.data.ConfigPortMirrorConfigurations; +import org.onap.sdnc.apps.ms.gra.data.ConfigPortMirrorConfigurationsRepository; import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadData; import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository; import org.onap.sdnc.apps.ms.gra.data.ConfigServices; import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository; -import org.onap.sdnc.apps.ms.gra.data.ConfigPortMirrorConfigurations; -import org.onap.sdnc.apps.ms.gra.data.ConfigPortMirrorConfigurationsRepository; -import org.onap.sdnc.apps.ms.gra.data.ConfigContrailRouteAllottedResources; -import org.onap.sdnc.apps.ms.gra.data.ConfigContrailRouteAllottedResourcesRepository; +import org.onap.sdnc.apps.ms.gra.data.ConfigVfModules; +import org.onap.sdnc.apps.ms.gra.data.ConfigVfModulesRepository; +import org.onap.sdnc.apps.ms.gra.data.ConfigVnfsRepository; import org.onap.sdnc.apps.ms.gra.swagger.ConfigApi; -import org.onap.sdnc.apps.ms.gra.swagger.model.*; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiContrailrouteallottedresourcesContrailRouteAllottedResource; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiContrailrouteallottedresourcesContrailrouteallottedresourceAllottedResourceData; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiContrailroutetopologyContrailRouteTopology; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiOnapmodelinformationOnapModelInformation; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiOperStatusData; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiPortmirrorconfigurationsPortMirrorConfiguration; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiPortmirrorconfigurationsPortmirrorconfigurationConfigurationData; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiPortmirrorconfigurationtopologyPortMirrorConfigurationTopology; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiPreloadModelInformation; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiPreloaddataPreloadData; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiPreloadmodelinformationPreloadList; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiPreloadnetworktopologyinformationPreloadNetworkTopologyInformation; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServiceModelInfrastructure; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServiceData; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnf; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnfVnfData; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicemodelinfrastructureService; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicestatusServiceStatus; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicetopologyServiceTopology; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiVfmoduletopologyVfModuleTopology; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiVnfNetworkData; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiVnfresourceassignmentsVnfResourceAssignments; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiVnftopologyVnfTopology; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -47,17 +84,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; -import javax.servlet.http.HttpServletRequest; -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Collectors; -import java.util.stream.Stream; - @Controller @ComponentScan(basePackages = { "org.onap.sdnc.apps.ms.gra.*" }) @EntityScan("org.onap.sdnc.apps.ms.gra.springboot.*") @@ -75,11 +101,22 @@ public class ConfigApiController implements ConfigApi { private ConfigServicesRepository configServicesRepository; @Autowired + private ConfigNetworksRepository configNetworksRepository; + + @Autowired + private ConfigVnfsRepository configVnfsRepository; + + @Autowired + private ConfigVfModulesRepository configVfModulesRepository; + + @Autowired private ConfigPortMirrorConfigurationsRepository configPortMirrorConfigurationsRepository; @Autowired private ConfigContrailRouteAllottedResourcesRepository configContrailRouteAllottedResourcesRepository; - + + @Autowired + private ServiceDataHelper serviceDataHelper; @Autowired public ConfigApiController(ObjectMapper objectMapper, HttpServletRequest request) { @@ -667,8 +704,7 @@ public class ConfigApiController implements ConfigApi { public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypePreloadDataPost( String preloadId, String preloadType, @Valid GenericResourceApiPreloaddataPreloadData preloadData) throws RestApplicationException, RestProtocolException { - List<ConfigPreloadData> preloadDataEntries = configPreloadDataRepository - .findByPreloadIdAndPreloadType(preloadId, preloadType); + List<ConfigPreloadData> preloadDataItems = configPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType); @@ -743,6 +779,9 @@ public class ConfigApiController implements ConfigApi { @Override public ResponseEntity<Void> configGENERICRESOURCEAPIservicesDelete() { + configVfModulesRepository.deleteAll(); + configVnfsRepository.deleteAll(); + configNetworksRepository.deleteAll(); configServicesRepository.deleteAll(); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @@ -760,20 +799,26 @@ public class ConfigApiController implements ConfigApi { for (ConfigServices service : configServicesRepository.findAll()) { GenericResourceApiServicemodelinfrastructureService serviceItem = new GenericResourceApiServicemodelinfrastructureService(); - serviceItem.setServiceInstanceId(service.getSvcInstanceId()); - if (service.getSvcData() != null) { - try { - serviceItem.setServiceData(objectMapper.readValue(service.getSvcData(), - GenericResourceApiServicedataServiceData.class)); - } catch (JsonProcessingException e) { - log.error("Could not deserialize service data for {}", service.getSvcInstanceId(), e); - throw new RestApplicationException("data-conversion", - "Request could not be completed due to internal error", e, - HttpStatus.INTERNAL_SERVER_ERROR.value()); + String svcInstanceId = service.getSvcInstanceId(); - } - } + serviceItem.setServiceInstanceId(svcInstanceId); serviceItem.setServiceStatus(service.getServiceStatus()); + + // Construct service data from networks/vnfs/vfModules + GenericResourceApiServicedataServiceData serviceItemSvcData; + try { + serviceItemSvcData = serviceDataHelper.getServiceData(service); + } catch (JsonProcessingException e) { + log.error("Could not deserialize service data for {}", service.getSvcInstanceId(), e); + throw new RestApplicationException("data-conversion", + "Request could not be completed due to internal error", e, + HttpStatus.INTERNAL_SERVER_ERROR.value()); + } + + + if (serviceItemSvcData != null) { + serviceItem.setServiceData(serviceItemSvcData); + } modelInfrastructure.addServiceItem(serviceItem); } @@ -782,10 +827,10 @@ public class ConfigApiController implements ConfigApi { } @Override - public ResponseEntity<Void> configGENERICRESOURCEAPIservicesPost( - @Valid GenericResourceApiServiceModelInfrastructure modelInfrastructure) + public ResponseEntity<Void> configGENERICRESOURCEAPIservicesPost(@Valid GenericResourceApiServiceModelInfrastructure modelInfrastructure) throws RestApplicationException, RestProtocolException { - List<ConfigServices> newServices = new LinkedList<>(); + + ServiceDataTransaction transaction = serviceDataHelper.createTransaction(); for (GenericResourceApiServicemodelinfrastructureService serviceItem : modelInfrastructure.getService()) { String svcInstanceId = serviceItem.getServiceInstanceId(); @@ -797,8 +842,10 @@ public class ConfigApiController implements ConfigApi { } ConfigServices service = new ConfigServices(); service.setSvcInstanceId(svcInstanceId); + service.setServiceStatus(serviceItem.getServiceStatus()); + try { - service.setSvcData(objectMapper.writeValueAsString(serviceItem.getServiceData())); + serviceDataHelper.saveService(service, serviceItem.getServiceData(), transaction); } catch (JsonProcessingException e) { log.error("Could not serialize service data for {}", service.getSvcInstanceId(), e); throw new RestApplicationException("data-conversion", @@ -806,13 +853,9 @@ public class ConfigApiController implements ConfigApi { HttpStatus.INTERNAL_SERVER_ERROR.value()); } - service.setServiceStatus(serviceItem.getServiceStatus()); - newServices.add(service); } - for (ConfigServices service : newServices) { - configServicesRepository.save(service); - } + transaction.commit(); return new ResponseEntity<>(HttpStatus.CREATED); @@ -822,7 +865,7 @@ public class ConfigApiController implements ConfigApi { public ResponseEntity<Void> configGENERICRESOURCEAPIservicesPut( @Valid GenericResourceApiServiceModelInfrastructure modelInfrastructure) throws RestApplicationException { - List<ConfigServices> newServices = new LinkedList<>(); + ServiceDataTransaction transaction = serviceDataHelper.createTransaction(); boolean dataExists = false; for (GenericResourceApiServicemodelinfrastructureService serviceItem : modelInfrastructure.getService()) { @@ -833,8 +876,9 @@ public class ConfigApiController implements ConfigApi { } ConfigServices service = new ConfigServices(); service.setSvcInstanceId(svcInstanceId); + service.setServiceStatus(serviceItem.getServiceStatus()); try { - service.setSvcData(objectMapper.writeValueAsString(serviceItem.getServiceData())); + serviceDataHelper.saveService(service, serviceItem.getServiceData(), transaction); } catch (JsonProcessingException e) { log.error("Could not serialize service data for {}", service.getSvcInstanceId(), e); throw new RestApplicationException("data-conversion", @@ -842,13 +886,9 @@ public class ConfigApiController implements ConfigApi { HttpStatus.INTERNAL_SERVER_ERROR.value()); } - service.setServiceStatus(serviceItem.getServiceStatus()); - newServices.add(service); } - for (ConfigServices service : newServices) { - configServicesRepository.save(service); - } + transaction.commit(); if (dataExists) { return new ResponseEntity<>(HttpStatus.NO_CONTENT); @@ -863,10 +903,8 @@ public class ConfigApiController implements ConfigApi { @Valid GenericResourceApiServicemodelinfrastructureService servicesData) throws RestApplicationException { String svcInstanceId = servicesData.getServiceInstanceId(); try { - String svcData = objectMapper.writeValueAsString(servicesData.getServiceData()); - ConfigServices configService = new ConfigServices(svcInstanceId, svcData, servicesData.getServiceStatus()); - configServicesRepository.deleteBySvcInstanceId(svcInstanceId); - configServicesRepository.save(configService); + ConfigServices configService = new ConfigServices(svcInstanceId, servicesData.getServiceStatus()); + serviceDataHelper.saveService(configService, servicesData.getServiceData()); } catch (JsonProcessingException e) { log.error("Cannot convert service data", e); throw new RestApplicationException("data-conversion", @@ -880,7 +918,7 @@ public class ConfigApiController implements ConfigApi { @Override public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdDelete( String serviceInstanceId) { - configServicesRepository.deleteBySvcInstanceId(serviceInstanceId); + serviceDataHelper.deleteService(serviceInstanceId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @@ -899,8 +937,7 @@ public class ConfigApiController implements ConfigApi { retval.setServiceInstanceId(serviceInstanceId); retval.setServiceStatus(service.getServiceStatus()); try { - retval.setServiceData( - objectMapper.readValue(service.getSvcData(), GenericResourceApiServicedataServiceData.class)); + retval.setServiceData(serviceDataHelper.getServiceData(service)); } catch (JsonProcessingException e) { log.error("Could not deserialize service data for service instance id {}", serviceInstanceId, e); throw new RestApplicationException("data-conversion", @@ -927,8 +964,9 @@ public class ConfigApiController implements ConfigApi { } ConfigServices service = new ConfigServices(); service.setSvcInstanceId(svcInstanceId); + service.setServiceStatus(newService.getServiceStatus()); try { - service.setSvcData(objectMapper.writeValueAsString(newService.getServiceData())); + serviceDataHelper.saveService(service, newService.getServiceData()); } catch (JsonProcessingException e) { log.error("Could not serialize service data for {}", service.getSvcInstanceId(), e); throw new RestApplicationException("data-conversion", @@ -936,8 +974,6 @@ public class ConfigApiController implements ConfigApi { HttpStatus.INTERNAL_SERVER_ERROR.value()); } - service.setServiceStatus(newService.getServiceStatus()); - configServicesRepository.save(service); return new ResponseEntity<>(HttpStatus.CREATED); } @@ -960,8 +996,9 @@ public class ConfigApiController implements ConfigApi { service.setSvcInstanceId(svcInstanceId); } + service.setServiceStatus(newService.getServiceStatus()); try { - service.setSvcData(objectMapper.writeValueAsString(newService.getServiceData())); + serviceDataHelper.saveService(service, newService.getServiceData()); } catch (JsonProcessingException e) { log.error("Could not serialize service data for {}", service.getSvcInstanceId(), e); throw new RestApplicationException("data-conversion", @@ -969,8 +1006,6 @@ public class ConfigApiController implements ConfigApi { HttpStatus.INTERNAL_SERVER_ERROR.value()); } - service.setServiceStatus(newService.getServiceStatus()); - configServicesRepository.save(service); if (dataExists) { return new ResponseEntity<>(HttpStatus.NO_CONTENT); @@ -989,11 +1024,10 @@ public class ConfigApiController implements ConfigApi { } ConfigServices service = services.get(0); - if (service.getSvcData() == null) { + if (!serviceDataHelper.hasServiceData(service)) { throw new RestProtocolException("data-missing", "No service-data found", HttpStatus.NOT_FOUND.value()); } - service.setSvcData(null); - configServicesRepository.save(service); + serviceDataHelper.clearServiceData(service); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @@ -1009,8 +1043,7 @@ public class ConfigApiController implements ConfigApi { } try { - serviceData = objectMapper.readValue(services.get(0).getSvcData(), - GenericResourceApiServicedataServiceData.class); + serviceData = serviceDataHelper.getServiceData(services.get(0)); return new ResponseEntity<>(serviceData, HttpStatus.OK); } catch (JsonProcessingException e) { log.error("Could not parse service data", e); @@ -1038,15 +1071,14 @@ public class ConfigApiController implements ConfigApi { } service = services.get(0); - if ((service.getSvcData() != null) && (service.getSvcData().length() > 0)) { + if (serviceDataHelper.hasServiceData(service)) { log.error("service-data already exists for svcInstanceId {}", serviceInstanceId); throw new RestProtocolException("data-exists", "Data already exists for " + serviceInstanceId, HttpStatus.CONFLICT.value()); } try { - service.setSvcData(objectMapper.writeValueAsString(serviceData)); - configServicesRepository.save(service); + serviceDataHelper.saveService(service, serviceData); } catch (JsonProcessingException e) { log.error("Could not serialize service data for svc instance id {}", serviceInstanceId, e); throw new RestApplicationException("data-conversion", @@ -1077,13 +1109,10 @@ public class ConfigApiController implements ConfigApi { } service = services.get(0); - if ((service.getSvcData() != null) && (service.getSvcData().length() > 0)) { - dataExists = true; - } + dataExists = serviceDataHelper.hasServiceData(service); try { - service.setSvcData(objectMapper.writeValueAsString(serviceData)); - configServicesRepository.save(service); + serviceDataHelper.saveService(service, serviceData); } catch (JsonProcessingException e) { log.error("Could not serialize service data for svc instance id {}", serviceInstanceId, e); throw new RestApplicationException("data-conversion", @@ -1217,17 +1246,6 @@ public class ConfigApiController implements ConfigApi { String serviceInstanceId, String vnfId) throws RestException { log.info("DELETE | VNF Data for ({})", vnfId); - /* - * The logic may need to be moved inside of this check or this check may need to - * be removed. - */ - if (getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - log.info("Something with header."); - } else { - log.warn( - "ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } - List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); ConfigServices data; if ((services == null) || (services.isEmpty())) { @@ -1239,49 +1257,18 @@ public class ConfigApiController implements ConfigApi { data = services.get(0); } - GenericResourceApiServicedataServiceData svcData; - try { - svcData = objectMapper.readValue(data.getSvcData(), GenericResourceApiServicedataServiceData.class); - } catch (JsonProcessingException e) { - // Or throw the data not found error? - log.error("Could not map service data for ({})", serviceInstanceId); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - if (svcData == null) { - // Or throw the data not found error? + if (!serviceDataHelper.hasServiceData(data)) { log.info("Could not find Service Data for ({}).", serviceInstanceId); throw new RestProtocolException("data-missing", "Service data not found.", HttpStatus.NOT_FOUND.value()); } - GenericResourceApiServicedataServicedataVnfs vnfs = svcData.getVnfs(); - if (vnfs == null) { - // Or throw the data not found error? - log.info("VNF List not found for ({}).", serviceInstanceId); - throw new RestProtocolException("data-missing", "VNFs not found.", HttpStatus.NOT_FOUND.value()); - } - - Stream<GenericResourceApiServicedataServicedataVnfsVnf> vnfStream = svcData.getVnfs().getVnf().stream(); - if (vnfStream.noneMatch(targetVnf -> targetVnf.getVnfId().equals(vnfId))) { + if (serviceDataHelper.deleteVnf(serviceInstanceId, vnfId) > 0) { + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } else { // Data was not found log.error("Did not find VNF ({}) in data.", vnfId); throw new RestProtocolException("data-missing", "VNF ID not found.", HttpStatus.NOT_FOUND.value()); } - // Recreate the stream per Sonar? - vnfStream = svcData.getVnfs().getVnf().stream(); - svcData.getVnfs().setVnf( - vnfStream.filter(targetVnf -> !targetVnf.getVnfId().equals(vnfId)).collect(Collectors.toList())); - - // Map and save the new data - try { - data.setSvcData(objectMapper.writeValueAsString(svcData)); - configServicesRepository.save(data); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } catch (JsonProcessingException e) { - log.error("Error mapping object to JSON", e); - // Should probably be a 500 INTERNAL_SERVICE_ERROR - throw new RestProtocolException("internal-service-error", "Failed to save data.", - HttpStatus.BAD_REQUEST.value()); - } } /** @@ -1299,21 +1286,24 @@ public class ConfigApiController implements ConfigApi { public ResponseEntity<GenericResourceApiServicedataServicedataVnfsVnf> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdGet( String serviceInstanceId, String vnfId) throws RestException { log.info("GET | VNF Data for ({})", vnfId); - if (getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - if (getAcceptHeader().get().contains("application/json")) { - } - } else { - log.warn( - "ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } + List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); if ((services == null) || (services.isEmpty())) { throw new RestProtocolException("data-missing", "No service entry found", HttpStatus.NOT_FOUND.value()); } - Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnf = getVnfObject(services.get(0), vnfId); - if (vnf.isPresent()) { - return new ResponseEntity<>(vnf.get(), HttpStatus.OK); + GenericResourceApiServicedataServicedataVnfsVnf vnf = null; + try { + vnf = serviceDataHelper.getVnf(serviceInstanceId, vnfId); + } catch (JsonProcessingException e) { + log.error("Could not parse service data", e); + throw new RestApplicationException("data-conversion", + "Request could not be completed due to internal error", e, + HttpStatus.INTERNAL_SERVER_ERROR.value()); + } + + if (vnf != null) { + return new ResponseEntity<>(vnf, HttpStatus.OK); } else { log.info("No information found for {}", vnfId); throw new RestApplicationException("data-missing", @@ -1323,30 +1313,6 @@ public class ConfigApiController implements ConfigApi { } /** - * Extracts a vf-module object from the database, - * @param configServices A Config Services option created from a Service - * Instance ID - * @param vnfId the target VNF ID - * @param vfModuleId the target vf-module ID - * @return An empty Optional if the Service Data does not exist, an empty - * Optional if the VNF is not found, or an optional containing the - * found VNF. - */ - private Optional<GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule> getVfModuleObject ( - ConfigServices configServices, String vnfId, String vfModuleId) { - // Map the Marshall the JSON String into a Java Object - log.info("Getting vf-module Data for ({})", vfModuleId); - - Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnf = getVnfObject(configServices, vnfId); - GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnf.get().getVnfData(); - - return vnfData.getVfModules().getVfModule() - .stream() - .filter(vf -> vf.getVfModuleId().equals(vfModuleId)) - .findFirst(); - } - - /** * Creates or updates VNF data in the Config table for a specified Service * Instance. If it is a new Service Instance or a new VNF, creates all necessary * parent data containers, then performs the updates. @@ -1366,68 +1332,35 @@ public class ConfigApiController implements ConfigApi { @Override public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdPut( String serviceInstanceId, String vnfId, - GenericResourceApiServicedataServicedataVnfsVnf genericResourceApiServicedataServicedataVnfsVnfBodyParam) + GenericResourceApiServicedataServicedataVnfsVnf vnf) throws RestException { log.info("PUT | VNF Data for ({})", vnfId); - if (!vnfId.equals(genericResourceApiServicedataServicedataVnfsVnfBodyParam.getVnfId())) { + if (!vnfId.equals(vnf.getVnfId())) { throw new RestProtocolException("bad-attribute", "vnf-id mismatch", HttpStatus.BAD_REQUEST.value()); } - if (getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - log.info("Something with header"); - } else { - log.warn( - "ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); ConfigServices data; + ServiceDataTransaction transaction = serviceDataHelper.createTransaction(); if ((services == null) || (services.isEmpty())) { log.info("Could not find data for ({}). Creating new Service Object.", serviceInstanceId); data = new ConfigServices(); data.setSvcInstanceId(serviceInstanceId); + transaction.save(data); } else { data = services.get(0); } - GenericResourceApiServicedataServiceData svcData = null; - try { - svcData = objectMapper.readValue(data.getSvcData(), GenericResourceApiServicedataServiceData.class); - } catch (JsonProcessingException e) { - log.error("Could not map service data for ({})", serviceInstanceId); - } - if (svcData == null) { - log.info("Could not find Service Data for ({}). Creating new Service Data Container", serviceInstanceId); - svcData = new GenericResourceApiServicedataServiceData(); - } - if (svcData.getVnfs() == null) { - log.info("VNF List not found for ({}). Creating new VNF List Container.", serviceInstanceId); - svcData.setVnfs(new GenericResourceApiServicedataServicedataVnfs()); - svcData.getVnfs().setVnf(new ArrayList<>()); - } - - GenericResourceApiServicedataServicedataVnfs vnflist = new GenericResourceApiServicedataServicedataVnfs(); - HttpStatus responseStatus = HttpStatus.NO_CONTENT; - if (svcData.getVnfs().getVnf().isEmpty()) { - log.info("Creating VNF data for ({})", vnfId); - vnflist.addVnfItem(genericResourceApiServicedataServicedataVnfsVnfBodyParam); - responseStatus = HttpStatus.CREATED; - } else { - log.info("Updating VNF data for ({})", vnfId); - // Filter out all of the other vnf objects into a new VNF List - // Replace if a delete method exists - svcData.getVnfs().getVnf().stream().filter(targetVnf -> !targetVnf.getVnfId().equals(vnfId)) - .forEach(vnflist::addVnfItem); - vnflist.addVnfItem(genericResourceApiServicedataServicedataVnfsVnfBodyParam); - } - svcData.setVnfs(vnflist); - // Map and save the new data try { - data.setSvcData(objectMapper.writeValueAsString(svcData)); - configServicesRepository.save(data); + HttpStatus responseStatus = HttpStatus.NO_CONTENT; + if (serviceDataHelper.getVnf(serviceInstanceId, vnfId) == null) { + responseStatus = HttpStatus.CREATED; + } + serviceDataHelper.saveVnf(serviceInstanceId, vnf, transaction); + transaction.commit(); return new ResponseEntity<>(responseStatus); } catch (JsonProcessingException e) { - log.error("Error mapping object to JSON", e); - // Should probably be a 500 INTERNAL_SERVICE_ERROR + log.error("Error saving vnf", e); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } } @@ -1448,23 +1381,26 @@ public class ConfigApiController implements ConfigApi { public ResponseEntity<GenericResourceApiVnftopologyVnfTopology> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVnfTopologyGet( String serviceInstanceId, String vnfId) throws RestException { log.info("GET | VNF Topology for ({})", vnfId); - if (getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - if (getAcceptHeader().get().contains("application/json")) { - } - } else { - log.warn( - "ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); if ((services == null) || (services.isEmpty())) { throw new RestProtocolException("data-missing", "No service entry found", HttpStatus.NOT_FOUND.value()); } - Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnf = getVnfObject(services.get(0), vnfId); + GenericResourceApiServicedataServicedataVnfsVnf vnf = null; + + try { + vnf = serviceDataHelper.getVnf(serviceInstanceId, vnfId); + } catch (JsonProcessingException e) { + log.error("Could not parse service data", e); + throw new RestApplicationException("data-conversion", + "Request could not be completed due to internal error", e, + HttpStatus.INTERNAL_SERVER_ERROR.value()); + } + // Drill down to find the data - if (vnf.isPresent() && vnf.get().getVnfData() != null && vnf.get().getVnfData().getVnfTopology() != null) { - return new ResponseEntity<>(vnf.get().getVnfData().getVnfTopology(), HttpStatus.OK); + if (vnf != null && vnf.getVnfData() != null && vnf.getVnfData().getVnfTopology() != null) { + return new ResponseEntity<>(vnf.getVnfData().getVnfTopology(), HttpStatus.OK); } else { log.info("No information found for {}", vnfId); throw new RestApplicationException("data-missing", @@ -1498,11 +1434,7 @@ public class ConfigApiController implements ConfigApi { String serviceInstanceId, String vnfId, GenericResourceApiOperStatusData genericResourceApiOperStatusDataBodyParam) throws RestException { log.info("PUT | VNF Level Oper Status ({})", vnfId); - if (getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - } else { - log.warn( - "ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } + ServiceDataTransaction transaction = serviceDataHelper.createTransaction(); List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); ConfigServices data; @@ -1510,66 +1442,31 @@ public class ConfigApiController implements ConfigApi { log.info("Could not find data for ({}). Creating new Service Object.", serviceInstanceId); data = new ConfigServices(); data.setSvcInstanceId(serviceInstanceId); + transaction.save(data); } else { data = services.get(0); } - GenericResourceApiServicedataServiceData svcData = null; - try { - svcData = objectMapper.readValue(data.getSvcData(), GenericResourceApiServicedataServiceData.class); - } catch (JsonProcessingException e) { - log.error("Could not map service data for ({})", serviceInstanceId); - } - if (svcData == null) { - log.info("Could not find Service Data for ({}). Creating new Service Data Container", serviceInstanceId); - svcData = new GenericResourceApiServicedataServiceData(); - } - if (svcData.getVnfs() == null) { - log.info("VNF List not found for ({}). Creating new VNF List Container.", serviceInstanceId); - svcData.setVnfs(new GenericResourceApiServicedataServicedataVnfs()); - svcData.getVnfs().setVnf(new ArrayList<>()); - } - - GenericResourceApiServicedataServicedataVnfs vnflist = new GenericResourceApiServicedataServicedataVnfs(); HttpStatus responseStatus = HttpStatus.NO_CONTENT; - if (svcData.getVnfs().getVnf().isEmpty()) { - log.info("Creating VNF data for ({})", vnfId); - GenericResourceApiServicedataServicedataVnfsVnf vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); - vnf.setVnfId(vnfId); - vnf.setVnfData(new GenericResourceApiServicedataServicedataVnfsVnfVnfData()); - vnf.getVnfData().setVnfLevelOperStatus(genericResourceApiOperStatusDataBodyParam); - vnflist.addVnfItem(vnf); - responseStatus = HttpStatus.CREATED; - } else { - log.info("Updating VNF data for ({})", vnfId); - // Filter out all of the other vnf objects into a new VNF List - // Replace if a delete method exists - svcData.getVnfs().getVnf().stream().filter(targetVnf -> !targetVnf.getVnfId().equals(vnfId)) - .forEach(vnflist::addVnfItem); - GenericResourceApiServicedataServicedataVnfsVnf vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); - // If the vnf exists, set it up with new data - Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnfOptional = getVnfObject(data, vnfId); - if (vnfOptional.isPresent()) { - vnf = vnfOptional.get(); - } - if (vnf.getVnfData() == null) { - vnf.setVnfData(new GenericResourceApiServicedataServicedataVnfsVnfVnfData()); - responseStatus = HttpStatus.CREATED; - } - - vnf.getVnfData().setVnfLevelOperStatus(genericResourceApiOperStatusDataBodyParam); - vnflist.addVnfItem(vnf); - } - svcData.setVnfs(vnflist); - // Map and save the new data try { - data.setSvcData(objectMapper.writeValueAsString(svcData)); - configServicesRepository.save(data); + GenericResourceApiServicedataServicedataVnfsVnf vnf = serviceDataHelper.getVnf(serviceInstanceId, vnfId); + if (vnf == null) { + responseStatus = HttpStatus.CREATED; + vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); + vnf.setVnfId(vnfId); + } + GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnf.getVnfData(); + if (vnfData == null) { + vnfData = new GenericResourceApiServicedataServicedataVnfsVnfVnfData(); + } + vnfData.setVnfLevelOperStatus(genericResourceApiOperStatusDataBodyParam); + vnf.setVnfData(vnfData); + serviceDataHelper.saveVnf(serviceInstanceId, vnf, transaction); + transaction.commit(); return new ResponseEntity<>(responseStatus); } catch (JsonProcessingException e) { - log.error("Error mapping object to JSON", e); - // Should probably be a 500 INTERNAL_SERVICE_ERROR + log.error("Error saving vnf", e); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } } @@ -1614,11 +1511,7 @@ public class ConfigApiController implements ConfigApi { GenericResourceApiOnapmodelinformationOnapModelInformation genericResourceApiOnapmodelinformationOnapModelInformationBodyParam) throws RestException { log.info("PUT | VNF Topology Onap Model Information ({})", vnfId); - if (getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - } else { - log.warn( - "ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } + ServiceDataTransaction transaction = serviceDataHelper.createTransaction(); List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); ConfigServices data; @@ -1626,68 +1519,40 @@ public class ConfigApiController implements ConfigApi { log.info("Could not find data for ({}). Creating new Service Object.", serviceInstanceId); data = new ConfigServices(); data.setSvcInstanceId(serviceInstanceId); + transaction.save(data); } else { data = services.get(0); } - GenericResourceApiServicedataServiceData svcData = null; + + GenericResourceApiServicedataServicedataVnfsVnf vnf = null; + HttpStatus responseStatus = HttpStatus.NO_CONTENT; + try { - svcData = objectMapper.readValue(data.getSvcData(), GenericResourceApiServicedataServiceData.class); - } catch (JsonProcessingException e) { - log.error("Could not map service data for ({})", serviceInstanceId); - } - if (svcData == null) { - log.info("Could not find Service Data for ({}). Creating new Service Data Container", serviceInstanceId); - svcData = new GenericResourceApiServicedataServiceData(); - } - if (svcData.getVnfs() == null) { - log.info("VNF List not found for ({}). Creating new VNF List Container.", serviceInstanceId); - svcData.setVnfs(new GenericResourceApiServicedataServicedataVnfs()); - svcData.getVnfs().setVnf(new ArrayList<>()); + vnf = serviceDataHelper.getVnf(serviceInstanceId, vnfId); + } catch(JsonProcessingException e) { + + log.error("Could not parse service data", e); + throw new RestApplicationException("data-conversion", + "Request could not be completed due to internal error", e, + HttpStatus.INTERNAL_SERVER_ERROR.value()); } - GenericResourceApiServicedataServicedataVnfs vnflist = new GenericResourceApiServicedataServicedataVnfs(); - HttpStatus responseStatus = HttpStatus.NO_CONTENT; - if (svcData.getVnfs().getVnf().isEmpty()) { - log.info("Creating VNF data for ({})", vnfId); - GenericResourceApiServicedataServicedataVnfsVnf vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); + if (vnf == null) { + responseStatus = HttpStatus.CREATED; + vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); vnf.setVnfId(vnfId); vnf.setVnfData(new GenericResourceApiServicedataServicedataVnfsVnfVnfData()); vnf.getVnfData().setVnfTopology(new GenericResourceApiVnftopologyVnfTopology()); - vnf.getVnfData().getVnfTopology() - .setOnapModelInformation(genericResourceApiOnapmodelinformationOnapModelInformationBodyParam); - vnflist.addVnfItem(vnf); - responseStatus = HttpStatus.CREATED; - } else { - log.info("Updating VNF data for ({})", vnfId); - // Filter out all of the other vnf objects into a new VNF List - // Replace if a delete method exists - svcData.getVnfs().getVnf().stream().filter(targetVnf -> !targetVnf.getVnfId().equals(vnfId)) - .forEach(vnflist::addVnfItem); - GenericResourceApiServicedataServicedataVnfsVnf vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); - // If the vnf exists, set it up with new data - Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnfOptional = getVnfObject(data, vnfId); - if (vnfOptional.isPresent()) { - vnf = vnfOptional.get(); - } - if (vnf.getVnfData() == null) { - vnf.setVnfData(new GenericResourceApiServicedataServicedataVnfsVnfVnfData()); - } - if (vnf.getVnfData().getVnfTopology() == null) { - vnf.getVnfData().setVnfTopology(new GenericResourceApiVnftopologyVnfTopology()); - responseStatus = HttpStatus.CREATED; - } - - vnf.getVnfData().getVnfTopology() - .setOnapModelInformation(genericResourceApiOnapmodelinformationOnapModelInformationBodyParam); - vnflist.addVnfItem(vnf); } - svcData.setVnfs(vnflist); - // Map and save the new data + vnf.getVnfData().getVnfTopology() + .setOnapModelInformation(genericResourceApiOnapmodelinformationOnapModelInformationBodyParam); + + // Save the updated VNF (and service, if new) try { - data.setSvcData(objectMapper.writeValueAsString(svcData)); - configServicesRepository.save(data); + serviceDataHelper.saveVnf(serviceInstanceId, vnf, transaction); + transaction.commit(); return new ResponseEntity<>(responseStatus); } catch (JsonProcessingException e) { log.error("Error mapping object to JSON", e); @@ -1718,86 +1583,61 @@ public class ConfigApiController implements ConfigApi { GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks genericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworksBodyParam) throws RestException { log.info("PUT | VNF Topology VNF Resource Assignments VNF Networks ({})", vnfId); - if (getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - } else { - log.warn( - "ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } + ServiceDataTransaction transaction = serviceDataHelper.createTransaction(); List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); ConfigServices data; if ((services == null) || (services.isEmpty())) { log.info("Could not find data for ({}). Creating new Service Object.", serviceInstanceId); data = new ConfigServices(); data.setSvcInstanceId(serviceInstanceId); + transaction.save(data); } else { data = services.get(0); } - GenericResourceApiServicedataServiceData svcData = null; + HttpStatus responseStatus = HttpStatus.NO_CONTENT; + GenericResourceApiServicedataServicedataVnfsVnf vnf = null; + try { - svcData = objectMapper.readValue(data.getSvcData(), GenericResourceApiServicedataServiceData.class); - } catch (JsonProcessingException e) { - log.error("Could not map service data for ({})", serviceInstanceId); - } - if (svcData == null) { - log.info("Could not find Service Data for ({}). Creating new Service Data Container", serviceInstanceId); - svcData = new GenericResourceApiServicedataServiceData(); - } - if (svcData.getVnfs() == null) { - log.info("VNF List not found for ({}). Creating new VNF List Container.", serviceInstanceId); - svcData.setVnfs(new GenericResourceApiServicedataServicedataVnfs()); - svcData.getVnfs().setVnf(new ArrayList<>()); + vnf = serviceDataHelper.getVnf(serviceInstanceId, vnfId); + } catch(JsonProcessingException e) { + + log.error("Could not parse service data", e); + throw new RestApplicationException("data-conversion", + "Request could not be completed due to internal error", e, + HttpStatus.INTERNAL_SERVER_ERROR.value()); } - GenericResourceApiServicedataServicedataVnfs vnflist = new GenericResourceApiServicedataServicedataVnfs(); - HttpStatus responseStatus = HttpStatus.NO_CONTENT; - if (svcData.getVnfs().getVnf().isEmpty()) { + if (vnf == null) { log.info("Creating VNF data for ({})", vnfId); - GenericResourceApiServicedataServicedataVnfsVnf vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); + vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); vnf.setVnfId(vnfId); - vnf.setVnfData(new GenericResourceApiServicedataServicedataVnfsVnfVnfData()); - vnf.getVnfData().setVnfTopology(new GenericResourceApiVnftopologyVnfTopology()); - vnf.getVnfData().getVnfTopology() - .setVnfResourceAssignments(new GenericResourceApiVnfresourceassignmentsVnfResourceAssignments()); - vnf.getVnfData().getVnfTopology().getVnfResourceAssignments() - .setVnfNetworks(genericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworksBodyParam); - vnflist.addVnfItem(vnf); responseStatus = HttpStatus.CREATED; - } else { - log.info("Updating VNF data for ({})", vnfId); - // Filter out all of the other vnf objects into a new VNF List - // Replace if a delete method exists - svcData.getVnfs().getVnf().stream().filter(targetVnf -> !targetVnf.getVnfId().equals(vnfId)) - .forEach(vnflist::addVnfItem); - GenericResourceApiServicedataServicedataVnfsVnf vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); - // If the vnf exists, set it up with new data - Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnfOptional = getVnfObject(data, vnfId); - if (vnfOptional.isPresent()) { - vnf = vnfOptional.get(); - } - if (vnf.getVnfData() == null) { - vnf.setVnfData(new GenericResourceApiServicedataServicedataVnfsVnfVnfData()); - } - if (vnf.getVnfData().getVnfTopology() == null) { - vnf.getVnfData().setVnfTopology(new GenericResourceApiVnftopologyVnfTopology()); - } - if (vnf.getVnfData().getVnfTopology().getVnfResourceAssignments() == null) { - vnf.getVnfData().getVnfTopology().setVnfResourceAssignments( - new GenericResourceApiVnfresourceassignmentsVnfResourceAssignments()); - responseStatus = HttpStatus.CREATED; - } + } + GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnf.getVnfData(); + if (vnfData == null) { + vnfData = new GenericResourceApiServicedataServicedataVnfsVnfVnfData(); + } + + GenericResourceApiVnftopologyVnfTopology vnfTopology = vnfData.getVnfTopology(); + if (vnfTopology == null) { + vnfTopology = new GenericResourceApiVnftopologyVnfTopology(); + } - vnf.getVnfData().getVnfTopology().getVnfResourceAssignments() - .setVnfNetworks(genericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworksBodyParam); - vnflist.addVnfItem(vnf); + GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments = vnfTopology.getVnfResourceAssignments(); + if (vnfResourceAssignments == null) { + vnfResourceAssignments = new GenericResourceApiVnfresourceassignmentsVnfResourceAssignments(); } + vnfResourceAssignments.setVnfNetworks(genericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworksBodyParam); + vnfTopology.setVnfResourceAssignments(vnfResourceAssignments); + vnfData.setVnfTopology(vnfTopology); + vnf.setVnfData(vnfData); - svcData.setVnfs(vnflist); // Map and save the new data try { - data.setSvcData(objectMapper.writeValueAsString(svcData)); - configServicesRepository.save(data); + serviceDataHelper.saveVnf(serviceInstanceId, vnf, transaction); + transaction.commit(); return new ResponseEntity<>(responseStatus); } catch (JsonProcessingException e) { log.error("Error mapping object to JSON", e); @@ -1834,11 +1674,8 @@ public class ConfigApiController implements ConfigApi { if (!networkRole.equals(genericResourceApiVnfNetworkDataBodyParam.getNetworkRole())) { throw new RestProtocolException("bad-attribute", "network-role mismatch", HttpStatus.BAD_REQUEST.value()); } - if (getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - } else { - log.warn( - "ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } + + ServiceDataTransaction transaction = serviceDataHelper.createTransaction(); List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); ConfigServices data; @@ -1846,102 +1683,71 @@ public class ConfigApiController implements ConfigApi { log.info("Could not find data for ({}). Creating new Service Object.", serviceInstanceId); data = new ConfigServices(); data.setSvcInstanceId(serviceInstanceId); + transaction.save(data); } else { data = services.get(0); } - GenericResourceApiServicedataServiceData svcData = null; + HttpStatus responseStatus = HttpStatus.NO_CONTENT; + GenericResourceApiServicedataServicedataVnfsVnf vnf = null; + try { - svcData = objectMapper.readValue(data.getSvcData(), GenericResourceApiServicedataServiceData.class); - } catch (JsonProcessingException e) { - log.error("Could not map service data for ({})", serviceInstanceId); - } - if (svcData == null) { - log.info("Could not find Service Data for ({}). Creating new Service Data Container", serviceInstanceId); - svcData = new GenericResourceApiServicedataServiceData(); - } - if (svcData.getVnfs() == null) { - log.info("VNF List not found for ({}). Creating new VNF List Container.", serviceInstanceId); - svcData.setVnfs(new GenericResourceApiServicedataServicedataVnfs()); - svcData.getVnfs().setVnf(new ArrayList<>()); + vnf = serviceDataHelper.getVnf(serviceInstanceId, vnfId); + } catch(JsonProcessingException e) { + + log.error("Could not parse service data", e); + throw new RestApplicationException("data-conversion", + "Request could not be completed due to internal error", e, + HttpStatus.INTERNAL_SERVER_ERROR.value()); } - GenericResourceApiServicedataServicedataVnfs vnflist = new GenericResourceApiServicedataServicedataVnfs(); - HttpStatus responseStatus = HttpStatus.NO_CONTENT; - if (svcData.getVnfs().getVnf().isEmpty()) { + if (vnf == null) { log.info("Creating VNF data for ({})", vnfId); - GenericResourceApiServicedataServicedataVnfsVnf vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); + vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); vnf.setVnfId(vnfId); - vnf.setVnfData(new GenericResourceApiServicedataServicedataVnfsVnfVnfData()); - vnf.getVnfData().setVnfTopology(new GenericResourceApiVnftopologyVnfTopology()); - vnf.getVnfData().getVnfTopology() - .setVnfResourceAssignments(new GenericResourceApiVnfresourceassignmentsVnfResourceAssignments()); - vnf.getVnfData().getVnfTopology().getVnfResourceAssignments() - .setVnfNetworks(new GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks()); - vnf.getVnfData().getVnfTopology().getVnfResourceAssignments().getVnfNetworks() - .setVnfNetwork(new ArrayList<>()); - vnf.getVnfData().getVnfTopology().getVnfResourceAssignments().getVnfNetworks() - .addVnfNetworkItem(genericResourceApiVnfNetworkDataBodyParam); - vnflist.addVnfItem(vnf); responseStatus = HttpStatus.CREATED; - } else { - log.info("Updating VNF data for ({})", vnfId); - // Filter out all of the other vnf objects into a new VNF List - // Replace if a delete method exists - svcData.getVnfs().getVnf().stream().filter(targetVnf -> !targetVnf.getVnfId().equals(vnfId)) - .forEach(vnflist::addVnfItem); - GenericResourceApiServicedataServicedataVnfsVnf vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); - // If the vnf exists, set it up with new data - Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnfOptional = getVnfObject(data, vnfId); - if (vnfOptional.isPresent()) { - vnf = vnfOptional.get(); - } - if (vnf.getVnfData() == null) { - vnf.setVnfData(new GenericResourceApiServicedataServicedataVnfsVnfVnfData()); - } - if (vnf.getVnfData().getVnfTopology() == null) { - vnf.getVnfData().setVnfTopology(new GenericResourceApiVnftopologyVnfTopology()); - } - if (vnf.getVnfData().getVnfTopology().getVnfResourceAssignments() == null) { - vnf.getVnfData().getVnfTopology().setVnfResourceAssignments( - new GenericResourceApiVnfresourceassignmentsVnfResourceAssignments()); - } - if (vnf.getVnfData().getVnfTopology().getVnfResourceAssignments().getVnfNetworks() == null) { - log.info("Creating new VnfNetworks"); - vnf.getVnfData().getVnfTopology().getVnfResourceAssignments().setVnfNetworks( - new GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks()); - } + } + GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnf.getVnfData(); + if (vnfData == null) { + vnfData = new GenericResourceApiServicedataServicedataVnfsVnfVnfData(); + } - GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks networkList = new GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks(); - if (vnf.getVnfData().getVnfTopology().getVnfResourceAssignments().getVnfNetworks().getVnfNetwork() - .isEmpty()) { - log.info("First entry into network info."); - vnf.getVnfData().getVnfTopology().getVnfResourceAssignments().getVnfNetworks() - .addVnfNetworkItem(genericResourceApiVnfNetworkDataBodyParam); - responseStatus = HttpStatus.CREATED; - } else { - log.info("Found networks. Filtering."); - vnf.getVnfData().getVnfTopology().getVnfResourceAssignments().getVnfNetworks().getVnfNetwork().stream() - .filter(targetNetwork -> !targetNetwork.getNetworkRole().equals(networkRole)) - .forEach(networkList::addVnfNetworkItem); - networkList.addVnfNetworkItem(genericResourceApiVnfNetworkDataBodyParam); - - if (networkList.getVnfNetwork().size() != vnf.getVnfData().getVnfTopology().getVnfResourceAssignments() - .getVnfNetworks().getVnfNetwork().size()) { - log.info("Added a new Item"); - responseStatus = HttpStatus.CREATED; - } - vnf.getVnfData().getVnfTopology().getVnfResourceAssignments().setVnfNetworks(networkList); - } + GenericResourceApiVnftopologyVnfTopology vnfTopology = vnfData.getVnfTopology(); + if (vnfTopology == null) { + vnfTopology = new GenericResourceApiVnftopologyVnfTopology(); + } - vnflist.addVnfItem(vnf); + GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments = vnfTopology.getVnfResourceAssignments(); + if (vnfResourceAssignments == null) { + vnfResourceAssignments = new GenericResourceApiVnfresourceassignmentsVnfResourceAssignments(); } - svcData.setVnfs(vnflist); - // Map and save the new data + GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks vnfNetworks = vnfResourceAssignments.getVnfNetworks(); + if (vnfNetworks == null) { + vnfNetworks = new GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks(); + vnfNetworks.setVnfNetwork(new ArrayList<>()); + } + + + if (vnfNetworks.getVnfNetwork().isEmpty()) { + vnfNetworks.addVnfNetworkItem(genericResourceApiVnfNetworkDataBodyParam); + } else { + GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks vnfNetworksNew = new GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks(); + vnfNetworksNew.setVnfNetwork(new ArrayList<>()); + vnfNetworks.getVnfNetwork().stream() + .filter(targetNetwork -> !targetNetwork.getNetworkRole().equals(networkRole)).forEach(vnfNetworksNew::addVnfNetworkItem); + + vnfNetworksNew.addVnfNetworkItem(genericResourceApiVnfNetworkDataBodyParam); + vnfNetworks = vnfNetworksNew; + } + + vnfResourceAssignments.setVnfNetworks(vnfNetworks); + vnfTopology.setVnfResourceAssignments(vnfResourceAssignments); + vnfData.setVnfTopology(vnfTopology); + vnf.setVnfData(vnfData); try { - data.setSvcData(objectMapper.writeValueAsString(svcData)); - configServicesRepository.save(data); + serviceDataHelper.saveVnf(serviceInstanceId, vnf, transaction); + transaction.commit(); return new ResponseEntity<>(responseStatus); } catch (JsonProcessingException e) { log.error("Error mapping object to JSON", e); @@ -1950,35 +1756,6 @@ public class ConfigApiController implements ConfigApi { } } - /** - * Extracts a VNF object from the database, - * - * @param configServices A Config Services option created from a Service - * Instance ID - * @param vnfId the target VNF ID - * @return An empty Optional if the Service Data does not exist, an empty - * Optional if the VNF is not found, or an optional containing the found - * VNF. - */ - private Optional<GenericResourceApiServicedataServicedataVnfsVnf> getVnfObject(ConfigServices configServices, - String vnfId) { - // Map the Marshall the JSON String into a Java Object - log.info("Getting VNF Data for ({})", vnfId); - GenericResourceApiServicedataServiceData svcData; - try { - svcData = objectMapper.readValue(configServices.getSvcData(), - GenericResourceApiServicedataServiceData.class); - } catch (JsonProcessingException e) { - log.error("Error", e); - return Optional.empty(); - } - - /* - * Get a stream of the VNF Objects and return the target if it's found, assuming - * that each VNF ID is unique within a Service Instance Object - */ - return svcData.getVnfs().getVnf().stream().filter(targetVnf -> targetVnf.getVnfId().equals(vnfId)).findFirst(); - } @Override public ResponseEntity<GenericResourceApiServicetopologyServiceTopology> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataServiceTopologyGet( @@ -1991,13 +1768,14 @@ public class ConfigApiController implements ConfigApi { throw new RestProtocolException("data-missing", "No service entry found", HttpStatus.NOT_FOUND.value()); } + ConfigServices service = services.get(0); + try { - if (services.get(0).getSvcData().isEmpty()) { + if ( (service.getSvcData() == null) || service.getSvcData().isEmpty()) { throw new RestProtocolException("data-missing", "No service-data entry found", HttpStatus.NOT_FOUND.value()); } else { - serviceData = objectMapper.readValue(services.get(0).getSvcData(), - GenericResourceApiServicedataServiceData.class); + serviceData = serviceDataHelper.getServiceData(service); serviceTopology = serviceData.getServiceTopology(); } if (serviceTopology == null) { @@ -2031,21 +1809,24 @@ public class ConfigApiController implements ConfigApi { log.info("GET | Vf Module Data for ({})", vfModuleId); - if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - if(getAcceptHeader().get().contains("application/json")) { - } - } else { - log.warn("ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } + List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); if((services == null) || (services.isEmpty())) { throw new RestProtocolException("data-missing", "No service entry found", HttpStatus.NOT_FOUND.value()); } - Optional<GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule> vfModule = - getVfModuleObject(services.get(0), vnfId, vfModuleId); - if(vfModule.isPresent()) { - return new ResponseEntity<>(vfModule.get(), HttpStatus.OK); + GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vfModule; + try { + vfModule = serviceDataHelper.getVfModule(serviceInstanceId, vnfId, vfModuleId); + } catch (JsonProcessingException e) { + log.error("Could not parse service data", e); + throw new RestApplicationException("data-conversion", + "Request could not be completed due to internal error", e, + HttpStatus.INTERNAL_SERVER_ERROR.value()); + } + + if(vfModule != null) { + return new ResponseEntity<>(vfModule, HttpStatus.OK); } else { log.info("No vf-module found for [{}]", vfModuleId); throw new RestApplicationException("data-missing", @@ -2074,75 +1855,42 @@ public class ConfigApiController implements ConfigApi { if(! vfModuleId.equals(genericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModuleBodyParam.getVfModuleId())) { throw new RestProtocolException("bad-attribute", "vf-module-id mismatch", HttpStatus.BAD_REQUEST.value()); } - if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - log.info("Something with header"); - } else { - log.warn("ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } + HttpStatus responseStatus = HttpStatus.NO_CONTENT; - ConfigServices service; - GenericResourceApiServicedataServiceData svcData; List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); if((services == null) || (services.isEmpty())) { log.error("service-instance-id ({}) not found in SDN.", serviceInstanceId); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } else { - service = services.get(0); - } + } + + GenericResourceApiServicedataServicedataVnfsVnf vnf; try { - svcData = objectMapper.readValue(service.getSvcData(), GenericResourceApiServicedataServiceData.class); - } catch(JsonProcessingException e) { - log.error("Error", e); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + vnf = serviceDataHelper.getVnf(serviceInstanceId, vnfId); + } catch (JsonProcessingException e1) { + log.error("Could not parse service data", e1); + throw new RestApplicationException("data-conversion", + "Request could not be completed due to internal error", e1, + HttpStatus.INTERNAL_SERVER_ERROR.value()); } - GenericResourceApiServicedataServicedataVnfs vnfs = svcData.getVnfs(); - Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnf = - vnfs.getVnf() - .stream() - .filter(targetVnf -> targetVnf.getVnfId().equals(vnfId)) - .findFirst(); - - if(! vnf.isPresent()) { + if(vnf == null) { log.error("vnf-id ({}) not found in SDN.", vnfId); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } - GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnf.get().getVnfData(); - GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules existingVfModules = vnfData.getVfModules(); - GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules newVfModules = new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules(); + // See if this is the first vf module being added + List<ConfigVfModules> configVfModules = configVfModulesRepository.findBySvcInstanceIdAndVnfId(serviceInstanceId, vnfId); - if (existingVfModules == null || existingVfModules.getVfModule().isEmpty()) { - log.info("No existing vf-module found. Creating the first vf-module for vnf [{}]", vnfId); - newVfModules.addVfModuleItem(genericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModuleBodyParam); + if ((configVfModules == null) || configVfModules.isEmpty()) { responseStatus = HttpStatus.CREATED; } - else { - ArrayList<String> vfModuleIds = new ArrayList<>(); - for (GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vf : existingVfModules.getVfModule()) { - vfModuleIds.add(vf.getVfModuleId()); - } - log.info("[{}] vf-module(s) {} found in vnf [{}]", existingVfModules.getVfModule().size(), vfModuleIds, vnfId); - if (!vfModuleIds.isEmpty() && vfModuleIds.contains(vfModuleId)) { - log.info("Overwriting vf-module [{}] in vnf [{}]", vfModuleId, vnfId); - } else { - log.info("Adding vf-module [{}] to vnf [{}]", vfModuleId, vnfId); - } - existingVfModules.getVfModule() - .stream() - .filter(vf -> ! vf.getVfModuleId().equals(vfModuleId)) - .forEach(newVfModules::addVfModuleItem); - newVfModules.addVfModuleItem(genericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModuleBodyParam); - responseStatus = HttpStatus.OK; - } - vnfData.setVfModules(newVfModules); - // Map and save the new data + + // Add vf module try { - service.setSvcData(objectMapper.writeValueAsString(svcData)); - configServicesRepository.save(service); + serviceDataHelper.saveVfModule(serviceInstanceId, vnfId, genericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModuleBodyParam, null); return new ResponseEntity<>(responseStatus); } catch(JsonProcessingException e) { log.error("Error mapping object to JSON", e); @@ -2167,13 +1915,7 @@ public class ConfigApiController implements ConfigApi { configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVfModulesVfModuleVfModuleIdVfModuleDataVfModuleTopologyGet( String serviceInstanceId, String vnfId, String vfModuleId) throws RestException { log.info("GET | vf-module-topology for ({})", vfModuleId); - if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - if (getAcceptHeader().get().contains("application/json")) { - log.info("Something with header"); - } - } else { - log.warn("ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } + List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); if((services == null) || (services.isEmpty())) { throw new RestApplicationException("data-missing", @@ -2181,12 +1923,19 @@ public class ConfigApiController implements ConfigApi { HttpStatus.NOT_FOUND.value()); } - Optional<GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule> vfModule = - getVfModuleObject(services.get(0), vnfId, vfModuleId); - if(vfModule.isPresent() - && vfModule.get().getVfModuleData() != null - && vfModule.get().getVfModuleData().getVfModuleTopology() != null) { - return new ResponseEntity<>(vfModule.get().getVfModuleData().getVfModuleTopology(), HttpStatus.OK); + GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vfModule; + try { + vfModule = serviceDataHelper.getVfModule(serviceInstanceId, vnfId, vfModuleId); + } catch (JsonProcessingException e) { + log.error("Could not parse service data", e); + throw new RestApplicationException("data-conversion", + "Request could not be completed due to internal error", e, + HttpStatus.INTERNAL_SERVER_ERROR.value()); + } + if (vfModule != null + && vfModule.getVfModuleData() != null + && vfModule.getVfModuleData().getVfModuleTopology() != null) { + return new ResponseEntity<>(vfModule.getVfModuleData().getVfModuleTopology(), HttpStatus.OK); } else { log.info("No information found for {}", vfModuleId); throw new RestApplicationException("data-missing", @@ -2201,78 +1950,20 @@ public class ConfigApiController implements ConfigApi { log.info("DELETE | vf-module Data for ({})", vfModuleId); - if (getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { - log.info("Something with header."); - } else { - log.warn("ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); - } - ConfigServices service; - GenericResourceApiServicedataServiceData svcData; + List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); if((services == null) || (services.isEmpty())) { log.error("service-instance-id ({}) not found in SDN.", serviceInstanceId); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } else { - service = services.get(0); - } + } - try { - svcData = objectMapper.readValue(service.getSvcData(), GenericResourceApiServicedataServiceData.class); - } catch(JsonProcessingException e) { - log.error("Error", e); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - GenericResourceApiServicedataServicedataVnfs vnfs = svcData.getVnfs(); - Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnf = - vnfs.getVnf() - .stream() - .filter(targetVnf -> targetVnf.getVnfId().equals(vnfId)) - .findFirst(); - if(! vnf.isPresent()) { - log.error("vnf-id ({}) not found in SDN.", vnfId); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - - GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnf.get().getVnfData(); - GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules existingVfModules = vnfData.getVfModules(); - GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules newVfModules = new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules(); - - if (existingVfModules == null || existingVfModules.getVfModule().isEmpty()) { - log.info("No existing vf-module found. Creating the first vf-module for vnf [{}]", vnfId); - return new ResponseEntity<>(HttpStatus.OK); - } - - ArrayList<String> vfModuleIds = new ArrayList<>(); - for (GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vf : existingVfModules.getVfModule()) { - vfModuleIds.add(vf.getVfModuleId()); - } - log.info("[{}] vf-module(s) {} found in vnf [{}]", existingVfModules.getVfModule().size(), vfModuleIds, vnfId); - if (!vfModuleIds.isEmpty() && vfModuleIds.contains(vfModuleId)) { - log.info("Deleting vf-module [{}] from vnf [{}]", vfModuleId, vnfId); - } else { - log.info("vf-module [{}] not found in vnf [{}]", vfModuleId, vnfId); - return new ResponseEntity<>(HttpStatus.OK); - } - existingVfModules.getVfModule() - .stream() - .filter(vf -> ! vf.getVfModuleId().equals(vfModuleId)) - .forEach(newVfModules::addVfModuleItem); - vnfData.setVfModules(newVfModules); - log.info("vf-module [{}] deleted from vnf [{}]", vfModuleId, vnfId); - - // Map and save the new data - try { - service.setSvcData(objectMapper.writeValueAsString(svcData)); - configServicesRepository.save(service); - return new ResponseEntity<>(HttpStatus.OK); - } catch(JsonProcessingException e) { - log.error("Error mapping object to JSON", e); - // Should probably be a 500 INTERNAL_SERVICE_ERROR - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } + serviceDataHelper.deleteVfModule(serviceInstanceId, vnfId, vfModuleId); + return new ResponseEntity<>(HttpStatus.OK); + } } + diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java index 2b52fca..19c8ca0 100644 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java @@ -42,7 +42,6 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceBase; import org.onap.sdnc.apps.ms.gra.data.ConfigContrailRouteAllottedResourcesRepository; -import org.onap.sdnc.apps.ms.gra.data.ConfigNetworks; import org.onap.sdnc.apps.ms.gra.data.ConfigNetworksRepository; import org.onap.sdnc.apps.ms.gra.data.ConfigPortMirrorConfigurations; import org.onap.sdnc.apps.ms.gra.data.ConfigPortMirrorConfigurationsRepository; @@ -50,9 +49,7 @@ import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadData; import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository; import org.onap.sdnc.apps.ms.gra.data.ConfigServices; import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository; -import org.onap.sdnc.apps.ms.gra.data.ConfigVfModules; import org.onap.sdnc.apps.ms.gra.data.ConfigVfModulesRepository; -import org.onap.sdnc.apps.ms.gra.data.ConfigVnfs; import org.onap.sdnc.apps.ms.gra.data.ConfigVnfsRepository; import org.onap.sdnc.apps.ms.gra.data.OperationalContrailRouteAllottedResourcesRepository; import org.onap.sdnc.apps.ms.gra.data.OperationalPortMirrorConfigurationsRepository; @@ -84,16 +81,6 @@ import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiRequestStatusEn import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServiceOperationInformation; import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServiceOperationInformationBodyparam; import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServiceTopologyOperation; -import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServiceData; -import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataNetworks; -import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataNetworksNetwork; -import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataNetworksNetworkNetworkData; -import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfs; -import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnf; -import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnfVnfData; -import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules; -import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule; -import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData; import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicetopologyoperationOutput; import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiVfModuleOperationInformation; import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiVfModuleOperationInformationBodyparam; @@ -175,6 +162,9 @@ public class OperationsApiController implements OperationsApi { @Autowired private OperationalPortMirrorConfigurationsRepository operationalPortMirrorConfigurationsRepository; + @Autowired + private ServiceDataHelper serviceDataHelper; + private static class Iso8601Util { private static TimeZone timeZone = TimeZone.getTimeZone("UTC"); @@ -552,147 +542,6 @@ public class OperationsApiController implements OperationsApi { } - private String getConfigServiceDataAsString(String svcInstanceId) throws JsonProcessingException { - return(objectMapper.writeValueAsString(getConfigServiceData(svcInstanceId))); - } - - private GenericResourceApiServicedataServiceData getConfigServiceData(String svcInstanceId) - throws JsonProcessingException { - - List<ConfigServices> configServices = configServicesRepository.findBySvcInstanceId(svcInstanceId); - - if (configServices.isEmpty()) { - return (null); - } - - GenericResourceApiServicedataServiceData svcData = (objectMapper.readValue(configServices.get(0).getSvcData(), GenericResourceApiServicedataServiceData.class)); - - // Get networks - List<ConfigNetworks> configNetworks = configNetworksRepository.findBySvcInstanceId(svcInstanceId); - GenericResourceApiServicedataServicedataNetworks networks = new GenericResourceApiServicedataServicedataNetworks(); - for (ConfigNetworks configNetwork : configNetworks) { - GenericResourceApiServicedataServicedataNetworksNetwork network = new GenericResourceApiServicedataServicedataNetworksNetwork(); - network.setNetworkId(configNetwork.getNetworkId()); - network.setNetworkData(objectMapper.readValue(configNetwork.getNetworkData(), GenericResourceApiServicedataServicedataNetworksNetworkNetworkData.class)); - networks.addNetworkItem(network); - } - svcData.setNetworks(networks); - - // Get VNFs - List<ConfigVnfs> configVnfs = configVnfsRepository.findBySvcInstanceId(svcInstanceId); - GenericResourceApiServicedataServicedataVnfs vnfs = new GenericResourceApiServicedataServicedataVnfs(); - for (ConfigVnfs configVnf : configVnfs) { - GenericResourceApiServicedataServicedataVnfsVnf vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); - vnf.setVnfId(configVnf.getVnfId()); - GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = objectMapper.readValue(configVnf.getVnfData(), GenericResourceApiServicedataServicedataVnfsVnfVnfData.class); - - // Get vf modules for this vnf - List<ConfigVfModules> configVfModules = configVfModulesRepository.findBySvcInstanceIdAndVnfId(svcInstanceId, configVnf.getVnfId()); - GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules vfModules = new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules(); - for (ConfigVfModules configVfModule : configVfModules) { - GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vfModule = new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule(); - vfModule.setVfModuleId(configVfModule.getVfModuleId()); - vfModule.setVfModuleData(objectMapper.readValue(configVfModule.getVfModuleData(), GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData.class)); - vfModules.addVfModuleItem(vfModule); - } - vnfData.setVfModules(vfModules); - vnf.setVnfData(vnfData); - vnfs.addVnfItem(vnf); - } - svcData.setVnfs(vnfs); - return(svcData); - } - - private void saveSvcData(ConfigServices configService, String svcDataAsString) throws JsonProcessingException { - if (svcDataAsString == null) { - configServicesRepository.save(configService); - return; - } - saveSvcData(configService, objectMapper.readValue(svcDataAsString, GenericResourceApiServicedataServiceData.class)); - } - - private void saveSvcData(ConfigServices configService, GenericResourceApiServicedataServiceData svcData) throws JsonProcessingException { - if (svcData == null) { - configServicesRepository.save(configService); - return; - } - - String svcInstanceId = configService.getSvcInstanceId(); - - // Write networks - GenericResourceApiServicedataServicedataNetworks networks = svcData.getNetworks(); - if (networks != null) { - List<GenericResourceApiServicedataServicedataNetworksNetwork> networkItems = networks.getNetwork(); - if ((networkItems != null) && !networkItems.isEmpty()) { - for (GenericResourceApiServicedataServicedataNetworksNetwork networkItem : networkItems) { - List<ConfigNetworks> configNetworks = configNetworksRepository - .findBySvcInstanceIdAndNetworkId(svcInstanceId, networkItem.getNetworkId()); - ConfigNetworks configNetwork; - if ((configNetworks == null) || (configNetworks.isEmpty())) { - configNetwork = new ConfigNetworks(svcInstanceId, networkItem.getNetworkId()); - } else { - configNetwork = configNetworks.get(0); - } - configNetwork.setNetworkData(objectMapper.writeValueAsString(networkItem.getNetworkData())); - configNetworksRepository.save(configNetwork); - } - } - svcData.setNetworks(null); - } - - // Write vnfs - GenericResourceApiServicedataServicedataVnfs vnfs = svcData.getVnfs(); - if (vnfs != null) { - List<GenericResourceApiServicedataServicedataVnfsVnf> vnfItems = vnfs.getVnf(); - if ((vnfItems != null) && !vnfItems.isEmpty()) { - for (GenericResourceApiServicedataServicedataVnfsVnf vnfItem : vnfItems) { - String vnfId = vnfItem.getVnfId(); - List<ConfigVnfs> configVnfs = configVnfsRepository.findBySvcInstanceIdAndVnfId(svcInstanceId, - vnfId); - ConfigVnfs configVnf; - if ((configVnfs == null) || (configVnfs.isEmpty())) { - configVnf = new ConfigVnfs(svcInstanceId, vnfId); - } else { - configVnf = configVnfs.get(0); - } - - GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnfItem.getVnfData(); - - // Write vf modules - GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules vfModules = vnfData.getVfModules(); - if (vfModules != null) { - List<GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule> vfModuleItems = vfModules - .getVfModule(); - if ((vfModuleItems != null) && !vfModuleItems.isEmpty()) { - for (GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vfModuleItem : vfModuleItems) { - List<ConfigVfModules> configVfModules = configVfModulesRepository - .findBySvcInstanceIdAndVnfIdAndVfModuleId(svcInstanceId, vnfId, - vfModuleItem.getVfModuleId()); - ConfigVfModules configVfModule; - if ((configVfModules == null) || (configVfModules.isEmpty())) { - configVfModule = new ConfigVfModules(svcInstanceId, vnfId, - vfModuleItem.getVfModuleId()); - } else { - configVfModule = configVfModules.get(0); - } - configVfModule.setVfModuleData( - objectMapper.writeValueAsString(vfModuleItem.getVfModuleData())); - configVfModulesRepository.save(configVfModule); - } - vnfData.setVfModules(null); - - configVnf.setVnfData(objectMapper.writeValueAsString(vnfData)); - configVnfsRepository.save(configVnf); - } - } - } - } - svcData.setVnfs(null); - } - - configService.setSvcData(objectMapper.writeValueAsString(svcData)); - configServicesRepository.save(configService); - } @Override public ResponseEntity<GenericResourceApiNetworkTopologyOperation> operationsGENERICRESOURCEAPInetworkTopologyOperationPost( @@ -738,7 +587,7 @@ public class OperationsApiController implements OperationsApi { if (configServices != null && !configServices.isEmpty()) { configService = configServices.get(0); try { - svcData = getConfigServiceDataAsString(svcInstanceId); + svcData = serviceDataHelper.getServiceDataAsString(svcInstanceId); } catch (JsonProcessingException e) { log.error("exiting {} due to parse error on service data", svcOperation); resp.setResponseCode("500"); @@ -836,7 +685,7 @@ public class OperationsApiController implements OperationsApi { // Save service data try { - saveSvcData(configService, ctxSvcDataJson); + serviceDataHelper.saveService(configService, ctxSvcDataJson); } catch (JsonProcessingException e) { log.error("exiting {} due to error saving service data", svcOperation); resp.setResponseCode("500"); @@ -901,10 +750,12 @@ public class OperationsApiController implements OperationsApi { if (configServices != null && !configServices.isEmpty()) { configService = configServices.get(0); try { - svcData = getConfigServiceDataAsString(svcInstanceId); - ctxIn.mergeJson("service-data", svcData); + svcData = serviceDataHelper.getServiceDataAsString(svcInstanceId); + if (svcData != null) { + ctxIn.mergeJson("service-data", svcData); + } } catch (JsonProcessingException e) { - log.error("exiting {} due to parse error on service data", svcOperation); + log.error("exiting {} due to parse error on service data", svcOperation, e); resp.setResponseCode("500"); resp.setResponseMessage("internal error"); resp.setAckFinalIndicator("Y"); @@ -912,7 +763,7 @@ public class OperationsApiController implements OperationsApi { return new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR); } } else { - configService = new ConfigServices(svcInstanceId, null); + configService = new ConfigServices(svcInstanceId); } @@ -981,7 +832,7 @@ public class OperationsApiController implements OperationsApi { // Save service data try { - saveSvcData(configService, ctxSvcDataJson); + serviceDataHelper.saveService(configService, ctxSvcDataJson); } catch (JsonProcessingException e) { log.error("exiting {} due to error saving service data", svcOperation); resp.setResponseCode("500"); @@ -1052,7 +903,7 @@ public class OperationsApiController implements OperationsApi { if (configServices != null && !configServices.isEmpty()) { configService = configServices.get(0); try { - svcData = getConfigServiceDataAsString(svcInstanceId); + svcData = serviceDataHelper.getServiceDataAsString(svcInstanceId); } catch (JsonProcessingException e) { log.error("exiting {} due to parse error on service data", svcOperation); resp.setResponseCode("500"); @@ -1153,7 +1004,7 @@ public class OperationsApiController implements OperationsApi { // Save service data try { - saveSvcData(configService, ctxSvcDataJson); + serviceDataHelper.saveService(configService, ctxSvcDataJson); } catch (JsonProcessingException e) { log.error("exiting {} due to error saving service data", svcOperation); resp.setResponseCode("500"); @@ -1210,7 +1061,7 @@ public class OperationsApiController implements OperationsApi { if (configServices != null && !configServices.isEmpty()) { configService = configServices.get(0); try { - svcData = getConfigServiceDataAsString(svcInstanceId); + svcData = serviceDataHelper.getServiceDataAsString(svcInstanceId); } catch (JsonProcessingException e) { log.error("exiting {} due to parse error on service data", svcOperation); return; @@ -1285,7 +1136,7 @@ public class OperationsApiController implements OperationsApi { // Save service data try { - saveSvcData(configService, ctxSvcDataJson); + serviceDataHelper.saveService(configService, ctxSvcDataJson); } catch (JsonProcessingException e) { log.error("exiting {} due to error saving service data", svcOperation); return; @@ -1311,6 +1162,8 @@ public class OperationsApiController implements OperationsApi { GenericResourceApiVfmoduletopologyoperationOutput resp = new GenericResourceApiVfmoduletopologyoperationOutput(); log.info(CALLED_STR, svcOperation); + + log.info("MYSQL_DATABASE = {}", System.getenv("MYSQL_DATABASE")); // Verify input contains service instance id if (hasInvalidServiceId(input.getInput())) { log.debug("exiting {} because of null or empty service-instance-id", svcOperation); @@ -1358,7 +1211,7 @@ public class OperationsApiController implements OperationsApi { if (configServices != null && !configServices.isEmpty()) { configService = configServices.get(0); try { - svcData = getConfigServiceDataAsString(svcInstanceId); + svcData = serviceDataHelper.getServiceDataAsString(svcInstanceId); } catch (JsonProcessingException e) { log.error("exiting {} due to parse error on service data", svcOperation); resp.setResponseCode("500"); @@ -1404,7 +1257,7 @@ public class OperationsApiController implements OperationsApi { String ackFinal = "Y"; String skipMdsalUpdate; - String ctxSvcDataJson = svcData; + // Call DG try { // Any of these can throw a nullpointer exception @@ -1450,8 +1303,9 @@ public class OperationsApiController implements OperationsApi { // ONLY update svcData in config and operational trees // and remember to save operational data when skip-mdsal-update is Y in ctx. String ctxJson = ctxOut.toJsonString("service-data"); - log.info("Saving service-data in SDN because skiMdsalUpdate is {}", skipMdsalUpdate); - saveSvcData(configService, ctxJson); + log.info("Saving service-data in SDN because skipMdsalUpdate is {}", skipMdsalUpdate); + log.info("Service data : {}", ctxJson); + serviceDataHelper.saveService(configService, ctxJson); log.info("Copying service-data to operational-data"); operService.setSvcData(ctxJson); @@ -1510,7 +1364,7 @@ public class OperationsApiController implements OperationsApi { if (configServices != null && !configServices.isEmpty()) { configService = configServices.get(0); try { - svcData = getConfigServiceDataAsString(svcInstanceId); + svcData = serviceDataHelper.getServiceDataAsString(svcInstanceId); } catch (JsonProcessingException e) { log.error("exiting {} due to parse error on service data", svcOperation); return; @@ -1578,7 +1432,7 @@ public class OperationsApiController implements OperationsApi { // Save service data try { - saveSvcData(configService, ctxSvcDataJson); + serviceDataHelper.saveService(configService, ctxSvcDataJson); } catch (JsonProcessingException e) { log.error("exiting {} due to error saving service data", svcOperation); return; @@ -1909,7 +1763,12 @@ public class OperationsApiController implements OperationsApi { ConfigServices configService = null; if (configServices != null && !configServices.isEmpty()) { configService = configServices.get(0); - ctxIn.mergeJson("service-data", configService.getSvcData()); + try { + ctxIn.mergeJson("service-data", serviceDataHelper.getServiceDataAsString(svcInstanceId)); + } catch (JsonProcessingException e) { + log.error("exiting {} due to parse error on service data", svcOperation); + return new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR); + } } else { log.debug("exiting {} because the service-instance does not have any service data in SDN", svcOperation); return new ResponseEntity<>(retval, HttpStatus.OK); @@ -1920,13 +1779,7 @@ public class OperationsApiController implements OperationsApi { // Any of these can throw a nullpointer exception // execute should only throw a SvcLogicException SvcLogicContext ctxOut = svc.execute(MODULE_NAME, svcOperation, null, "sync", ctxIn); - Properties respProps = ctxOut.toProperties(); - /* For debugging Only - respProps.forEach((k,v) -> { - log.debug("prop: {} -> {}",k,v); - }); - */ String ctxJson = ctxOut.toJsonString("vnf-get-resource-request-output"); GenericResourceApiVnfgetresourcerequestOutput vnfgetresourcerequestOutput = diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ServiceDataHelper.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ServiceDataHelper.java new file mode 100644 index 0000000..f120f8c --- /dev/null +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ServiceDataHelper.java @@ -0,0 +1,498 @@ +package org.onap.sdnc.apps.ms.gra.controllers; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.onap.sdnc.apps.ms.gra.data.ConfigNetworks; +import org.onap.sdnc.apps.ms.gra.data.ConfigNetworksRepository; +import org.onap.sdnc.apps.ms.gra.data.ConfigServices; +import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository; +import org.onap.sdnc.apps.ms.gra.data.ConfigVfModules; +import org.onap.sdnc.apps.ms.gra.data.ConfigVfModulesRepository; +import org.onap.sdnc.apps.ms.gra.data.ConfigVnfs; +import org.onap.sdnc.apps.ms.gra.data.ConfigVnfsRepository; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServiceData; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataNetworks; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataNetworksNetwork; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataNetworksNetworkNetworkData; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfs; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnf; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnfVnfData; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.stereotype.Component; + +@Component +@ComponentScan(basePackages = { "org.onap.sdnc.apps.ms.gra.*", "org.onap.ccsdk.apps.services" }) +public class ServiceDataHelper { + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private ConfigServicesRepository configServicesRepository; + + @Autowired + private ConfigNetworksRepository configNetworksRepository; + + @Autowired + private ConfigVnfsRepository configVnfsRepository; + + @Autowired + private ConfigVfModulesRepository configVfModulesRepository; + + public ServiceDataHelper() { + + } + + public class ServiceDataTransaction { + private List<ConfigServices> servicesToSave = new LinkedList<ConfigServices>(); + private List<ConfigNetworks> networksToSave = new LinkedList<ConfigNetworks>(); + private List<ConfigVnfs> vnfsToSave = new LinkedList<ConfigVnfs>(); + private List<ConfigVfModules> vfModulesToSave = new LinkedList<ConfigVfModules>(); + + private List<ConfigServices> servicesToRemove = new LinkedList<ConfigServices>(); + private List<ConfigNetworks> networksToRemove = new LinkedList<ConfigNetworks>(); + private List<ConfigVnfs> vnfsToRemove = new LinkedList<ConfigVnfs>(); + private List<ConfigVfModules> vfModulesToRemove = new LinkedList<ConfigVfModules>(); + + public void save(ConfigServices service) { + servicesToSave.add(service); + } + + public void save(ConfigNetworks network) { + networksToSave.add(network); + } + + public void save(ConfigVnfs vnf) { + vnfsToSave.add(vnf); + } + + public void save(ConfigVfModules vfModule) { + vfModulesToSave.add(vfModule); + } + + public void remove(ConfigServices service) { + servicesToRemove.add(service); + } + + public void remove(ConfigNetworks network) { + networksToRemove.add(network); + } + + public void remove(ConfigVnfs vnf) { + vnfsToRemove.add(vnf); + } + + public void remove(ConfigVfModules vfModule) { + vfModulesToRemove.add(vfModule); + } + + + public void commit() { + + for (ConfigServices service : servicesToSave) { + configServicesRepository.save(service); + } + for (ConfigNetworks network : networksToSave) { + configNetworksRepository.save(network); + } + for (ConfigVnfs vnf: vnfsToSave) { + configVnfsRepository.save(vnf); + } + for (ConfigVfModules vfModule : vfModulesToSave) { + configVfModulesRepository.save(vfModule); + } + for (ConfigServices service : servicesToRemove) { + configServicesRepository.delete(service); + } + for (ConfigNetworks network : networksToSave) { + configNetworksRepository.delete(network); + } + for (ConfigVnfs vnf: vnfsToSave) { + configVnfsRepository.delete(vnf); + } + for (ConfigVfModules vfModule : vfModulesToSave) { + configVfModulesRepository.delete(vfModule); + } + } + } + + public ServiceDataTransaction createTransaction() { + return new ServiceDataTransaction(); + } + + public GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule getVfModule(String svcInstanceId, + String vnfId, String vfModuleId) throws JsonProcessingException { + GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vfModule = null; + List<ConfigVfModules> configVfModules = configVfModulesRepository + .findBySvcInstanceIdAndVnfIdAndVfModuleId(svcInstanceId, vnfId, vfModuleId); + if ((configVfModules != null) && !configVfModules.isEmpty()) { + ConfigVfModules configVfModule = configVfModules.get(0); + vfModule = new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule(); + vfModule.setVfModuleId(configVfModule.getVfModuleId()); + String vfModuleDataAsString = configVfModule.getVfModuleData(); + if (vfModuleDataAsString != null) { + vfModule.setVfModuleData(objectMapper.readValue(vfModuleDataAsString, + GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData.class)); + } + + } + return (vfModule); + } + + public GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules getVfModules(String svcInstanceId, String vnfId) throws JsonProcessingException { + GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules vfModules = null; + List<ConfigVfModules> configVfModules = configVfModulesRepository.findBySvcInstanceIdAndVnfId(svcInstanceId, vnfId); + if ((configVfModules != null) && !configVfModules.isEmpty()) { + vfModules = new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules(); + for (ConfigVfModules configVfModule : configVfModules) { + GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vfModule = new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule(); + vfModule.setVfModuleId(configVfModule.getVfModuleId()); + String vfModuleDataAsString = configVfModule.getVfModuleData(); + if (vfModuleDataAsString != null) { + vfModule.setVfModuleData(objectMapper.readValue(vfModuleDataAsString, GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData.class)); + } + vfModules.addVfModuleItem(vfModule); + } + } + return(vfModules); + } + + public GenericResourceApiServicedataServicedataVnfsVnf getVnf(String svcInstanceId, String vnfId) throws JsonProcessingException { + GenericResourceApiServicedataServicedataVnfsVnf vnf = null; + List<ConfigVnfs> configVnfs = configVnfsRepository.findBySvcInstanceIdAndVnfId(svcInstanceId, vnfId); + if ((configVnfs != null) && !configVnfs.isEmpty()) { + ConfigVnfs configVnf = configVnfs.get(0); + vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); + vnf.setVnfId(configVnf.getVnfId()); + GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfDataAsObject = null; + String vnfDataAsString = configVnf.getVnfData(); + if (vnfDataAsString != null) { + vnfDataAsObject = objectMapper.readValue(vnfDataAsString, GenericResourceApiServicedataServicedataVnfsVnfVnfData.class); + } + + GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules vfModules = getVfModules(svcInstanceId, vnfId); + if (vfModules != null) { + if (vnfDataAsObject == null) { + vnfDataAsObject = new GenericResourceApiServicedataServicedataVnfsVnfVnfData(); + } + vnfDataAsObject.setVfModules(vfModules); + } + vnf.setVnfData(vnfDataAsObject); + } + return(vnf); + } + + public GenericResourceApiServicedataServicedataVnfs getVnfs(String svcInstanceId) throws JsonProcessingException { + + GenericResourceApiServicedataServicedataVnfs vnfs = null; + + List<ConfigVnfs> configVnfs = configVnfsRepository.findBySvcInstanceId(svcInstanceId); + if ((configVnfs != null) && !configVnfs.isEmpty()) { + vnfs = new GenericResourceApiServicedataServicedataVnfs(); + for (ConfigVnfs configVnf : configVnfs) { + GenericResourceApiServicedataServicedataVnfsVnf vnf = new GenericResourceApiServicedataServicedataVnfsVnf(); + vnf.setVnfId(configVnf.getVnfId()); + GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfDataAsObject = null; + String vnfDataAsString = configVnf.getVnfData(); + if (vnfDataAsString != null) { + vnfDataAsObject = objectMapper.readValue(vnfDataAsString, + GenericResourceApiServicedataServicedataVnfsVnfVnfData.class); + } + + GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules vfModules = getVfModules(svcInstanceId, configVnf.getVnfId()); + if (vfModules != null) { + if (vnfDataAsObject == null) { + vnfDataAsObject = new GenericResourceApiServicedataServicedataVnfsVnfVnfData(); + } + vnfDataAsObject.setVfModules(vfModules); + } + vnf.setVnfData(vnfDataAsObject); + vnfs.addVnfItem(vnf); + } + } + return (vnfs); + } + + public GenericResourceApiServicedataServicedataNetworks getNetworks(String svcInstanceId) throws JsonProcessingException { + GenericResourceApiServicedataServicedataNetworks networks = null; + List<ConfigNetworks> configNetworks = configNetworksRepository.findBySvcInstanceId(svcInstanceId); + if ((configNetworks != null) && !configNetworks.isEmpty()) { + networks = new GenericResourceApiServicedataServicedataNetworks(); + + for (ConfigNetworks configNetwork : configNetworks) { + GenericResourceApiServicedataServicedataNetworksNetwork network = new GenericResourceApiServicedataServicedataNetworksNetwork(); + network.setNetworkId(configNetwork.getNetworkId()); + String networkDataAsString = configNetwork.getNetworkData(); + if (networkDataAsString != null) { + network.setNetworkData(objectMapper.readValue(networkDataAsString, GenericResourceApiServicedataServicedataNetworksNetworkNetworkData.class)); + } + networks.addNetworkItem(network); + } + } + + return(networks); + } + + public String getServiceDataAsString(String svcInstanceId) throws JsonProcessingException { + GenericResourceApiServicedataServiceData svcData = getServiceData(svcInstanceId); + if (svcData == null) { + return(null); + } else { + return(objectMapper.writeValueAsString(getServiceData(svcInstanceId))); + } + } + + public GenericResourceApiServicedataServiceData getServiceData(String svcInstanceId) throws JsonProcessingException { + + List<ConfigServices> configServices = configServicesRepository.findBySvcInstanceId(svcInstanceId); + if ((configServices != null) && !configServices.isEmpty()) { + return(getServiceData(configServices.get(0))); + } else { + return(null); + } + } + + public GenericResourceApiServicedataServiceData getServiceData(ConfigServices configService) throws JsonProcessingException { + if (configService == null) { + return(null); + } + + GenericResourceApiServicedataServiceData svcData; + String svcInstanceId = configService.getSvcInstanceId(); + String svcDataAsString = configService.getSvcData(); + + if (svcDataAsString != null) { + svcData = objectMapper.readValue(svcDataAsString, GenericResourceApiServicedataServiceData.class); + } else { + svcData = new GenericResourceApiServicedataServiceData(); + } + + // Add networks + GenericResourceApiServicedataServicedataNetworks networks = getNetworks(svcInstanceId); + if (networks != null) { + svcData.setNetworks(networks); + } + + //Add Vnfs + GenericResourceApiServicedataServicedataVnfs vnfs = getVnfs(svcInstanceId); + if (vnfs != null) { + svcData.setVnfs(vnfs); + } + + return(svcData); + + } + + public void saveVfModule(String svcInstanceId, String vnfId, GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vfModule, ServiceDataTransaction transaction) throws JsonProcessingException { + if (vfModule == null) { + return; + } + List<ConfigVfModules> configVfModules = configVfModulesRepository.findBySvcInstanceIdAndVnfIdAndVfModuleId(svcInstanceId, vnfId, vfModule.getVfModuleId()); + ConfigVfModules configVfModule; + if ((configVfModules != null) && !configVfModules.isEmpty()) { + configVfModule = configVfModules.get(0); + } else { + configVfModule = new ConfigVfModules(svcInstanceId, vnfId, vfModule.getVfModuleId()); + } + if (vfModule.getVfModuleData() != null) { + configVfModule.setVfModuleData(objectMapper.writeValueAsString(vfModule.getVfModuleData())); + } + if (transaction != null) { + transaction.save(configVfModule); + } else { + configVfModulesRepository.save(configVfModule); + } + } + + public void saveVnf(String svcInstanceId, GenericResourceApiServicedataServicedataVnfsVnf vnf, ServiceDataTransaction transaction) throws JsonProcessingException { + if (vnf == null) { + return; + } + + GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnf.getVnfData(); + + // Make a list of potential vf modules to remove + HashMap<String, ConfigVfModules> vfModuleMap = new HashMap<>(); + List<ConfigVfModules> configVfModuleList = configVfModulesRepository.findBySvcInstanceIdAndVnfId(svcInstanceId, vnf.getVnfId()); + if ((configVfModuleList != null) && !configVfModuleList.isEmpty()) { + for (ConfigVfModules configVfModuleItem : configVfModuleList) { + vfModuleMap.put(configVfModuleItem.getVfModuleId(), configVfModuleItem); + } + } + + + // Save vf modules + GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules vfModules = vnfData.getVfModules(); + if (vfModules != null) { + List<GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule> vfModuleList = vfModules.getVfModule(); + if ((vfModuleList != null) && !vfModuleList.isEmpty()) { + for (GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vfModule : vfModuleList) { + saveVfModule(svcInstanceId, vnf.getVnfId(), vfModule, transaction); + if (vfModuleMap.containsKey(vfModule.getVfModuleId())) { + vfModuleMap.remove(vfModule.getVfModuleId()); + } + } + } + + // Remove any vf Modules for this vnf id not in this list + for (ConfigVfModules vfModuleToRemove : vfModuleMap.values()) { + if (transaction != null) { + transaction.remove(vfModuleToRemove); + } else { + configVfModulesRepository.delete(vfModuleToRemove); + } + } + + // Clear vf modules from vnfData before saving to avoid duplication + vnfData.setVfModules(null); + } + + // Save Vnf itself + List<ConfigVnfs> configVnfs = configVnfsRepository.findBySvcInstanceIdAndVnfId(svcInstanceId, vnf.getVnfId()); + ConfigVnfs configVnf; + if ((configVnfs != null) && !configVnfs.isEmpty()) { + configVnf = configVnfs.get(0); + } else { + configVnf = new ConfigVnfs(svcInstanceId, vnf.getVnfId()); + } + configVnf.setVnfData(objectMapper.writeValueAsString(vnfData)); + + if (transaction != null) { + transaction.save(configVnf); + } else { + configVnfsRepository.save(configVnf); + } + } + + public void saveNetwork(String svcInstanceId, GenericResourceApiServicedataServicedataNetworksNetwork network, ServiceDataTransaction transaction) throws JsonProcessingException { + List<ConfigNetworks> configNetworks = configNetworksRepository.findBySvcInstanceIdAndNetworkId(svcInstanceId, network.getNetworkId()); + ConfigNetworks configNetwork; + + if ((configNetworks != null) && !configNetworks.isEmpty()) { + configNetwork = configNetworks.get(0); + } else { + configNetwork = new ConfigNetworks(svcInstanceId, network.getNetworkId()); + } + configNetwork.setNetworkData(objectMapper.writeValueAsString(network.getNetworkData())); + if (transaction != null) { + transaction.save(configNetwork); + } else { + configNetworksRepository.save(configNetwork); + } + } + + public void saveService(ConfigServices configService, String svcDataAsString) throws JsonMappingException, JsonProcessingException { + saveService(configService, svcDataAsString, null); + } + + + public void saveService(ConfigServices configService, String svcDataAsString, ServiceDataTransaction transaction) throws JsonMappingException, JsonProcessingException { + if (svcDataAsString == null) { + configServicesRepository.save(configService); + } else { + saveService(configService, objectMapper.readValue(svcDataAsString, GenericResourceApiServicedataServiceData.class), transaction); + } + } + + public void saveService(ConfigServices configService, GenericResourceApiServicedataServiceData svcData) throws JsonProcessingException { + saveService(configService, svcData, null); + } + + public void saveService(ConfigServices configService, GenericResourceApiServicedataServiceData svcData, ServiceDataTransaction transaction) throws JsonProcessingException { + + if (svcData != null) { + String svcInstanceId = configService.getSvcInstanceId(); + + // Save networks + GenericResourceApiServicedataServicedataNetworks networks = svcData.getNetworks(); + if (networks != null) { + List<GenericResourceApiServicedataServicedataNetworksNetwork> networkList = networks.getNetwork(); + if ((networkList != null) && !networkList.isEmpty()) { + for (GenericResourceApiServicedataServicedataNetworksNetwork networkItem : networkList) { + saveNetwork(svcInstanceId, networkItem, transaction); + } + } + } + svcData.setNetworks(null); + + // Save vnfs / vfModules + GenericResourceApiServicedataServicedataVnfs vnfs = svcData.getVnfs(); + if (vnfs != null) { + List<GenericResourceApiServicedataServicedataVnfsVnf> vnfList = vnfs.getVnf(); + if ((vnfList != null) && !vnfList.isEmpty()) { + for (GenericResourceApiServicedataServicedataVnfsVnf vnfItem : vnfList) { + saveVnf(svcInstanceId, vnfItem, transaction); + } + } + } + svcData.setVnfs(null); + + configService.setSvcData(objectMapper.writeValueAsString(svcData)); + } else { + + } + if (transaction != null) { + transaction.save(configService); + } else { + configServicesRepository.save(configService); + } + } + + public long deleteVfModule(String svcInstanceId, String vnfId, String vfModuleId) { + return(configVfModulesRepository.deleteBySvcInstanceIdAndVnfIdAndVfModuleId(svcInstanceId, vnfId, vfModuleId)); + } + + public long deleteVnf(String svcInstanceId, String vnfId) { + configVfModulesRepository.deleteBySvcInstanceIdAndVnfId(svcInstanceId, vnfId); + return(configVnfsRepository.deleteBySvcInstanceIdAndVnfId(svcInstanceId, vnfId)); + } + + public long deleteNetwork(String svcInstanceId, String networkId) { + return(configNetworksRepository.deleteBySvcInstanceIdAndNetworkId(svcInstanceId, networkId)); + } + + public long deleteService(String svcInstanceId) { + configVfModulesRepository.deleteBySvcInstanceId(svcInstanceId); + configVnfsRepository.deleteBySvcInstanceId(svcInstanceId); + configNetworksRepository.deleteBySvcInstanceId(svcInstanceId); + return(configServicesRepository.deleteBySvcInstanceId(svcInstanceId)); + } + + public boolean hasServiceData(ConfigServices service) { + if ((service.getSvcData() != null) && (service.getSvcData().length() > 0)) { + return(true); + } + + List<ConfigNetworks> networks = configNetworksRepository.findBySvcInstanceId(service.getSvcInstanceId()); + if ((networks != null) && !networks.isEmpty()) { + return(true); + } + + List<ConfigVnfs> vnfs = configVnfsRepository.findBySvcInstanceId(service.getSvcInstanceId()); + if ((vnfs != null) && !vnfs.isEmpty()) { + return(true); + } + + return(false); + + } + public void clearServiceData(ConfigServices service) { + configVfModulesRepository.deleteBySvcInstanceId(service.getSvcInstanceId()); + configVnfsRepository.deleteBySvcInstanceId(service.getSvcInstanceId()); + configNetworksRepository.deleteBySvcInstanceId(service.getSvcInstanceId()); + service.setSvcData(null); + configServicesRepository.save(service); + } + +} diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigServices.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigServices.java index 2c89ed4..bf5d862 100644 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigServices.java +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigServices.java @@ -41,11 +41,30 @@ public class ConfigServices { this.svcData = ""; } + public ConfigServices(String svcInstanceId) { + this.svcInstanceId = svcInstanceId; + this.svcData = ""; + } + public ConfigServices(String svcInstanceId, String svcData) { this.svcInstanceId = svcInstanceId; this.svcData = svcData; } + public ConfigServices(String svcInstanceId, GenericResourceApiServicestatusServiceStatus serviceStatus) { + this.svcInstanceId = svcInstanceId; + this.svcData = ""; + + if (serviceStatus != null) { + this.serviceStatusAction = serviceStatus.getAction(); + this.serviceStatusFinalIndicator = serviceStatus.getFinalIndicator(); + this.serviceStatusRequestStatus = serviceStatus.getRequestStatus().toString(); + this.serviceStatusResponseCode = serviceStatus.getResponseCode(); + this.serviceStatusResponseMessage = serviceStatus.getResponseMessage(); + this.serviceStatusResponseTimestamp = serviceStatus.getResponseTimestamp(); + } + } + public ConfigServices(String svcInstanceId, String svcData, GenericResourceApiServicestatusServiceStatus serviceStatus) { this.svcInstanceId = svcInstanceId; this.svcData = svcData; diff --git a/ms/generic-resource-api/src/main/resources/data-mysql.sql b/ms/generic-resource-api/src/main/resources/data-demo.sql index 763d0cb..763d0cb 100644 --- a/ms/generic-resource-api/src/main/resources/data-mysql.sql +++ b/ms/generic-resource-api/src/main/resources/data-demo.sql diff --git a/ms/generic-resource-api/src/main/resources/generic-resource-api-dg.properties b/ms/generic-resource-api/src/main/resources/generic-resource-api-dg.properties index 49ec9fc..3751142 100644 --- a/ms/generic-resource-api/src/main/resources/generic-resource-api-dg.properties +++ b/ms/generic-resource-api/src/main/resources/generic-resource-api-dg.properties @@ -1,23 +1,23 @@ restapi.templateDir=/opt/onap/sdnc/restapi/templates controller.url=http://localhost:8080 -controller.user=admin -controller.pwd=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U +controller.user=${ODL_USER} +controller.pwd=${ODL_PASSWORD} honeycomb.url=http://{honeycomb-instance-ip}:8183 -honeycomb.user=admin -honeycomb.pwd=admin +honeycomb.user=${HONEYCOMB_USER} +honeycomb.pwd=${HONEYCOMB_PASSWORD} restapi.trustStoreFileName=/opt/onap/sdnc/config/truststoreONAPall.jks -restapi.trustStorePassword=changeit +restapi.trustStorePassword=${TRUSTSTORE_PASSWORD} restapi.keyStoreFileName=/opt/onap/sdnc/config/org.onap.sdnc.p12 -restapi.keyStorePassword=;:G58,7ZhqOSI:7^oZCY[9Dv +restapi.keyStorePassword=${KEYSTORE_PASSWORD} restapi.connection-oof-url=http://oof-osdf:8698/api/oof/v1/route naming.gen-name.url=http://neng-serv:8080 naming.gen-name.user=ccsdkapps naming.gen-name.pwd=ccsdkapps -so.user=sdncaBpmn -so.pwd=password1$ +so.user=${SO_USER} +so.pwd=${SO_PASSWORD} cds.url=http://cds-blueprints-processor-http:8080 -cds.user=ccsdkapps -cds.pwd=ccsdkapps +cds.user=${CDS_USER} +cds.pwd=${CDS_PASSWORD} # Templates restapi.sz.templatefile=security-zone-allotted-resource.json diff --git a/ms/generic-resource-api/src/main/resources/schema-mysql.sql b/ms/generic-resource-api/src/main/resources/schema-demo.sql index ddd3217..ddd3217 100644 --- a/ms/generic-resource-api/src/main/resources/schema-mysql.sql +++ b/ms/generic-resource-api/src/main/resources/schema-demo.sql diff --git a/ms/generic-resource-api/src/main/resources/schema-derby.sql b/ms/generic-resource-api/src/main/resources/schema-derby.sql deleted file mode 100644 index 9fbf95f..0000000 --- a/ms/generic-resource-api/src/main/resources/schema-derby.sql +++ /dev/null @@ -1,2755 +0,0 @@ - -CREATE SCHEMA gra; - -SET SCHEMA gra; - --- --- Table structure for table ACCESS_LOG --- - -CREATE TABLE ACCESS_LOG ( - access_log_seq int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - method varchar(12) DEFAULT NULL, - version varchar(12) DEFAULT NULL, - status varchar(12) DEFAULT NULL, - url varchar(256) DEFAULT NULL, - remote_address varchar(128) DEFAULT NULL, - PRIMARY KEY (access_log_seq) -) ; - --- --- Table structure for table CUSTOMER --- - - -CREATE TABLE CUSTOMER ( - cust_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - customer_name varchar(256) DEFAULT NULL, - grua varchar(4) NOT NULL, - create_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (cust_id) -) ; - - --- --- Table structure for table ADDRESS_PLAN_POLICIES --- - -CREATE TABLE ADDRESS_PLAN_POLICIES ( - key_name varchar(255) NOT NULL, - key_value_source_type varchar(255) NOT NULL, - key_value_source varchar(255) NOT NULL, - PRIMARY KEY (key_name) -) ; - --- --- Table structure for table AGNOSTIC_NOTIFICATION_URL --- - -CREATE TABLE AGNOSTIC_NOTIFICATION_URL ( - service_type varchar(128) NOT NULL, - service_instance_id varchar(128) NOT NULL, - request_id varchar(128) NOT NULL, - svc_notification_url varchar(256) NOT NULL, - PRIMARY KEY (service_type,service_instance_id,request_id) -) ; - - --- --- Table structure for table AGNOSTIC_TO_SVC_SPCFC_API --- -CREATE TABLE AGNOSTIC_TO_SVC_SPCFC_API ( - operation varchar(128) NOT NULL, - service varchar(128) NOT NULL, - service_specific_api varchar(128) NOT NULL, - async_process varchar(15) DEFAULT NULL, - PRIMARY KEY (operation,service) -) ; - --- --- Table structure for table AIC_AVAIL_ZONE_POOL --- -CREATE TABLE AIC_AVAIL_ZONE_POOL ( - aic_site_id varchar(100) NOT NULL, - status varchar(40) NOT NULL, - availability_zone varchar(100) NOT NULL, - token varchar(5) NOT NULL, - vnf_id varchar(80) DEFAULT NULL, - service_type varchar(100) NOT NULL, - vnf_type varchar(20) DEFAULT NULL, - hypervisor varchar(10) DEFAULT NULL, - PRIMARY KEY (aic_site_id,availability_zone,token) -) ; - --- --- Table structure for table AIC_HOSTNAME --- -CREATE TABLE AIC_HOSTNAME ( - hostname varchar(20) NOT NULL, - cust_id int NOT NULL, - vendor_code varchar(1) NOT NULL, - virtual_device_type varchar(2) DEFAULT NULL, - device_sequence varchar(3) NOT NULL, - create_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (hostname) -) ; - --- --- Table structure for table AIC_NETWORK --- - -CREATE TABLE AIC_NETWORK ( - network_id varchar(100) NOT NULL, - network_name varchar(100) DEFAULT NULL, - status varchar(20) DEFAULT NULL, - tenant_id varchar(100) DEFAULT NULL, - switch_uuid varchar(100) DEFAULT NULL, - portgroup_name varchar(100) DEFAULT NULL, - portgroup_id varchar(100) DEFAULT NULL, - PRIMARY KEY (network_id) -) ; - --- --- Table structure for table AIC_SITE --- - -CREATE TABLE AIC_SITE ( - name varchar(100) DEFAULT NULL, - aic_site_id varchar(100) NOT NULL, - vcenter_url varchar(200) DEFAULT NULL, - vcenter_username varchar(40) DEFAULT NULL, - vcenter_passwd varchar(255) for bit data DEFAULT NULL, - city varchar(100) DEFAULT NULL, - state varchar(2) DEFAULT NULL, - operational_status varchar(20) DEFAULT NULL, - oam_gateway_addr varchar(20) DEFAULT '', - PRIMARY KEY (aic_site_id) -) ; - --- --- Table structure for table AIC_SWITCH --- - -CREATE TABLE AIC_SWITCH ( - switch_name varchar(100) DEFAULT NULL, - physical_network_name varchar(100) NOT NULL, - aic_site_id varchar(100) DEFAULT NULL, - uuid varchar(100) DEFAULT NULL, - availability_zone varchar(100) DEFAULT NULL, - PRIMARY KEY (physical_network_name) -) ; - --- --- Table structure for table AIC_ZONE_CLOUD_REGION_ID --- - -CREATE TABLE AIC_ZONE_CLOUD_REGION_ID ( - zone_region_id varchar(255) NOT NULL, - cilli_code varchar(255) NOT NULL, - location_id varchar(255) NOT NULL DEFAULT '', - city_state_country varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (zone_region_id,cilli_code,location_id,city_state_country) -) ; - --- --- Table structure for table ALLOCATION_ITEM --- - -CREATE TABLE ALLOCATION_ITEM ( - allocation_item_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - resource_id bigint NOT NULL, - application_id varchar(50) NOT NULL, - resource_set_id varchar(200) NOT NULL, - resource_union_id varchar(200) NOT NULL, - resource_share_group_list varchar(200) DEFAULT NULL, - lt_used bigint DEFAULT NULL, - ll_label varchar(50) DEFAULT NULL, - rr_used varchar(200) DEFAULT NULL, - allocation_time timestamp NOT NULL, - PRIMARY KEY (allocation_item_id) -) ; - --- --- Table structure for table ALLOTTED_RESOURCE_MODEL --- -CREATE TABLE ALLOTTED_RESOURCE_MODEL ( - customization_uuid varchar(255) NOT NULL, - model_yaml blob, - invariant_uuid varchar(255) DEFAULT NULL, - uuid varchar(255) DEFAULT NULL, - version varchar(255) DEFAULT NULL, - naming_policy varchar(255) DEFAULT NULL, - ecomp_generated_naming char(1) DEFAULT NULL, - depending_service varchar(255) DEFAULT NULL, - role varchar(255) DEFAULT NULL, - type varchar(255) DEFAULT NULL, - service_dependency varchar(255) DEFAULT NULL, - allotted_resource_type varchar(255) DEFAULT NULL, - PRIMARY KEY (customization_uuid) -); - --- --- Table structure for table ALTS_CREDENTIALS --- - -CREATE TABLE ALTS_CREDENTIALS ( - alts_username varchar(255) NOT NULL, - alts_password varchar(255) for bit data NOT NULL, - PRIMARY KEY (alts_username) -) ; - --- --- Table structure for table ASDC_ARTIFACTS --- - -CREATE TABLE ASDC_ARTIFACTS ( - asdc_artifacts_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - service_uuid varchar(50) DEFAULT NULL, - distribution_id varchar(50) DEFAULT NULL, - service_name varchar(255) DEFAULT NULL, - service_description varchar(255) DEFAULT NULL, - resource_uuid varchar(255) DEFAULT NULL, - resource_instance_name varchar(255) DEFAULT NULL, - resource_name varchar(255) DEFAULT NULL, - resource_version varchar(50) DEFAULT NULL, - resource_type varchar(50) DEFAULT NULL, - artifact_uuid varchar(50) DEFAULT NULL, - artifact_type varchar(50) DEFAULT NULL, - artifact_version varchar(25) DEFAULT NULL, - artifact_description varchar(255) DEFAULT NULL, - internal_version int DEFAULT NULL, - creation_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - artifact_name varchar(255) DEFAULT NULL, - artifact_content long varchar, - PRIMARY KEY (asdc_artifacts_id) -) ; - --- --- Table structure for table ASDC_REFERENCE --- - -CREATE TABLE ASDC_REFERENCE ( - asdc_reference_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - service_type varchar(50) DEFAULT NULL, - vnf_type varchar(50) DEFAULT NULL, - vnfc_type varchar(50) DEFAULT NULL, - file_category varchar(50) DEFAULT NULL, - action varchar(50) DEFAULT NULL, - artifact_type varchar(50) DEFAULT NULL, - artifact_name varchar(255) NOT NULL, - PRIMARY KEY (asdc_reference_id) -) ; - - --- --- Table structure for table BLOB_TEST --- - -CREATE TABLE BLOB_TEST ( - seq int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - odl varchar(20) DEFAULT NULL, - communities blob, - status varchar(10) NOT NULL DEFAULT 'NEW' CONSTRAINT status_ck_1 CHECK(status IN ('NEW', 'COMPLETE', 'FAILED')), - retry_count int DEFAULT -1, - PRIMARY KEY (seq) -) ; - --- --- Table structure for table CAPABILITY --- - -CREATE TABLE CAPABILITY ( - capability_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - capability_name varchar(50) NOT NULL, - implementation_name varchar(100) NOT NULL, - operation_name varchar(50) NOT NULL, - operation_description varchar(100) NOT NULL, - input_definition long varchar, - output_definition long varchar, - dependency_definition long varchar, - tags varchar(100) DEFAULT NULL, - PRIMARY KEY (capability_id) -) ; - --- --- Table structure for table CITY_CODE --- - -CREATE TABLE CITY_CODE ( - city_code_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - city_code varchar(3) NOT NULL, - city varchar(150) NOT NULL, - state varchar(10) NOT NULL, - country_code varchar(10) NOT NULL, - PRIMARY KEY (city_code_id) -) ; - --- --- Table structure for table CLI_UPDATES --- - -CREATE TABLE CLI_UPDATES ( - seq int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - status varchar(10) NOT NULL DEFAULT 'NEW' CONSTRAINT status_ck_2 CHECK(status IN ('NEW', 'COMPLETE', 'FAILED')), - create_timestamp timestamp DEFAULT CURRENT_TIMESTAMP, - last_processed_timestamp timestamp DEFAULT CURRENT_TIMESTAMP, - target_address varchar(128) DEFAULT NULL, - cli_text varchar(128) DEFAULT NULL, - PRIMARY KEY (seq) -) ; - --- --- Table structure for table CONFIGFILES --- - -CREATE TABLE CONFIGFILES ( - config_file_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - external_version varchar(50) DEFAULT NULL, - data_source varchar(25) DEFAULT NULL, - creation_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - service_instance_id varchar(50) DEFAULT NULL, - vnf_type varchar(50) DEFAULT NULL, - vnfc_type varchar(50) DEFAULT NULL, - file_category varchar(50) DEFAULT NULL, - file_name varchar(255) DEFAULT NULL, - file_content long varchar, - action varchar(50) DEFAULT NULL, - vnf_id varchar(50) DEFAULT NULL, - vm_name varchar(50) DEFAULT NULL, - vnf_name varchar(50) DEFAULT NULL, - PRIMARY KEY (config_file_id) -) ; - --- --- Table structure for table CONFIGURE_ACTION_DG --- - - -CREATE TABLE CONFIGURE_ACTION_DG ( - configure_action_dg_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - vnf_type varchar(50) DEFAULT NULL, - action varchar(50) DEFAULT NULL, - init_config_dg varchar(50) DEFAULT NULL, - generate_config_dg varchar(50) DEFAULT NULL, - download_config_dg varchar(50) DEFAULT NULL, - PRIMARY KEY (configure_action_dg_id) -) ; - - --- --- Table structure for table CONFIG_CONTENT --- - -CREATE TABLE CONFIG_CONTENT ( - config_content_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - request_id varchar(50) NOT NULL, - content_type varchar(50) NOT NULL, - template_name varchar(50) DEFAULT NULL, - originator_id varchar(50) DEFAULT NULL, - service_description varchar(100) DEFAULT NULL, - action varchar(50) DEFAULT NULL, - creation_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - service_type varchar(50) DEFAULT NULL, - service_instance_id varchar(50) DEFAULT NULL, - vnf_id varchar(50) DEFAULT NULL, - vnf_name varchar(50) DEFAULT NULL, - vm_name varchar(50) DEFAULT NULL, - vnf_type varchar(50) DEFAULT NULL, - vnfc_type varchar(50) DEFAULT NULL, - host_ip_address varchar(50) DEFAULT NULL, - config_indicator varchar(25) DEFAULT NULL, - pending_delete varchar(1) DEFAULT NULL, - content long varchar, - PRIMARY KEY (config_content_id) -) ; - - --- --- Table structure for table CONFIG_FILE_REFERENCE --- - -CREATE TABLE CONFIG_FILE_REFERENCE ( - config_file_reference_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - site_location varchar(50) DEFAULT NULL, - vnf_type varchar(50) DEFAULT NULL, - import_type varchar(50) DEFAULT NULL, - file_type varchar(50) DEFAULT NULL, - source_server_name varchar(255) DEFAULT NULL, - source_file_path varchar(255) DEFAULT NULL, - target_file_path varchar(255) DEFAULT NULL, - name varchar(50) DEFAULT NULL, - file_name varchar(255) DEFAULT NULL, - PRIMARY KEY (config_file_reference_id) -) ; - --- --- Table structure for table CONFIG_TRANSACTION_LOG --- - -CREATE TABLE CONFIG_TRANSACTION_LOG ( - config_transaction_log_id varchar(50) NOT NULL, - request_id varchar(50) DEFAULT NULL, - message_type varchar(100) DEFAULT NULL, - creation_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - message long varchar, - PRIMARY KEY (config_transaction_log_id) -) ; - - --- --- Table structure for table COUNTRY_ASN_MAPPING --- - -CREATE TABLE COUNTRY_ASN_MAPPING ( - asn int NOT NULL, - iso_2char varchar(5) NOT NULL, - iso_3char varchar(5) NOT NULL -) ; - - - - --- --- Table structure for table CUSTOMER2CONNECTION_MAPPING --- - -CREATE TABLE CUSTOMER2CONNECTION_MAPPING ( - customer2connection_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - service_instance_id varchar(80) NOT NULL, - instance_type varchar(20) NOT NULL, - originating_service_instance_id varchar(80) DEFAULT NULL, - originating_service_type varchar(20) DEFAULT NULL, - service_type varchar(30) DEFAULT NULL, - connection_id varchar(100) NOT NULL, - status varchar(20) DEFAULT NULL, - PRIMARY KEY (customer2connection_id) -) ; - --- --- Table structure for table CUSTOMER2CONNECTION_MAPPING_NEW --- - -CREATE TABLE CUSTOMER2CONNECTION_MAPPING_NEW ( - customer2connection_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - service_instance_id varchar(80) NOT NULL, - instance_type varchar(20) NOT NULL, - originating_service_instance_id varchar(80) DEFAULT NULL, - originating_service_type varchar(20) DEFAULT NULL, - service_type varchar(30) DEFAULT NULL, - connection_id varchar(100) NOT NULL, - status varchar(100) DEFAULT NULL, - PRIMARY KEY (customer2connection_id) -) ; - --- --- Table structure for table DATA_OBJECT_MAPPING --- - -CREATE TABLE DATA_OBJECT_MAPPING ( - serial_key int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - data_object_key varchar(100) NOT NULL, - data_object_type varchar(50) NOT NULL, - service_type varchar(50) NOT NULL, - data_object_key2 varchar(100) NOT NULL, - data_object_key2_type varchar(50) NOT NULL, - data_object_key3 varchar(100) DEFAULT NULL, - data_object_key3_type varchar(50) DEFAULT NULL, - service varchar(50) DEFAULT NULL, - PRIMARY KEY (serial_key) -) ; - --- --- Table structure for table DEVICE2CONNECTION_MAPPING --- - -CREATE TABLE DEVICE2CONNECTION_MAPPING ( - vnf_host_name varchar(100) NOT NULL, - e2e_vpn_key varchar(30) NOT NULL, - service_type varchar(30) NOT NULL, - connection_id varchar(100) NOT NULL, - PRIMARY KEY (vnf_host_name,e2e_vpn_key,service_type) -) ; - --- --- Table structure for table DEVICE2IPADDRESS_CONSUMPTION --- - -CREATE TABLE DEVICE2IPADDRESS_CONSUMPTION ( - serial_key int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - device_id varchar(100) NOT NULL, - device_type varchar(30) NOT NULL, - ip_version varchar(10) NOT NULL, - consumption_key varchar(100) NOT NULL, - logical_interface_service_id varchar(100) NOT NULL, - address_type varchar(30) NOT NULL, - ip_consumed varchar(50) NOT NULL, - vnf_type varchar(30) NOT NULL, - secondary_key varchar(100) DEFAULT NULL, - PRIMARY KEY (serial_key) -) ; - --- --- Table structure for table DEVICE2IPADDRESS_MAPPING --- - -CREATE TABLE DEVICE2IPADDRESS_MAPPING ( - serial_key int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - device_id varchar(100) NOT NULL, - device_type varchar(30) NOT NULL, - secondary_key varchar(100) NOT NULL, - secondary_key_type varchar(30) NOT NULL, - address varchar(50) NOT NULL, - address_type varchar(30) NOT NULL, - ip_version varchar(10) NOT NULL, - length int NOT NULL, - status varchar(30) NOT NULL, - PRIMARY KEY (serial_key) -) ; - --- --- Table structure for table DEVICE_AUTHENTICATION --- - -CREATE TABLE DEVICE_AUTHENTICATION ( - device_authentication_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - vnf_type varchar(50) DEFAULT NULL, - user_name varchar(50) DEFAULT NULL, - password varchar(100) DEFAULT NULL, - protocol varchar(100) DEFAULT NULL, - port_number int DEFAULT NULL, - PRIMARY KEY (device_authentication_id) -) ; - --- --- Table structure for table DEVICE_INTERFACE_LOG --- - -CREATE TABLE DEVICE_INTERFACE_LOG ( - device_interface_log_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - service_instance_id varchar(50) DEFAULT NULL, - request_id varchar(50) DEFAULT NULL, - creation_date timestamp NOT NULL, - log long varchar, - PRIMARY KEY (device_interface_log_id) -) ; - --- --- Table structure for table DEVICE_INTERFACE_PROTOCOL --- - -CREATE TABLE DEVICE_INTERFACE_PROTOCOL ( - device_interface_protocol_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - vnf_type varchar(50) DEFAULT NULL, - protocol varchar(50) DEFAULT NULL, - module varchar(50) DEFAULT NULL, - dg_rpc varchar(50) DEFAULT NULL, - PRIMARY KEY (device_interface_protocol_id) -) ; - --- --- Table structure for table DOWNLOAD_CONFIG_TEMPLATE --- - -CREATE TABLE DOWNLOAD_CONFIG_TEMPLATE ( - download_config_template_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - vnf_type varchar(50) NOT NULL, - protocol varchar(50) NOT NULL, - template long varchar, - PRIMARY KEY (download_config_template_id) -) ; - --- --- Table structure for table DOWNLOAD_DG_REFERENCE --- - -CREATE TABLE DOWNLOAD_DG_REFERENCE ( - download_dg_reference_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - protocol varchar(50) NOT NULL, - download_config_dg varchar(50) NOT NULL, - PRIMARY KEY (download_dg_reference_id) -) ; - --- --- Table structure for table EIPAM_CLIENT_KEY_INDEX --- - -CREATE TABLE EIPAM_CLIENT_KEY_INDEX ( - vnf_name_prefix varchar(100) NOT NULL, - index_number int NOT NULL, - PRIMARY KEY (vnf_name_prefix) -) ; - --- --- Table structure for table EIPAM_IP_ASSIGNMENTS --- - -CREATE TABLE EIPAM_IP_ASSIGNMENTS ( - plan_name varchar(40) NOT NULL, - client_key varchar(100) NOT NULL, - service_type varchar(40) NOT NULL, - ip_address varchar(40) DEFAULT NULL, - prefix_length int, - status varchar(255) DEFAULT NULL, - service_instance_id varchar(80) DEFAULT NULL, - last_modified_ts timestamp DEFAULT CURRENT_TIMESTAMP, - prev_status varchar(20) DEFAULT NULL, - info varchar(255) DEFAULT NULL, - PRIMARY KEY (plan_name,client_key) -) ; - --- --- Table structure for table EIPAM_IP_POOLS --- - -CREATE TABLE EIPAM_IP_POOLS ( - pool_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - key_name varchar(50) NOT NULL, - key_value varchar(255) NOT NULL, - level int NOT NULL, - plan_name varchar(50) NOT NULL, - address_family varchar(10) NOT NULL, - parent_pool varchar(255) NOT NULL, - service_instance_id varchar(255) DEFAULT NULL, - network_id varchar(255) DEFAULT NULL, - created_timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - delete_failure varchar(20) DEFAULT NULL, - delete_request_id varchar(255) DEFAULT NULL, - PRIMARY KEY (pool_id) -) ; - --- --- Table structure for table EIPAM_IP_SUBNETS --- - -CREATE TABLE EIPAM_IP_SUBNETS ( - entity_id int NOT NULL, - service_type varchar(40) NOT NULL, - plan_name varchar(50) NOT NULL, - address_family varchar(10) NOT NULL, - ip_address varchar(40) NOT NULL, - prefix_length int NOT NULL, - status varchar(20) NOT NULL, - last_modified_ts timestamp DEFAULT CURRENT_TIMESTAMP, - network_id varchar(255) DEFAULT NULL, - pool_id int DEFAULT NULL, - dealloc_failure varchar(20) DEFAULT NULL, - dealloc_request_id varchar(255) DEFAULT NULL, - PRIMARY KEY (entity_id) -) ; - --- --- Table structure for table EIPAM_IP_SUBNET_KEYS --- - -CREATE TABLE EIPAM_IP_SUBNET_KEYS ( - entity_id int NOT NULL, - key_name varchar(50) NOT NULL, - key_value varchar(255) NOT NULL, - level int NOT NULL, - PRIMARY KEY (entity_id,key_name,key_value,level) -) ; - --- --- Table structure for table EIPAM_REQUEST_KEY --- - -CREATE TABLE EIPAM_REQUEST_KEY ( - key_name_1 varchar(50) NOT NULL, - address_family varchar(4) NOT NULL, - serial_key int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - plan_name varchar(50) NOT NULL, - request_length int NOT NULL, - pools_length int NOT NULL, - plan_length int NOT NULL, - key_name_0 varchar(50) NOT NULL, - key_name_type_0 varchar(255) NOT NULL, - key_name_type_1 varchar(255) NOT NULL, - prefix_length int NOT NULL, - group_flag char(1) NOT NULL, - address_type varchar(20) DEFAULT NULL, - PRIMARY KEY (key_name_1,address_family) -) ; - --- --- Table structure for table EXTERNAL_DATA --- - -CREATE TABLE EXTERNAL_DATA ( - external_data_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - request_id int DEFAULT NULL, - param_name varchar(30) NOT NULL, - param_value varchar(50) NOT NULL, - PRIMARY KEY (external_data_id) -) ; - --- --- Table structure for table FLOW_UPDATES --- - -CREATE TABLE FLOW_UPDATES ( - seq int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - status varchar(10) NOT NULL DEFAULT 'NEW' CONSTRAINT status_ck_3 CHECK(status IN ('NEW', 'COMPLETE', 'FAILED')), - create_timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - last_processed_timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - odl varchar(128) DEFAULT NULL, - address_family varchar(4) DEFAULT NULL CONSTRAINT fam_ck CHECK(address_family IN ('IPV4', 'IPV6')), - destination_prefix varchar(50) DEFAULT NULL, - communities varchar(6000) DEFAULT NULL, - route_key varchar(50) DEFAULT NULL, - PRIMARY KEY (seq) -) ; - --- --- Table structure for table GENERIC_L3_NETWORK --- - -CREATE TABLE GENERIC_L3_NETWORK ( - network_id varchar(80) NOT NULL, - network_name varchar(80) DEFAULT NULL, - network_type varchar(80) DEFAULT NULL, - network_role varchar(80) DEFAULT NULL, - network_technology varchar(80) DEFAULT NULL, - neutron_network_id varchar(80) DEFAULT NULL, - is_bound_to_vpn smallint DEFAULT NULL, - orchestration_status varchar(20) DEFAULT NULL, - heat_stack_id varchar(80) DEFAULT NULL, - mso_catalog_key varchar(80) DEFAULT NULL, - service_id varchar(80) NOT NULL, - tenant_id varchar(80) NOT NULL, - physical_location_id varchar(20) DEFAULT NULL, - network_role_instance varchar(80) NOT NULL, - PRIMARY KEY (network_id) -) ; - --- --- Table structure for table GENERIC_L3_NETWORK_SUBNET --- - -CREATE TABLE GENERIC_L3_NETWORK_SUBNET ( - network_id varchar(80) NOT NULL, - subnet_id varchar(80) NOT NULL, - neutron_subnet_id varchar(80) DEFAULT NULL, - gateway_address varchar(45) NOT NULL, - network_start_address varchar(45) NOT NULL, - cidr_mask varchar(20) NOT NULL, - ip_version char(1) NOT NULL, - orchestration_status varchar(64) NOT NULL, - dhcp_enabled smallint NOT NULL, - dhcp_start varchar(45) DEFAULT NULL, - dhcp_end varchar(45) DEFAULT NULL, - PRIMARY KEY (network_id,subnet_id) -) ; - --- --- Table structure for table GENERIC_L3_NETWORK_VPN_BINDING --- - -CREATE TABLE GENERIC_L3_NETWORK_VPN_BINDING ( - network_id varchar(80) NOT NULL, - vpn_id varchar(80) NOT NULL, - PRIMARY KEY (network_id,vpn_id) -) ; - --- --- Table structure for table GENERIC_RESOURCE_NAME --- - -CREATE TABLE GENERIC_RESOURCE_NAME ( - type varchar(50) NOT NULL, - name varchar(255) NOT NULL, - prefix varchar(255) , - name_index int , - context_id varchar(255) , - PRIMARY KEY (type,name) -) ; - --- --- Table structure for table GENERIC_VNF --- - -CREATE TABLE GENERIC_VNF ( - vnf_id varchar(80) NOT NULL, - vnf_name varchar(80) NOT NULL, - vnf_type varchar(200) NOT NULL, - vnf_name2 varchar(80) DEFAULT NULL, - service_id varchar(80) NOT NULL, - equipment_role varchar(80) NOT NULL, - orchestration_status varchar(20) DEFAULT NULL, - prov_status varchar(20) DEFAULT NULL, - heat_stack_id varchar(80) DEFAULT NULL, - mso_catalog_key varchar(80) DEFAULT NULL, - regional_resource_zone varchar(80) DEFAULT NULL, - operational_state varchar(80) DEFAULT NULL, - license_key varchar(80) DEFAULT NULL, - ipv4_oam_address varchar(20) DEFAULT NULL, - ipv4_loopback0_address varchar(20) DEFAULT NULL, - nm_lan_v6_address varchar(40) DEFAULT NULL, - management_v6_address varchar(40) DEFAULT NULL, - management_option varchar(45) DEFAULT NULL, - vcpu varchar(45) DEFAULT NULL, - vmemory varchar(45) DEFAULT NULL, - vdisk varchar(45) DEFAULT NULL, - vcpu_units varchar(45) DEFAULT NULL, - vmemory_units varchar(45) DEFAULT NULL, - vdisk_units varchar(45) DEFAULT NULL, - PRIMARY KEY (vnf_id) -) ; - --- --- Table structure for table GENERIC_VNF_L3_NETWORK --- - -CREATE TABLE GENERIC_VNF_L3_NETWORK ( - vnf_id varchar(80) NOT NULL, - network_id varchar(80) NOT NULL, - PRIMARY KEY (vnf_id,network_id) -) ; - --- --- Table structure for table GENERIC_VNF_LICENSE_MANAGEMENT --- - -CREATE TABLE GENERIC_VNF_LICENSE_MANAGEMENT ( - vnf_id varchar(80) NOT NULL, - att_uuid varchar(80) NOT NULL, - PRIMARY KEY (vnf_id,att_uuid) -) ; - --- --- Table structure for table GENERIC_VNF_LINTERFACE --- - -CREATE TABLE GENERIC_VNF_LINTERFACE ( - vnf_id varchar(80) NOT NULL, - interface_name varchar(255) NOT NULL, - interface_role varchar(45) DEFAULT NULL, - v6_wan_link_ip varchar(45) DEFAULT NULL, - selflink varchar(128) DEFAULT NULL, - interface_id varchar(45) DEFAULT NULL, - macaddr varchar(64) DEFAULT NULL, - network_name varchar(255) DEFAULT NULL, - PRIMARY KEY (vnf_id,interface_name) -) ; - --- --- Table structure for table GENERIC_VNF_PSERVER --- - -CREATE TABLE GENERIC_VNF_PSERVER ( - vnf_id varchar(64) NOT NULL, - hostname varchar(255) NOT NULL, - PRIMARY KEY (vnf_id,hostname) -) ; - --- --- Table structure for table GENERIC_VNF_SERVICE_INSTANCE --- - -CREATE TABLE GENERIC_VNF_SERVICE_INSTANCE ( - vnf_id varchar(64) NOT NULL, - service_instance_id varchar(255) NOT NULL, - relationship_key varchar(64) NOT NULL, - relationship_value varchar(64) DEFAULT NULL, - global_customer_id varchar(255) DEFAULT NULL, - service_type varchar(255) DEFAULT NULL, - PRIMARY KEY (vnf_id,service_instance_id,relationship_key) -) ; - --- --- Table structure for table GENERIC_VNF_VNF_IMAGE --- - -CREATE TABLE GENERIC_VNF_VNF_IMAGE ( - vnf_id varchar(64) NOT NULL, - att_uuid varchar(255) NOT NULL, - PRIMARY KEY (vnf_id,att_uuid) -) ; - --- --- Table structure for table GENERIC_VNF_VSERVER --- - -CREATE TABLE GENERIC_VNF_VSERVER ( - vnf_id varchar(80) NOT NULL, - vserver_id varchar(128) NOT NULL, - tenant_id varchar(128) DEFAULT NULL, - PRIMARY KEY (vnf_id,vserver_id) -) ; - --- --- Table structure for table GENERIC_VPN_BINDING --- - -CREATE TABLE GENERIC_VPN_BINDING ( - vpn_id varchar(80) NOT NULL, - vpn_name varchar(80) NOT NULL, - global_route_target varchar(80) NOT NULL, - PRIMARY KEY (vpn_id) -) ; - --- --- Table structure for table GET_CONFIG_TEMPLATE --- - -CREATE TABLE GET_CONFIG_TEMPLATE ( - get_config_template_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - vnf_type varchar(50) NOT NULL, - device_interface_protocol_id int NOT NULL, - xml_processing varchar(1) DEFAULT NULL, - xml_protocol varchar(30) DEFAULT NULL, - template long varchar, - PRIMARY KEY (get_config_template_id) -) ; - --- --- Table structure for table LOCATION --- - -CREATE TABLE LOCATION ( - loc_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - address varchar(150) NOT NULL, - city_code_id int NOT NULL, - create_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (loc_id) -) ; - --- --- Table structure for table HOSTNAME --- - -CREATE TABLE HOSTNAME ( - hostname varchar(21) NOT NULL, - parent_hostname varchar(21) DEFAULT NULL, - cust_id int NOT NULL, - loc_id int NOT NULL, - site_sequence varchar(2) NOT NULL, - server_sequence varchar(2) NOT NULL, - activation_code varchar(11) DEFAULT NULL, - vnf_sequence varchar(2) DEFAULT NULL, - vendor_code varchar(1) NOT NULL, - virtual_device_type varchar(2) DEFAULT NULL, - device_sequence varchar(3) DEFAULT NULL, - create_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (hostname) -) ; - --- --- Table structure for table IPV4_ADDRESS_POOL --- - -CREATE TABLE IPV4_ADDRESS_POOL ( - aic_site_id varchar(100) NOT NULL, - universe varchar(40) NOT NULL, - status varchar(40) NOT NULL, - ipv4_addr varchar(20) NOT NULL, - PRIMARY KEY (ipv4_addr,universe) -) ; - --- --- Table structure for table LINK_MASTER --- - -CREATE TABLE LINK_MASTER ( - link_interface_ip varchar(20) NOT NULL, - source_crs_name varchar(20) NOT NULL, - destination_crs_name varchar(20) NOT NULL, - max_reserved_bw int DEFAULT NULL, - default_cost int DEFAULT NULL, - bundle_name varchar(20) DEFAULT NULL, - PRIMARY KEY (link_interface_ip) -) ; - --- --- Table structure for table LINTERFACE_VLAN --- - -CREATE TABLE LINTERFACE_VLAN ( - vnf_id varchar(80) NOT NULL, - interface_name varchar(255) NOT NULL, - vlan_interface varchar(255) NOT NULL, - vlan_id_inner varchar(64) DEFAULT NULL, - vlan_id_outer varchar(64) DEFAULT NULL, - PRIMARY KEY (vnf_id,interface_name,vlan_interface) -) ; - - --- --- Table structure for table MAX_PORT_SPEED --- - -CREATE TABLE MAX_PORT_SPEED ( - max_port_speed_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - image_file_name varchar(50) NOT NULL, - end_point_position varchar(50) NOT NULL, - interface_name varchar(100) NOT NULL, - max_speed bigint NOT NULL, - unit varchar(10) NOT NULL, - PRIMARY KEY (max_port_speed_id) -) ; - --- --- Table structure for table MAX_SERVER_SPEED --- - -CREATE TABLE MAX_SERVER_SPEED ( - max_server_speed_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - server_model varchar(50) NOT NULL, - evc_count smallint NOT NULL, - max_speed bigint NOT NULL, - unit varchar(10) NOT NULL, - description varchar(500) DEFAULT NULL, - PRIMARY KEY (max_server_speed_id) -) ; - --- --- Table structure for table NAMING_POLICY_VM_NAME_INDEX --- - -CREATE TABLE NAMING_POLICY_VM_NAME_INDEX ( - vm_name_prefix varchar(255) NOT NULL, - index_number int NOT NULL, - PRIMARY KEY (vm_name_prefix) -) ; - --- --- Table structure for table NAMING_POLICY_VNFC_NAME_INDEX --- - -CREATE TABLE NAMING_POLICY_VNFC_NAME_INDEX ( - vnfc_name_prefix varchar(255) NOT NULL, - index_number int NOT NULL, - PRIMARY KEY (vnfc_name_prefix) -) ; - --- --- Table structure for table NBNC_ASSIGN_VPN_OVERRIDE --- - -CREATE TABLE NBNC_ASSIGN_VPN_OVERRIDE ( - vpn_id varchar(12) NOT NULL DEFAULT '', - vpn_rt varchar(16) NOT NULL DEFAULT '', - service_type varchar(16) NOT NULL DEFAULT '', - be_location varchar(16) NOT NULL DEFAULT '', - be_type varchar(32) NOT NULL DEFAULT '', - be_id varchar(32) DEFAULT NULL, - description varchar(128) DEFAULT NULL, - PRIMARY KEY (vpn_id,vpn_rt,service_type,be_location,be_type) -) ; - --- --- Table structure for table NBNC_BORDER_ELEMENT --- - -CREATE TABLE NBNC_BORDER_ELEMENT ( - be_id varchar(32) NOT NULL, - be_type varchar(16) NOT NULL, - be_name varchar(32) DEFAULT NULL, - be_host_vnf_id varchar(32) DEFAULT NULL, - service_type varchar(16) DEFAULT NULL, - tangibility varchar(16) DEFAULT NULL, - usage_order smallint DEFAULT NULL, - vlan_start smallint DEFAULT NULL, - vlan_end smallint DEFAULT NULL, - ipv4_subnet varchar(18) DEFAULT NULL, - ipv6_subnet varchar(68) DEFAULT NULL, - network_ip varchar(48) DEFAULT NULL, - be_location varchar(16) DEFAULT NULL, - description varchar(128) DEFAULT NULL, - updated_timestamp timestamp DEFAULT NULL, - log_link_model_uuid varchar(64) DEFAULT NULL, - PRIMARY KEY (be_id,be_type) -) ; - --- --- Table structure for table NBNC_IPE --- - -CREATE TABLE NBNC_IPE ( - ipe_name varchar(32) NOT NULL, - ipe_location varchar(16) DEFAULT NULL, - ipe_ip_address varchar(16) DEFAULT NULL, - ipe_id varchar(8) DEFAULT NULL, - service_type_array varchar(512) DEFAULT NULL, - ipe_status varchar(32) DEFAULT NULL, - updated_timestamp timestamp DEFAULT NULL, - PRIMARY KEY (ipe_name) -) ; - --- --- Table structure for table NBNC_IPE_PORT --- - -CREATE TABLE NBNC_IPE_PORT ( - port_id varchar(16) NOT NULL, - ipe_name varchar(32) NOT NULL, - be_id varchar(32) NOT NULL, - be_type varchar(16) NOT NULL, - port_type varchar(16) DEFAULT NULL, - ae_name varchar(16) DEFAULT NULL, - description varchar(128) DEFAULT NULL, - updated_timestamp timestamp DEFAULT NULL, - PRIMARY KEY (port_id,ipe_name,be_id,be_type) -) ; - --- --- Table structure for table NBNC_MAPPING_SBG_BGF --- - -CREATE TABLE NBNC_MAPPING_SBG_BGF ( - asbg_vlan smallint NOT NULL, - bgf_vlan smallint NOT NULL, - PRIMARY KEY (asbg_vlan) -) ; - --- --- Table structure for table NBNC_SERVICE --- - -CREATE TABLE NBNC_SERVICE ( - service_type varchar(16) NOT NULL, - service_model_uuid varchar(64) NOT NULL, - description varchar(128) DEFAULT NULL, - created_timestamp timestamp DEFAULT NULL, - updated_timestamp timestamp DEFAULT NULL, - PRIMARY KEY (service_type) -) ; - --- --- Table structure for table NBNC_SERVICE_VLAN --- - -CREATE TABLE NBNC_SERVICE_VLAN ( - be_id varchar(32) NOT NULL, - vlan smallint NOT NULL, - service_type varchar(16) DEFAULT NULL, - be_type varchar(16) DEFAULT NULL, - be_name varchar(32) DEFAULT NULL, - be_host_vnf_id varchar(32) DEFAULT NULL, - be_location varchar(16) DEFAULT NULL, - be_usage_order smallint DEFAULT NULL, - vlan_usage_order smallint DEFAULT NULL, - status varchar(16) DEFAULT 'AVAILABLE', - request_id varchar(64) DEFAULT NULL, - service_instance_id varchar(64) DEFAULT NULL, - vni_id varchar(16) DEFAULT NULL, - customer_id varchar(16) DEFAULT NULL, - ipe1_router_name varchar(32) DEFAULT NULL, - ipe1_port_id varchar(16) DEFAULT NULL, - ipe1_ae_name varchar(16) DEFAULT NULL, - ipe2_router_name varchar(32) DEFAULT NULL, - ipe2_port_id varchar(16) DEFAULT NULL, - ipe2_ae_name varchar(16) DEFAULT NULL, - available_timestamp timestamp DEFAULT NULL, - allocated_timestamp timestamp DEFAULT NULL, - disabled_timestamp timestamp DEFAULT NULL, - enabled_timestamp timestamp DEFAULT NULL, - vpn_id varchar(12) DEFAULT NULL, - vpn_rt varchar(16) DEFAULT NULL, - PRIMARY KEY (be_id,vlan) -) ; - --- --- Table structure for table NCS_EXPECTED_ASYNC_REQUESTS --- - -CREATE TABLE NCS_EXPECTED_ASYNC_REQUESTS ( - ncs_request_id varchar(255) NOT NULL, - mso_gp_request_id varchar(255) NOT NULL, - service_instance_id varchar(255) NOT NULL, - sdn_module_name varchar(255) NOT NULL, - sdn_rpc_name varchar(255) NOT NULL, - sdn_service_action varchar(255) DEFAULT NULL, - ncs_rpc varchar(255) NOT NULL, - ncs_sub_action varchar(255) DEFAULT NULL, - status varchar(255) NOT NULL DEFAULT 'inProgress', - creation_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (ncs_request_id) -) ; - --- --- Table structure for table NETWORK_INSTANCE_NAME_INDEX --- - -CREATE TABLE NETWORK_INSTANCE_NAME_INDEX ( - network_instance_name_prefix varchar(255) NOT NULL, - index_number int NOT NULL, - PRIMARY KEY (network_instance_name_prefix) -) ; - - --- --- Table structure for table SERVICE_MODEL --- - -CREATE TABLE SERVICE_MODEL ( - service_uuid varchar(255) NOT NULL, - model_yaml blob, - invariant_uuid varchar(255) DEFAULT NULL, - version varchar(255) DEFAULT NULL, - name varchar(255) DEFAULT NULL, - description varchar(1024) DEFAULT NULL, - type varchar(255) DEFAULT NULL, - category varchar(255) DEFAULT NULL, - ecomp_naming char(1) DEFAULT NULL, - service_instance_name_prefix varchar(255) DEFAULT NULL, - filename varchar(100) DEFAULT NULL, - naming_policy varchar(255) DEFAULT NULL, - PRIMARY KEY (service_uuid) -); - - --- --- Table structure for table NETWORK_MODEL --- -CREATE TABLE NETWORK_MODEL ( - customization_uuid varchar(255) NOT NULL, - service_uuid varchar(255) NOT NULL, - model_yaml blob, - invariant_uuid varchar(255) DEFAULT NULL, - uuid varchar(255) DEFAULT NULL, - network_type varchar(255) DEFAULT NULL, - network_role varchar(255) DEFAULT NULL, - network_technology varchar(255) DEFAULT NULL, - trunk_network_indicator char(1) DEFAULT NULL, - network_scope varchar(255) DEFAULT NULL, - naming_policy varchar(255) DEFAULT NULL, - ecomp_generated_naming char(1) DEFAULT NULL, - is_shared_network char(1) DEFAULT NULL, - is_external_network char(1) DEFAULT NULL, - is_provider_network char(1) DEFAULT NULL, - physical_network_name varchar(255) DEFAULT NULL, - is_bound_to_vpn char(1) DEFAULT NULL, - vpn_binding varchar(255) DEFAULT NULL, - use_ipv4 char(1) DEFAULT NULL, - ipv4_dhcp_enabled char(1) DEFAULT NULL, - ipv4_ip_version char(1) DEFAULT NULL, - ipv4_cidr_mask varchar(255) DEFAULT NULL, - eipam_v4_address_plan varchar(255) DEFAULT NULL, - use_ipv6 char(1) DEFAULT NULL, - ipv6_dhcp_enabled char(1) DEFAULT NULL, - ipv6_ip_version char(1) DEFAULT NULL, - ipv6_cidr_mask varchar(255) DEFAULT NULL, - eipam_v6_address_plan varchar(255) DEFAULT NULL, - version varchar(255) DEFAULT NULL, - PRIMARY KEY (customization_uuid) -); - --- --- Table structure for table NETWORK_PROFILE --- - -CREATE TABLE NETWORK_PROFILE ( - network_type varchar(100) NOT NULL, - technology varchar(100) NOT NULL, - PRIMARY KEY (network_type) -) ; - --- --- Table structure for table NETWORK_ROLE_VPN_BINDING --- - -CREATE TABLE NETWORK_ROLE_VPN_BINDING ( - network_role varchar(80) NOT NULL, - vpn_id varchar(80) NOT NULL, - PRIMARY KEY (network_role,vpn_id) -) ; - --- --- Table structure for table NODE_TYPES --- - -CREATE TABLE NODE_TYPES ( - nodetype varchar(80) NOT NULL, - PRIMARY KEY (nodetype) -) ; - --- --- Table structure for table OBJECT_GROUPING --- - -CREATE TABLE OBJECT_GROUPING ( - group_id varchar(128) NOT NULL, - group_type varchar(128) NOT NULL, - PRIMARY KEY (group_id) -) ; - --- --- Table structure for table OBJECT_GROUP_MEMBER_TRACKING --- - -CREATE TABLE OBJECT_GROUP_MEMBER_TRACKING ( - group_id varchar(128) NOT NULL, - key_id varchar(128) NOT NULL, - key_type varchar(128) NOT NULL, - PRIMARY KEY (group_id,key_id,key_type) -) ; - --- --- Table structure for table PARAMETERS --- - -CREATE TABLE PARAMETERS ( - name varchar(100) NOT NULL, - value varchar(128) NOT NULL, - category varchar(24) DEFAULT NULL, - memo varchar(128) DEFAULT NULL, - PRIMARY KEY (name) -) ; - --- --- Table structure for table PE_INV --- - -CREATE TABLE PE_INV ( - EQUIP_ID int DEFAULT NULL, - EQUIP_TYPE varchar(20) DEFAULT NULL, - PTNII_EQUIP_NAME varchar(20) DEFAULT NULL, - IP_ADDR varchar(15) DEFAULT NULL, - ROUTER_PROV_STATUS varchar(50) DEFAULT NULL, - REGION varchar(16) DEFAULT NULL, - COUNTRY_ABBR varchar(50) DEFAULT NULL, - EQUIP_NAME_CODE varchar(50) DEFAULT NULL, - AS_NUMBER varchar(5) DEFAULT NULL, - LOOPBACK1 varchar(15) DEFAULT NULL, - LOOPBACK2 varchar(15) DEFAULT NULL, - LOOPBACK3 varchar(15) DEFAULT NULL, - LOOPBACK40 varchar(15) DEFAULT NULL, - LOOPBACK65535 varchar(15) DEFAULT NULL, - INMS_LIST varchar(20) DEFAULT NULL, - ENCRYPTED_ACCESS_FLAG varchar(50) DEFAULT NULL, - SW_NAME varchar(100) DEFAULT NULL, - NMIPADDR varchar(15) DEFAULT NULL, - CREATE_DATE timestamp DEFAULT NULL, - MOD_DATE timestamp DEFAULT NULL, - FCN_CODE varchar(50) DEFAULT NULL -) ; - --- --- Table structure for table PHYSICAL_LINK --- - -CREATE TABLE PHYSICAL_LINK ( - link_name varchar(255) NOT NULL, - speed_value varchar(64) DEFAULT NULL, - speed_units varchar(64) DEFAULT NULL, - circuit_id varchar(255) NOT NULL, - dual_mode varchar(64) NOT NULL, - PRIMARY KEY (link_name) -) ; - --- --- Table structure for table PHYSICAL_LINK_PINTERFACE --- - -CREATE TABLE PHYSICAL_LINK_PINTERFACE ( - link_name varchar(255) NOT NULL, - hostname varchar(255) NOT NULL, - port_name_ft varchar(255) NOT NULL, - PRIMARY KEY (link_name,hostname,port_name_ft) -) ; - --- --- Table structure for table PINTERFACE --- - -CREATE TABLE PINTERFACE ( - hostname varchar(255) NOT NULL, - port_name_ft varchar(255) NOT NULL, - interface_name varchar(255) DEFAULT '', - physical_speed varchar(255) DEFAULT '', - physical_units varchar(255) DEFAULT '', - port_description varchar(255) DEFAULT '', - PRIMARY KEY (hostname,port_name_ft) -) ; - --- --- Table structure for table POLICY_UPDATE_NOTIFICATION --- - -CREATE TABLE POLICY_UPDATE_NOTIFICATION ( - policy_name varchar(255) NOT NULL, - version_id varchar(255) NOT NULL, - update_type varchar(255) NOT NULL, - timestamp timestamp DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (policy_name,version_id) -) ; - --- --- Table structure for table PORTAL_USERS --- - -CREATE TABLE PORTAL_USERS ( - email varchar(64) NOT NULL, - password varchar(255) for bit data NOT NULL, - privilege char(1) NOT NULL, - PRIMARY KEY (email) -) ; - - --- --- Table structure for table PREPARE_FILE_RELATIONSHIP --- - -CREATE TABLE PREPARE_FILE_RELATIONSHIP ( - prepare_file_relationship_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - service_instance_id varchar(50) DEFAULT NULL, - request_id varchar(255) DEFAULT NULL, - config_file_id int DEFAULT NULL, - asdc_artifacts_id int DEFAULT NULL, - PRIMARY KEY (prepare_file_relationship_id) -) ; - --- --- Table structure for table PRE_LOAD_VNF_DATA --- - -CREATE TABLE PRE_LOAD_VNF_DATA ( - id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - svc_request_id varchar(100) DEFAULT '', - svc_action varchar(40) DEFAULT '', - status varchar(10) NOT NULL DEFAULT 'pending', - filename varchar(100) NOT NULL, - ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - preload_data blob, - PRIMARY KEY (id) -) ; - --- --- Table structure for table PRE_LOAD_VNF_NETWORK_DATA --- - -CREATE TABLE PRE_LOAD_VNF_NETWORK_DATA ( - id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - svc_request_id varchar(100) DEFAULT '', - svc_action varchar(40) DEFAULT '', - status varchar(10) NOT NULL DEFAULT 'pending', - filename varchar(100) NOT NULL, - ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - preload_data blob, - PRIMARY KEY (id) -) ; - --- --- Table structure for table PSERVER --- - -CREATE TABLE PSERVER ( - hostname varchar(255) NOT NULL, - ptnii_equip_name varchar(255) DEFAULT '', - number_of_cpus varchar(255) DEFAULT '', - disk_in_gigabytes varchar(255) DEFAULT '', - ram_in_megabytes varchar(255) DEFAULT '', - equip_type varchar(255) DEFAULT '', - equip_vendor varchar(255) DEFAULT '', - equip_model varchar(255) DEFAULT '', - fqdn varchar(255) DEFAULT '', - pserver_selflink varchar(255) DEFAULT '', - ipv4_oam_address varchar(40) DEFAULT NULL, - serial_number varchar(255) DEFAULT '', - pserver_id varchar(255) DEFAULT '', - internet_topology varchar(40) DEFAULT '', - aic_site_id varchar(100) DEFAULT '', - in_maint varchar(5) DEFAULT '', - pserver_name2 varchar(255) DEFAULT '', - purpose varchar(255) DEFAULT '', - PRIMARY KEY (hostname) -) ; - --- --- Table structure for table RANGE_RULE --- - -CREATE TABLE RANGE_RULE ( - range_rule_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - range_name varchar(50) NOT NULL, - service_model varchar(50) NOT NULL, - end_point_position varchar(50) NOT NULL, - equipment_level varchar(50) NOT NULL, - min_value int NOT NULL, - max_value int NOT NULL, - PRIMARY KEY (range_rule_id) -) ; - --- --- Table structure for table REQUEST_DETAILS --- - -CREATE TABLE REQUEST_DETAILS ( - request_id varchar(255) NOT NULL, - controller_id varchar(255) DEFAULT NULL, - status varchar(255) DEFAULT NULL, - service_rate varchar(255) DEFAULT NULL, - service_instance_id varchar(255) DEFAULT NULL, - service_type varchar(255) DEFAULT NULL, - global_customer_id varchar(255) DEFAULT NULL, - notification_url varchar(255) DEFAULT NULL, - domain_requests varchar(255) DEFAULT NULL, - PRIMARY KEY (request_id) -) ; - --- --- Table structure for table REQUEST_PROGRESS --- - -CREATE TABLE REQUEST_PROGRESS ( - request_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - request_type varchar(20) DEFAULT NULL, - service_instance_id varchar(80) NOT NULL, - request_instance_type varchar(20) NOT NULL, - originating_service_instance_id varchar(80) DEFAULT NULL, - originating_service_type varchar(20) DEFAULT NULL, - overall_status varchar(20) DEFAULT NULL, - status_date varchar(80) DEFAULT NULL, - message varchar(255) DEFAULT NULL, - PRIMARY KEY (request_id) -) ; - --- --- Table structure for table REQUEST_PROGRESS_STATE --- - -CREATE TABLE REQUEST_PROGRESS_STATE ( - request_progress_state_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - request_id int DEFAULT NULL, - service_instance_id varchar(80) NOT NULL, - request_instance_type varchar(20) NOT NULL, - progress_state varchar(30) DEFAULT NULL, - transaction_status varchar(20) DEFAULT NULL, - status_date varchar(80) DEFAULT NULL, - response_code varchar(20) DEFAULT NULL, - message varchar(255) DEFAULT NULL, - PRIMARY KEY (request_progress_state_id) -) ; - --- --- Table structure for table RESOURCE --- - -CREATE TABLE RESOURCE ( - resource_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - asset_id varchar(100) NOT NULL, - resource_name varchar(50) NOT NULL, - resource_type varchar(5) NOT NULL CONSTRAINT res_ck CHECK(resource_type IN ('Limit','Label','Range')), - lt_used bigint DEFAULT NULL, - ll_label varchar(50) DEFAULT NULL, - ll_reference_count smallint DEFAULT NULL, - rr_used varchar(4000) DEFAULT NULL, - PRIMARY KEY (resource_id) -) ; - --- --- Table structure for table RESOURCE_LOAD --- - -CREATE TABLE RESOURCE_LOAD ( - resource_load_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - resource_id bigint NOT NULL, - application_id varchar(20) NOT NULL, - resource_load_time timestamp NOT NULL, - resource_expiration_time timestamp DEFAULT NULL, - PRIMARY KEY (resource_load_id) -) ; - --- --- Table structure for table RESOURCE_LOCK --- - -CREATE TABLE RESOURCE_LOCK ( - resource_lock_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - resource_name varchar(256) DEFAULT NULL, - lock_holder varchar(100) NOT NULL, - lock_count smallint NOT NULL, - lock_time timestamp NOT NULL, - expiration_time timestamp NOT NULL, - PRIMARY KEY (resource_lock_id) -) ; - --- --- Table structure for table RESOURCE_RULE --- - -CREATE TABLE RESOURCE_RULE ( - resource_rule_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - resource_name varchar(50) NOT NULL, - service_model varchar(50) NOT NULL, - end_point_position varchar(50) NOT NULL, - service_expression varchar(2000) NOT NULL, - equipment_level varchar(50) NOT NULL, - equipment_expression varchar(2000) NOT NULL, - allocation_expression varchar(2000) NOT NULL, - soft_limit_expression varchar(2000) NOT NULL, - hard_limit_expression varchar(2000) NOT NULL, - PRIMARY KEY (resource_rule_id) -) ; - --- --- Table structure for table RESOURCE_THRESHOLD --- - -CREATE TABLE RESOURCE_THRESHOLD ( - resource_threshold_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - resource_rule_id bigint NOT NULL, - threshold_expression varchar(2000) NOT NULL, - threshold_message varchar(2000) NOT NULL, - PRIMARY KEY (resource_threshold_id) -) ; - --- --- Table structure for table ROUTER_MASTER --- - -CREATE TABLE ROUTER_MASTER ( - crs_name varchar(20) NOT NULL, - loopback_ip varchar(20) NOT NULL, - PRIMARY KEY (crs_name) -) ; - --- --- Table structure for table ROUTING_CHARACTERISTIC_MAPPING --- - -CREATE TABLE ROUTING_CHARACTERISTIC_MAPPING ( - network_role varchar(255) NOT NULL, - vrf_name varchar(255) NOT NULL, - routing_characteristic varchar(255) NOT NULL, - PRIMARY KEY (network_role,vrf_name) -) ; - --- --- Table structure for table SERVICE_HOMING --- - -CREATE TABLE SERVICE_HOMING ( - service_type varchar(100) NOT NULL, - lata int NOT NULL, - hubbing_city_type varchar(40) NOT NULL, - latitude float DEFAULT NULL, - longitude float DEFAULT NULL, - primary_aic_site_name varchar(100) NOT NULL, - secondary_aic_site_name varchar(100) DEFAULT NULL, - tertiary_aic_site_name varchar(100) DEFAULT NULL, - PRIMARY KEY (service_type,lata,hubbing_city_type) -) ; - --- --- Table structure for table SERVICE_HOMING_BACKUP --- - -CREATE TABLE SERVICE_HOMING_BACKUP ( - service_type varchar(100) NOT NULL, - lata int NOT NULL, - hubbing_city_type varchar(40) NOT NULL, - latitude float DEFAULT NULL, - longitude float DEFAULT NULL, - primary_aic_site_name varchar(100) NOT NULL, - secondary_aic_site_name varchar(100) DEFAULT NULL, - tertiary_aic_site_name varchar(100) DEFAULT NULL, - PRIMARY KEY (service_type,lata,hubbing_city_type) -) ; - --- --- Table structure for table SERVICE_INSTANCE_NAME_INDEX --- - -CREATE TABLE SERVICE_INSTANCE_NAME_INDEX ( - service_instance_name_prefix varchar(255) NOT NULL, - index_number int NOT NULL, - PRIMARY KEY (service_instance_name_prefix) -) ; - --- --- Table structure for table SERVICE_MANAGER_CREDENTIALS --- - -CREATE TABLE SERVICE_MANAGER_CREDENTIALS ( - service_manager_username varchar(255) NOT NULL, - service_manager_password varchar(255) for bit data NOT NULL, - PRIMARY KEY (service_manager_username) -) ; - --- --- Table structure for table SERVICE_PROXY --- - -CREATE TABLE SERVICE_PROXY ( - port_mirror_service_uuid varchar(255) NOT NULL, - service_proxy_name varchar(255) NOT NULL, - source_service_uuid varchar(255) NOT NULL, - resources_vendor varchar(255) DEFAULT NULL, - resource_vendor_release varchar(255) DEFAULT NULL, - description varchar(255) DEFAULT NULL, - category varchar(255) DEFAULT NULL, - subcategory varchar(255) DEFAULT NULL, - version varchar(255) DEFAULT NULL, - role varchar(255) NOT NULL, - uuid varchar(255) DEFAULT NULL, - customization_uuid varchar(255) DEFAULT NULL, - invariant_uuid varchar(255) DEFAULT NULL, - PRIMARY KEY (port_mirror_service_uuid,service_proxy_name) -) ; - --- --- Table structure for table SERVICE_RESOURCE --- - -CREATE TABLE SERVICE_RESOURCE ( - service_resource_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - service_instance_id varchar(80) NOT NULL, - service_status varchar(7) NOT NULL CONSTRAINT svc_stat_ck CHECK (service_status IN ('Active','Pending')), - service_change_number smallint NOT NULL, - resource_set_id varchar(100) NOT NULL, - resource_union_id varchar(100) NOT NULL, - PRIMARY KEY (service_instance_id,service_change_number) -) ; - --- --- Table structure for table SERVICE_TYPE_MAPPING --- - -CREATE TABLE SERVICE_TYPE_MAPPING ( - sdnc_service_type varchar(128) NOT NULL, - ncs_service_type varchar(128) NOT NULL, - PRIMARY KEY (sdnc_service_type,ncs_service_type) -) ; - --- --- Table structure for table SUBNETPOOL_MAPPING --- - -CREATE TABLE SUBNETPOOL_MAPPING ( - aic_cloud_region varchar(16) NOT NULL, - ntc varchar(32) NOT NULL, - lcp varchar(32) NOT NULL, - aic_region_id varchar(255) NOT NULL, - PRIMARY KEY (aic_cloud_region) -) ; - --- --- Table structure for table SUPPORTED_SEQUENCE_NUMBER --- - -CREATE TABLE SUPPORTED_SEQUENCE_NUMBER ( - resource_sequence_number varchar(10) NOT NULL, - resource_type varchar(10) NOT NULL, - PRIMARY KEY (resource_sequence_number,resource_type) -) ; - --- --- Table structure for table SVC_LOGIC --- - -CREATE TABLE SVC_LOGIC ( - module varchar(80) NOT NULL, - rpc varchar(80) NOT NULL, - version varchar(40) NOT NULL, - mode varchar(5) NOT NULL, - active varchar(1) NOT NULL, - graph blob, - modified_timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - md5sum varchar(128) DEFAULT NULL, - PRIMARY KEY (module,rpc,version,mode) -) ; - --- --- Table structure for table TABLE_CLEANUP_CONFIGURATION --- - -CREATE TABLE TABLE_CLEANUP_CONFIGURATION ( - table_name varchar(255) NOT NULL, - days_old int NOT NULL , - date_column varchar(255) NOT NULL , - commit_interval int NOT NULL DEFAULT 2500 , - query_clause varchar(1000) DEFAULT NULL , - child_table_name varchar(255) DEFAULT NULL, - child_table_pk varchar(255) DEFAULT NULL, - PRIMARY KEY (table_name) -) ; - --- --- Table structure for table TASK_TEMPLATE --- - -CREATE TABLE TASK_TEMPLATE ( - task_template_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - request_type varchar(20) DEFAULT NULL, - task_name varchar(30) NOT NULL, - task_category varchar(50) NOT NULL, - ecomp_task varchar(50) NOT NULL, - initial_load varchar(1) NOT NULL, - service varchar(20) DEFAULT NULL, - PRIMARY KEY (task_template_id) -) ; - --- --- Table structure for table TENANT --- - -CREATE TABLE TENANT ( - tenant_id varchar(255) NOT NULL, - tenant_name varchar(255) NOT NULL, - service_instance_id varchar(255) NOT NULL, - PRIMARY KEY (tenant_id,tenant_name) -) ; - --- --- Table structure for table TESTTBL --- - -CREATE TABLE TESTTBL ( - pk varchar(25) NOT NULL, - col1 varchar(25) DEFAULT NULL -) ; - --- --- Table structure for table THRESHOLD_NOTIFICATION --- - -CREATE TABLE THRESHOLD_NOTIFICATION ( - resource_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - threshold_expression varchar(2000) DEFAULT NULL, - threshold_message varchar(500) DEFAULT NULL, - PRIMARY KEY (resource_id) -) ; - --- --- Table structure for table TMP_AIC_AVAIL_ZONE_POOL --- - -CREATE TABLE TMP_AIC_AVAIL_ZONE_POOL ( - aic_site_id varchar(100) NOT NULL, - status varchar(40) NOT NULL, - availability_zone varchar(100) NOT NULL, - token int NOT NULL, - vnf_id varchar(80) DEFAULT NULL, - service_type varchar(100) NOT NULL, - vnf_type varchar(20) DEFAULT NULL, - hypervisor varchar(10) DEFAULT NULL, - PRIMARY KEY (aic_site_id,availability_zone,token) -) ; - --- --- Table structure for table TOPOLOGY_PARAMETER --- - -CREATE TABLE TOPOLOGY_PARAMETER ( - parameter_id int NOT NULL, - parameter_name varchar(20) NOT NULL, - parameter_set int NOT NULL, - create_update_time timestamp NOT NULL, - create_update_user varchar(40) NOT NULL, - PRIMARY KEY (parameter_id) -) ; - --- --- Table structure for table TOPOLOGY_PARAMETER_ENTRIES --- - -CREATE TABLE TOPOLOGY_PARAMETER_ENTRIES ( - parameter_entry_id int NOT NULL, - parameter_name varchar(255) NOT NULL, - parameter_value varchar(64) NOT NULL, - create_update_time timestamp NOT NULL, - create_update_user varchar(40) NOT NULL, - PRIMARY KEY (parameter_entry_id) -) ; - --- --- Table structure for table TOPOLOGY_PARAMETER_TO_ENTRIES --- - -CREATE TABLE TOPOLOGY_PARAMETER_TO_ENTRIES ( - parameter_id int DEFAULT NULL, - parameter_entry_id int DEFAULT NULL, - entry_order int DEFAULT NULL, - create_update_time timestamp DEFAULT NULL, - create_update_user varchar(40) NOT NULL -) ; - --- --- Table structure for table TOPOLOGY_LOGICAL_RELATION_TO_PINTERFACE --- - -CREATE TABLE TOPOLOGY_LOGICAL_RELATION_TO_PINTERFACE ( - interface_name varchar(255) NOT NULL, - interface_id varchar(255) NOT NULL, - pnf_name varchar(255) NOT NULL, - pnf_id varchar(255) NOT NULL, - controller_id varchar(255) DEFAULT NULL, - rate varchar(255) DEFAULT NULL, - clli varchar(255) DEFAULT NULL, - connection_point varchar(255) DEFAULT NULL, - PRIMARY KEY (interface_name) -) ; - --- --- Table structure for table TRANSACTION_LOG --- - -CREATE TABLE TRANSACTION_LOG ( - serial_key int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - log_time varchar(40) NOT NULL, - request_id varchar(80) DEFAULT NULL, - svc_request_id varchar(80) DEFAULT NULL, - x_ecomp_request_id varchar(80) DEFAULT NULL, - graph_name varchar(255) DEFAULT NULL, - PRIMARY KEY (serial_key) -) ; - - --- --- Table structure for table UPLOAD_CONFIG --- - -CREATE TABLE UPLOAD_CONFIG ( - upload_config_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - request_id varchar(50) DEFAULT NULL, - originator_id varchar(50) DEFAULT NULL, - service_description varchar(100) DEFAULT NULL, - action varchar(50) DEFAULT NULL, - upload_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - vnf_id varchar(50) DEFAULT NULL, - vnf_name varchar(50) DEFAULT NULL, - vm_name varchar(50) DEFAULT NULL, - vnf_type varchar(50) DEFAULT NULL, - vnfc_type varchar(50) DEFAULT NULL, - host_ip_address varchar(50) DEFAULT NULL, - config_indicator varchar(25) DEFAULT NULL, - pending_delete varchar(1) DEFAULT NULL, - content long varchar, - PRIMARY KEY (upload_config_id) -) ; - --- --- Table structure for table USED_SEQUENCE_NUMBER --- - -CREATE TABLE USED_SEQUENCE_NUMBER ( - resource_sequence_number varchar(10) NOT NULL, - resource_type varchar(10) NOT NULL, - zone_region_id varchar(50) NOT NULL, - PRIMARY KEY (resource_sequence_number,resource_type,zone_region_id) -) ; - - --- --- Table structure for table VENDOR_CODE --- - -CREATE TABLE VENDOR_CODE ( - vendor_code varchar(1) NOT NULL, - vendor varchar(45) NOT NULL DEFAULT '', - PRIMARY KEY (vendor_code,vendor) -) ; - --- --- Table structure for table VFC_MODEL --- - -CREATE TABLE VFC_MODEL ( - customization_uuid varchar(255) NOT NULL, - model_yaml blob, - invariant_uuid varchar(255) DEFAULT NULL, - uuid varchar(255) DEFAULT NULL, - version varchar(255) DEFAULT NULL, - naming_policy varchar(255) DEFAULT NULL, - ecomp_generated_naming char(1) DEFAULT NULL, - nfc_function varchar(255) DEFAULT NULL, - nfc_naming_code varchar(255) DEFAULT NULL, - vm_type varchar(255) DEFAULT NULL, - vm_type_tag varchar(255) DEFAULT NULL, - vm_image_name varchar(255) DEFAULT NULL, - vm_flavor_name varchar(255) DEFAULT NULL, - high_availability varchar(255) DEFAULT NULL, - nfc_naming varchar(255) DEFAULT NULL, - min_instances int(11) DEFAULT NULL, - max_instances int(11) DEFAULT NULL, - PRIMARY KEY (customization_uuid) -) ; - --- --- Table structure for table VFC_TO_NETWORK_ROLE_MAPPING --- - -CREATE TABLE VFC_TO_NETWORK_ROLE_MAPPING ( - seq int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - vfc_customization_uuid varchar(255) NOT NULL, - network_role varchar(255) NOT NULL, - vm_type varchar(255) DEFAULT NULL, - network_role_tag varchar(255) DEFAULT NULL, - ipv4_count int(11) NOT NULL, - ipv6_count int(11) NOT NULL, - ipv4_use_dhcp char(1) DEFAULT NULL, - ipv6_use_dhcp char(1) DEFAULT NULL, - ipv4_ip_version char(1) DEFAULT NULL, - ipv6_ip_version char(1) DEFAULT NULL, - extcp_subnetpool_id varchar(512) DEFAULT NULL, - ipv4_floating_count int(11) DEFAULT NULL, - ipv6_floating_count int(11) DEFAULT NULL, - ipv4_address_plan_name varchar(512) DEFAULT NULL, - ipv6_address_plan_name varchar(512) DEFAULT NULL, - ipv4_vrf_name varchar(512) DEFAULT NULL, - ipv6_vrf_name varchar(512) DEFAULT NULL, - subnet_role varchar(255) DEFAULT NULL, - subinterface_indicator char(1) DEFAULT NULL, - PRIMARY KEY (seq) -) ; - --- --- Table structure for table VF_MODEL --- - -CREATE TABLE VF_MODEL ( - customization_uuid varchar(255) NOT NULL, - model_yaml blob, - invariant_uuid varchar(255) DEFAULT NULL, - uuid varchar(255) DEFAULT NULL, - version varchar(255) DEFAULT NULL, - name varchar(255) DEFAULT NULL, - naming_policy varchar(255) DEFAULT NULL, - ecomp_generated_naming char(1) DEFAULT NULL, - avail_zone_max_count int(11) DEFAULT NULL, - nf_function varchar(255) DEFAULT NULL, - nf_code varchar(255) DEFAULT NULL, - nf_type varchar(255) DEFAULT NULL, - nf_role varchar(255) DEFAULT NULL, - vendor varchar(255) DEFAULT NULL, - vendor_version varchar(255) DEFAULT NULL, - sdnc_model_name varchar(255) DEFAULT NULL, - sdnc_model_version varchar(255) DEFAULT NULL, - sdnc_artifact_name varchar(255) DEFAULT NULL, - PRIMARY KEY (customization_uuid) -); - --- --- Table structure for table VF_MODULE_MODEL --- - -CREATE TABLE VF_MODULE_MODEL ( - customization_uuid varchar(255) NOT NULL, - model_yaml longblob, - invariant_uuid varchar(255) DEFAULT NULL, - uuid varchar(255) DEFAULT NULL, - version varchar(255) DEFAULT NULL, - vf_module_type varchar(255) DEFAULT NULL, - availability_zone_count int(11) DEFAULT NULL, - ecomp_generated_vm_assignments char(1) DEFAULT NULL, - vf_customization_uuid varchar(255) DEFAULT NULL, - vf_module_label varchar(255) DEFAULT NULL, - PRIMARY KEY (customization_uuid) -) ; - --- --- Table structure for table VF_MODULE_TO_VFC_MAPPING --- - -CREATE TABLE VF_MODULE_TO_VFC_MAPPING ( - seq int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - vf_module_customization_uuid varchar(255) NOT NULL, - vfc_customization_uuid varchar(255) NOT NULL, - vm_type varchar(255) NOT NULL, - vm_count int(11) NOT NULL, - PRIMARY KEY (seq), -); - --- --- Table structure for table VF_TO_NETWORK_ROLE_MAPPING --- - -CREATE TABLE VF_TO_NETWORK_ROLE_MAPPING ( - seq int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - vf_customization_uuid varchar(255) NOT NULL, - network_role varchar(255) NOT NULL, - PRIMARY KEY (seq) -) ; - --- --- Table structure for table VIPR_CONFIGURATION --- - -CREATE TABLE VIPR_CONFIGURATION ( - seq int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - serial_number varchar(255) DEFAULT NULL, - vnf_id varchar(255) DEFAULT NULL, - vnf_name varchar(255) DEFAULT NULL, - ecomp_service_instance_id varchar(255) DEFAULT NULL, - vm_name varchar(255) DEFAULT NULL, - cloud_region_id varchar(255) DEFAULT NULL, - cloud_owner varchar(255) DEFAULT NULL, - PRIMARY KEY (seq) -) ; - --- --- Table structure for table VIPR_SZ_MANAGER_KEY --- - -CREATE TABLE VIPR_SZ_MANAGER_KEY ( - vipr_sz_manager_ip_addr varchar(40) NOT NULL, - vipr_sz_manager_state varchar(10) DEFAULT NULL, - vipr_sz_manager_api_key varchar(255) DEFAULT NULL, - PRIMARY KEY (vipr_sz_manager_ip_addr) -) ; - --- --- Table structure for table VLAN_ID_POOL --- - -CREATE TABLE VLAN_ID_POOL ( - aic_site_id varchar(100) NOT NULL, - purpose varchar(40) NOT NULL, - status varchar(40) NOT NULL, - vlan_id int NOT NULL, - svc_instance_id varchar(80) DEFAULT NULL, - availability_zone varchar(100) DEFAULT NULL, - vplspe_name varchar(80) DEFAULT NULL, - PRIMARY KEY (vlan_id,aic_site_id,purpose) -) ; - --- --- Table structure for table VLAN_L3INTERFACE_IPV4_ADDRESS --- - -CREATE TABLE VLAN_L3INTERFACE_IPV4_ADDRESS ( - vnf_id varchar(80) NOT NULL, - interface_name varchar(255) NOT NULL, - vlan_interface varchar(255) NOT NULL, - l3_interface_ipv4_address varchar(64) NOT NULL, - l3_interface_ipv4_prefix_length varchar(45) DEFAULT NULL, - vlan_id_inner varchar(45) DEFAULT NULL, - vlan_id_outer varchar(45) DEFAULT NULL, - is_floating varchar(1) DEFAULT NULL, - PRIMARY KEY (vnf_id,interface_name,vlan_interface,l3_interface_ipv4_address) -) ; - --- --- Table structure for table VLAN_L3INTERFACE_IPV6_ADDRESS --- - -CREATE TABLE VLAN_L3INTERFACE_IPV6_ADDRESS ( - vnf_id varchar(80) NOT NULL, - interface_name varchar(255) NOT NULL, - vlan_interface varchar(255) NOT NULL, - l3_interface_ipv6_address varchar(64) NOT NULL, - l3_interface_ipv6_prefix_length varchar(45) DEFAULT NULL, - vlan_id_inner varchar(45) DEFAULT NULL, - vlan_id_outer varchar(45) DEFAULT NULL, - is_floating varchar(1) DEFAULT NULL, - PRIMARY KEY (vnf_id,interface_name,vlan_interface,l3_interface_ipv6_address) -) ; - --- --- Table structure for table VLAN_PLAN_ID --- - -CREATE TABLE VLAN_PLAN_ID ( - plan_type varchar(40) NOT NULL, - purpose varchar(40) NOT NULL, - vlan_plan_id_count int NOT NULL, - PRIMARY KEY (vlan_plan_id_count,plan_type,purpose) -) ; - --- --- Table structure for table VLAN_POOL --- - -CREATE TABLE VLAN_POOL ( - aic_site_id varchar(100) NOT NULL, - availability_zone varchar(100) NOT NULL, - vlan_plan_id varchar(100) NOT NULL, - plan_type varchar(40) NOT NULL, - purpose varchar(40) NOT NULL, - vlan_id int NOT NULL, - status varchar(40) NOT NULL, - reserved_id varchar(80) DEFAULT NULL, - PRIMARY KEY (aic_site_id,availability_zone,vlan_plan_id,plan_type,purpose,vlan_id) -) ; - --- --- Table structure for table VLAN_RANGES --- - -CREATE TABLE VLAN_RANGES ( - vlan_plan_id varchar(100) NOT NULL, - plan_type varchar(40) NOT NULL, - purpose varchar(40) NOT NULL, - range_start int NOT NULL, - range_end int NOT NULL, - generated char(1) DEFAULT NULL, - PRIMARY KEY (vlan_plan_id,plan_type,purpose,range_start,range_end) -) ; - --- --- Table structure for table VM_NAME_INDEX --- - -CREATE TABLE VM_NAME_INDEX ( - vm_name_prefix varchar(255) NOT NULL, - index_number int NOT NULL, - PRIMARY KEY (vm_name_prefix) -) ; - --- --- Table structure for table VM_NETWORKS --- - -CREATE TABLE VM_NETWORKS ( - vnf_type varchar(200) NOT NULL, - vm_type varchar(45) NOT NULL, - network_role varchar(45) NOT NULL, - assign_ips smallint NOT NULL, - assign_macs smallint NOT NULL, - assign_floating_ip smallint NOT NULL, - ip_count int DEFAULT NULL, - PRIMARY KEY (vnf_type,vm_type,network_role) -) ; - --- --- Table structure for table VM_PROFILE --- - -CREATE TABLE VM_PROFILE ( - vnf_type varchar(200) NOT NULL, - vm_type varchar(45) NOT NULL, - vm_count int NOT NULL, - PRIMARY KEY (vnf_type,vm_type) -) ; - --- --- Table structure for table VNF --- - -CREATE TABLE VNF ( - vnf_id varchar(80) NOT NULL, - vnf_name varchar(80) NOT NULL, - vnf_type varchar(10) NOT NULL, - orchestration_status varchar(20) DEFAULT NULL, - heat_stack_id varchar(80) DEFAULT NULL, - mso_catalog_key varchar(80) DEFAULT NULL, - availability_zone varchar(80) DEFAULT NULL, - aic_site_id varchar(80) DEFAULT NULL, - oam_ipv4_address varchar(20) DEFAULT NULL, - vnf_name2 varchar(80) DEFAULT NULL, - vpe_id varchar(80) NOT NULL, - ipv4_loopback0_address varchar(80) DEFAULT NULL, - license_key varchar(256) DEFAULT NULL, - entitlement_resource_uuid varchar(256) DEFAULT NULL, - PRIMARY KEY (vnf_id) -) ; - --- --- Table structure for table VNFC_DG_MAPPING --- - -CREATE TABLE VNFC_DG_MAPPING ( - vnfc_dg_mapping_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - action varchar(50) DEFAULT NULL, - api_version varchar(10) DEFAULT NULL, - vnf_type varchar(50) DEFAULT NULL, - vnfc_type varchar(50) DEFAULT NULL, - dg_name varchar(50) NOT NULL, - dg_version varchar(50) DEFAULT NULL, - dg_module varchar(50) NOT NULL, - PRIMARY KEY (vnfc_dg_mapping_id) -) ; - --- --- Table structure for table VNFC_REFERENCE --- - -CREATE TABLE VNFC_REFERENCE ( - vnfc_reference_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - action varchar(50) NOT NULL, - vnf_type varchar(50) NOT NULL, - vm_instance int NOT NULL, - vnfc_instance int NOT NULL, - vnfc_type varchar(50) NOT NULL, - vnfc_function_code varchar(50) NOT NULL, - ipaddress_v4_oam_vip varchar(50) DEFAULT NULL, - group_notation_type varchar(50) DEFAULT NULL, - group_notation_value varchar(50) DEFAULT NULL, - PRIMARY KEY (vnfc_reference_id) -) ; - --- --- Table structure for table VNF_IMAGE --- - -CREATE TABLE VNF_IMAGE ( - application_vendor varchar(255) NOT NULL, - application_version varchar(255) NOT NULL, - att_uuid varchar(255) NOT NULL, - application varchar(255) DEFAULT NULL, - selflink varchar(255) DEFAULT NULL, - PRIMARY KEY (application_vendor,application_version,att_uuid) -) ; - --- --- Table structure for table VNF_MODEL_LICENSES --- - -CREATE TABLE VNF_MODEL_LICENSES ( - att_part_number varchar(255) NOT NULL, - license_assignment_group varchar(255) NOT NULL, - license_required smallint DEFAULT NULL, - entitlement_assignment_group varchar(255) DEFAULT NULL, - entitlement_required smallint DEFAULT 0, - feature_group_uuid varchar(255) DEFAULT NULL, - PRIMARY KEY (att_part_number,license_assignment_group) -) ; - --- --- Table structure for table VNF_MODEL_LICENSE_FEATURES --- - -CREATE TABLE VNF_MODEL_LICENSE_FEATURES ( - att_part_number varchar(255) NOT NULL, - license_assignment_group varchar(255) NOT NULL, - feature varchar(255) NOT NULL, - PRIMARY KEY (att_part_number,license_assignment_group,feature) -) ; - --- --- Table structure for table VNF_NAME_INDEX --- - -CREATE TABLE VNF_NAME_INDEX ( - vnf_name_prefix varchar(255) NOT NULL, - index_number int NOT NULL, - PRIMARY KEY (vnf_name_prefix) -) ; - --- --- Table structure for table VNF_NETWORKS --- - -CREATE TABLE VNF_NETWORKS ( - vnf_type varchar(200) NOT NULL, - network_role varchar(45) NOT NULL, - PRIMARY KEY (vnf_type,network_role) -) ; - --- --- Table structure for table VNF_NETWORK_CONNECTION --- - -CREATE TABLE VNF_NETWORK_CONNECTION ( - connection_uuid varchar(80) NOT NULL, - vnf_id varchar(80) NOT NULL, - connection_id varchar(80) DEFAULT NULL, - connection_type varchar(20) DEFAULT NULL, - neutron_network_id varchar(80) DEFAULT NULL, - neutron_network_name varchar(80) DEFAULT NULL, - orchestration_status varchar(20) DEFAULT NULL, - switch_id varchar(40) DEFAULT NULL, - heat_stack_id varchar(80) DEFAULT NULL, - mso_catalog_key varchar(80) DEFAULT NULL, - provider_network varchar(80) DEFAULT NULL, - port_group_id varchar(80) DEFAULT NULL, - port_group_name varchar(80) DEFAULT NULL, - PRIMARY KEY (connection_uuid) -) ; - --- --- Table structure for table VNF_NETWORK_CONNECTION_VLAN --- - -CREATE TABLE VNF_NETWORK_CONNECTION_VLAN ( - vlan_uuid varchar(80) NOT NULL, - vlan_id int NOT NULL, - vlan_type varchar(5) NOT NULL, - connection_uuid varchar(80) DEFAULT NULL, - PRIMARY KEY (vlan_uuid) -) ; - --- --- Table structure for table VNF_PROFILE --- - -CREATE TABLE VNF_PROFILE ( - vnf_type varchar(200) NOT NULL, - availability_zone_count int NOT NULL, - equipment_role varchar(80) NOT NULL, - PRIMARY KEY (vnf_type) -) ; - --- --- Table structure for table VNF_SERVICE_TO_NETWORK_ROLE_FILTER --- - -CREATE TABLE VNF_SERVICE_TO_NETWORK_ROLE_FILTER ( - vnf_service_type varchar(60) NOT NULL, - network_role_filter varchar(60) NOT NULL, - PRIMARY KEY (vnf_service_type,network_role_filter) -) ; - --- --- Table structure for table VPE_LOCK --- - -CREATE TABLE VPE_LOCK ( - vpe_name varchar(20) NOT NULL, - vpn_lock varchar(20) NOT NULL, - PRIMARY KEY (vpe_name) -) ; - --- --- Table structure for table VPE_MAC_ADDRESS_POOL --- - -CREATE TABLE VPE_MAC_ADDRESS_POOL ( - id int NOT NULL, - mac_address varchar(50) NOT NULL, - sw_name varchar(30) NOT NULL, - PRIMARY KEY (id) -) ; - --- --- Table structure for table VPE_MAC_ADDRESS_TO_HOSTNAME_MAPPING --- - -CREATE TABLE VPE_MAC_ADDRESS_TO_HOSTNAME_MAPPING ( - id int NOT NULL, - hostname varchar(50) NOT NULL, - assigned_user varchar(25) NOT NULL, - assigned_date date DEFAULT NULL, - PRIMARY KEY (id) -) ; - --- --- Table structure for table VPE_POOL --- - -CREATE TABLE VPE_POOL ( - vpe_name varchar(20) NOT NULL, - ipv4_oam_address varchar(20) NOT NULL, - loopback0_ipv4_address varchar(20) NOT NULL, - provisioning_status varchar(10) NOT NULL, - aic_site_id varchar(100) NOT NULL, - availability_zone varchar(100) NOT NULL, - vlan_id_outer varchar(20) NOT NULL, - vendor varchar(20) NOT NULL, - physical_intf_name varchar(40) NOT NULL, - physical_intf_speed varchar(20) NOT NULL, - physical_intf_units varchar(20) NOT NULL, - vpe_uuid varchar(80) DEFAULT NULL, - vpe_id varchar(80) NOT NULL, - image_filename varchar(100) DEFAULT NULL, - as_number varchar(20) NOT NULL, - loopback5000 varchar(16) DEFAULT NULL, - loopback10 varchar(16) DEFAULT NULL, - aic_version varchar(50) DEFAULT NULL, - vpe_capacity int NOT NULL, - PRIMARY KEY (aic_site_id,vpe_name,availability_zone) -) ; - --- --- Table structure for table VPLSPE_POOL --- - -CREATE TABLE VPLSPE_POOL ( - vplspe_name varchar(20) NOT NULL, - aic_site_id varchar(100) NOT NULL, - availability_zone varchar(100) NOT NULL, - physical_intf_name varchar(40) NOT NULL, - physical_intf_speed varchar(20) NOT NULL, - physical_intf_units varchar(20) NOT NULL, - loopback0_ipv4_address varchar(20) NOT NULL, - vlan_id_outer varchar(20) NOT NULL, - vplspe_uuid varchar(80) DEFAULT NULL, - image_filename varchar(100) DEFAULT NULL, - provisioning_status varchar(10) DEFAULT NULL, - vendor varchar(20) DEFAULT NULL, - PRIMARY KEY (vplspe_name,aic_site_id,availability_zone,physical_intf_name) -) ; - --- --- Table structure for table VPN_BINDINGS --- - -CREATE TABLE VPN_BINDINGS ( - network_customization_uuid varchar(255) NOT NULL, - binding_uuid varchar(255) NOT NULL, - PRIMARY KEY (network_customization_uuid,binding_uuid) -) ; - --- --- Table structure for table VRR_FUNCTION_CODE_VMTYPE_MAPPING --- - -CREATE TABLE VRR_FUNCTION_CODE_VMTYPE_MAPPING ( - ptnii_function_code varchar(128) NOT NULL, - vm_type varchar(128) NOT NULL, - PRIMARY KEY (ptnii_function_code,vm_type) -) ; - --- --- Table structure for table VSERVER --- - -CREATE TABLE VSERVER ( - tenant_id varchar(40) NOT NULL, - vserver_id varchar(40) NOT NULL, - aic_site_id varchar(100) NOT NULL, - vendor varchar(20) NOT NULL, - image_name varchar(100) NOT NULL, - vnf_type varchar(10) NOT NULL, - vnf_id varchar(80) NOT NULL, - PRIMARY KEY (tenant_id,vserver_id) -) ; - --- --- Table structure for table VSERVER2 --- - -CREATE TABLE VSERVER2 ( - tenant_id varchar(255) NOT NULL, - vserver_id varchar(128) NOT NULL, - vserver_name varchar(255) NOT NULL, - vserver_name2 varchar(255) DEFAULT NULL, - prov_status varchar(20) DEFAULT NULL, - selflink varchar(255) DEFAULT NULL, - PRIMARY KEY (tenant_id,vserver_id) -) ; - --- --- Table structure for table VSERVER_PSERVER --- - -CREATE TABLE VSERVER_PSERVER ( - vserver_id varchar(128) NOT NULL, - pserver_hostname varchar(255) DEFAULT NULL, - PRIMARY KEY (vserver_id) -) ; - --- --- Table structure for table VVIG_VM_INSTANCE_TO_CLOUD_REGION_MAPPING --- - -CREATE TABLE VVIG_VM_INSTANCE_TO_CLOUD_REGION_MAPPING ( - key_id varchar(128) NOT NULL, - cloud_region varchar(128) NOT NULL, - key_type varchar(128) NOT NULL, - PRIMARY KEY (key_id,cloud_region,key_type) -) ; - --- --- Table structure for table WAN_COMBO_ALLOWABLE --- - -CREATE TABLE WAN_COMBO_ALLOWABLE ( - combo_sequence int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - topology varchar(16) DEFAULT 'unknown', - internet_topology varchar(20) DEFAULT NULL, - wan1 varchar(40) DEFAULT NULL, - wan2 varchar(40) DEFAULT NULL, - new_start_release_flexware varchar(16) DEFAULT 'unknown', - is_active_flexware varchar(1) DEFAULT 'N', - new_start_release_dhv varchar(16) DEFAULT 'unknown', - is_active_dhv varchar(1) DEFAULT 'N', - ucpe_type varchar(32) DEFAULT 'stand-alone', - description varchar(128) NOT NULL, - PRIMARY KEY (combo_sequence) -) ; - -CREATE TABLE DHCP_MAP ( - mac_addr varchar(128) NOT NULL, - ip_addr varchar(128) DEFAULT NULL, - PRIMARY KEY (mac_addr) -) ; - -CREATE TABLE RESOURCE_GROUP_TO_TARGET_NODE_MAPPING ( - group_uuid varchar(255) NOT NULL, - parent_uuid varchar(255) NOT NULL, - target_node_uuid varchar(255) NOT NULL, - target_type varchar(255) , - table_name varchar(255) , - PRIMARY KEY (group_uuid, parent_uuid, target_node_uuid) -) ; - - - -CREATE TABLE ATTRIBUTE_VALUE_PAIR ( - resource_uuid varchar(255) NOT NULL, - attribute_name varchar(255) NOT NULL, - resource_type varchar(255) NOT NULL, - attribute_value varchar(255) DEFAULT NULL, - resource_customization_uuid varchar(255) DEFAULT NULL, - PRIMARY KEY (resource_uuid,attribute_name,resource_type) -) ; - -CREATE TABLE COMPLEX_RESOURCE ( - uuid varchar(255) NOT NULL, - model_yaml blob, - invariant_uuid varchar(255) NOT NULL, - customization_uuid varchar(255) NOT NULL, - version varchar(255) DEFAULT NULL, - name varchar(255) DEFAULT NULL, - description varchar(255) DEFAULT NULL, - type varchar(255) NOT NULL, - PRIMARY KEY (uuid,customization_uuid) -) ; - -CREATE TABLE NODE_CAPABILITY ( - capability_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - capability_provider_uuid varchar(255) NOT NULL, - capability_provider_customization_uuid varchar(255) NOT NULL, - capability_name varchar(255) DEFAULT NULL, - capability_type varchar(255) DEFAULT NULL, - PRIMARY KEY (capability_id) -) ; - -CREATE TABLE NODE_REQUIREMENT ( - requirement_id int NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1), - capability_id int DEFAULT NULL, - capability_provider_uuid varchar(255) DEFAULT NULL, - capability_provider_customization_uuid varchar(255) DEFAULT NULL, - capability_consumer_uuid varchar(255) NOT NULL, - capability_consumer_customization_uuid varchar(255) NOT NULL, - requirement_name varchar(255) NOT NULL, - PRIMARY KEY (requirement_id) -) ; - -CREATE TABLE RELATED_NETWORK_ROLE ( - network_model_customization_uuid varchar(255) NOT NULL, - related_network_role varchar(255) NOT NULL, - PRIMARY KEY (network_model_customization_uuid,related_network_role) -) ; - -CREATE TABLE RESOURCE_GROUP ( - resource_uuid varchar(255) NOT NULL, - group_uuid varchar(255) NOT NULL, - group_customization_uuid varchar(255) DEFAULT NULL, - group_invariant_uuid varchar(255) NOT NULL, - group_name varchar(255) DEFAULT NULL, - version varchar(255) DEFAULT NULL, - group_type varchar(255) DEFAULT NULL, - PRIMARY KEY (resource_uuid,group_uuid) -) ; - -CREATE TABLE RESOURCE_POLICY ( - resource_uuid varchar(255) NOT NULL, - policy_uuid varchar(255) NOT NULL, - policy_customization_uuid varchar(255) DEFAULT NULL, - policy_invariant_uuid varchar(255) NOT NULL, - policy_name varchar(255) DEFAULT NULL, - version varchar(255) DEFAULT NULL, - policy_type varchar(255) DEFAULT NULL, - property_type varchar(255) DEFAULT NULL, - property_source varchar(255) DEFAULT NULL, - property_name varchar(255) DEFAULT NULL, - PRIMARY KEY (resource_uuid,policy_uuid) -) ; - -CREATE TABLE RESOURCE_POLICY_TO_TARGET_NODE_MAPPING ( - policy_uuid varchar(255) NOT NULL, - parent_uuid varchar(255) NOT NULL, - target_node_uuid varchar(255) NOT NULL, - target_type varchar(255) DEFAULT NULL, - target_node_customization_uuid varchar(255) DEFAULT NULL, - policy_customization_uuid varchar(255) DEFAULT NULL, - PRIMARY KEY (policy_uuid,parent_uuid,target_node_uuid) -) ; - - -CREATE TABLE SERVICE_MODEL_TO_COMPLEX_RESOURCE_MAPPING ( - service_uuid varchar(255) NOT NULL, - complex_resource_uuid varchar(255) NOT NULL, - complex_resource_customization_uuid varchar(255) NOT NULL, - PRIMARY KEY (service_uuid,complex_resource_uuid,complex_resource_customization_uuid) -) ; - -CREATE TABLE VFC_RELATED_NETWORK_ROLE ( - vfc_customization_uuid varchar(255) NOT NULL, - vm_type varchar(255) NOT NULL, - network_role varchar(255) NOT NULL, - related_network_role varchar(255) NOT NULL, - PRIMARY KEY (vfc_customization_uuid,vm_type,network_role,related_network_role) -) ; - -CREATE TABLE VNF_RELATED_NETWORK_ROLE ( - vnf_customization_uuid varchar(255) NOT NULL, - network_role varchar(255) NOT NULL, - related_network_role varchar(255) NOT NULL, - PRIMARY KEY (vnf_customization_uuid,network_role,related_network_role) -) ; - -CREATE TABLE CONFIG_GRA_SERVICES ( - svcInstanceId varchar(255) not null, - serviceStatusAction varchar(255), - serviceStatusFinalIndicator varchar(255), - serviceStatusRequestStatus varchar(255), - serviceStatusResponseCode varchar(255), - serviceStatusResponseMessage varchar(255), - serviceStatusResponseTimestamp varchar(255), - serviceStatusRpcAction varchar(255), - serviceStatusRpcName varchar(255), - svcData clob, primary key (svcInstanceId) -) ; - -CREATE TABLE OPERATIONAL_GRA_SERVICES ( - svcInstanceId varchar(255) not null, - serviceStatusAction varchar(255), - serviceStatusFinalIndicator varchar(255), - serviceStatusRequestStatus varchar(255), - serviceStatusResponseCode varchar(255), - serviceStatusResponseMessage varchar(255), - serviceStatusResponseTimestamp varchar(255), - serviceStatusRpcAction varchar(255), - serviceStatusRpcName varchar(255), - svcData clob, - primary key (svcInstanceId) -) ; - -CREATE TABLE CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS ( - configurationId varchar(255) not null, - portMirrorConfigurationStatusAction varchar(255), - portMirrorConfigurationStatusFinalIndicator varchar(255), - portMirrorConfigurationStatusRequestStatus varchar(255), - portMirrorConfigurationStatusResponseCode varchar(255), - portMirrorConfigurationStatusResponseMessage varchar(255), - portMirrorConfigurationStatusResponseTimestamp varchar(255), - portMirrorConfigurationStatusRpcAction varchar(255), - portMirrorConfigurationStatusRpcName varchar(255), - pmcData clob, primary key (configurationId) -) ; - -CREATE TABLE OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS ( - configurationId varchar(255) not null, - portMirrorConfigurationStatusAction varchar(255), - portMirrorConfigurationStatusFinalIndicator varchar(255), - portMirrorConfigurationStatusRequestStatus varchar(255), - portMirrorConfigurationStatusResponseCode varchar(255), - portMirrorConfigurationStatusResponseMessage varchar(255), - portMirrorConfigurationStatusResponseTimestamp varchar(255), - portMirrorConfigurationStatusRpcAction varchar(255), - portMirrorConfigurationStatusRpcName varchar(255), - pmcData clob, - primary key (configurationId) -) ; - -CREATE TABLE CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES ( - allottedResourceId varchar(255) not null, - allottedResourceStatusAction varchar(255), - allottedResourceStatusFinalIndicator varchar(255), - allottedResourceStatusRequestStatus varchar(255), - allottedResourceStatusResponseCode varchar(255), - allottedResourceStatusResponseMessage varchar(255), - allottedResourceStatusResponseTimestamp varchar(255), - allottedResourceStatusRpcAction varchar(255), - allottedResourceStatusRpcName varchar(255), - arData clob, primary key (allottedResourceId) -) ; - -CREATE TABLE OPERATIONAL_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES ( - allottedResourceId varchar(255) not null, - allottedResourceStatusAction varchar(255), - allottedResourceStatusFinalIndicator varchar(255), - allottedResourceStatusRequestStatus varchar(255), - allottedResourceStatusResponseCode varchar(255), - allottedResourceStatusResponseMessage varchar(255), - allottedResourceStatusResponseTimestamp varchar(255), - allottedResourceStatusRpcAction varchar(255), - allottedResourceStatusRpcName varchar(255), - arData clob, - primary key (allottedResourceId) -) ; diff --git a/ms/generic-resource-api/src/main/resources/startGra.sh b/ms/generic-resource-api/src/main/resources/startGra.sh index 4507c43..e007a52 100644 --- a/ms/generic-resource-api/src/main/resources/startGra.sh +++ b/ms/generic-resource-api/src/main/resources/startGra.sh @@ -67,7 +67,7 @@ then fi if [ ! -f ${SDNC_CERT_DIR}/${TRUSTSTORE} ]; then - echo "${SDNC_CERT_DIR}/${TRUSTSTORE} not found ... cannot install ONAP CA certs" + echo "${SDNC_CERT_DIR}/${TRUSTSTORE} not found ... skipping ONAP CA cert installation" elif [ -z "$TRUSTSTORE_PASSWORD" ]; then echo "TRUSTSTORE_PASSWORD unset - cannot install ONAP CA certs" else diff --git a/ms/generic-resource-api/src/main/resources/svclogic.properties b/ms/generic-resource-api/src/main/resources/svclogic.properties index 55e5b1f..8e49400 100644 --- a/ms/generic-resource-api/src/main/resources/svclogic.properties +++ b/ms/generic-resource-api/src/main/resources/svclogic.properties @@ -20,10 +20,10 @@ ### org.onap.ccsdk.sli.dbtype = jdbc -org.onap.ccsdk.sli.jdbc.url=jdbc:mariadb://dbhost:3306/gradb +org.onap.ccsdk.sli.jdbc.url=jdbc:mariadb://dbhost:3306/${MYSQL_DATABASE} org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver -org.onap.ccsdk.sli.jdbc.database = gradb -org.onap.ccsdk.sli.jdbc.user = gra -org.onap.ccsdk.sli.jdbc.password = test123 +org.onap.ccsdk.sli.jdbc.database = ${MYSQL_DATABASE} +org.onap.ccsdk.sli.jdbc.user = ${MYSQL_USER} +org.onap.ccsdk.sli.jdbc.password = ${MYSQL_PASSWORD} sliapi.serviceLogicDirectory=/opt/onap/sdnc/svclogic/graphs |