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.tapi.utils.TapiTopologyDataUtils;
37 import org.opendaylight.transportpce.test.AbstractTest;
38 import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1Builder;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1Builder;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmTpType;
46 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
47 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
48 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
49 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
50 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
51 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeBuilder;
52 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeKey;
53 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId;
54 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
55 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1;
56 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
57 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.LinkKey;
58 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
59 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointBuilder;
60 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointKey;
61 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
62 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
63 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
64 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
65 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
66 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
67 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
68 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
69 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
79 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
80 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
81 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
82 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
83 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
84 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
85 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
86 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePointKey;
87 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint;
88 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
89 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link;
90 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
91 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
92 import org.opendaylight.yangtools.yang.common.Uint64;
93 import org.slf4j.Logger;
94 import org.slf4j.LoggerFactory;
96 public class ConvertORTopoToTapiTopoTest extends AbstractTest {
97 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToTapiTopoTest.class);
99 private static Node otnMuxA;
100 private static Node otnMuxC;
101 private static Node otnSwitch;
102 private static Node tpdr100G;
103 private static Map<LinkKey,org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
104 .networks.network.Link> otnLinks;
105 private static Uuid topologyUuid;
106 private static DataBroker dataBroker = getDataBroker();
107 private static final String E_OTSI = "eOTSi";
108 private static final String I_OTSI = "iOTSi";
109 private static final String DSR = "DSR";
112 public static void setUp() throws InterruptedException, ExecutionException {
113 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
114 TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
115 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
116 TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
117 TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
118 TapiTopologyDataUtils.PORTMAPPING_FILE);
120 KeyedInstanceIdentifier<Node, NodeKey> muxAIID = InstanceIdentifier.create(Networks.class)
121 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
122 .class, new NetworkKey(new NetworkId("otn-topology")))
123 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR1")));
124 FluentFuture<Optional<Node>> muxAFuture = dataBroker.newReadOnlyTransaction()
125 .read(LogicalDatastoreType.CONFIGURATION, muxAIID);
126 KeyedInstanceIdentifier<Node, NodeKey> muxCIID = InstanceIdentifier.create(Networks.class)
127 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
128 .class, new NetworkKey(new NetworkId("otn-topology")))
129 .child(Node.class, new NodeKey(new NodeId("SPDR-SC1-XPDR1")));
130 FluentFuture<Optional<Node>> muxCFuture = dataBroker.newReadOnlyTransaction()
131 .read(LogicalDatastoreType.CONFIGURATION, muxCIID);
132 KeyedInstanceIdentifier<Node, NodeKey> switchIID = InstanceIdentifier.create(Networks.class)
133 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
134 .class, new NetworkKey(new NetworkId("otn-topology")))
135 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR2")));
136 FluentFuture<Optional<Node>> switchFuture = dataBroker.newReadOnlyTransaction()
137 .read(LogicalDatastoreType.CONFIGURATION, switchIID);
139 otnMuxA = muxAFuture.get().get();
140 otnMuxC = muxCFuture.get().get();
141 otnSwitch = switchFuture.get().get();
143 KeyedInstanceIdentifier<Node, NodeKey> tpdrIID = InstanceIdentifier.create(Networks.class)
144 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
145 .class, new NetworkKey(new NetworkId("otn-topology")))
146 .child(Node.class, new NodeKey(new NodeId("XPDR-A1-XPDR1")));
147 FluentFuture<Optional<Node>> tpdrFuture = dataBroker.newReadOnlyTransaction()
148 .read(LogicalDatastoreType.CONFIGURATION, tpdrIID);
149 tpdr100G = tpdrFuture.get().get();
151 InstanceIdentifier<Network1> linksIID = InstanceIdentifier.create(Networks.class)
152 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
153 .class, new NetworkKey(new NetworkId("otn-topology")))
154 .augmentation(Network1.class);
155 FluentFuture<Optional<Network1>> linksFuture = dataBroker.newReadOnlyTransaction()
156 .read(LogicalDatastoreType.CONFIGURATION, linksIID);
157 otnLinks = linksFuture.get().get().getLink();
159 topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TopologyUtils.T0_MULTILAYER.getBytes(Charset.forName("UTF-8")))
161 LOG.info("TEST SETUP READY");
165 public void convertNodeWhenNoStates() {
166 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", null, null);
167 List<String> networkPortList = new ArrayList<>();
168 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
169 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
170 networkPortList.add(tp.getTpId().getValue());
173 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
174 tapiFactory.convertNode(tpdr, networkPortList);
176 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
178 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
179 .getTapiNodes().get(new
180 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
181 Uuid networkNepUuid = new Uuid(
182 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
184 OwnedNodeEdgePoint nepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(networkNepUuid));
185 assertNull("Administrative State should not be present", nepN.getAdministrativeState());
186 assertNull("Operational State should not be present", nepN.getOperationalState());
188 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
190 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
191 .getTapiNodes().get(new
192 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
193 Uuid enepUuid = new Uuid(
194 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
196 Uuid inepUuid = new Uuid(
197 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
199 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
200 assertNull("Administrative State should not be present", enep.getAdministrativeState());
201 assertNull("Operational State should not be present", enep.getOperationalState());
203 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
204 assertNull("Administrative State should not be present", inep.getAdministrativeState());
205 assertNull("Operational State should not be present", inep.getOperationalState());
209 public void convertNodeWhenBadStates1() {
210 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", AdminStates.OutOfService,
212 List<String> networkPortList = new ArrayList<>();
213 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
214 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
215 networkPortList.add(tp.getTpId().getValue());
218 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
219 tapiFactory.convertNode(tpdr, networkPortList);
221 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
223 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
224 .getTapiNodes().get(new
225 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
226 Uuid networkNepUuid = new Uuid(
227 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
229 OwnedNodeEdgePoint nepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(networkNepUuid));
230 assertEquals("Administrative State should be Locked",
231 AdministrativeState.LOCKED, nepN.getAdministrativeState());
232 assertEquals("Operational State should be Disabled",
233 OperationalState.DISABLED, nepN.getOperationalState());
235 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
237 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
238 .getTapiNodes().get(new
239 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
240 Uuid enepUuid = new Uuid(
241 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
243 Uuid inepUuid = new Uuid(
244 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
246 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
247 assertEquals("Administrative State should be Locked",
248 AdministrativeState.LOCKED, enep.getAdministrativeState());
249 assertEquals("Operational State should be Disabled",
250 OperationalState.DISABLED, enep.getOperationalState());
252 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
253 assertEquals("Administrative State should be Locked",
254 AdministrativeState.LOCKED, inep.getAdministrativeState());
255 assertEquals("Operational State should be Disabled",
256 OperationalState.DISABLED, inep.getOperationalState());
260 public void convertNodeWhenBadStates2() {
261 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", AdminStates.Maintenance,
263 List<String> networkPortList = new ArrayList<>();
264 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
265 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
266 networkPortList.add(tp.getTpId().getValue());
269 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
270 tapiFactory.convertNode(tpdr, networkPortList);
272 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
274 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
275 .getTapiNodes().get(new
276 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
277 Uuid networkNepUuid = new Uuid(
278 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
280 OwnedNodeEdgePoint nepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(networkNepUuid));
281 assertEquals("Administrative State should be Locked",
282 AdministrativeState.LOCKED, nepN.getAdministrativeState());
283 assertEquals("Operational State should be Disabled",
284 OperationalState.DISABLED, nepN.getOperationalState());
286 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
288 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
289 .getTapiNodes().get(new
290 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
291 Uuid enepUuid = new Uuid(
292 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
294 Uuid inepUuid = new Uuid(
295 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
297 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
298 assertEquals("Administrative State should be Locked",
299 AdministrativeState.LOCKED, enep.getAdministrativeState());
300 assertEquals("Operational State should be Disabled",
301 OperationalState.DISABLED, enep.getOperationalState());
303 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
304 assertEquals("Administrative State should be Locked",
305 AdministrativeState.LOCKED, inep.getAdministrativeState());
306 assertEquals("Operational State should be Disabled",
307 OperationalState.DISABLED, inep.getOperationalState());
311 public void convertOtnLinkWhenNoState() {
312 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
313 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
314 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
315 link = changeOtnLinkState(otnLinks.get(new LinkKey(
316 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), null, null);
317 otnLinksAlt.replace(link.key(), link);
319 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
320 List<String> networkPortListA = new ArrayList<>();
321 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
322 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
323 networkPortListA.add(tp.getTpId().getValue());
326 tapiFactory.convertNode(otnMuxA, networkPortListA);
327 List<String> networkPortListC = new ArrayList<>();
328 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
329 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
330 networkPortListC.add(tp.getTpId().getValue());
333 tapiFactory.convertNode(otnMuxC, networkPortListC);
334 tapiFactory.convertLinks(otnLinksAlt);
336 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
337 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
338 .collect(Collectors.toList());
339 assertNull("Administrative State should not be present", tapiLinks.get(0).getAdministrativeState());
340 assertEquals("Administrative state should be UNLOCKED",
341 AdministrativeState.UNLOCKED, tapiLinks.get(2).getAdministrativeState());
342 assertNull("Operational State should not be present", tapiLinks.get(0).getOperationalState());
343 assertEquals("Operational state should be ENABLED",
344 OperationalState.ENABLED, tapiLinks.get(2).getOperationalState());
348 public void convertOtnLinkWhenNoStateOnOppositeLink() {
349 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
350 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
351 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
352 link = changeOtnLinkState(otnLinks.get(new LinkKey(
353 new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))), null, null);
354 otnLinksAlt.replace(link.key(), link);
356 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
357 List<String> networkPortListA = new ArrayList<>();
358 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
359 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
360 networkPortListA.add(tp.getTpId().getValue());
363 tapiFactory.convertNode(otnMuxA, networkPortListA);
364 List<String> networkPortListC = new ArrayList<>();
365 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
366 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
367 networkPortListC.add(tp.getTpId().getValue());
370 tapiFactory.convertNode(otnMuxC, networkPortListC);
371 tapiFactory.convertLinks(otnLinksAlt);
373 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
374 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
375 .collect(Collectors.toList());
376 assertNull("Administrative State should not be present", tapiLinks.get(0).getAdministrativeState());
377 assertEquals("Administrative state should be UNLOCKED",
378 AdministrativeState.UNLOCKED, tapiLinks.get(2).getAdministrativeState());
379 assertNull("Operational State should not be present", tapiLinks.get(0).getOperationalState());
380 assertEquals("Operational state should be ENABLED",
381 OperationalState.ENABLED, tapiLinks.get(2).getOperationalState());
385 public void convertOtnLinkWhenBadState1() {
386 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
387 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
388 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
389 link = changeOtnLinkState(otnLinks.get(new LinkKey(
390 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
391 AdminStates.OutOfService, State.OutOfService);
392 otnLinksAlt.replace(link.key(), link);
394 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
395 List<String> networkPortListA = new ArrayList<>();
396 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
397 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
398 networkPortListA.add(tp.getTpId().getValue());
401 tapiFactory.convertNode(otnMuxA, networkPortListA);
402 List<String> networkPortListC = new ArrayList<>();
403 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
404 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
405 networkPortListC.add(tp.getTpId().getValue());
408 tapiFactory.convertNode(otnMuxC, networkPortListC);
409 tapiFactory.convertLinks(otnLinksAlt);
411 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
412 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
413 .collect(Collectors.toList());
414 assertEquals("Administrative state should be LOCKED",
415 AdministrativeState.LOCKED, tapiLinks.get(0).getAdministrativeState());
416 assertEquals("Administrative state should be UNLOCKED",
417 AdministrativeState.UNLOCKED, tapiLinks.get(2).getAdministrativeState());
418 assertEquals("Operational state should be DISABLED",
419 OperationalState.DISABLED, tapiLinks.get(0).getOperationalState());
420 assertEquals("Operational state should be ENABLED",
421 OperationalState.ENABLED, tapiLinks.get(2).getOperationalState());
425 public void convertOtnLinkWhenBadState2() {
426 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
427 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
428 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
429 link = changeOtnLinkState(otnLinks.get(new LinkKey(
430 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
431 AdminStates.Maintenance, State.Degraded);
432 otnLinksAlt.replace(link.key(), link);
434 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
435 List<String> networkPortListA = new ArrayList<>();
436 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
437 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
438 networkPortListA.add(tp.getTpId().getValue());
441 tapiFactory.convertNode(otnMuxA, networkPortListA);
442 List<String> networkPortListC = new ArrayList<>();
443 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
444 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
445 networkPortListC.add(tp.getTpId().getValue());
448 tapiFactory.convertNode(otnMuxC, networkPortListC);
449 tapiFactory.convertLinks(otnLinksAlt);
451 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
452 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
453 .collect(Collectors.toList());
454 assertEquals("Administrative state should be LOCKED",
455 AdministrativeState.LOCKED, tapiLinks.get(0).getAdministrativeState());
456 assertEquals("Administrative state should be UNLOCKED",
457 AdministrativeState.UNLOCKED, tapiLinks.get(2).getAdministrativeState());
458 assertEquals("Operational state should be DISABLED",
459 OperationalState.DISABLED, tapiLinks.get(0).getOperationalState());
460 assertEquals("Operational state should be ENABLED",
461 OperationalState.ENABLED, tapiLinks.get(2).getOperationalState());
465 public void convertOtnLinkWhenBadStateOnOppositeLink() {
466 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
467 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
468 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
469 link = changeOtnLinkState(otnLinks.get(new LinkKey(
470 new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))),
471 AdminStates.OutOfService, State.OutOfService);
472 otnLinksAlt.replace(link.key(), link);
474 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
475 List<String> networkPortListA = new ArrayList<>();
476 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
477 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
478 networkPortListA.add(tp.getTpId().getValue());
481 tapiFactory.convertNode(otnMuxA, networkPortListA);
482 List<String> networkPortListC = new ArrayList<>();
483 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
484 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
485 networkPortListC.add(tp.getTpId().getValue());
488 tapiFactory.convertNode(otnMuxC, networkPortListC);
489 tapiFactory.convertLinks(otnLinksAlt);
491 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
492 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
493 .collect(Collectors.toList());
494 assertEquals("Administrative state should be LOCKED",
495 AdministrativeState.LOCKED, tapiLinks.get(0).getAdministrativeState());
496 assertEquals("Administrative state should be UNLOCKED",
497 AdministrativeState.UNLOCKED, tapiLinks.get(2).getAdministrativeState());
498 assertEquals("Operational state should be DISABLED",
499 OperationalState.DISABLED, tapiLinks.get(0).getOperationalState());
500 assertEquals("Operational state should be ENABLED",
501 OperationalState.ENABLED, tapiLinks.get(2).getOperationalState());
505 public void convertNodeForTransponder100G() {
506 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
507 List<String> networkPortList = new ArrayList<>();
508 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
509 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
510 networkPortList.add(tp.getTpId().getValue());
513 tapiFactory.convertNode(tpdr100G, networkPortList);
514 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
515 = tapiFactory.getTapiNodes().values().stream()
516 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
517 .collect(Collectors.toList());
519 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
520 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
522 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
524 checkDsrNode(tapiNodes.get(1), dsrNodeUuid, "tpdr", "XPDR-A1-XPDR1");
525 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
527 checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "tpdr", "XPDR-A1-XPDR1");
529 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
530 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
531 .collect(Collectors.toList());
532 checkTransitionalLink(tapiLinks.get(1), dsrNodeUuid, otsiNodeUuid,
533 "XPDR-A1-XPDR1+DSR+XPDR1-NETWORK1", "XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1", "XPDR-A1-XPDR1");
537 public void convertNodeForOtnMuxponder() {
538 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
539 List<String> networkPortList = new ArrayList<>();
540 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
541 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
542 networkPortList.add(tp.getTpId().getValue());
545 tapiFactory.convertNode(otnMuxA, networkPortList);
546 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
547 = tapiFactory.getTapiNodes().values().stream()
548 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
549 .collect(Collectors.toList());
551 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
552 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
553 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
555 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "mux", "SPDR-SA1-XPDR1");
556 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
558 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "mux", "SPDR-SA1-XPDR1");
560 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
561 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
562 .collect(Collectors.toList());
563 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
564 "SPDR-SA1-XPDR1+DSR+XPDR1-NETWORK1", "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1", "SPDR-SA1-XPDR1");
568 public void convertNodeForOtnSwitch() {
569 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
570 List<String> networkPortList = new ArrayList<>();
571 for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
572 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
573 networkPortList.add(tp.getTpId().getValue());
576 tapiFactory.convertNode(otnSwitch, networkPortList);
577 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
578 = tapiFactory.getTapiNodes().values().stream()
579 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
580 .collect(Collectors.toList());
582 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
583 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
585 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+DSR".getBytes(Charset.forName("UTF-8")))
587 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "switch", "SPDR-SA1-XPDR2");
588 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+OTSi".getBytes(Charset.forName("UTF-8")))
590 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "switch", "SPDR-SA1-XPDR2");
592 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
593 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
594 .collect(Collectors.toList());
595 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
596 "SPDR-SA1-XPDR2+DSR+XPDR2-NETWORK4", "SPDR-SA1-XPDR2+iOTSi+XPDR2-NETWORK4", "SPDR-SA1-XPDR2");
600 public void convertOtnLink() {
601 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
602 List<String> networkPortListA = new ArrayList<>();
603 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
604 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
605 networkPortListA.add(tp.getTpId().getValue());
608 tapiFactory.convertNode(otnMuxA, networkPortListA);
609 List<String> networkPortListC = new ArrayList<>();
610 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
611 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
612 networkPortListC.add(tp.getTpId().getValue());
615 tapiFactory.convertNode(otnMuxC, networkPortListC);
616 tapiFactory.convertLinks(otnLinks);
617 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
619 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
621 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
623 Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
625 Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
627 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR+XPDR1-NETWORK1"
628 .getBytes(Charset.forName("UTF-8"))).toString());
629 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR+XPDR1-NETWORK1"
630 .getBytes(Charset.forName("UTF-8"))).toString());
631 Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1"
632 .getBytes(Charset.forName("UTF-8"))).toString());
633 Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
634 .getBytes(Charset.forName("UTF-8"))).toString());
636 new Uuid(UUID.nameUUIDFromBytes("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"
637 .getBytes(Charset.forName("UTF-8"))).toString());
639 new Uuid(UUID.nameUUIDFromBytes("OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"
640 .getBytes(Charset.forName("UTF-8"))).toString());
642 List<Link> links = tapiFactory.getTapiLinks().values().stream()
643 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
644 .collect(Collectors.toList());
645 checkOtnLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid,
646 "ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1");
647 checkOtnLink(links.get(2), node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid,
648 "OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1");
652 public void convertRoadmInfrastructureWhenNoXponderAttached() {
653 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
654 tapiFactory.convertRoadmInfrastructure();
656 assertEquals("Node list size should be 1", 1, tapiFactory.getTapiNodes().size());
657 assertEquals("Link list size should be empty", 0, tapiFactory.getTapiLinks().size());
658 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
659 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
660 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
662 checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "infra", "ROADM-infra");
666 public void convertRoadmInfrastructureWhenOtnMuxAttached() {
667 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
668 List<String> networkPortListA = new ArrayList<>();
669 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
670 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
671 networkPortListA.add(tp.getTpId().getValue());
674 tapiFactory.convertNode(otnMuxA, networkPortListA);
675 tapiFactory.convertRoadmInfrastructure();
677 assertEquals("Node list size should be 3", 3, tapiFactory.getTapiNodes().size());
678 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
679 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
680 = tapiFactory.getTapiNodes().values().stream()
681 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
682 .collect(Collectors.toList());
683 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
685 checkOtsiNode(tapiNodes.get(2), otsiNodeUuid, "infra", "ROADM-infra");
687 List<Link> links = tapiFactory.getTapiLinks().values().stream()
688 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
689 .collect(Collectors.toList());
690 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
692 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
694 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eOTSi+XPDR1-NETWORK1"
695 .getBytes(Charset.forName("UTF-8"))).toString());
696 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("roadm node+nep+1")
697 .getBytes(Charset.forName("UTF-8"))).toString());
699 new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1--XPDR1-NETWORK1 and ROADM-infra--NodeEdgePoint_1"
700 .getBytes(Charset.forName("UTF-8"))).toString());
701 checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
702 "SPDR-SA1-XPDR1--XPDR1-NETWORK1 and ROADM-infra--NodeEdgePoint_1");
705 private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
706 Uuid nodeUuid, String dsrNodeType, String nodeId) {
707 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
708 assertEquals("incorrect node name", nodeId, node.getName().get(new NameKey("dsr/odu node name")).getValue());
709 assertEquals("administrative state should be UNLOCKED",
710 AdministrativeState.UNLOCKED, node.getAdministrativeState());
711 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
712 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
713 assertEquals("value-name should be 'dsr/odu node name'",
714 "dsr/odu node name", node.nonnullName().values().stream().findFirst().get().getValueName());
715 assertEquals("dsr node should manage 2 protocol layers : dsr and odu",
716 2, node.getLayerProtocolName().size());
717 assertThat("dsr node should manage 2 protocol layers : dsr and odu",
718 node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
719 List<OwnedNodeEdgePoint> nepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
720 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_N")))
721 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
722 .collect(Collectors.toList());
723 List<OwnedNodeEdgePoint> nepsC;
724 switch (dsrNodeType) {
726 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
727 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
728 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
729 .collect(Collectors.toList());
730 assertEquals("Switch-DSR node should have 4 NEPs network", 4, nepsN.size());
731 assertEquals("Switch-DSR node should have 4 NEPs client", 4, nepsC.size());
732 OwnedNodeEdgePoint nep1 = nepsC.get(2);
733 Uuid client4NepUuid = new Uuid(
734 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
736 checkNepClient100GSwitch(nep1, client4NepUuid, "XPDR2-CLIENT4", "NodeEdgePoint_C",
737 otnSwitch.getNodeId().getValue(), DSR);
738 OwnedNodeEdgePoint nep2 = nepsN.get(1);
739 Uuid networkNepUuid = new Uuid(
740 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
742 checkNepNetworkODU4(nep2, networkNepUuid, "XPDR2-NETWORK1", "NodeEdgePoint_N",
743 otnSwitch.getNodeId().getValue(), DSR);
744 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
745 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
746 .collect(Collectors.toList());
747 checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, networkNepUuid, nodeUuid);
750 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
751 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
752 .sorted((nep3, nep4) -> nep3.getUuid().getValue().compareTo(nep4.getUuid().getValue()))
753 .collect(Collectors.toList());
754 assertEquals("Mux-DSR node should have 1 NEP network", 1, nepsN.size());
755 assertEquals("Mux-DSR node should have 4 NEPs client", 4, nepsC.size());
756 OwnedNodeEdgePoint nep3 = nepsC.get(2);
757 Uuid client3NepUuid = new Uuid(
758 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
760 checkNepClient10G(nep3, client3NepUuid, "XPDR1-CLIENT3", "NodeEdgePoint_C",
761 otnMuxA.getNodeId().getValue(), DSR);
763 OwnedNodeEdgePoint nep4 = nepsN.get(0);
764 Uuid networkNepUuid2 = new Uuid(
765 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
767 checkNepNetworkODU4(nep4, networkNepUuid2, "XPDR1-NETWORK1", "NodeEdgePoint_N",
768 otnMuxA.getNodeId().getValue(), DSR);
769 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
770 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
771 .collect(Collectors.toList());
772 checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, networkNepUuid2, nodeUuid);
775 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
776 .filter(n -> n.getName().containsKey(new NameKey("100G-tpdr")))
777 .sorted((nep5, nep6) -> nep5.getUuid().getValue().compareTo(nep6.getUuid().getValue()))
778 .collect(Collectors.toList());
779 assertEquals("Tpdr-DSR node should have 2 NEPs network", 2, nepsN.size());
780 assertEquals("Tpdr-DSR node should have 2 NEPs client", 2, nepsC.size());
781 OwnedNodeEdgePoint nep5 = nepsC.get(0);
782 Uuid client1NepUuid = new Uuid(
783 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
785 checkNepClient100GTpdr(nep5, client1NepUuid, "XPDR1-CLIENT1", "100G-tpdr",
786 tpdr100G.getNodeId().getValue(), DSR);
788 OwnedNodeEdgePoint nep6 = nepsN.get(0);
789 Uuid networkNepUuid3 = new Uuid(
790 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
792 checkNepNetworkODU4(nep6, networkNepUuid3, "XPDR1-NETWORK1", "NodeEdgePoint_N",
793 tpdr100G.getNodeId().getValue(), DSR);
794 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
795 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
796 .collect(Collectors.toList());
797 checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, networkNepUuid3, nodeUuid);
805 private void checkOtsiNode(
806 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
807 Uuid nodeUuid, String otsiNodeType, String nodeId) {
808 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
809 assertEquals("incorrect node name", nodeId, node.getName().get(new NameKey("otsi node name")).getValue());
810 assertEquals("administrative state should be UNLOCKED",
811 AdministrativeState.UNLOCKED, node.getAdministrativeState());
812 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
813 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
814 assertEquals("value-name should be 'dsr/odu node name'",
815 "otsi node name", node.nonnullName().values().stream().findFirst().get().getValueName());
816 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
817 1, node.getLayerProtocolName().size());
818 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
819 LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().get(0));
820 List<OwnedNodeEdgePoint> nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
821 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
822 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
823 .collect(Collectors.toList());
824 List<OwnedNodeEdgePoint> nepsE = node.nonnullOwnedNodeEdgePoint().values().stream()
825 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint")))
826 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
827 .collect(Collectors.toList());
828 switch (otsiNodeType) {
830 assertEquals("Switch-OTSi node should have 4 eNEPs", 4, nepsE.size());
831 assertEquals("Switch-OTSi node should have 4 iNEPs", 4, nepsI.size());
832 OwnedNodeEdgePoint nep1 = nepsI.get(1);
833 Uuid inepUuid = new Uuid(
834 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
836 checkNepOtsiNode(nep1, inepUuid, "XPDR2-NETWORK2", "iNodeEdgePoint", otnSwitch.getNodeId().getValue(),
838 OwnedNodeEdgePoint nep2 = nepsE.get(0);
839 Uuid enepUuid = new Uuid(
840 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
842 checkNepOtsiNode(nep2, enepUuid, "XPDR2-NETWORK2", "eNodeEdgePoint", otnSwitch.getNodeId().getValue(),
844 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
845 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
846 .collect(Collectors.toList());
847 checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
850 assertEquals("Mux-OTSi node should have 1 eNEP", 1, nepsE.size());
851 assertEquals("Mux-OTSi node should have 1 iNEPs", 1, nepsI.size());
852 OwnedNodeEdgePoint nep3 = nepsE.get(0);
853 Uuid enepUuid2 = new Uuid(
854 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
856 checkNepOtsiNode(nep3, enepUuid2, "XPDR1-NETWORK1", "eNodeEdgePoint", otnMuxA.getNodeId().getValue(),
858 OwnedNodeEdgePoint nep4 = nepsI.get(0);
859 Uuid inepUuid2 = new Uuid(
860 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
862 checkNepOtsiNode(nep4, inepUuid2, "XPDR1-NETWORK1", "iNodeEdgePoint", otnMuxA.getNodeId().getValue(),
864 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
865 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
866 .collect(Collectors.toList());
867 checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
870 assertEquals("Tpdr-OTSi node should have 2 eNEPs", 2, nepsE.size());
871 assertEquals("Tpdr-OTSi node should have 2 iNEPs", 2, nepsI.size());
872 OwnedNodeEdgePoint nep5 = nepsE.get(0);
873 Uuid enepUuid3 = new Uuid(
874 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
876 checkNepOtsiNode(nep5, enepUuid3, "XPDR1-NETWORK1", "eNodeEdgePoint", tpdr100G.getNodeId().getValue(),
878 OwnedNodeEdgePoint nep6 = nepsI.get(0);
879 Uuid inepUuid3 = new Uuid(
880 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
882 checkNepOtsiNode(nep6, inepUuid3, "XPDR1-NETWORK1", "iNodeEdgePoint", tpdr100G.getNodeId().getValue(),
884 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
885 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
886 .collect(Collectors.toList());
887 checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
890 Iterator<OwnedNodeEdgePoint> nepIterator = node.nonnullOwnedNodeEdgePoint().values().iterator();
892 while (nepIterator.hasNext()) {
893 OwnedNodeEdgePoint nep = nepIterator.next();
894 Uuid nepUuid = new Uuid(
895 UUID.nameUUIDFromBytes((String.join("+", "roadm node", "nep", String.valueOf(count)))
896 .getBytes(Charset.forName("UTF-8"))).toString());
897 checkNepOtsiRdmNode(nep, nepUuid, new StringBuilder("NodeEdgePoint_").append(count).toString(),
898 "NodeEdgePoint name");
901 List<NodeRuleGroup> nrgList4 = node.nonnullNodeRuleGroup().values().stream()
902 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
903 .collect(Collectors.toList());
904 checkNodeRuleGroupForRdmInfra(nrgList4, count - 1);
909 private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
910 String nodeId, String extension) {
911 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
912 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
913 Name name = nameList.get(0);
914 assertEquals("value of client nep should be '" + portName + "'",
915 portName, name.getValue());
916 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
917 nepName, name.getValueName());
918 assertEquals("Client nep should support 3 kind of cep",
919 3, nep.getSupportedCepLayerProtocolQualifier().size());
920 assertThat("client nep should support 3 kind of cep",
921 nep.getSupportedCepLayerProtocolQualifier(),
922 hasItems(ODUTYPEODU2.class, ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
923 assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
924 checkCommonPartOfNep(nep, false);
925 checkSIP(nep, portName, nodeId, extension);
928 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
929 String nodeId, String extension) {
930 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
931 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
932 Name name = nameList.get(0);
933 assertEquals("value of network nep should be '" + portName + "'",
934 portName, name.getValue());
935 assertEquals("value-name of network nep for '" + portName + "' should be '" + nepName + "'",
936 nepName, name.getValueName());
937 assertEquals("Network nep should support 1 kind of cep",
938 1, nep.getSupportedCepLayerProtocolQualifier().size());
939 assertThat("network nep should support 1 kind of cep",
940 nep.getSupportedCepLayerProtocolQualifier(),
941 hasItem(ODUTYPEODU4.class));
942 assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
943 checkCommonPartOfNep(nep, false);
944 checkSIP(nep, portName, nodeId, extension);
947 private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
949 assertEquals("transponder DSR should contain 2 node rule group", 2, nrgList.size());
950 for (NodeRuleGroup nodeRuleGroup : nrgList) {
951 assertEquals("each node-rule-group should contain 2 NEP for transponder DSR",
952 2, nodeRuleGroup.getNodeEdgePoint().size());
954 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
955 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
956 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
957 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
958 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
959 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
960 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
961 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
962 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
963 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
964 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
965 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
966 assertEquals("node-rule-group nb 1 should contain a single rule", 1, rule.size());
967 assertEquals("local-id of the rule should be 'forward'",
968 "forward", rule.get(0).getLocalId());
969 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
970 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
971 assertEquals("the rule type should be 'FORWARDING'",
972 RuleType.FORWARDING, rule.get(0).getRuleType());
975 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
977 assertEquals("muxponder DSR should contain 4 node rule group", 4, nrgList.size());
978 for (NodeRuleGroup nodeRuleGroup : nrgList) {
979 assertEquals("each node-rule-group should contain 2 NEP for muxponder DSR",
980 2, nodeRuleGroup.getNodeEdgePoint().size());
982 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
983 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
984 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
985 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
986 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
987 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
988 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
989 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
990 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
991 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
992 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
993 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
994 assertEquals("node-rule-group nb 2 should contain a single rule", 1, rule.size());
995 assertEquals("local-id of the rule should be 'forward'",
996 "forward", rule.get(0).getLocalId());
997 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
998 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
999 assertEquals("the rule type should be 'FORWARDING'",
1000 RuleType.FORWARDING, rule.get(0).getRuleType());
1003 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1005 assertEquals("Switch-DSR should contain a single node rule group", 1, nrgList.size());
1006 assertEquals("Switch-DSR node-rule-group should contain 8 NEP", 8, nrgList.get(0).getNodeEdgePoint().size());
1007 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
1008 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
1009 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
1010 .collect(Collectors.toList());
1011 assertEquals("in the sorted node-rule-group, nep number 2 should be XPDR2-NETWORK1",
1012 networkNepUuid, nrg.get(4).getNodeEdgePointUuid());
1013 assertEquals("in the sorted node-rule-group, nep number 6 should be XPDR2-CLIENT4",
1014 clientNepUuid, nrg.get(3).getNodeEdgePointUuid());
1015 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1016 nodeUuid, nrg.get(4).getNodeUuid());
1017 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1018 nodeUuid, nrg.get(3).getNodeUuid());
1020 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1021 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1022 assertEquals("local-id of the rule should be 'forward'",
1023 "forward", ruleList.get(0).getLocalId());
1024 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1025 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1026 assertEquals("the rule type should be 'FORWARDING'",
1027 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1030 private void checkNodeRuleGroupForRdmInfra(List<NodeRuleGroup> nrgList, int nbNeps) {
1031 assertEquals("RDM infra node - OTSi should contain a single node rule groups", 1, nrgList.size());
1033 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1034 assertEquals("RDM infra node -rule-group should contain " + nbNeps + " NEP",
1035 nbNeps, nodeEdgePointList.size());
1037 assertNull("RDM infra node -rule-group should contain no NEP", nrgList.get(0).getNodeEdgePoint());
1039 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1040 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1041 assertEquals("local-id of the rule should be 'forward'",
1042 "forward", ruleList.get(0).getLocalId());
1043 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1044 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1045 assertEquals("the rule type should be 'FORWARDING'",
1046 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1049 private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1051 assertEquals("Tpdr-OTSi should contain two node rule groups", 2, nrgList.size());
1052 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1053 assertEquals("Tpdr-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1054 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1055 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1056 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1057 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1058 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1059 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1060 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1061 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1062 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1063 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1064 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1065 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1066 assertEquals("local-id of the rule should be 'forward'",
1067 "forward", ruleList.get(0).getLocalId());
1068 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1069 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1070 assertEquals("the rule type should be 'FORWARDING'",
1071 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1074 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1076 assertEquals("Mux-OTSi should contain a single node rule group", 1, nrgList.size());
1077 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1078 assertEquals("Mux-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1079 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1080 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1081 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1082 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1083 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1084 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1085 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1086 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1087 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1088 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1089 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1090 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1091 assertEquals("local-id of the rule should be 'forward'",
1092 "forward", ruleList.get(0).getLocalId());
1093 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1094 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1095 assertEquals("the rule type should be 'FORWARDING'",
1096 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1099 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1101 assertEquals("Switch-OTSi should contain 4 node rule group", 4, nrgList.size());
1102 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1103 assertEquals("each node-rule-group should contain 2 NEP for Switch-OTSi",
1104 2, nodeRuleGroup.getNodeEdgePoint().size());
1106 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
1107 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1108 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
1109 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1110 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1111 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
1112 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1113 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1114 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1115 nodeUuid, nodeEdgePointList0.get(0).getNodeUuid());
1116 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1117 nodeUuid, nodeEdgePointList0.get(1).getNodeUuid());
1118 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1119 assertEquals("node-rule-group should contain a single rule", 1, ruleList0.size());
1120 assertEquals("local-id of the rule should be 'forward'",
1121 "forward", ruleList0.get(0).getLocalId());
1122 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1123 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList0.get(0).getForwardingRule());
1124 assertEquals("the rule type should be 'FORWARDING'",
1125 RuleType.FORWARDING, ruleList0.get(0).getRuleType());
1128 private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1129 String nodeId, String extension) {
1130 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1131 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1132 assertEquals("value of client nep should be '" + portName + "'",
1133 portName, nameList.get(0).getValue());
1134 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
1135 nepName, nameList.get(0).getValueName());
1136 assertEquals("Client nep should support 2 kind of cep",
1137 2, nep.getSupportedCepLayerProtocolQualifier().size());
1138 assertThat("client nep should support 2 kind of cep",
1139 nep.getSupportedCepLayerProtocolQualifier(),
1140 hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
1141 assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
1142 checkCommonPartOfNep(nep, false);
1143 checkSIP(nep, portName, nodeId, extension);
1146 private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1147 String nodeId, String extension) {
1148 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1149 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1150 assertEquals("value of client nep should be '" + portName + "'",
1151 portName, nameList.get(0).getValue());
1152 assertEquals("value-name of client nep for '" + portName + "' should be 100G-tpdr'",
1153 nepName, nameList.get(0).getValueName());
1154 assertEquals("Client nep should support 1 kind of cep",
1155 1, nep.getSupportedCepLayerProtocolQualifier().size());
1156 assertThat("client nep should support 2 kind of cep",
1157 nep.getSupportedCepLayerProtocolQualifier(),
1158 hasItems(DIGITALSIGNALTYPE100GigE.class));
1159 assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
1160 checkCommonPartOfNep(nep, false);
1161 checkSIP(nep, portName, nodeId, extension);
1164 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1165 String nodeId, String extension) {
1166 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1167 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1168 assertEquals("value of OTSi nep should be '" + portName + "'",
1169 portName, nameList.get(0).getValue());
1170 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1171 nepName, nameList.get(0).getValueName());
1172 assertEquals("OTSi nep should support 2 kind of cep",
1173 2, nep.getSupportedCepLayerProtocolQualifier().size());
1174 assertThat("OTSi nep should support 2 kind of cep",
1175 nep.getSupportedCepLayerProtocolQualifier(),
1176 hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
1177 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1178 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1179 assertEquals("OTSi nep should support one SIP", 1, nep.getMappedServiceInterfacePoint().size());
1180 checkCommonPartOfNep(nep, false);
1181 checkSIP(nep, portName, nodeId, extension);
1184 private void checkSIP(OwnedNodeEdgePoint nep, String portName, String nodeId, String extension) {
1185 Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeId, extension, portName))
1186 .getBytes(Charset.forName("UTF-8"))).toString());
1187 assertEquals("service-interface-point-uuid of network nep for '" + portName + "' should be '"
1188 + String.join("+", "SIP", nodeId, portName) + "'", sipUuid, nep.getMappedServiceInterfacePoint()
1189 .get(new MappedServiceInterfacePointKey(sipUuid)).getServiceInterfacePointUuid());
1192 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1193 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1194 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1195 assertEquals("value of OTSi nep should be '" + portName + "'",
1196 portName, nameList.get(0).getValue());
1197 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1198 nepName, nameList.get(0).getValueName());
1199 assertEquals("OTSi nep of RDM infra node should support only 1 kind of cep",
1200 1, nep.getSupportedCepLayerProtocolQualifier().size());
1201 assertThat("OTSi nep should support 2 kind of cep",
1202 nep.getSupportedCepLayerProtocolQualifier(),
1203 hasItems(PHOTONICLAYERQUALIFIEROMS.class));
1204 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1205 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1206 assertEquals("OTSi nep of RDM infra should support no SIP", 0, nep.nonnullMappedServiceInterfacePoint().size());
1207 checkCommonPartOfNep(nep, true);
1210 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean isRdm) {
1211 assertEquals("link port direction should be DIRECTIONAL",
1212 PortDirection.BIDIRECTIONAL, nep.getLinkPortDirection());
1213 assertEquals("administrative state should be UNLOCKED",
1214 AdministrativeState.UNLOCKED, nep.getAdministrativeState());
1215 assertEquals("termination state should be TERMINATED BIDIRECTIONAL",
1216 TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState());
1217 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, nep.getLifecycleState());
1219 assertEquals("client nep should support 1 SIP", 1, nep.getMappedServiceInterfacePoint().size());
1221 assertEquals("termination direction should be BIDIRECTIONAL",
1222 TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection());
1223 assertEquals("operational state of client nep should be ENABLED",
1224 OperationalState.ENABLED, nep.getOperationalState());
1225 assertEquals("link-port-role of client nep should be SYMMETRIC",
1226 PortRole.SYMMETRIC, nep.getLinkPortRole());
1229 private void checkTransitionalLink(Link link, Uuid node1Uuid, Uuid node2Uuid, String tp1, String tp2,
1230 String ietfNodeId) {
1231 Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((ietfNodeId + "--" + tp1 + "--" + tp2)
1232 .getBytes(Charset.forName("UTF-8"))).toString());
1233 assertEquals("bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2, linkUuid, link.getUuid());
1234 assertEquals("Available capacity unit should be GBPS",
1235 CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
1236 assertEquals("Available capacity -total size value should be 100",
1237 Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue());
1238 assertEquals("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1239 2, link.getTransitionedLayerProtocolName().size());
1240 assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1241 link.getTransitionedLayerProtocolName(),
1242 hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));
1243 assertEquals("transitional link should be BIDIRECTIONAL",
1244 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1245 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1246 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1247 assertEquals("topology uuid should be the same for the two termination point of the link",
1248 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1249 assertEquals("topology uuid should be the same for the two termination point of the link",
1250 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1251 assertThat("transitional links should terminate on DSR node and Photonic node",
1252 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1253 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1254 assertThat("transitional links should terminate on DSR node and Photonic node",
1255 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1256 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1257 Uuid nep1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1.getBytes(Charset.forName("UTF-8"))).toString());
1258 Uuid nep2Uuid = new Uuid(UUID.nameUUIDFromBytes(tp2.getBytes(Charset.forName("UTF-8"))).toString());
1259 assertThat("transitional links should terminate on " + tp1 + " and " + tp2 + " neps",
1260 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1261 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1262 assertThat("transitional links should terminate on DSR node and Photonic node",
1263 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1264 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1267 private void checkOtnLink(Link link, Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1269 assertEquals("bad name for the link", linkName, link.getName().get(new NameKey("otn link name")).getValue());
1270 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1271 assertEquals("Available capacity unit should be MBPS",
1272 CapacityUnit.MBPS, link.getAvailableCapacity().getTotalSize().getUnit());
1273 String prefix = linkName.split("-")[0];
1274 if ("OTU4".equals(prefix)) {
1275 assertEquals("Available capacity -total size value should be 0",
1276 Uint64.valueOf(0), link.getAvailableCapacity().getTotalSize().getValue());
1277 } else if ("ODTU4".equals(prefix)) {
1278 assertEquals("Available capacity -total size value should be 100 000",
1279 Uint64.valueOf(100000), link.getAvailableCapacity().getTotalSize().getValue());
1281 assertEquals("Total capacity unit should be GBPS",
1282 CapacityUnit.GBPS, link.getTotalPotentialCapacity().getTotalSize().getUnit());
1283 assertEquals("Total capacity -total size value should be 100",
1284 Uint64.valueOf(100), link.getTotalPotentialCapacity().getTotalSize().getValue());
1285 if ("OTU4".equals(prefix)) {
1286 assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1287 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1288 } else if ("ODTU4".equals(prefix)) {
1289 assertEquals("otn link should be between 2 nodes of protocol layers ODU",
1290 LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName());
1292 assertEquals("otn tapi link should be BIDIRECTIONAL",
1293 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1294 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1295 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1296 assertEquals("topology uuid should be the same for the two termination point of the link",
1297 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1298 assertEquals("topology uuid should be the same for the two termination point of the link",
1299 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1300 assertThat("otn links should terminate on two distinct nodes",
1301 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1302 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1303 assertThat("otn links should terminate on two distinct nodes",
1304 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1305 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1306 assertThat("otn links should terminate on two distinct tps",
1307 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1308 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1309 assertThat("otn links should terminate on two distinct tps",
1310 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1311 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1312 assertEquals("operational state should be ENABLED",
1313 OperationalState.ENABLED, link.getOperationalState());
1314 assertEquals("administrative state should be UNLOCKED",
1315 AdministrativeState.UNLOCKED, link.getAdministrativeState());
1318 private void checkOmsLink(Link link, Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1320 assertEquals("bad name for the link", linkName, link.getName().get(new NameKey("OMS link name")).getValue());
1321 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1322 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1323 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1324 assertEquals("otn tapi link should be BIDIRECTIONAL",
1325 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1326 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1327 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1328 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
1329 assertEquals("topology uuid should be the same for the two termination point of the link",
1330 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1331 assertEquals("topology uuid should be the same for the two termination point of the link",
1332 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1333 assertThat("oms links should terminate on two distinct nodes",
1334 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1335 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1336 assertThat("oms links should terminate on two distinct nodes",
1337 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1338 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1339 assertThat("oms links should terminate on two distinct tps",
1340 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1341 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1342 assertThat("oms links should terminate on two distinct tps",
1343 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1344 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1347 private Node changeTerminationPointState(Node initialNode, String tpid, AdminStates admin, State oper) {
1348 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
1349 = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
1350 initialNode.augmentation(Node1.class));
1351 Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
1352 TerminationPointBuilder tpBldr = new TerminationPointBuilder(
1353 tps.get(new TerminationPointKey(new TpId(tpid))));
1354 TerminationPoint1Builder tp1Bldr = new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class));
1355 tp1Bldr.setAdministrativeState(admin)
1356 .setOperationalState(oper);
1357 tpBldr.addAugmentation(tp1Bldr.build());
1358 tps.replace(tpBldr.key(), tpBldr.build());
1359 tpdr1Bldr.setTerminationPoint(tps);
1360 return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();
1363 private org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1364 .Link changeOtnLinkState(
1365 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1366 .Link initiallink, AdminStates admin, State oper) {
1368 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1369 .LinkBuilder linkBldr = new
1370 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1371 .LinkBuilder(initiallink);
1372 Link1Builder link1Bldr = new Link1Builder(linkBldr.augmentation(Link1.class));
1373 link1Bldr.setAdministrativeState(admin)
1374 .setOperationalState(oper);
1375 linkBldr.addAugmentation(link1Bldr.build());
1376 return linkBldr.build();