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.tapi.TapiStringConstants;
41 import org.opendaylight.transportpce.tapi.utils.TapiLink;
42 import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils;
43 import org.opendaylight.transportpce.test.AbstractTest;
44 import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1Builder;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmLinkType;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmTpType;
52 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
53 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
54 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
55 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
56 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
57 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
58 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeBuilder;
59 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeKey;
60 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
61 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1;
62 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
63 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
64 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.LinkKey;
65 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
66 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointBuilder;
67 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointKey;
68 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
69 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
79 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
80 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
81 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
82 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
83 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU0;
84 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
85 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
86 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
87 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
88 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
89 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
90 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
91 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
92 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
93 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
94 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint;
95 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
96 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
97 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
98 import org.opendaylight.yangtools.yang.common.Uint64;
99 import org.slf4j.Logger;
100 import org.slf4j.LoggerFactory;
102 public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
103 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToFullTapiTopoTest.class);
105 private static Node otnMuxA;
106 private static Node otnSwitch;
107 private static Node tpdr100G;
108 private static Node roadmA;
109 private static Node roadmC;
110 private static Network openroadmNet;
111 private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
112 .networks.network.Link> ortopoLinks;
113 private static Uuid topologyUuid;
114 private static NetworkTransactionService networkTransactionService;
115 private static TapiLink tapiLink;
116 private static DataBroker dataBroker = getDataBroker();
119 public static void setUp() throws InterruptedException, ExecutionException {
120 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
121 TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
122 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
123 TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II);
124 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
125 TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
126 TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
127 TapiTopologyDataUtils.PORTMAPPING_FILE);
129 KeyedInstanceIdentifier<Node, NodeKey> muxAIID = InstanceIdentifier.create(Networks.class)
130 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
131 .class, new NetworkKey(new NetworkId("otn-topology")))
132 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR1")));
133 FluentFuture<Optional<Node>> muxAFuture = dataBroker.newReadOnlyTransaction()
134 .read(LogicalDatastoreType.CONFIGURATION, muxAIID);
135 otnMuxA = muxAFuture.get().get();
136 KeyedInstanceIdentifier<Node, NodeKey> muxCIID = InstanceIdentifier.create(Networks.class)
137 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
138 .class, new NetworkKey(new NetworkId("otn-topology")))
139 .child(Node.class, new NodeKey(new NodeId("SPDR-SC1-XPDR1")));
140 FluentFuture<Optional<Node>> muxCFuture = dataBroker.newReadOnlyTransaction()
141 .read(LogicalDatastoreType.CONFIGURATION, muxCIID);
142 muxCFuture.get().get();
143 KeyedInstanceIdentifier<Node, NodeKey> switchIID = InstanceIdentifier.create(Networks.class)
144 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
145 .class, new NetworkKey(new NetworkId("otn-topology")))
146 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR2")));
147 FluentFuture<Optional<Node>> switchFuture = dataBroker.newReadOnlyTransaction()
148 .read(LogicalDatastoreType.CONFIGURATION, switchIID);
149 otnSwitch = switchFuture.get().get();
150 KeyedInstanceIdentifier<Node, NodeKey> roadmaIID = InstanceIdentifier.create(Networks.class)
151 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
152 .class, new NetworkKey(new NetworkId("openroadm-network")))
153 .child(Node.class, new NodeKey(new NodeId("ROADM-A1")));
154 FluentFuture<Optional<Node>> roadmaFuture = dataBroker.newReadOnlyTransaction()
155 .read(LogicalDatastoreType.CONFIGURATION, roadmaIID);
156 roadmA = roadmaFuture.get().get();
157 KeyedInstanceIdentifier<Node, NodeKey> roadmcIID = InstanceIdentifier.create(Networks.class)
158 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
159 .class, new NetworkKey(new NetworkId("openroadm-network")))
160 .child(Node.class, new NodeKey(new NodeId("ROADM-C1")));
161 FluentFuture<Optional<Node>> roadmcFuture = dataBroker.newReadOnlyTransaction()
162 .read(LogicalDatastoreType.CONFIGURATION, roadmcIID);
163 roadmC = roadmcFuture.get().get();
165 KeyedInstanceIdentifier<Node, NodeKey> tpdrIID = InstanceIdentifier.create(Networks.class)
166 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
167 .class, new NetworkKey(new NetworkId("otn-topology")))
168 .child(Node.class, new NodeKey(new NodeId("XPDR-A1-XPDR1")));
169 FluentFuture<Optional<Node>> tpdrFuture = dataBroker.newReadOnlyTransaction()
170 .read(LogicalDatastoreType.CONFIGURATION, tpdrIID);
171 tpdr100G = tpdrFuture.get().get();
173 InstanceIdentifier<Network1> linksIID = InstanceIdentifier.create(Networks.class)
174 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
175 .class, new NetworkKey(new NetworkId("otn-topology")))
176 .augmentation(Network1.class);
177 FluentFuture<Optional<Network1>> linksFuture = dataBroker.newReadOnlyTransaction()
178 .read(LogicalDatastoreType.CONFIGURATION, linksIID);
179 linksFuture.get().get().getLink();
181 InstanceIdentifier<Network1> links1IID = InstanceIdentifier.create(Networks.class)
182 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
183 .class, new NetworkKey(new NetworkId("openroadm-topology")))
184 .augmentation(Network1.class);
185 FluentFuture<Optional<Network1>> links1Future = dataBroker.newReadOnlyTransaction()
186 .read(LogicalDatastoreType.CONFIGURATION, links1IID);
187 ortopoLinks = links1Future.get().get().getLink();
189 InstanceIdentifier<Network> ortopo1IID = InstanceIdentifier.create(Networks.class)
190 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
191 .class, new NetworkKey(new NetworkId("openroadm-topology")));
192 FluentFuture<Optional<Network>> ortopoFuture = dataBroker.newReadOnlyTransaction()
193 .read(LogicalDatastoreType.CONFIGURATION, ortopo1IID);
194 openroadmNet = ortopoFuture.get().get();
196 topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
197 Charset.forName("UTF-8"))).toString());
198 networkTransactionService = new NetworkTransactionImpl(getDataBroker());
199 tapiLink = new TapiLink(networkTransactionService);
200 LOG.info("TEST SETUP READY");
204 public void convertNodeWhenNoStates() {
205 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1", null, null);
206 List<String> networkPortList = new ArrayList<>();
207 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
208 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
209 networkPortList.add(tp.getTpId().getValue());
212 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
213 tapiFactory.convertNode(tpdr, networkPortList);
215 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
217 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
218 .getTapiNodes().get(new
219 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
220 Uuid enetworkNepUuid = new Uuid(
221 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
223 Uuid inetworkNepUuid = new Uuid(
224 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
226 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
227 assertNull("Administrative State should not be present", enepN.getAdministrativeState());
228 assertNull("Operational State should not be present", enepN.getOperationalState());
230 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
231 assertNull("Administrative State should not be present", inepN.getAdministrativeState());
232 assertNull("Operational State should not be present", inepN.getOperationalState());
234 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
236 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
237 .getTapiNodes().get(new
238 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
239 Uuid enepUuid = new Uuid(
240 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
242 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
243 assertNull("Administrative State should not be present", enep.getAdministrativeState());
244 assertNull("Operational State should not be present", enep.getOperationalState());
246 Uuid inepUuid = new Uuid(
247 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
249 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
250 assertNull("Administrative State should not be present", inep.getAdministrativeState());
251 assertNull("Operational State should not be present", inep.getOperationalState());
253 Uuid photnepUuid = new Uuid(
254 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
256 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
257 assertNull("Administrative State should not be present", photnep.getAdministrativeState());
258 assertNull("Operational State should not be present", photnep.getOperationalState());
262 public void convertNodeWhenBadStates1() {
263 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
264 AdminStates.OutOfService, State.OutOfService);
265 List<String> networkPortList = new ArrayList<>();
266 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
267 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
268 networkPortList.add(tp.getTpId().getValue());
271 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
272 tapiFactory.convertNode(tpdr, networkPortList);
274 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
276 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
277 .getTapiNodes().get(new
278 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
279 Uuid enetworkNepUuid = new Uuid(
280 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
282 Uuid inetworkNepUuid = new Uuid(
283 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
285 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
286 assertEquals("Administrative State should be Locked",
287 AdministrativeState.LOCKED, enepN.getAdministrativeState());
288 assertEquals("Operational State should be Disabled",
289 OperationalState.DISABLED, enepN.getOperationalState());
291 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
292 assertEquals("Administrative State should be Locked",
293 AdministrativeState.LOCKED, inepN.getAdministrativeState());
294 assertEquals("Operational State should be Disabled",
295 OperationalState.DISABLED, inepN.getOperationalState());
297 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
299 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
300 .getTapiNodes().get(new
301 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
302 Uuid enepUuid = new Uuid(
303 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
305 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
306 assertEquals("Administrative State should be Locked",
307 AdministrativeState.LOCKED, enep.getAdministrativeState());
308 assertEquals("Operational State should be Disabled",
309 OperationalState.DISABLED, enep.getOperationalState());
311 Uuid inepUuid = new Uuid(
312 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
314 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
315 assertEquals("Administrative State should be Locked",
316 AdministrativeState.LOCKED, inep.getAdministrativeState());
317 assertEquals("Operational State should be Disabled",
318 OperationalState.DISABLED, inep.getOperationalState());
320 Uuid photnepUuid = new Uuid(
321 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
323 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
324 assertEquals("Administrative State should be Locked",
325 AdministrativeState.LOCKED, photnep.getAdministrativeState());
326 assertEquals("Operational State should be Disabled",
327 OperationalState.DISABLED, photnep.getOperationalState());
331 public void convertNodeWhenBadStates2() {
332 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
333 AdminStates.Maintenance, State.Degraded);
334 List<String> networkPortList = new ArrayList<>();
335 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
336 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
337 networkPortList.add(tp.getTpId().getValue());
340 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
341 tapiFactory.convertNode(tpdr, networkPortList);
343 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
345 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
346 .getTapiNodes().get(new
347 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
348 Uuid enetworkNepUuid = new Uuid(
349 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
351 Uuid inetworkNepUuid = new Uuid(
352 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
354 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
355 assertEquals("Administrative State should be Locked",
356 AdministrativeState.LOCKED, enepN.getAdministrativeState());
357 assertEquals("Operational State should be Disabled",
358 OperationalState.DISABLED, enepN.getOperationalState());
360 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
361 assertEquals("Administrative State should be Locked",
362 AdministrativeState.LOCKED, inepN.getAdministrativeState());
363 assertEquals("Operational State should be Disabled",
364 OperationalState.DISABLED, inepN.getOperationalState());
366 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
368 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
369 .getTapiNodes().get(new
370 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
371 Uuid enepUuid = new Uuid(
372 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
374 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
375 assertEquals("Administrative State should be Locked",
376 AdministrativeState.LOCKED, enep.getAdministrativeState());
377 assertEquals("Operational State should be Disabled",
378 OperationalState.DISABLED, enep.getOperationalState());
380 Uuid inepUuid = new Uuid(
381 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
383 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
384 assertEquals("Administrative State should be Locked",
385 AdministrativeState.LOCKED, inep.getAdministrativeState());
386 assertEquals("Operational State should be Disabled",
387 OperationalState.DISABLED, inep.getOperationalState());
389 Uuid photnepUuid = new Uuid(
390 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
392 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
393 assertEquals("Administrative State should be Locked",
394 AdministrativeState.LOCKED, photnep.getAdministrativeState());
395 assertEquals("Operational State should be Disabled",
396 OperationalState.DISABLED, photnep.getOperationalState());
400 public void convertNodeForTransponder100G() {
401 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
402 List<String> networkPortList = new ArrayList<>();
403 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
404 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
405 networkPortList.add(tp.getTpId().getValue());
408 tapiFactory.convertNode(tpdr100G, networkPortList);
409 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
410 = tapiFactory.getTapiNodes().values().stream()
411 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
412 .collect(Collectors.toList());
414 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
415 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
417 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
419 checkDsrNode(tapiNodes.get(1), dsrNodeUuid, "tpdr", "XPDR-A1-XPDR1");
420 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
422 checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "tpdr", "XPDR-A1-XPDR1");
424 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
425 = tapiFactory.getTapiLinks().values().stream()
426 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
427 .collect(Collectors.toList());
428 checkTransitionalLink(tapiLinks.get(1), dsrNodeUuid, otsiNodeUuid,
429 "XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1", "XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1", "XPDR-A1-XPDR1");
433 public void convertNodeForOtnMuxponder() {
434 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
435 List<String> networkPortList = new ArrayList<>();
436 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
437 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
438 networkPortList.add(tp.getTpId().getValue());
441 tapiFactory.convertNode(otnMuxA, networkPortList);
442 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
443 = tapiFactory.getTapiNodes().values().stream()
444 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
445 .collect(Collectors.toList());
447 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
448 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
449 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
451 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "mux", "SPDR-SA1-XPDR1");
452 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
454 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "mux", "SPDR-SA1-XPDR1");
456 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
457 = tapiFactory.getTapiLinks().values().stream()
458 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
459 .collect(Collectors.toList());
460 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
461 "SPDR-SA1-XPDR1+iODU+XPDR1-NETWORK1", "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1", "SPDR-SA1-XPDR1");
465 public void convertNodeForOtnSwitch() {
466 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
467 List<String> networkPortList = new ArrayList<>();
468 for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
469 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
470 networkPortList.add(tp.getTpId().getValue());
473 tapiFactory.convertNode(otnSwitch, networkPortList);
474 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
475 = tapiFactory.getTapiNodes().values().stream()
476 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
477 .collect(Collectors.toList());
479 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
480 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
482 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+DSR".getBytes(Charset.forName("UTF-8")))
484 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "switch", "SPDR-SA1-XPDR2");
485 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+OTSi".getBytes(Charset.forName("UTF-8")))
487 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "switch", "SPDR-SA1-XPDR2");
489 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
490 = tapiFactory.getTapiLinks().values().stream()
491 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
492 .collect(Collectors.toList());
493 checkTransitionalLink(tapiLinks.get(2), dsrNodeUuid, otsiNodeUuid,
494 "SPDR-SA1-XPDR2+iODU+XPDR2-NETWORK4", "SPDR-SA1-XPDR2+iOTSi+XPDR2-NETWORK4", "SPDR-SA1-XPDR2");
498 public void convertNodeForRoadmWhenNoOtnMuxAttached() {
499 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
500 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
502 assertEquals("Node list size should be 1", 1, tapiFactory.getTapiNodes().size());
503 assertEquals("Link list size should be empty", 0, tapiFactory.getTapiLinks().size());
504 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
505 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
506 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
507 .getBytes(Charset.forName("UTF-8"))).toString());
508 checkOtsiNode(tapiNodes.get(0), roadmNodeUuid, "roadm", "ROADM-A1");
512 public void convertNodeForRoadmWhenRoadmNeighborAttached() {
513 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
514 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
515 tapiFactory.convertRoadmNode(roadmC, openroadmNet);
517 List<Link> rdmTordmLinkList = ortopoLinks.values().stream()
518 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
519 .collect(Collectors.toList());
520 tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
522 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
523 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
525 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
526 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
527 Uuid roadmaNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
528 .getBytes(Charset.forName("UTF-8"))).toString());
529 checkOtsiNode(tapiNodes.get(1), roadmaNodeUuid, "roadm", "ROADM-A1");
531 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
532 = tapiFactory.getTapiLinks().values().stream()
533 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
534 .collect(Collectors.toList());
535 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
537 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-C1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
539 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
540 .getBytes(Charset.forName("UTF-8"))).toString());
541 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
542 .getBytes(Charset.forName("UTF-8"))).toString());
544 new Uuid(UUID.nameUUIDFromBytes(
545 "ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
546 .getBytes(Charset.forName("UTF-8"))).toString());
547 checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
548 "ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX");
552 public void convertNodeForRoadmWhenOtnMuxAttached() {
553 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
554 List<String> networkPortListA = new ArrayList<>();
555 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
556 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
557 networkPortListA.add(tp.getTpId().getValue());
560 tapiFactory.convertNode(otnMuxA, networkPortListA);
561 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
562 List<Link> xponderOutLinkList = ortopoLinks.values().stream()
563 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
564 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
565 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
566 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
567 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
568 .collect(Collectors.toList());
569 List<Link> xponderInLinkList = ortopoLinks.values().stream()
570 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
571 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
572 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
573 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
574 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
575 .collect(Collectors.toList());
576 xponderInLinkList.addAll(xponderOutLinkList);
577 tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
578 assertEquals("Node list size should be 3", 3, tapiFactory.getTapiNodes().size());
579 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
580 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
581 = tapiFactory.getTapiNodes().values().stream()
582 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
583 .collect(Collectors.toList());
584 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
585 .getBytes(Charset.forName("UTF-8"))).toString());
586 checkOtsiNode(tapiNodes.get(1), roadmNodeUuid, "roadm", "ROADM-A1");
588 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
589 = tapiFactory.getTapiLinks().values().stream()
590 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
591 .collect(Collectors.toList());
592 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
594 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
596 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
597 .getBytes(Charset.forName("UTF-8"))).toString());
598 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRX")
599 .getBytes(Charset.forName("UTF-8"))).toString());
601 new Uuid(UUID.nameUUIDFromBytes(
602 "ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
603 .getBytes(Charset.forName("UTF-8"))).toString());
604 checkXpdrRdmLink(links.get(1), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
605 "ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1");
608 private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
609 Uuid nodeUuid, String dsrNodeType, String nodeId) {
610 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
611 assertEquals("incorrect node name", nodeId + "+DSR", node.getName().get(
612 new NameKey("dsr/odu node name")).getValue());
613 assertEquals("administrative state should be UNLOCKED",
614 AdministrativeState.UNLOCKED, node.getAdministrativeState());
615 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
616 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
617 assertThat("one value-name should be 'dsr/odu node name'",
618 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("dsr/odu node name")));
619 assertEquals("dsr node should manage 2 protocol layers : dsr and odu",
620 2, node.getLayerProtocolName().size());
621 assertThat("dsr node should manage 2 protocol layers : dsr and odu",
622 node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
623 List<OwnedNodeEdgePoint> inepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
624 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint_N")))
625 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
626 .collect(Collectors.toList());
627 List<OwnedNodeEdgePoint> enepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
628 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint_N")))
629 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
630 .collect(Collectors.toList());
631 List<OwnedNodeEdgePoint> nepsC;
632 switch (dsrNodeType) {
634 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
635 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
636 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
637 .collect(Collectors.toList());
638 assertEquals("Switch-DSR node should have 4 eNEPs network", 4, enepsN.size());
639 assertEquals("Switch-DSR node should have 4 iNEPs network", 4, inepsN.size());
640 assertEquals("Switch-DSR node should have 4 NEPs client", 4, nepsC.size());
641 OwnedNodeEdgePoint nep1 = nepsC.get(2);
642 Uuid client4NepUuid = new Uuid(
643 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
645 checkNepClient100GSwitch(nep1, client4NepUuid, nodeId + "+DSR+XPDR2-CLIENT4", "NodeEdgePoint_C");
646 OwnedNodeEdgePoint enep2 = enepsN.get(2);
647 OwnedNodeEdgePoint inep2 = inepsN.get(3);
648 Uuid enetworkNepUuid = new Uuid(
649 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
651 Uuid inetworkNepUuid = new Uuid(
652 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
654 checkNepeODU4(enep2, enetworkNepUuid, nodeId + "+eODU+XPDR2-CLIENT4", "eNodeEdgePoint_N", false);
655 checkNepNetworkODU4(inep2, inetworkNepUuid, nodeId + "+iODU+XPDR2-NETWORK1", "iNodeEdgePoint_N", true);
656 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
657 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
658 .collect(Collectors.toList());
659 checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, enetworkNepUuid, nodeUuid);
662 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
663 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
664 .sorted((nep3, nep4) -> nep3.getUuid().getValue().compareTo(nep4.getUuid().getValue()))
665 .collect(Collectors.toList());
666 assertEquals("Mux-DSR node should have 4 eNEP network", 4, enepsN.size());
667 assertEquals("Mux-DSR node should have 1 iNEP network", 1, inepsN.size());
668 assertEquals("Mux-DSR node should have 4 NEPs client", 4, nepsC.size());
669 OwnedNodeEdgePoint nep3 = nepsC.get(2);
670 Uuid client3NepUuid = new Uuid(
671 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
673 checkNepClient10G(nep3, client3NepUuid, nodeId + "+DSR+XPDR1-CLIENT3", "NodeEdgePoint_C");
674 OwnedNodeEdgePoint enep4 = enepsN.get(3);
675 OwnedNodeEdgePoint inep4 = inepsN.get(0);
676 Uuid enetworkNepUuid2 = new Uuid(
677 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
679 Uuid inetworkNepUuid2 = new Uuid(
680 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
682 checkNepeODU4(enep4, enetworkNepUuid2, nodeId + "+eODU+XPDR1-CLIENT3", "eNodeEdgePoint_N", false);
683 checkNepNetworkODU4(inep4, inetworkNepUuid2, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
685 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
686 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
687 .collect(Collectors.toList());
688 checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, enetworkNepUuid2, nodeUuid);
691 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
692 .filter(n -> n.getName().containsKey(new NameKey("100G-tpdr")))
693 .sorted((nep5, nep6) -> nep5.getUuid().getValue().compareTo(nep6.getUuid().getValue()))
694 .collect(Collectors.toList());
695 assertEquals("Tpdr-DSR node should have 2 eNEPs network", 2, enepsN.size());
696 assertEquals("Tpdr-DSR node should have 2 iNEPs network", 2, inepsN.size());
697 assertEquals("Tpdr-DSR node should have 2 NEPs client", 2, nepsC.size());
698 OwnedNodeEdgePoint nep5 = nepsC.get(0);
699 Uuid client1NepUuid = new Uuid(
700 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
702 checkNepClient100GTpdr(nep5, client1NepUuid, nodeId + "+DSR+XPDR1-CLIENT1", "100G-tpdr");
703 OwnedNodeEdgePoint enep6 = enepsN.get(0);
704 OwnedNodeEdgePoint inep6 = inepsN.get(1);
705 Uuid enetworkNepUuid3 = new Uuid(
706 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
708 Uuid inetworkNepUuid3 = new Uuid(
709 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
711 checkNepeODU4(enep6, enetworkNepUuid3, nodeId + "+eODU+XPDR1-CLIENT1", "eNodeEdgePoint_N", false);
712 checkNepNetworkODU4(inep6, inetworkNepUuid3, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
714 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
715 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
716 .collect(Collectors.toList());
717 checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, enetworkNepUuid3, nodeUuid);
725 private void checkOtsiNode(
726 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
727 Uuid nodeUuid, String otsiNodeType, String nodeId) {
728 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
729 List<OwnedNodeEdgePoint> nepsI = null;
730 List<OwnedNodeEdgePoint> nepsE = null;
731 List<OwnedNodeEdgePoint> nepsP = null;
732 List<OwnedNodeEdgePoint> nepsMc = null;
733 List<OwnedNodeEdgePoint> nepsOtsimc = null;
734 List<OwnedNodeEdgePoint> nepsPhot = null;
735 if (!otsiNodeType.equals("roadm")) {
736 assertEquals("incorrect node name", nodeId + "+OTSi", node.getName().get(
737 new NameKey("otsi node name")).getValue());
738 assertThat("one value-name should be 'dsr/odu node name'",
739 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("otsi node name")));
740 nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
741 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
742 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
743 .collect(Collectors.toList());
744 nepsE = node.nonnullOwnedNodeEdgePoint().values().stream()
745 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint")))
746 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
747 .collect(Collectors.toList());
748 nepsP = node.nonnullOwnedNodeEdgePoint().values().stream()
749 .filter(n -> n.getName().containsKey(new NameKey("PhotMedNodeEdgePoint")))
750 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
751 .collect(Collectors.toList());
753 assertEquals("incorrect node name", nodeId + "+PHOTONIC_MEDIA", node.getName().get(
754 new NameKey("roadm node name")).getValue());
755 assertThat("one value-name should be 'dsr/odu node name'",
756 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("roadm node name")));
757 nepsMc = node.nonnullOwnedNodeEdgePoint().values().stream()
758 .filter(n -> n.getName().containsKey(new NameKey("MEDIA_CHANNELNodeEdgePoint")))
759 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
760 .collect(Collectors.toList());
761 nepsOtsimc = node.nonnullOwnedNodeEdgePoint().values().stream()
762 .filter(n -> n.getName().containsKey(new NameKey("OTSi_MEDIA_CHANNELNodeEdgePoint")))
763 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
764 .collect(Collectors.toList());
765 nepsPhot = node.nonnullOwnedNodeEdgePoint().values().stream()
766 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIANodeEdgePoint")))
767 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
768 .collect(Collectors.toList());
770 assertEquals("administrative state should be UNLOCKED",
771 AdministrativeState.UNLOCKED, node.getAdministrativeState());
772 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
773 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
774 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
775 1, node.getLayerProtocolName().size());
776 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
777 LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().stream().findFirst().get());
779 switch (otsiNodeType) {
781 assertEquals("Switch-OTSi node should have 4 eNEPs", 4, nepsE.size());
782 assertEquals("Switch-OTSi node should have 4 iNEPs", 4, nepsI.size());
783 assertEquals("Switch-OTSi node should have 4 photNEPs", 4, nepsP.size());
784 OwnedNodeEdgePoint nep1 = nepsI.get(1);
785 Uuid inepUuid = new Uuid(
786 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
788 checkNepOtsiNode(nep1, inepUuid, nodeId + "+iOTSi+XPDR2-NETWORK2", "iNodeEdgePoint", true);
789 OwnedNodeEdgePoint nep2 = nepsE.get(0);
790 Uuid enepUuid = new Uuid(
791 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
793 checkNepOtsiNode(nep2, enepUuid, nodeId + "+eOTSi+XPDR2-NETWORK2", "eNodeEdgePoint", false);
794 OwnedNodeEdgePoint photNep = nepsP.get(1);
795 Uuid pnepUuid = new Uuid(
796 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2")
797 .getBytes(Charset.forName("UTF-8"))).toString());
798 checkNepOtsiNode(photNep, pnepUuid, nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2", "PhotMedNodeEdgePoint",
800 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
801 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
802 .collect(Collectors.toList());
803 checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
806 assertEquals("Mux-OTSi node should have 1 eNEP", 1, nepsE.size());
807 assertEquals("Mux-OTSi node should have 1 iNEPs", 1, nepsI.size());
808 assertEquals("Mux-OTSi node should have 1 photNEPs", 1, nepsP.size());
809 OwnedNodeEdgePoint nep3 = nepsE.get(0);
810 Uuid enepUuid2 = new Uuid(
811 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
813 checkNepOtsiNode(nep3, enepUuid2, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
814 OwnedNodeEdgePoint nep4 = nepsI.get(0);
815 Uuid inepUuid2 = new Uuid(
816 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
818 checkNepOtsiNode(nep4, inepUuid2, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
819 OwnedNodeEdgePoint photNep1 = nepsP.get(0);
820 Uuid pnep1Uuid = new Uuid(
821 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
822 .getBytes(Charset.forName("UTF-8"))).toString());
823 checkNepOtsiNode(photNep1, pnep1Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
825 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
826 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
827 .collect(Collectors.toList());
828 checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
831 assertEquals("Tpdr-OTSi node should have 2 eNEPs", 2, nepsE.size());
832 assertEquals("Tpdr-OTSi node should have 2 iNEPs", 2, nepsI.size());
833 assertEquals("Tpdr-OTSi node should have 2 photNEPs", 2, nepsP.size());
834 OwnedNodeEdgePoint nep5 = nepsE.get(0);
835 Uuid enepUuid3 = new Uuid(
836 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
838 checkNepOtsiNode(nep5, enepUuid3, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
839 OwnedNodeEdgePoint nep6 = nepsI.get(0);
840 Uuid inepUuid3 = new Uuid(
841 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
843 checkNepOtsiNode(nep6, inepUuid3, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
844 OwnedNodeEdgePoint photNep2 = nepsP.get(0);
845 Uuid pnep2Uuid = new Uuid(
846 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
847 .getBytes(Charset.forName("UTF-8"))).toString());
848 checkNepOtsiNode(photNep2, pnep2Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
850 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
851 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
852 .collect(Collectors.toList());
853 checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
856 assertEquals("Roadm node should have 10 MC NEPs", 10, nepsMc.size());
857 assertEquals("Roadm node should have 10 OTSiMC NEPs", 10, nepsOtsimc.size());
858 assertEquals("Roadm node should have 10 PHOT_MEDIA NEPs", 10, nepsPhot.size());
860 OwnedNodeEdgePoint nep7 = nepsMc.get(6);
861 Uuid mcnepUuid3 = new Uuid(
862 UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX").getBytes(Charset.forName("UTF-8")))
864 checkNepOtsiRdmNode(nep7, mcnepUuid3, nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX",
865 "MEDIA_CHANNELNodeEdgePoint", false);
866 OwnedNodeEdgePoint nep8 = nepsOtsimc.get(0);
867 Uuid otmcnepUuid3 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX")
868 .getBytes(Charset.forName("UTF-8"))).toString());
869 checkNepOtsiRdmNode(nep8, otmcnepUuid3, nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX",
870 "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
871 OwnedNodeEdgePoint photNep3 = nepsPhot.get(3);
872 Uuid pnep3Uuid = new Uuid(
873 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
874 .getBytes(Charset.forName("UTF-8"))).toString());
875 checkNepOtsiRdmNode(photNep3, pnep3Uuid, nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX",
876 "PHOTONIC_MEDIANodeEdgePoint", false);
878 OwnedNodeEdgePoint nep9 = nepsMc.get(0);
879 Uuid mcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX")
880 .getBytes(Charset.forName("UTF-8"))).toString());
881 checkNepOtsiRdmNode(nep9, mcnepUuid4, nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX",
882 "MEDIA_CHANNELNodeEdgePoint", true);
883 OwnedNodeEdgePoint nep10 = nepsOtsimc.get(9);
884 Uuid otmcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX")
885 .getBytes(Charset.forName("UTF-8"))).toString());
886 checkNepOtsiRdmNode(nep10, otmcnepUuid4, nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX",
887 "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
888 OwnedNodeEdgePoint photNep4 = nepsPhot.get(4);
889 Uuid pnep4Uuid = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX")
890 .getBytes(Charset.forName("UTF-8"))).toString());
891 checkNepOtsiRdmNode(photNep4, pnep4Uuid, nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX",
892 "PHOTONIC_MEDIANodeEdgePoint", false);
893 List<NodeRuleGroup> nrgList4 = node.nonnullNodeRuleGroup().values().stream()
894 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
895 .collect(Collectors.toList());
896 checkNodeRuleGroupForRdm(nrgList4, 30);
904 private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
905 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
906 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
907 Name name = nameList.get(0);
908 assertEquals("value of client nep should be '" + portName + "'",
909 portName, name.getValue());
910 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
911 nepName, name.getValueName());
912 assertEquals("Client nep should support 3 kind of cep",
913 3, nep.getSupportedCepLayerProtocolQualifier().size());
914 assertThat("client nep should support 3 kind of cep",
915 nep.getSupportedCepLayerProtocolQualifier(),
916 hasItems(ODUTYPEODU2.VALUE, ODUTYPEODU2E.VALUE, DIGITALSIGNALTYPE10GigELAN.VALUE));
917 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
918 checkCommonPartOfNep(nep, false);
921 private void checkNepeODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
923 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
924 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
925 Name name = nameList.get(0);
926 assertEquals("value of eODU nep should be '" + portName + "'",
927 portName, name.getValue());
928 assertEquals("value-name of eODU nep for '" + portName + "' should be '" + nepName + "'",
929 nepName, name.getValueName());
930 // TODO: depending on the type of node there is one type or another
931 assertThat("eODU nep should support 1, 2 or 3 kind of cep, depending on client port",
932 nep.getSupportedCepLayerProtocolQualifier().size(), anyOf(is(1), is(2), is(3)));
933 assertTrue("eODU nep should support 1 kind of cep",
934 nep.getSupportedCepLayerProtocolQualifier().stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.VALUE)
935 || splc.equals(ODUTYPEODU2.VALUE) || splc.equals(ODUTYPEODU2E.VALUE)
936 || splc.equals(ODUTYPEODU4.VALUE)));
937 assertEquals("eODU nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
938 checkCommonPartOfNep(nep, withSip);
941 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
943 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
944 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
945 Name name = nameList.get(0);
946 assertEquals("value of network nep should be '" + portName + "'",
947 portName, name.getValue());
948 assertEquals("value-name of network nep for '" + portName + "' should be '" + nepName + "'",
949 nepName, name.getValueName());
950 assertEquals("Network nep should support 1 kind of cep",
951 1, nep.getSupportedCepLayerProtocolQualifier().size());
952 assertThat("network nep should support 1 kind of cep",
953 nep.getSupportedCepLayerProtocolQualifier(),
954 hasItem(ODUTYPEODU4.VALUE));
955 assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
956 checkCommonPartOfNep(nep, withSip);
959 private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
961 assertEquals("transponder DSR should contain 2 node rule group", 2, nrgList.size());
962 for (NodeRuleGroup nodeRuleGroup : nrgList) {
963 assertEquals("each node-rule-group should contain 2 NEP for transponder DSR",
964 2, nodeRuleGroup.getNodeEdgePoint().size());
966 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
967 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
968 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
969 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
970 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
971 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
972 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
973 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
974 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
975 assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
976 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
977 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
978 assertEquals("node-rule-group nb 1 should contain a single rule", 1, rule.size());
979 assertEquals("local-id of the rule should be 'forward'",
980 "forward", rule.get(0).getLocalId());
981 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
982 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
983 assertEquals("the rule type should be 'FORWARDING'",
984 RuleType.FORWARDING, rule.get(0).getRuleType());
987 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
989 assertEquals("muxponder DSR should contain 4 node rule group", 4, nrgList.size());
990 for (NodeRuleGroup nodeRuleGroup : nrgList) {
991 assertEquals("each node-rule-group should contain 2 NEP for muxponder DSR",
992 2, nodeRuleGroup.getNodeEdgePoint().size());
994 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(2).nonnullNodeEdgePoint().values());
995 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
996 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
997 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
998 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
999 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1000 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1001 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
1002 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
1003 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
1004 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
1005 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
1006 assertEquals("node-rule-group nb 2 should contain a single rule", 1, rule.size());
1007 assertEquals("local-id of the rule should be 'forward'",
1008 "forward", rule.get(0).getLocalId());
1009 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1010 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
1011 assertEquals("the rule type should be 'FORWARDING'",
1012 RuleType.FORWARDING, rule.get(0).getRuleType());
1015 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1017 assertEquals("Switch-DSR should contain a single node rule group", 1, nrgList.size());
1018 assertEquals("Switch-DSR node-rule-group should contain 8 NEP", 8, nrgList.get(0).getNodeEdgePoint().size());
1019 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
1020 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
1021 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
1022 .collect(Collectors.toList());
1023 assertEquals("in the sorted node-rule-group, nep number 7 should be XPDR2-NETWORK1",
1024 networkNepUuid, nrg.get(6).getNodeEdgePointUuid());
1025 assertEquals("in the sorted node-rule-group, nep number 4 should be XPDR2-CLIENT4",
1026 clientNepUuid, nrg.get(3).getNodeEdgePointUuid());
1027 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1028 nodeUuid, nrg.get(4).getNodeUuid());
1029 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1030 nodeUuid, nrg.get(3).getNodeUuid());
1032 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1033 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1034 assertEquals("local-id of the rule should be 'forward'",
1035 "forward", ruleList.get(0).getLocalId());
1036 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1037 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1038 assertEquals("the rule type should be 'FORWARDING'",
1039 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1042 private void checkNodeRuleGroupForRdm(List<NodeRuleGroup> nrgList, int nbNeps) {
1043 assertEquals("RDM infra node - OTSi should contain a single node rule groups", 1, nrgList.size());
1045 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1046 assertEquals("RDM infra node -rule-group should contain " + nbNeps + " NEP",
1047 nbNeps, nodeEdgePointList.size());
1049 assertNull("RDM infra node -rule-group should contain no NEP", nrgList.get(0).getNodeEdgePoint());
1051 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1052 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1053 assertEquals("local-id of the rule should be 'forward'",
1054 "forward", ruleList.get(0).getLocalId());
1055 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1056 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1057 assertEquals("the rule type should be 'FORWARDING'",
1058 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1061 private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1063 assertEquals("Tpdr-OTSi should contain two node rule groups", 2, nrgList.size());
1064 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1065 assertEquals("Tpdr-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1066 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1067 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1068 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1069 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1070 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1071 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1072 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1073 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1074 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1075 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1076 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1077 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1078 assertEquals("local-id of the rule should be 'forward'",
1079 "forward", ruleList.get(0).getLocalId());
1080 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1081 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1082 assertEquals("the rule type should be 'FORWARDING'",
1083 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1086 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1088 assertEquals("Mux-OTSi should contain a single node rule group", 1, nrgList.size());
1089 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1090 assertEquals("Mux-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
1091 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1092 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1093 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1094 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1095 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1096 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1097 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1098 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
1099 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1100 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
1101 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1102 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
1103 assertEquals("local-id of the rule should be 'forward'",
1104 "forward", ruleList.get(0).getLocalId());
1105 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1106 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
1107 assertEquals("the rule type should be 'FORWARDING'",
1108 RuleType.FORWARDING, ruleList.get(0).getRuleType());
1111 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1113 assertEquals("Switch-OTSi should contain 4 node rule group", 4, nrgList.size());
1114 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1115 assertEquals("each node-rule-group should contain 2 NEP for Switch-OTSi",
1116 2, nodeRuleGroup.getNodeEdgePoint().size());
1118 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
1119 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1120 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
1121 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1122 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1123 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
1124 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1125 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1126 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1127 nodeUuid, nodeEdgePointList0.get(0).getNodeUuid());
1128 assertEquals("any item of the node-rule-group should have the same nodeUuid",
1129 nodeUuid, nodeEdgePointList0.get(1).getNodeUuid());
1130 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1131 assertEquals("node-rule-group should contain a single rule", 1, ruleList0.size());
1132 assertEquals("local-id of the rule should be 'forward'",
1133 "forward", ruleList0.get(0).getLocalId());
1134 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
1135 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList0.get(0).getForwardingRule());
1136 assertEquals("the rule type should be 'FORWARDING'",
1137 RuleType.FORWARDING, ruleList0.get(0).getRuleType());
1140 private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1141 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1142 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1143 assertEquals("value of client nep should be '" + portName + "'",
1144 portName, nameList.get(0).getValue());
1145 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
1146 nepName, nameList.get(0).getValueName());
1147 assertEquals("Client nep should support 2 kind of cep",
1148 2, nep.getSupportedCepLayerProtocolQualifier().size());
1149 assertThat("client nep should support 2 kind of cep",
1150 nep.getSupportedCepLayerProtocolQualifier(),
1151 hasItems(ODUTYPEODU4.VALUE, DIGITALSIGNALTYPE100GigE.VALUE));
1152 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
1153 checkCommonPartOfNep(nep, false);
1156 private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1157 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1158 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1159 assertEquals("value of client nep should be '" + portName + "'",
1160 portName, nameList.get(0).getValue());
1161 assertEquals("value-name of client nep for '" + portName + "' should be 100G-tpdr'",
1162 nepName, nameList.get(0).getValueName());
1163 assertEquals("Client nep should support 1 kind of cep",
1164 1, nep.getSupportedCepLayerProtocolQualifier().size());
1165 assertThat("client nep should support 2 kind of cep",
1166 nep.getSupportedCepLayerProtocolQualifier(),
1167 hasItems(DIGITALSIGNALTYPE100GigE.VALUE));
1168 assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
1169 checkCommonPartOfNep(nep, false);
1172 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1174 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1175 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1176 assertEquals("value of OTSi nep should be '" + portName + "'",
1177 portName, nameList.get(0).getValue());
1178 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1179 nepName, nameList.get(0).getValueName());
1180 assertEquals("OTSi nep should support 2 kind of cep",
1181 2, nep.getSupportedCepLayerProtocolQualifier().size());
1182 assertThat("OTSi nep should support 2 kind of cep",
1183 nep.getSupportedCepLayerProtocolQualifier(),
1184 hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE, PHOTONICLAYERQUALIFIEROTSi.VALUE));
1185 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1186 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1187 checkCommonPartOfNep(nep, withSip);
1190 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1192 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
1193 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1194 assertEquals("value of OTSi nep should be '" + portName + "'",
1195 portName, nameList.get(0).getValue());
1196 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
1197 nepName, nameList.get(0).getValueName());
1198 assertEquals("OTSi nep of RDM infra node should support only 1 kind of cep",
1199 1, nep.getSupportedCepLayerProtocolQualifier().size());
1200 assertThat("OTSi nep should support 2 kind of cep",
1201 nep.getSupportedCepLayerProtocolQualifier(),
1202 hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE));
1203 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
1204 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
1205 checkCommonPartOfNep(nep, withSip);
1208 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean withSip) {
1209 assertEquals("link port direction should be DIRECTIONAL",
1210 PortDirection.BIDIRECTIONAL, nep.getLinkPortDirection());
1211 assertEquals("administrative state should be UNLOCKED",
1212 AdministrativeState.UNLOCKED, nep.getAdministrativeState());
1213 assertEquals("termination state should be TERMINATED BIDIRECTIONAL",
1214 TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState());
1215 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, nep.getLifecycleState());
1217 assertEquals("Given nep should support 1 SIP", 1, nep.getMappedServiceInterfacePoint().size());
1219 assertEquals("termination direction should be BIDIRECTIONAL",
1220 TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection());
1221 assertEquals("operational state of client nep should be ENABLED",
1222 OperationalState.ENABLED, nep.getOperationalState());
1223 assertEquals("link-port-role of client nep should be SYMMETRIC",
1224 PortRole.SYMMETRIC, nep.getLinkPortRole());
1227 private void checkTransitionalLink(org.opendaylight.yang.gen.v1
1228 .urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1229 Uuid node1Uuid, Uuid node2Uuid, String tp1, String tp2, String ietfNodeId) {
1230 Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((tp1 + "to" + tp2)
1231 .getBytes(Charset.forName("UTF-8"))).toString());
1232 assertEquals("bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2, linkUuid, link.getUuid());
1233 assertEquals("Available capacity unit should be GBPS",
1234 CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
1235 assertEquals("Available capacity -total size value should be 100",
1236 Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue());
1237 assertEquals("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1238 2, link.getTransitionedLayerProtocolName().size());
1239 assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1240 link.getTransitionedLayerProtocolName(),
1241 hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));
1242 assertEquals("transitional link should be BIDIRECTIONAL",
1243 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1244 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1245 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1246 assertEquals("topology uuid should be the same for the two termination point of the link",
1247 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1248 assertEquals("topology uuid should be the same for the two termination point of the link",
1249 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1250 assertThat("transitional links should terminate on DSR node and Photonic node",
1251 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1252 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1253 assertThat("transitional links should terminate on DSR node and Photonic node",
1254 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1255 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1256 Uuid nep1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1.getBytes(Charset.forName("UTF-8"))).toString());
1257 Uuid nep2Uuid = new Uuid(UUID.nameUUIDFromBytes(tp2.getBytes(Charset.forName("UTF-8"))).toString());
1258 assertThat("transitional links should terminate on " + tp1 + " and " + tp2 + " neps",
1259 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1260 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1261 assertThat("transitional links should terminate on DSR node and Photonic node",
1262 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1263 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1267 private void checkOmsLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1268 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1270 assertEquals("bad name for the link", linkName, link.getName().get(
1271 new NameKey("OMS link name")).getValue());
1272 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1273 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1274 LayerProtocolName.PHOTONICMEDIA.getName(),
1275 link.getLayerProtocolName().stream().findFirst().get().getName());
1276 assertEquals("otn tapi link should be BIDIRECTIONAL",
1277 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1278 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1279 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1280 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
1281 assertEquals("topology uuid should be the same for the two termination point of the link",
1282 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1283 assertEquals("topology uuid should be the same for the two termination point of the link",
1284 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1285 assertThat("oms links should terminate on two distinct nodes",
1286 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1287 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1288 assertThat("oms links should terminate on two distinct nodes",
1289 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1290 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1291 assertThat("oms links should terminate on two distinct tps",
1292 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1293 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1294 assertThat("oms links should terminate on two distinct tps",
1295 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1296 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1299 private void checkXpdrRdmLink(org.opendaylight.yang.gen.v1.urn
1300 .onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1301 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
1303 assertEquals("bad name for the link", linkName, link.getName().get(
1304 new NameKey("XPDR-RDM link name")).getValue());
1305 assertEquals("bad uuid for link", linkUuid, link.getUuid());
1306 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
1307 LayerProtocolName.PHOTONICMEDIA.getName(),
1308 link.getLayerProtocolName().stream().findFirst().get().getName());
1309 assertEquals("otn tapi link should be BIDIRECTIONAL",
1310 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
1311 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1312 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1313 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
1314 assertEquals("topology uuid should be the same for the two termination point of the link",
1315 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
1316 assertEquals("topology uuid should be the same for the two termination point of the link",
1317 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
1318 assertThat("oms links should terminate on two distinct nodes",
1319 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1320 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1321 assertThat("oms links should terminate on two distinct nodes",
1322 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1323 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1324 assertThat("oms links should terminate on two distinct tps",
1325 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1326 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1327 assertThat("oms links should terminate on two distinct tps",
1328 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1329 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1332 private Node changeTerminationPointState(Node initialNode, String tpid, String tpid1, AdminStates admin,
1334 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
1335 = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
1336 initialNode.augmentation(Node1.class));
1337 Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
1338 TerminationPointBuilder tpBldr = new TerminationPointBuilder(
1339 tps.get(new TerminationPointKey(new TpId(tpid))));
1340 tpBldr.addAugmentation(new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class))
1341 .setAdministrativeState(admin)
1342 .setOperationalState(oper)
1344 tps.replace(tpBldr.key(), tpBldr.build());
1345 TerminationPointBuilder tpBldr1 = new TerminationPointBuilder(
1346 tps.get(new TerminationPointKey(new TpId(tpid1))));
1347 tpBldr1.addAugmentation(new TerminationPoint1Builder(tpBldr1.augmentation(TerminationPoint1.class))
1348 .setAdministrativeState(admin)
1349 .setOperationalState(oper)
1351 tps.replace(tpBldr1.key(), tpBldr1.build());
1352 tpdr1Bldr.setTerminationPoint(tps);
1353 return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();