2 * Copyright © 2021 Nokia, 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.List;
25 import java.util.Optional;
26 import java.util.UUID;
27 import java.util.concurrent.ExecutionException;
28 import java.util.stream.Collectors;
29 import org.eclipse.jdt.annotation.Nullable;
30 import org.junit.BeforeClass;
31 import org.junit.Test;
32 import org.opendaylight.mdsal.binding.api.DataBroker;
33 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
34 import org.opendaylight.transportpce.common.InstanceIdentifiers;
35 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
36 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
37 import org.opendaylight.transportpce.common.network.RequestProcessor;
38 import org.opendaylight.transportpce.tapi.TapiStringConstants;
39 import org.opendaylight.transportpce.tapi.utils.TapiLink;
40 import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils;
41 import org.opendaylight.transportpce.test.AbstractTest;
42 import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1Builder;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1Builder;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmLinkType;
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.Network;
55 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
56 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
57 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeBuilder;
58 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeKey;
59 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId;
60 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
61 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1;
62 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
63 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
64 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.LinkKey;
65 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
66 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointBuilder;
67 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointKey;
68 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
69 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
79 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
80 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
81 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
82 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
83 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
84 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
85 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
86 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
87 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
88 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
89 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
90 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
91 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
92 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
93 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint;
94 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
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 ConvertORTopoToFullTapiTopoTest extends AbstractTest {
102 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToFullTapiTopoTest.class);
104 private static Node otnMuxA;
105 private static Node otnMuxC;
106 private static Node otnSwitch;
107 private static Node tpdr100G;
108 private static Node roadmA;
109 private static Node roadmC;
110 private static Network openroadmNet;
111 private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
112 .networks.network.Link> otnLinks;
113 private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
114 .networks.network.Link> ortopoLinks;
115 private static Uuid topologyUuid;
116 private static NetworkTransactionService networkTransactionService;
117 private static TapiLink tapiLink;
118 private static DataBroker dataBroker = getDataBroker();
121 public static void setUp() throws InterruptedException, ExecutionException {
122 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
123 TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
124 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
125 TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II);
126 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
127 TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
128 TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
129 TapiTopologyDataUtils.PORTMAPPING_FILE);
131 KeyedInstanceIdentifier<Node, NodeKey> muxAIID = InstanceIdentifier.create(Networks.class)
132 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
133 .class, new NetworkKey(new NetworkId("otn-topology")))
134 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR1")));
135 FluentFuture<Optional<Node>> muxAFuture = dataBroker.newReadOnlyTransaction()
136 .read(LogicalDatastoreType.CONFIGURATION, muxAIID);
137 otnMuxA = muxAFuture.get().get();
138 KeyedInstanceIdentifier<Node, NodeKey> muxCIID = InstanceIdentifier.create(Networks.class)
139 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
140 .class, new NetworkKey(new NetworkId("otn-topology")))
141 .child(Node.class, new NodeKey(new NodeId("SPDR-SC1-XPDR1")));
142 FluentFuture<Optional<Node>> muxCFuture = dataBroker.newReadOnlyTransaction()
143 .read(LogicalDatastoreType.CONFIGURATION, muxCIID);
144 otnMuxC = muxCFuture.get().get();
145 KeyedInstanceIdentifier<Node, NodeKey> switchIID = InstanceIdentifier.create(Networks.class)
146 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
147 .class, new NetworkKey(new NetworkId("otn-topology")))
148 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR2")));
149 FluentFuture<Optional<Node>> switchFuture = dataBroker.newReadOnlyTransaction()
150 .read(LogicalDatastoreType.CONFIGURATION, switchIID);
151 otnSwitch = switchFuture.get().get();
152 KeyedInstanceIdentifier<Node, NodeKey> roadmaIID = InstanceIdentifier.create(Networks.class)
153 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
154 .class, new NetworkKey(new NetworkId("openroadm-network")))
155 .child(Node.class, new NodeKey(new NodeId("ROADM-A1")));
156 FluentFuture<Optional<Node>> roadmaFuture = dataBroker.newReadOnlyTransaction()
157 .read(LogicalDatastoreType.CONFIGURATION, roadmaIID);
158 roadmA = roadmaFuture.get().get();
159 KeyedInstanceIdentifier<Node, NodeKey> roadmcIID = InstanceIdentifier.create(Networks.class)
160 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
161 .class, new NetworkKey(new NetworkId("openroadm-network")))
162 .child(Node.class, new NodeKey(new NodeId("ROADM-C1")));
163 FluentFuture<Optional<Node>> roadmcFuture = dataBroker.newReadOnlyTransaction()
164 .read(LogicalDatastoreType.CONFIGURATION, roadmcIID);
165 roadmC = roadmcFuture.get().get();
167 KeyedInstanceIdentifier<Node, NodeKey> tpdrIID = InstanceIdentifier.create(Networks.class)
168 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
169 .class, new NetworkKey(new NetworkId("otn-topology")))
170 .child(Node.class, new NodeKey(new NodeId("XPDR-A1-XPDR1")));
171 FluentFuture<Optional<Node>> tpdrFuture = dataBroker.newReadOnlyTransaction()
172 .read(LogicalDatastoreType.CONFIGURATION, tpdrIID);
173 tpdr100G = tpdrFuture.get().get();
175 InstanceIdentifier<Network1> linksIID = InstanceIdentifier.create(Networks.class)
176 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
177 .class, new NetworkKey(new NetworkId("otn-topology")))
178 .augmentation(Network1.class);
179 FluentFuture<Optional<Network1>> linksFuture = dataBroker.newReadOnlyTransaction()
180 .read(LogicalDatastoreType.CONFIGURATION, linksIID);
181 otnLinks = linksFuture.get().get().getLink();
183 InstanceIdentifier<Network1> links1IID = InstanceIdentifier.create(Networks.class)
184 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
185 .class, new NetworkKey(new NetworkId("openroadm-topology")))
186 .augmentation(Network1.class);
187 FluentFuture<Optional<Network1>> links1Future = dataBroker.newReadOnlyTransaction()
188 .read(LogicalDatastoreType.CONFIGURATION, links1IID);
189 ortopoLinks = links1Future.get().get().getLink();
191 InstanceIdentifier<Network> ortopo1IID = InstanceIdentifier.create(Networks.class)
192 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
193 .class, new NetworkKey(new NetworkId("openroadm-topology")));
194 FluentFuture<Optional<Network>> ortopoFuture = dataBroker.newReadOnlyTransaction()
195 .read(LogicalDatastoreType.CONFIGURATION, ortopo1IID);
196 openroadmNet = ortopoFuture.get().get();
198 topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
199 Charset.forName("UTF-8"))).toString());
200 networkTransactionService = new NetworkTransactionImpl(
201 new RequestProcessor(getDataStoreContextUtil().getDataBroker()));
202 tapiLink = new TapiLink(networkTransactionService);
203 LOG.info("TEST SETUP READY");
207 public void convertNodeWhenNoStates() {
208 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", null, null);
209 List<String> networkPortList = new ArrayList<>();
210 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
211 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
212 networkPortList.add(tp.getTpId().getValue());
215 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
216 tapiFactory.convertNode(tpdr, networkPortList);
218 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
220 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
221 .getTapiNodes().get(new
222 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
223 Uuid enetworkNepUuid = new Uuid(
224 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
226 Uuid inetworkNepUuid = new Uuid(
227 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
229 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
230 assertNull("Administrative State should not be present", enepN.getAdministrativeState());
231 assertNull("Operational State should not be present", enepN.getOperationalState());
233 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
234 assertNull("Administrative State should not be present", inepN.getAdministrativeState());
235 assertNull("Operational State should not be present", inepN.getOperationalState());
237 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
239 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
240 .getTapiNodes().get(new
241 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
242 Uuid enepUuid = new Uuid(
243 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
245 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
246 assertNull("Administrative State should not be present", enep.getAdministrativeState());
247 assertNull("Operational State should not be present", enep.getOperationalState());
249 Uuid inepUuid = new Uuid(
250 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
252 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
253 assertNull("Administrative State should not be present", inep.getAdministrativeState());
254 assertNull("Operational State should not be present", inep.getOperationalState());
256 Uuid photnepUuid = new Uuid(
257 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
259 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
260 assertNull("Administrative State should not be present", photnep.getAdministrativeState());
261 assertNull("Operational State should not be present", photnep.getOperationalState());
265 public void convertNodeWhenBadStates1() {
266 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", AdminStates.OutOfService,
268 List<String> networkPortList = new ArrayList<>();
269 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
270 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
271 networkPortList.add(tp.getTpId().getValue());
274 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
275 tapiFactory.convertNode(tpdr, networkPortList);
277 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
279 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
280 .getTapiNodes().get(new
281 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
282 Uuid enetworkNepUuid = new Uuid(
283 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
285 Uuid inetworkNepUuid = new Uuid(
286 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
288 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
289 assertEquals("Administrative State should be Locked",
290 AdministrativeState.LOCKED, enepN.getAdministrativeState());
291 assertEquals("Operational State should be Disabled",
292 OperationalState.DISABLED, enepN.getOperationalState());
294 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
295 assertEquals("Administrative State should be Locked",
296 AdministrativeState.LOCKED, inepN.getAdministrativeState());
297 assertEquals("Operational State should be Disabled",
298 OperationalState.DISABLED, inepN.getOperationalState());
300 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
302 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
303 .getTapiNodes().get(new
304 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
305 Uuid enepUuid = new Uuid(
306 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
308 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
309 assertEquals("Administrative State should be Locked",
310 AdministrativeState.LOCKED, enep.getAdministrativeState());
311 assertEquals("Operational State should be Disabled",
312 OperationalState.DISABLED, enep.getOperationalState());
314 Uuid inepUuid = new Uuid(
315 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
317 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
318 assertEquals("Administrative State should be Locked",
319 AdministrativeState.LOCKED, inep.getAdministrativeState());
320 assertEquals("Operational State should be Disabled",
321 OperationalState.DISABLED, inep.getOperationalState());
323 Uuid photnepUuid = new Uuid(
324 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
326 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
327 assertEquals("Administrative State should be Locked",
328 AdministrativeState.LOCKED, photnep.getAdministrativeState());
329 assertEquals("Operational State should be Disabled",
330 OperationalState.DISABLED, photnep.getOperationalState());
334 public void convertNodeWhenBadStates2() {
335 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", AdminStates.Maintenance,
337 List<String> networkPortList = new ArrayList<>();
338 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
339 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
340 networkPortList.add(tp.getTpId().getValue());
343 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
344 tapiFactory.convertNode(tpdr, networkPortList);
346 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
348 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
349 .getTapiNodes().get(new
350 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
351 Uuid enetworkNepUuid = new Uuid(
352 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
354 Uuid inetworkNepUuid = new Uuid(
355 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
357 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
358 assertEquals("Administrative State should be Locked",
359 AdministrativeState.LOCKED, enepN.getAdministrativeState());
360 assertEquals("Operational State should be Disabled",
361 OperationalState.DISABLED, enepN.getOperationalState());
363 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
364 assertEquals("Administrative State should be Locked",
365 AdministrativeState.LOCKED, inepN.getAdministrativeState());
366 assertEquals("Operational State should be Disabled",
367 OperationalState.DISABLED, inepN.getOperationalState());
369 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
371 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
372 .getTapiNodes().get(new
373 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
374 Uuid enepUuid = new Uuid(
375 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
377 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
378 assertEquals("Administrative State should be Locked",
379 AdministrativeState.LOCKED, enep.getAdministrativeState());
380 assertEquals("Operational State should be Disabled",
381 OperationalState.DISABLED, enep.getOperationalState());
383 Uuid inepUuid = new Uuid(
384 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
386 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
387 assertEquals("Administrative State should be Locked",
388 AdministrativeState.LOCKED, inep.getAdministrativeState());
389 assertEquals("Operational State should be Disabled",
390 OperationalState.DISABLED, inep.getOperationalState());
392 Uuid photnepUuid = new Uuid(
393 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
395 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
396 assertEquals("Administrative State should be Locked",
397 AdministrativeState.LOCKED, photnep.getAdministrativeState());
398 assertEquals("Operational State should be Disabled",
399 OperationalState.DISABLED, photnep.getOperationalState());
403 public void convertOtnLinkWhenNoState() {
404 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
405 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
406 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
407 link = changeOtnLinkState(otnLinks.get(new LinkKey(
408 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), null, null);
409 otnLinksAlt.replace(link.key(), link);
411 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
412 List<String> networkPortListA = new ArrayList<>();
413 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
414 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
415 networkPortListA.add(tp.getTpId().getValue());
418 tapiFactory.convertNode(otnMuxA, networkPortListA);
419 List<String> networkPortListC = new ArrayList<>();
420 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
421 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
422 networkPortListC.add(tp.getTpId().getValue());
425 tapiFactory.convertNode(otnMuxC, networkPortListC);
426 tapiFactory.convertLinks(otnLinksAlt);
428 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
429 = tapiFactory.getTapiLinks().values().stream()
430 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
431 .collect(Collectors.toList());
432 assertNull("Administrative State should not be present", tapiLinks.get(3).getAdministrativeState());
433 assertEquals("Administrative state should be UNLOCKED",
434 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
435 assertNull("Operational State should not be present", tapiLinks.get(3).getOperationalState());
436 assertEquals("Operational state should be ENABLED",
437 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
441 public void convertOtnLinkWhenNoStateOnOppositeLink() {
442 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
443 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
444 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
445 link = changeOtnLinkState(otnLinks.get(new LinkKey(
446 new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))), null, null);
447 otnLinksAlt.replace(link.key(), link);
449 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
450 List<String> networkPortListA = new ArrayList<>();
451 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
452 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
453 networkPortListA.add(tp.getTpId().getValue());
456 tapiFactory.convertNode(otnMuxA, networkPortListA);
457 List<String> networkPortListC = new ArrayList<>();
458 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
459 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
460 networkPortListC.add(tp.getTpId().getValue());
463 tapiFactory.convertNode(otnMuxC, networkPortListC);
464 tapiFactory.convertLinks(otnLinksAlt);
466 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
467 = tapiFactory.getTapiLinks().values().stream()
468 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
469 .collect(Collectors.toList());
470 assertNull("Administrative State should not be present", tapiLinks.get(3).getAdministrativeState());
471 assertEquals("Administrative state should be UNLOCKED",
472 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
473 assertNull("Operational State should not be present", tapiLinks.get(3).getOperationalState());
474 assertEquals("Operational state should be ENABLED",
475 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
479 public void convertOtnLinkWhenBadState1() {
480 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
481 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
482 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
483 link = changeOtnLinkState(otnLinks.get(new LinkKey(
484 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
485 AdminStates.OutOfService, State.OutOfService);
486 otnLinksAlt.replace(link.key(), link);
488 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
489 List<String> networkPortListA = new ArrayList<>();
490 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
491 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
492 networkPortListA.add(tp.getTpId().getValue());
495 tapiFactory.convertNode(otnMuxA, networkPortListA);
496 List<String> networkPortListC = new ArrayList<>();
497 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
498 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
499 networkPortListC.add(tp.getTpId().getValue());
502 tapiFactory.convertNode(otnMuxC, networkPortListC);
503 tapiFactory.convertLinks(otnLinksAlt);
505 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
506 = tapiFactory.getTapiLinks().values().stream()
507 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
508 .collect(Collectors.toList());
509 assertEquals("Administrative state should be LOCKED",
510 AdministrativeState.LOCKED, tapiLinks.get(3).getAdministrativeState());
511 assertEquals("Administrative state should be UNLOCKED",
512 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
513 assertEquals("Operational state should be DISABLED",
514 OperationalState.DISABLED, tapiLinks.get(3).getOperationalState());
515 assertEquals("Operational state should be ENABLED",
516 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
520 public void convertOtnLinkWhenBadState2() {
521 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
522 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
523 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
524 link = changeOtnLinkState(otnLinks.get(new LinkKey(
525 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
526 AdminStates.Maintenance, State.Degraded);
527 otnLinksAlt.replace(link.key(), link);
529 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
530 List<String> networkPortListA = new ArrayList<>();
531 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
532 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
533 networkPortListA.add(tp.getTpId().getValue());
536 tapiFactory.convertNode(otnMuxA, networkPortListA);
537 List<String> networkPortListC = new ArrayList<>();
538 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
539 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
540 networkPortListC.add(tp.getTpId().getValue());
543 tapiFactory.convertNode(otnMuxC, networkPortListC);
544 tapiFactory.convertLinks(otnLinksAlt);
546 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
547 = tapiFactory.getTapiLinks().values().stream()
548 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
549 .collect(Collectors.toList());
550 assertEquals("Administrative state should be LOCKED",
551 AdministrativeState.LOCKED, tapiLinks.get(3).getAdministrativeState());
552 assertEquals("Administrative state should be UNLOCKED",
553 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
554 assertEquals("Operational state should be DISABLED",
555 OperationalState.DISABLED, tapiLinks.get(3).getOperationalState());
556 assertEquals("Operational state should be ENABLED",
557 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
561 public void convertOtnLinkWhenBadStateOnOppositeLink() {
562 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
563 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
564 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
565 link = changeOtnLinkState(otnLinks.get(new LinkKey(
566 new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))),
567 AdminStates.OutOfService, State.OutOfService);
568 otnLinksAlt.replace(link.key(), link);
570 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
571 List<String> networkPortListA = new ArrayList<>();
572 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
573 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
574 networkPortListA.add(tp.getTpId().getValue());
577 tapiFactory.convertNode(otnMuxA, networkPortListA);
578 List<String> networkPortListC = new ArrayList<>();
579 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
580 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
581 networkPortListC.add(tp.getTpId().getValue());
584 tapiFactory.convertNode(otnMuxC, networkPortListC);
585 tapiFactory.convertLinks(otnLinksAlt);
587 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
588 = tapiFactory.getTapiLinks().values().stream()
589 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
590 .collect(Collectors.toList());
591 assertEquals("Administrative state should be LOCKED",
592 AdministrativeState.LOCKED, tapiLinks.get(3).getAdministrativeState());
593 assertEquals("Administrative state should be UNLOCKED",
594 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
595 assertEquals("Operational state should be DISABLED",
596 OperationalState.DISABLED, tapiLinks.get(3).getOperationalState());
597 assertEquals("Operational state should be ENABLED",
598 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
602 public void convertNodeForTransponder100G() {
603 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
604 List<String> networkPortList = new ArrayList<>();
605 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
606 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
607 networkPortList.add(tp.getTpId().getValue());
610 tapiFactory.convertNode(tpdr100G, networkPortList);
611 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
612 = tapiFactory.getTapiNodes().values().stream()
613 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
614 .collect(Collectors.toList());
616 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
617 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
619 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
621 checkDsrNode(tapiNodes.get(1), dsrNodeUuid, "tpdr", "XPDR-A1-XPDR1");
622 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
624 checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "tpdr", "XPDR-A1-XPDR1");
626 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
627 = tapiFactory.getTapiLinks().values().stream()
628 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
629 .collect(Collectors.toList());
630 checkTransitionalLink(tapiLinks.get(1), dsrNodeUuid, otsiNodeUuid,
631 "XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1", "XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1", "XPDR-A1-XPDR1");
635 public void convertNodeForOtnMuxponder() {
636 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
637 List<String> networkPortList = new ArrayList<>();
638 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
639 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
640 networkPortList.add(tp.getTpId().getValue());
643 tapiFactory.convertNode(otnMuxA, networkPortList);
644 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
645 = tapiFactory.getTapiNodes().values().stream()
646 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
647 .collect(Collectors.toList());
649 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
650 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
651 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
653 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "mux", "SPDR-SA1-XPDR1");
654 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
656 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "mux", "SPDR-SA1-XPDR1");
658 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
659 = tapiFactory.getTapiLinks().values().stream()
660 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
661 .collect(Collectors.toList());
662 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
663 "SPDR-SA1-XPDR1+iODU+XPDR1-NETWORK1", "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1", "SPDR-SA1-XPDR1");
667 public void convertNodeForOtnSwitch() {
668 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
669 List<String> networkPortList = new ArrayList<>();
670 for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
671 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
672 networkPortList.add(tp.getTpId().getValue());
675 tapiFactory.convertNode(otnSwitch, networkPortList);
676 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
677 = tapiFactory.getTapiNodes().values().stream()
678 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
679 .collect(Collectors.toList());
681 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
682 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
684 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+DSR".getBytes(Charset.forName("UTF-8")))
686 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "switch", "SPDR-SA1-XPDR2");
687 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+OTSi".getBytes(Charset.forName("UTF-8")))
689 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "switch", "SPDR-SA1-XPDR2");
691 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
692 = tapiFactory.getTapiLinks().values().stream()
693 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
694 .collect(Collectors.toList());
695 checkTransitionalLink(tapiLinks.get(2), dsrNodeUuid, otsiNodeUuid,
696 "SPDR-SA1-XPDR2+iODU+XPDR2-NETWORK4", "SPDR-SA1-XPDR2+iOTSi+XPDR2-NETWORK4", "SPDR-SA1-XPDR2");
700 public void convertOtnLink() {
701 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
702 List<String> networkPortListA = new ArrayList<>();
703 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
704 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
705 networkPortListA.add(tp.getTpId().getValue());
708 tapiFactory.convertNode(otnMuxA, networkPortListA);
709 List<String> networkPortListC = new ArrayList<>();
710 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
711 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
712 networkPortListC.add(tp.getTpId().getValue());
715 tapiFactory.convertNode(otnMuxC, networkPortListC);
716 tapiFactory.convertLinks(otnLinks);
717 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
719 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
721 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
723 Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
725 Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
727 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1"
728 .getBytes(Charset.forName("UTF-8"))).toString());
729 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"
730 .getBytes(Charset.forName("UTF-8"))).toString());
731 Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1"
732 .getBytes(Charset.forName("UTF-8"))).toString());
733 Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
734 .getBytes(Charset.forName("UTF-8"))).toString());
736 new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1toSPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"
737 .getBytes(Charset.forName("UTF-8"))).toString());
739 new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
740 .getBytes(Charset.forName("UTF-8"))).toString());
742 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
743 = tapiFactory.getTapiLinks().values().stream()
744 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
745 .collect(Collectors.toList());
746 checkOtnLink(links.get(3), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid,
747 "SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1toSPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1");
748 checkOtnLink(links.get(2), node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid,
749 "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1");
753 public void convertNodeForRoadmWhenNoOtnMuxAttached() {
754 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
755 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
757 assertEquals("Node list size should be 1", 1, tapiFactory.getTapiNodes().size());
758 assertEquals("Link list size should be empty", 0, tapiFactory.getTapiLinks().size());
759 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
760 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
761 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
762 .getBytes(Charset.forName("UTF-8"))).toString());
763 checkOtsiNode(tapiNodes.get(0), roadmNodeUuid, "roadm", "ROADM-A1");
767 public void convertNodeForRoadmWhenRoadmNeighborAttached() {
768 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
769 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
770 tapiFactory.convertRoadmNode(roadmC, openroadmNet);
772 List<Link> rdmTordmLinkList = ortopoLinks.values().stream()
773 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
774 .collect(Collectors.toList());
775 tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
777 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
778 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
780 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
781 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
782 Uuid roadmaNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
783 .getBytes(Charset.forName("UTF-8"))).toString());
784 checkOtsiNode(tapiNodes.get(1), roadmaNodeUuid, "roadm", "ROADM-A1");
786 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
787 = tapiFactory.getTapiLinks().values().stream()
788 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
789 .collect(Collectors.toList());
790 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
792 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-C1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
794 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
795 .getBytes(Charset.forName("UTF-8"))).toString());
796 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
797 .getBytes(Charset.forName("UTF-8"))).toString());
799 new Uuid(UUID.nameUUIDFromBytes(
800 "ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
801 .getBytes(Charset.forName("UTF-8"))).toString());
802 checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
803 "ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX");
807 public void convertNodeForRoadmWhenOtnMuxAttached() {
808 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
809 List<String> networkPortListA = new ArrayList<>();
810 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
811 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
812 networkPortListA.add(tp.getTpId().getValue());
815 tapiFactory.convertNode(otnMuxA, networkPortListA);
816 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
817 List<Link> xponderOutLinkList = ortopoLinks.values().stream()
818 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
819 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
820 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
821 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
822 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
823 .collect(Collectors.toList());
824 List<Link> xponderInLinkList = ortopoLinks.values().stream()
825 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
826 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
827 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
828 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
829 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
830 .collect(Collectors.toList());
831 xponderInLinkList.addAll(xponderOutLinkList);
832 tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
833 assertEquals("Node list size should be 3", 3, tapiFactory.getTapiNodes().size());
834 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
835 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
836 = tapiFactory.getTapiNodes().values().stream()
837 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
838 .collect(Collectors.toList());
839 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
840 .getBytes(Charset.forName("UTF-8"))).toString());
841 checkOtsiNode(tapiNodes.get(1), roadmNodeUuid, "roadm", "ROADM-A1");
843 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
844 = tapiFactory.getTapiLinks().values().stream()
845 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
846 .collect(Collectors.toList());
847 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
849 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
851 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
852 .getBytes(Charset.forName("UTF-8"))).toString());
853 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRX")
854 .getBytes(Charset.forName("UTF-8"))).toString());
856 new Uuid(UUID.nameUUIDFromBytes(
857 "ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
858 .getBytes(Charset.forName("UTF-8"))).toString());
859 checkXpdrRdmLink(links.get(1), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
860 "ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1");
863 private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
864 Uuid nodeUuid, String dsrNodeType, String nodeId) {
865 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
866 assertEquals("incorrect node name", nodeId + "+DSR", node.getName().get(
867 new NameKey("dsr/odu node name")).getValue());
868 assertEquals("administrative state should be UNLOCKED",
869 AdministrativeState.UNLOCKED, node.getAdministrativeState());
870 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
871 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
872 assertEquals("value-name should be 'dsr/odu node name'",
873 "dsr/odu node name", node.nonnullName().values().stream().findFirst().get().getValueName());
874 assertEquals("dsr node should manage 2 protocol layers : dsr and odu",
875 2, node.getLayerProtocolName().size());
876 assertThat("dsr node should manage 2 protocol layers : dsr and odu",
877 node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
878 List<OwnedNodeEdgePoint> inepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
879 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint_N")))
880 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
881 .collect(Collectors.toList());
882 List<OwnedNodeEdgePoint> enepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
883 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint_N")))
884 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
885 .collect(Collectors.toList());
886 List<OwnedNodeEdgePoint> nepsC;
887 switch (dsrNodeType) {
889 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
890 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
891 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
892 .collect(Collectors.toList());
893 assertEquals("Switch-DSR node should have 4 eNEPs network", 4, enepsN.size());
894 assertEquals("Switch-DSR node should have 4 iNEPs network", 4, inepsN.size());
895 assertEquals("Switch-DSR node should have 4 NEPs client", 4, nepsC.size());
896 OwnedNodeEdgePoint nep1 = nepsC.get(2);
897 Uuid client4NepUuid = new Uuid(
898 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
900 checkNepClient100GSwitch(nep1, client4NepUuid, nodeId + "+DSR+XPDR2-CLIENT4", "NodeEdgePoint_C");
901 OwnedNodeEdgePoint enep2 = enepsN.get(3);
902 OwnedNodeEdgePoint inep2 = inepsN.get(3);
903 Uuid enetworkNepUuid = new Uuid(
904 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
906 Uuid inetworkNepUuid = new Uuid(
907 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
909 checkNepNetworkODU4(enep2, enetworkNepUuid, nodeId + "+eODU+XPDR2-NETWORK1", "eNodeEdgePoint_N", true);
910 checkNepNetworkODU4(inep2, inetworkNepUuid, nodeId + "+iODU+XPDR2-NETWORK1", "iNodeEdgePoint_N", false);
911 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
912 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
913 .collect(Collectors.toList());
914 checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, enetworkNepUuid, nodeUuid);
917 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
918 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
919 .sorted((nep3, nep4) -> nep3.getUuid().getValue().compareTo(nep4.getUuid().getValue()))
920 .collect(Collectors.toList());
921 assertEquals("Mux-DSR node should have 1 eNEP network", 1, enepsN.size());
922 assertEquals("Mux-DSR node should have 1 iNEP network", 1, inepsN.size());
923 assertEquals("Mux-DSR node should have 4 NEPs client", 4, nepsC.size());
924 OwnedNodeEdgePoint nep3 = nepsC.get(2);
925 Uuid client3NepUuid = new Uuid(
926 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
928 checkNepClient10G(nep3, client3NepUuid, nodeId + "+DSR+XPDR1-CLIENT3", "NodeEdgePoint_C");
930 OwnedNodeEdgePoint enep4 = enepsN.get(0);
931 OwnedNodeEdgePoint inep4 = inepsN.get(0);
932 Uuid enetworkNepUuid2 = new Uuid(
933 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
935 Uuid inetworkNepUuid2 = new Uuid(
936 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
938 checkNepNetworkODU4(enep4, enetworkNepUuid2, nodeId + "+eODU+XPDR1-NETWORK1", "eNodeEdgePoint_N", true);
939 checkNepNetworkODU4(inep4, inetworkNepUuid2, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
941 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
942 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
943 .collect(Collectors.toList());
944 checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, enetworkNepUuid2, nodeUuid);
947 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
948 .filter(n -> n.getName().containsKey(new NameKey("100G-tpdr")))
949 .sorted((nep5, nep6) -> nep5.getUuid().getValue().compareTo(nep6.getUuid().getValue()))
950 .collect(Collectors.toList());
951 assertEquals("Tpdr-DSR node should have 2 eNEPs network", 2, enepsN.size());
952 assertEquals("Tpdr-DSR node should have 2 iNEPs network", 2, inepsN.size());
953 assertEquals("Tpdr-DSR node should have 2 NEPs client", 2, nepsC.size());
954 OwnedNodeEdgePoint nep5 = nepsC.get(0);
955 Uuid client1NepUuid = new Uuid(
956 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
958 checkNepClient100GTpdr(nep5, client1NepUuid, nodeId + "+DSR+XPDR1-CLIENT1", "100G-tpdr");
960 OwnedNodeEdgePoint enep6 = enepsN.get(0);
961 OwnedNodeEdgePoint inep6 = inepsN.get(1);
962 Uuid enetworkNepUuid3 = new Uuid(
963 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
965 Uuid inetworkNepUuid3 = new Uuid(
966 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
968 checkNepNetworkODU4(enep6, enetworkNepUuid3, nodeId + "+eODU+XPDR1-NETWORK1", "eNodeEdgePoint_N", true);
969 checkNepNetworkODU4(inep6, inetworkNepUuid3, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
971 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
972 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
973 .collect(Collectors.toList());
974 checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, enetworkNepUuid3, nodeUuid);
982 private void checkOtsiNode(
983 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
984 Uuid nodeUuid, String otsiNodeType, String nodeId) {
985 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
986 List<OwnedNodeEdgePoint> nepsI = null;
987 List<OwnedNodeEdgePoint> nepsE = null;
988 List<OwnedNodeEdgePoint> nepsP = null;
989 List<OwnedNodeEdgePoint> nepsMc = null;
990 List<OwnedNodeEdgePoint> nepsOtsimc = null;
991 List<OwnedNodeEdgePoint> nepsPhot = null;
992 if (!otsiNodeType.equals("roadm")) {
993 assertEquals("incorrect node name", nodeId + "+OTSi", node.getName().get(
994 new NameKey("otsi node name")).getValue());
995 assertEquals("value-name should be 'dsr/odu node name'",
996 "otsi node name", node.nonnullName().values().stream().findFirst().get().getValueName());
997 nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
998 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
999 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1000 .collect(Collectors.toList());
1001 nepsE = node.nonnullOwnedNodeEdgePoint().values().stream()
1002 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint")))
1003 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1004 .collect(Collectors.toList());
1005 nepsP = node.nonnullOwnedNodeEdgePoint().values().stream()
1006 .filter(n -> n.getName().containsKey(new NameKey("PhotMedNodeEdgePoint")))
1007 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1008 .collect(Collectors.toList());
1010 assertEquals("incorrect node name", nodeId + "+PHOTONIC_MEDIA", node.getName().get(
1011 new NameKey("roadm node name")).getValue());
1012 assertEquals("value-name should be 'dsr/odu node name'",
1013 "roadm node name", node.nonnullName().values().stream().findFirst().get().getValueName());
1014 nepsMc = node.nonnullOwnedNodeEdgePoint().values().stream()
1015 .filter(n -> n.getName().containsKey(new NameKey("MEDIA_CHANNELNodeEdgePoint")))
1016 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1017 .collect(Collectors.toList());
1018 nepsOtsimc = node.nonnullOwnedNodeEdgePoint().values().stream()
1019 .filter(n -> n.getName().containsKey(new NameKey("OTSi_MEDIA_CHANNELNodeEdgePoint")))
1020 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1021 .collect(Collectors.toList());
1022 nepsPhot = node.nonnullOwnedNodeEdgePoint().values().stream()
1023 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIANodeEdgePoint")))
1024 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1025 .collect(Collectors.toList());
1027 assertEquals("administrative state should be UNLOCKED",
1028 AdministrativeState.UNLOCKED, node.getAdministrativeState());
1029 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
1030 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
1031 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
1032 1, node.getLayerProtocolName().size());
1033 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
1034 LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().get(0));
1036 switch (otsiNodeType) {
1038 assertEquals("Switch-OTSi node should have 4 eNEPs", 4, nepsE.size());
1039 assertEquals("Switch-OTSi node should have 4 iNEPs", 4, nepsI.size());
1040 assertEquals("Switch-OTSi node should have 4 photNEPs", 4, nepsP.size());
1041 OwnedNodeEdgePoint nep1 = nepsI.get(1);
1042 Uuid inepUuid = new Uuid(
1043 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
1045 checkNepOtsiNode(nep1, inepUuid, nodeId + "+iOTSi+XPDR2-NETWORK2", "iNodeEdgePoint", true);
1046 OwnedNodeEdgePoint nep2 = nepsE.get(0);
1047 Uuid enepUuid = new Uuid(
1048 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
1050 checkNepOtsiNode(nep2, enepUuid, nodeId + "+eOTSi+XPDR2-NETWORK2", "eNodeEdgePoint", false);
1051 OwnedNodeEdgePoint photNep = nepsP.get(1);
1052 Uuid pnepUuid = new Uuid(
1053 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2")
1054 .getBytes(Charset.forName("UTF-8"))).toString());
1055 checkNepOtsiNode(photNep, pnepUuid, nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2", "PhotMedNodeEdgePoint",
1057 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
1058 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
1059 .collect(Collectors.toList());
1060 checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
1063 assertEquals("Mux-OTSi node should have 1 eNEP", 1, nepsE.size());
1064 assertEquals("Mux-OTSi node should have 1 iNEPs", 1, nepsI.size());
1065 assertEquals("Mux-OTSi node should have 1 photNEPs", 1, nepsP.size());
1066 OwnedNodeEdgePoint nep3 = nepsE.get(0);
1067 Uuid enepUuid2 = new Uuid(
1068 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
1070 checkNepOtsiNode(nep3, enepUuid2, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
1071 OwnedNodeEdgePoint nep4 = nepsI.get(0);
1072 Uuid inepUuid2 = new Uuid(
1073 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
1075 checkNepOtsiNode(nep4, inepUuid2, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
1076 OwnedNodeEdgePoint photNep1 = nepsP.get(0);
1077 Uuid pnep1Uuid = new Uuid(
1078 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
1079 .getBytes(Charset.forName("UTF-8"))).toString());
1080 checkNepOtsiNode(photNep1, pnep1Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
1082 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
1083 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
1084 .collect(Collectors.toList());
1085 checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
1088 assertEquals("Tpdr-OTSi node should have 2 eNEPs", 2, nepsE.size());
1089 assertEquals("Tpdr-OTSi node should have 2 iNEPs", 2, nepsI.size());
1090 assertEquals("Tpdr-OTSi node should have 2 photNEPs", 2, nepsP.size());
1091 OwnedNodeEdgePoint nep5 = nepsE.get(0);
1092 Uuid enepUuid3 = new Uuid(
1093 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
1095 checkNepOtsiNode(nep5, enepUuid3, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
1096 OwnedNodeEdgePoint nep6 = nepsI.get(0);
1097 Uuid inepUuid3 = new Uuid(
1098 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
1100 checkNepOtsiNode(nep6, inepUuid3, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
1101 OwnedNodeEdgePoint photNep2 = nepsP.get(0);
1102 Uuid pnep2Uuid = new Uuid(
1103 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
1104 .getBytes(Charset.forName("UTF-8"))).toString());
1105 checkNepOtsiNode(photNep2, pnep2Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
1107 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
1108 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
1109 .collect(Collectors.toList());
1110 checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
1113 assertEquals("Roadm node should have 10 MC NEPs", 10, nepsMc.size());
1114 assertEquals("Roadm node should have 10 OTSiMC NEPs", 10, nepsOtsimc.size());
1115 assertEquals("Roadm node should have 10 PHOT_MEDIA NEPs", 10, nepsPhot.size());
1117 OwnedNodeEdgePoint nep7 = nepsMc.get(6);
1118 Uuid mcnepUuid3 = new Uuid(
1119 UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX").getBytes(Charset.forName("UTF-8")))
1121 checkNepOtsiRdmNode(nep7, mcnepUuid3, nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX",
1122 "MEDIA_CHANNELNodeEdgePoint", false);
1123 OwnedNodeEdgePoint nep8 = nepsOtsimc.get(0);
1124 Uuid otmcnepUuid3 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX")
1125 .getBytes(Charset.forName("UTF-8"))).toString());
1126 checkNepOtsiRdmNode(nep8, otmcnepUuid3, nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX",
1127 "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
1128 OwnedNodeEdgePoint photNep3 = nepsPhot.get(3);
1129 Uuid pnep3Uuid = new Uuid(
1130 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
1131 .getBytes(Charset.forName("UTF-8"))).toString());
1132 checkNepOtsiRdmNode(photNep3, pnep3Uuid, nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX",
1133 "PHOTONIC_MEDIANodeEdgePoint", false);
1135 OwnedNodeEdgePoint nep9 = nepsMc.get(0);
1136 Uuid mcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX")
1137 .getBytes(Charset.forName("UTF-8"))).toString());
1138 checkNepOtsiRdmNode(nep9, mcnepUuid4, nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX",
1139 "MEDIA_CHANNELNodeEdgePoint", true);
1140 OwnedNodeEdgePoint nep10 = nepsOtsimc.get(9);
1141 Uuid otmcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX")
1142 .getBytes(Charset.forName("UTF-8"))).toString());
1143 checkNepOtsiRdmNode(nep10, otmcnepUuid4, nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX",
1144 "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
1145 OwnedNodeEdgePoint photNep4 = nepsPhot.get(4);
1146 Uuid pnep4Uuid = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX")
1147 .getBytes(Charset.forName("UTF-8"))).toString());
1148 checkNepOtsiRdmNode(photNep4, pnep4Uuid, nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX",
1149 "PHOTONIC_MEDIANodeEdgePoint", false);
1150 List<NodeRuleGroup> nrgList4 = node.nonnullNodeRuleGroup().values().stream()
1151 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
1152 .collect(Collectors.toList());
1153 checkNodeRuleGroupForRdm(nrgList4, 30);
1161 private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1162 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1163 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1164 Name name = nameList.get(0);
1165 assertEquals("value of client nep should be '" + portName + "'",
1166 portName, name.getValue());
1167 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
1168 nepName, name.getValueName());
1169 assertEquals("Client nep should support 3 kind of cep",
1170 3, nep.getSupportedCepLayerProtocolQualifier().size());
1171 assertThat("client nep should support 3 kind of cep",
1172 nep.getSupportedCepLayerProtocolQualifier(),
1173 hasItems(ODUTYPEODU2.class, ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
1174 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
1175 checkCommonPartOfNep(nep, false);
1178 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1180 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1181 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1182 Name name = nameList.get(0);
1183 assertEquals("value of network nep should be '" + portName + "'",
1184 portName, name.getValue());
1185 assertEquals("value-name of network nep for '" + portName + "' should be '" + nepName + "'",
1186 nepName, name.getValueName());
1187 assertEquals("Network nep should support 1 kind of cep",
1188 1, nep.getSupportedCepLayerProtocolQualifier().size());
1189 assertThat("network nep should support 1 kind of cep",
1190 nep.getSupportedCepLayerProtocolQualifier(),
1191 hasItem(ODUTYPEODU4.class));
1192 assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
1193 checkCommonPartOfNep(nep, withSip);
1196 private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1198 assertEquals("transponder DSR should contain 2 node rule group", 2, nrgList.size());
1199 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1200 assertEquals("each node-rule-group should contain 2 NEP for transponder DSR",
1201 2, nodeRuleGroup.getNodeEdgePoint().size());
1203 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
1204 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
1205 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1206 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1207 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
1208 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1209 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1210 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
1211 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
1212 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
1213 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
1214 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
1215 assertEquals("node-rule-group nb 1 should contain a single rule", 1, rule.size());
1216 assertEquals("local-id of the rule should be 'forward'",
1217 "forward", rule.get(0).getLocalId());
1218 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1219 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
1220 assertEquals("the rule type should be 'FORWARDING'",
1221 RuleType.FORWARDING, rule.get(0).getRuleType());
1224 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1226 assertEquals("muxponder DSR should contain 4 node rule group", 4, nrgList.size());
1227 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1228 assertEquals("each node-rule-group should contain 2 NEP for muxponder DSR",
1229 2, nodeRuleGroup.getNodeEdgePoint().size());
1231 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
1232 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
1233 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1234 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1235 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
1236 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1237 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1238 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
1239 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
1240 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
1241 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
1242 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
1243 assertEquals("node-rule-group nb 2 should contain a single rule", 1, rule.size());
1244 assertEquals("local-id of the rule should be 'forward'",
1245 "forward", rule.get(0).getLocalId());
1246 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1247 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
1248 assertEquals("the rule type should be 'FORWARDING'",
1249 RuleType.FORWARDING, rule.get(0).getRuleType());
1252 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1254 assertEquals("Switch-DSR should contain a single node rule group", 1, nrgList.size());
1255 assertEquals("Switch-DSR node-rule-group should contain 8 NEP", 8, nrgList.get(0).getNodeEdgePoint().size());
1256 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
1257 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
1258 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
1259 .collect(Collectors.toList());
1260 assertEquals("in the sorted node-rule-group, nep number 7 should be XPDR2-NETWORK1",
1261 networkNepUuid, nrg.get(7).getNodeEdgePointUuid());
1262 assertEquals("in the sorted node-rule-group, nep number 4 should be XPDR2-CLIENT4",
1263 clientNepUuid, nrg.get(4).getNodeEdgePointUuid());
1264 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1265 nodeUuid, nrg.get(4).getNodeUuid());
1266 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1267 nodeUuid, nrg.get(3).getNodeUuid());
1269 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1270 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1271 assertEquals("local-id of the rule should be 'forward'",
1272 "forward", ruleList.get(0).getLocalId());
1273 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1274 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1275 assertEquals("the rule type should be 'FORWARDING'",
1276 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1279 private void checkNodeRuleGroupForRdm(List<NodeRuleGroup> nrgList, int nbNeps) {
1280 assertEquals("RDM infra node - OTSi should contain a single node rule groups", 1, nrgList.size());
1282 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1283 assertEquals("RDM infra node -rule-group should contain " + nbNeps + " NEP",
1284 nbNeps, nodeEdgePointList.size());
1286 assertNull("RDM infra node -rule-group should contain no NEP", nrgList.get(0).getNodeEdgePoint());
1288 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1289 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1290 assertEquals("local-id of the rule should be 'forward'",
1291 "forward", ruleList.get(0).getLocalId());
1292 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1293 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1294 assertEquals("the rule type should be 'FORWARDING'",
1295 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1298 private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1300 assertEquals("Tpdr-OTSi should contain two node rule groups", 2, nrgList.size());
1301 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1302 assertEquals("Tpdr-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1303 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1304 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1305 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1306 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1307 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1308 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1309 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1310 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1311 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1312 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1313 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1314 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1315 assertEquals("local-id of the rule should be 'forward'",
1316 "forward", ruleList.get(0).getLocalId());
1317 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1318 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1319 assertEquals("the rule type should be 'FORWARDING'",
1320 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1323 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1325 assertEquals("Mux-OTSi should contain a single node rule group", 1, nrgList.size());
1326 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1327 assertEquals("Mux-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1328 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1329 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1330 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1331 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1332 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1333 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1334 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1335 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1336 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1337 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1338 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1339 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1340 assertEquals("local-id of the rule should be 'forward'",
1341 "forward", ruleList.get(0).getLocalId());
1342 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1343 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1344 assertEquals("the rule type should be 'FORWARDING'",
1345 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1348 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1350 assertEquals("Switch-OTSi should contain 4 node rule group", 4, nrgList.size());
1351 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1352 assertEquals("each node-rule-group should contain 2 NEP for Switch-OTSi",
1353 2, nodeRuleGroup.getNodeEdgePoint().size());
1355 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
1356 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1357 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
1358 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1359 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1360 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
1361 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1362 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1363 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1364 nodeUuid, nodeEdgePointList0.get(0).getNodeUuid());
1365 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1366 nodeUuid, nodeEdgePointList0.get(1).getNodeUuid());
1367 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1368 assertEquals("node-rule-group should contain a single rule", 1, ruleList0.size());
1369 assertEquals("local-id of the rule should be 'forward'",
1370 "forward", ruleList0.get(0).getLocalId());
1371 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1372 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList0.get(0).getForwardingRule());
1373 assertEquals("the rule type should be 'FORWARDING'",
1374 RuleType.FORWARDING, ruleList0.get(0).getRuleType());
1377 private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1378 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1379 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1380 assertEquals("value of client nep should be '" + portName + "'",
1381 portName, nameList.get(0).getValue());
1382 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
1383 nepName, nameList.get(0).getValueName());
1384 assertEquals("Client nep should support 2 kind of cep",
1385 2, nep.getSupportedCepLayerProtocolQualifier().size());
1386 assertThat("client nep should support 2 kind of cep",
1387 nep.getSupportedCepLayerProtocolQualifier(),
1388 hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
1389 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
1390 checkCommonPartOfNep(nep, false);
1393 private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1394 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1395 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1396 assertEquals("value of client nep should be '" + portName + "'",
1397 portName, nameList.get(0).getValue());
1398 assertEquals("value-name of client nep for '" + portName + "' should be 100G-tpdr'",
1399 nepName, nameList.get(0).getValueName());
1400 assertEquals("Client nep should support 1 kind of cep",
1401 1, nep.getSupportedCepLayerProtocolQualifier().size());
1402 assertThat("client nep should support 2 kind of cep",
1403 nep.getSupportedCepLayerProtocolQualifier(),
1404 hasItems(DIGITALSIGNALTYPE100GigE.class));
1405 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
1406 checkCommonPartOfNep(nep, false);
1409 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1411 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1412 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1413 assertEquals("value of OTSi nep should be '" + portName + "'",
1414 portName, nameList.get(0).getValue());
1415 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1416 nepName, nameList.get(0).getValueName());
1417 assertEquals("OTSi nep should support 2 kind of cep",
1418 2, nep.getSupportedCepLayerProtocolQualifier().size());
1419 assertThat("OTSi nep should support 2 kind of cep",
1420 nep.getSupportedCepLayerProtocolQualifier(),
1421 hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
1422 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1423 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1424 checkCommonPartOfNep(nep, withSip);
1427 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1429 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1430 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1431 assertEquals("value of OTSi nep should be '" + portName + "'",
1432 portName, nameList.get(0).getValue());
1433 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1434 nepName, nameList.get(0).getValueName());
1435 assertEquals("OTSi nep of RDM infra node should support only 1 kind of cep",
1436 1, nep.getSupportedCepLayerProtocolQualifier().size());
1437 assertThat("OTSi nep should support 2 kind of cep",
1438 nep.getSupportedCepLayerProtocolQualifier(),
1439 hasItems(PHOTONICLAYERQUALIFIEROMS.class));
1440 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1441 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1442 checkCommonPartOfNep(nep, withSip);
1445 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean withSip) {
1446 assertEquals("link port direction should be DIRECTIONAL",
1447 PortDirection.BIDIRECTIONAL, nep.getLinkPortDirection());
1448 assertEquals("administrative state should be UNLOCKED",
1449 AdministrativeState.UNLOCKED, nep.getAdministrativeState());
1450 assertEquals("termination state should be TERMINATED BIDIRECTIONAL",
1451 TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState());
1452 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, nep.getLifecycleState());
1454 assertEquals("Given nep should support 1 SIP", 1, nep.getMappedServiceInterfacePoint().size());
1456 assertEquals("termination direction should be BIDIRECTIONAL",
1457 TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection());
1458 assertEquals("operational state of client nep should be ENABLED",
1459 OperationalState.ENABLED, nep.getOperationalState());
1460 assertEquals("link-port-role of client nep should be SYMMETRIC",
1461 PortRole.SYMMETRIC, nep.getLinkPortRole());
1464 private void checkTransitionalLink(org.opendaylight.yang.gen.v1
1465 .urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1466 Uuid node1Uuid, Uuid node2Uuid, String tp1, String tp2, String ietfNodeId) {
1467 Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((tp1 + "to" + tp2)
1468 .getBytes(Charset.forName("UTF-8"))).toString());
1469 assertEquals("bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2, linkUuid, link.getUuid());
1470 assertEquals("Available capacity unit should be GBPS",
1471 CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
1472 assertEquals("Available capacity -total size value should be 100",
1473 Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue());
1474 assertEquals("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1475 2, link.getTransitionedLayerProtocolName().size());
1476 assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1477 link.getTransitionedLayerProtocolName(),
1478 hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));
1479 assertEquals("transitional link should be BIDIRECTIONAL",
1480 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1481 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1482 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1483 assertEquals("topology uuid should be the same for the two termination point of the link",
1484 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1485 assertEquals("topology uuid should be the same for the two termination point of the link",
1486 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1487 assertThat("transitional links should terminate on DSR node and Photonic node",
1488 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1489 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1490 assertThat("transitional links should terminate on DSR node and Photonic node",
1491 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1492 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1493 Uuid nep1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1.getBytes(Charset.forName("UTF-8"))).toString());
1494 Uuid nep2Uuid = new Uuid(UUID.nameUUIDFromBytes(tp2.getBytes(Charset.forName("UTF-8"))).toString());
1495 assertThat("transitional links should terminate on " + tp1 + " and " + tp2 + " neps",
1496 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1497 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1498 assertThat("transitional links should terminate on DSR node and Photonic node",
1499 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1500 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1503 private void checkOtnLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1504 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1506 assertEquals("bad name for the link", linkName, link.getName().get(
1507 new NameKey("otn link name")).getValue());
1508 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1509 assertEquals("Available capacity unit should be MBPS",
1510 CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
1511 String prefix = linkName.split("-")[0];
1512 if ("OTU4".equals(prefix)) {
1513 assertEquals("Available capacity -total size value should be 0",
1514 Uint64.valueOf(0), link.getAvailableCapacity().getTotalSize().getValue());
1515 } else if ("ODU4".equals(prefix)) {
1516 assertEquals("Available capacity -total size value should be 100 000",
1517 Uint64.valueOf(100000), link.getAvailableCapacity().getTotalSize().getValue());
1519 assertEquals("Total capacity unit should be GBPS",
1520 CapacityUnit.GBPS, link.getTotalPotentialCapacity().getTotalSize().getUnit());
1521 assertEquals("Total capacity -total size value should be 100",
1522 Uint64.valueOf(100), link.getTotalPotentialCapacity().getTotalSize().getValue());
1523 if ("OTU4".equals(prefix)) {
1524 assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1525 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1526 } else if ("ODU4".equals(prefix)) {
1527 assertEquals("otn link should be between 2 nodes of protocol layers ODU",
1528 LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName());
1530 assertEquals("otn tapi link should be BIDIRECTIONAL",
1531 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1532 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1533 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1534 assertEquals("topology uuid should be the same for the two termination point of the link",
1535 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1536 assertEquals("topology uuid should be the same for the two termination point of the link",
1537 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1538 assertThat("otn links should terminate on two distinct nodes",
1539 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1540 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1541 assertThat("otn links should terminate on two distinct nodes",
1542 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1543 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1544 assertThat("otn links should terminate on two distinct tps",
1545 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1546 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1547 assertThat("otn links should terminate on two distinct tps",
1548 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1549 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1550 assertEquals("operational state should be ENABLED",
1551 OperationalState.ENABLED, link.getOperationalState());
1552 assertEquals("administrative state should be UNLOCKED",
1553 AdministrativeState.UNLOCKED, link.getAdministrativeState());
1556 private void checkOmsLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1557 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1559 assertEquals("bad name for the link", linkName, link.getName().get(
1560 new NameKey("OMS link name")).getValue());
1561 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1562 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1563 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1564 assertEquals("otn tapi link should be BIDIRECTIONAL",
1565 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1566 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1567 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1568 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
1569 assertEquals("topology uuid should be the same for the two termination point of the link",
1570 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1571 assertEquals("topology uuid should be the same for the two termination point of the link",
1572 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1573 assertThat("oms links should terminate on two distinct nodes",
1574 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1575 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1576 assertThat("oms links should terminate on two distinct nodes",
1577 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1578 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1579 assertThat("oms links should terminate on two distinct tps",
1580 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1581 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1582 assertThat("oms links should terminate on two distinct tps",
1583 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1584 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1587 private void checkXpdrRdmLink(org.opendaylight.yang.gen.v1.urn
1588 .onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1589 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1591 assertEquals("bad name for the link", linkName, link.getName().get(
1592 new NameKey("XPDR-RDM link name")).getValue());
1593 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1594 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1595 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1596 assertEquals("otn tapi link should be BIDIRECTIONAL",
1597 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1598 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1599 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1600 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
1601 assertEquals("topology uuid should be the same for the two termination point of the link",
1602 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1603 assertEquals("topology uuid should be the same for the two termination point of the link",
1604 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1605 assertThat("oms links should terminate on two distinct nodes",
1606 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1607 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1608 assertThat("oms links should terminate on two distinct nodes",
1609 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1610 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1611 assertThat("oms links should terminate on two distinct tps",
1612 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1613 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1614 assertThat("oms links should terminate on two distinct tps",
1615 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1616 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1619 private Node changeTerminationPointState(Node initialNode, String tpid, AdminStates admin, State oper) {
1620 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
1621 = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
1622 initialNode.augmentation(Node1.class));
1623 Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
1624 TerminationPointBuilder tpBldr = new TerminationPointBuilder(
1625 tps.get(new TerminationPointKey(new TpId(tpid))));
1626 tpBldr.addAugmentation(new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class))
1627 .setAdministrativeState(admin)
1628 .setOperationalState(oper)
1630 tps.replace(tpBldr.key(), tpBldr.build());
1631 tpdr1Bldr.setTerminationPoint(tps);
1632 return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();
1635 private org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1636 .ietf.network.topology.rev180226.networks.network.Link changeOtnLinkState(
1637 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1638 .Link initiallink, AdminStates admin, State oper) {
1639 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1640 .LinkBuilder linkBldr = new
1641 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1642 .LinkBuilder(initiallink);
1643 linkBldr.addAugmentation(new Link1Builder(linkBldr.augmentation(Link1.class))
1644 .setAdministrativeState(admin)
1645 .setOperationalState(oper)
1647 return linkBldr.build();