From d20e0ddf4b8953ce539f1dc7bf7cb4dca30fd189 Mon Sep 17 00:00:00 2001 From: "Leigh, Phillip (pl876u)" Date: Wed, 27 Feb 2019 13:31:33 -0500 Subject: AaiCtxBuilder:Handle L-Interface & Logical-Link Also remove resourceVersion and handle empty valude of any attribute (LOG-988) Issue-ID: LOG-988 Issue-ID: LOG-766 Issue-ID: LOG-767 Change-Id: I8b3eef61cebf93690aaa0291f8d0a7c1e3575088 Signed-off-by: Leigh, Phillip (pl876u) --- .../LInterfaceInstanceTest.java | 31 +-- .../LogicalLinkInstanceTest.java | 59 +++++ .../PInterfaceInstanceTest.java | 3 +- .../pomba_aai_context_builder/RestUtilTest.java | 26 +- .../pomba_aai_context_builder/VnfInstanceTest.java | 9 +- .../pomba_aai_context_builder/VserverTest.java | 9 +- .../test/RestServiceTest.java | 276 ++++++++++++++++++++- .../resources/junit/aai-service-instance_set4.json | 44 ++++ src/test/resources/junit/aai-vserver-set3.json | 96 ++++--- src/test/resources/junit/genericVnfInput_set6.json | 148 +++++++++++ src/test/resources/junit/l-interface-input.json | 10 - src/test/resources/junit/l-interface-input2.json | 10 - src/test/resources/junit/logical-link-input1.json | 17 ++ src/test/resources/junit/logical-link-input2.json | 17 ++ src/test/resources/junit/logical-link-input3.json | 17 ++ src/test/resources/junit/logical-link-input4.json | 17 ++ .../resources/junit/pnfInput_w_pInterface.json | 86 ------- .../junit/pnfInput_w_pInterface_LInterface.json | 110 ++++++++ .../pnfInput_w_pInterface_LInterface_set2.json | 146 +++++++++++ .../junit/pserverInput_with_pInterface.json | 65 ----- .../pserverInput_with_pInterface_LInterface.json | 89 +++++++ ...erverInput_with_pInterface_LInterface_set2.json | 165 ++++++++++++ 22 files changed, 1185 insertions(+), 265 deletions(-) create mode 100644 src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java create mode 100644 src/test/resources/junit/aai-service-instance_set4.json create mode 100644 src/test/resources/junit/genericVnfInput_set6.json delete mode 100644 src/test/resources/junit/l-interface-input.json delete mode 100644 src/test/resources/junit/l-interface-input2.json create mode 100644 src/test/resources/junit/logical-link-input1.json create mode 100644 src/test/resources/junit/logical-link-input2.json create mode 100644 src/test/resources/junit/logical-link-input3.json create mode 100644 src/test/resources/junit/logical-link-input4.json delete mode 100644 src/test/resources/junit/pnfInput_w_pInterface.json create mode 100644 src/test/resources/junit/pnfInput_w_pInterface_LInterface.json create mode 100644 src/test/resources/junit/pnfInput_w_pInterface_LInterface_set2.json delete mode 100644 src/test/resources/junit/pserverInput_with_pInterface.json create mode 100644 src/test/resources/junit/pserverInput_with_pInterface_LInterface.json create mode 100644 src/test/resources/junit/pserverInput_with_pInterface_LInterface_set2.json (limited to 'src/test') diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java index dbca0d0..1dde19d 100644 --- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java +++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java @@ -21,44 +21,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.onap.pomba.contextbuilder.aai.datatype.L3networkInstance; import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstance; public class LInterfaceInstanceTest { - @Test - public void testL3networkInstanceEquals() { - L3networkInstance l3networkInstance1 = new L3networkInstance - ( "networkId1", "networkName1", "networkType1", - "networkRole1", "networkTechnology1", "resourceVersion1", - "modelInvariantId1", "modelVersionId1", "physicalNetworkName1", "true", - null); - - L3networkInstance l3networkInstance2 = new L3networkInstance (); - l3networkInstance2.setNetworkId("networkId1"); - l3networkInstance2.setNetworkName("networkName1"); - l3networkInstance2.setNetworkType("networkType1"); - l3networkInstance2.setNetworkRole("networkRole1"); - l3networkInstance2.setNetworkTechnology("networkTechnology1"); - l3networkInstance2.setResourceVersion("resourceVersion1"); - l3networkInstance2.setModelInvariantId("modelInvariantId1"); - l3networkInstance2.setModelVersionId("modelVersionId1"); - l3networkInstance2.setPhysicalNetworkName("physicalNetworkName1"); - l3networkInstance2.setSharedNetworkBoolean("true"); - l3networkInstance2.setRelationshipList(null); - - l3networkInstance1.toJson(); - l3networkInstance1.toString(); - assertEquals("physicalNetworkName1", l3networkInstance2.getPhysicalNetworkName()); - assertTrue(l3networkInstance1.equals(l3networkInstance1)); - assertTrue(l3networkInstance1.equals(l3networkInstance2)); - } - @Test public void testLInterfaceInstanceEquals() { LInterfaceInstance lInterfaceInstance1 = new LInterfaceInstance ( "interfaceId1", "interfaceName1", "interfaceRole1", "isPortMirrored1", "adminStatus1", "networkName1", - "macAddr1", "inMaint1"); + "macAddr1", "inMaint1", null); LInterfaceInstance lInterfaceInstance2 = new LInterfaceInstance (); lInterfaceInstance2.setInterfaceId("interfaceId1"); diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java new file mode 100644 index 0000000..b0c4ea8 --- /dev/null +++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END===================================================== + */ +package org.onap.logging_analytics.pomba.pomba_aai_context_builder; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.LogicalLinkInstance; + +public class LogicalLinkInstanceTest { + @Test + public void testLogicalLinkInstanceEquals() { + LogicalLinkInstance logicalLinkInstance1 = new LogicalLinkInstance + ( "linkName1", "linkId1", "modelVersionId1", + "modelInvariantId1", "linkType1", "routingProtocol1", + "speedValue1", "speedUnits1", "provStatus1", + "inMaint1", "linkRole1", "ipVersion1", + "linkName21","circuitId1","purpose1"); + + LogicalLinkInstance logicalLinkInstance2 = new LogicalLinkInstance (); + logicalLinkInstance2.setLinkName("linkName1"); + logicalLinkInstance2.setLinkId("linkId1"); + logicalLinkInstance2.setModelVersionId("modelVersionId1"); + logicalLinkInstance2.setModelInvariantId("modelInvariantId1"); + logicalLinkInstance2.setLinkType("linkType1"); + logicalLinkInstance2.setRoutingProtocol("routingProtocol1"); + logicalLinkInstance2.setSpeedValue("speedValue1"); + logicalLinkInstance2.setSpeedUnits("speedUnits1"); + logicalLinkInstance2.setProvStatus("provStatus1"); + logicalLinkInstance2.setInMaint("inMaint1"); + logicalLinkInstance2.setLinkRole("linkRole1"); + logicalLinkInstance2.setIpVersion("ipVersion1"); + logicalLinkInstance2.setLinkName2("linkName21"); + logicalLinkInstance2.setCircuitId("circuitId1"); + logicalLinkInstance2.setPurpose("purpose1"); + + logicalLinkInstance1.toJson(); + logicalLinkInstance1.toString(); + assertEquals("linkName1", logicalLinkInstance2.getLinkName()); + assertTrue(logicalLinkInstance1.equals(logicalLinkInstance1)); + assertTrue(logicalLinkInstance1.equals(logicalLinkInstance2)); + } +} diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java index 2a0bbb2..33bba56 100644 --- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java +++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.pomba.contextbuilder.aai.datatype.PInterfaceInstance; +import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList; public class PInterfaceInstanceTest { @@ -30,7 +31,7 @@ public class PInterfaceInstanceTest { PInterfaceInstance pInterfaceInstance1 = new PInterfaceInstance ( "interfaceName1", "speedValue1", "speedUnits1", "portDescription1", "equipmentIdentifier1", "interfaceRole1", "interfaceType1", - "provStatus1", "resourceVersion1", "inMaint1", "invStatus1" ); + "provStatus1", "resourceVersion1", "inMaint1", "invStatus1" , new LInterfaceInstanceList(), null); PInterfaceInstance pInterfaceInstance2 = new PInterfaceInstance (); pInterfaceInstance2.setInterfaceName("interfaceName1"); diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java index a7be281..e184f4d 100644 --- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java +++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java @@ -188,7 +188,7 @@ public class RestUtilTest { // note: match to vserver-id to the path of "vserver" in (3) addResponse( "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant" - + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH, "junit/aai-vserver.json", aaiEnricherRule); // 5. simulate the rsp of pserver @@ -212,7 +212,7 @@ public class RestUtilTest { //// @Test - public void testretrieveAAIModelDataFromAAI_PInterface_with_PNF() throws Exception { + public void testretrieveAAIModelDataFromAAI_PInterface_LInterface_with_PNF() throws Exception { String transactionId = UUID.randomUUID().toString(); String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json @@ -230,17 +230,20 @@ public class RestUtilTest { // 4. simulate the response of PNF based on the resourceLink in (2) //note: match pnf_id in junit/aai-service-instance.json addResponse( "/aai/v13/network/pnfs/pnf/amdocsPnfName" + DEPTH, - "junit/pnfInput_w_pInterface.json", aaiEnricherRule); + "junit/pnfInput_w_pInterface_LInterface.json", aaiEnricherRule); ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization); assertEquals(modelCtx.getVnfs().size(), 1); assertEquals(modelCtx.getPnfs().size(), 1); - + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().size(), 1); + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().size(), 2); + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name5"); //l-interface-name + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name6"); //l-interface-name } @Test - public void testretrieveAAIModelDataFromAAI_P_Interface_with_PSERVER() throws Exception { + public void testretrieveAAIModelDataFromAAI_PInterface_LInterface_with_PSERVER() throws Exception { String transactionId = UUID.randomUUID().toString(); String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json @@ -261,14 +264,14 @@ public class RestUtilTest { // note: match to vserver-id to the path of "vserver" in (3) addResponse( "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant" - + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH, "junit/aai-vserver.json", aaiEnricherRule); - // 5. simulate the rsp of pserver + // 5. simulate the rsp of pserver with P-interface which also contains L-interface. // note: match pserver hostname to the path of "pserver" in (4) addResponse( "/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com" + DEPTH, - "junit/pserverInput_with_pInterface.json", aaiEnricherRule); + "junit/pserverInput_with_pInterface_LInterface.json", aaiEnricherRule); ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization); @@ -281,6 +284,9 @@ public class RestUtilTest { assertEquals(vmList.size(), 1); assertEquals(vmList.get(0).getPServer().getPInterfaceList().size(), 1); assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getName(), "bdc3cc2a-c73e-414f-7ddb-367de92801cb"); //interface-name + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().size(), 2); + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name7"); //l-interface-name + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name8"); //l-interface-name } ///Verify the relationship serviceInstanceId -> l3network @@ -339,7 +345,7 @@ public class RestUtilTest { // note: match to vserver-id to the path of "vserver" in (3) addResponse( "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant" - + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH, "junit/aai-vserver-set2.json", aaiEnricherRule); // 5. simulate the rsp of l3-network @@ -380,7 +386,7 @@ public class RestUtilTest { // note: match to vserver-id to the path of "vserver" in (3) addResponse( "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant" - + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH, "junit/aai-vserver-set2.json", aaiEnricherRule); // 5. simulate the rsp of l3-network diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java index dd2a3fc..b9d9329 100644 --- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java +++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java @@ -24,6 +24,7 @@ import org.junit.Test; import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList; import org.onap.pomba.contextbuilder.aai.datatype.VfModules; import org.onap.pomba.contextbuilder.aai.datatype.VnfInstance; +import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList; public class VnfInstanceTest { @Test @@ -90,7 +91,7 @@ public class VnfInstanceTest { @Test public void testVnfInstanceWithParameters() { - VnfInstance vnfInstance = new VnfInstance("vnfId", "vnfName", "vnfName2", "vnfType", "serviceId", "provisionStatus", "licenseKey", "equipmentRole", "orchestrationStatus", "heatStackId", "msoCatalogKey", "ipv4OamAddress", "ipv4Loopback0Address", "nmLanV6Address", "managementV6Address", true, true, "resourceVersion", "modelInvariantId", "modelVersionId", "modelCustomizationId", "nfType", "nfFunction", "nfRole", "nfNamingCode", new RelationshipList(), new VfModules()); + VnfInstance vnfInstance = new VnfInstance("vnfId", "vnfName", "vnfName2", "vnfType", "serviceId", "provisionStatus", "licenseKey", "equipmentRole", "orchestrationStatus", "heatStackId", "msoCatalogKey", "ipv4OamAddress", "ipv4Loopback0Address", "nmLanV6Address", "managementV6Address", true, true, "resourceVersion", "modelInvariantId", "modelVersionId", "modelCustomizationId", "nfType", "nfFunction", "nfRole", "nfNamingCode", new RelationshipList(), new VfModules(), new LInterfaceInstanceList()); assertEquals("serviceId", vnfInstance.getServiceId()); assertEquals("modelCustomizationId", vnfInstance.getModelCustomizationId()); @@ -126,9 +127,9 @@ public class VnfInstanceTest { @Test public void testVnfInstanceEquals() { - VnfInstance vnfInstance1 = new VnfInstance("vnfId1", "vnfName1", "vnfName2-1", "vnfType1", "serviceId1", "provisionStatus1", "licenseKey1", "equipmentRole1", "orchestrationStatus1", "heatStackId1", "msoCatalogKey1", "ipv4OamAddress1", "ipv4Loopback0Address1", "nmLanV6Address1", "managementV6Address1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", "nfType1", "nfFunction1", "nfRole1", "nfNamingCode1", new RelationshipList(), new VfModules()); - VnfInstance vnfInstance2 = new VnfInstance("vnfId2", "vnfName2", "vnfName2-2", "vnfType2", "serviceId2", "provisionStatus2", "licenseKey2", "equipmentRole2", "orchestrationStatus2", "heatStackId2", "msoCatalogKey2", "ipv4OamAddress2", "ipv4Loopback0Address2", "nmLanV6Address2", "managementV6Address2", true, true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", "modelCustomizationId2", "nfType2", "nfFunction2", "nfRole2", "nfNamingCode2", new RelationshipList(), new VfModules()); - VnfInstance vnfInstance3 = new VnfInstance("vnfId1", "vnfName1", "vnfName2-1", "vnfType1", "serviceId1", "provisionStatus1", "licenseKey1", "equipmentRole1", "orchestrationStatus1", "heatStackId1", "msoCatalogKey1", "ipv4OamAddress1", "ipv4Loopback0Address1", "nmLanV6Address1", "managementV6Address1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", "nfType1", "nfFunction1", "nfRole1", "nfNamingCode1", new RelationshipList(), new VfModules()); + VnfInstance vnfInstance1 = new VnfInstance("vnfId1", "vnfName1", "vnfName2-1", "vnfType1", "serviceId1", "provisionStatus1", "licenseKey1", "equipmentRole1", "orchestrationStatus1", "heatStackId1", "msoCatalogKey1", "ipv4OamAddress1", "ipv4Loopback0Address1", "nmLanV6Address1", "managementV6Address1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", "nfType1", "nfFunction1", "nfRole1", "nfNamingCode1", new RelationshipList(), new VfModules(), new LInterfaceInstanceList()); + VnfInstance vnfInstance2 = new VnfInstance("vnfId2", "vnfName2", "vnfName2-2", "vnfType2", "serviceId2", "provisionStatus2", "licenseKey2", "equipmentRole2", "orchestrationStatus2", "heatStackId2", "msoCatalogKey2", "ipv4OamAddress2", "ipv4Loopback0Address2", "nmLanV6Address2", "managementV6Address2", true, true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", "modelCustomizationId2", "nfType2", "nfFunction2", "nfRole2", "nfNamingCode2", new RelationshipList(), new VfModules(), new LInterfaceInstanceList()); + VnfInstance vnfInstance3 = new VnfInstance("vnfId1", "vnfName1", "vnfName2-1", "vnfType1", "serviceId1", "provisionStatus1", "licenseKey1", "equipmentRole1", "orchestrationStatus1", "heatStackId1", "msoCatalogKey1", "ipv4OamAddress1", "ipv4Loopback0Address1", "nmLanV6Address1", "managementV6Address1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", "nfType1", "nfFunction1", "nfRole1", "nfNamingCode1", new RelationshipList(), new VfModules(), new LInterfaceInstanceList()); assertTrue(vnfInstance1.equals(vnfInstance1)); assertTrue(!vnfInstance1.equals(vnfInstance2)); diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VserverTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VserverTest.java index b42da7e..509db34 100644 --- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VserverTest.java +++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VserverTest.java @@ -26,6 +26,7 @@ import org.junit.Test; import org.onap.pomba.contextbuilder.aai.datatype.Relationship; import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList; import org.onap.pomba.contextbuilder.aai.datatype.Vserver; +import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList; public class VserverTest { @@ -62,7 +63,7 @@ public class VserverTest { @Test public void testVserverWithParameters() { - Vserver aVServer = new Vserver("vserverId", "vserverName", "vserverName2", "provStatus", "vserverSelflink", true, true, "resourceVersion", new RelationshipList()); + Vserver aVServer = new Vserver("vserverId", "vserverName", "vserverName2", "provStatus", "vserverSelflink", true, true, "resourceVersion", new RelationshipList(), new LInterfaceInstanceList()); assertEquals("vserverId", aVServer.getVserverId()); assertEquals("vserverName", aVServer.getVserverName()); @@ -76,9 +77,9 @@ public class VserverTest { @Test public void testVserverEquals() { - Vserver aVServer1 = new Vserver("vserverId1", "vserverName1", "vserverName2", "provStatus1", "vserverSelflink1", true, true, "resourceVersion1", new RelationshipList()); - Vserver aVServer2 = new Vserver("vserverId2", "vserverName2", "vserverName2", "provStatus2", "vserverSelflink2", false, false, "resourceVersion2", new RelationshipList()); - Vserver aVServer3 = new Vserver("vserverId1", "vserverName1", "vserverName2", "provStatus1", "vserverSelflink1", true, true, "resourceVersion1", new RelationshipList()); + Vserver aVServer1 = new Vserver("vserverId1", "vserverName1", "vserverName2", "provStatus1", "vserverSelflink1", true, true, "resourceVersion1", new RelationshipList(), new LInterfaceInstanceList()); + Vserver aVServer2 = new Vserver("vserverId2", "vserverName2", "vserverName2", "provStatus2", "vserverSelflink2", false, false, "resourceVersion2", new RelationshipList(), new LInterfaceInstanceList()); + Vserver aVServer3 = new Vserver("vserverId1", "vserverName1", "vserverName2", "provStatus1", "vserverSelflink1", true, true, "resourceVersion1", new RelationshipList(), new LInterfaceInstanceList()); assertTrue(aVServer1.equals(aVServer1)); assertFalse(aVServer1.equals(aVServer2)); diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java index 9f82c69..8e50484 100644 --- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java +++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java @@ -139,7 +139,7 @@ public class RestServiceTest { // note: match to vserver-id to the path of "vserver" in (3) addResponse( "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant" - + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH, "junit/aai-vserver.json", aaiEnricherRule); // 5. simulate the rsp of pserver @@ -168,9 +168,10 @@ public class RestServiceTest { } - ///Verify the relationship serviceInstanceId -> vnf -> vserver -> LInterfaceList + ///Verify the relationship serviceInstanceId -> vnf (containing L-Interface) -> vserver (containing - LInterfaceList) + @Test - public void testGetContext_VSERVER_L_interface_List() throws Exception { + public void testGetContext_VSERVER_L_interface_And_Logical_link() throws Exception { String transactionId = UUID.randomUUID().toString(); String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json @@ -190,23 +191,30 @@ public class RestServiceTest { // 3. simulate the rsp of VNF (with 1 vserver) // note: match vnf_id in (2) addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH, - "junit/genericVnfInput_set2.json", aaiEnricherRule); + "junit/genericVnfInput_set6.json", aaiEnricherRule); // 4. simulate the rsp of vserer // note: match to vserver-id to the path of "vserver" in (3) addResponse( "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant" - + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH, "junit/aai-vserver-set3.json", aaiEnricherRule); - - // 5. simulate the rsp of LInterface - // note: match l-Interface hostname to the path of "l-interface" in (4) + // 5. simulate the rsp of logical-link + // note: match to link-name to the path of "relationship-list" in (3: genericVnfInput_set6) + // and match the link-name to (4 aai-vserver-set3.json) addResponse( - "/aai/v13/l-interfaces/l-interface/junit-l-interface-name1" + DEPTH, - "junit/l-interface-input.json", aaiEnricherRule); + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1", + "junit/logical-link-input1.json", aaiEnricherRule); addResponse( - "/aai/v13/l-interfaces/l-interface/junit-l-interface-name2" + DEPTH, - "junit/l-interface-input2.json", aaiEnricherRule); + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2", + "junit/logical-link-input2.json", aaiEnricherRule); + addResponse( + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-3", + "junit/logical-link-input3.json", aaiEnricherRule); + addResponse( + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-4", + "junit/logical-link-input4.json", aaiEnricherRule); + when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl); @@ -219,6 +227,13 @@ public class RestServiceTest { // verify results List vnfList = modelCtx.getVnfs(); assertEquals(vnfList.size(), 1); + assertEquals(vnfList.get(0).getLInterfaceList().size(), 2); + assertEquals(vnfList.get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name3"); //l-interface-name + assertEquals(vnfList.get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name4"); //l-interface-name + assertEquals(vnfList.get(0).getLInterfaceList().get(0).getLogicalLinkList().size(), 1); + assertEquals(vnfList.get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-3"); //Logical-link at vnf->l-interface -> Logical-link + assertEquals(vnfList.get(0).getLInterfaceList().get(1).getLogicalLinkList().size(), 1); + assertEquals(vnfList.get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-4"); List vfModuleList = vnfList.get(0).getVfModules(); assertEquals(vfModuleList.size(), 1); List vmList = vfModuleList.get(0).getVms(); @@ -227,6 +242,11 @@ public class RestServiceTest { assertEquals(vmList.get(0).getLInterfaceList().size(), 2); assertEquals(vmList.get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name1"); //l-interface-name assertEquals(vmList.get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name2"); //l-interface-name + assertEquals(vmList.get(0).getLInterfaceList().get(0).getLogicalLinkList().size(), 1); + assertEquals(vmList.get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1"); //Logical-link at vserver->l-interface -> Logical-link + assertEquals(vmList.get(0).getLInterfaceList().get(1).getLogicalLinkList().size(), 1); + assertEquals(vmList.get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-2"); + } ///Verify the relationship serviceInstanceId -> vnf + vnfc @@ -257,7 +277,66 @@ public class RestServiceTest { // note: match to vserver-id to the path of "vserver" in (3) addResponse( "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant" - + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH, + "junit/aai-vserver-set2.json", aaiEnricherRule); + + // 5. simulate the rsp of vnfc + // note: match to vnfc-name to the path of "vnfc" in (3) + addResponse( + "/aai/v13/network/vnfcs/vnfc/junit-vnfc-name1212", + "junit/vnfc-input1.json", aaiEnricherRule); + + when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl); + + Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId, + serviceInstanceId); + + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + Gson gson = new Gson(); + ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class); + // verify results + List vnfList = modelCtx.getVnfs(); + assertEquals(vnfList.size(), 1); + List vfModuleList = vnfList.get(0).getVfModules(); + assertEquals(vfModuleList.size(), 1); + List vmList = vfModuleList.get(0).getVms(); + assertEquals(vmList.size(), 1); + assertEquals(vmList.get(0).getUuid(), "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"); //vserver-id + + List vnfcList = vnfList.get(0).getVnfcs(); + assertEquals(vnfcList.size(), 1); + assertEquals(vnfcList.get(0).getName(), "junit-vnfc-name1212"); //vnfc-name + } + + ///Verify the relationship serviceInstanceId -> vnf + vnfc + @Test + public void testGetContext_VNFC2() throws Exception { + + String transactionId = UUID.randomUUID().toString(); + String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json + String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId; + + // Test with No Partner Name + final MultivaluedMap multivaluedMapImpl = buildHeaders( + transactionId, testRestHeaders, httpBasicAuthorization); + + // 1. simulate the response to obtainResourceLink based on ServiceInstanceId + addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule); + // 2. simulate the response of AAI (1 vnf) + // note: match serviceInstanceId in (1) + addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb", + "junit/aai-service-instance_set2.json", aaiEnricherRule); + + // 3. simulate the rsp of VNF (with 1 vserver) + // note: match vnf_id in (2) + addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH, + "junit/genericVnfInput_set5.json", aaiEnricherRule); + + // 4. simulate the rsp of vserer + // note: match to vserver-id to the path of "vserver" in (3) + addResponse( + "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant" + + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH, "junit/aai-vserver-set2.json", aaiEnricherRule); // 5. simulate the rsp of vnfc @@ -287,4 +366,175 @@ public class RestServiceTest { assertEquals(vnfcList.size(), 1); assertEquals(vnfcList.get(0).getName(), "junit-vnfc-name1212"); //vnfc-name } + + ///Verify the relationship serviceInstanceId -> vnf + vnfc + @Test + public void testGetContext_LogicalLink_in_service_level() throws Exception { + String transactionId = UUID.randomUUID().toString(); + String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json + String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId; + + // Test with No Partner Name + final MultivaluedMap multivaluedMapImpl = buildHeaders( + transactionId, testRestHeaders, httpBasicAuthorization); + + // 1. simulate the response to obtainResourceLink based on ServiceInstanceId + addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule); + // 2. simulate the response of AAI (1 vnf) + // note: match serviceInstanceId in (1) + addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb", + "junit/aai-service-instance_set4.json", aaiEnricherRule); + + // 3. simulate the rsp of logical-link + // note: match to link-name to the path of "relationship-list" in (2: aai-service-instance_set4) + addResponse( + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1", + "junit/logical-link-input1.json", aaiEnricherRule); + addResponse( + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2", + "junit/logical-link-input2.json", aaiEnricherRule); + + when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl); + Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId, + serviceInstanceId); + + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + Gson gson = new Gson(); + ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class); + assertEquals(modelCtx.getLogicalLinkList().size(), 2); + assertEquals(modelCtx.getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1"); + assertEquals(modelCtx.getLogicalLinkList().get(1).getName(), "01e8d84a-logical-link-2"); + } + + ///Verify the relationship P-interface, L-interaface, Logical-link + @Test + public void testGetContext_LogicalLink_in_PInterface_level_with_PNF() throws Exception { + String transactionId = UUID.randomUUID().toString(); + String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json + String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId; + + // Test with No Partner Name + final MultivaluedMap multivaluedMapImpl = buildHeaders( + transactionId, testRestHeaders, httpBasicAuthorization); + + // 1. simulate the response to obtainResourceLink based on ServiceInstanceId + addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule); + // 2. simulate the response of AAI (1 vnf and 1 pnf) + addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb", + "junit/aai-service-instance.json", aaiEnricherRule); + + // 3. simulate the rsp of VNF + addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH, + "junit/genericVnfInput.json", aaiEnricherRule); + + // 4. simulate the response of PNF based on the resourceLink in (2) + //note: match pnf_id in junit/aai-service-instance.json + addResponse( "/aai/v13/network/pnfs/pnf/amdocsPnfName" + DEPTH, + "junit/pnfInput_w_pInterface_LInterface_set2.json", aaiEnricherRule); + + // 5. simulate the rsp of logical-link + // note: match to link-name to the path of "relationship-list" in (4: pnfInput_w_pInterface_LInterface_set2) + addResponse( + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1", + "junit/logical-link-input1.json", aaiEnricherRule); + addResponse( + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2", + "junit/logical-link-input2.json", aaiEnricherRule); + + when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl); + Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId, + serviceInstanceId); + + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + Gson gson = new Gson(); + ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class); + assertEquals(modelCtx.getVnfs().size(), 1); + assertEquals(modelCtx.getPnfs().size(), 1); + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().size(), 1); + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().size(), 2); + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name5"); //l-interface-name + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name6"); //l-interface-name + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().size(), 2); + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1"); + assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().get(1).getName(), "01e8d84a-logical-link-2"); + } + + ///Verify the relationship P-interface, L-interaface, Logical-link + @Test + public void testGetContext_LogicalLink_in_PInterface_level_with_PSERVER() throws Exception { + String transactionId = UUID.randomUUID().toString(); + String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json + String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId; + + // Test with No Partner Name + final MultivaluedMap multivaluedMapImpl = buildHeaders( + transactionId, testRestHeaders, httpBasicAuthorization); + + // 1. simulate the response to obtainResourceLink based on ServiceInstanceId + addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule); + // 2. simulate the response of AAI (1 vnf) + // note: match serviceInstanceId in (1) + addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb", + "junit/aai-service-instance_set2.json", aaiEnricherRule); + + // 3. simulate the rsp of VNF (with 1 vserver) + // note: match vnf_id in (2) + addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH, + "junit/genericVnfInput_set2.json", aaiEnricherRule); + + // 4. simulate the rsp of vserer + // note: match to vserver-id to the path of "vserver" in (3) + addResponse( + "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant" + + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH, + "junit/aai-vserver.json", aaiEnricherRule); + + // 5. simulate the rsp of pserver with P-interface which also contains L-interface. + // note: match pserver hostname to the path of "pserver" in (4) + addResponse( + "/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com" + DEPTH, + "junit/pserverInput_with_pInterface_LInterface_set2.json", aaiEnricherRule); + + // 6. simulate the rsp of logical-link + // note: match to link-name to the path of "relationship-list" in (5: pserverInput_with_pInterface_LInterface_set2) + addResponse( + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1", + "junit/logical-link-input1.json", aaiEnricherRule); + addResponse( + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2", + "junit/logical-link-input2.json", aaiEnricherRule); + addResponse( + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-3", + "junit/logical-link-input3.json", aaiEnricherRule); + addResponse( + "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-4", + "junit/logical-link-input4.json", aaiEnricherRule); + + when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl); + Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId, + serviceInstanceId); + + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + Gson gson = new Gson(); + ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class); + + List vnfList = modelCtx.getVnfs(); + assertEquals(vnfList.size(), 1); + List vfModuleList = vnfList.get(0).getVfModules(); + assertEquals(vfModuleList.size(), 1); + List vmList = vfModuleList.get(0).getVms(); + assertEquals(vmList.size(), 1); + assertEquals(vmList.get(0).getPServer().getPInterfaceList().size(), 1); + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getName(), "bdc3cc2a-c73e-414f-7ddb-367de92801cb"); //interface-name + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().size(), 2); + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name7"); //Vserver-> Pserver-> P-interface -> l-interface + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name8"); + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getLogicalLinkList().size(), 1); + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-3"); //Vserver-> Pserver-> P-interface -> l-interface -> logical-link + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getLogicalLinkList().size(), 1); + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-4"); + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().size(), 2); + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1"); //Vserver-> Pserver-> P-interface -> Logical-link + assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().get(1).getName(), "01e8d84a-logical-link-2"); + } } diff --git a/src/test/resources/junit/aai-service-instance_set4.json b/src/test/resources/junit/aai-service-instance_set4.json new file mode 100644 index 0000000..f7e6f1a --- /dev/null +++ b/src/test/resources/junit/aai-service-instance_set4.json @@ -0,0 +1,44 @@ +{ + "service-instance-id": "adc3cc2a-c73e-414f-8ddb-367de81300cb", + "service-instance-name": "Firewall1", + "model-invariant-id": "0c5a20de-87ad-442c-9190-f38ab0a6bb7f", + "model-version-id": "d3d6cf83-d03a-43cc-99ff-206d40bb9a72", + "resource-version": "1527637758480", + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-1" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + }, + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-2" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + } + + ] + } +} diff --git a/src/test/resources/junit/aai-vserver-set3.json b/src/test/resources/junit/aai-vserver-set3.json index f50d65a..9804786 100644 --- a/src/test/resources/junit/aai-vserver-set3.json +++ b/src/test/resources/junit/aai-vserver-set3.json @@ -7,40 +7,72 @@ "in-maint": false, "is-closed-loop-disabled": false, "resource-version": "1528481820321", + "l-interfaces" : { + "l-interface" : [ + { + "interface-id": "junit-l-interface-1", + "interface-name": "junit-l-interface-name1", + "interface-role": "interface-role1", + "is-port-mirrored": "true", + "admin-status": "admin-status1", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-1", + "in-maint": "true", + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-1" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + } + ] + } + }, + { + "interface-id": "junit-l-interface-2", + "interface-name": "junit-l-interface-name2", + "interface-role": "interface-role2", + "is-port-mirrored": "true", + "admin-status": "admin-status2", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-2", + "in-maint": "true", + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-2" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + } + ] + } + } + ] + }, "relationship-list": { "relationship": [ - { - "related-to": "l-interface", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v13/l-interfaces/l-interface/junit-l-interface-name1", - "relationship-data": [ - { - "relationship-key": "l-interface.interface-name", - "relationship-value": "junit-l-interface-name1" - } - ], - "related-to-property": [ - { "property-key": "l-interface.interface-id", - "property-value": "junit-l-interface-1" - } - ] - }, - { - "related-to": "l-interface", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v13/l-interfaces/l-interface/junit-l-interface-name2", - "relationship-data": [ - { - "relationship-key": "l-interface.interface-name", - "relationship-value": "junit-l-interface-name2" - } - ], - "related-to-property": [ - { "property-key": "l-interface.interface-id", - "property-value": "junit-l-interface-2" - } - ] - }, { "related-to": "generic-vnf", "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39", diff --git a/src/test/resources/junit/genericVnfInput_set6.json b/src/test/resources/junit/genericVnfInput_set6.json new file mode 100644 index 0000000..e5f7ea4 --- /dev/null +++ b/src/test/resources/junit/genericVnfInput_set6.json @@ -0,0 +1,148 @@ +{ + "vnf-id": "8a9ddb25-2e79-449c-a40d-5011bac0da39", + "vnf-name": "Firewall-1", + "vnf-type": "vFW-vSINK-service/vFWvSINK 0", + "service-id": "8ea56b0d-459d-4668-b363-c9567432d8b7", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1527637940029", + "model-invariant-id": "59dd4d63-8f21-406c-98c0-3b057bb86820", + "model-version-id": "e2d52f32-a952-46f5-800c-c250903625d6", + "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc", + "nf-type": "", + "nf-function": "", + "nf-role": "", + "nf-naming-code": "", + "l-interfaces" : { + "l-interface" : [ + { + "interface-id": "junit-l-interface-3", + "interface-name": "junit-l-interface-name3", + "interface-role": "interface-role3", + "is-port-mirrored": "true", + "admin-status": "admin-status3", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-3", + "in-maint": "true", + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-3", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-3" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + } + ] + } + }, + { + "interface-id": "junit-l-interface-4", + "interface-name": "junit-l-interface-name4", + "interface-role": "interface-role4", + "is-port-mirrored": "true", + "admin-status": "admin-status4", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-4", + "in-maint": "true", + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-4", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-4" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "vserver", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "RegionOne" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "b49b830686654191bb1e952a74b014ad" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + } + ] + }, + { + "related-to": "service-instance", + "related-link": "/aai/v13/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "Demonstration" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "vFWCL" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "adc3cc2a-c73e-414f-8ddb-367de81300cb" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "Firewall1" + } + ] + } + ] + }, + "vf-modules": { + "vf-module": [ + { + "vf-module-id": "1563b649-9e05-4288-b7d9-e3639a54ace6", + "vf-module-name": "vFW_SINC_Module-2", + "heat-stack-id": "vFW_SINC_Module-2/41c4533a-748d-4cf4-a8d3-eccdd0aeb0d4", + "orchestration-status": "active", + "is-base-vf-module": true, + "resource-version": "1527638439198", + "model-invariant-id": "74bc1518-282d-4148-860f-8892b6369456", + "model-version-id": "4e3d28cf-d654-41af-a47b-04b4bd0ac58e", + "model-customization-id": "cc51ab7d-9b03-4bd6-9104-09df0c7c7907", + "module-index": 0 + } + ] + } +} diff --git a/src/test/resources/junit/l-interface-input.json b/src/test/resources/junit/l-interface-input.json deleted file mode 100644 index 0f80367..0000000 --- a/src/test/resources/junit/l-interface-input.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "interface-id": "junit-l-interface-1", - "interface-name": "junit-l-interface-name1", - "interface-role": "interface-role1", - "is-port-mirrored": "true", - "admin-status": "admin-status1", - "network-name": "network-name-amdocs", - "macaddr": "macaddr-1", - "in-maint": "true" -} \ No newline at end of file diff --git a/src/test/resources/junit/l-interface-input2.json b/src/test/resources/junit/l-interface-input2.json deleted file mode 100644 index 3bcbbda..0000000 --- a/src/test/resources/junit/l-interface-input2.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "interface-id": "junit-l-interface-2", - "interface-name": "junit-l-interface-name2", - "interface-role": "interface-role2", - "is-port-mirrored": "true", - "admin-status": "admin-status2", - "network-name": "network-name-amdocs", - "macaddr": "macaddr-2", - "in-maint": "true" -} \ No newline at end of file diff --git a/src/test/resources/junit/logical-link-input1.json b/src/test/resources/junit/logical-link-input1.json new file mode 100644 index 0000000..40fc85d --- /dev/null +++ b/src/test/resources/junit/logical-link-input1.json @@ -0,0 +1,17 @@ +{ + "link-name" : "01e8d84a-logical-link-1", + "link-id" : "link-id-1", + "model-version-id" : "model-version-id_1", + "model-invariant-id" : "model-invariant-id_1", + "link-type" : "link-type_1", + "routing-protocol" : "routing-protocol-1", + "speed-value" : "speed-value-1", + "speed-units" : "speed-units-001", + "ip-version" : "ip-version-001", + "prov-status" : "prov-status-1", + "link-role" : "link-role-1", + "link-name2" : "link-name2-1", + "circuit-id" : "circuit-id-001", + "purpose" : "purpose-1", + "in-maint" : false +} \ No newline at end of file diff --git a/src/test/resources/junit/logical-link-input2.json b/src/test/resources/junit/logical-link-input2.json new file mode 100644 index 0000000..e606764 --- /dev/null +++ b/src/test/resources/junit/logical-link-input2.json @@ -0,0 +1,17 @@ +{ + "link-name" : "01e8d84a-logical-link-2", + "link-id" : "link-id-2", + "model-version-id" : "model-version-id_2", + "model-invariant-id" : "model-invariant-id_2", + "link-type" : "link-type_2", + "routing-protocol" : "routing-protocol-2", + "speed-value" : "speed-value-2", + "speed-units" : "speed-units-002", + "ip-version" : "ip-version-002", + "prov-status" : "prov-status-2", + "link-role" : "link-role-2", + "link-name2" : "link-name2-2", + "circuit-id" : "circuit-id-002", + "purpose" : "purpose-2", + "in-maint" : true +} \ No newline at end of file diff --git a/src/test/resources/junit/logical-link-input3.json b/src/test/resources/junit/logical-link-input3.json new file mode 100644 index 0000000..bc25f61 --- /dev/null +++ b/src/test/resources/junit/logical-link-input3.json @@ -0,0 +1,17 @@ +{ + "link-name" : "01e8d84a-logical-link-3", + "link-id" : "link-id-3", + "model-version-id" : "model-version-id_3", + "model-invariant-id" : "model-invariant-id_3", + "link-type" : "link-type_3", + "routing-protocol" : "routing-protocol-3", + "speed-value" : "speed-value-3", + "speed-units" : "speed-units-003", + "ip-version" : "ip-version-003", + "prov-status" : "prov-status-3", + "link-role" : "link-role-3", + "link-name2" : "link-name2-3", + "circuit-id" : "circuit-id-003", + "purpose" : "purpose-3", + "in-maint" : false +} \ No newline at end of file diff --git a/src/test/resources/junit/logical-link-input4.json b/src/test/resources/junit/logical-link-input4.json new file mode 100644 index 0000000..d44f075 --- /dev/null +++ b/src/test/resources/junit/logical-link-input4.json @@ -0,0 +1,17 @@ +{ + "link-name" : "01e8d84a-logical-link-4", + "link-id" : "link-id-4", + "model-version-id" : "model-version-id_4", + "model-invariant-id" : "model-invariant-id_4", + "link-type" : "link-type_4", + "routing-protocol" : "routing-protocol-4", + "speed-value" : "speed-value-4", + "speed-units" : "speed-units-004", + "ip-version" : "ip-version-004", + "prov-status" : "prov-status-4", + "link-role" : "link-role-4", + "link-name2" : "link-name2-4", + "circuit-id" : "circuit-id-004", + "purpose" : "purpose-4", + "in-maint" : false +} \ No newline at end of file diff --git a/src/test/resources/junit/pnfInput_w_pInterface.json b/src/test/resources/junit/pnfInput_w_pInterface.json deleted file mode 100644 index c534dfc..0000000 --- a/src/test/resources/junit/pnfInput_w_pInterface.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "pnf-name": "amdocsPnfName", - "pnf-name2": "amdocsPnfName2", - "pnf-name2-source": "pombaName2Source", - "pnf-id": "11112222pnf88889999", - "equip-type": "software", - "equip-vendor": "8df84f0a-737a-4628-be9c-c3c78454f9d9", - "equip-model": "123134236", - "management-option": "TBD", - "sw-version": "2", - "in-maint": "true", - "frame-id": "99888", - "serial-number": "c44b872f6830498b88c4989d67b2a6b7", - "status": "ACTIVE", - "nf-function": "nf-Function-123", - "nf-role": "22222", - "model-invariant-id": "12345", - "model-version-id": "2123", - "admin_state_up": true, - "resource-version": "28", - "tenant_id": "c44b872f6830498b88c4989d67b2a6b7", - "created_at": "2018-03-20T16:49:01Z", - "provider:network_type": "vlan", - "p-interfaces":{ - "p-interface": [ - { - "interface-name": "bdc3cc2a-c73e-414f-7ddb-367de92801cb", - "speed-value": "1225", - "speed-units": "mbs", - "port-description": "port-used-for-junit", - "equipment-identifier": "8df84f0a-737a-4628-be9c-c3c78454f9d9", - "interface-role": "123134236", - "interface-type": "Software", - "prov-status": "2", - "in-maint": "true", - "resource-version": "99888", - "serial-number": "c44b872f6830498b88c4989d67b2a6b7", - "status": "ACTIVE", - "inv-status": "TBD" - } - ] - }, - "relationship-list": { - "relationship": [ - { - "related-to": "vserver", - "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "CloudOwner" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "RegionOne" - }, - { - "relationship-key": "tenant.tenant-id", - "relationship-value": "b49b830686654191bb1e952a74b014ad" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" - } - ] - }, - { - "related-to": "l3-network", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951870", - "relationship-data": [ - { - "relationship-key": "l3-network.network-id", - "relationship-value": "HNP1d77c-1094-41ec-b7f3-94bb30951870" - } - ], - "related-to-property": [ - { - "property-key": "l3-network.network-name", - "property-value": "HNPORTALOAM.OAM" - } - ] - } - ] - } -} \ No newline at end of file diff --git a/src/test/resources/junit/pnfInput_w_pInterface_LInterface.json b/src/test/resources/junit/pnfInput_w_pInterface_LInterface.json new file mode 100644 index 0000000..d7a9fd7 --- /dev/null +++ b/src/test/resources/junit/pnfInput_w_pInterface_LInterface.json @@ -0,0 +1,110 @@ +{ + "pnf-name": "amdocsPnfName", + "pnf-name2": "amdocsPnfName2", + "pnf-name2-source": "pombaName2Source", + "pnf-id": "11112222pnf88889999", + "equip-type": "software", + "equip-vendor": "8df84f0a-737a-4628-be9c-c3c78454f9d9", + "equip-model": "123134236", + "management-option": "TBD", + "sw-version": "2", + "in-maint": "true", + "frame-id": "99888", + "serial-number": "c44b872f6830498b88c4989d67b2a6b7", + "status": "ACTIVE", + "nf-function": "nf-Function-123", + "nf-role": "22222", + "model-invariant-id": "12345", + "model-version-id": "2123", + "admin_state_up": true, + "resource-version": "28", + "tenant_id": "c44b872f6830498b88c4989d67b2a6b7", + "created_at": "2018-03-20T16:49:01Z", + "provider:network_type": "vlan", + "p-interfaces":{ + "p-interface": [ + { + "interface-name": "bdc3cc2a-c73e-414f-7ddb-367de92801cb", + "speed-value": "1225", + "speed-units": "mbs", + "port-description": "port-used-for-junit", + "equipment-identifier": "8df84f0a-737a-4628-be9c-c3c78454f9d9", + "interface-role": "123134236", + "interface-type": "Software", + "prov-status": "2", + "in-maint": "true", + "resource-version": "99888", + "serial-number": "c44b872f6830498b88c4989d67b2a6b7", + "status": "ACTIVE", + "inv-status": "TBD", + "l-interfaces" : { + "l-interface" : [ + { + "interface-id": "junit-l-interface-5", + "interface-name": "junit-l-interface-name5", + "interface-role": "interface-role5", + "is-port-mirrored": "true", + "admin-status": "admin-status5", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-5", + "in-maint": "true" + }, + { + "interface-id": "junit-l-interface-6", + "interface-name": "junit-l-interface-name6", + "interface-role": "interface-role6", + "is-port-mirrored": "true", + "admin-status": "admin-status6", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-6", + "in-maint": "true" + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "vserver", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "RegionOne" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "b49b830686654191bb1e952a74b014ad" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + } + ] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951870", + "relationship-data": [ + { + "relationship-key": "l3-network.network-id", + "relationship-value": "HNP1d77c-1094-41ec-b7f3-94bb30951870" + } + ], + "related-to-property": [ + { + "property-key": "l3-network.network-name", + "property-value": "HNPORTALOAM.OAM" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/src/test/resources/junit/pnfInput_w_pInterface_LInterface_set2.json b/src/test/resources/junit/pnfInput_w_pInterface_LInterface_set2.json new file mode 100644 index 0000000..acd995e --- /dev/null +++ b/src/test/resources/junit/pnfInput_w_pInterface_LInterface_set2.json @@ -0,0 +1,146 @@ +{ + "pnf-name": "amdocsPnfName", + "pnf-name2": "amdocsPnfName2", + "pnf-name2-source": "pombaName2Source", + "pnf-id": "11112222pnf88889999", + "equip-type": "software", + "equip-vendor": "8df84f0a-737a-4628-be9c-c3c78454f9d9", + "equip-model": "123134236", + "management-option": "TBD", + "sw-version": "2", + "in-maint": "true", + "frame-id": "99888", + "serial-number": "c44b872f6830498b88c4989d67b2a6b7", + "status": "ACTIVE", + "nf-function": "nf-Function-123", + "nf-role": "22222", + "model-invariant-id": "12345", + "model-version-id": "2123", + "admin_state_up": true, + "resource-version": "28", + "tenant_id": "c44b872f6830498b88c4989d67b2a6b7", + "created_at": "2018-03-20T16:49:01Z", + "provider:network_type": "vlan", + "p-interfaces":{ + "p-interface": [ + { + "interface-name": "bdc3cc2a-c73e-414f-7ddb-367de92801cb", + "speed-value": "1225", + "speed-units": "mbs", + "port-description": "port-used-for-junit", + "equipment-identifier": "8df84f0a-737a-4628-be9c-c3c78454f9d9", + "interface-role": "123134236", + "interface-type": "Software", + "prov-status": "2", + "in-maint": "true", + "resource-version": "99888", + "serial-number": "c44b872f6830498b88c4989d67b2a6b7", + "status": "ACTIVE", + "inv-status": "TBD", + "l-interfaces" : { + "l-interface" : [ + { + "interface-id": "junit-l-interface-5", + "interface-name": "junit-l-interface-name5", + "interface-role": "interface-role5", + "is-port-mirrored": "true", + "admin-status": "admin-status5", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-5", + "in-maint": "true" + }, + { + "interface-id": "junit-l-interface-6", + "interface-name": "junit-l-interface-name6", + "interface-role": "interface-role6", + "is-port-mirrored": "true", + "admin-status": "admin-status6", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-6", + "in-maint": "true" + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-1" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + }, + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-2" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "vserver", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "RegionOne" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "b49b830686654191bb1e952a74b014ad" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + } + ] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951870", + "relationship-data": [ + { + "relationship-key": "l3-network.network-id", + "relationship-value": "HNP1d77c-1094-41ec-b7f3-94bb30951870" + } + ], + "related-to-property": [ + { + "property-key": "l3-network.network-name", + "property-value": "HNPORTALOAM.OAM" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/src/test/resources/junit/pserverInput_with_pInterface.json b/src/test/resources/junit/pserverInput_with_pInterface.json deleted file mode 100644 index e33026b..0000000 --- a/src/test/resources/junit/pserverInput_with_pInterface.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "hostname": "mtn96compute.cci.att.com", - "fqdn": "mtn96compute.cci.att.com", - "pserver-id": "auto-generated-skeleton", - "pserver-name2": "pserverName2-hello", - "ptnii-equip-name": "ptnii-equip-name-hello", - "equip-type": "Firewall", - "equip-vendor": "equip-vendor-hello", - "equip-model": "equip-model-hello", - "internet-topology": "internet-topology-hello", - "purpose": "purpose-something-for-fun", - "serial-number": "1223128888", - "in-maint": false, - "resource-version": "1544034123458", - "p-interfaces":{ - "p-interface": [ - { - "interface-name": "bdc3cc2a-c73e-414f-7ddb-367de92801cb", - "speed-value": "1225", - "speed-units": "mbs", - "port-description": "port-used-for-junit", - "equipment-identifier": "8df84f0a-737a-4628-be9c-c3c78454f9d9", - "interface-role": "123134236", - "interface-type": "Software", - "prov-status": "2", - "in-maint": "true", - "resource-version": "99888", - "serial-number": "c44b872f6830498b88c4989d67b2a6b7", - "status": "ACTIVE", - "inv-status": "TBD" - } - ] - }, - "relationship-list": { - "relationship": [ - { - "related-to": "vserver", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "CloudOwner" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "RegionOne" - }, - { - "relationship-key": "tenant.tenant-id", - "relationship-value": "b49b830686654191bb1e952a74b014ad" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" - } - ], - "related-to-property": [ { - "property-key": "vserver.vserver-name", - "property-value": "Firewall-0" - }] - } - ] - } -} \ No newline at end of file diff --git a/src/test/resources/junit/pserverInput_with_pInterface_LInterface.json b/src/test/resources/junit/pserverInput_with_pInterface_LInterface.json new file mode 100644 index 0000000..f0ce496 --- /dev/null +++ b/src/test/resources/junit/pserverInput_with_pInterface_LInterface.json @@ -0,0 +1,89 @@ +{ + "hostname": "mtn96compute.cci.att.com", + "fqdn": "mtn96compute.cci.att.com", + "pserver-id": "auto-generated-skeleton", + "pserver-name2": "pserverName2-hello", + "ptnii-equip-name": "ptnii-equip-name-hello", + "equip-type": "Firewall", + "equip-vendor": "equip-vendor-hello", + "equip-model": "equip-model-hello", + "internet-topology": "internet-topology-hello", + "purpose": "purpose-something-for-fun", + "serial-number": "1223128888", + "in-maint": false, + "resource-version": "1544034123458", + "p-interfaces":{ + "p-interface": [ + { + "interface-name": "bdc3cc2a-c73e-414f-7ddb-367de92801cb", + "speed-value": "1225", + "speed-units": "mbs", + "port-description": "port-used-for-junit", + "equipment-identifier": "8df84f0a-737a-4628-be9c-c3c78454f9d9", + "interface-role": "123134236", + "interface-type": "Software", + "prov-status": "2", + "in-maint": "true", + "resource-version": "99888", + "serial-number": "c44b872f6830498b88c4989d67b2a6b7", + "status": "ACTIVE", + "inv-status": "TBD", + "l-interfaces" : { + "l-interface" : [ + { + "interface-id": "junit-l-interface-7", + "interface-name": "junit-l-interface-name7", + "interface-role": "interface-role7", + "is-port-mirrored": "true", + "admin-status": "admin-status7", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-7", + "in-maint": "true" + }, + { + "interface-id": "junit-l-interface-8", + "interface-name": "junit-l-interface-name8", + "interface-role": "interface-role8", + "is-port-mirrored": "true", + "admin-status": "admin-status8", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-8", + "in-maint": "true" + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "vserver", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "RegionOne" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "b49b830686654191bb1e952a74b014ad" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + } + ], + "related-to-property": [ { + "property-key": "vserver.vserver-name", + "property-value": "Firewall-0" + }] + } + ] + } +} \ No newline at end of file diff --git a/src/test/resources/junit/pserverInput_with_pInterface_LInterface_set2.json b/src/test/resources/junit/pserverInput_with_pInterface_LInterface_set2.json new file mode 100644 index 0000000..7b87fa7 --- /dev/null +++ b/src/test/resources/junit/pserverInput_with_pInterface_LInterface_set2.json @@ -0,0 +1,165 @@ +{ + "hostname": "mtn96compute.cci.att.com", + "fqdn": "mtn96compute.cci.att.com", + "pserver-id": "auto-generated-skeleton", + "pserver-name2": "pserverName2-hello", + "ptnii-equip-name": "ptnii-equip-name-hello", + "equip-type": "Firewall", + "equip-vendor": "equip-vendor-hello", + "equip-model": "equip-model-hello", + "internet-topology": "internet-topology-hello", + "purpose": "purpose-something-for-fun", + "serial-number": "1223128888", + "in-maint": false, + "resource-version": "1544034123458", + "p-interfaces":{ + "p-interface": [ + { + "interface-name": "bdc3cc2a-c73e-414f-7ddb-367de92801cb", + "speed-value": "1225", + "speed-units": "mbs", + "port-description": "port-used-for-junit", + "equipment-identifier": "8df84f0a-737a-4628-be9c-c3c78454f9d9", + "interface-role": "123134236", + "interface-type": "Software", + "prov-status": "2", + "in-maint": "true", + "resource-version": "99888", + "serial-number": "c44b872f6830498b88c4989d67b2a6b7", + "status": "ACTIVE", + "inv-status": "TBD", + "l-interfaces" : { + "l-interface" : [ + { + "interface-id": "junit-l-interface-7", + "interface-name": "junit-l-interface-name7", + "interface-role": "interface-role7", + "is-port-mirrored": "true", + "admin-status": "admin-status7", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-7", + "in-maint": "true", + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-3", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-3" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + } + ] + } + }, + { + "interface-id": "junit-l-interface-8", + "interface-name": "junit-l-interface-name8", + "interface-role": "interface-role8", + "is-port-mirrored": "true", + "admin-status": "admin-status8", + "network-name": "network-name-amdocs", + "macaddr": "macaddr-8", + "in-maint": "true", + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-4", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-4" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-1" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + }, + { + "related-to": "logical-link", + "related-link": "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "01e8d84a-logical-link-2" + } + ], + "related-to-property": [ + { + "property-key": "logical-link.circuit-id", + "property-value": "NET_8802" + } + ] + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "vserver", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "RegionOne" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "b49b830686654191bb1e952a74b014ad" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + } + ], + "related-to-property": [ { + "property-key": "vserver.vserver-name", + "property-value": "Firewall-0" + }] + } + ] + } +} \ No newline at end of file -- cgit 1.2.3-korg