diff options
Diffstat (limited to 'ueb-listener')
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 3605465d4..671d47a9f 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 2cc08e1ae..67e042b5d 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 b49a66070..75cb9c971 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 d62618c6d..79a598ce5 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 000000000..0256515f0 --- /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 548cc4c45..4b9886ee5 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 |