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.TerminationPoint1;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1Builder;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmLinkType;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmTpType;
53 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
54 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
55 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
56 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
57 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
58 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
59 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeBuilder;
60 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeKey;
61 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
62 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1;
63 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
64 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
65 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.LinkKey;
66 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
67 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointBuilder;
68 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointKey;
69 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
79 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
80 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
81 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
82 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
83 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
84 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU0;
85 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
86 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
87 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
88 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
89 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
90 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
91 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
92 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
93 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
94 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
95 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint;
96 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
97 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
98 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
99 import org.opendaylight.yangtools.yang.common.Uint64;
100 import org.slf4j.Logger;
101 import org.slf4j.LoggerFactory;
103 public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
104 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToFullTapiTopoTest.class);
106 private static Node otnMuxA;
107 private static Node otnMuxC;
108 private static Node otnSwitch;
109 private static Node tpdr100G;
110 private static Node roadmA;
111 private static Node roadmC;
112 private static Network openroadmNet;
113 private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
114 .networks.network.Link> otnLinks;
115 private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
116 .networks.network.Link> ortopoLinks;
117 private static Uuid topologyUuid;
118 private static NetworkTransactionService networkTransactionService;
119 private static TapiLink tapiLink;
120 private static DataBroker dataBroker = getDataBroker();
123 public static void setUp() throws InterruptedException, ExecutionException {
124 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
125 TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
126 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
127 TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II);
128 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
129 TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
130 TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
131 TapiTopologyDataUtils.PORTMAPPING_FILE);
133 KeyedInstanceIdentifier<Node, NodeKey> muxAIID = InstanceIdentifier.create(Networks.class)
134 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
135 .class, new NetworkKey(new NetworkId("otn-topology")))
136 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR1")));
137 FluentFuture<Optional<Node>> muxAFuture = dataBroker.newReadOnlyTransaction()
138 .read(LogicalDatastoreType.CONFIGURATION, muxAIID);
139 otnMuxA = muxAFuture.get().get();
140 KeyedInstanceIdentifier<Node, NodeKey> muxCIID = InstanceIdentifier.create(Networks.class)
141 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
142 .class, new NetworkKey(new NetworkId("otn-topology")))
143 .child(Node.class, new NodeKey(new NodeId("SPDR-SC1-XPDR1")));
144 FluentFuture<Optional<Node>> muxCFuture = dataBroker.newReadOnlyTransaction()
145 .read(LogicalDatastoreType.CONFIGURATION, muxCIID);
146 otnMuxC = muxCFuture.get().get();
147 KeyedInstanceIdentifier<Node, NodeKey> switchIID = InstanceIdentifier.create(Networks.class)
148 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
149 .class, new NetworkKey(new NetworkId("otn-topology")))
150 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR2")));
151 FluentFuture<Optional<Node>> switchFuture = dataBroker.newReadOnlyTransaction()
152 .read(LogicalDatastoreType.CONFIGURATION, switchIID);
153 otnSwitch = switchFuture.get().get();
154 KeyedInstanceIdentifier<Node, NodeKey> roadmaIID = InstanceIdentifier.create(Networks.class)
155 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
156 .class, new NetworkKey(new NetworkId("openroadm-network")))
157 .child(Node.class, new NodeKey(new NodeId("ROADM-A1")));
158 FluentFuture<Optional<Node>> roadmaFuture = dataBroker.newReadOnlyTransaction()
159 .read(LogicalDatastoreType.CONFIGURATION, roadmaIID);
160 roadmA = roadmaFuture.get().get();
161 KeyedInstanceIdentifier<Node, NodeKey> roadmcIID = InstanceIdentifier.create(Networks.class)
162 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
163 .class, new NetworkKey(new NetworkId("openroadm-network")))
164 .child(Node.class, new NodeKey(new NodeId("ROADM-C1")));
165 FluentFuture<Optional<Node>> roadmcFuture = dataBroker.newReadOnlyTransaction()
166 .read(LogicalDatastoreType.CONFIGURATION, roadmcIID);
167 roadmC = roadmcFuture.get().get();
169 KeyedInstanceIdentifier<Node, NodeKey> tpdrIID = InstanceIdentifier.create(Networks.class)
170 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
171 .class, new NetworkKey(new NetworkId("otn-topology")))
172 .child(Node.class, new NodeKey(new NodeId("XPDR-A1-XPDR1")));
173 FluentFuture<Optional<Node>> tpdrFuture = dataBroker.newReadOnlyTransaction()
174 .read(LogicalDatastoreType.CONFIGURATION, tpdrIID);
175 tpdr100G = tpdrFuture.get().get();
177 InstanceIdentifier<Network1> linksIID = InstanceIdentifier.create(Networks.class)
178 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
179 .class, new NetworkKey(new NetworkId("otn-topology")))
180 .augmentation(Network1.class);
181 FluentFuture<Optional<Network1>> linksFuture = dataBroker.newReadOnlyTransaction()
182 .read(LogicalDatastoreType.CONFIGURATION, linksIID);
183 otnLinks = linksFuture.get().get().getLink();
185 InstanceIdentifier<Network1> links1IID = InstanceIdentifier.create(Networks.class)
186 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
187 .class, new NetworkKey(new NetworkId("openroadm-topology")))
188 .augmentation(Network1.class);
189 FluentFuture<Optional<Network1>> links1Future = dataBroker.newReadOnlyTransaction()
190 .read(LogicalDatastoreType.CONFIGURATION, links1IID);
191 ortopoLinks = links1Future.get().get().getLink();
193 InstanceIdentifier<Network> ortopo1IID = InstanceIdentifier.create(Networks.class)
194 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
195 .class, new NetworkKey(new NetworkId("openroadm-topology")));
196 FluentFuture<Optional<Network>> ortopoFuture = dataBroker.newReadOnlyTransaction()
197 .read(LogicalDatastoreType.CONFIGURATION, ortopo1IID);
198 openroadmNet = ortopoFuture.get().get();
200 topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
201 Charset.forName("UTF-8"))).toString());
202 networkTransactionService = new NetworkTransactionImpl(
203 new RequestProcessor(getDataStoreContextUtil().getDataBroker()));
204 tapiLink = new TapiLink(networkTransactionService);
205 LOG.info("TEST SETUP READY");
209 public void convertNodeWhenNoStates() {
210 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1", null, null);
211 List<String> networkPortList = new ArrayList<>();
212 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
213 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
214 networkPortList.add(tp.getTpId().getValue());
217 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
218 tapiFactory.convertNode(tpdr, networkPortList);
220 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
222 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
223 .getTapiNodes().get(new
224 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
225 Uuid enetworkNepUuid = new Uuid(
226 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
228 Uuid inetworkNepUuid = new Uuid(
229 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
231 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
232 assertNull("Administrative State should not be present", enepN.getAdministrativeState());
233 assertNull("Operational State should not be present", enepN.getOperationalState());
235 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
236 assertNull("Administrative State should not be present", inepN.getAdministrativeState());
237 assertNull("Operational State should not be present", inepN.getOperationalState());
239 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
241 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
242 .getTapiNodes().get(new
243 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
244 Uuid enepUuid = new Uuid(
245 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
247 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
248 assertNull("Administrative State should not be present", enep.getAdministrativeState());
249 assertNull("Operational State should not be present", enep.getOperationalState());
251 Uuid inepUuid = new Uuid(
252 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
254 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
255 assertNull("Administrative State should not be present", inep.getAdministrativeState());
256 assertNull("Operational State should not be present", inep.getOperationalState());
258 Uuid photnepUuid = new Uuid(
259 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
261 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
262 assertNull("Administrative State should not be present", photnep.getAdministrativeState());
263 assertNull("Operational State should not be present", photnep.getOperationalState());
267 public void convertNodeWhenBadStates1() {
268 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
269 AdminStates.OutOfService, State.OutOfService);
270 List<String> networkPortList = new ArrayList<>();
271 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
272 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
273 networkPortList.add(tp.getTpId().getValue());
276 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
277 tapiFactory.convertNode(tpdr, networkPortList);
279 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
281 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
282 .getTapiNodes().get(new
283 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
284 Uuid enetworkNepUuid = new Uuid(
285 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
287 Uuid inetworkNepUuid = new Uuid(
288 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
290 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
291 assertEquals("Administrative State should be Locked",
292 AdministrativeState.LOCKED, enepN.getAdministrativeState());
293 assertEquals("Operational State should be Disabled",
294 OperationalState.DISABLED, enepN.getOperationalState());
296 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
297 assertEquals("Administrative State should be Locked",
298 AdministrativeState.LOCKED, inepN.getAdministrativeState());
299 assertEquals("Operational State should be Disabled",
300 OperationalState.DISABLED, inepN.getOperationalState());
302 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
304 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
305 .getTapiNodes().get(new
306 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
307 Uuid enepUuid = new Uuid(
308 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
310 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
311 assertEquals("Administrative State should be Locked",
312 AdministrativeState.LOCKED, enep.getAdministrativeState());
313 assertEquals("Operational State should be Disabled",
314 OperationalState.DISABLED, enep.getOperationalState());
316 Uuid inepUuid = new Uuid(
317 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
319 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
320 assertEquals("Administrative State should be Locked",
321 AdministrativeState.LOCKED, inep.getAdministrativeState());
322 assertEquals("Operational State should be Disabled",
323 OperationalState.DISABLED, inep.getOperationalState());
325 Uuid photnepUuid = new Uuid(
326 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
328 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
329 assertEquals("Administrative State should be Locked",
330 AdministrativeState.LOCKED, photnep.getAdministrativeState());
331 assertEquals("Operational State should be Disabled",
332 OperationalState.DISABLED, photnep.getOperationalState());
336 public void convertNodeWhenBadStates2() {
337 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
338 AdminStates.Maintenance, State.Degraded);
339 List<String> networkPortList = new ArrayList<>();
340 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
341 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
342 networkPortList.add(tp.getTpId().getValue());
345 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
346 tapiFactory.convertNode(tpdr, networkPortList);
348 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
350 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
351 .getTapiNodes().get(new
352 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
353 Uuid enetworkNepUuid = new Uuid(
354 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
356 Uuid inetworkNepUuid = new Uuid(
357 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
359 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
360 assertEquals("Administrative State should be Locked",
361 AdministrativeState.LOCKED, enepN.getAdministrativeState());
362 assertEquals("Operational State should be Disabled",
363 OperationalState.DISABLED, enepN.getOperationalState());
365 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
366 assertEquals("Administrative State should be Locked",
367 AdministrativeState.LOCKED, inepN.getAdministrativeState());
368 assertEquals("Operational State should be Disabled",
369 OperationalState.DISABLED, inepN.getOperationalState());
371 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
373 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
374 .getTapiNodes().get(new
375 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
376 Uuid enepUuid = new Uuid(
377 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
379 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
380 assertEquals("Administrative State should be Locked",
381 AdministrativeState.LOCKED, enep.getAdministrativeState());
382 assertEquals("Operational State should be Disabled",
383 OperationalState.DISABLED, enep.getOperationalState());
385 Uuid inepUuid = new Uuid(
386 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
388 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
389 assertEquals("Administrative State should be Locked",
390 AdministrativeState.LOCKED, inep.getAdministrativeState());
391 assertEquals("Operational State should be Disabled",
392 OperationalState.DISABLED, inep.getOperationalState());
394 Uuid photnepUuid = new Uuid(
395 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
397 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
398 assertEquals("Administrative State should be Locked",
399 AdministrativeState.LOCKED, photnep.getAdministrativeState());
400 assertEquals("Operational State should be Disabled",
401 OperationalState.DISABLED, photnep.getOperationalState());
405 public void convertNodeForTransponder100G() {
406 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
407 List<String> networkPortList = new ArrayList<>();
408 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
409 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
410 networkPortList.add(tp.getTpId().getValue());
413 tapiFactory.convertNode(tpdr100G, networkPortList);
414 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
415 = tapiFactory.getTapiNodes().values().stream()
416 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
417 .collect(Collectors.toList());
419 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
420 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
422 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
424 checkDsrNode(tapiNodes.get(1), dsrNodeUuid, "tpdr", "XPDR-A1-XPDR1");
425 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
427 checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "tpdr", "XPDR-A1-XPDR1");
429 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
430 = tapiFactory.getTapiLinks().values().stream()
431 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
432 .collect(Collectors.toList());
433 checkTransitionalLink(tapiLinks.get(1), dsrNodeUuid, otsiNodeUuid,
434 "XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1", "XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1", "XPDR-A1-XPDR1");
438 public void convertNodeForOtnMuxponder() {
439 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
440 List<String> networkPortList = new ArrayList<>();
441 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
442 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
443 networkPortList.add(tp.getTpId().getValue());
446 tapiFactory.convertNode(otnMuxA, networkPortList);
447 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
448 = tapiFactory.getTapiNodes().values().stream()
449 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
450 .collect(Collectors.toList());
452 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
453 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
454 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
456 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "mux", "SPDR-SA1-XPDR1");
457 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
459 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "mux", "SPDR-SA1-XPDR1");
461 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
462 = tapiFactory.getTapiLinks().values().stream()
463 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
464 .collect(Collectors.toList());
465 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
466 "SPDR-SA1-XPDR1+iODU+XPDR1-NETWORK1", "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1", "SPDR-SA1-XPDR1");
470 public void convertNodeForOtnSwitch() {
471 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
472 List<String> networkPortList = new ArrayList<>();
473 for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
474 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
475 networkPortList.add(tp.getTpId().getValue());
478 tapiFactory.convertNode(otnSwitch, networkPortList);
479 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
480 = tapiFactory.getTapiNodes().values().stream()
481 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
482 .collect(Collectors.toList());
484 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
485 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
487 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+DSR".getBytes(Charset.forName("UTF-8")))
489 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "switch", "SPDR-SA1-XPDR2");
490 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+OTSi".getBytes(Charset.forName("UTF-8")))
492 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "switch", "SPDR-SA1-XPDR2");
494 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
495 = tapiFactory.getTapiLinks().values().stream()
496 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
497 .collect(Collectors.toList());
498 checkTransitionalLink(tapiLinks.get(2), dsrNodeUuid, otsiNodeUuid,
499 "SPDR-SA1-XPDR2+iODU+XPDR2-NETWORK4", "SPDR-SA1-XPDR2+iOTSi+XPDR2-NETWORK4", "SPDR-SA1-XPDR2");
503 public void convertNodeForRoadmWhenNoOtnMuxAttached() {
504 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
505 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
507 assertEquals("Node list size should be 1", 1, tapiFactory.getTapiNodes().size());
508 assertEquals("Link list size should be empty", 0, tapiFactory.getTapiLinks().size());
509 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
510 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
511 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
512 .getBytes(Charset.forName("UTF-8"))).toString());
513 checkOtsiNode(tapiNodes.get(0), roadmNodeUuid, "roadm", "ROADM-A1");
517 public void convertNodeForRoadmWhenRoadmNeighborAttached() {
518 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
519 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
520 tapiFactory.convertRoadmNode(roadmC, openroadmNet);
522 List<Link> rdmTordmLinkList = ortopoLinks.values().stream()
523 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
524 .collect(Collectors.toList());
525 tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
527 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
528 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
530 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
531 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
532 Uuid roadmaNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
533 .getBytes(Charset.forName("UTF-8"))).toString());
534 checkOtsiNode(tapiNodes.get(1), roadmaNodeUuid, "roadm", "ROADM-A1");
536 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
537 = tapiFactory.getTapiLinks().values().stream()
538 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
539 .collect(Collectors.toList());
540 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
542 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-C1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
544 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
545 .getBytes(Charset.forName("UTF-8"))).toString());
546 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
547 .getBytes(Charset.forName("UTF-8"))).toString());
549 new Uuid(UUID.nameUUIDFromBytes(
550 "ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
551 .getBytes(Charset.forName("UTF-8"))).toString());
552 checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
553 "ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX");
557 public void convertNodeForRoadmWhenOtnMuxAttached() {
558 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
559 List<String> networkPortListA = new ArrayList<>();
560 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
561 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
562 networkPortListA.add(tp.getTpId().getValue());
565 tapiFactory.convertNode(otnMuxA, networkPortListA);
566 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
567 List<Link> xponderOutLinkList = ortopoLinks.values().stream()
568 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
569 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
570 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
571 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
572 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
573 .collect(Collectors.toList());
574 List<Link> xponderInLinkList = ortopoLinks.values().stream()
575 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
576 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
577 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
578 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
579 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
580 .collect(Collectors.toList());
581 xponderInLinkList.addAll(xponderOutLinkList);
582 tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
583 assertEquals("Node list size should be 3", 3, tapiFactory.getTapiNodes().size());
584 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
585 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
586 = tapiFactory.getTapiNodes().values().stream()
587 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
588 .collect(Collectors.toList());
589 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
590 .getBytes(Charset.forName("UTF-8"))).toString());
591 checkOtsiNode(tapiNodes.get(1), roadmNodeUuid, "roadm", "ROADM-A1");
593 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
594 = tapiFactory.getTapiLinks().values().stream()
595 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
596 .collect(Collectors.toList());
597 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
599 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
601 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
602 .getBytes(Charset.forName("UTF-8"))).toString());
603 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRX")
604 .getBytes(Charset.forName("UTF-8"))).toString());
606 new Uuid(UUID.nameUUIDFromBytes(
607 "ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
608 .getBytes(Charset.forName("UTF-8"))).toString());
609 checkXpdrRdmLink(links.get(1), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
610 "ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1");
613 private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
614 Uuid nodeUuid, String dsrNodeType, String nodeId) {
615 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
616 assertEquals("incorrect node name", nodeId + "+DSR", node.getName().get(
617 new NameKey("dsr/odu node name")).getValue());
618 assertEquals("administrative state should be UNLOCKED",
619 AdministrativeState.UNLOCKED, node.getAdministrativeState());
620 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
621 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
622 assertThat("one value-name should be 'dsr/odu node name'",
623 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("dsr/odu node name")));
624 assertEquals("dsr node should manage 2 protocol layers : dsr and odu",
625 2, node.getLayerProtocolName().size());
626 assertThat("dsr node should manage 2 protocol layers : dsr and odu",
627 node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
628 List<OwnedNodeEdgePoint> inepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
629 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint_N")))
630 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
631 .collect(Collectors.toList());
632 List<OwnedNodeEdgePoint> enepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
633 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint_N")))
634 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
635 .collect(Collectors.toList());
636 List<OwnedNodeEdgePoint> nepsC;
637 switch (dsrNodeType) {
639 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
640 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
641 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
642 .collect(Collectors.toList());
643 assertEquals("Switch-DSR node should have 4 eNEPs network", 4, enepsN.size());
644 assertEquals("Switch-DSR node should have 4 iNEPs network", 4, inepsN.size());
645 assertEquals("Switch-DSR node should have 4 NEPs client", 4, nepsC.size());
646 OwnedNodeEdgePoint nep1 = nepsC.get(2);
647 Uuid client4NepUuid = new Uuid(
648 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
650 checkNepClient100GSwitch(nep1, client4NepUuid, nodeId + "+DSR+XPDR2-CLIENT4", "NodeEdgePoint_C");
651 OwnedNodeEdgePoint enep2 = enepsN.get(2);
652 OwnedNodeEdgePoint inep2 = inepsN.get(3);
653 Uuid enetworkNepUuid = new Uuid(
654 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
656 Uuid inetworkNepUuid = new Uuid(
657 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
659 checkNepeODU4(enep2, enetworkNepUuid, nodeId + "+eODU+XPDR2-CLIENT4", "eNodeEdgePoint_N", false);
660 checkNepNetworkODU4(inep2, inetworkNepUuid, nodeId + "+iODU+XPDR2-NETWORK1", "iNodeEdgePoint_N", true);
661 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
662 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
663 .collect(Collectors.toList());
664 checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, enetworkNepUuid, nodeUuid);
667 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
668 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
669 .sorted((nep3, nep4) -> nep3.getUuid().getValue().compareTo(nep4.getUuid().getValue()))
670 .collect(Collectors.toList());
671 assertEquals("Mux-DSR node should have 4 eNEP network", 4, enepsN.size());
672 assertEquals("Mux-DSR node should have 1 iNEP network", 1, inepsN.size());
673 assertEquals("Mux-DSR node should have 4 NEPs client", 4, nepsC.size());
674 OwnedNodeEdgePoint nep3 = nepsC.get(2);
675 Uuid client3NepUuid = new Uuid(
676 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
678 checkNepClient10G(nep3, client3NepUuid, nodeId + "+DSR+XPDR1-CLIENT3", "NodeEdgePoint_C");
679 OwnedNodeEdgePoint enep4 = enepsN.get(3);
680 OwnedNodeEdgePoint inep4 = inepsN.get(0);
681 Uuid enetworkNepUuid2 = new Uuid(
682 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
684 Uuid inetworkNepUuid2 = new Uuid(
685 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
687 checkNepeODU4(enep4, enetworkNepUuid2, nodeId + "+eODU+XPDR1-CLIENT3", "eNodeEdgePoint_N", false);
688 checkNepNetworkODU4(inep4, inetworkNepUuid2, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
690 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
691 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
692 .collect(Collectors.toList());
693 checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, enetworkNepUuid2, nodeUuid);
696 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
697 .filter(n -> n.getName().containsKey(new NameKey("100G-tpdr")))
698 .sorted((nep5, nep6) -> nep5.getUuid().getValue().compareTo(nep6.getUuid().getValue()))
699 .collect(Collectors.toList());
700 assertEquals("Tpdr-DSR node should have 2 eNEPs network", 2, enepsN.size());
701 assertEquals("Tpdr-DSR node should have 2 iNEPs network", 2, inepsN.size());
702 assertEquals("Tpdr-DSR node should have 2 NEPs client", 2, nepsC.size());
703 OwnedNodeEdgePoint nep5 = nepsC.get(0);
704 Uuid client1NepUuid = new Uuid(
705 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
707 checkNepClient100GTpdr(nep5, client1NepUuid, nodeId + "+DSR+XPDR1-CLIENT1", "100G-tpdr");
708 OwnedNodeEdgePoint enep6 = enepsN.get(0);
709 OwnedNodeEdgePoint inep6 = inepsN.get(1);
710 Uuid enetworkNepUuid3 = new Uuid(
711 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
713 Uuid inetworkNepUuid3 = new Uuid(
714 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
716 checkNepeODU4(enep6, enetworkNepUuid3, nodeId + "+eODU+XPDR1-CLIENT1", "eNodeEdgePoint_N", false);
717 checkNepNetworkODU4(inep6, inetworkNepUuid3, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
719 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
720 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
721 .collect(Collectors.toList());
722 checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, enetworkNepUuid3, nodeUuid);
730 private void checkOtsiNode(
731 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
732 Uuid nodeUuid, String otsiNodeType, String nodeId) {
733 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
734 List<OwnedNodeEdgePoint> nepsI = null;
735 List<OwnedNodeEdgePoint> nepsE = null;
736 List<OwnedNodeEdgePoint> nepsP = null;
737 List<OwnedNodeEdgePoint> nepsMc = null;
738 List<OwnedNodeEdgePoint> nepsOtsimc = null;
739 List<OwnedNodeEdgePoint> nepsPhot = null;
740 if (!otsiNodeType.equals("roadm")) {
741 assertEquals("incorrect node name", nodeId + "+OTSi", node.getName().get(
742 new NameKey("otsi node name")).getValue());
743 assertThat("one value-name should be 'dsr/odu node name'",
744 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("otsi node name")));
745 nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
746 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
747 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
748 .collect(Collectors.toList());
749 nepsE = node.nonnullOwnedNodeEdgePoint().values().stream()
750 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint")))
751 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
752 .collect(Collectors.toList());
753 nepsP = node.nonnullOwnedNodeEdgePoint().values().stream()
754 .filter(n -> n.getName().containsKey(new NameKey("PhotMedNodeEdgePoint")))
755 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
756 .collect(Collectors.toList());
758 assertEquals("incorrect node name", nodeId + "+PHOTONIC_MEDIA", node.getName().get(
759 new NameKey("roadm node name")).getValue());
760 assertThat("one value-name should be 'dsr/odu node name'",
761 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("roadm node name")));
762 nepsMc = node.nonnullOwnedNodeEdgePoint().values().stream()
763 .filter(n -> n.getName().containsKey(new NameKey("MEDIA_CHANNELNodeEdgePoint")))
764 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
765 .collect(Collectors.toList());
766 nepsOtsimc = node.nonnullOwnedNodeEdgePoint().values().stream()
767 .filter(n -> n.getName().containsKey(new NameKey("OTSi_MEDIA_CHANNELNodeEdgePoint")))
768 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
769 .collect(Collectors.toList());
770 nepsPhot = node.nonnullOwnedNodeEdgePoint().values().stream()
771 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIANodeEdgePoint")))
772 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
773 .collect(Collectors.toList());
775 assertEquals("administrative state should be UNLOCKED",
776 AdministrativeState.UNLOCKED, node.getAdministrativeState());
777 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
778 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
779 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
780 1, node.getLayerProtocolName().size());
781 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
782 LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().get(0));
784 switch (otsiNodeType) {
786 assertEquals("Switch-OTSi node should have 4 eNEPs", 4, nepsE.size());
787 assertEquals("Switch-OTSi node should have 4 iNEPs", 4, nepsI.size());
788 assertEquals("Switch-OTSi node should have 4 photNEPs", 4, nepsP.size());
789 OwnedNodeEdgePoint nep1 = nepsI.get(1);
790 Uuid inepUuid = new Uuid(
791 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
793 checkNepOtsiNode(nep1, inepUuid, nodeId + "+iOTSi+XPDR2-NETWORK2", "iNodeEdgePoint", true);
794 OwnedNodeEdgePoint nep2 = nepsE.get(0);
795 Uuid enepUuid = new Uuid(
796 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
798 checkNepOtsiNode(nep2, enepUuid, nodeId + "+eOTSi+XPDR2-NETWORK2", "eNodeEdgePoint", false);
799 OwnedNodeEdgePoint photNep = nepsP.get(1);
800 Uuid pnepUuid = new Uuid(
801 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2")
802 .getBytes(Charset.forName("UTF-8"))).toString());
803 checkNepOtsiNode(photNep, pnepUuid, nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2", "PhotMedNodeEdgePoint",
805 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
806 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
807 .collect(Collectors.toList());
808 checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
811 assertEquals("Mux-OTSi node should have 1 eNEP", 1, nepsE.size());
812 assertEquals("Mux-OTSi node should have 1 iNEPs", 1, nepsI.size());
813 assertEquals("Mux-OTSi node should have 1 photNEPs", 1, nepsP.size());
814 OwnedNodeEdgePoint nep3 = nepsE.get(0);
815 Uuid enepUuid2 = new Uuid(
816 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
818 checkNepOtsiNode(nep3, enepUuid2, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
819 OwnedNodeEdgePoint nep4 = nepsI.get(0);
820 Uuid inepUuid2 = new Uuid(
821 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
823 checkNepOtsiNode(nep4, inepUuid2, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
824 OwnedNodeEdgePoint photNep1 = nepsP.get(0);
825 Uuid pnep1Uuid = new Uuid(
826 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
827 .getBytes(Charset.forName("UTF-8"))).toString());
828 checkNepOtsiNode(photNep1, pnep1Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
830 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
831 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
832 .collect(Collectors.toList());
833 checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
836 assertEquals("Tpdr-OTSi node should have 2 eNEPs", 2, nepsE.size());
837 assertEquals("Tpdr-OTSi node should have 2 iNEPs", 2, nepsI.size());
838 assertEquals("Tpdr-OTSi node should have 2 photNEPs", 2, nepsP.size());
839 OwnedNodeEdgePoint nep5 = nepsE.get(0);
840 Uuid enepUuid3 = new Uuid(
841 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
843 checkNepOtsiNode(nep5, enepUuid3, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
844 OwnedNodeEdgePoint nep6 = nepsI.get(0);
845 Uuid inepUuid3 = new Uuid(
846 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
848 checkNepOtsiNode(nep6, inepUuid3, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
849 OwnedNodeEdgePoint photNep2 = nepsP.get(0);
850 Uuid pnep2Uuid = new Uuid(
851 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
852 .getBytes(Charset.forName("UTF-8"))).toString());
853 checkNepOtsiNode(photNep2, pnep2Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
855 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
856 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
857 .collect(Collectors.toList());
858 checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
861 assertEquals("Roadm node should have 10 MC NEPs", 10, nepsMc.size());
862 assertEquals("Roadm node should have 10 OTSiMC NEPs", 10, nepsOtsimc.size());
863 assertEquals("Roadm node should have 10 PHOT_MEDIA NEPs", 10, nepsPhot.size());
865 OwnedNodeEdgePoint nep7 = nepsMc.get(6);
866 Uuid mcnepUuid3 = new Uuid(
867 UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX").getBytes(Charset.forName("UTF-8")))
869 checkNepOtsiRdmNode(nep7, mcnepUuid3, nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX",
870 "MEDIA_CHANNELNodeEdgePoint", false);
871 OwnedNodeEdgePoint nep8 = nepsOtsimc.get(0);
872 Uuid otmcnepUuid3 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX")
873 .getBytes(Charset.forName("UTF-8"))).toString());
874 checkNepOtsiRdmNode(nep8, otmcnepUuid3, nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX",
875 "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
876 OwnedNodeEdgePoint photNep3 = nepsPhot.get(3);
877 Uuid pnep3Uuid = new Uuid(
878 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
879 .getBytes(Charset.forName("UTF-8"))).toString());
880 checkNepOtsiRdmNode(photNep3, pnep3Uuid, nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX",
881 "PHOTONIC_MEDIANodeEdgePoint", false);
883 OwnedNodeEdgePoint nep9 = nepsMc.get(0);
884 Uuid mcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX")
885 .getBytes(Charset.forName("UTF-8"))).toString());
886 checkNepOtsiRdmNode(nep9, mcnepUuid4, nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX",
887 "MEDIA_CHANNELNodeEdgePoint", true);
888 OwnedNodeEdgePoint nep10 = nepsOtsimc.get(9);
889 Uuid otmcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX")
890 .getBytes(Charset.forName("UTF-8"))).toString());
891 checkNepOtsiRdmNode(nep10, otmcnepUuid4, nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX",
892 "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
893 OwnedNodeEdgePoint photNep4 = nepsPhot.get(4);
894 Uuid pnep4Uuid = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX")
895 .getBytes(Charset.forName("UTF-8"))).toString());
896 checkNepOtsiRdmNode(photNep4, pnep4Uuid, nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX",
897 "PHOTONIC_MEDIANodeEdgePoint", false);
898 List<NodeRuleGroup> nrgList4 = node.nonnullNodeRuleGroup().values().stream()
899 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
900 .collect(Collectors.toList());
901 checkNodeRuleGroupForRdm(nrgList4, 30);
909 private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
910 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
911 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
912 Name name = nameList.get(0);
913 assertEquals("value of client nep should be '" + portName + "'",
914 portName, name.getValue());
915 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
916 nepName, name.getValueName());
917 assertEquals("Client nep should support 3 kind of cep",
918 3, nep.getSupportedCepLayerProtocolQualifier().size());
919 assertThat("client nep should support 3 kind of cep",
920 nep.getSupportedCepLayerProtocolQualifier(),
921 hasItems(ODUTYPEODU2.class, ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
922 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
923 checkCommonPartOfNep(nep, false);
926 private void checkNepeODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
928 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
929 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
930 Name name = nameList.get(0);
931 assertEquals("value of eODU nep should be '" + portName + "'",
932 portName, name.getValue());
933 assertEquals("value-name of eODU nep for '" + portName + "' should be '" + nepName + "'",
934 nepName, name.getValueName());
935 // TODO: depending on the type of node there is one type or another
936 assertThat("eODU nep should support 1, 2 or 3 kind of cep, depending on client port",
937 nep.getSupportedCepLayerProtocolQualifier().size(), anyOf(is(1), is(2), is(3)));
938 assertTrue("eODU nep should support 1 kind of cep",
939 nep.getSupportedCepLayerProtocolQualifier().stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.class)
940 || splc.equals(ODUTYPEODU2.class) || splc.equals(ODUTYPEODU2E.class)
941 || splc.equals(ODUTYPEODU4.class)));
942 assertEquals("eODU nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
943 checkCommonPartOfNep(nep, withSip);
946 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
948 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
949 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
950 Name name = nameList.get(0);
951 assertEquals("value of network nep should be '" + portName + "'",
952 portName, name.getValue());
953 assertEquals("value-name of network nep for '" + portName + "' should be '" + nepName + "'",
954 nepName, name.getValueName());
955 assertEquals("Network nep should support 1 kind of cep",
956 1, nep.getSupportedCepLayerProtocolQualifier().size());
957 assertThat("network nep should support 1 kind of cep",
958 nep.getSupportedCepLayerProtocolQualifier(),
959 hasItem(ODUTYPEODU4.class));
960 assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
961 checkCommonPartOfNep(nep, withSip);
964 private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
966 assertEquals("transponder DSR should contain 2 node rule group", 2, nrgList.size());
967 for (NodeRuleGroup nodeRuleGroup : nrgList) {
968 assertEquals("each node-rule-group should contain 2 NEP for transponder DSR",
969 2, nodeRuleGroup.getNodeEdgePoint().size());
971 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
972 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
973 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
974 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
975 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
976 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
977 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
978 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
979 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
980 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
981 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
982 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
983 assertEquals("node-rule-group nb 1 should contain a single rule", 1, rule.size());
984 assertEquals("local-id of the rule should be 'forward'",
985 "forward", rule.get(0).getLocalId());
986 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
987 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
988 assertEquals("the rule type should be 'FORWARDING'",
989 RuleType.FORWARDING, rule.get(0).getRuleType());
992 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
994 assertEquals("muxponder DSR should contain 4 node rule group", 4, nrgList.size());
995 for (NodeRuleGroup nodeRuleGroup : nrgList) {
996 assertEquals("each node-rule-group should contain 2 NEP for muxponder DSR",
997 2, nodeRuleGroup.getNodeEdgePoint().size());
999 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(2).nonnullNodeEdgePoint().values());
1000 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
1001 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1002 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1003 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
1004 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1005 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1006 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
1007 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
1008 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
1009 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
1010 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
1011 assertEquals("node-rule-group nb 2 should contain a single rule", 1, rule.size());
1012 assertEquals("local-id of the rule should be 'forward'",
1013 "forward", rule.get(0).getLocalId());
1014 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1015 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
1016 assertEquals("the rule type should be 'FORWARDING'",
1017 RuleType.FORWARDING, rule.get(0).getRuleType());
1020 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1022 assertEquals("Switch-DSR should contain a single node rule group", 1, nrgList.size());
1023 assertEquals("Switch-DSR node-rule-group should contain 8 NEP", 8, nrgList.get(0).getNodeEdgePoint().size());
1024 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
1025 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
1026 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
1027 .collect(Collectors.toList());
1028 assertEquals("in the sorted node-rule-group, nep number 7 should be XPDR2-NETWORK1",
1029 networkNepUuid, nrg.get(6).getNodeEdgePointUuid());
1030 assertEquals("in the sorted node-rule-group, nep number 4 should be XPDR2-CLIENT4",
1031 clientNepUuid, nrg.get(3).getNodeEdgePointUuid());
1032 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1033 nodeUuid, nrg.get(4).getNodeUuid());
1034 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1035 nodeUuid, nrg.get(3).getNodeUuid());
1037 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1038 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1039 assertEquals("local-id of the rule should be 'forward'",
1040 "forward", ruleList.get(0).getLocalId());
1041 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1042 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1043 assertEquals("the rule type should be 'FORWARDING'",
1044 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1047 private void checkNodeRuleGroupForRdm(List<NodeRuleGroup> nrgList, int nbNeps) {
1048 assertEquals("RDM infra node - OTSi should contain a single node rule groups", 1, nrgList.size());
1050 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1051 assertEquals("RDM infra node -rule-group should contain " + nbNeps + " NEP",
1052 nbNeps, nodeEdgePointList.size());
1054 assertNull("RDM infra node -rule-group should contain no NEP", nrgList.get(0).getNodeEdgePoint());
1056 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1057 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1058 assertEquals("local-id of the rule should be 'forward'",
1059 "forward", ruleList.get(0).getLocalId());
1060 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1061 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1062 assertEquals("the rule type should be 'FORWARDING'",
1063 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1066 private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1068 assertEquals("Tpdr-OTSi should contain two node rule groups", 2, nrgList.size());
1069 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1070 assertEquals("Tpdr-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1071 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1072 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1073 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1074 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1075 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1076 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1077 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1078 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1079 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1080 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1081 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1082 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1083 assertEquals("local-id of the rule should be 'forward'",
1084 "forward", ruleList.get(0).getLocalId());
1085 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1086 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1087 assertEquals("the rule type should be 'FORWARDING'",
1088 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1091 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1093 assertEquals("Mux-OTSi should contain a single node rule group", 1, nrgList.size());
1094 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1095 assertEquals("Mux-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1096 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1097 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1098 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1099 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1100 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1101 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1102 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1103 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1104 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1105 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1106 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1107 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1108 assertEquals("local-id of the rule should be 'forward'",
1109 "forward", ruleList.get(0).getLocalId());
1110 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1111 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1112 assertEquals("the rule type should be 'FORWARDING'",
1113 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1116 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1118 assertEquals("Switch-OTSi should contain 4 node rule group", 4, nrgList.size());
1119 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1120 assertEquals("each node-rule-group should contain 2 NEP for Switch-OTSi",
1121 2, nodeRuleGroup.getNodeEdgePoint().size());
1123 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
1124 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1125 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
1126 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1127 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1128 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
1129 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1130 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1131 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1132 nodeUuid, nodeEdgePointList0.get(0).getNodeUuid());
1133 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1134 nodeUuid, nodeEdgePointList0.get(1).getNodeUuid());
1135 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1136 assertEquals("node-rule-group should contain a single rule", 1, ruleList0.size());
1137 assertEquals("local-id of the rule should be 'forward'",
1138 "forward", ruleList0.get(0).getLocalId());
1139 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1140 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList0.get(0).getForwardingRule());
1141 assertEquals("the rule type should be 'FORWARDING'",
1142 RuleType.FORWARDING, ruleList0.get(0).getRuleType());
1145 private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1146 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1147 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1148 assertEquals("value of client nep should be '" + portName + "'",
1149 portName, nameList.get(0).getValue());
1150 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
1151 nepName, nameList.get(0).getValueName());
1152 assertEquals("Client nep should support 2 kind of cep",
1153 2, nep.getSupportedCepLayerProtocolQualifier().size());
1154 assertThat("client nep should support 2 kind of cep",
1155 nep.getSupportedCepLayerProtocolQualifier(),
1156 hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
1157 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
1158 checkCommonPartOfNep(nep, false);
1161 private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1162 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1163 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1164 assertEquals("value of client nep should be '" + portName + "'",
1165 portName, nameList.get(0).getValue());
1166 assertEquals("value-name of client nep for '" + portName + "' should be 100G-tpdr'",
1167 nepName, nameList.get(0).getValueName());
1168 assertEquals("Client nep should support 1 kind of cep",
1169 1, nep.getSupportedCepLayerProtocolQualifier().size());
1170 assertThat("client nep should support 2 kind of cep",
1171 nep.getSupportedCepLayerProtocolQualifier(),
1172 hasItems(DIGITALSIGNALTYPE100GigE.class));
1173 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
1174 checkCommonPartOfNep(nep, false);
1177 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1179 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1180 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1181 assertEquals("value of OTSi nep should be '" + portName + "'",
1182 portName, nameList.get(0).getValue());
1183 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1184 nepName, nameList.get(0).getValueName());
1185 assertEquals("OTSi nep should support 2 kind of cep",
1186 2, nep.getSupportedCepLayerProtocolQualifier().size());
1187 assertThat("OTSi nep should support 2 kind of cep",
1188 nep.getSupportedCepLayerProtocolQualifier(),
1189 hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
1190 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1191 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1192 checkCommonPartOfNep(nep, withSip);
1195 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1197 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1198 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1199 assertEquals("value of OTSi nep should be '" + portName + "'",
1200 portName, nameList.get(0).getValue());
1201 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1202 nepName, nameList.get(0).getValueName());
1203 assertEquals("OTSi nep of RDM infra node should support only 1 kind of cep",
1204 1, nep.getSupportedCepLayerProtocolQualifier().size());
1205 assertThat("OTSi nep should support 2 kind of cep",
1206 nep.getSupportedCepLayerProtocolQualifier(),
1207 hasItems(PHOTONICLAYERQUALIFIEROMS.class));
1208 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1209 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1210 checkCommonPartOfNep(nep, withSip);
1213 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean withSip) {
1214 assertEquals("link port direction should be DIRECTIONAL",
1215 PortDirection.BIDIRECTIONAL, nep.getLinkPortDirection());
1216 assertEquals("administrative state should be UNLOCKED",
1217 AdministrativeState.UNLOCKED, nep.getAdministrativeState());
1218 assertEquals("termination state should be TERMINATED BIDIRECTIONAL",
1219 TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState());
1220 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, nep.getLifecycleState());
1222 assertEquals("Given nep should support 1 SIP", 1, nep.getMappedServiceInterfacePoint().size());
1224 assertEquals("termination direction should be BIDIRECTIONAL",
1225 TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection());
1226 assertEquals("operational state of client nep should be ENABLED",
1227 OperationalState.ENABLED, nep.getOperationalState());
1228 assertEquals("link-port-role of client nep should be SYMMETRIC",
1229 PortRole.SYMMETRIC, nep.getLinkPortRole());
1232 private void checkTransitionalLink(org.opendaylight.yang.gen.v1
1233 .urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1234 Uuid node1Uuid, Uuid node2Uuid, String tp1, String tp2, String ietfNodeId) {
1235 Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((tp1 + "to" + tp2)
1236 .getBytes(Charset.forName("UTF-8"))).toString());
1237 assertEquals("bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2, linkUuid, link.getUuid());
1238 assertEquals("Available capacity unit should be GBPS",
1239 CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
1240 assertEquals("Available capacity -total size value should be 100",
1241 Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue());
1242 assertEquals("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1243 2, link.getTransitionedLayerProtocolName().size());
1244 assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1245 link.getTransitionedLayerProtocolName(),
1246 hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));
1247 assertEquals("transitional link should be BIDIRECTIONAL",
1248 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1249 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1250 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1251 assertEquals("topology uuid should be the same for the two termination point of the link",
1252 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1253 assertEquals("topology uuid should be the same for the two termination point of the link",
1254 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1255 assertThat("transitional links should terminate on DSR node and Photonic node",
1256 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1257 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1258 assertThat("transitional links should terminate on DSR node and Photonic node",
1259 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1260 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1261 Uuid nep1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1.getBytes(Charset.forName("UTF-8"))).toString());
1262 Uuid nep2Uuid = new Uuid(UUID.nameUUIDFromBytes(tp2.getBytes(Charset.forName("UTF-8"))).toString());
1263 assertThat("transitional links should terminate on " + tp1 + " and " + tp2 + " neps",
1264 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1265 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1266 assertThat("transitional links should terminate on DSR node and Photonic node",
1267 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1268 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1272 private void checkOmsLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1273 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1275 assertEquals("bad name for the link", linkName, link.getName().get(
1276 new NameKey("OMS link name")).getValue());
1277 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1278 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1279 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1280 assertEquals("otn tapi link should be BIDIRECTIONAL",
1281 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1282 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1283 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1284 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
1285 assertEquals("topology uuid should be the same for the two termination point of the link",
1286 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1287 assertEquals("topology uuid should be the same for the two termination point of the link",
1288 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1289 assertThat("oms links should terminate on two distinct nodes",
1290 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1291 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1292 assertThat("oms links should terminate on two distinct nodes",
1293 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1294 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1295 assertThat("oms links should terminate on two distinct tps",
1296 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1297 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1298 assertThat("oms links should terminate on two distinct tps",
1299 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1300 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1303 private void checkXpdrRdmLink(org.opendaylight.yang.gen.v1.urn
1304 .onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1305 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1307 assertEquals("bad name for the link", linkName, link.getName().get(
1308 new NameKey("XPDR-RDM link name")).getValue());
1309 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1310 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1311 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
1312 assertEquals("otn tapi link should be BIDIRECTIONAL",
1313 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1314 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1315 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1316 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
1317 assertEquals("topology uuid should be the same for the two termination point of the link",
1318 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1319 assertEquals("topology uuid should be the same for the two termination point of the link",
1320 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1321 assertThat("oms links should terminate on two distinct nodes",
1322 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1323 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1324 assertThat("oms links should terminate on two distinct nodes",
1325 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1326 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1327 assertThat("oms links should terminate on two distinct tps",
1328 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1329 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1330 assertThat("oms links should terminate on two distinct tps",
1331 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1332 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1335 private Node changeTerminationPointState(Node initialNode, String tpid, String tpid1, AdminStates admin,
1337 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
1338 = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
1339 initialNode.augmentation(Node1.class));
1340 Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
1341 TerminationPointBuilder tpBldr = new TerminationPointBuilder(
1342 tps.get(new TerminationPointKey(new TpId(tpid))));
1343 tpBldr.addAugmentation(new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class))
1344 .setAdministrativeState(admin)
1345 .setOperationalState(oper)
1347 tps.replace(tpBldr.key(), tpBldr.build());
1348 TerminationPointBuilder tpBldr1 = new TerminationPointBuilder(
1349 tps.get(new TerminationPointKey(new TpId(tpid1))));
1350 tpBldr1.addAugmentation(new TerminationPoint1Builder(tpBldr1.augmentation(TerminationPoint1.class))
1351 .setAdministrativeState(admin)
1352 .setOperationalState(oper)
1354 tps.replace(tpBldr1.key(), tpBldr1.build());
1355 tpdr1Bldr.setTerminationPoint(tps);
1356 return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();