2 * Copyright © 2020 Orange, Inc. and others. All rights reserved.
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
8 package org.opendaylight.transportpce.tapi.topology;
10 import static org.hamcrest.CoreMatchers.containsString;
11 import static org.hamcrest.CoreMatchers.either;
12 import static org.hamcrest.CoreMatchers.hasItem;
13 import static org.hamcrest.CoreMatchers.hasItems;
14 import static org.hamcrest.MatcherAssert.assertThat;
15 import static org.junit.Assert.assertEquals;
16 import static org.junit.Assert.assertNull;
17 import static org.junit.Assert.fail;
19 import com.google.common.util.concurrent.FluentFuture;
20 import java.nio.charset.Charset;
21 import java.util.ArrayList;
22 import java.util.HashMap;
23 import java.util.Iterator;
24 import java.util.List;
26 import java.util.Optional;
27 import java.util.UUID;
28 import java.util.concurrent.ExecutionException;
29 import java.util.stream.Collectors;
30 import org.eclipse.jdt.annotation.Nullable;
31 import org.junit.BeforeClass;
32 import org.junit.Test;
33 import org.opendaylight.mdsal.binding.api.DataBroker;
34 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
35 import org.opendaylight.transportpce.common.InstanceIdentifiers;
36 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
37 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
38 import org.opendaylight.transportpce.common.network.RequestProcessor;
39 import org.opendaylight.transportpce.tapi.TapiStringConstants;
40 import org.opendaylight.transportpce.tapi.utils.TapiLink;
41 import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils;
42 import org.opendaylight.transportpce.test.AbstractTest;
43 import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1Builder;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1Builder;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmTpType;
51 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
52 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
53 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
54 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
55 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
56 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeBuilder;
57 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeKey;
58 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId;
59 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
60 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1;
61 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
62 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.LinkKey;
63 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
64 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointBuilder;
65 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointKey;
66 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
67 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
68 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
69 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
79 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
80 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
81 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
82 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
83 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
84 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
85 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
86 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
87 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
88 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
89 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
90 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
91 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePointKey;
92 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint;
93 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
94 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link;
95 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
96 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
97 import org.opendaylight.yangtools.yang.common.Uint64;
98 import org.slf4j.Logger;
99 import org.slf4j.LoggerFactory;
101 public class ConvertORTopoToTapiTopoTest extends AbstractTest {
102 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToTapiTopoTest.class);
104 private static Node otnMuxA;
105 private static Node otnMuxC;
106 private static Node otnSwitch;
107 private static Node tpdr100G;
108 private static Map<LinkKey,org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
109 .networks.network.Link> otnLinks;
110 private static Uuid topologyUuid;
111 private static NetworkTransactionService networkTransactionService;
112 private static TapiLink tapiLink;
113 private static DataBroker dataBroker = getDataBroker();
116 public static void setUp() throws InterruptedException, ExecutionException {
117 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
118 TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
119 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
120 TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
121 TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
122 TapiTopologyDataUtils.PORTMAPPING_FILE);
124 KeyedInstanceIdentifier<Node, NodeKey> muxAIID = InstanceIdentifier.create(Networks.class)
125 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
126 .class, new NetworkKey(new NetworkId("otn-topology")))
127 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR1")));
128 FluentFuture<Optional<Node>> muxAFuture = dataBroker.newReadOnlyTransaction()
129 .read(LogicalDatastoreType.CONFIGURATION, muxAIID);
130 KeyedInstanceIdentifier<Node, NodeKey> muxCIID = InstanceIdentifier.create(Networks.class)
131 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
132 .class, new NetworkKey(new NetworkId("otn-topology")))
133 .child(Node.class, new NodeKey(new NodeId("SPDR-SC1-XPDR1")));
134 FluentFuture<Optional<Node>> muxCFuture = dataBroker.newReadOnlyTransaction()
135 .read(LogicalDatastoreType.CONFIGURATION, muxCIID);
136 KeyedInstanceIdentifier<Node, NodeKey> switchIID = InstanceIdentifier.create(Networks.class)
137 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
138 .class, new NetworkKey(new NetworkId("otn-topology")))
139 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR2")));
140 FluentFuture<Optional<Node>> switchFuture = dataBroker.newReadOnlyTransaction()
141 .read(LogicalDatastoreType.CONFIGURATION, switchIID);
143 otnMuxA = muxAFuture.get().get();
144 otnMuxC = muxCFuture.get().get();
145 otnSwitch = switchFuture.get().get();
147 KeyedInstanceIdentifier<Node, NodeKey> tpdrIID = InstanceIdentifier.create(Networks.class)
148 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
149 .class, new NetworkKey(new NetworkId("otn-topology")))
150 .child(Node.class, new NodeKey(new NodeId("XPDR-A1-XPDR1")));
151 FluentFuture<Optional<Node>> tpdrFuture = dataBroker.newReadOnlyTransaction()
152 .read(LogicalDatastoreType.CONFIGURATION, tpdrIID);
153 tpdr100G = tpdrFuture.get().get();
155 InstanceIdentifier<Network1> linksIID = InstanceIdentifier.create(Networks.class)
156 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
157 .class, new NetworkKey(new NetworkId("otn-topology")))
158 .augmentation(Network1.class);
159 FluentFuture<Optional<Network1>> linksFuture = dataBroker.newReadOnlyTransaction()
160 .read(LogicalDatastoreType.CONFIGURATION, linksIID);
161 otnLinks = linksFuture.get().get().getLink();
163 topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_MULTILAYER.getBytes(
164 Charset.forName("UTF-8"))).toString());
165 networkTransactionService = new NetworkTransactionImpl(
166 new RequestProcessor(getDataStoreContextUtil().getDataBroker()));
167 tapiLink = new TapiLink(networkTransactionService);
168 LOG.info("TEST SETUP READY");
172 public void convertNodeWhenNoStates() {
173 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", null, null);
174 List<String> networkPortList = new ArrayList<>();
175 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
176 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
177 networkPortList.add(tp.getTpId().getValue());
180 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
181 tapiFactory.convertNode(tpdr, networkPortList);
183 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
185 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
186 .getTapiNodes().get(new
187 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
188 Uuid networkNepUuid = new Uuid(
189 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
191 OwnedNodeEdgePoint nepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(networkNepUuid));
192 assertNull("Administrative State should not be present", nepN.getAdministrativeState());
193 assertNull("Operational State should not be present", nepN.getOperationalState());
195 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
197 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
198 .getTapiNodes().get(new
199 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
200 Uuid enepUuid = new Uuid(
201 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
203 Uuid inepUuid = new Uuid(
204 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
206 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
207 assertNull("Administrative State should not be present", enep.getAdministrativeState());
208 assertNull("Operational State should not be present", enep.getOperationalState());
210 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
211 assertNull("Administrative State should not be present", inep.getAdministrativeState());
212 assertNull("Operational State should not be present", inep.getOperationalState());
216 public void convertNodeWhenBadStates1() {
217 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", AdminStates.OutOfService,
219 List<String> networkPortList = new ArrayList<>();
220 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
221 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
222 networkPortList.add(tp.getTpId().getValue());
225 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
226 tapiFactory.convertNode(tpdr, networkPortList);
228 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
230 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
231 .getTapiNodes().get(new
232 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
233 Uuid networkNepUuid = new Uuid(
234 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
236 OwnedNodeEdgePoint nepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(networkNepUuid));
237 assertEquals("Administrative State should be Locked",
238 AdministrativeState.LOCKED, nepN.getAdministrativeState());
239 assertEquals("Operational State should be Disabled",
240 OperationalState.DISABLED, nepN.getOperationalState());
242 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
244 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
245 .getTapiNodes().get(new
246 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
247 Uuid enepUuid = new Uuid(
248 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
250 Uuid inepUuid = new Uuid(
251 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
253 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
254 assertEquals("Administrative State should be Locked",
255 AdministrativeState.LOCKED, enep.getAdministrativeState());
256 assertEquals("Operational State should be Disabled",
257 OperationalState.DISABLED, enep.getOperationalState());
259 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
260 assertEquals("Administrative State should be Locked",
261 AdministrativeState.LOCKED, inep.getAdministrativeState());
262 assertEquals("Operational State should be Disabled",
263 OperationalState.DISABLED, inep.getOperationalState());
267 public void convertNodeWhenBadStates2() {
268 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", AdminStates.Maintenance,
270 List<String> networkPortList = new ArrayList<>();
271 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
272 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
273 networkPortList.add(tp.getTpId().getValue());
276 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
277 tapiFactory.convertNode(tpdr, networkPortList);
279 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
281 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
282 .getTapiNodes().get(new
283 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
284 Uuid networkNepUuid = new Uuid(
285 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
287 OwnedNodeEdgePoint nepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(networkNepUuid));
288 assertEquals("Administrative State should be Locked",
289 AdministrativeState.LOCKED, nepN.getAdministrativeState());
290 assertEquals("Operational State should be Disabled",
291 OperationalState.DISABLED, nepN.getOperationalState());
293 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
295 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
296 .getTapiNodes().get(new
297 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
298 Uuid enepUuid = new Uuid(
299 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
301 Uuid inepUuid = new Uuid(
302 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
304 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
305 assertEquals("Administrative State should be Locked",
306 AdministrativeState.LOCKED, enep.getAdministrativeState());
307 assertEquals("Operational State should be Disabled",
308 OperationalState.DISABLED, enep.getOperationalState());
310 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
311 assertEquals("Administrative State should be Locked",
312 AdministrativeState.LOCKED, inep.getAdministrativeState());
313 assertEquals("Operational State should be Disabled",
314 OperationalState.DISABLED, inep.getOperationalState());
318 public void convertOtnLinkWhenNoState() {
319 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
320 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
321 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
322 link = changeOtnLinkState(otnLinks.get(new LinkKey(
323 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), null, null);
324 otnLinksAlt.replace(link.key(), link);
326 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
327 List<String> networkPortListA = new ArrayList<>();
328 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
329 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
330 networkPortListA.add(tp.getTpId().getValue());
333 tapiFactory.convertNode(otnMuxA, networkPortListA);
334 List<String> networkPortListC = new ArrayList<>();
335 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
336 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
337 networkPortListC.add(tp.getTpId().getValue());
340 tapiFactory.convertNode(otnMuxC, networkPortListC);
341 tapiFactory.convertLinks(otnLinksAlt);
343 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
344 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
345 .collect(Collectors.toList());
346 assertNull("Administrative State should not be present", tapiLinks.get(3).getAdministrativeState());
347 assertEquals("Administrative state should be UNLOCKED",
348 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
349 assertNull("Operational State should not be present", tapiLinks.get(3).getOperationalState());
350 assertEquals("Operational state should be ENABLED",
351 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
355 public void convertOtnLinkWhenNoStateOnOppositeLink() {
356 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
357 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
358 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
359 link = changeOtnLinkState(otnLinks.get(new LinkKey(
360 new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))), null, null);
361 otnLinksAlt.replace(link.key(), link);
363 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
364 List<String> networkPortListA = new ArrayList<>();
365 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
366 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
367 networkPortListA.add(tp.getTpId().getValue());
370 tapiFactory.convertNode(otnMuxA, networkPortListA);
371 List<String> networkPortListC = new ArrayList<>();
372 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
373 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
374 networkPortListC.add(tp.getTpId().getValue());
377 tapiFactory.convertNode(otnMuxC, networkPortListC);
378 tapiFactory.convertLinks(otnLinksAlt);
380 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
381 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
382 .collect(Collectors.toList());
383 assertNull("Administrative State should not be present", tapiLinks.get(3).getAdministrativeState());
384 assertEquals("Administrative state should be UNLOCKED",
385 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
386 assertNull("Operational State should not be present", tapiLinks.get(3).getOperationalState());
387 assertEquals("Operational state should be ENABLED",
388 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
392 public void convertOtnLinkWhenBadState1() {
393 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
394 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
395 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
396 link = changeOtnLinkState(otnLinks.get(new LinkKey(
397 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
398 AdminStates.OutOfService, State.OutOfService);
399 otnLinksAlt.replace(link.key(), link);
401 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
402 List<String> networkPortListA = new ArrayList<>();
403 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
404 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
405 networkPortListA.add(tp.getTpId().getValue());
408 tapiFactory.convertNode(otnMuxA, networkPortListA);
409 List<String> networkPortListC = new ArrayList<>();
410 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
411 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
412 networkPortListC.add(tp.getTpId().getValue());
415 tapiFactory.convertNode(otnMuxC, networkPortListC);
416 tapiFactory.convertLinks(otnLinksAlt);
418 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
419 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
420 .collect(Collectors.toList());
421 assertEquals("Administrative state should be LOCKED",
422 AdministrativeState.LOCKED, tapiLinks.get(3).getAdministrativeState());
423 assertEquals("Administrative state should be UNLOCKED",
424 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
425 assertEquals("Operational state should be DISABLED",
426 OperationalState.DISABLED, tapiLinks.get(3).getOperationalState());
427 assertEquals("Operational state should be ENABLED",
428 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
432 public void convertOtnLinkWhenBadState2() {
433 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
434 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
435 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
436 link = changeOtnLinkState(otnLinks.get(new LinkKey(
437 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
438 AdminStates.Maintenance, State.Degraded);
439 otnLinksAlt.replace(link.key(), link);
441 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
442 List<String> networkPortListA = new ArrayList<>();
443 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
444 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
445 networkPortListA.add(tp.getTpId().getValue());
448 tapiFactory.convertNode(otnMuxA, networkPortListA);
449 List<String> networkPortListC = new ArrayList<>();
450 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
451 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
452 networkPortListC.add(tp.getTpId().getValue());
455 tapiFactory.convertNode(otnMuxC, networkPortListC);
456 tapiFactory.convertLinks(otnLinksAlt);
458 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
459 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
460 .collect(Collectors.toList());
461 assertEquals("Administrative state should be LOCKED",
462 AdministrativeState.LOCKED, tapiLinks.get(3).getAdministrativeState());
463 assertEquals("Administrative state should be UNLOCKED",
464 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
465 assertEquals("Operational state should be DISABLED",
466 OperationalState.DISABLED, tapiLinks.get(3).getOperationalState());
467 assertEquals("Operational state should be ENABLED",
468 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
472 public void convertOtnLinkWhenBadStateOnOppositeLink() {
473 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
474 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
475 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
476 link = changeOtnLinkState(otnLinks.get(new LinkKey(
477 new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))),
478 AdminStates.OutOfService, State.OutOfService);
479 otnLinksAlt.replace(link.key(), link);
481 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
482 List<String> networkPortListA = new ArrayList<>();
483 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
484 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
485 networkPortListA.add(tp.getTpId().getValue());
488 tapiFactory.convertNode(otnMuxA, networkPortListA);
489 List<String> networkPortListC = new ArrayList<>();
490 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
491 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
492 networkPortListC.add(tp.getTpId().getValue());
495 tapiFactory.convertNode(otnMuxC, networkPortListC);
496 tapiFactory.convertLinks(otnLinksAlt);
498 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
499 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
500 .collect(Collectors.toList());
501 assertEquals("Administrative state should be LOCKED",
502 AdministrativeState.LOCKED, tapiLinks.get(3).getAdministrativeState());
503 assertEquals("Administrative state should be UNLOCKED",
504 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
505 assertEquals("Operational state should be DISABLED",
506 OperationalState.DISABLED, tapiLinks.get(3).getOperationalState());
507 assertEquals("Operational state should be ENABLED",
508 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
512 public void convertNodeForTransponder100G() {
513 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
514 List<String> networkPortList = new ArrayList<>();
515 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
516 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
517 networkPortList.add(tp.getTpId().getValue());
520 tapiFactory.convertNode(tpdr100G, networkPortList);
521 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
522 = tapiFactory.getTapiNodes().values().stream()
523 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
524 .collect(Collectors.toList());
526 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
527 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
529 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
531 checkDsrNode(tapiNodes.get(1), dsrNodeUuid, "tpdr", "XPDR-A1-XPDR1");
532 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
534 checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "tpdr", "XPDR-A1-XPDR1");
536 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
537 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
538 .collect(Collectors.toList());
539 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
540 "XPDR-A1-XPDR1+DSR+XPDR1-NETWORK1", "XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1", "XPDR-A1-XPDR1");
544 public void convertNodeForOtnMuxponder() {
545 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
546 List<String> networkPortList = new ArrayList<>();
547 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
548 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
549 networkPortList.add(tp.getTpId().getValue());
552 tapiFactory.convertNode(otnMuxA, networkPortList);
553 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
554 = tapiFactory.getTapiNodes().values().stream()
555 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
556 .collect(Collectors.toList());
558 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
559 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
560 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
562 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "mux", "SPDR-SA1-XPDR1");
563 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
565 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "mux", "SPDR-SA1-XPDR1");
567 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
568 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
569 .collect(Collectors.toList());
570 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
571 "SPDR-SA1-XPDR1+DSR+XPDR1-NETWORK1", "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1", "SPDR-SA1-XPDR1");
575 public void convertNodeForOtnSwitch() {
576 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
577 List<String> networkPortList = new ArrayList<>();
578 for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
579 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
580 networkPortList.add(tp.getTpId().getValue());
583 tapiFactory.convertNode(otnSwitch, networkPortList);
584 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
585 = tapiFactory.getTapiNodes().values().stream()
586 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
587 .collect(Collectors.toList());
589 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
590 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
592 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+DSR".getBytes(Charset.forName("UTF-8")))
594 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "switch", "SPDR-SA1-XPDR2");
595 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+OTSi".getBytes(Charset.forName("UTF-8")))
597 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "switch", "SPDR-SA1-XPDR2");
599 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
600 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
601 .collect(Collectors.toList());
602 checkTransitionalLink(tapiLinks.get(3), dsrNodeUuid, otsiNodeUuid,
603 "SPDR-SA1-XPDR2+DSR+XPDR2-NETWORK4", "SPDR-SA1-XPDR2+iOTSi+XPDR2-NETWORK4", "SPDR-SA1-XPDR2");
607 public void convertOtnLink() {
608 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
609 List<String> networkPortListA = new ArrayList<>();
610 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
611 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
612 networkPortListA.add(tp.getTpId().getValue());
615 tapiFactory.convertNode(otnMuxA, networkPortListA);
616 List<String> networkPortListC = new ArrayList<>();
617 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
618 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
619 networkPortListC.add(tp.getTpId().getValue());
622 tapiFactory.convertNode(otnMuxC, networkPortListC);
623 tapiFactory.convertLinks(otnLinks);
624 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
626 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
628 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
630 Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
632 Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
634 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1"
635 .getBytes(Charset.forName("UTF-8"))).toString());
636 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"
637 .getBytes(Charset.forName("UTF-8"))).toString());
638 Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1"
639 .getBytes(Charset.forName("UTF-8"))).toString());
640 Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
641 .getBytes(Charset.forName("UTF-8"))).toString());
643 new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1toSPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"
644 .getBytes(Charset.forName("UTF-8"))).toString());
646 new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
647 .getBytes(Charset.forName("UTF-8"))).toString());
649 List<Link> links = tapiFactory.getTapiLinks().values().stream()
650 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
651 .collect(Collectors.toList());
652 checkOtnLink(links.get(3), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid,
653 "SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1toSPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1");
654 checkOtnLink(links.get(2), node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid,
655 "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1");
659 public void convertRoadmInfrastructureWhenNoXponderAttached() {
660 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
661 tapiFactory.convertRoadmInfrastructure();
663 assertEquals("Node list size should be 1", 1, tapiFactory.getTapiNodes().size());
664 assertEquals("Link list size should be empty", 0, tapiFactory.getTapiLinks().size());
665 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
666 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
667 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
669 checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "infra", "ROADM-infra");
673 public void convertRoadmInfrastructureWhenOtnMuxAttached() {
674 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
675 List<String> networkPortListA = new ArrayList<>();
676 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
677 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
678 networkPortListA.add(tp.getTpId().getValue());
681 tapiFactory.convertNode(otnMuxA, networkPortListA);
682 tapiFactory.convertRoadmInfrastructure();
684 assertEquals("Node list size should be 3", 3, tapiFactory.getTapiNodes().size());
685 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
686 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
687 = tapiFactory.getTapiNodes().values().stream()
688 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
689 .collect(Collectors.toList());
690 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
692 checkOtsiNode(tapiNodes.get(2), otsiNodeUuid, "infra", "ROADM-infra");
694 List<Link> links = tapiFactory.getTapiLinks().values().stream()
695 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
696 .collect(Collectors.toList());
697 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
699 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
701 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eOTSi+XPDR1-NETWORK1"
702 .getBytes(Charset.forName("UTF-8"))).toString());
703 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("roadm node+nep+1")
704 .getBytes(Charset.forName("UTF-8"))).toString());
706 new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1--XPDR1-NETWORK1 and ROADM-infra--NodeEdgePoint_1"
707 .getBytes(Charset.forName("UTF-8"))).toString());
708 checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
709 "SPDR-SA1-XPDR1--XPDR1-NETWORK1 and ROADM-infra--NodeEdgePoint_1");
712 private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
713 Uuid nodeUuid, String dsrNodeType, String nodeId) {
714 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
715 assertEquals("incorrect node name", nodeId, node.getName().get(new NameKey("dsr/odu node name")).getValue());
716 assertEquals("administrative state should be UNLOCKED",
717 AdministrativeState.UNLOCKED, node.getAdministrativeState());
718 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
719 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
720 assertEquals("value-name should be 'dsr/odu node name'",
721 "dsr/odu node name", node.nonnullName().values().stream().findFirst().get().getValueName());
722 assertEquals("dsr node should manage 2 protocol layers : dsr and odu",
723 2, node.getLayerProtocolName().size());
724 assertThat("dsr node should manage 2 protocol layers : dsr and odu",
725 node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
726 List<OwnedNodeEdgePoint> nepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
727 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_N")))
728 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
729 .collect(Collectors.toList());
730 List<OwnedNodeEdgePoint> nepsC;
731 switch (dsrNodeType) {
733 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
734 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
735 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
736 .collect(Collectors.toList());
737 assertEquals("Switch-DSR node should have 4 NEPs network", 4, nepsN.size());
738 assertEquals("Switch-DSR node should have 4 NEPs client", 4, nepsC.size());
739 OwnedNodeEdgePoint nep1 = nepsC.get(2);
740 Uuid client4NepUuid = new Uuid(
741 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
743 checkNepClient100GSwitch(nep1, client4NepUuid, "XPDR2-CLIENT4", "NodeEdgePoint_C",
744 otnSwitch.getNodeId().getValue(), TapiStringConstants.DSR);
745 OwnedNodeEdgePoint nep2 = nepsN.get(1);
746 Uuid networkNepUuid = new Uuid(
747 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
749 checkNepNetworkODU4(nep2, networkNepUuid, "XPDR2-NETWORK1", "NodeEdgePoint_N",
750 otnSwitch.getNodeId().getValue(), TapiStringConstants.DSR);
751 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
752 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
753 .collect(Collectors.toList());
754 checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, networkNepUuid, nodeUuid);
757 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
758 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
759 .sorted((nep3, nep4) -> nep3.getUuid().getValue().compareTo(nep4.getUuid().getValue()))
760 .collect(Collectors.toList());
761 assertEquals("Mux-DSR node should have 1 NEP network", 1, nepsN.size());
762 assertEquals("Mux-DSR node should have 4 NEPs client", 4, nepsC.size());
763 OwnedNodeEdgePoint nep3 = nepsC.get(2);
764 Uuid client3NepUuid = new Uuid(
765 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
767 checkNepClient10G(nep3, client3NepUuid, "XPDR1-CLIENT3", "NodeEdgePoint_C",
768 otnMuxA.getNodeId().getValue(), TapiStringConstants.DSR);
770 OwnedNodeEdgePoint nep4 = nepsN.get(0);
771 Uuid networkNepUuid2 = new Uuid(
772 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
774 checkNepNetworkODU4(nep4, networkNepUuid2, "XPDR1-NETWORK1", "NodeEdgePoint_N",
775 otnMuxA.getNodeId().getValue(), TapiStringConstants.DSR);
776 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
777 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
778 .collect(Collectors.toList());
779 checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, networkNepUuid2, nodeUuid);
782 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
783 .filter(n -> n.getName().containsKey(new NameKey("100G-tpdr")))
784 .sorted((nep5, nep6) -> nep5.getUuid().getValue().compareTo(nep6.getUuid().getValue()))
785 .collect(Collectors.toList());
786 assertEquals("Tpdr-DSR node should have 2 NEPs network", 2, nepsN.size());
787 assertEquals("Tpdr-DSR node should have 2 NEPs client", 2, nepsC.size());
788 OwnedNodeEdgePoint nep5 = nepsC.get(0);
789 Uuid client1NepUuid = new Uuid(
790 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
792 checkNepClient100GTpdr(nep5, client1NepUuid, "XPDR1-CLIENT1", "100G-tpdr",
793 tpdr100G.getNodeId().getValue(), TapiStringConstants.DSR);
795 OwnedNodeEdgePoint nep6 = nepsN.get(0);
796 Uuid networkNepUuid3 = new Uuid(
797 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
799 checkNepNetworkODU4(nep6, networkNepUuid3, "XPDR1-NETWORK1", "NodeEdgePoint_N",
800 tpdr100G.getNodeId().getValue(), TapiStringConstants.DSR);
801 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
802 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
803 .collect(Collectors.toList());
804 checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, networkNepUuid3, nodeUuid);
812 private void checkOtsiNode(
813 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
814 Uuid nodeUuid, String otsiNodeType, String nodeId) {
815 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
816 assertEquals("incorrect node name", nodeId, node.getName().get(new NameKey("otsi node name")).getValue());
817 assertEquals("administrative state should be UNLOCKED",
818 AdministrativeState.UNLOCKED, node.getAdministrativeState());
819 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
820 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
821 assertEquals("value-name should be 'dsr/odu node name'",
822 "otsi node name", node.nonnullName().values().stream().findFirst().get().getValueName());
823 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
824 1, node.getLayerProtocolName().size());
825 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
826 LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().get(0));
827 List<OwnedNodeEdgePoint> nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
828 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
829 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
830 .collect(Collectors.toList());
831 List<OwnedNodeEdgePoint> nepsE = node.nonnullOwnedNodeEdgePoint().values().stream()
832 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint")))
833 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
834 .collect(Collectors.toList());
835 switch (otsiNodeType) {
837 assertEquals("Switch-OTSi node should have 4 eNEPs", 4, nepsE.size());
838 assertEquals("Switch-OTSi node should have 4 iNEPs", 4, nepsI.size());
839 OwnedNodeEdgePoint nep1 = nepsI.get(1);
840 Uuid inepUuid = new Uuid(
841 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
843 checkNepOtsiNode(nep1, inepUuid, "XPDR2-NETWORK2", "iNodeEdgePoint", otnSwitch.getNodeId().getValue(),
844 TapiStringConstants.I_OTSI);
845 OwnedNodeEdgePoint nep2 = nepsE.get(0);
846 Uuid enepUuid = new Uuid(
847 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
849 checkNepOtsiNode(nep2, enepUuid, "XPDR2-NETWORK2", "eNodeEdgePoint", otnSwitch.getNodeId().getValue(),
850 TapiStringConstants.E_OTSI);
851 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
852 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
853 .collect(Collectors.toList());
854 checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
857 assertEquals("Mux-OTSi node should have 1 eNEP", 1, nepsE.size());
858 assertEquals("Mux-OTSi node should have 1 iNEPs", 1, nepsI.size());
859 OwnedNodeEdgePoint nep3 = nepsE.get(0);
860 Uuid enepUuid2 = new Uuid(
861 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
863 checkNepOtsiNode(nep3, enepUuid2, "XPDR1-NETWORK1", "eNodeEdgePoint", otnMuxA.getNodeId().getValue(),
864 TapiStringConstants.E_OTSI);
865 OwnedNodeEdgePoint nep4 = nepsI.get(0);
866 Uuid inepUuid2 = new Uuid(
867 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
869 checkNepOtsiNode(nep4, inepUuid2, "XPDR1-NETWORK1", "iNodeEdgePoint", otnMuxA.getNodeId().getValue(),
870 TapiStringConstants.I_OTSI);
871 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
872 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
873 .collect(Collectors.toList());
874 checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
877 assertEquals("Tpdr-OTSi node should have 2 eNEPs", 2, nepsE.size());
878 assertEquals("Tpdr-OTSi node should have 2 iNEPs", 2, nepsI.size());
879 OwnedNodeEdgePoint nep5 = nepsE.get(0);
880 Uuid enepUuid3 = new Uuid(
881 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
883 checkNepOtsiNode(nep5, enepUuid3, "XPDR1-NETWORK1", "eNodeEdgePoint", tpdr100G.getNodeId().getValue(),
884 TapiStringConstants.E_OTSI);
885 OwnedNodeEdgePoint nep6 = nepsI.get(0);
886 Uuid inepUuid3 = new Uuid(
887 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
889 checkNepOtsiNode(nep6, inepUuid3, "XPDR1-NETWORK1", "iNodeEdgePoint", tpdr100G.getNodeId().getValue(),
890 TapiStringConstants.I_OTSI);
891 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
892 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
893 .collect(Collectors.toList());
894 checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
897 Iterator<OwnedNodeEdgePoint> nepIterator = node.nonnullOwnedNodeEdgePoint().values().iterator();
899 while (nepIterator.hasNext()) {
900 OwnedNodeEdgePoint nep = nepIterator.next();
901 Uuid nepUuid = new Uuid(
902 UUID.nameUUIDFromBytes((String.join("+", "roadm node", "nep", String.valueOf(count)))
903 .getBytes(Charset.forName("UTF-8"))).toString());
904 checkNepOtsiRdmNode(nep, nepUuid, new StringBuilder("NodeEdgePoint_").append(count).toString(),
905 "NodeEdgePoint name");
908 List<NodeRuleGroup> nrgList4 = node.nonnullNodeRuleGroup().values().stream()
909 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
910 .collect(Collectors.toList());
911 checkNodeRuleGroupForRdmInfra(nrgList4, count - 1);
916 private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
917 String nodeId, String extension) {
918 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
919 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
920 Name name = nameList.get(0);
921 assertEquals("value of client nep should be '" + portName + "'",
922 portName, name.getValue());
923 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
924 nepName, name.getValueName());
925 assertEquals("Client nep should support 3 kind of cep",
926 3, nep.getSupportedCepLayerProtocolQualifier().size());
927 assertThat("client nep should support 3 kind of cep",
928 nep.getSupportedCepLayerProtocolQualifier(),
929 hasItems(ODUTYPEODU2.class, ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
930 assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
931 checkCommonPartOfNep(nep, false);
932 checkSIP(nep, portName, nodeId, extension);
935 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
936 String nodeId, String extension) {
937 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
938 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
939 Name name = nameList.get(0);
940 assertEquals("value of network nep should be '" + portName + "'",
941 portName, name.getValue());
942 assertEquals("value-name of network nep for '" + portName + "' should be '" + nepName + "'",
943 nepName, name.getValueName());
944 assertEquals("Network nep should support 1 kind of cep",
945 1, nep.getSupportedCepLayerProtocolQualifier().size());
946 assertThat("network nep should support 1 kind of cep",
947 nep.getSupportedCepLayerProtocolQualifier(),
948 hasItem(ODUTYPEODU4.class));
949 assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
950 checkCommonPartOfNep(nep, false);
951 checkSIP(nep, portName, nodeId, extension);
954 private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
956 assertEquals("transponder DSR should contain 2 node rule group", 2, nrgList.size());
957 for (NodeRuleGroup nodeRuleGroup : nrgList) {
958 assertEquals("each node-rule-group should contain 2 NEP for transponder DSR",
959 2, nodeRuleGroup.getNodeEdgePoint().size());
961 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
962 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
963 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
964 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
965 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
966 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
967 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
968 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
969 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
970 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
971 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
972 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
973 assertEquals("node-rule-group nb 1 should contain a single rule", 1, rule.size());
974 assertEquals("local-id of the rule should be 'forward'",
975 "forward", rule.get(0).getLocalId());
976 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
977 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
978 assertEquals("the rule type should be 'FORWARDING'",
979 RuleType.FORWARDING, rule.get(0).getRuleType());
982 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
984 assertEquals("muxponder DSR should contain 4 node rule group", 4, nrgList.size());
985 for (NodeRuleGroup nodeRuleGroup : nrgList) {
986 assertEquals("each node-rule-group should contain 2 NEP for muxponder DSR",
987 2, nodeRuleGroup.getNodeEdgePoint().size());
989 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
990 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
991 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
992 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
993 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
994 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
995 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
996 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
997 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
998 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
999 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
1000 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
1001 assertEquals("node-rule-group nb 2 should contain a single rule", 1, rule.size());
1002 assertEquals("local-id of the rule should be 'forward'",
1003 "forward", rule.get(0).getLocalId());
1004 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1005 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
1006 assertEquals("the rule type should be 'FORWARDING'",
1007 RuleType.FORWARDING, rule.get(0).getRuleType());
1010 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1012 assertEquals("Switch-DSR should contain a single node rule group", 1, nrgList.size());
1013 assertEquals("Switch-DSR node-rule-group should contain 8 NEP", 8, nrgList.get(0).getNodeEdgePoint().size());
1014 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
1015 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
1016 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
1017 .collect(Collectors.toList());
1018 assertEquals("in the sorted node-rule-group, nep number 2 should be XPDR2-NETWORK1",
1019 networkNepUuid, nrg.get(4).getNodeEdgePointUuid());
1020 assertEquals("in the sorted node-rule-group, nep number 6 should be XPDR2-CLIENT4",
1021 clientNepUuid, nrg.get(3).getNodeEdgePointUuid());
1022 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1023 nodeUuid, nrg.get(4).getNodeUuid());
1024 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1025 nodeUuid, nrg.get(3).getNodeUuid());
1027 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1028 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1029 assertEquals("local-id of the rule should be 'forward'",
1030 "forward", ruleList.get(0).getLocalId());
1031 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1032 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1033 assertEquals("the rule type should be 'FORWARDING'",
1034 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1037 private void checkNodeRuleGroupForRdmInfra(List<NodeRuleGroup> nrgList, int nbNeps) {
1038 assertEquals("RDM infra node - OTSi should contain a single node rule groups", 1, nrgList.size());
1040 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1041 assertEquals("RDM infra node -rule-group should contain " + nbNeps + " NEP",
1042 nbNeps, nodeEdgePointList.size());
1044 assertNull("RDM infra node -rule-group should contain no NEP", nrgList.get(0).getNodeEdgePoint());
1046 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1047 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1048 assertEquals("local-id of the rule should be 'forward'",
1049 "forward", ruleList.get(0).getLocalId());
1050 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1051 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1052 assertEquals("the rule type should be 'FORWARDING'",
1053 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1056 private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1058 assertEquals("Tpdr-OTSi should contain two node rule groups", 2, nrgList.size());
1059 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1060 assertEquals("Tpdr-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1061 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1062 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1063 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1064 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1065 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1066 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1067 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1068 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1069 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1070 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1071 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1072 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1073 assertEquals("local-id of the rule should be 'forward'",
1074 "forward", ruleList.get(0).getLocalId());
1075 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1076 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1077 assertEquals("the rule type should be 'FORWARDING'",
1078 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1081 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1083 assertEquals("Mux-OTSi should contain a single node rule group", 1, nrgList.size());
1084 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1085 assertEquals("Mux-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1086 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1087 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1088 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1089 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1090 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1091 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1092 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1093 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1094 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1095 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1096 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1097 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1098 assertEquals("local-id of the rule should be 'forward'",
1099 "forward", ruleList.get(0).getLocalId());
1100 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1101 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1102 assertEquals("the rule type should be 'FORWARDING'",
1103 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1106 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1108 assertEquals("Switch-OTSi should contain 4 node rule group", 4, nrgList.size());
1109 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1110 assertEquals("each node-rule-group should contain 2 NEP for Switch-OTSi",
1111 2, nodeRuleGroup.getNodeEdgePoint().size());
1113 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
1114 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1115 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
1116 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1117 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1118 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
1119 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1120 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1121 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1122 nodeUuid, nodeEdgePointList0.get(0).getNodeUuid());
1123 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1124 nodeUuid, nodeEdgePointList0.get(1).getNodeUuid());
1125 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1126 assertEquals("node-rule-group should contain a single rule", 1, ruleList0.size());
1127 assertEquals("local-id of the rule should be 'forward'",
1128 "forward", ruleList0.get(0).getLocalId());
1129 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1130 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList0.get(0).getForwardingRule());
1131 assertEquals("the rule type should be 'FORWARDING'",
1132 RuleType.FORWARDING, ruleList0.get(0).getRuleType());
1135 private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1136 String nodeId, String extension) {
1137 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1138 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1139 assertEquals("value of client nep should be '" + portName + "'",
1140 portName, nameList.get(0).getValue());
1141 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
1142 nepName, nameList.get(0).getValueName());
1143 assertEquals("Client nep should support 2 kind of cep",
1144 2, nep.getSupportedCepLayerProtocolQualifier().size());
1145 assertThat("client nep should support 2 kind of cep",
1146 nep.getSupportedCepLayerProtocolQualifier(),
1147 hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
1148 assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
1149 checkCommonPartOfNep(nep, false);
1150 checkSIP(nep, portName, nodeId, extension);
1153 private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1154 String nodeId, String extension) {
1155 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1156 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1157 assertEquals("value of client nep should be '" + portName + "'",
1158 portName, nameList.get(0).getValue());
1159 assertEquals("value-name of client nep for '" + portName + "' should be 100G-tpdr'",
1160 nepName, nameList.get(0).getValueName());
1161 assertEquals("Client nep should support 1 kind of cep",
1162 1, nep.getSupportedCepLayerProtocolQualifier().size());
1163 assertThat("client nep should support 2 kind of cep",
1164 nep.getSupportedCepLayerProtocolQualifier(),
1165 hasItems(DIGITALSIGNALTYPE100GigE.class));
1166 assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
1167 checkCommonPartOfNep(nep, false);
1168 checkSIP(nep, portName, nodeId, extension);
1171 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1172 String nodeId, String extension) {
1173 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1174 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1175 assertEquals("value of OTSi nep should be '" + portName + "'",
1176 portName, nameList.get(0).getValue());
1177 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1178 nepName, nameList.get(0).getValueName());
1179 assertEquals("OTSi nep should support 2 kind of cep",
1180 2, nep.getSupportedCepLayerProtocolQualifier().size());
1181 assertThat("OTSi nep should support 2 kind of cep",
1182 nep.getSupportedCepLayerProtocolQualifier(),
1183 hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
1184 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1185 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1186 assertEquals("OTSi nep should support one SIP", 1, nep.getMappedServiceInterfacePoint().size());
1187 checkCommonPartOfNep(nep, false);
1188 checkSIP(nep, portName, nodeId, extension);
1191 private void checkSIP(OwnedNodeEdgePoint nep, String portName, String nodeId, String extension) {
1192 Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeId, extension, portName))
1193 .getBytes(Charset.forName("UTF-8"))).toString());
1194 assertEquals("service-interface-point-uuid of network nep for '" + portName + "' should be '"
1195 + String.join("+", "SIP", nodeId, portName) + "'", sipUuid, nep.getMappedServiceInterfacePoint()
1196 .get(new MappedServiceInterfacePointKey(sipUuid)).getServiceInterfacePointUuid());
1199 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1200 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1201 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1202 assertEquals("value of OTSi nep should be '" + portName + "'",
1203 portName, nameList.get(0).getValue());
1204 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1205 nepName, nameList.get(0).getValueName());
1206 assertEquals("OTSi nep of RDM infra node should support only 1 kind of cep",
1207 1, nep.getSupportedCepLayerProtocolQualifier().size());
1208 assertThat("OTSi nep should support 2 kind of cep",
1209 nep.getSupportedCepLayerProtocolQualifier(),
1210 hasItems(PHOTONICLAYERQUALIFIEROMS.class));
1211 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1212 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1213 assertEquals("OTSi nep of RDM infra should support no SIP", 0, nep.nonnullMappedServiceInterfacePoint().size());
1214 checkCommonPartOfNep(nep, true);
1217 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean isRdm) {
1218 assertEquals("link port direction should be DIRECTIONAL",
1219 PortDirection.BIDIRECTIONAL, nep.getLinkPortDirection());
1220 assertEquals("administrative state should be UNLOCKED",
1221 AdministrativeState.UNLOCKED, nep.getAdministrativeState());
1222 assertEquals("termination state should be TERMINATED BIDIRECTIONAL",
1223 TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState());
1224 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, nep.getLifecycleState());
1226 assertEquals("client nep should support 1 SIP", 1, nep.getMappedServiceInterfacePoint().size());
1228 assertEquals("termination direction should be BIDIRECTIONAL",
1229 TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection());
1230 assertEquals("operational state of client nep should be ENABLED",
1231 OperationalState.ENABLED, nep.getOperationalState());
1232 assertEquals("link-port-role of client nep should be SYMMETRIC",
1233 PortRole.SYMMETRIC, nep.getLinkPortRole());
1236 private void checkTransitionalLink(Link link, Uuid node1Uuid, Uuid node2Uuid, String tp1, String tp2,
1237 String ietfNodeId) {
1238 Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((tp1 + "to" + tp2)
1239 .getBytes(Charset.forName("UTF-8"))).toString());
1240 assertEquals("bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2, linkUuid, link.getUuid());
1241 assertEquals("Available capacity unit should be GBPS",
1242 CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
1243 assertEquals("Available capacity -total size value should be 100",
1244 Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue());
1245 assertEquals("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1246 2, link.getTransitionedLayerProtocolName().size());
1247 assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1248 link.getTransitionedLayerProtocolName(),
1249 hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));
1250 assertEquals("transitional link should be BIDIRECTIONAL",
1251 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1252 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1253 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1254 assertEquals("topology uuid should be the same for the two termination point of the link",
1255 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1256 assertEquals("topology uuid should be the same for the two termination point of the link",
1257 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1258 assertThat("transitional links should terminate on DSR node and Photonic node",
1259 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1260 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1261 assertThat("transitional links should terminate on DSR node and Photonic node",
1262 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1263 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1264 Uuid nep1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1.getBytes(Charset.forName("UTF-8"))).toString());
1265 Uuid nep2Uuid = new Uuid(UUID.nameUUIDFromBytes(tp2.getBytes(Charset.forName("UTF-8"))).toString());
1266 assertThat("transitional links should terminate on " + tp1 + " and " + tp2 + " neps",
1267 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1268 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1269 assertThat("transitional links should terminate on DSR node and Photonic node",
1270 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1271 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1274 private void checkOtnLink(Link link, Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1276 assertEquals("bad name for the link", linkName, link.getName().get(new NameKey("otn link name")).getValue());
1277 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1278 assertEquals("Available capacity unit should be MBPS",
1279 CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
1280 String prefix = linkName.split("-")[0];
1281 if ("OTU4".equals(prefix)) {
1282 assertEquals("Available capacity -total size value should be 0",
1283 Uint64.valueOf(0), link.getAvailableCapacity().getTotalSize().getValue());
1284 } else if ("ODTU4".equals(prefix)) {
1285 assertEquals("Available capacity -total size value should be 100 000",
1286 Uint64.valueOf(100000), link.getAvailableCapacity().getTotalSize().getValue());
1288 assertEquals("Total capacity unit should be GBPS",
1289 CapacityUnit.GBPS, link.getTotalPotentialCapacity().getTotalSize().getUnit());
1290 assertEquals("Total capacity -total size value should be 100",
1291 Uint64.valueOf(100), link.getTotalPotentialCapacity().getTotalSize().getValue());
1292 if ("OTU4".equals(prefix)) {
1293 assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1294 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1295 } else if ("ODTU4".equals(prefix)) {
1296 assertEquals("otn link should be between 2 nodes of protocol layers ODU",
1297 LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName());
1299 assertEquals("otn tapi link should be BIDIRECTIONAL",
1300 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1301 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1302 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1303 assertEquals("topology uuid should be the same for the two termination point of the link",
1304 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1305 assertEquals("topology uuid should be the same for the two termination point of the link",
1306 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1307 assertThat("otn links should terminate on two distinct nodes",
1308 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1309 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1310 assertThat("otn links should terminate on two distinct nodes",
1311 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1312 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1313 assertThat("otn links should terminate on two distinct tps",
1314 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1315 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1316 assertThat("otn links should terminate on two distinct tps",
1317 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1318 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1319 assertEquals("operational state should be ENABLED",
1320 OperationalState.ENABLED, link.getOperationalState());
1321 assertEquals("administrative state should be UNLOCKED",
1322 AdministrativeState.UNLOCKED, link.getAdministrativeState());
1325 private void checkOmsLink(Link link, Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1327 assertEquals("bad name for the link", linkName, link.getName().get(new NameKey("OMS link name")).getValue());
1328 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1329 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1330 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1331 assertEquals("otn tapi link should be BIDIRECTIONAL",
1332 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1333 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1334 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1335 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
1336 assertEquals("topology uuid should be the same for the two termination point of the link",
1337 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1338 assertEquals("topology uuid should be the same for the two termination point of the link",
1339 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1340 assertThat("oms links should terminate on two distinct nodes",
1341 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1342 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1343 assertThat("oms links should terminate on two distinct nodes",
1344 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1345 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1346 assertThat("oms links should terminate on two distinct tps",
1347 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1348 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1349 assertThat("oms links should terminate on two distinct tps",
1350 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1351 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1354 private Node changeTerminationPointState(Node initialNode, String tpid, AdminStates admin, State oper) {
1355 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
1356 = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
1357 initialNode.augmentation(Node1.class));
1358 Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
1359 TerminationPointBuilder tpBldr = new TerminationPointBuilder(
1360 tps.get(new TerminationPointKey(new TpId(tpid))));
1361 TerminationPoint1Builder tp1Bldr = new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class));
1362 tp1Bldr.setAdministrativeState(admin)
1363 .setOperationalState(oper);
1364 tpBldr.addAugmentation(tp1Bldr.build());
1365 tps.replace(tpBldr.key(), tpBldr.build());
1366 tpdr1Bldr.setTerminationPoint(tps);
1367 return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();
1370 private org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1371 .Link changeOtnLinkState(
1372 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1373 .Link initiallink, AdminStates admin, State oper) {
1375 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1376 .LinkBuilder linkBldr = new
1377 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1378 .LinkBuilder(initiallink);
1379 Link1Builder link1Bldr = new Link1Builder(linkBldr.augmentation(Link1.class));
1380 link1Bldr.setAdministrativeState(admin)
1381 .setOperationalState(oper);
1382 linkBldr.addAugmentation(link1Bldr.build());
1383 return linkBldr.build();