diff options
author | 2017-10-04 16:58:38 -0400 | |
---|---|---|
committer | 2017-10-04 17:04:45 -0400 | |
commit | 70eb2ae5c2f87511a34aeab170b13a7d3bdae66a (patch) | |
tree | 0f62b63ff3b8578b6844f757f77cac33d6f0178a /ueb-listener/src | |
parent | 0df357bc4d684d13029d702312995659373fc711 (diff) |
Test TOSCA table insertion
Add code to create TOSCA tables in test driver to test TOSCA table
insertion in ueb-listener TOSCA parser test.
Change-Id: Ib8c3fcdb25fbdba39b4700553d8c01b684efa384
Issue-ID: CCSDK-102
Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'ueb-listener/src')
6 files changed, 141 insertions, 4 deletions
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncArtifactMap.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncArtifactMap.java index 3605465d..671d47a9 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncArtifactMap.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncArtifactMap.java @@ -8,9 +8,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. @@ -104,6 +104,8 @@ public class SdncArtifactMap { LOG.error("Caught exception reading artifact map", e); return; } + } else { + LOG.info("Artifact map {} does not exist or is not readable", fileName); } } diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java index 2cc08e1a..67e042b5 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java @@ -561,7 +561,7 @@ public class SdncUebCallback implements INotificationCallback { insertToscaData(serviceModel.getSql(model_yaml)); } catch (IOException e) { LOG.error("Could not insert Tosca YAML data into the SERVICE_MODEL table ", e); - return; + // return; } // Ingest Network (VL) Data - 1707 diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java index b49a6607..75cb9c97 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java @@ -177,7 +177,10 @@ public class SdncUebConfiguration implements IConfiguration{ String artifactMapFile = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.artifact-map"); if (artifactMapFile != null) { + LOG.info("Loading artifactMapFile {}", artifactMapFile); artifactMap.load(artifactMapFile); + } else { + LOG.warn("artifact-map is unset"); } } diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java index d62618c6..79a598ce 100644 --- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java +++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java @@ -25,6 +25,125 @@ import ch.vorburger.mariadb4j.DBConfigurationBuilder; public class TestSdncUebCallback { + + private static final String CRTBL_SERVICE_MODEL = "CREATE TABLE `SERVICE_MODEL` (\n" + + " `service_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `name` varchar(255) DEFAULT NULL,\n" + + " `description` varchar(1024) DEFAULT NULL,\n" + + " `type` varchar(255) DEFAULT NULL,\n" + + " `category` varchar(255) DEFAULT NULL,\n" + + " `ecomp_naming` char(1) DEFAULT NULL,\n" + + " `service_instance_name_prefix` varchar(255) DEFAULT NULL,\n" + + " `filename` varchar(100) DEFAULT NULL,\n" + + " `naming_policy` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`service_uuid`)\n" + + ") "; + + private static final String CRTBL_NETWORK_MODEL = "CREATE TABLE `NETWORK_MODEL` (\n" + + " `customization_uuid` varchar(255) NOT NULL,\n" + + " `service_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `uuid` varchar(255) DEFAULT NULL,\n" + + " `network_type` varchar(255) DEFAULT NULL,\n" + + " `network_role` varchar(255) DEFAULT NULL,\n" + + " `network_technology` varchar(255) DEFAULT NULL,\n" + + " `network_scope` varchar(255) DEFAULT NULL,\n" + + " `naming_policy` varchar(255) DEFAULT NULL,\n" + + " `ecomp_generated_naming` char(1) DEFAULT NULL,\n" + + " `is_shared_network` char(1) DEFAULT NULL,\n" + + " `is_external_network` char(1) DEFAULT NULL,\n" + + " `is_provider_network` char(1) DEFAULT NULL,\n" + + " `physical_network_name` varchar(255) DEFAULT NULL,\n" + + " `is_bound_to_vpn` char(1) DEFAULT NULL,\n" + + " `vpn_binding` varchar(255) DEFAULT NULL,\n" + + " `use_ipv4` char(1) DEFAULT NULL,\n" + + " `ipv4_dhcp_enabled` char(1) DEFAULT NULL,\n" + + " `ipv4_ip_version` char(1) DEFAULT NULL,\n" + + " `ipv4_cidr_mask` varchar(255) DEFAULT NULL,\n" + + " `eipam_v4_address_plan` varchar(255) DEFAULT NULL,\n" + + " `use_ipv6` char(1) DEFAULT NULL,\n" + + " `ipv6_dhcp_enabled` char(1) DEFAULT NULL,\n" + + " `ipv6_ip_version` char(1) DEFAULT NULL,\n" + + " `ipv6_cidr_mask` varchar(255) DEFAULT NULL,\n" + + " `eipam_v6_address_plan` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`customization_uuid`),\n" + + " KEY `FK_NETWORK_MODEL` (`service_uuid`),\n" + + " CONSTRAINT `FK_NETWORK_MODEL` FOREIGN KEY (`service_uuid`) REFERENCES `SERVICE_MODEL` (`service_uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION\n" + + ")"; + + private static final String CRTBL_ALLOTTED_RESOURCE_MODEL = "CREATE TABLE `ALLOTTED_RESOURCE_MODEL` (\n" + + " `customization_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `uuid` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `naming_policy` varchar(255) DEFAULT NULL,\n" + + " `ecomp_generated_naming` char(1) DEFAULT NULL,\n" + + " `depending_service` varchar(255) DEFAULT NULL,\n" + + " `role` varchar(255) DEFAULT NULL,\n" + + " `type` varchar(255) DEFAULT NULL,\n" + + " `service_dependency` varchar(255) DEFAULT NULL,\n" + + " `allotted_resource_type` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`customization_uuid`)\n" + + ") "; + + private static final String CRTBL_VFC_MODEL = "CREATE TABLE `VFC_MODEL` (\n" + + " `customization_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `uuid` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `naming_policy` varchar(255) DEFAULT NULL,\n" + + " `ecomp_generated_naming` char(1) DEFAULT NULL,\n" + + " `nfc_function` varchar(255) DEFAULT NULL,\n" + + " `nfc_naming_code` varchar(255) DEFAULT NULL,\n" + + " `vm_type` varchar(255) DEFAULT NULL,\n" + + " `vm_type_tag` varchar(255) DEFAULT NULL,\n" + + " `vm_image_name` varchar(255) DEFAULT NULL,\n" + + " `vm_flavor_name` varchar(255) DEFAULT NULL,\n" + + " `high_availability` varchar(255) DEFAULT NULL,\n" + + " `nfc_naming` varchar(255) DEFAULT NULL,\n" + + " `min_instances` int(11) DEFAULT NULL,\n" + + " `max_instances` int(11) DEFAULT NULL,\n" + + " PRIMARY KEY (`customization_uuid`)\n" + + ") "; + + private static final String CRTBL_VF_MODEL = "CREATE TABLE `VF_MODEL` (\n" + + " `customization_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `uuid` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `name` varchar(255) DEFAULT NULL,\n" + + " `naming_policy` varchar(255) DEFAULT NULL,\n" + + " `ecomp_generated_naming` char(1) DEFAULT NULL,\n" + + " `avail_zone_max_count` int(11) DEFAULT NULL,\n" + + " `nf_function` varchar(255) DEFAULT NULL,\n" + + " `nf_code` varchar(255) DEFAULT NULL,\n" + + " `nf_type` varchar(255) DEFAULT NULL,\n" + + " `nf_role` varchar(255) DEFAULT NULL,\n" + + " `vendor` varchar(255) DEFAULT NULL,\n" + + " `vendor_version` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`customization_uuid`)\n" + + ")"; + + private static final String CRTBL_VF_MODULE_MODEL = "CREATE TABLE `VF_MODULE_MODEL` (\n" + + " `customization_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `uuid` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `vf_module_type` varchar(255) DEFAULT NULL,\n" + + " `availability_zone_count` int(11) DEFAULT NULL,\n" + + " `ecomp_generated_vm_assignments` char(1) DEFAULT NULL,\n" + + " PRIMARY KEY (`customization_uuid`)\n" + + ")"; + private static final Logger LOG = LoggerFactory .getLogger(TestSdncUebCallback.class); SdncUebConfiguration config; @@ -35,6 +154,7 @@ public class TestSdncUebCallback { public void setUp() throws Exception { config = new SdncUebConfiguration("src/test/resources"); + URL propUrl = getClass().getResource("/dblib.properties"); InputStream propStr = getClass().getResourceAsStream("/dblib.properties"); @@ -56,7 +176,16 @@ public class TestSdncUebCallback { props.setProperty("org.onap.ccsdk.sli.jdbc.url", config.getURL("test")); + // Create dblib connection dblibSvc = new DBResourceManager(props); + + // Create TOSCA tables + dblibSvc.writeData(CRTBL_SERVICE_MODEL, null, null); + dblibSvc.writeData(CRTBL_NETWORK_MODEL, null, null); + dblibSvc.writeData(CRTBL_VFC_MODEL, null, null); + dblibSvc.writeData(CRTBL_VF_MODEL, null, null); + dblibSvc.writeData(CRTBL_VF_MODULE_MODEL, null, null); + dblibSvc.writeData(CRTBL_ALLOTTED_RESOURCE_MODEL, null, null); } @After diff --git a/ueb-listener/src/test/resources/artifact.map b/ueb-listener/src/test/resources/artifact.map new file mode 100644 index 00000000..0256515f --- /dev/null +++ b/ueb-listener/src/test/resources/artifact.map @@ -0,0 +1,2 @@ +vf-license-model,ASDC-API:vf-license-model-update,0 +bad-entry,0 diff --git a/ueb-listener/src/test/resources/ueb-listener.properties b/ueb-listener/src/test/resources/ueb-listener.properties index 548cc4c4..4b9886ee 100755 --- a/ueb-listener/src/test/resources/ueb-listener.properties +++ b/ueb-listener/src/test/resources/ueb-listener.properties @@ -16,4 +16,5 @@ org.onap.ccsdk.sli.northbound.uebclient.relevant-artifact-types=YANG_XML,VF_LICE org.onap.ccsdk.sli.northbound.uebclient.activate-server-tls-auth=false org.onap.ccsdk.sli.northbound.uebclient.keystore-path= org.onap.ccsdk.sli.northbound.uebclient.keystore-password= -org.onap.ccsdk.sli.northbound.uebclient.xslt-path-list=
\ No newline at end of file +org.onap.ccsdk.sli.northbound.uebclient.xslt-path-list= +org.onap.ccsdk.sli.northbound.uebclient.artifact-map=src/test/resources/artifact.map
\ No newline at end of file |