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