summaryrefslogtreecommitdiffstats
path: root/ueb-listener/src/test
diff options
context:
space:
mode:
authorlalena.aria <lalena.aria@att.com>2019-08-07 19:59:04 +0000
committerTimoney, Dan (dt5972) <dtimoney@att.com>2019-08-09 13:52:24 -0400
commit3f336cecddbc7adf45489e0d4a0b1b19deeee1ef (patch)
tree9964976ded424f3d93f3e5e133d1965c2ea57e0d /ueb-listener/src/test
parentc0c9d433434dde14d68c5a8b5816b5371677dc24 (diff)
Use getEntity to populate Complex Resource-Related tables
Changes made: Clean up in SdncBaseModel for unused methods. Fixes in SdncGroupModel. Convert SdncNodeModel to entity. Corrected logging in SdncVFCModel. Corresponding Group-related and logging fixes in SdncVFModel. Corresponding SdncBaseModel changes for getEntity migration. Corresponding junit changes for getEntity migration. Issue-ID: CCSDK-1578 Change-Id: Ic7f7ec38325aeddcad2d86c8f8425ec825512714 Signed-off-by: lalena.aria <lalena.aria@att.com>
Diffstat (limited to 'ueb-listener/src/test')
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java6
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java18
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java152
-rwxr-xr-xueb-listener/src/test/resources/ueb-listener.properties3
4 files changed, 165 insertions, 14 deletions
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java
index 8bf3c9145..3b2cd96a1 100644
--- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java
@@ -8,8 +8,6 @@ import java.io.IOException;
import org.junit.Test;
import org.onap.sdc.tosca.parser.api.IEntityDetails;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
-import org.onap.sdc.toscaparser.api.Group;
import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
public class SdncGroupModelTest {
@@ -17,13 +15,13 @@ import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
@Test
public void testSdncGroupModelConstructor() {
ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class);
- NodeTemplate nodeTemplate = mock(NodeTemplate.class);
IEntityDetails group = mock(IEntityDetails.class);
+ IEntityDetails entityDetails = mock(IEntityDetails.class);
DBResourceManager mockDBResourceManager = mock(DBResourceManager.class);
SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class);
SdncGroupModel testSdncGroupModel = null;
try {
- testSdncGroupModel = new SdncGroupModel(mockCsarHelper,group,nodeTemplate,mockSdncUebConfiguration,mockDBResourceManager);
+ testSdncGroupModel = new SdncGroupModel(mockCsarHelper,group,entityDetails,mockSdncUebConfiguration,mockDBResourceManager);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java
index a77c5adbf..9f859e793 100644
--- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java
@@ -7,9 +7,9 @@ import static org.mockito.Mockito.*;
import java.io.IOException;
import org.junit.Before;
-import org.junit.Test;
-import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.junit.Test;
+import org.onap.sdc.tosca.parser.api.IEntityDetails;
+import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
@@ -18,17 +18,17 @@ public class SdncNodeModelTest {
SdncNodeModel sdncNodeModel;
@Before
- public void setUp() throws Exception {
+ public void setUp() throws Exception {
+ SdncUebConfiguration config = mock(SdncUebConfiguration.class);
ISdcCsarHelper isdcCsarHelper = mock(ISdcCsarHelper.class);
- NodeTemplate nodeTemplate = mock(NodeTemplate.class);
+ IEntityDetails entityDetails = mock(IEntityDetails.class);
Metadata mockMetadata = mock(Metadata.class);
DBResourceManager mockDBResourceManager = mock(DBResourceManager.class);
- when(nodeTemplate.getMetaData()).thenReturn(mockMetadata);
+ when(entityDetails.getMetadata()).thenReturn(mockMetadata);
when(isdcCsarHelper.getMetadataPropertyValue(mockMetadata, "customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd");
- when(isdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, "network_type")).thenReturn("test-network-type");
- sdncNodeModel = new SdncNodeModel(isdcCsarHelper, nodeTemplate, mockDBResourceManager);
+ sdncNodeModel = new SdncNodeModel(isdcCsarHelper, entityDetails, mockDBResourceManager, config);
sdncNodeModel.setServiceUUID("0e8d757f-1c80-40af-85de-31d64f1f5af8");
sdncNodeModel.setEcompGeneratedNaming("hello-world");
}
@@ -48,7 +48,7 @@ public class SdncNodeModelTest {
@Test
public void testGetSqlString() {
String result = sdncNodeModel.getSql("TEST-HELLO");
- String test = "INSERT into NETWORK_MODEL (service_uuid, customization_uuid, model_yaml, ecomp_generated_naming, network_type) values (0e8d757f-1c80-40af-85de-31d64f1f5af8, \"aaaa-bbbb-cccc-dddd\", \"TEST-HELLO\", \"hello-world\", \"test-network-type\");";
+ String test = "INSERT into NETWORK_MODEL (service_uuid, customization_uuid, model_yaml, ecomp_generated_naming) values (0e8d757f-1c80-40af-85de-31d64f1f5af8, \"aaaa-bbbb-cccc-dddd\", \"TEST-HELLO\", \"hello-world\");";
assertEquals(test, result);
}
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 5b4637ea7..2c44ba732 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
@@ -46,6 +46,23 @@ public class TestSdncUebCallback {
" `naming_policy` varchar(255) DEFAULT NULL,\n" +
" PRIMARY KEY (`service_uuid`)\n" +
") ";
+
+ private static final String CRTBL_SERVICE_MODEL_TO_VF_MODEL_MAPPING = "CREATE TABLE `SERVICE_MODEL_TO_VF_MODEL_MAPPING` (\n" +
+ " `service_uuid` varchar(255) NOT NULL,\n" +
+ " `vf_uuid` varchar(255) DEFAULT NULL,\n" +
+ " `vf_customization_uuid` varchar(255) DEFAULT NULL,\n" +
+ " `service_invariant_uuid` varchar(255) DEFAULT NULL,\n" +
+ " PRIMARY KEY (`service_uuid`)\n" +
+ ") ";
+
+ private static final String CRTBL_ATTRIBUTE_VALUE_PAIR = "CREATE TABLE `ATTRIBUTE_VALUE_PAIR` (\n" +
+ " `resource_uuid` varchar(255) NOT NULL,\n" +
+ " `attribute_name` varchar(255) NOT NULL,\n" +
+ " `resource_type` varchar(255) NOT NULL,\n" +
+ " `attribute_value` varchar(255) DEFAULT NULL,\n" +
+ " `resource_customization_uuid` varchar(255) DEFAULT NULL,\n" +
+ " PRIMARY KEY (`resource_uuid`,`attribute_name`,`resource_type`)\n" +
+ ") ";
private static final String CRTBL_NETWORK_MODEL = "CREATE TABLE `NETWORK_MODEL` (\n" +
" `customization_uuid` varchar(255) NOT NULL,\n" +
@@ -118,6 +135,39 @@ public class TestSdncUebCallback {
" PRIMARY KEY (`customization_uuid`)\n" +
") ";
+ private static final String CRTBL_VFC_RELATED_NETWORK_ROLE = "CREATE TABLE `VFC_RELATED_NETWORK_ROLE` (\n" +
+ " `vfc_customization_uuid` varchar(255) NOT NULL,\n" +
+ " `vm_type` varchar(255) NOT NULL,\n" +
+ " `network_role` varchar(255) NOT NULL,\n" +
+ " `related_network_role` varchar(255) NOT NULL,\n" +
+ " PRIMARY KEY (`vfc_customization_uuid`,`vm_type`,`network_role`,`related_network_role`)\n" +
+ ") ";
+
+ private static final String CRTBL_VFC_TO_NETWORK_ROLE_MAPPING = "CREATE TABLE `VFC_TO_NETWORK_ROLE_MAPPING` (\n" +
+ " `seq` int(11) NOT NULL AUTO_INCREMENT,\n" +
+ " `vfc_customization_uuid` varchar(255) NOT NULL,\n" +
+ " `network_role` varchar(255) NOT NULL,\n" +
+ " `vm_type` varchar(255) DEFAULT NULL,\n" +
+ " `network_role_tag` varchar(255) DEFAULT NULL,\n" +
+ " `ipv4_count` int(11) NOT NULL,\n" +
+ " `ipv6_count` int(11) NOT NULL,\n" +
+ " `ipv4_use_dhcp` char(1) DEFAULT NULL,\n" +
+ " `ipv6_use_dhcp` char(1) DEFAULT NULL,\n" +
+ " `ipv4_ip_version` char(1) DEFAULT NULL,\n" +
+ " `ipv6_ip_version` char(1) DEFAULT NULL,\n" +
+ " `extcp_subnetpool_id` varchar(512) DEFAULT NULL,\n" +
+ " `ipv4_floating_count` int(11) DEFAULT NULL,\n" +
+ " `ipv6_floating_count` int(11) DEFAULT NULL,\n" +
+ " `ipv4_address_plan_name` varchar(512) DEFAULT NULL,\n" +
+ " `ipv6_address_plan_name` varchar(512) DEFAULT NULL,\n" +
+ " `ipv4_vrf_name` varchar(512) DEFAULT NULL,\n" +
+ " `ipv6_vrf_name` varchar(512) DEFAULT NULL,\n" +
+ " `subnet_role` varchar(255) DEFAULT NULL,\n" +
+ " `subinterface_indicator` char(1) DEFAULT NULL,\n" +
+ " PRIMARY KEY (`seq`),\n" +
+ " KEY `IX1_VFC_TO_NETWORK_ROLE_MAPPING` (`vfc_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" +
@@ -137,6 +187,21 @@ public class TestSdncUebCallback {
" PRIMARY KEY (`customization_uuid`)\n" +
")";
+ private static final String CRTBL_VNF_RELATED_NETWORK_ROLE = "CREATE TABLE `VNF_RELATED_NETWORK_ROLE` (\n" +
+ " `vnf_customization_uuid` varchar(255) NOT NULL,\n" +
+ " `network_role` varchar(255) NOT NULL,\n" +
+ " `related_network_role` varchar(255) NOT NULL,\n" +
+ " PRIMARY KEY (`vnf_customization_uuid`,`network_role`,`related_network_role`)\n" +
+ ")";
+
+ private static final String CRTBL_VF_TO_NETWORK_ROLE_MAPPING = "CREATE TABLE `VF_TO_NETWORK_ROLE_MAPPING` (\n" +
+ " `seq` int(11) NOT NULL AUTO_INCREMENT,\n" +
+ " `vf_customization_uuid` varchar(255) NOT NULL,\n" +
+ " `network_role` varchar(255) NOT NULL,\n" +
+ " PRIMARY KEY (`seq`),\n" +
+ " KEY `IX1_VF_TO_NETWORK_ROLE_MAPPING` (`vf_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" +
@@ -146,8 +211,82 @@ public class TestSdncUebCallback {
" `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" +
+ " `vf_customization_uuid` char(255) DEFAULT NULL,\n" +
+ " `vf_module_label` char(255) DEFAULT NULL,\n" +
" PRIMARY KEY (`customization_uuid`)\n" +
")";
+
+ private static final String CRTBL_VF_MODULE_TO_VFC_MAPPING = "CREATE TABLE `VF_MODULE_TO_VFC_MAPPING` (\n" +
+ " `seq` int(11) NOT NULL AUTO_INCREMENT,\n" +
+ " `vf_module_customization_uuid` varchar(255) NOT NULL,\n" +
+ " `vfc_customization_uuid` varchar(255) NOT NULL,\n" +
+ " `vm_type` varchar(255) NOT NULL,\n" +
+ " `vm_count` int(11) NOT NULL,\n" +
+ " PRIMARY KEY (`seq`),\n" +
+ " KEY `IX1_VF_MODULE_TO_VFC_MAPPING` (`vf_module_customization_uuid`)\n" +
+ ")";
+
+ private static final String CRTBL_RESOURCE_GROUP = "CREATE TABLE `RESOURCE_GROUP` (\n" +
+ " `resource_uuid` varchar(255) NOT NULL,\n" +
+ " `group_uuid` varchar(255) NOT NULL,\n" +
+ " `group_customization_uuid` varchar(255) DEFAULT NULL,\n" +
+ " `group_invariant_uuid` varchar(255) DEFAULT NULL,\n" +
+ " `group_name` varchar(255) DEFAULT NULL,\n" +
+ " `version` varchar(255) DEFAULT NULL,\n" +
+ " `group_type` varchar(255) DEFAULT NULL,\n" +
+ " PRIMARY KEY (`resource_uuid`,`group_uuid`)\n" +
+ ")";
+
+ private static final String CRTBL_RESOURCE_GROUP_TO_TARGET_NODE_MAPPING = "CREATE TABLE `RESOURCE_GROUP_TO_TARGET_NODE_MAPPING` (\n" +
+ " `group_uuid` varchar(255) NOT NULL,\n" +
+ " `parent_uuid` varchar(255) NOT NULL,\n" +
+ " `target_node_uuid` varchar(255) NOT NULL,\n" +
+ " `target_type` varchar(255) DEFAULT NULL,\n" +
+ " `table_name` varchar(255) DEFAULT NULL,\n" +
+ " PRIMARY KEY (`group_uuid`,`parent_uuid`,`target_node_uuid`)\n" +
+ ")";
+
+ private static final String CRTBL_RESOURCE_POLICY = "CREATE TABLE `RESOURCE_POLICY` (\n" +
+ " `resource_uuid` varchar(255) NOT NULL,\n" +
+ " `policy_uuid` varchar(255) NOT NULL,\n" +
+ " `policy_invariant_uuid` varchar(255) NOT NULL,\n" +
+ " `policy_name` varchar(255) DEFAULT NULL,\n" +
+ " `version` varchar(255) DEFAULT NULL,\n" +
+ " `policy_type` varchar(255) DEFAULT NULL,\n" +
+ " `property_type` varchar(255) DEFAULT NULL,\n" +
+ " `property_source` varchar(255) DEFAULT NULL,\n" +
+ " `property_name` varchar(255) DEFAULT NULL,\n" +
+ " `policy_customization_uuid` varchar(255) DEFAULT NULL,\n" +
+ " PRIMARY KEY (`resource_uuid`,`policy_uuid`)\n" +
+ ")";
+
+ private static final String CRTBL_RESOURCE_POLICY_TO_TARGET_NODE_MAPPING = "CREATE TABLE `RESOURCE_POLICY_TO_TARGET_NODE_MAPPING` (\n" +
+ " `policy_uuid` varchar(255) NOT NULL,\n" +
+ " `parent_uuid` varchar(255) NOT NULL,\n" +
+ " `target_node_uuid` varchar(255) NOT NULL,\n" +
+ " `target_type` varchar(255) DEFAULT NULL,\n" +
+ " `target_node_customization_uuid` varchar(255) DEFAULT NULL,\n" +
+ " `policy_customization_uuid` varchar(255) DEFAULT NULL,\n" +
+ " PRIMARY KEY (`policy_uuid`,`parent_uuid`,`target_node_uuid`)\n" +
+ ")";
+
+ private static final String CRTBL_NODE_CAPABILITY = "CREATE TABLE `NODE_CAPABILITY` (\n" +
+ " `capability_id` int(11) NOT NULL AUTO_INCREMENT,\n" +
+ " `capability_provider_uuid` varchar(255) NOT NULL,\n" +
+ " `capability_provider_customization_uuid` varchar(255) NOT NULL,\n" +
+ " `capability_name` varchar(255) DEFAULT NULL,\n" +
+ " `capability_type` varchar(255) DEFAULT NULL,\n" +
+ " PRIMARY KEY (`capability_id`)\n" +
+ ")";
+
+ private static final String CRTBL_NODE_CAPABILITY_PROPERTY = "CREATE TABLE `NODE_CAPABILITY_PROPERTY` (\n" +
+ " `capability_id` int(11) NOT NULL AUTO_INCREMENT,\n" +
+ " `capability_property_name` varchar(255) NOT NULL,\n" +
+ " `capability_property_type` varchar(255) DEFAULT NULL,\n" +
+ " PRIMARY KEY (`capability_id`,`capability_property_name`),\n" +
+ " CONSTRAINT `NODE_CAPABILITY_PROPERTY_TO_NODE_CAPABILITY` FOREIGN KEY (`capability_id`) REFERENCES `NODE_CAPABILITY` (`capability_id`) ON DELETE CASCADE\n" +
+ ")";
+
private static final Logger LOG = LoggerFactory
.getLogger(TestSdncUebCallback.class);
@@ -195,11 +334,24 @@ public class TestSdncUebCallback {
// Create TOSCA tables
dblibSvc.writeData(CRTBL_SERVICE_MODEL, null, null);
+ dblibSvc.writeData(CRTBL_SERVICE_MODEL_TO_VF_MODEL_MAPPING, null, null);
+ dblibSvc.writeData(CRTBL_ATTRIBUTE_VALUE_PAIR, null, null);
dblibSvc.writeData(CRTBL_NETWORK_MODEL, null, null);
dblibSvc.writeData(CRTBL_VFC_MODEL, null, null);
+ dblibSvc.writeData(CRTBL_VFC_RELATED_NETWORK_ROLE, null, null);
+ dblibSvc.writeData(CRTBL_VFC_TO_NETWORK_ROLE_MAPPING, null, null);
dblibSvc.writeData(CRTBL_VF_MODEL, null, null);
+ dblibSvc.writeData(CRTBL_VNF_RELATED_NETWORK_ROLE, null, null);
+ dblibSvc.writeData(CRTBL_VF_TO_NETWORK_ROLE_MAPPING, null, null);
dblibSvc.writeData(CRTBL_VF_MODULE_MODEL, null, null);
+ dblibSvc.writeData(CRTBL_VF_MODULE_TO_VFC_MAPPING, null, null);
dblibSvc.writeData(CRTBL_ALLOTTED_RESOURCE_MODEL, null, null);
+ dblibSvc.writeData(CRTBL_RESOURCE_GROUP, null, null);
+ dblibSvc.writeData(CRTBL_RESOURCE_GROUP_TO_TARGET_NODE_MAPPING, null, null);
+ dblibSvc.writeData(CRTBL_RESOURCE_POLICY, null, null);
+ dblibSvc.writeData(CRTBL_RESOURCE_POLICY_TO_TARGET_NODE_MAPPING, null, null);
+ dblibSvc.writeData(CRTBL_NODE_CAPABILITY, null, null);
+ dblibSvc.writeData(CRTBL_NODE_CAPABILITY_PROPERTY, null, null);
processLevelArtifactList = new ArrayList<>();
serviceLevelArtifactList = new ArrayList<>();
diff --git a/ueb-listener/src/test/resources/ueb-listener.properties b/ueb-listener/src/test/resources/ueb-listener.properties
index 35c380595..c017cbd7b 100755
--- a/ueb-listener/src/test/resources/ueb-listener.properties
+++ b/ueb-listener/src/test/resources/ueb-listener.properties
@@ -14,8 +14,9 @@ org.onap.ccsdk.sli.northbound.uebclient.polling-interval=30
org.onap.ccsdk.sli.northbound.uebclient.polling-timeout=15
org.onap.ccsdk.sli.northbound.uebclient.client-startup-timeout=60
org.onap.ccsdk.sli.northbound.uebclient.relevant-artifact-types=YANG_XML,VF_LICENSE,TOSCA_TEMPLATE,TOSCA_CSAR,UCPE_LAYER_2_CONFIGURATION
+org.onap.ccsdk.sli.northbound.uebclient.relevant-capability-names=RoutingConfiguration,routing_configuration,VLANAssignment,vlan_assignment
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=
-org.onap.ccsdk.sli.northbound.uebclient.artifact-map=src/test/resources/artifact.map \ No newline at end of file
+org.onap.ccsdk.sli.northbound.uebclient.artifact-map=src/test/resources/artifact.map