X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tapi%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Ftapi%2Ftopology%2FTapiTopologyImplTest.java;h=8e615cb4b8ddaa623c45a59be39be3fe4e395f35;hb=refs%2Fchanges%2F46%2F100646%2F27;hp=94ff0c67f21e9b2ceba3e5faba468cc14c9287b7;hpb=3e33c429ca86add1881d7586a2d0c3c60ddac3c7;p=transportpce.git diff --git a/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImplTest.java b/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImplTest.java index 94ff0c67f..8e615cb4b 100644 --- a/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImplTest.java +++ b/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImplTest.java @@ -35,9 +35,11 @@ import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.common.network.RequestProcessor; import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations; import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl; +import org.opendaylight.transportpce.tapi.TapiStringConstants; import org.opendaylight.transportpce.tapi.connectivity.ConnectivityUtils; import org.opendaylight.transportpce.tapi.utils.TapiContext; import org.opendaylight.transportpce.tapi.utils.TapiInitialORMapping; +import org.opendaylight.transportpce.tapi.utils.TapiLink; import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils; import org.opendaylight.transportpce.test.AbstractTest; import org.opendaylight.transportpce.test.utils.TopologyDataUtils; @@ -89,27 +91,31 @@ public class TapiTopologyImplTest extends AbstractTest { public static ConnectivityUtils connectivityUtils; public static ServiceDataStoreOperations serviceDataStoreOperations; public static TapiInitialORMapping tapiInitialORMapping; + public static TapiLink tapiLink; @BeforeClass public static void setUp() throws InterruptedException, ExecutionException { executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS)); endSignal = new CountDownLatch(1); TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(), - TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II); + TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II); TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(), - TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II); + TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II); TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(), - TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II); + TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II); TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(), - TapiTopologyDataUtils.PORTMAPPING_FILE); + TapiTopologyDataUtils.PORTMAPPING_FILE); networkTransactionService = new NetworkTransactionImpl( - new RequestProcessor(getDataStoreContextUtil().getDataBroker())); + new RequestProcessor(getDataStoreContextUtil().getDataBroker())); + tapiLink = new TapiLink(networkTransactionService); serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(getDataStoreContextUtil().getDataBroker()); tapiContext = new TapiContext(networkTransactionService); - topologyUtils = new TopologyUtils(networkTransactionService, getDataStoreContextUtil().getDataBroker()); - connectivityUtils = new ConnectivityUtils(serviceDataStoreOperations, new HashMap<>(), tapiContext); + topologyUtils = new TopologyUtils(networkTransactionService, getDataStoreContextUtil().getDataBroker(), + tapiLink); + connectivityUtils = new ConnectivityUtils(serviceDataStoreOperations, new HashMap<>(), tapiContext, + networkTransactionService); tapiInitialORMapping = new TapiInitialORMapping(topologyUtils, connectivityUtils, - tapiContext, serviceDataStoreOperations); + tapiContext, serviceDataStoreOperations); tapiInitialORMapping.performTopoInitialMapping(); LOG.info("setup done"); } @@ -117,8 +123,9 @@ public class TapiTopologyImplTest extends AbstractTest { @Test public void getTopologyDetailsForTransponder100GTopologyWhenSuccessful() throws ExecutionException, InterruptedException { - GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(TopologyUtils.TPDR_100G); - TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils); + GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput( + TapiStringConstants.TPDR_100G); + TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils, tapiLink); ListenableFuture> result = tapiTopoImpl.getTopologyDetails(input); result.addListener(new Runnable() { @Override @@ -131,7 +138,7 @@ public class TapiTopologyImplTest extends AbstractTest { @Nullable Topology topology = rpcResult.getResult().getTopology(); assertNotNull("Topology should not be null", topology); - Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TopologyUtils.TPDR_100G.getBytes(StandardCharsets.UTF_8)) + Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.TPDR_100G.getBytes(StandardCharsets.UTF_8)) .toString()); assertEquals("incorrect topology uuid", topoUuid, topology.getUuid()); assertEquals("Node list size should be 1", 1, topology.getNode().size()); @@ -162,8 +169,9 @@ public class TapiTopologyImplTest extends AbstractTest { @Test public void getTopologyDetailsForOtnTopologyWithOtnLinksWhenSuccessful() throws ExecutionException, InterruptedException { - GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(TopologyUtils.T0_MULTILAYER); - TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils); + GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput( + TapiStringConstants.T0_MULTILAYER); + TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils, tapiLink); ListenableFuture> result = tapiTopoImpl.getTopologyDetails(input); result.addListener(new Runnable() { @Override @@ -179,37 +187,42 @@ public class TapiTopologyImplTest extends AbstractTest { assertEquals("Node list size should be 13", 13, topology.getNode().size()); long nb1 = topology.getNode().values().stream() .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR)) - .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("XPDR-A1-XPDR1")) + .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue() + .equals("XPDR-A1-XPDR1+DSR")) .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream() .filter(nep -> nep.getName().containsKey(new NameKey("100G-tpdr")))) .count(); assertEquals("XPDR-A1-XPDR1 should only have one client nep", 1, nb1); long nb2 = topology.getNode().values().stream() .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR)) - .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR1")) + .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue() + .equals("SPDR-SA1-XPDR1+DSR")) .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream() .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_C")))) .count(); assertEquals("SPDR-SA1-XPDR1 (mux) should have 4 client neps", 4, nb2); long nb3 = topology.getNode().values().stream() .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR)) - .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR1")) + .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue() + .equals("SPDR-SA1-XPDR1+DSR")) .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream() - .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_N")))) + .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N")))) .count(); assertEquals("SPDR-SA1-XPDR1 (mux) should have a single network nep", 1, nb3); long nb4 = topology.getNode().values().stream() .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR)) - .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR2")) + .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue() + .equals("SPDR-SA1-XPDR2+DSR")) .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream() .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_C")))) .count(); assertEquals("SPDR-SA1-XPDR2 (switch) should have 4 client neps", 4, nb4); long nb5 = topology.getNode().values().stream() .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR)) - .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR2")) + .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue() + .equals("SPDR-SA1-XPDR2+DSR")) .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream() - .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_N")))) + .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N")))) .count(); assertEquals("SPDR-SA1-XPDR2 (switch) should have 2 network neps", 2, nb5); assertEquals("Link list size should be 18", 18, topology.getLink().size()); @@ -243,37 +256,37 @@ public class TapiTopologyImplTest extends AbstractTest { .toString()); Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(StandardCharsets.UTF_8)) .toString()); - Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR+XPDR1-NETWORK1" + Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1" .getBytes(StandardCharsets.UTF_8)).toString()); - Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR+XPDR1-NETWORK1" + Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1" .getBytes(StandardCharsets.UTF_8)).toString()); Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1" .getBytes(StandardCharsets.UTF_8)).toString()); Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1" .getBytes(StandardCharsets.UTF_8)).toString()); Uuid link1Uuid = - new Uuid(UUID.nameUUIDFromBytes("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1" + new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1" .getBytes(StandardCharsets.UTF_8)).toString()); Uuid link2Uuid = - new Uuid(UUID.nameUUIDFromBytes("OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1" + new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1toSPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1" .getBytes(StandardCharsets.UTF_8)).toString()); List links = topology.nonnullLink().values().stream() .filter(l -> l.getName().containsKey(new NameKey("otn link name"))) .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue())) .collect(Collectors.toList()); - checkOtnLink(links.get(0), topoUuid, node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid, - "ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"); - checkOtnLink(links.get(1), topoUuid, node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid, - "OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"); + checkOtnLink(links.get(0), topoUuid, node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link1Uuid, + "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"); + checkOtnLink(links.get(1), topoUuid, node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link2Uuid, + "SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1toSPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"); } @Test public void getTopologyDetailsForFullTapiTopologyWithLinksWhenSuccessful() throws ExecutionException, InterruptedException { GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput( - TopologyUtils.T0_FULL_MULTILAYER); - TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils); + TapiStringConstants.T0_FULL_MULTILAYER); + TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils, tapiLink); ListenableFuture> result = tapiTopoImpl.getTopologyDetails(input); result.addListener(new Runnable() { @Override @@ -330,7 +343,7 @@ public class TapiTopologyImplTest extends AbstractTest { .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream() .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N")))) .count(); - assertEquals("SPDR-SA1-XPDR1+DSR (mux) should have a single external network nep", 1, enb3); + assertEquals("SPDR-SA1-XPDR1+DSR (mux) should have 4 external network nep", 4, enb3); long nb4 = topology.getNode().values().stream() .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR)) .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR2+DSR")) @@ -438,7 +451,7 @@ public class TapiTopologyImplTest extends AbstractTest { // Links in openroadm topology which include Roadm-to-Roadm and Xpdr-to-Roadm (ortopo / 2) // + transitional links -> 1 per network port of Xpdr + OTN links / 2 - assertEquals("Link list size should be 27", 27, topology.getLink().size()); + assertEquals("Link list size should be 25", 25, topology.getLink().size()); Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes("T0 - Full Multi-layer topology".getBytes()).toString()); assertEquals("incorrect topology uuid", topoUuid, topology.getUuid()); assertEquals("topology name should be T0 - Full Multi-layer topology", @@ -461,54 +474,18 @@ public class TapiTopologyImplTest extends AbstractTest { // Xpdr-to-Roadm long nbOmsLinks1 = topology.getLink().values().stream() .filter(l -> l.getName().containsKey(new NameKey("XPDR-RDM link name"))).count(); - long nbOtnLinks = topology.getLink().values().stream() - .filter(l -> l.getName().containsKey(new NameKey("otn link name"))).count(); // 1 transitional link per NETWORK port assertEquals("Link list should contain 16 transitional links", 16, nbTransititionalLinks); // 1 OMS per ROADM-to-ROADM link + Existing XPDR-tp-ROADM link in openroadm topology assertEquals("Link list should contain 9 OMS links", 9, nbOmsLinks + nbOmsLinks1); - // Should we consider OTN links as links or connections?? - assertEquals("Link list should contain 2 OTN links", 2, nbOtnLinks); - - Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(StandardCharsets.UTF_8)) - .toString()); - Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR".getBytes(StandardCharsets.UTF_8)) - .toString()); - Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(StandardCharsets.UTF_8)) - .toString()); - Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(StandardCharsets.UTF_8)) - .toString()); - Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1" - .getBytes(StandardCharsets.UTF_8)).toString()); - Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1" - .getBytes(StandardCharsets.UTF_8)).toString()); - Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1" - .getBytes(StandardCharsets.UTF_8)).toString()); - Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1" - .getBytes(StandardCharsets.UTF_8)).toString()); - Uuid link1Uuid = - new Uuid(UUID.nameUUIDFromBytes("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1" - .getBytes(StandardCharsets.UTF_8)).toString()); - Uuid link2Uuid = - new Uuid(UUID.nameUUIDFromBytes("OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1" - .getBytes(StandardCharsets.UTF_8)).toString()); - - List links = topology.nonnullLink().values().stream() - .filter(l -> l.getName().containsKey(new NameKey("otn link name"))) - .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue())) - .collect(Collectors.toList()); - checkOtnLink(links.get(0), topoUuid, node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid, - "ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"); - checkOtnLink(links.get(1), topoUuid, node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid, - "OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"); } @Test public void getNodeAndNepsDetailsWhenSuccessful() throws ExecutionException, InterruptedException { GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput( - TopologyUtils.T0_FULL_MULTILAYER); - TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils); + TapiStringConstants.T0_FULL_MULTILAYER); + TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils, tapiLink); ListenableFuture> result = tapiTopoImpl.getTopologyDetails(input); result.addListener(new Runnable() { @Override @@ -523,7 +500,7 @@ public class TapiTopologyImplTest extends AbstractTest { for (Node node:topology.getNode().values()) { String nodeName = node.getName().values().stream().findFirst().get().getValue(); GetNodeDetailsInput input1 = TapiTopologyDataUtils.buildGetNodeDetailsInput( - TopologyUtils.T0_FULL_MULTILAYER, nodeName); + TapiStringConstants.T0_FULL_MULTILAYER, nodeName); ListenableFuture> result1 = tapiTopoImpl.getNodeDetails(input1); result.addListener(new Runnable() { @Override @@ -539,7 +516,7 @@ public class TapiTopologyImplTest extends AbstractTest { for (OwnedNodeEdgePoint onep:node1.getOwnedNodeEdgePoint().values()) { String onepName = onep.getName().values().stream().findFirst().get().getValue(); GetNodeEdgePointDetailsInput input2 = TapiTopologyDataUtils.buildGetNodeEdgePointDetailsInput( - TopologyUtils.T0_FULL_MULTILAYER, nodeName, onepName); + TapiStringConstants.T0_FULL_MULTILAYER, nodeName, onepName); ListenableFuture> result2 = tapiTopoImpl.getNodeEdgePointDetails(input2); result.addListener(new Runnable() { @@ -552,7 +529,7 @@ public class TapiTopologyImplTest extends AbstractTest { RpcResult rpcResult2 = result2.get(); org.opendaylight.yang.gen.v1 .urn.onf.otcc.yang.tapi.topology.rev181210.get.node.edge.point.details.output.NodeEdgePoint - onep1 = rpcResult2.getResult().getNodeEdgePoint(); + onep1 = rpcResult2.getResult().getNodeEdgePoint(); assertNotNull("Node Edge Point should not be null", onep1); } } @@ -562,8 +539,8 @@ public class TapiTopologyImplTest extends AbstractTest { public void getLinkDetailsWhenSuccessful() throws ExecutionException, InterruptedException { GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput( - TopologyUtils.T0_FULL_MULTILAYER); - TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils); + TapiStringConstants.T0_FULL_MULTILAYER); + TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils, tapiLink); ListenableFuture> result = tapiTopoImpl.getTopologyDetails(input); result.addListener(new Runnable() { @Override @@ -578,7 +555,7 @@ public class TapiTopologyImplTest extends AbstractTest { for (Link link:topology.getLink().values()) { String linkName = link.getName().values().stream().findFirst().get().getValue(); GetLinkDetailsInput input1 = TapiTopologyDataUtils.buildGetLinkDetailsInput( - TopologyUtils.T0_FULL_MULTILAYER, linkName); + TapiStringConstants.T0_FULL_MULTILAYER, linkName); ListenableFuture> result1 = tapiTopoImpl.getLinkDetails(input1); result.addListener(new Runnable() { @Override @@ -598,7 +575,7 @@ public class TapiTopologyImplTest extends AbstractTest { public void getSipDetailsWhenSuccessful() throws ExecutionException, InterruptedException { GetServiceInterfacePointListInput input = TapiTopologyDataUtils.buildServiceInterfacePointListInput(); - TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils); + TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils, tapiLink); ListenableFuture> result = tapiTopoImpl .getServiceInterfacePointList(input); result.addListener(new Runnable() { @@ -626,7 +603,7 @@ public class TapiTopologyImplTest extends AbstractTest { RpcResult rpcResult1 = result1.get(); org.opendaylight.yang.gen.v1 .urn.onf.otcc.yang.tapi.common.rev181210.get.service._interface.point.details.output.Sip sip1 - = rpcResult1.getResult().getSip(); + = rpcResult1.getResult().getSip(); assertNotNull("Sip should not be null", sip1); } } @@ -636,7 +613,7 @@ public class TapiTopologyImplTest extends AbstractTest { assertEquals("bad name for the link", linkName, link.getName().get(new NameKey("otn link name")).getValue()); assertEquals("bad uuid for link", linkUuid, link.getUuid()); assertEquals("Available capacity unit should be MBPS", - CapacityUnit.MBPS, link.getAvailableCapacity().getTotalSize().getUnit()); + CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit()); String prefix = linkName.split("-")[0]; if ("OTU4".equals(prefix)) { assertEquals("Available capacity -total size value should be 0", @@ -651,10 +628,12 @@ public class TapiTopologyImplTest extends AbstractTest { Uint64.valueOf(100), link.getTotalPotentialCapacity().getTotalSize().getValue()); if ("OTU4".equals(prefix)) { assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA", - LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName()); + LayerProtocolName.PHOTONICMEDIA.getName(), + link.getLayerProtocolName().stream().findFirst().get().getName()); } else if ("ODTU4".equals(prefix)) { assertEquals("otn link should be between 2 nodes of protocol layers ODU", - LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName()); + LayerProtocolName.ODU.getName(), + link.getLayerProtocolName().stream().findFirst().get().getName()); } assertEquals("transitional link should be BIDIRECTIONAL", ForwardingDirection.BIDIRECTIONAL, link.getDirection());