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.anyOf;
11 import static org.hamcrest.CoreMatchers.containsString;
12 import static org.hamcrest.CoreMatchers.either;
13 import static org.hamcrest.CoreMatchers.hasItem;
14 import static org.hamcrest.CoreMatchers.hasItems;
15 import static org.hamcrest.CoreMatchers.is;
16 import static org.hamcrest.MatcherAssert.assertThat;
17 import static org.junit.Assert.assertEquals;
18 import static org.junit.Assert.assertNull;
19 import static org.junit.Assert.assertTrue;
20 import static org.junit.Assert.fail;
22 import com.google.common.util.concurrent.FluentFuture;
23 import java.nio.charset.Charset;
24 import java.util.ArrayList;
25 import java.util.HashMap;
26 import java.util.List;
28 import java.util.Optional;
29 import java.util.UUID;
30 import java.util.concurrent.ExecutionException;
31 import java.util.stream.Collectors;
32 import org.eclipse.jdt.annotation.Nullable;
33 import org.junit.BeforeClass;
34 import org.junit.Test;
35 import org.opendaylight.mdsal.binding.api.DataBroker;
36 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
37 import org.opendaylight.transportpce.common.InstanceIdentifiers;
38 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
39 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
40 import org.opendaylight.transportpce.common.network.RequestProcessor;
41 import org.opendaylight.transportpce.tapi.TapiStringConstants;
42 import org.opendaylight.transportpce.tapi.utils.TapiLink;
43 import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils;
44 import org.opendaylight.transportpce.test.AbstractTest;
45 import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1Builder;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1Builder;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmLinkType;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmTpType;
54 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
55 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
56 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
57 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
58 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
59 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
60 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeBuilder;
61 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeKey;
62 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId;
63 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
64 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1;
65 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
66 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
67 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.LinkKey;
68 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
69 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointBuilder;
70 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointKey;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
79 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
80 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
81 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
82 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
83 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
84 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
85 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
86 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU0;
87 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
88 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
89 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
90 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
91 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
92 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
93 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
94 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
95 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
96 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
97 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint;
98 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
99 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
100 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
101 import org.opendaylight.yangtools.yang.common.Uint64;
102 import org.slf4j.Logger;
103 import org.slf4j.LoggerFactory;
105 public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
106 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToFullTapiTopoTest.class);
108 private static Node otnMuxA;
109 private static Node otnMuxC;
110 private static Node otnSwitch;
111 private static Node tpdr100G;
112 private static Node roadmA;
113 private static Node roadmC;
114 private static Network openroadmNet;
115 private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
116 .networks.network.Link> otnLinks;
117 private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
118 .networks.network.Link> ortopoLinks;
119 private static Uuid topologyUuid;
120 private static NetworkTransactionService networkTransactionService;
121 private static TapiLink tapiLink;
122 private static DataBroker dataBroker = getDataBroker();
125 public static void setUp() throws InterruptedException, ExecutionException {
126 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
127 TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
128 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
129 TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II);
130 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
131 TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
132 TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
133 TapiTopologyDataUtils.PORTMAPPING_FILE);
135 KeyedInstanceIdentifier<Node, NodeKey> muxAIID = InstanceIdentifier.create(Networks.class)
136 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
137 .class, new NetworkKey(new NetworkId("otn-topology")))
138 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR1")));
139 FluentFuture<Optional<Node>> muxAFuture = dataBroker.newReadOnlyTransaction()
140 .read(LogicalDatastoreType.CONFIGURATION, muxAIID);
141 otnMuxA = muxAFuture.get().get();
142 KeyedInstanceIdentifier<Node, NodeKey> muxCIID = InstanceIdentifier.create(Networks.class)
143 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
144 .class, new NetworkKey(new NetworkId("otn-topology")))
145 .child(Node.class, new NodeKey(new NodeId("SPDR-SC1-XPDR1")));
146 FluentFuture<Optional<Node>> muxCFuture = dataBroker.newReadOnlyTransaction()
147 .read(LogicalDatastoreType.CONFIGURATION, muxCIID);
148 otnMuxC = muxCFuture.get().get();
149 KeyedInstanceIdentifier<Node, NodeKey> switchIID = InstanceIdentifier.create(Networks.class)
150 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
151 .class, new NetworkKey(new NetworkId("otn-topology")))
152 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR2")));
153 FluentFuture<Optional<Node>> switchFuture = dataBroker.newReadOnlyTransaction()
154 .read(LogicalDatastoreType.CONFIGURATION, switchIID);
155 otnSwitch = switchFuture.get().get();
156 KeyedInstanceIdentifier<Node, NodeKey> roadmaIID = InstanceIdentifier.create(Networks.class)
157 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
158 .class, new NetworkKey(new NetworkId("openroadm-network")))
159 .child(Node.class, new NodeKey(new NodeId("ROADM-A1")));
160 FluentFuture<Optional<Node>> roadmaFuture = dataBroker.newReadOnlyTransaction()
161 .read(LogicalDatastoreType.CONFIGURATION, roadmaIID);
162 roadmA = roadmaFuture.get().get();
163 KeyedInstanceIdentifier<Node, NodeKey> roadmcIID = InstanceIdentifier.create(Networks.class)
164 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
165 .class, new NetworkKey(new NetworkId("openroadm-network")))
166 .child(Node.class, new NodeKey(new NodeId("ROADM-C1")));
167 FluentFuture<Optional<Node>> roadmcFuture = dataBroker.newReadOnlyTransaction()
168 .read(LogicalDatastoreType.CONFIGURATION, roadmcIID);
169 roadmC = roadmcFuture.get().get();
171 KeyedInstanceIdentifier<Node, NodeKey> tpdrIID = InstanceIdentifier.create(Networks.class)
172 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
173 .class, new NetworkKey(new NetworkId("otn-topology")))
174 .child(Node.class, new NodeKey(new NodeId("XPDR-A1-XPDR1")));
175 FluentFuture<Optional<Node>> tpdrFuture = dataBroker.newReadOnlyTransaction()
176 .read(LogicalDatastoreType.CONFIGURATION, tpdrIID);
177 tpdr100G = tpdrFuture.get().get();
179 InstanceIdentifier<Network1> linksIID = InstanceIdentifier.create(Networks.class)
180 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
181 .class, new NetworkKey(new NetworkId("otn-topology")))
182 .augmentation(Network1.class);
183 FluentFuture<Optional<Network1>> linksFuture = dataBroker.newReadOnlyTransaction()
184 .read(LogicalDatastoreType.CONFIGURATION, linksIID);
185 otnLinks = linksFuture.get().get().getLink();
187 InstanceIdentifier<Network1> links1IID = InstanceIdentifier.create(Networks.class)
188 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
189 .class, new NetworkKey(new NetworkId("openroadm-topology")))
190 .augmentation(Network1.class);
191 FluentFuture<Optional<Network1>> links1Future = dataBroker.newReadOnlyTransaction()
192 .read(LogicalDatastoreType.CONFIGURATION, links1IID);
193 ortopoLinks = links1Future.get().get().getLink();
195 InstanceIdentifier<Network> ortopo1IID = InstanceIdentifier.create(Networks.class)
196 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
197 .class, new NetworkKey(new NetworkId("openroadm-topology")));
198 FluentFuture<Optional<Network>> ortopoFuture = dataBroker.newReadOnlyTransaction()
199 .read(LogicalDatastoreType.CONFIGURATION, ortopo1IID);
200 openroadmNet = ortopoFuture.get().get();
202 topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
203 Charset.forName("UTF-8"))).toString());
204 networkTransactionService = new NetworkTransactionImpl(
205 new RequestProcessor(getDataStoreContextUtil().getDataBroker()));
206 tapiLink = new TapiLink(networkTransactionService);
207 LOG.info("TEST SETUP READY");
211 public void convertNodeWhenNoStates() {
212 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1", null, null);
213 List<String> networkPortList = new ArrayList<>();
214 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
215 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
216 networkPortList.add(tp.getTpId().getValue());
219 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
220 tapiFactory.convertNode(tpdr, networkPortList);
222 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
224 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
225 .getTapiNodes().get(new
226 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
227 Uuid enetworkNepUuid = new Uuid(
228 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
230 Uuid inetworkNepUuid = new Uuid(
231 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
233 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
234 assertNull("Administrative State should not be present", enepN.getAdministrativeState());
235 assertNull("Operational State should not be present", enepN.getOperationalState());
237 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
238 assertNull("Administrative State should not be present", inepN.getAdministrativeState());
239 assertNull("Operational State should not be present", inepN.getOperationalState());
241 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
243 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
244 .getTapiNodes().get(new
245 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
246 Uuid enepUuid = new Uuid(
247 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
249 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
250 assertNull("Administrative State should not be present", enep.getAdministrativeState());
251 assertNull("Operational State should not be present", enep.getOperationalState());
253 Uuid inepUuid = new Uuid(
254 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
256 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
257 assertNull("Administrative State should not be present", inep.getAdministrativeState());
258 assertNull("Operational State should not be present", inep.getOperationalState());
260 Uuid photnepUuid = new Uuid(
261 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
263 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
264 assertNull("Administrative State should not be present", photnep.getAdministrativeState());
265 assertNull("Operational State should not be present", photnep.getOperationalState());
269 public void convertNodeWhenBadStates1() {
270 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
271 AdminStates.OutOfService, State.OutOfService);
272 List<String> networkPortList = new ArrayList<>();
273 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
274 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
275 networkPortList.add(tp.getTpId().getValue());
278 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
279 tapiFactory.convertNode(tpdr, networkPortList);
281 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
283 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
284 .getTapiNodes().get(new
285 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
286 Uuid enetworkNepUuid = new Uuid(
287 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
289 Uuid inetworkNepUuid = new Uuid(
290 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
292 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
293 assertEquals("Administrative State should be Locked",
294 AdministrativeState.LOCKED, enepN.getAdministrativeState());
295 assertEquals("Operational State should be Disabled",
296 OperationalState.DISABLED, enepN.getOperationalState());
298 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
299 assertEquals("Administrative State should be Locked",
300 AdministrativeState.LOCKED, inepN.getAdministrativeState());
301 assertEquals("Operational State should be Disabled",
302 OperationalState.DISABLED, inepN.getOperationalState());
304 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
306 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
307 .getTapiNodes().get(new
308 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
309 Uuid enepUuid = new Uuid(
310 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
312 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
313 assertEquals("Administrative State should be Locked",
314 AdministrativeState.LOCKED, enep.getAdministrativeState());
315 assertEquals("Operational State should be Disabled",
316 OperationalState.DISABLED, enep.getOperationalState());
318 Uuid inepUuid = new Uuid(
319 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
321 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
322 assertEquals("Administrative State should be Locked",
323 AdministrativeState.LOCKED, inep.getAdministrativeState());
324 assertEquals("Operational State should be Disabled",
325 OperationalState.DISABLED, inep.getOperationalState());
327 Uuid photnepUuid = new Uuid(
328 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
330 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
331 assertEquals("Administrative State should be Locked",
332 AdministrativeState.LOCKED, photnep.getAdministrativeState());
333 assertEquals("Operational State should be Disabled",
334 OperationalState.DISABLED, photnep.getOperationalState());
338 public void convertNodeWhenBadStates2() {
339 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
340 AdminStates.Maintenance, State.Degraded);
341 List<String> networkPortList = new ArrayList<>();
342 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
343 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
344 networkPortList.add(tp.getTpId().getValue());
347 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
348 tapiFactory.convertNode(tpdr, networkPortList);
350 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
352 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
353 .getTapiNodes().get(new
354 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
355 Uuid enetworkNepUuid = new Uuid(
356 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
358 Uuid inetworkNepUuid = new Uuid(
359 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
361 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
362 assertEquals("Administrative State should be Locked",
363 AdministrativeState.LOCKED, enepN.getAdministrativeState());
364 assertEquals("Operational State should be Disabled",
365 OperationalState.DISABLED, enepN.getOperationalState());
367 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
368 assertEquals("Administrative State should be Locked",
369 AdministrativeState.LOCKED, inepN.getAdministrativeState());
370 assertEquals("Operational State should be Disabled",
371 OperationalState.DISABLED, inepN.getOperationalState());
373 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
375 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
376 .getTapiNodes().get(new
377 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
378 Uuid enepUuid = new Uuid(
379 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
381 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
382 assertEquals("Administrative State should be Locked",
383 AdministrativeState.LOCKED, enep.getAdministrativeState());
384 assertEquals("Operational State should be Disabled",
385 OperationalState.DISABLED, enep.getOperationalState());
387 Uuid inepUuid = new Uuid(
388 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
390 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
391 assertEquals("Administrative State should be Locked",
392 AdministrativeState.LOCKED, inep.getAdministrativeState());
393 assertEquals("Operational State should be Disabled",
394 OperationalState.DISABLED, inep.getOperationalState());
396 Uuid photnepUuid = new Uuid(
397 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
399 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
400 assertEquals("Administrative State should be Locked",
401 AdministrativeState.LOCKED, photnep.getAdministrativeState());
402 assertEquals("Operational State should be Disabled",
403 OperationalState.DISABLED, photnep.getOperationalState());
407 public void convertOtnLinkWhenNoState() {
408 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
409 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
410 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
411 link = changeOtnLinkState(otnLinks.get(new LinkKey(
412 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), null, null);
413 otnLinksAlt.replace(link.key(), link);
415 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
416 List<String> networkPortListA = new ArrayList<>();
417 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
418 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
419 networkPortListA.add(tp.getTpId().getValue());
422 tapiFactory.convertNode(otnMuxA, networkPortListA);
423 List<String> networkPortListC = new ArrayList<>();
424 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
425 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
426 networkPortListC.add(tp.getTpId().getValue());
429 tapiFactory.convertNode(otnMuxC, networkPortListC);
430 tapiFactory.convertLinks(otnLinksAlt);
432 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
433 = tapiFactory.getTapiLinks().values().stream()
434 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
435 .collect(Collectors.toList());
436 assertNull("Administrative State should not be present", tapiLinks.get(3).getAdministrativeState());
437 assertEquals("Administrative state should be UNLOCKED",
438 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
439 assertNull("Operational State should not be present", tapiLinks.get(3).getOperationalState());
440 assertEquals("Operational state should be ENABLED",
441 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
445 public void convertOtnLinkWhenNoStateOnOppositeLink() {
446 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
447 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
448 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
449 link = changeOtnLinkState(otnLinks.get(new LinkKey(
450 new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))), null, null);
451 otnLinksAlt.replace(link.key(), link);
453 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
454 List<String> networkPortListA = new ArrayList<>();
455 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
456 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
457 networkPortListA.add(tp.getTpId().getValue());
460 tapiFactory.convertNode(otnMuxA, networkPortListA);
461 List<String> networkPortListC = new ArrayList<>();
462 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
463 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
464 networkPortListC.add(tp.getTpId().getValue());
467 tapiFactory.convertNode(otnMuxC, networkPortListC);
468 tapiFactory.convertLinks(otnLinksAlt);
470 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
471 = tapiFactory.getTapiLinks().values().stream()
472 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
473 .collect(Collectors.toList());
474 assertNull("Administrative State should not be present", tapiLinks.get(3).getAdministrativeState());
475 assertEquals("Administrative state should be UNLOCKED",
476 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
477 assertNull("Operational State should not be present", tapiLinks.get(3).getOperationalState());
478 assertEquals("Operational state should be ENABLED",
479 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
483 public void convertOtnLinkWhenBadState1() {
484 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
485 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
486 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
487 link = changeOtnLinkState(otnLinks.get(new LinkKey(
488 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
489 AdminStates.OutOfService, State.OutOfService);
490 otnLinksAlt.replace(link.key(), link);
492 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
493 List<String> networkPortListA = new ArrayList<>();
494 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
495 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
496 networkPortListA.add(tp.getTpId().getValue());
499 tapiFactory.convertNode(otnMuxA, networkPortListA);
500 List<String> networkPortListC = new ArrayList<>();
501 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
502 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
503 networkPortListC.add(tp.getTpId().getValue());
506 tapiFactory.convertNode(otnMuxC, networkPortListC);
507 tapiFactory.convertLinks(otnLinksAlt);
509 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
510 = tapiFactory.getTapiLinks().values().stream()
511 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
512 .collect(Collectors.toList());
513 assertEquals("Administrative state should be LOCKED",
514 AdministrativeState.LOCKED, tapiLinks.get(3).getAdministrativeState());
515 assertEquals("Administrative state should be UNLOCKED",
516 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
517 assertEquals("Operational state should be DISABLED",
518 OperationalState.DISABLED, tapiLinks.get(3).getOperationalState());
519 assertEquals("Operational state should be ENABLED",
520 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
524 public void convertOtnLinkWhenBadState2() {
525 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
526 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
527 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
528 link = changeOtnLinkState(otnLinks.get(new LinkKey(
529 new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
530 AdminStates.Maintenance, State.Degraded);
531 otnLinksAlt.replace(link.key(), link);
533 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
534 List<String> networkPortListA = new ArrayList<>();
535 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
536 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
537 networkPortListA.add(tp.getTpId().getValue());
540 tapiFactory.convertNode(otnMuxA, networkPortListA);
541 List<String> networkPortListC = new ArrayList<>();
542 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
543 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
544 networkPortListC.add(tp.getTpId().getValue());
547 tapiFactory.convertNode(otnMuxC, networkPortListC);
548 tapiFactory.convertLinks(otnLinksAlt);
550 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
551 = tapiFactory.getTapiLinks().values().stream()
552 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
553 .collect(Collectors.toList());
554 assertEquals("Administrative state should be LOCKED",
555 AdministrativeState.LOCKED, tapiLinks.get(3).getAdministrativeState());
556 assertEquals("Administrative state should be UNLOCKED",
557 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
558 assertEquals("Operational state should be DISABLED",
559 OperationalState.DISABLED, tapiLinks.get(3).getOperationalState());
560 assertEquals("Operational state should be ENABLED",
561 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
565 public void convertOtnLinkWhenBadStateOnOppositeLink() {
566 HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
567 .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
568 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
569 link = changeOtnLinkState(otnLinks.get(new LinkKey(
570 new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))),
571 AdminStates.OutOfService, State.OutOfService);
572 otnLinksAlt.replace(link.key(), link);
574 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
575 List<String> networkPortListA = new ArrayList<>();
576 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
577 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
578 networkPortListA.add(tp.getTpId().getValue());
581 tapiFactory.convertNode(otnMuxA, networkPortListA);
582 List<String> networkPortListC = new ArrayList<>();
583 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
584 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
585 networkPortListC.add(tp.getTpId().getValue());
588 tapiFactory.convertNode(otnMuxC, networkPortListC);
589 tapiFactory.convertLinks(otnLinksAlt);
591 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
592 = tapiFactory.getTapiLinks().values().stream()
593 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
594 .collect(Collectors.toList());
595 assertEquals("Administrative state should be LOCKED",
596 AdministrativeState.LOCKED, tapiLinks.get(3).getAdministrativeState());
597 assertEquals("Administrative state should be UNLOCKED",
598 AdministrativeState.UNLOCKED, tapiLinks.get(0).getAdministrativeState());
599 assertEquals("Operational state should be DISABLED",
600 OperationalState.DISABLED, tapiLinks.get(3).getOperationalState());
601 assertEquals("Operational state should be ENABLED",
602 OperationalState.ENABLED, tapiLinks.get(0).getOperationalState());
606 public void convertNodeForTransponder100G() {
607 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
608 List<String> networkPortList = new ArrayList<>();
609 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
610 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
611 networkPortList.add(tp.getTpId().getValue());
614 tapiFactory.convertNode(tpdr100G, networkPortList);
615 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
616 = tapiFactory.getTapiNodes().values().stream()
617 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
618 .collect(Collectors.toList());
620 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
621 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
623 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
625 checkDsrNode(tapiNodes.get(1), dsrNodeUuid, "tpdr", "XPDR-A1-XPDR1");
626 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
628 checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "tpdr", "XPDR-A1-XPDR1");
630 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
631 = tapiFactory.getTapiLinks().values().stream()
632 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
633 .collect(Collectors.toList());
634 checkTransitionalLink(tapiLinks.get(1), dsrNodeUuid, otsiNodeUuid,
635 "XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1", "XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1", "XPDR-A1-XPDR1");
639 public void convertNodeForOtnMuxponder() {
640 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
641 List<String> networkPortList = new ArrayList<>();
642 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
643 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
644 networkPortList.add(tp.getTpId().getValue());
647 tapiFactory.convertNode(otnMuxA, networkPortList);
648 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
649 = tapiFactory.getTapiNodes().values().stream()
650 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
651 .collect(Collectors.toList());
653 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
654 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
655 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
657 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "mux", "SPDR-SA1-XPDR1");
658 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
660 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "mux", "SPDR-SA1-XPDR1");
662 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
663 = tapiFactory.getTapiLinks().values().stream()
664 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
665 .collect(Collectors.toList());
666 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
667 "SPDR-SA1-XPDR1+iODU+XPDR1-NETWORK1", "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1", "SPDR-SA1-XPDR1");
671 public void convertNodeForOtnSwitch() {
672 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
673 List<String> networkPortList = new ArrayList<>();
674 for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
675 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
676 networkPortList.add(tp.getTpId().getValue());
679 tapiFactory.convertNode(otnSwitch, networkPortList);
680 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
681 = tapiFactory.getTapiNodes().values().stream()
682 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
683 .collect(Collectors.toList());
685 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
686 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
688 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+DSR".getBytes(Charset.forName("UTF-8")))
690 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "switch", "SPDR-SA1-XPDR2");
691 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+OTSi".getBytes(Charset.forName("UTF-8")))
693 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "switch", "SPDR-SA1-XPDR2");
695 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
696 = tapiFactory.getTapiLinks().values().stream()
697 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
698 .collect(Collectors.toList());
699 checkTransitionalLink(tapiLinks.get(2), dsrNodeUuid, otsiNodeUuid,
700 "SPDR-SA1-XPDR2+iODU+XPDR2-NETWORK4", "SPDR-SA1-XPDR2+iOTSi+XPDR2-NETWORK4", "SPDR-SA1-XPDR2");
704 public void convertOtnLink() {
705 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
706 List<String> networkPortListA = new ArrayList<>();
707 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
708 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
709 networkPortListA.add(tp.getTpId().getValue());
712 tapiFactory.convertNode(otnMuxA, networkPortListA);
713 List<String> networkPortListC = new ArrayList<>();
714 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
715 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
716 networkPortListC.add(tp.getTpId().getValue());
719 tapiFactory.convertNode(otnMuxC, networkPortListC);
720 tapiFactory.convertLinks(otnLinks);
721 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
723 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
725 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
727 Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
729 Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
731 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1"
732 .getBytes(Charset.forName("UTF-8"))).toString());
733 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"
734 .getBytes(Charset.forName("UTF-8"))).toString());
735 Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1"
736 .getBytes(Charset.forName("UTF-8"))).toString());
737 Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
738 .getBytes(Charset.forName("UTF-8"))).toString());
740 new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1toSPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"
741 .getBytes(Charset.forName("UTF-8"))).toString());
743 new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
744 .getBytes(Charset.forName("UTF-8"))).toString());
746 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
747 = tapiFactory.getTapiLinks().values().stream()
748 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
749 .collect(Collectors.toList());
750 checkOtnLink(links.get(3), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid,
751 "SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1toSPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1");
752 checkOtnLink(links.get(2), node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid,
753 "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1");
757 public void convertNodeForRoadmWhenNoOtnMuxAttached() {
758 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
759 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
761 assertEquals("Node list size should be 1", 1, tapiFactory.getTapiNodes().size());
762 assertEquals("Link list size should be empty", 0, tapiFactory.getTapiLinks().size());
763 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
764 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
765 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
766 .getBytes(Charset.forName("UTF-8"))).toString());
767 checkOtsiNode(tapiNodes.get(0), roadmNodeUuid, "roadm", "ROADM-A1");
771 public void convertNodeForRoadmWhenRoadmNeighborAttached() {
772 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
773 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
774 tapiFactory.convertRoadmNode(roadmC, openroadmNet);
776 List<Link> rdmTordmLinkList = ortopoLinks.values().stream()
777 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
778 .collect(Collectors.toList());
779 tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
781 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
782 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
784 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
785 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
786 Uuid roadmaNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
787 .getBytes(Charset.forName("UTF-8"))).toString());
788 checkOtsiNode(tapiNodes.get(1), roadmaNodeUuid, "roadm", "ROADM-A1");
790 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
791 = tapiFactory.getTapiLinks().values().stream()
792 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
793 .collect(Collectors.toList());
794 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
796 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-C1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
798 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
799 .getBytes(Charset.forName("UTF-8"))).toString());
800 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
801 .getBytes(Charset.forName("UTF-8"))).toString());
803 new Uuid(UUID.nameUUIDFromBytes(
804 "ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
805 .getBytes(Charset.forName("UTF-8"))).toString());
806 checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
807 "ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX");
811 public void convertNodeForRoadmWhenOtnMuxAttached() {
812 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
813 List<String> networkPortListA = new ArrayList<>();
814 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
815 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
816 networkPortListA.add(tp.getTpId().getValue());
819 tapiFactory.convertNode(otnMuxA, networkPortListA);
820 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
821 List<Link> xponderOutLinkList = ortopoLinks.values().stream()
822 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
823 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
824 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
825 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
826 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
827 .collect(Collectors.toList());
828 List<Link> xponderInLinkList = ortopoLinks.values().stream()
829 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
830 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
831 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
832 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
833 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
834 .collect(Collectors.toList());
835 xponderInLinkList.addAll(xponderOutLinkList);
836 tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
837 assertEquals("Node list size should be 3", 3, tapiFactory.getTapiNodes().size());
838 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
839 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
840 = tapiFactory.getTapiNodes().values().stream()
841 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
842 .collect(Collectors.toList());
843 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
844 .getBytes(Charset.forName("UTF-8"))).toString());
845 checkOtsiNode(tapiNodes.get(1), roadmNodeUuid, "roadm", "ROADM-A1");
847 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
848 = tapiFactory.getTapiLinks().values().stream()
849 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
850 .collect(Collectors.toList());
851 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
853 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
855 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
856 .getBytes(Charset.forName("UTF-8"))).toString());
857 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRX")
858 .getBytes(Charset.forName("UTF-8"))).toString());
860 new Uuid(UUID.nameUUIDFromBytes(
861 "ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
862 .getBytes(Charset.forName("UTF-8"))).toString());
863 checkXpdrRdmLink(links.get(1), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
864 "ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1");
867 private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
868 Uuid nodeUuid, String dsrNodeType, String nodeId) {
869 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
870 assertEquals("incorrect node name", nodeId + "+DSR", node.getName().get(
871 new NameKey("dsr/odu node name")).getValue());
872 assertEquals("administrative state should be UNLOCKED",
873 AdministrativeState.UNLOCKED, node.getAdministrativeState());
874 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
875 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
876 assertEquals("value-name should be 'dsr/odu node name'",
877 "dsr/odu node name", node.nonnullName().values().stream().findFirst().get().getValueName());
878 assertEquals("dsr node should manage 2 protocol layers : dsr and odu",
879 2, node.getLayerProtocolName().size());
880 assertThat("dsr node should manage 2 protocol layers : dsr and odu",
881 node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
882 List<OwnedNodeEdgePoint> inepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
883 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint_N")))
884 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
885 .collect(Collectors.toList());
886 List<OwnedNodeEdgePoint> enepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
887 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint_N")))
888 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
889 .collect(Collectors.toList());
890 List<OwnedNodeEdgePoint> nepsC;
891 switch (dsrNodeType) {
893 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
894 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
895 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
896 .collect(Collectors.toList());
897 assertEquals("Switch-DSR node should have 4 eNEPs network", 4, enepsN.size());
898 assertEquals("Switch-DSR node should have 4 iNEPs network", 4, inepsN.size());
899 assertEquals("Switch-DSR node should have 4 NEPs client", 4, nepsC.size());
900 OwnedNodeEdgePoint nep1 = nepsC.get(2);
901 Uuid client4NepUuid = new Uuid(
902 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
904 checkNepClient100GSwitch(nep1, client4NepUuid, nodeId + "+DSR+XPDR2-CLIENT4", "NodeEdgePoint_C");
905 OwnedNodeEdgePoint enep2 = enepsN.get(2);
906 OwnedNodeEdgePoint inep2 = inepsN.get(3);
907 Uuid enetworkNepUuid = new Uuid(
908 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
910 Uuid inetworkNepUuid = new Uuid(
911 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
913 checkNepeODU4(enep2, enetworkNepUuid, nodeId + "+eODU+XPDR2-CLIENT4", "eNodeEdgePoint_N", false);
914 checkNepNetworkODU4(inep2, inetworkNepUuid, nodeId + "+iODU+XPDR2-NETWORK1", "iNodeEdgePoint_N", true);
915 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
916 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
917 .collect(Collectors.toList());
918 checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, enetworkNepUuid, nodeUuid);
921 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
922 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
923 .sorted((nep3, nep4) -> nep3.getUuid().getValue().compareTo(nep4.getUuid().getValue()))
924 .collect(Collectors.toList());
925 assertEquals("Mux-DSR node should have 4 eNEP network", 4, enepsN.size());
926 assertEquals("Mux-DSR node should have 1 iNEP network", 1, inepsN.size());
927 assertEquals("Mux-DSR node should have 4 NEPs client", 4, nepsC.size());
928 OwnedNodeEdgePoint nep3 = nepsC.get(2);
929 Uuid client3NepUuid = new Uuid(
930 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
932 checkNepClient10G(nep3, client3NepUuid, nodeId + "+DSR+XPDR1-CLIENT3", "NodeEdgePoint_C");
933 OwnedNodeEdgePoint enep4 = enepsN.get(3);
934 OwnedNodeEdgePoint inep4 = inepsN.get(0);
935 Uuid enetworkNepUuid2 = new Uuid(
936 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
938 Uuid inetworkNepUuid2 = new Uuid(
939 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
941 checkNepeODU4(enep4, enetworkNepUuid2, nodeId + "+eODU+XPDR1-CLIENT3", "eNodeEdgePoint_N", false);
942 checkNepNetworkODU4(inep4, inetworkNepUuid2, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
944 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
945 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
946 .collect(Collectors.toList());
947 checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, enetworkNepUuid2, nodeUuid);
950 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
951 .filter(n -> n.getName().containsKey(new NameKey("100G-tpdr")))
952 .sorted((nep5, nep6) -> nep5.getUuid().getValue().compareTo(nep6.getUuid().getValue()))
953 .collect(Collectors.toList());
954 assertEquals("Tpdr-DSR node should have 2 eNEPs network", 2, enepsN.size());
955 assertEquals("Tpdr-DSR node should have 2 iNEPs network", 2, inepsN.size());
956 assertEquals("Tpdr-DSR node should have 2 NEPs client", 2, nepsC.size());
957 OwnedNodeEdgePoint nep5 = nepsC.get(0);
958 Uuid client1NepUuid = new Uuid(
959 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
961 checkNepClient100GTpdr(nep5, client1NepUuid, nodeId + "+DSR+XPDR1-CLIENT1", "100G-tpdr");
962 OwnedNodeEdgePoint enep6 = enepsN.get(0);
963 OwnedNodeEdgePoint inep6 = inepsN.get(1);
964 Uuid enetworkNepUuid3 = new Uuid(
965 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
967 Uuid inetworkNepUuid3 = new Uuid(
968 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
970 checkNepeODU4(enep6, enetworkNepUuid3, nodeId + "+eODU+XPDR1-CLIENT1", "eNodeEdgePoint_N", false);
971 checkNepNetworkODU4(inep6, inetworkNepUuid3, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
973 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
974 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
975 .collect(Collectors.toList());
976 checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, enetworkNepUuid3, nodeUuid);
984 private void checkOtsiNode(
985 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
986 Uuid nodeUuid, String otsiNodeType, String nodeId) {
987 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
988 List<OwnedNodeEdgePoint> nepsI = null;
989 List<OwnedNodeEdgePoint> nepsE = null;
990 List<OwnedNodeEdgePoint> nepsP = null;
991 List<OwnedNodeEdgePoint> nepsMc = null;
992 List<OwnedNodeEdgePoint> nepsOtsimc = null;
993 List<OwnedNodeEdgePoint> nepsPhot = null;
994 if (!otsiNodeType.equals("roadm")) {
995 assertEquals("incorrect node name", nodeId + "+OTSi", node.getName().get(
996 new NameKey("otsi node name")).getValue());
997 assertEquals("value-name should be 'dsr/odu node name'",
998 "otsi node name", node.nonnullName().values().stream().findFirst().get().getValueName());
999 nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
1000 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
1001 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1002 .collect(Collectors.toList());
1003 nepsE = node.nonnullOwnedNodeEdgePoint().values().stream()
1004 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint")))
1005 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1006 .collect(Collectors.toList());
1007 nepsP = node.nonnullOwnedNodeEdgePoint().values().stream()
1008 .filter(n -> n.getName().containsKey(new NameKey("PhotMedNodeEdgePoint")))
1009 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1010 .collect(Collectors.toList());
1012 assertEquals("incorrect node name", nodeId + "+PHOTONIC_MEDIA", node.getName().get(
1013 new NameKey("roadm node name")).getValue());
1014 assertEquals("value-name should be 'dsr/odu node name'",
1015 "roadm node name", node.nonnullName().values().stream().findFirst().get().getValueName());
1016 nepsMc = node.nonnullOwnedNodeEdgePoint().values().stream()
1017 .filter(n -> n.getName().containsKey(new NameKey("MEDIA_CHANNELNodeEdgePoint")))
1018 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1019 .collect(Collectors.toList());
1020 nepsOtsimc = node.nonnullOwnedNodeEdgePoint().values().stream()
1021 .filter(n -> n.getName().containsKey(new NameKey("OTSi_MEDIA_CHANNELNodeEdgePoint")))
1022 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1023 .collect(Collectors.toList());
1024 nepsPhot = node.nonnullOwnedNodeEdgePoint().values().stream()
1025 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIANodeEdgePoint")))
1026 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
1027 .collect(Collectors.toList());
1029 assertEquals("administrative state should be UNLOCKED",
1030 AdministrativeState.UNLOCKED, node.getAdministrativeState());
1031 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
1032 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
1033 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
1034 1, node.getLayerProtocolName().size());
1035 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
1036 LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().get(0));
1038 switch (otsiNodeType) {
1040 assertEquals("Switch-OTSi node should have 4 eNEPs", 4, nepsE.size());
1041 assertEquals("Switch-OTSi node should have 4 iNEPs", 4, nepsI.size());
1042 assertEquals("Switch-OTSi node should have 4 photNEPs", 4, nepsP.size());
1043 OwnedNodeEdgePoint nep1 = nepsI.get(1);
1044 Uuid inepUuid = new Uuid(
1045 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
1047 checkNepOtsiNode(nep1, inepUuid, nodeId + "+iOTSi+XPDR2-NETWORK2", "iNodeEdgePoint", true);
1048 OwnedNodeEdgePoint nep2 = nepsE.get(0);
1049 Uuid enepUuid = new Uuid(
1050 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
1052 checkNepOtsiNode(nep2, enepUuid, nodeId + "+eOTSi+XPDR2-NETWORK2", "eNodeEdgePoint", false);
1053 OwnedNodeEdgePoint photNep = nepsP.get(1);
1054 Uuid pnepUuid = new Uuid(
1055 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2")
1056 .getBytes(Charset.forName("UTF-8"))).toString());
1057 checkNepOtsiNode(photNep, pnepUuid, nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2", "PhotMedNodeEdgePoint",
1059 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
1060 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
1061 .collect(Collectors.toList());
1062 checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
1065 assertEquals("Mux-OTSi node should have 1 eNEP", 1, nepsE.size());
1066 assertEquals("Mux-OTSi node should have 1 iNEPs", 1, nepsI.size());
1067 assertEquals("Mux-OTSi node should have 1 photNEPs", 1, nepsP.size());
1068 OwnedNodeEdgePoint nep3 = nepsE.get(0);
1069 Uuid enepUuid2 = new Uuid(
1070 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
1072 checkNepOtsiNode(nep3, enepUuid2, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
1073 OwnedNodeEdgePoint nep4 = nepsI.get(0);
1074 Uuid inepUuid2 = new Uuid(
1075 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
1077 checkNepOtsiNode(nep4, inepUuid2, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
1078 OwnedNodeEdgePoint photNep1 = nepsP.get(0);
1079 Uuid pnep1Uuid = new Uuid(
1080 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
1081 .getBytes(Charset.forName("UTF-8"))).toString());
1082 checkNepOtsiNode(photNep1, pnep1Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
1084 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
1085 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
1086 .collect(Collectors.toList());
1087 checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
1090 assertEquals("Tpdr-OTSi node should have 2 eNEPs", 2, nepsE.size());
1091 assertEquals("Tpdr-OTSi node should have 2 iNEPs", 2, nepsI.size());
1092 assertEquals("Tpdr-OTSi node should have 2 photNEPs", 2, nepsP.size());
1093 OwnedNodeEdgePoint nep5 = nepsE.get(0);
1094 Uuid enepUuid3 = new Uuid(
1095 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
1097 checkNepOtsiNode(nep5, enepUuid3, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
1098 OwnedNodeEdgePoint nep6 = nepsI.get(0);
1099 Uuid inepUuid3 = new Uuid(
1100 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
1102 checkNepOtsiNode(nep6, inepUuid3, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
1103 OwnedNodeEdgePoint photNep2 = nepsP.get(0);
1104 Uuid pnep2Uuid = new Uuid(
1105 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
1106 .getBytes(Charset.forName("UTF-8"))).toString());
1107 checkNepOtsiNode(photNep2, pnep2Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
1109 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
1110 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
1111 .collect(Collectors.toList());
1112 checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
1115 assertEquals("Roadm node should have 10 MC NEPs", 10, nepsMc.size());
1116 assertEquals("Roadm node should have 10 OTSiMC NEPs", 10, nepsOtsimc.size());
1117 assertEquals("Roadm node should have 10 PHOT_MEDIA NEPs", 10, nepsPhot.size());
1119 OwnedNodeEdgePoint nep7 = nepsMc.get(6);
1120 Uuid mcnepUuid3 = new Uuid(
1121 UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX").getBytes(Charset.forName("UTF-8")))
1123 checkNepOtsiRdmNode(nep7, mcnepUuid3, nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX",
1124 "MEDIA_CHANNELNodeEdgePoint", false);
1125 OwnedNodeEdgePoint nep8 = nepsOtsimc.get(0);
1126 Uuid otmcnepUuid3 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX")
1127 .getBytes(Charset.forName("UTF-8"))).toString());
1128 checkNepOtsiRdmNode(nep8, otmcnepUuid3, nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX",
1129 "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
1130 OwnedNodeEdgePoint photNep3 = nepsPhot.get(3);
1131 Uuid pnep3Uuid = new Uuid(
1132 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
1133 .getBytes(Charset.forName("UTF-8"))).toString());
1134 checkNepOtsiRdmNode(photNep3, pnep3Uuid, nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX",
1135 "PHOTONIC_MEDIANodeEdgePoint", false);
1137 OwnedNodeEdgePoint nep9 = nepsMc.get(0);
1138 Uuid mcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX")
1139 .getBytes(Charset.forName("UTF-8"))).toString());
1140 checkNepOtsiRdmNode(nep9, mcnepUuid4, nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX",
1141 "MEDIA_CHANNELNodeEdgePoint", true);
1142 OwnedNodeEdgePoint nep10 = nepsOtsimc.get(9);
1143 Uuid otmcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX")
1144 .getBytes(Charset.forName("UTF-8"))).toString());
1145 checkNepOtsiRdmNode(nep10, otmcnepUuid4, nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX",
1146 "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
1147 OwnedNodeEdgePoint photNep4 = nepsPhot.get(4);
1148 Uuid pnep4Uuid = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX")
1149 .getBytes(Charset.forName("UTF-8"))).toString());
1150 checkNepOtsiRdmNode(photNep4, pnep4Uuid, nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX",
1151 "PHOTONIC_MEDIANodeEdgePoint", false);
1152 List<NodeRuleGroup> nrgList4 = node.nonnullNodeRuleGroup().values().stream()
1153 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
1154 .collect(Collectors.toList());
1155 checkNodeRuleGroupForRdm(nrgList4, 30);
1163 private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1164 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1165 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1166 Name name = nameList.get(0);
1167 assertEquals("value of client nep should be '" + portName + "'",
1168 portName, name.getValue());
1169 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
1170 nepName, name.getValueName());
1171 assertEquals("Client nep should support 3 kind of cep",
1172 3, nep.getSupportedCepLayerProtocolQualifier().size());
1173 assertThat("client nep should support 3 kind of cep",
1174 nep.getSupportedCepLayerProtocolQualifier(),
1175 hasItems(ODUTYPEODU2.class, ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
1176 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
1177 checkCommonPartOfNep(nep, false);
1180 private void checkNepeODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1182 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1183 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1184 Name name = nameList.get(0);
1185 assertEquals("value of eODU nep should be '" + portName + "'",
1186 portName, name.getValue());
1187 assertEquals("value-name of eODU nep for '" + portName + "' should be '" + nepName + "'",
1188 nepName, name.getValueName());
1189 // TODO: depending on the type of node there is one type or another
1190 assertThat("eODU nep should support 1, 2 or 3 kind of cep, depending on client port",
1191 nep.getSupportedCepLayerProtocolQualifier().size(), anyOf(is(1), is(2), is(3)));
1192 assertTrue("eODU nep should support 1 kind of cep",
1193 nep.getSupportedCepLayerProtocolQualifier().stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.class)
1194 || splc.equals(ODUTYPEODU2.class) || splc.equals(ODUTYPEODU2E.class)
1195 || splc.equals(ODUTYPEODU4.class)));
1196 assertEquals("eODU nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
1197 checkCommonPartOfNep(nep, withSip);
1200 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1202 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1203 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1204 Name name = nameList.get(0);
1205 assertEquals("value of network nep should be '" + portName + "'",
1206 portName, name.getValue());
1207 assertEquals("value-name of network nep for '" + portName + "' should be '" + nepName + "'",
1208 nepName, name.getValueName());
1209 assertEquals("Network nep should support 1 kind of cep",
1210 1, nep.getSupportedCepLayerProtocolQualifier().size());
1211 assertThat("network nep should support 1 kind of cep",
1212 nep.getSupportedCepLayerProtocolQualifier(),
1213 hasItem(ODUTYPEODU4.class));
1214 assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
1215 checkCommonPartOfNep(nep, withSip);
1218 private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1220 assertEquals("transponder DSR should contain 2 node rule group", 2, nrgList.size());
1221 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1222 assertEquals("each node-rule-group should contain 2 NEP for transponder DSR",
1223 2, nodeRuleGroup.getNodeEdgePoint().size());
1225 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
1226 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
1227 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1228 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1229 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
1230 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1231 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1232 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
1233 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
1234 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
1235 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
1236 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
1237 assertEquals("node-rule-group nb 1 should contain a single rule", 1, rule.size());
1238 assertEquals("local-id of the rule should be 'forward'",
1239 "forward", rule.get(0).getLocalId());
1240 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1241 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
1242 assertEquals("the rule type should be 'FORWARDING'",
1243 RuleType.FORWARDING, rule.get(0).getRuleType());
1246 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1248 assertEquals("muxponder DSR should contain 4 node rule group", 4, nrgList.size());
1249 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1250 assertEquals("each node-rule-group should contain 2 NEP for muxponder DSR",
1251 2, nodeRuleGroup.getNodeEdgePoint().size());
1253 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(2).nonnullNodeEdgePoint().values());
1254 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
1255 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1256 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1257 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
1258 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1259 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1260 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
1261 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
1262 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
1263 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
1264 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
1265 assertEquals("node-rule-group nb 2 should contain a single rule", 1, rule.size());
1266 assertEquals("local-id of the rule should be 'forward'",
1267 "forward", rule.get(0).getLocalId());
1268 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1269 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
1270 assertEquals("the rule type should be 'FORWARDING'",
1271 RuleType.FORWARDING, rule.get(0).getRuleType());
1274 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1276 assertEquals("Switch-DSR should contain a single node rule group", 1, nrgList.size());
1277 assertEquals("Switch-DSR node-rule-group should contain 8 NEP", 8, nrgList.get(0).getNodeEdgePoint().size());
1278 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
1279 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
1280 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
1281 .collect(Collectors.toList());
1282 assertEquals("in the sorted node-rule-group, nep number 7 should be XPDR2-NETWORK1",
1283 networkNepUuid, nrg.get(6).getNodeEdgePointUuid());
1284 assertEquals("in the sorted node-rule-group, nep number 4 should be XPDR2-CLIENT4",
1285 clientNepUuid, nrg.get(3).getNodeEdgePointUuid());
1286 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1287 nodeUuid, nrg.get(4).getNodeUuid());
1288 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1289 nodeUuid, nrg.get(3).getNodeUuid());
1291 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1292 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1293 assertEquals("local-id of the rule should be 'forward'",
1294 "forward", ruleList.get(0).getLocalId());
1295 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1296 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1297 assertEquals("the rule type should be 'FORWARDING'",
1298 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1301 private void checkNodeRuleGroupForRdm(List<NodeRuleGroup> nrgList, int nbNeps) {
1302 assertEquals("RDM infra node - OTSi should contain a single node rule groups", 1, nrgList.size());
1304 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1305 assertEquals("RDM infra node -rule-group should contain " + nbNeps + " NEP",
1306 nbNeps, nodeEdgePointList.size());
1308 assertNull("RDM infra node -rule-group should contain no NEP", nrgList.get(0).getNodeEdgePoint());
1310 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1311 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1312 assertEquals("local-id of the rule should be 'forward'",
1313 "forward", ruleList.get(0).getLocalId());
1314 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1315 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1316 assertEquals("the rule type should be 'FORWARDING'",
1317 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1320 private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1322 assertEquals("Tpdr-OTSi should contain two node rule groups", 2, nrgList.size());
1323 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1324 assertEquals("Tpdr-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1325 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1326 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1327 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1328 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1329 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1330 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1331 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1332 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1333 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1334 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1335 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1336 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1337 assertEquals("local-id of the rule should be 'forward'",
1338 "forward", ruleList.get(0).getLocalId());
1339 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1340 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1341 assertEquals("the rule type should be 'FORWARDING'",
1342 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1345 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1347 assertEquals("Mux-OTSi should contain a single node rule group", 1, nrgList.size());
1348 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1349 assertEquals("Mux-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1350 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1351 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1352 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1353 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1354 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1355 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1356 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1357 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1358 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1359 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1360 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1361 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1362 assertEquals("local-id of the rule should be 'forward'",
1363 "forward", ruleList.get(0).getLocalId());
1364 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1365 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1366 assertEquals("the rule type should be 'FORWARDING'",
1367 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1370 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1372 assertEquals("Switch-OTSi should contain 4 node rule group", 4, nrgList.size());
1373 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1374 assertEquals("each node-rule-group should contain 2 NEP for Switch-OTSi",
1375 2, nodeRuleGroup.getNodeEdgePoint().size());
1377 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
1378 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1379 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
1380 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1381 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1382 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
1383 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1384 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1385 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1386 nodeUuid, nodeEdgePointList0.get(0).getNodeUuid());
1387 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1388 nodeUuid, nodeEdgePointList0.get(1).getNodeUuid());
1389 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1390 assertEquals("node-rule-group should contain a single rule", 1, ruleList0.size());
1391 assertEquals("local-id of the rule should be 'forward'",
1392 "forward", ruleList0.get(0).getLocalId());
1393 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1394 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList0.get(0).getForwardingRule());
1395 assertEquals("the rule type should be 'FORWARDING'",
1396 RuleType.FORWARDING, ruleList0.get(0).getRuleType());
1399 private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1400 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1401 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1402 assertEquals("value of client nep should be '" + portName + "'",
1403 portName, nameList.get(0).getValue());
1404 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
1405 nepName, nameList.get(0).getValueName());
1406 assertEquals("Client nep should support 2 kind of cep",
1407 2, nep.getSupportedCepLayerProtocolQualifier().size());
1408 assertThat("client nep should support 2 kind of cep",
1409 nep.getSupportedCepLayerProtocolQualifier(),
1410 hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
1411 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
1412 checkCommonPartOfNep(nep, false);
1415 private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1416 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1417 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1418 assertEquals("value of client nep should be '" + portName + "'",
1419 portName, nameList.get(0).getValue());
1420 assertEquals("value-name of client nep for '" + portName + "' should be 100G-tpdr'",
1421 nepName, nameList.get(0).getValueName());
1422 assertEquals("Client nep should support 1 kind of cep",
1423 1, nep.getSupportedCepLayerProtocolQualifier().size());
1424 assertThat("client nep should support 2 kind of cep",
1425 nep.getSupportedCepLayerProtocolQualifier(),
1426 hasItems(DIGITALSIGNALTYPE100GigE.class));
1427 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
1428 checkCommonPartOfNep(nep, false);
1431 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1433 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1434 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1435 assertEquals("value of OTSi nep should be '" + portName + "'",
1436 portName, nameList.get(0).getValue());
1437 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1438 nepName, nameList.get(0).getValueName());
1439 assertEquals("OTSi nep should support 2 kind of cep",
1440 2, nep.getSupportedCepLayerProtocolQualifier().size());
1441 assertThat("OTSi nep should support 2 kind of cep",
1442 nep.getSupportedCepLayerProtocolQualifier(),
1443 hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
1444 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1445 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1446 checkCommonPartOfNep(nep, withSip);
1449 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1451 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1452 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1453 assertEquals("value of OTSi nep should be '" + portName + "'",
1454 portName, nameList.get(0).getValue());
1455 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1456 nepName, nameList.get(0).getValueName());
1457 assertEquals("OTSi nep of RDM infra node should support only 1 kind of cep",
1458 1, nep.getSupportedCepLayerProtocolQualifier().size());
1459 assertThat("OTSi nep should support 2 kind of cep",
1460 nep.getSupportedCepLayerProtocolQualifier(),
1461 hasItems(PHOTONICLAYERQUALIFIEROMS.class));
1462 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1463 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1464 checkCommonPartOfNep(nep, withSip);
1467 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean withSip) {
1468 assertEquals("link port direction should be DIRECTIONAL",
1469 PortDirection.BIDIRECTIONAL, nep.getLinkPortDirection());
1470 assertEquals("administrative state should be UNLOCKED",
1471 AdministrativeState.UNLOCKED, nep.getAdministrativeState());
1472 assertEquals("termination state should be TERMINATED BIDIRECTIONAL",
1473 TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState());
1474 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, nep.getLifecycleState());
1476 assertEquals("Given nep should support 1 SIP", 1, nep.getMappedServiceInterfacePoint().size());
1478 assertEquals("termination direction should be BIDIRECTIONAL",
1479 TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection());
1480 assertEquals("operational state of client nep should be ENABLED",
1481 OperationalState.ENABLED, nep.getOperationalState());
1482 assertEquals("link-port-role of client nep should be SYMMETRIC",
1483 PortRole.SYMMETRIC, nep.getLinkPortRole());
1486 private void checkTransitionalLink(org.opendaylight.yang.gen.v1
1487 .urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1488 Uuid node1Uuid, Uuid node2Uuid, String tp1, String tp2, String ietfNodeId) {
1489 Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((tp1 + "to" + tp2)
1490 .getBytes(Charset.forName("UTF-8"))).toString());
1491 assertEquals("bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2, linkUuid, link.getUuid());
1492 assertEquals("Available capacity unit should be GBPS",
1493 CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
1494 assertEquals("Available capacity -total size value should be 100",
1495 Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue());
1496 assertEquals("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1497 2, link.getTransitionedLayerProtocolName().size());
1498 assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1499 link.getTransitionedLayerProtocolName(),
1500 hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));
1501 assertEquals("transitional link should be BIDIRECTIONAL",
1502 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1503 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1504 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1505 assertEquals("topology uuid should be the same for the two termination point of the link",
1506 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1507 assertEquals("topology uuid should be the same for the two termination point of the link",
1508 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1509 assertThat("transitional links should terminate on DSR node and Photonic node",
1510 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1511 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1512 assertThat("transitional links should terminate on DSR node and Photonic node",
1513 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1514 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1515 Uuid nep1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1.getBytes(Charset.forName("UTF-8"))).toString());
1516 Uuid nep2Uuid = new Uuid(UUID.nameUUIDFromBytes(tp2.getBytes(Charset.forName("UTF-8"))).toString());
1517 assertThat("transitional links should terminate on " + tp1 + " and " + tp2 + " neps",
1518 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1519 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1520 assertThat("transitional links should terminate on DSR node and Photonic node",
1521 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1522 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1525 private void checkOtnLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1526 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1528 assertEquals("bad name for the link", linkName, link.getName().get(
1529 new NameKey("otn link name")).getValue());
1530 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1531 assertEquals("Available capacity unit should be MBPS",
1532 CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
1533 String prefix = linkName.split("-")[0];
1534 if ("OTU4".equals(prefix)) {
1535 assertEquals("Available capacity -total size value should be 0",
1536 Uint64.valueOf(0), link.getAvailableCapacity().getTotalSize().getValue());
1537 } else if ("ODU4".equals(prefix)) {
1538 assertEquals("Available capacity -total size value should be 100 000",
1539 Uint64.valueOf(100000), link.getAvailableCapacity().getTotalSize().getValue());
1541 assertEquals("Total capacity unit should be GBPS",
1542 CapacityUnit.GBPS, link.getTotalPotentialCapacity().getTotalSize().getUnit());
1543 assertEquals("Total capacity -total size value should be 100",
1544 Uint64.valueOf(100), link.getTotalPotentialCapacity().getTotalSize().getValue());
1545 if ("OTU4".equals(prefix)) {
1546 assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1547 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1548 } else if ("ODU4".equals(prefix)) {
1549 assertEquals("otn link should be between 2 nodes of protocol layers ODU",
1550 LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName());
1552 assertEquals("otn tapi link should be BIDIRECTIONAL",
1553 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1554 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1555 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1556 assertEquals("topology uuid should be the same for the two termination point of the link",
1557 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1558 assertEquals("topology uuid should be the same for the two termination point of the link",
1559 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1560 assertThat("otn links should terminate on two distinct nodes",
1561 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1562 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1563 assertThat("otn links should terminate on two distinct nodes",
1564 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1565 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1566 assertThat("otn links should terminate on two distinct tps",
1567 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1568 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1569 assertThat("otn links should terminate on two distinct tps",
1570 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1571 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1572 assertEquals("operational state should be ENABLED",
1573 OperationalState.ENABLED, link.getOperationalState());
1574 assertEquals("administrative state should be UNLOCKED",
1575 AdministrativeState.UNLOCKED, link.getAdministrativeState());
1578 private void checkOmsLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1579 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1581 assertEquals("bad name for the link", linkName, link.getName().get(
1582 new NameKey("OMS link name")).getValue());
1583 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1584 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1585 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1586 assertEquals("otn tapi link should be BIDIRECTIONAL",
1587 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1588 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1589 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1590 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
1591 assertEquals("topology uuid should be the same for the two termination point of the link",
1592 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1593 assertEquals("topology uuid should be the same for the two termination point of the link",
1594 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1595 assertThat("oms links should terminate on two distinct nodes",
1596 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1597 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1598 assertThat("oms links should terminate on two distinct nodes",
1599 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1600 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1601 assertThat("oms links should terminate on two distinct tps",
1602 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1603 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1604 assertThat("oms links should terminate on two distinct tps",
1605 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1606 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1609 private void checkXpdrRdmLink(org.opendaylight.yang.gen.v1.urn
1610 .onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1611 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1613 assertEquals("bad name for the link", linkName, link.getName().get(
1614 new NameKey("XPDR-RDM link name")).getValue());
1615 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1616 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1617 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1618 assertEquals("otn tapi link should be BIDIRECTIONAL",
1619 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1620 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1621 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1622 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
1623 assertEquals("topology uuid should be the same for the two termination point of the link",
1624 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1625 assertEquals("topology uuid should be the same for the two termination point of the link",
1626 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1627 assertThat("oms links should terminate on two distinct nodes",
1628 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1629 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1630 assertThat("oms links should terminate on two distinct nodes",
1631 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1632 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1633 assertThat("oms links should terminate on two distinct tps",
1634 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1635 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1636 assertThat("oms links should terminate on two distinct tps",
1637 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1638 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1641 private Node changeTerminationPointState(Node initialNode, String tpid, String tpid1, AdminStates admin,
1643 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
1644 = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
1645 initialNode.augmentation(Node1.class));
1646 Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
1647 TerminationPointBuilder tpBldr = new TerminationPointBuilder(
1648 tps.get(new TerminationPointKey(new TpId(tpid))));
1649 tpBldr.addAugmentation(new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class))
1650 .setAdministrativeState(admin)
1651 .setOperationalState(oper)
1653 tps.replace(tpBldr.key(), tpBldr.build());
1654 TerminationPointBuilder tpBldr1 = new TerminationPointBuilder(
1655 tps.get(new TerminationPointKey(new TpId(tpid1))));
1656 tpBldr1.addAugmentation(new TerminationPoint1Builder(tpBldr1.augmentation(TerminationPoint1.class))
1657 .setAdministrativeState(admin)
1658 .setOperationalState(oper)
1660 tps.replace(tpBldr1.key(), tpBldr1.build());
1661 tpdr1Bldr.setTerminationPoint(tps);
1662 return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();
1665 private org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1666 .ietf.network.topology.rev180226.networks.network.Link changeOtnLinkState(
1667 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1668 .Link initiallink, AdminStates admin, State oper) {
1669 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1670 .LinkBuilder linkBldr = new
1671 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
1672 .LinkBuilder(initiallink);
1673 linkBldr.addAugmentation(new Link1Builder(linkBldr.augmentation(Link1.class))
1674 .setAdministrativeState(admin)
1675 .setOperationalState(oper)
1677 return linkBldr.build();