diff options
Diffstat (limited to 'asdc-controller/src')
5 files changed, 224 insertions, 79 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index c9d4f4d92f..e084cfec18 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -39,6 +39,9 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Paths; import java.util.List; import java.util.Optional; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.so.asdc.util.ZipParser; import org.onap.so.logger.LoggingAnchor; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.sdc.api.IDistributionClient; @@ -737,6 +740,7 @@ public class ASDCController { protected void processResourceNotification(INotificationData iNotif) { // For each artifact, create a structure describing the VFModule in a ordered flat level + ResourceStructure resourceStructure = null; String msoConfigPath = getMsoConfigPath(); ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure(msoConfigPath); DistributionStatusEnum deployStatus = DistributionStatusEnum.DEPLOY_OK; @@ -748,8 +752,8 @@ public class ASDCController { if (isCsarAlreadyDeployed(iNotif, toscaResourceStructure)) { return; } - - ResourceStructure resourceStructure = null; + // process NsstResource + this.processNsstNotification(iNotif, toscaResourceStructure); for (IResourceInstance resource : iNotif.getResources()) { String resourceType = resource.getResourceType(); @@ -914,6 +918,23 @@ public class ASDCController { "processCsarServiceArtifacts", ErrorCode.BusinessProcessError.getValue(), "Exception in processCsarServiceArtifacts", e); } + } else if (artifact.getArtifactType().equals(ASDCConfiguration.OTHER)) { + try { + IDistributionClientDownloadResult resultArtifact = + this.downloadTheArtifact(artifact, iNotif.getDistributionID()); + + writeArtifactToFile(artifact, resultArtifact); + + toscaResourceStructure.setToscaArtifact(artifact); + + toscaResourceStructure.setServiceVersion(iNotif.getServiceVersion()); + + } catch (ASDCDownloadException e) { + logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), + "Exception caught during processCsarServiceArtifacts", "ASDC", + "processCsarServiceArtifacts", ErrorCode.BusinessProcessError.getValue(), + "Exception in processCsarServiceArtifacts", e); + } } @@ -940,4 +961,38 @@ public class ASDCController { } return UNKNOWN; } + + private void processNsstNotification(INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) { + Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata(); + try { + if (serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY).equalsIgnoreCase("NSST")) { + + String artifactContent = null; + List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts(); + Optional<IArtifactInfo> artifactOpt = serviceArtifacts.stream() + .filter(e -> e.getArtifactType().equalsIgnoreCase("OTHER")).findFirst(); + if (artifactOpt.isPresent()) { + IArtifactInfo artifactInfo = artifactOpt.get(); + logger.debug("Ready to parse this serviceArtifactUUID: " + artifactInfo.getArtifactUUID()); + String filePath = Paths.get(getMsoConfigPath(), "ASDC", artifactInfo.getArtifactVersion(), + artifactInfo.getArtifactName()).normalize().toString(); + ZipParser zipParserInstance = ZipParser.getInstance(); + artifactContent = zipParserInstance.parseJsonForZip(filePath); + logger.debug( + "serviceArtifact parsing success! serviceArtifactUUID: " + artifactInfo.getArtifactUUID()); + } else { + logger.debug("serviceArtifact is null"); + } + ResourceStructure resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance()); + resourceStructure.setResourceType(ResourceType.OTHER); + toscaInstaller.installTheNsstService(toscaResourceStructure, (VfResourceStructure) resourceStructure, + artifactContent); + } + } catch (IOException e) { + logger.error("serviceArtifact parse failure for service uuid: " + + serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)); + } catch (Exception e) { + logger.error("error NSST process resource failure ", e); + } + } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 263118d1b3..1c7ebb7d9a 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -54,6 +54,7 @@ import org.onap.sdc.tosca.parser.enums.EntityTemplateType; import org.onap.sdc.tosca.parser.enums.SdcTypes; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; import org.onap.sdc.toscaparser.api.CapabilityAssignment; +import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.Property; import org.onap.sdc.toscaparser.api.RequirementAssignment; import org.onap.sdc.toscaparser.api.elements.Metadata; @@ -74,64 +75,8 @@ import org.onap.so.asdc.installer.VfModuleStructure; import org.onap.so.asdc.installer.VfResourceStructure; import org.onap.so.asdc.installer.bpmn.WorkflowResource; import org.onap.so.asdc.util.YamlEditor; -import org.onap.so.db.catalog.beans.AllottedResource; -import org.onap.so.db.catalog.beans.AllottedResourceCustomization; -import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; -import org.onap.so.db.catalog.beans.CollectionResource; -import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; -import org.onap.so.db.catalog.beans.ConfigurationResource; -import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; -import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; -import org.onap.so.db.catalog.beans.CvnfcCustomization; -import org.onap.so.db.catalog.beans.HeatEnvironment; -import org.onap.so.db.catalog.beans.HeatFiles; -import org.onap.so.db.catalog.beans.HeatTemplate; -import org.onap.so.db.catalog.beans.HeatTemplateParam; -import org.onap.so.db.catalog.beans.InstanceGroup; -import org.onap.so.db.catalog.beans.InstanceGroupType; -import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; -import org.onap.so.db.catalog.beans.NetworkInstanceGroup; -import org.onap.so.db.catalog.beans.NetworkResource; -import org.onap.so.db.catalog.beans.NetworkResourceCustomization; -import org.onap.so.db.catalog.beans.PnfResource; -import org.onap.so.db.catalog.beans.PnfResourceCustomization; -import org.onap.so.db.catalog.beans.Service; -import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; -import org.onap.so.db.catalog.beans.SubType; -import org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup; -import org.onap.so.db.catalog.beans.ToscaCsar; -import org.onap.so.db.catalog.beans.VFCInstanceGroup; -import org.onap.so.db.catalog.beans.VfModule; -import org.onap.so.db.catalog.beans.VfModuleCustomization; -import org.onap.so.db.catalog.beans.VnfResource; -import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.onap.so.db.catalog.beans.VnfcCustomization; -import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; -import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; -import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; -import org.onap.so.db.catalog.data.repository.CollectionResourceCustomizationRepository; -import org.onap.so.db.catalog.data.repository.CollectionResourceRepository; -import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository; -import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository; -import org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository; -import org.onap.so.db.catalog.data.repository.ExternalServiceToInternalServiceRepository; -import org.onap.so.db.catalog.data.repository.HeatEnvironmentRepository; -import org.onap.so.db.catalog.data.repository.HeatFilesRepository; -import org.onap.so.db.catalog.data.repository.HeatTemplateRepository; -import org.onap.so.db.catalog.data.repository.InstanceGroupRepository; -import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository; -import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; -import org.onap.so.db.catalog.data.repository.PnfCustomizationRepository; -import org.onap.so.db.catalog.data.repository.PnfResourceRepository; -import org.onap.so.db.catalog.data.repository.ServiceProxyResourceCustomizationRepository; -import org.onap.so.db.catalog.data.repository.ServiceRepository; -import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository; -import org.onap.so.db.catalog.data.repository.ToscaCsarRepository; -import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; -import org.onap.so.db.catalog.data.repository.VFModuleRepository; -import org.onap.so.db.catalog.data.repository.VnfResourceRepository; -import org.onap.so.db.catalog.data.repository.VnfcCustomizationRepository; -import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository; +import org.onap.so.db.catalog.beans.*; +import org.onap.so.db.catalog.data.repository.*; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.beans.WatchdogDistributionStatus; import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup; @@ -271,6 +216,9 @@ public class ToscaResourceInstaller { protected PnfCustomizationRepository pnfCustomizationRepository; @Autowired + protected ServiceInfoRepository serviceInfoRepository; + + @Autowired protected WorkflowResource workflowResource; @Autowired @@ -445,6 +393,7 @@ public class ToscaResourceInstaller { createToscaCsar(toscaResourceStruct); createService(toscaResourceStruct, vfResourceStruct); Service service = toscaResourceStruct.getCatalogService(); + ServiceInfo serviceInfo = createServiceInfo(toscaResourceStruct, service); List<IEntityDetails> vfEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); @@ -474,8 +423,9 @@ public class ToscaResourceInstaller { processServiceProxyAndConfiguration(toscaResourceStruct, service); logger.info("Saving Service: {} ", service.getModelName()); - service = serviceRepo.save(service); - correlateConfigCustomResources(service); + ServiceInfo serviceResult = serviceInfoRepository.save(serviceInfo); + Service resultService = serviceResult.getService(); + correlateConfigCustomResources(resultService); workflowResource.processWorkflows(vfResourceStructure); @@ -1347,6 +1297,9 @@ public class ToscaResourceInstaller { heatTemplate.setParameters(heatParam); vfModuleArtifact.setHeatTemplate(heatTemplate); } else { + if (vfModuleArtifact.getArtifactInfo().getArtifactTimeout() != null) { + existingHeatTemplate.setTimeoutMinutes(vfModuleArtifact.getArtifactInfo().getArtifactTimeout()); + } vfModuleArtifact.setHeatTemplate(existingHeatTemplate); } } @@ -2912,5 +2865,122 @@ public class ToscaResourceInstaller { return new Timestamp(new Date().getTime()); } + private String getServiceInput(ToscaResourceStructure toscaResourceStructure) { + String serviceInput = null; + + List<Object> serviceInputList; + ISdcCsarHelper sdcCsarHelper = toscaResourceStructure.getSdcCsarHelper(); + List<Input> serviceInputs = sdcCsarHelper.getServiceInputs(); + if (!serviceInputs.isEmpty()) { + serviceInputList = new ArrayList<>(); + serviceInputs.forEach(input -> { + Map<String, Object> serviceInputMap = new HashMap<>(); + serviceInputMap.put("name", input.getName()); + serviceInputMap.put("type", input.getType()); + serviceInputMap.put("default", input.getDefault() == null ? "" : input.getDefault()); + serviceInputMap.put("required", input.isRequired()); + serviceInputList.add(serviceInputMap); + + }); + ObjectMapper objectMapper = new ObjectMapper(); + try { + serviceInput = objectMapper.writeValueAsString(serviceInputList); + serviceInput = serviceInput.replace("\"", "\\\""); + } catch (JsonProcessingException e) { + logger.error("service input could not be deserialized for service uuid: " + + sdcCsarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + } + } else { + logger.debug("serviceInput is null"); + } + return serviceInput; + } + + @Transactional(rollbackFor = {ArtifactInstallerException.class}) + public void installTheNsstService(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStruct, + String artifactContent) { + createToscaCsar(toscaResourceStruct); + createService(toscaResourceStruct, vfResourceStruct); + Service service = toscaResourceStruct.getCatalogService(); + ServiceInfo serviceInfo = createServiceInfo(toscaResourceStruct, service); + createServiceArtifact(service, vfResourceStruct, artifactContent); + serviceInfoRepository.save(serviceInfo); + } + + private void createServiceArtifact(Service service, VfResourceStructure vfResourceStruct, String artifactContent) { + List<ServiceArtifact> serviceArtifactList = new ArrayList<>(); + ServiceArtifact serviceArtifact; + List<IArtifactInfo> artifactInfoList = vfResourceStruct.getNotification().getServiceArtifacts().stream() + .filter(artifact -> artifact.getArtifactType().equalsIgnoreCase("OTHER")).collect(Collectors.toList()); + for (IArtifactInfo artifactInfo : artifactInfoList) { + serviceArtifact = new ServiceArtifact(); + serviceArtifact.setArtifactUUID(artifactInfo.getArtifactUUID()); + serviceArtifact.setName(artifactInfo.getArtifactName()); + serviceArtifact.setType(artifactInfo.getArtifactType()); + serviceArtifact.setVersion(artifactInfo.getArtifactVersion()); + serviceArtifact.setDescription(artifactInfo.getArtifactDescription()); + serviceArtifact.setChecksum(artifactInfo.getArtifactChecksum()); + serviceArtifact.setContent(artifactContent); + serviceArtifact.setService(service); + serviceArtifactList.add(serviceArtifact); + } + service.setServiceArtifactList(serviceArtifactList); + } + + private ServiceInfo createServiceInfo(ToscaResourceStructure toscaResourceStruct, Service service) { + ServiceInfo serviceInfo = new ServiceInfo(); + String serviceInput = getServiceInput(toscaResourceStruct); + serviceInfo.setServiceInput(serviceInput); + + String serviceProperties = getServiceProperties(toscaResourceStruct); + serviceInfo.setServiceProperties(serviceProperties); + + serviceInfo.setService(service); + return serviceInfo; + } + + private String getServiceProperties(ToscaResourceStructure toscaResourceStruct) { + String propertiesJson = null; + ObjectMapper objectMapper = new ObjectMapper(); + ISdcCsarHelper helper = toscaResourceStruct.getSdcCsarHelper(); + String typeName = helper.getServiceSubstitutionMappingsTypeName(); + Optional<NodeTemplate> nodeTemplate = helper.getServiceNodeTemplates().stream().findAny(); + List<Object> serviceProperties = new ArrayList<>(); + Map<String, Object> servicePropertiesMap; + if (nodeTemplate.isPresent()) { + LinkedHashMap<String, Object> customDef = nodeTemplate.get().getCustomDef(); + Optional<String> machKey = + customDef.keySet().stream().filter(key -> key.equalsIgnoreCase(typeName)).findFirst(); + if (machKey.isPresent()) { + Object obj = customDef.get(machKey.get()); + try { + if (obj instanceof Map) { + Object properties = ((HashMap) obj).get("properties"); + if (null != properties) { + for (Object propertyName : ((Map) properties).keySet()) { + servicePropertiesMap = new HashMap<>(); + servicePropertiesMap.put("name", propertyName); + Object object = ((Map) properties).get(propertyName); + for (Object entry : ((Map) object).entrySet()) { + servicePropertiesMap.put((String) ((Map.Entry) entry).getKey(), + ((Map.Entry) entry).getValue()); + } + servicePropertiesMap.remove("description"); + serviceProperties.add(servicePropertiesMap); + } + propertiesJson = objectMapper.writeValueAsString(serviceProperties); + propertiesJson = propertiesJson.replace("\"", "\\\""); + } + } + } catch (JsonProcessingException e) { + logger.error("serviceProperties could not be deserialized for service uuid: " + + nodeTemplate.get().getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + } + } + } else { + logger.debug("ServiceNodeTemplates is null"); + } + return propertiesJson; + } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index c25c4c2828..b8a2d01b49 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -75,19 +75,8 @@ import org.onap.so.asdc.installer.ToscaResourceStructure; import org.onap.so.asdc.installer.VfModuleStructure; import org.onap.so.asdc.installer.VfResourceStructure; import org.onap.so.asdc.installer.bpmn.WorkflowResource; -import org.onap.so.db.catalog.beans.ConfigurationResource; -import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; -import org.onap.so.db.catalog.beans.Service; -import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; -import org.onap.so.db.catalog.beans.ToscaCsar; -import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; -import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository; -import org.onap.so.db.catalog.data.repository.InstanceGroupRepository; -import org.onap.so.db.catalog.data.repository.ServiceRepository; -import org.onap.so.db.catalog.data.repository.ToscaCsarRepository; -import org.onap.so.db.catalog.data.repository.VFModuleRepository; -import org.onap.so.db.catalog.data.repository.VnfResourceRepository; -import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository; +import org.onap.so.db.catalog.beans.*; +import org.onap.so.db.catalog.data.repository.*; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -325,8 +314,6 @@ public class ToscaResourceInstallerTest extends BaseTest { notificationData.setServiceUUID("serviceUUID1"); notificationData.setWorkloadContext("workloadContext1"); - - String serviceType = "test-type1"; String serviceRole = "test-role1"; String category = "Network L3+"; @@ -356,6 +343,7 @@ public class ToscaResourceInstallerTest extends BaseTest { doReturn(resourceCustomizationUUID).when(metadata).getValue("vfModuleModelCustomizationUUID"); ServiceRepository serviceRepo = spy(ServiceRepository.class); + ServiceInfoRepository serviceInfoRepo = spy(ServiceInfoRepository.class); VnfResourceRepository vnfRepo = spy(VnfResourceRepository.class); doReturn(null).when(vnfRepo).findResourceByModelUUID(uuid); @@ -366,6 +354,7 @@ public class ToscaResourceInstallerTest extends BaseTest { WorkflowResource workflowResource = spy(WorkflowResource.class); ReflectionTestUtils.setField(toscaInstaller, "serviceRepo", serviceRepo); + ReflectionTestUtils.setField(toscaInstaller, "serviceInfoRepository", serviceInfoRepo); ReflectionTestUtils.setField(toscaInstaller, "vnfRepo", vnfRepo); ReflectionTestUtils.setField(toscaInstaller, "vfModuleRepo", vfModuleRepo); ReflectionTestUtils.setField(toscaInstaller, "instanceGroupRepo", instanceGroupRepo); @@ -436,7 +425,10 @@ public class ToscaResourceInstallerTest extends BaseTest { assertNotNull(service); service.setModelVersion("1.0"); + ServiceInfo serviceInfo = new ServiceInfo(); + serviceInfo.setService(service); doReturn(service).when(serviceRepo).save(service); + doReturn(serviceInfo).when(serviceInfoRepo).save(any(ServiceInfo.class)); WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository = spy(WatchdogComponentDistributionStatusRepository.class); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java index 53d163a5bc..02c0f2dbf7 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index 0821ebc97c..d051d1a56c 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -1378,6 +1378,34 @@ CREATE TABLE IF NOT EXISTS `activity_spec_to_user_parameters` ( ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; +CREATE TABLE IF NOT EXISTS `service_info` ( + `ID` int (11) AUTO_INCREMENT, + `SERVICE_INPUT` varchar (5000), + `SERVICE_PROPERTIES` varchar (5000), + PRIMARY KEY (`ID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `service_artifact`( + `ARTIFACT_UUID` varchar (200) NOT NULL, + `TYPE` varchar (200) NOT NULL, + `NAME` varchar (200) NOT NULL, + `VERSION` varchar (200) NOT NULL, + `DESCRIPTION` varchar (200) DEFAULT NULL, + `CONTENT` LONGTEXT DEFAULT NULL, + `CHECKSUM` varchar (200) DEFAULT NULL, + `CREATION_TIMESTAMP` DATETIME DEFAULT CURRENT_TIMESTAMP, + `SERVICE_MODEL_UUID` varchar (200) NOT NULL, + PRIMARY KEY (`ARTIFACT_UUID`), + CONSTRAINT `fk_service_artifact_service_info1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `service_to_service_info` ( + `SERVICE_MODEL_UUID` varchar (200) NOT NULL, + `SERVICE_INFO_ID` INT (11) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`SERVICE_INFO_ID`), + CONSTRAINT `fk_service_to_service_info__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_service_to_service_info__service_info1` FOREIGN KEY (`SERVICE_INFO_ID`) REFERENCES `service_info` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE +)ENGINE=InnoDB DEFAULT CHARSET=latin1; --------START Request DB SCHEMA -------- CREATE DATABASE requestdb; |