Refactoring of Tapi Step2
[transportpce.git] / tapi / src / test / java / org / opendaylight / transportpce / tapi / topology / TapiTopologyImplTest.java
1 /*
2  * Copyright © 2019 Orange, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.transportpce.tapi.topology;
9
10 import static org.hamcrest.CoreMatchers.containsString;
11 import static org.hamcrest.CoreMatchers.either;
12 import static org.hamcrest.MatcherAssert.assertThat;
13 import static org.junit.jupiter.api.Assertions.assertEquals;
14 import static org.junit.jupiter.api.Assertions.assertNotNull;
15
16 import com.google.common.util.concurrent.ListenableFuture;
17 import com.google.common.util.concurrent.ListeningExecutorService;
18 import com.google.common.util.concurrent.MoreExecutors;
19 import java.nio.charset.Charset;
20 import java.nio.charset.StandardCharsets;
21 import java.util.ArrayList;
22 import java.util.HashMap;
23 import java.util.List;
24 import java.util.Map;
25 import java.util.UUID;
26 import java.util.concurrent.CountDownLatch;
27 import java.util.concurrent.ExecutionException;
28 import java.util.concurrent.Executors;
29 import java.util.stream.Collectors;
30 import org.eclipse.jdt.annotation.Nullable;
31 import org.junit.jupiter.api.BeforeAll;
32 import org.junit.jupiter.api.Test;
33 import org.opendaylight.transportpce.common.InstanceIdentifiers;
34 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
35 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
36 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
37 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
38 import org.opendaylight.transportpce.tapi.TapiStringConstants;
39 import org.opendaylight.transportpce.tapi.connectivity.ConnectivityUtils;
40 import org.opendaylight.transportpce.tapi.utils.TapiContext;
41 import org.opendaylight.transportpce.tapi.utils.TapiInitialORMapping;
42 import org.opendaylight.transportpce.tapi.utils.TapiLink;
43 import org.opendaylight.transportpce.tapi.utils.TapiLinkImpl;
44 import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils;
45 import org.opendaylight.transportpce.test.AbstractTest;
46 import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
47 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.AdministrativeState;
48 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.CAPACITYUNITGBPS;
49 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.ForwardingDirection;
50 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.GetServiceInterfacePointDetailsInput;
51 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.GetServiceInterfacePointDetailsOutput;
52 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.GetServiceInterfacePointListInput;
53 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.GetServiceInterfacePointListOutput;
54 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LayerProtocolName;
55 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.OperationalState;
56 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
57 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.get.service._interface.point.list.output.Sip;
58 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.get.service._interface.point.list.output.SipKey;
59 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.Name;
60 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameKey;
61 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULEMAYFORWARDACROSSGROUP;
62 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetLinkDetailsInput;
63 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetLinkDetailsOutput;
64 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeDetailsInput;
65 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeDetailsOutput;
66 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeEdgePointDetailsInput;
67 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeEdgePointDetailsOutput;
68 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetTopologyDetailsInput;
69 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetTopologyDetailsOutput;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Node;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.RuleType;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.get.topology.details.output.Topology;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroup;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.Rule;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.LinkKey;
79 import org.opendaylight.yangtools.yang.common.Decimal64;
80 import org.opendaylight.yangtools.yang.common.RpcResult;
81 import org.opendaylight.yangtools.yang.common.Uint64;
82 import org.slf4j.Logger;
83 import org.slf4j.LoggerFactory;
84
85 public class TapiTopologyImplTest extends AbstractTest {
86     private static final Logger LOG = LoggerFactory.getLogger(TapiTopologyImplTest.class);
87
88     private static ListeningExecutorService executorService;
89     private static CountDownLatch endSignal;
90     private static final int NUM_THREADS = 3;
91     private static NetworkTransactionService networkTransactionService;
92     private static TapiContext tapiContext;
93     private static TopologyUtils topologyUtils;
94     private static ConnectivityUtils connectivityUtils;
95     private static ServiceDataStoreOperations serviceDataStoreOperations;
96     private static TapiInitialORMapping tapiInitialORMapping;
97     private static TapiLink tapiLink;
98
99     @BeforeAll
100     static void setUp() throws InterruptedException, ExecutionException {
101         executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
102         endSignal = new CountDownLatch(1);
103         TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
104             TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
105         TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
106             TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II);
107         TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
108             TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
109         TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
110             TapiTopologyDataUtils.PORTMAPPING_FILE);
111         networkTransactionService = new NetworkTransactionImpl(getDataBroker());
112         tapiLink = new TapiLinkImpl(networkTransactionService);
113         serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(getDataStoreContextUtil().getDataBroker());
114         tapiContext = new TapiContext(networkTransactionService);
115         topologyUtils = new TopologyUtils(networkTransactionService, getDataStoreContextUtil().getDataBroker(),
116             tapiLink);
117         connectivityUtils = new ConnectivityUtils(serviceDataStoreOperations, new HashMap<>(), tapiContext,
118             networkTransactionService);
119         tapiInitialORMapping = new TapiInitialORMapping(topologyUtils, connectivityUtils,
120             tapiContext, serviceDataStoreOperations);
121         tapiInitialORMapping.performTopoInitialMapping();
122         LOG.info("setup done");
123     }
124
125     @Test
126     void getTopologyDetailsForTransponder100GTopologyWhenSuccessful()
127             throws ExecutionException, InterruptedException {
128         Uuid topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.TPDR_100G.getBytes(
129             Charset.forName("UTF-8"))).toString());
130         LOG.info("TPDR100GUuid = {}", topologyUuid);
131         GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(topologyUuid);
132         TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(networkTransactionService, tapiContext, topologyUtils,
133             tapiLink);
134         ListenableFuture<RpcResult<GetTopologyDetailsOutput>> result = tapiTopoImpl.getTopologyDetails(input);
135         LOG.info("RESULT of getTopoDetailsTopo/name = {}", result.get().getResult().getTopology().getName().toString());
136         result.addListener(new Runnable() {
137             @Override
138             public void run() {
139                 endSignal.countDown();
140             }
141         }, executorService);
142         endSignal.await();
143         RpcResult<GetTopologyDetailsOutput> rpcResult = result.get();
144         @Nullable
145         Topology topology = rpcResult.getResult().getTopology();
146         assertNotNull(topology, "Topology should not be null");
147         Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.TPDR_100G.getBytes(StandardCharsets.UTF_8))
148             .toString());
149         assertEquals(topoUuid, topology.getUuid(), "incorrect topology uuid");
150         assertEquals(1, topology.getNode().size(), "Node list size should be 1");
151         Name nodeName = topology.getNode().values().stream().findFirst().orElseThrow().getName()
152             .get(new NameKey("Tpdr100g node name"));
153         assertEquals("Tpdr100g over WDM node", nodeName.getValue(), "Node name should be 'Tpdr100g over WDM node'");
154         Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(nodeName.getValue().getBytes(StandardCharsets.UTF_8))
155             .toString());
156         assertEquals(nodeUuid, topology.getNode().values().stream().findFirst().orElseThrow().getUuid(),
157             "incorrect node uuid");
158         long nb = topology.getNode().values().stream().findFirst().orElseThrow().getOwnedNodeEdgePoint().size();
159         assertEquals(2, nb, "'Transponder 100GE' node should have 2 neps");
160         List<NodeRuleGroup> nrgList = topology.getNode().values().stream().findFirst().orElseThrow()
161             .nonnullNodeRuleGroup().values().stream()
162             .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
163             .collect(Collectors.toList());
164         assertEquals(1, nrgList.size(), "'Transponder 100GE' node should contain a single node rule groups");
165         List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
166         assertEquals(nb, nodeEdgePointList.size(), "'Transponder 100GE' node -rule-group should contain 2 NEPs");
167         List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
168         assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
169         assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
170         assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
171             "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
172         assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType().iterator().next(),
173             "the rule type should be 'FORWARDING'");
174     }
175
176     @Test
177     void getTopologyDetailsForOtnTopologyWithOtnLinksWhenSuccessful()
178             throws ExecutionException, InterruptedException {
179         Uuid topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_MULTILAYER.getBytes(
180             Charset.forName("UTF-8"))).toString());
181         LOG.info("T0MultilayerUuid = {}", topologyUuid);
182         GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(topologyUuid);
183         TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(networkTransactionService, tapiContext, topologyUtils,
184             tapiLink);
185         ListenableFuture<RpcResult<GetTopologyDetailsOutput>> result = tapiTopoImpl.getTopologyDetails(input);
186         result.addListener(new Runnable() {
187             @Override
188             public void run() {
189                 endSignal.countDown();
190             }
191         }, executorService);
192         endSignal.await();
193         RpcResult<GetTopologyDetailsOutput> rpcResult = result.get();
194         @Nullable
195         Topology topology = rpcResult.getResult().getTopology();
196         assertNotNull(topology, "Topology should not be null");
197         for (Map.Entry<
198             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey,
199             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> entry :
200                 topology.getNode().entrySet()) {
201             LOG.debug("NODESDETECTED = {}",entry.getValue().getName().toString());
202         }
203         assertEquals(7, topology.getNode().size(), "Node list size should be 7");
204         long nb1 = topology.getNode().values().stream()
205             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
206             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
207                 .equals("XPDR-A1-XPDR1+XPONDER"))
208             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
209                 .filter(nep -> nep.getName().containsKey(new NameKey("100G-tpdr"))))
210             .count();
211         assertEquals(1, nb1, "XPDR-A1-XPDR1 should only have one client nep");
212         long nb2 = topology.getNode().values().stream()
213             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
214             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
215                 .equals("SPDR-SA1-XPDR1+XPONDER"))
216             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
217                 .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_C"))))
218             .count();
219         assertEquals(4, nb2, "SPDR-SA1-XPDR1 (mux) should have 4 client neps");
220         long nb3 = topology.getNode().values().stream()
221             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
222             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
223                 .equals("SPDR-SA1-XPDR1+XPONDER"))
224             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
225                 .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
226             .count();
227         assertEquals(1, nb3, "SPDR-SA1-XPDR1 (mux) should have a single network nep");
228         long nb4 = topology.getNode().values().stream()
229             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
230             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
231                 .equals("SPDR-SA1-XPDR2+XPONDER"))
232             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
233                 .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_C"))))
234             .count();
235         assertEquals(4, nb4, "SPDR-SA1-XPDR2 (switch) should have 4 client neps");
236         long nb5 = topology.getNode().values().stream()
237             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
238             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
239                 .equals("SPDR-SA1-XPDR2+XPONDER"))
240             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
241                 .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
242             .count();
243         assertEquals(2, nb5, "SPDR-SA1-XPDR2 (switch) should have 2 network neps");
244         long nb7 = topology.getNode().values().stream()
245             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA)
246                 && node.getLayerProtocolName().contains(LayerProtocolName.DSR))
247             .filter(node -> node.getName().get(new NameKey("otsi node name")).getValue()
248                 .equals("XPDR-A1-XPDR1+XPONDER"))
249             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
250                 .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint"))))
251             .count();
252         assertEquals(1, nb7, "XPDR-A1-XPDR1 should only have 1 OTSI network nep");
253         long nb8 = topology.getNode().values().stream()
254             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA)
255                 && node.getLayerProtocolName().contains(LayerProtocolName.DSR))
256             .filter(node -> node.getName().get(new NameKey("otsi node name")).getValue()
257                 .equals("SPDR-SA1-XPDR1+XPONDER"))
258             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
259                 .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint"))))
260             .count();
261         assertEquals(1, nb8, "SPDR-SA1-XPDR1 (mux) should have a single OTSI network nep");
262         long nb9 = topology.getNode().values().stream()
263             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA)
264                 && node.getLayerProtocolName().contains(LayerProtocolName.DSR))
265             .filter(node -> node.getName().get(new NameKey("otsi node name")).getValue()
266                 .equals("SPDR-SA1-XPDR2+XPONDER"))
267             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
268                 .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint"))))
269             .count();
270         assertEquals(2, nb9, "SPDR-SA1-XPDR2 (switch) should have 2 OTSI network nep");
271
272         assertEquals(10, topology.getLink().size(), "Link list size should be 10, no more transitionnal links");
273         Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes("T0 - Multi-layer topology".getBytes()).toString());
274         assertEquals(topoUuid, topology.getUuid(), "incorrect topology uuid");
275         assertEquals(
276             "T0 - Multi-layer topology",
277             topology.nonnullName().values().stream().findFirst().orElseThrow().getValue(),
278             "topology name should be T0 - Multi-layer topology");
279
280         long nbDsrOduNodes = topology.nonnullNode().values().stream()
281             .filter(n -> n.getName().containsKey(new NameKey("dsr/odu node name"))).count();
282         long nbPhotonicNodes = topology.nonnullNode().values().stream()
283             .filter(n -> n.getName().containsKey(new NameKey("otsi node name"))).count();
284         assertEquals(6, nbDsrOduNodes, "Node list should contain 6 DSR-ODU nodes");
285         assertEquals(7, nbPhotonicNodes, "Node list should contain 7 Photonics node");
286         long nbOtsLinks = topology.getLink().values().stream()
287             .filter(l -> l.getName().containsKey(new NameKey("OTS link name"))).count();
288         long nbOtnLinks = topology.getLink().values().stream()
289             .filter(l -> l.getName().containsKey(new NameKey("otn link name"))).count();
290         assertEquals(8, nbOtsLinks, "Link list should contain 8 OTS links");
291         assertEquals(2, nbOtnLinks, "Link list should contain 2 OTN links");
292
293         Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+XPONDER".getBytes(StandardCharsets.UTF_8))
294             .toString());
295         Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+XPONDER".getBytes(StandardCharsets.UTF_8))
296             .toString());
297         Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+XPONDER".getBytes(StandardCharsets.UTF_8))
298             .toString());
299         Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+XPONDER".getBytes(StandardCharsets.UTF_8))
300             .toString());
301         Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1"
302             .getBytes(StandardCharsets.UTF_8)).toString());
303         Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"
304             .getBytes(StandardCharsets.UTF_8)).toString());
305         Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1"
306             .getBytes(StandardCharsets.UTF_8)).toString());
307         Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
308             .getBytes(StandardCharsets.UTF_8)).toString());
309         Uuid link1Uuid =
310             new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
311                 .getBytes(StandardCharsets.UTF_8)).toString());
312         Uuid link2Uuid =
313             new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1toSPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"
314                 .getBytes(StandardCharsets.UTF_8)).toString());
315
316         List<Link> links = topology.nonnullLink().values().stream()
317             .filter(l -> l.getName().containsKey(new NameKey("otn link name")))
318             .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
319             .collect(Collectors.toList());
320         checkOtnLink(links.get(0), topoUuid, node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link1Uuid,
321             "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1");
322         checkOtnLink(links.get(1), topoUuid, node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link2Uuid,
323             "SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1toSPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1");
324
325     }
326
327     @Test
328     void getTopologyDetailsForFullTapiTopologyWithLinksWhenSuccessful()
329             throws ExecutionException, InterruptedException {
330         Uuid topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
331             Charset.forName("UTF-8"))).toString());
332         LOG.info("T0FullMultilayerUuid = {}", topologyUuid);
333         GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(topologyUuid);
334         TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(networkTransactionService, tapiContext, topologyUtils,
335             tapiLink);
336         ListenableFuture<RpcResult<GetTopologyDetailsOutput>> result = tapiTopoImpl.getTopologyDetails(input);
337         result.addListener(new Runnable() {
338             @Override
339             public void run() {
340                 endSignal.countDown();
341             }
342         }, executorService);
343         endSignal.await();
344         RpcResult<GetTopologyDetailsOutput> rpcResult = result.get();
345         @Nullable
346         Topology topology = rpcResult.getResult().getTopology();
347         assertNotNull(topology, "Topology should not be null");
348         // 2 Nodes per Xpdr/Spdr node (DSR-ODU & PHOT) + 3 Node per Roadm
349         assertEquals(10, topology.getNode().size(), "Node list size should be 10");
350         List<Map<NameKey, Name>> nodeNames = topology.getNode().values().stream()
351             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
352             .map(Node::getName).collect(Collectors.toList());
353         LOG.info("TopologyNodes = {}", nodeNames.toString());
354         Node nodeTsp = topology.getNode().values().stream()
355             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
356             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
357                 .equals("XPDR-A1-XPDR1+XPONDER"))
358             .findAny().orElseThrow();
359         LOG.debug("XPDRA1 NEPs = {}", nodeTsp.getOwnedNodeEdgePoint().toString());
360         long nb1 = topology.getNode().values().stream()
361             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
362             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
363                 .equals("XPDR-A1-XPDR1+XPONDER"))
364             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
365                 .filter(nep -> nep.getName().containsKey(new NameKey("100G-tpdr"))))
366             .count();
367         // 2 client ports in configuration -> removed the checkTp so we have 2 NEPs
368         assertEquals(2, nb1, "XPDR-A1-XPDR1+XPONDER should only have two client neps");
369         long inb1 = topology.getNode().values().stream()
370             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
371             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
372                 .equals("XPDR-A1-XPDR1+XPONDER"))
373             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
374                 .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
375             .count();
376         assertEquals(2, inb1, "XPDR-A1-XPDR1+XPONDER should only have two internal network neps");
377         long enb1 = topology.getNode().values().stream()
378             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
379             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
380                 .equals("XPDR-A1-XPDR1+XPONDER"))
381             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
382                 .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N"))))
383             .count();
384         assertEquals(2, enb1, "XPDR-A1-XPDR1+XPONDER should only have two external network neps");
385         long nb2 = topology.getNode().values().stream()
386             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
387             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
388                 .equals("SPDR-SA1-XPDR1+XPONDER"))
389             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
390                 .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_C"))))
391             .count();
392         assertEquals(4, nb2, "SPDR-SA1-XPDR1+XPONDER (mux) should have 4 client neps");
393         long inb3 = topology.getNode().values().stream()
394             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
395             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
396                 .equals("SPDR-SA1-XPDR1+XPONDER"))
397             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
398                 .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
399             .count();
400         assertEquals(1, inb3, "SPDR-SA1-XPDR1+XPONDER (mux) should have a single internal network nep");
401         long enb3 = topology.getNode().values().stream()
402             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
403             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
404                 .equals("SPDR-SA1-XPDR1+XPONDER"))
405             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
406                 .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N"))))
407             .count();
408         assertEquals(4, enb3, "SPDR-SA1-XPDR1+XPONDER (mux) should have 4 external network nep");
409         long nb4 = topology.getNode().values().stream()
410             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
411             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
412                 .equals("SPDR-SA1-XPDR2+XPONDER"))
413             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
414                 .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_C"))))
415             .count();
416         assertEquals(4, nb4, "SPDR-SA1-XPDR2+XPONDER (switch) should have 4 client neps");
417         long inb5 = topology.getNode().values().stream()
418             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
419             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
420                 .equals("SPDR-SA1-XPDR2+XPONDER"))
421             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
422                 .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
423             .count();
424         assertEquals(4, inb5, "SPDR-SA1-XPDR2+XPONDER (switch) should have 4 internal network neps");
425         long enb5 = topology.getNode().values().stream()
426             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
427             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
428                 .equals("SPDR-SA1-XPDR1+XPONDER"))
429             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
430                 .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N"))))
431             .count();
432         assertEquals(4, enb5, "SPDR-SA1-XPDR2+XPONDER (switch) should have 4 external network neps");
433
434         inb1 = topology.getNode().values().stream()
435             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
436             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
437                 .equals("XPDR-A1-XPDR1+XPONDER"))
438             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
439                 .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N"))))
440             .count();
441         assertEquals(2, inb1, "XPDR-A1-XPDR1+XPONDER should only have two external network neps");
442         enb1 = topology.getNode().values().stream()
443             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
444             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
445                 .equals("XPDR-A1-XPDR1+XPONDER"))
446             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
447                 .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
448             .count();
449         assertEquals(2, enb1, "XPDR-A1-XPDR1+XPONDER should only have two photonic network neps");
450         inb3 = topology.getNode().values().stream()
451             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
452             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
453                 .equals("SPDR-SA1-XPDR1+XPONDER"))
454             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
455                 .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint"))))
456             .count();
457         assertEquals(1, inb3, "SPDR-SA1-XPDR1+XPONDER (mux) should have a single external network nep");
458         inb5 = topology.getNode().values().stream()
459             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
460             .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
461                 .equals("SPDR-SA1-XPDR2+XPONDER"))
462             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
463                 .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint"))))
464             .count();
465         assertEquals(4, inb5, "SPDR-SA1-XPDR2+XPONDER (switch) should have 4 external network neps");
466         long inb6 = topology.getNode().values().stream()
467             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA)
468                 && !node.getLayerProtocolName().contains(LayerProtocolName.DSR))
469             .filter(node -> node.getName().get(new NameKey("roadm node name")).getValue()
470                 .equals("ROADM-A1+PHOTONIC_MEDIA"))
471             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
472                 .filter(nep -> nep.getName().values().stream().findAny().orElseThrow().getValue().contains("DEG")))
473             .count();
474         assertEquals(4, inb6, "ROADM-A1+PHOTONIC_MEDIA (DEGREE) should have 4 network neps");
475         long enb6 = topology.getNode().values().stream()
476             .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA)
477                 && !node.getLayerProtocolName().contains(LayerProtocolName.DSR))
478             .filter(node -> node.getName().get(new NameKey("roadm node name")).getValue()
479                 .equals("ROADM-A1+PHOTONIC_MEDIA"))
480             .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
481                 .filter(nep -> nep.getName().values().stream().findAny().orElseThrow().getValue().contains("SRG")))
482             .count();
483         assertEquals(8, enb6, "ROADM-A1+PHOTONIC_MEDIA (SRG) should have 8 network neps (OTS)");
484
485         // Links in openroadm topology which include Roadm-to-Roadm and Xpdr-to-Roadm (ortopo / 2)
486         // + transitional links -> 0 per network port of Xpdr + OTN links / 2
487         List<String> linkList = new ArrayList<>();
488         for (Map.Entry<LinkKey, Link> entry : topology.getLink().entrySet()) {
489             linkList.add(entry.getValue().getName().entrySet().iterator().next().getValue().toString());
490         }
491         assertEquals(9, topology.getLink().size(), "Link list size should be 8 XPDR To SRG and 1 DEG2A-DEG1C");
492         Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes("T0 - Full Multi-layer topology".getBytes()).toString());
493         assertEquals(topoUuid, topology.getUuid(), "incorrect topology uuid");
494         assertEquals(
495             "T0 - Full Multi-layer topology",
496             topology.nonnullName().values().stream().findFirst().orElseThrow().getValue(),
497             "topology name should be T0 - Full Multi-layer topology");
498
499         long nbDsrOduNodes = topology.nonnullNode().values().stream()
500             .filter(n -> n.getName().containsKey(new NameKey("dsr/odu node name"))).count();
501         long nbPhotonicNodes = topology.nonnullNode().values().stream()
502             .filter(n -> n.getName().containsKey(new NameKey("otsi node name"))).count();
503         // In DSR/ODU we create one node per Xpdr (no filtering out)
504         assertEquals(8, nbDsrOduNodes, "Node list should contain 8 DSR-ODU nodes");
505         // We need to add the Roadms as Photonic nodes. Instead of 1 node as roadm infra we have 2 roadm nodes
506         assertEquals(8, nbPhotonicNodes, "Node list should contain 8 Photonics nodes");
507         // Roadm-to-Roadm
508         long nbOmsLinks = topology.getLink().values().stream()
509             .filter(l -> l.getName().containsKey(new NameKey("OMS link name"))).count();
510         // Xpdr-to-Roadm
511         long nbOmsLinks1 = topology.getLink().values().stream()
512             .filter(l -> l.getName().containsKey(new NameKey("XPDR-RDM link name"))).count();
513         // 1 OMS per ROADM-to-ROADM link + Existing XPDR-tp-ROADM link in openroadm topology
514         assertEquals(9, nbOmsLinks + nbOmsLinks1, "Link list should contain 9 OMS links");
515     }
516
517     @Test
518     void getNodeAndNepsDetailsWhenSuccessful()
519             throws ExecutionException, InterruptedException {
520         Uuid topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
521             Charset.forName("UTF-8"))).toString());
522         GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(topologyUuid);
523         TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(networkTransactionService, tapiContext, topologyUtils,
524             tapiLink);
525         ListenableFuture<RpcResult<GetTopologyDetailsOutput>> result = tapiTopoImpl.getTopologyDetails(input);
526         result.addListener(new Runnable() {
527             @Override
528             public void run() {
529                 endSignal.countDown();
530             }
531         }, executorService);
532         endSignal.await();
533         RpcResult<GetTopologyDetailsOutput> rpcResult = result.get();
534         @Nullable
535         Topology topology = rpcResult.getResult().getTopology();
536         for (Node node:topology.getNode().values()) {
537             Uuid nodeUuid = node.getUuid();
538             GetNodeDetailsInput input1 = TapiTopologyDataUtils.buildGetNodeDetailsInput(topologyUuid, nodeUuid);
539             ListenableFuture<RpcResult<GetNodeDetailsOutput>> result1 = tapiTopoImpl.getNodeDetails(input1);
540             result.addListener(new Runnable() {
541                 @Override
542                 public void run() {
543                     endSignal.countDown();
544                 }
545             }, executorService);
546             endSignal.await();
547             RpcResult<GetNodeDetailsOutput> rpcResult1 = result1.get();
548             @Nullable
549             Node node1 = rpcResult1.getResult().getNode();
550             assertNotNull(node1, "Node should not be null");
551             for (OwnedNodeEdgePoint onep:node1.getOwnedNodeEdgePoint().values()) {
552                 Uuid onepUuid = onep.getUuid();
553                 GetNodeEdgePointDetailsInput input2 = TapiTopologyDataUtils.buildGetNodeEdgePointDetailsInput(
554                     topologyUuid, nodeUuid, onepUuid);
555                 ListenableFuture<RpcResult<GetNodeEdgePointDetailsOutput>> result2
556                     = tapiTopoImpl.getNodeEdgePointDetails(input2);
557                 result.addListener(new Runnable() {
558                     @Override
559                     public void run() {
560                         endSignal.countDown();
561                     }
562                 }, executorService);
563                 endSignal.await();
564                 RpcResult<GetNodeEdgePointDetailsOutput> rpcResult2 = result2.get();
565                 org.opendaylight.yang.gen.v1
566                     .urn.onf.otcc.yang.tapi.topology.rev221121.get.node.edge.point.details.output.NodeEdgePoint
567                     onep1 = rpcResult2.getResult().getNodeEdgePoint();
568                 assertNotNull(onep1, "Node Edge Point should not be null");
569             }
570         }
571     }
572
573     @Test
574     void getLinkDetailsWhenSuccessful()
575             throws ExecutionException, InterruptedException {
576         Uuid topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
577             Charset.forName("UTF-8"))).toString());
578         GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(topologyUuid);
579         TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(networkTransactionService, tapiContext, topologyUtils,
580             tapiLink);
581         ListenableFuture<RpcResult<GetTopologyDetailsOutput>> result = tapiTopoImpl.getTopologyDetails(input);
582         result.addListener(new Runnable() {
583             @Override
584             public void run() {
585                 endSignal.countDown();
586             }
587         }, executorService);
588         endSignal.await();
589         RpcResult<GetTopologyDetailsOutput> rpcResult = result.get();
590         @Nullable
591         Topology topology = rpcResult.getResult().getTopology();
592         for (Link link:topology.getLink().values()) {
593             Uuid linkUuid = link.getUuid();
594             GetLinkDetailsInput input1 = TapiTopologyDataUtils.buildGetLinkDetailsInput(
595                 topologyUuid, linkUuid);
596             ListenableFuture<RpcResult<GetLinkDetailsOutput>> result1 = tapiTopoImpl.getLinkDetails(input1);
597             result.addListener(new Runnable() {
598                 @Override
599                 public void run() {
600                     endSignal.countDown();
601                 }
602             }, executorService);
603             endSignal.await();
604             RpcResult<GetLinkDetailsOutput> rpcResult1 = result1.get();
605             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.get.link.details.output.Link link1
606                 = rpcResult1.getResult().getLink();
607             assertNotNull(link1, "Link should not be null");
608         }
609     }
610
611     @Test
612     void getSipDetailsWhenSuccessful()
613             throws ExecutionException, InterruptedException {
614         GetServiceInterfacePointListInput input = TapiTopologyDataUtils.buildServiceInterfacePointListInput();
615         TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(networkTransactionService, tapiContext, topologyUtils,
616             tapiLink);
617         ListenableFuture<RpcResult<GetServiceInterfacePointListOutput>> result = tapiTopoImpl
618             .getServiceInterfacePointList(input);
619         result.addListener(new Runnable() {
620             @Override
621             public void run() {
622                 endSignal.countDown();
623             }
624         }, executorService);
625         endSignal.await();
626         RpcResult<GetServiceInterfacePointListOutput> rpcResult = result.get();
627         Map<SipKey, Sip> sipMap = rpcResult.getResult().getSip();
628         for (Sip sip:sipMap.values()) {
629             Uuid sipUuid = sip.getUuid();
630             GetServiceInterfacePointDetailsInput input1 = TapiTopologyDataUtils
631                 .buildGetServiceInterfacePointDetailsInput(sipUuid);
632             ListenableFuture<RpcResult<GetServiceInterfacePointDetailsOutput>> result1
633                 = tapiTopoImpl.getServiceInterfacePointDetails(input1);
634             result.addListener(new Runnable() {
635                 @Override
636                 public void run() {
637                     endSignal.countDown();
638                 }
639             }, executorService);
640             endSignal.await();
641             RpcResult<GetServiceInterfacePointDetailsOutput> rpcResult1 = result1.get();
642             org.opendaylight.yang.gen.v1
643                 .urn.onf.otcc.yang.tapi.common.rev221121.get.service._interface.point.details.output.Sip sip1
644                 = rpcResult1.getResult().getSip();
645             assertNotNull(sip1, "Sip should not be null");
646         }
647     }
648
649     private void checkOtnLink(Link link, Uuid topoUuid, Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid,
650             Uuid linkUuid, String linkName) {
651         assertEquals(linkName, link.getName().get(new NameKey("otn link name")).getValue(), "bad name for the link");
652         assertEquals(linkUuid, link.getUuid(), "bad uuid for link");
653         assertEquals(CAPACITYUNITGBPS.VALUE, link.getAvailableCapacity().getTotalSize().getUnit(),
654             "Available capacity unit should be MBPS");
655         String prefix = linkName.split("-")[0];
656         if ("OTU4".equals(prefix)) {
657             assertEquals(Uint64.valueOf(0), link.getAvailableCapacity().getTotalSize().getValue(),
658                 "Available capacity -total size value should be 0");
659         } else if ("ODTU4".equals(prefix)) {
660             assertEquals(Uint64.valueOf(100000), link.getAvailableCapacity().getTotalSize().getValue(),
661                 "Available capacity -total size value should be 100 000");
662         }
663         assertEquals(CAPACITYUNITGBPS.VALUE, link.getTotalPotentialCapacity().getTotalSize().getUnit(),
664             "Total capacity unit should be GBPS");
665         assertEquals(Decimal64.valueOf("100"), link.getTotalPotentialCapacity().getTotalSize().getValue(),
666             "Total capacity -total size value should be 100");
667         if ("OTU4".equals(prefix)) {
668             assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
669                 LayerProtocolName.PHOTONICMEDIA.getName(),
670                 link.getLayerProtocolName().stream().findFirst().orElseThrow().getName());
671         } else if ("ODTU4".equals(prefix)) {
672             assertEquals("otn link should be between 2 nodes of protocol layers ODU",
673                 LayerProtocolName.ODU.getName(),
674                 link.getLayerProtocolName().stream().findFirst().orElseThrow().getName());
675         }
676         assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),
677             "transitional link should be BIDIRECTIONAL");
678         List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
679             .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
680         assertEquals(topoUuid, nodeEdgePointList.get(0).getTopologyUuid(),
681             "topology uuid should be the same for the two termination point of the link");
682         assertEquals(topoUuid, nodeEdgePointList.get(1).getTopologyUuid(),
683             "topology uuid should be the same for the two termination point of the link");
684         assertThat("otn links should terminate on two distinct nodes",
685             nodeEdgePointList.get(0).getNodeUuid().getValue(),
686             either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
687         assertThat("otn links should terminate on two distinct nodes",
688             nodeEdgePointList.get(1).getNodeUuid().getValue(),
689             either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
690         assertThat("otn links should terminate on two distinct tps",
691             nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
692             either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
693         assertThat("otn links should terminate on two distinct tps",
694             nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
695             either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
696         assertEquals(OperationalState.ENABLED, link.getOperationalState(), "operational state should be ENABLED");
697         assertEquals(AdministrativeState.UNLOCKED, link.getAdministrativeState(),
698             "administrative state should be UNLOCKED");
699     }
700 }