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.jupiter.api.Assertions.assertEquals;
18 import static org.junit.jupiter.api.Assertions.assertNull;
19 import static org.junit.jupiter.api.Assertions.assertTrue;
20 import static org.junit.jupiter.api.Assertions.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.jupiter.api.BeforeAll;
34 import org.junit.jupiter.api.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.TapiLinkImpl;
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.rev230526.Link1;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.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.rev230526.OpenroadmLinkType;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.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 otnSwitch;
108 private static Node tpdr100G;
109 private static Node roadmA;
110 private static Node roadmC;
111 private static Network openroadmNet;
112 private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
113 .networks.network.Link> ortopoLinks;
114 private static Uuid topologyUuid;
115 private static NetworkTransactionService networkTransactionService;
116 private static TapiLink tapiLink;
117 private static DataBroker dataBroker = getDataBroker();
120 static void setUp() throws InterruptedException, ExecutionException {
121 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
122 TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
123 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
124 TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II);
125 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
126 TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
127 TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
128 TapiTopologyDataUtils.PORTMAPPING_FILE);
130 KeyedInstanceIdentifier<Node, NodeKey> muxAIID = InstanceIdentifier.create(Networks.class)
131 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
132 .class, new NetworkKey(new NetworkId("otn-topology")))
133 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR1")));
134 FluentFuture<Optional<Node>> muxAFuture = dataBroker.newReadOnlyTransaction()
135 .read(LogicalDatastoreType.CONFIGURATION, muxAIID);
136 otnMuxA = muxAFuture.get().orElseThrow();
137 KeyedInstanceIdentifier<Node, NodeKey> muxCIID = InstanceIdentifier.create(Networks.class)
138 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
139 .class, new NetworkKey(new NetworkId("otn-topology")))
140 .child(Node.class, new NodeKey(new NodeId("SPDR-SC1-XPDR1")));
141 FluentFuture<Optional<Node>> muxCFuture = dataBroker.newReadOnlyTransaction()
142 .read(LogicalDatastoreType.CONFIGURATION, muxCIID);
143 muxCFuture.get().orElseThrow();
144 KeyedInstanceIdentifier<Node, NodeKey> switchIID = InstanceIdentifier.create(Networks.class)
145 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
146 .class, new NetworkKey(new NetworkId("otn-topology")))
147 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR2")));
148 FluentFuture<Optional<Node>> switchFuture = dataBroker.newReadOnlyTransaction()
149 .read(LogicalDatastoreType.CONFIGURATION, switchIID);
150 otnSwitch = switchFuture.get().orElseThrow();
151 KeyedInstanceIdentifier<Node, NodeKey> roadmaIID = InstanceIdentifier.create(Networks.class)
152 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
153 .class, new NetworkKey(new NetworkId("openroadm-network")))
154 .child(Node.class, new NodeKey(new NodeId("ROADM-A1")));
155 FluentFuture<Optional<Node>> roadmaFuture = dataBroker.newReadOnlyTransaction()
156 .read(LogicalDatastoreType.CONFIGURATION, roadmaIID);
157 roadmA = roadmaFuture.get().orElseThrow();
158 KeyedInstanceIdentifier<Node, NodeKey> roadmcIID = InstanceIdentifier.create(Networks.class)
159 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
160 .class, new NetworkKey(new NetworkId("openroadm-network")))
161 .child(Node.class, new NodeKey(new NodeId("ROADM-C1")));
162 FluentFuture<Optional<Node>> roadmcFuture = dataBroker.newReadOnlyTransaction()
163 .read(LogicalDatastoreType.CONFIGURATION, roadmcIID);
164 roadmC = roadmcFuture.get().orElseThrow();
166 KeyedInstanceIdentifier<Node, NodeKey> tpdrIID = InstanceIdentifier.create(Networks.class)
167 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
168 .class, new NetworkKey(new NetworkId("otn-topology")))
169 .child(Node.class, new NodeKey(new NodeId("XPDR-A1-XPDR1")));
170 FluentFuture<Optional<Node>> tpdrFuture = dataBroker.newReadOnlyTransaction()
171 .read(LogicalDatastoreType.CONFIGURATION, tpdrIID);
172 tpdr100G = tpdrFuture.get().orElseThrow();
174 InstanceIdentifier<Network1> linksIID = InstanceIdentifier.create(Networks.class)
175 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
176 .class, new NetworkKey(new NetworkId("otn-topology")))
177 .augmentation(Network1.class);
178 FluentFuture<Optional<Network1>> linksFuture = dataBroker.newReadOnlyTransaction()
179 .read(LogicalDatastoreType.CONFIGURATION, linksIID);
180 linksFuture.get().orElseThrow().getLink();
182 InstanceIdentifier<Network1> links1IID = InstanceIdentifier.create(Networks.class)
183 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
184 .class, new NetworkKey(new NetworkId("openroadm-topology")))
185 .augmentation(Network1.class);
186 FluentFuture<Optional<Network1>> links1Future = dataBroker.newReadOnlyTransaction()
187 .read(LogicalDatastoreType.CONFIGURATION, links1IID);
188 ortopoLinks = links1Future.get().orElseThrow().getLink();
190 InstanceIdentifier<Network> ortopo1IID = InstanceIdentifier.create(Networks.class)
191 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
192 .class, new NetworkKey(new NetworkId("openroadm-topology")));
193 FluentFuture<Optional<Network>> ortopoFuture = dataBroker.newReadOnlyTransaction()
194 .read(LogicalDatastoreType.CONFIGURATION, ortopo1IID);
195 openroadmNet = ortopoFuture.get().orElseThrow();
197 topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
198 Charset.forName("UTF-8"))).toString());
199 networkTransactionService = new NetworkTransactionImpl(getDataBroker());
200 tapiLink = new TapiLinkImpl(networkTransactionService);
201 LOG.info("TEST SETUP READY");
205 void convertNodeWhenNoStates() {
206 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1", null, null);
207 List<String> networkPortList = new ArrayList<>();
208 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
209 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
210 networkPortList.add(tp.getTpId().getValue());
213 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
214 tapiFactory.convertNode(tpdr, networkPortList);
216 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
218 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
219 .getTapiNodes().get(new
220 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
221 Uuid enetworkNepUuid = new Uuid(
222 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
224 Uuid inetworkNepUuid = new Uuid(
225 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
227 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
228 assertNull(enepN.getAdministrativeState(), "Administrative State should not be present");
229 assertNull(enepN.getOperationalState(), "Operational State should not be present");
231 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
232 assertNull(inepN.getAdministrativeState(), "Administrative State should not be present");
233 assertNull(inepN.getOperationalState(), "Operational State should not be present");
235 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
237 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
238 .getTapiNodes().get(new
239 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
240 Uuid enepUuid = new Uuid(
241 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
243 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
244 assertNull(enep.getAdministrativeState(), "Administrative State should not be present");
245 assertNull(enep.getOperationalState(), "Operational State should not be present");
247 Uuid inepUuid = new Uuid(
248 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
250 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
251 assertNull(inep.getAdministrativeState(), "Administrative State should not be present");
252 assertNull(inep.getOperationalState(), "Operational State should not be present");
254 Uuid photnepUuid = new Uuid(
255 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
257 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
258 assertNull(photnep.getAdministrativeState(), "Administrative State should not be present");
259 assertNull(photnep.getOperationalState(), "Operational State should not be present");
263 void convertNodeWhenBadStates1() {
264 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
265 AdminStates.OutOfService, State.OutOfService);
266 List<String> networkPortList = new ArrayList<>();
267 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
268 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
269 networkPortList.add(tp.getTpId().getValue());
272 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
273 tapiFactory.convertNode(tpdr, networkPortList);
275 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
277 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
278 .getTapiNodes().get(new
279 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
280 Uuid enetworkNepUuid = new Uuid(
281 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
283 Uuid inetworkNepUuid = new Uuid(
284 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
286 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
287 assertEquals(AdministrativeState.LOCKED, enepN.getAdministrativeState(),
288 "Administrative State should be Locked");
289 assertEquals(OperationalState.DISABLED, enepN.getOperationalState(), "Operational State should be Disabled");
291 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
292 assertEquals(AdministrativeState.LOCKED, inepN.getAdministrativeState(),
293 "Administrative State should be Locked");
294 assertEquals(OperationalState.DISABLED, inepN.getOperationalState(), "Operational State should be Disabled");
296 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
298 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
299 .getTapiNodes().get(new
300 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
301 Uuid enepUuid = new Uuid(
302 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
304 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
305 assertEquals(AdministrativeState.LOCKED, enep.getAdministrativeState(),
306 "Administrative State should be Locked");
307 assertEquals(OperationalState.DISABLED, enep.getOperationalState(), "Operational State should be Disabled");
309 Uuid inepUuid = new Uuid(
310 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
312 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
313 assertEquals(AdministrativeState.LOCKED, inep.getAdministrativeState(),
314 "Administrative State should be Locked");
315 assertEquals(OperationalState.DISABLED, inep.getOperationalState(), "Operational State should be Disabled");
317 Uuid photnepUuid = new Uuid(
318 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
320 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
321 assertEquals(AdministrativeState.LOCKED, photnep.getAdministrativeState(),
322 "Administrative State should be Locked");
323 assertEquals(OperationalState.DISABLED, photnep.getOperationalState(), "Operational State should be Disabled");
327 void convertNodeWhenBadStates2() {
328 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
329 AdminStates.Maintenance, State.Degraded);
330 List<String> networkPortList = new ArrayList<>();
331 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
332 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
333 networkPortList.add(tp.getTpId().getValue());
336 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
337 tapiFactory.convertNode(tpdr, networkPortList);
339 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
341 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
342 .getTapiNodes().get(new
343 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
344 Uuid enetworkNepUuid = new Uuid(
345 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
347 Uuid inetworkNepUuid = new Uuid(
348 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
350 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
351 assertEquals(AdministrativeState.LOCKED, enepN.getAdministrativeState(),
352 "Administrative State should be Locked");
353 assertEquals(OperationalState.DISABLED, enepN.getOperationalState(), "Operational State should be Disabled");
355 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
356 assertEquals(AdministrativeState.LOCKED, inepN.getAdministrativeState(),
357 "Administrative State should be Locked");
358 assertEquals(OperationalState.DISABLED, inepN.getOperationalState(), "Operational State should be Disabled");
360 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
362 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
363 .getTapiNodes().get(new
364 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
365 Uuid enepUuid = new Uuid(
366 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
368 OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
369 assertEquals(AdministrativeState.LOCKED, enep.getAdministrativeState(),
370 "Administrative State should be Locked");
371 assertEquals(OperationalState.DISABLED, enep.getOperationalState(), "Operational State should be Disabled");
373 Uuid inepUuid = new Uuid(
374 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
376 OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
377 assertEquals(AdministrativeState.LOCKED, inep.getAdministrativeState(),
378 "Administrative State should be Locked");
379 assertEquals(OperationalState.DISABLED, inep.getOperationalState(), "Operational State should be Disabled");
381 Uuid photnepUuid = new Uuid(
382 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
384 OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
385 assertEquals(AdministrativeState.LOCKED, photnep.getAdministrativeState(),
386 "Administrative State should be Locked");
387 assertEquals(OperationalState.DISABLED, photnep.getOperationalState(), "Operational State should be Disabled");
391 void convertNodeForTransponder100G() {
392 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
393 List<String> networkPortList = new ArrayList<>();
394 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
395 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
396 networkPortList.add(tp.getTpId().getValue());
399 tapiFactory.convertNode(tpdr100G, networkPortList);
400 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
401 = tapiFactory.getTapiNodes().values().stream()
402 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
403 .collect(Collectors.toList());
405 assertEquals(2, tapiFactory.getTapiNodes().size(), "Node list size should be 2");
406 assertEquals(2, tapiFactory.getTapiLinks().size(), "Link list size should be 2");
408 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
410 checkDsrNode(tapiNodes.get(1), dsrNodeUuid, "tpdr", "XPDR-A1-XPDR1");
411 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
413 checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "tpdr", "XPDR-A1-XPDR1");
415 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
416 = tapiFactory.getTapiLinks().values().stream()
417 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
418 .collect(Collectors.toList());
419 checkTransitionalLink(tapiLinks.get(1), dsrNodeUuid, otsiNodeUuid,
420 "XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1", "XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1", "XPDR-A1-XPDR1");
424 void convertNodeForOtnMuxponder() {
425 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
426 List<String> networkPortList = new ArrayList<>();
427 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
428 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
429 networkPortList.add(tp.getTpId().getValue());
432 tapiFactory.convertNode(otnMuxA, networkPortList);
433 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
434 = tapiFactory.getTapiNodes().values().stream()
435 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
436 .collect(Collectors.toList());
438 assertEquals(2, tapiFactory.getTapiNodes().size(), "Node list size should be 2");
439 assertEquals(1, tapiFactory.getTapiLinks().size(), "Link list size should be 1");
440 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
442 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "mux", "SPDR-SA1-XPDR1");
443 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
445 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "mux", "SPDR-SA1-XPDR1");
447 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
448 = tapiFactory.getTapiLinks().values().stream()
449 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
450 .collect(Collectors.toList());
451 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
452 "SPDR-SA1-XPDR1+iODU+XPDR1-NETWORK1", "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1", "SPDR-SA1-XPDR1");
456 void convertNodeForOtnSwitch() {
457 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
458 List<String> networkPortList = new ArrayList<>();
459 for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
460 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
461 networkPortList.add(tp.getTpId().getValue());
464 tapiFactory.convertNode(otnSwitch, networkPortList);
465 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
466 = tapiFactory.getTapiNodes().values().stream()
467 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
468 .collect(Collectors.toList());
470 assertEquals(2, tapiFactory.getTapiNodes().size(), "Node list size should be 2");
471 assertEquals(4, tapiFactory.getTapiLinks().size(), "Link list size should be 4");
473 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+DSR".getBytes(Charset.forName("UTF-8")))
475 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "switch", "SPDR-SA1-XPDR2");
476 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+OTSi".getBytes(Charset.forName("UTF-8")))
478 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "switch", "SPDR-SA1-XPDR2");
480 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
481 = tapiFactory.getTapiLinks().values().stream()
482 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
483 .collect(Collectors.toList());
484 checkTransitionalLink(tapiLinks.get(2), dsrNodeUuid, otsiNodeUuid,
485 "SPDR-SA1-XPDR2+iODU+XPDR2-NETWORK4", "SPDR-SA1-XPDR2+iOTSi+XPDR2-NETWORK4", "SPDR-SA1-XPDR2");
489 void convertNodeForRoadmWhenNoOtnMuxAttached() {
490 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
491 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
493 assertEquals(1, tapiFactory.getTapiNodes().size(), "Node list size should be 1");
494 assertEquals(0, tapiFactory.getTapiLinks().size(), "Link list size should be empty");
495 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
496 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
497 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
498 .getBytes(Charset.forName("UTF-8"))).toString());
499 checkOtsiNode(tapiNodes.get(0), roadmNodeUuid, "roadm", "ROADM-A1");
503 void convertNodeForRoadmWhenRoadmNeighborAttached() {
504 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
505 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
506 tapiFactory.convertRoadmNode(roadmC, openroadmNet);
508 List<Link> rdmTordmLinkList = ortopoLinks.values().stream()
509 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
510 .collect(Collectors.toList());
511 tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
513 assertEquals(2, tapiFactory.getTapiNodes().size(), "Node list size should be 2");
514 assertEquals(1, tapiFactory.getTapiLinks().size(), "Link list size should be 1");
516 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
517 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
518 Uuid roadmaNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
519 .getBytes(Charset.forName("UTF-8"))).toString());
520 checkOtsiNode(tapiNodes.get(1), roadmaNodeUuid, "roadm", "ROADM-A1");
522 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
523 = tapiFactory.getTapiLinks().values().stream()
524 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
525 .collect(Collectors.toList());
526 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
528 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-C1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
530 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
531 .getBytes(Charset.forName("UTF-8"))).toString());
532 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
533 .getBytes(Charset.forName("UTF-8"))).toString());
535 new Uuid(UUID.nameUUIDFromBytes(
536 "ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
537 .getBytes(Charset.forName("UTF-8"))).toString());
538 checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
539 "ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX");
543 void convertNodeForRoadmWhenOtnMuxAttached() {
544 ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
545 List<String> networkPortListA = new ArrayList<>();
546 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
547 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
548 networkPortListA.add(tp.getTpId().getValue());
551 tapiFactory.convertNode(otnMuxA, networkPortListA);
552 tapiFactory.convertRoadmNode(roadmA, openroadmNet);
553 List<Link> xponderOutLinkList = ortopoLinks.values().stream()
554 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
555 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
556 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
557 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
558 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
559 .collect(Collectors.toList());
560 List<Link> xponderInLinkList = ortopoLinks.values().stream()
561 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
562 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
563 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
564 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
565 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
566 .collect(Collectors.toList());
567 xponderInLinkList.addAll(xponderOutLinkList);
568 tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
569 assertEquals(3, tapiFactory.getTapiNodes().size(), "Node list size should be 3");
570 assertEquals(2, tapiFactory.getTapiLinks().size(), "Link list size should be 2");
571 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
572 = tapiFactory.getTapiNodes().values().stream()
573 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
574 .collect(Collectors.toList());
575 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
576 .getBytes(Charset.forName("UTF-8"))).toString());
577 checkOtsiNode(tapiNodes.get(1), roadmNodeUuid, "roadm", "ROADM-A1");
579 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
580 = tapiFactory.getTapiLinks().values().stream()
581 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
582 .collect(Collectors.toList());
583 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
585 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
587 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
588 .getBytes(Charset.forName("UTF-8"))).toString());
589 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRX")
590 .getBytes(Charset.forName("UTF-8"))).toString());
592 new Uuid(UUID.nameUUIDFromBytes(
593 "ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
594 .getBytes(Charset.forName("UTF-8"))).toString());
595 checkXpdrRdmLink(links.get(1), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
596 "ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1");
599 private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
600 Uuid nodeUuid, String dsrNodeType, String nodeId) {
601 assertEquals(nodeUuid, node.getUuid(), "incorrect node uuid");
602 assertEquals(nodeId + "+DSR", node.getName().get(new NameKey("dsr/odu node name")).getValue(),
603 "incorrect node name");
604 assertEquals(AdministrativeState.UNLOCKED, node.getAdministrativeState(),
605 "administrative state should be UNLOCKED");
606 assertEquals(LifecycleState.INSTALLED, node.getLifecycleState(), "life-cycle state should be INSTALLED");
607 assertEquals(OperationalState.ENABLED, node.getOperationalState(), "operational state should be ENABLED");
608 assertThat("one value-name should be 'dsr/odu node name'",
609 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("dsr/odu node name")));
610 assertEquals(2, node.getLayerProtocolName().size(), "dsr node should manage 2 protocol layers : dsr and odu");
611 assertThat("dsr node should manage 2 protocol layers : dsr and odu",
612 node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
613 List<OwnedNodeEdgePoint> inepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
614 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint_N")))
615 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
616 .collect(Collectors.toList());
617 List<OwnedNodeEdgePoint> enepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
618 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint_N")))
619 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
620 .collect(Collectors.toList());
621 List<OwnedNodeEdgePoint> nepsC;
622 switch (dsrNodeType) {
624 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
625 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
626 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
627 .collect(Collectors.toList());
628 assertEquals(4, enepsN.size(), "Switch-DSR node should have 4 eNEPs network");
629 assertEquals(4, inepsN.size(), "Switch-DSR node should have 4 iNEPs network");
630 assertEquals(4, nepsC.size(), "Switch-DSR node should have 4 NEPs client");
631 OwnedNodeEdgePoint nep1 = nepsC.get(2);
632 Uuid client4NepUuid = new Uuid(
633 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
635 checkNepClient100GSwitch(nep1, client4NepUuid, nodeId + "+DSR+XPDR2-CLIENT4", "NodeEdgePoint_C");
636 OwnedNodeEdgePoint enep2 = enepsN.get(2);
637 OwnedNodeEdgePoint inep2 = inepsN.get(3);
638 Uuid enetworkNepUuid = new Uuid(
639 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
641 Uuid inetworkNepUuid = new Uuid(
642 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
644 checkNepeODU4(enep2, enetworkNepUuid, nodeId + "+eODU+XPDR2-CLIENT4", "eNodeEdgePoint_N", false);
645 checkNepNetworkODU4(inep2, inetworkNepUuid, nodeId + "+iODU+XPDR2-NETWORK1", "iNodeEdgePoint_N", true);
646 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
647 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
648 .collect(Collectors.toList());
649 checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, enetworkNepUuid, nodeUuid);
652 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
653 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
654 .sorted((nep3, nep4) -> nep3.getUuid().getValue().compareTo(nep4.getUuid().getValue()))
655 .collect(Collectors.toList());
656 assertEquals(4, enepsN.size(), "Mux-DSR node should have 4 eNEP network");
657 assertEquals(1, inepsN.size(), "Mux-DSR node should have 1 iNEP network");
658 assertEquals(4, nepsC.size(), "Mux-DSR node should have 4 NEPs client");
659 OwnedNodeEdgePoint nep3 = nepsC.get(2);
660 Uuid client3NepUuid = new Uuid(
661 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
663 checkNepClient10G(nep3, client3NepUuid, nodeId + "+DSR+XPDR1-CLIENT3", "NodeEdgePoint_C");
664 OwnedNodeEdgePoint enep4 = enepsN.get(3);
665 OwnedNodeEdgePoint inep4 = inepsN.get(0);
666 Uuid enetworkNepUuid2 = new Uuid(
667 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
669 Uuid inetworkNepUuid2 = new Uuid(
670 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
672 checkNepeODU4(enep4, enetworkNepUuid2, nodeId + "+eODU+XPDR1-CLIENT3", "eNodeEdgePoint_N", false);
673 checkNepNetworkODU4(inep4, inetworkNepUuid2, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
675 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
676 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
677 .collect(Collectors.toList());
678 checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, enetworkNepUuid2, nodeUuid);
681 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
682 .filter(n -> n.getName().containsKey(new NameKey("100G-tpdr")))
683 .sorted((nep5, nep6) -> nep5.getUuid().getValue().compareTo(nep6.getUuid().getValue()))
684 .collect(Collectors.toList());
685 assertEquals(2, enepsN.size(), "Tpdr-DSR node should have 2 eNEPs network");
686 assertEquals(2, inepsN.size(), "Tpdr-DSR node should have 2 iNEPs network");
687 assertEquals(2, nepsC.size(), "Tpdr-DSR node should have 2 NEPs client");
688 OwnedNodeEdgePoint nep5 = nepsC.get(0);
689 Uuid client1NepUuid = new Uuid(
690 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
692 checkNepClient100GTpdr(nep5, client1NepUuid, nodeId + "+DSR+XPDR1-CLIENT1", "100G-tpdr");
693 OwnedNodeEdgePoint enep6 = enepsN.get(0);
694 OwnedNodeEdgePoint inep6 = inepsN.get(1);
695 Uuid enetworkNepUuid3 = new Uuid(
696 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
698 Uuid inetworkNepUuid3 = new Uuid(
699 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
701 checkNepeODU4(enep6, enetworkNepUuid3, nodeId + "+eODU+XPDR1-CLIENT1", "eNodeEdgePoint_N", false);
702 checkNepNetworkODU4(inep6, inetworkNepUuid3, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
704 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
705 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
706 .collect(Collectors.toList());
707 checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, enetworkNepUuid3, nodeUuid);
715 private void checkOtsiNode(
716 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
717 Uuid nodeUuid, String otsiNodeType, String nodeId) {
718 assertEquals(nodeUuid, node.getUuid(), "incorrect node uuid");
719 List<OwnedNodeEdgePoint> nepsI = null;
720 List<OwnedNodeEdgePoint> nepsE = null;
721 List<OwnedNodeEdgePoint> nepsP = null;
722 List<OwnedNodeEdgePoint> nepsMc = null;
723 List<OwnedNodeEdgePoint> nepsOtsimc = null;
724 List<OwnedNodeEdgePoint> nepsPhot = null;
725 if (!otsiNodeType.equals("roadm")) {
726 assertEquals(nodeId + "+OTSi", node.getName().get(new NameKey("otsi node name")).getValue(),
727 "incorrect node name");
728 assertThat("one value-name should be 'dsr/odu node name'",
729 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("otsi node name")));
730 nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
731 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
732 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
733 .collect(Collectors.toList());
734 nepsE = node.nonnullOwnedNodeEdgePoint().values().stream()
735 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint")))
736 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
737 .collect(Collectors.toList());
738 nepsP = node.nonnullOwnedNodeEdgePoint().values().stream()
739 .filter(n -> n.getName().containsKey(new NameKey("PhotMedNodeEdgePoint")))
740 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
741 .collect(Collectors.toList());
743 assertEquals(nodeId + "+PHOTONIC_MEDIA", node.getName().get(new NameKey("roadm node name")).getValue(),
744 "incorrect node name");
745 assertThat("one value-name should be 'dsr/odu node name'",
746 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("roadm node name")));
747 nepsMc = node.nonnullOwnedNodeEdgePoint().values().stream()
748 .filter(n -> n.getName().containsKey(new NameKey("MEDIA_CHANNELNodeEdgePoint")))
749 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
750 .collect(Collectors.toList());
751 nepsOtsimc = node.nonnullOwnedNodeEdgePoint().values().stream()
752 .filter(n -> n.getName().containsKey(new NameKey("OTSi_MEDIA_CHANNELNodeEdgePoint")))
753 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
754 .collect(Collectors.toList());
755 nepsPhot = node.nonnullOwnedNodeEdgePoint().values().stream()
756 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIANodeEdgePoint")))
757 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
758 .collect(Collectors.toList());
760 assertEquals(AdministrativeState.UNLOCKED, node.getAdministrativeState(),
761 "administrative state should be UNLOCKED");
762 assertEquals(LifecycleState.INSTALLED, node.getLifecycleState(), "life-cycle state should be INSTALLED");
763 assertEquals(OperationalState.ENABLED, node.getOperationalState(), "operational state should be ENABLED");
764 assertEquals(1, node.getLayerProtocolName().size(),
765 "otsi node should manage a single protocol layer : PHOTONIC_MEDIA");
766 assertEquals(LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().stream().findFirst().orElseThrow(),
767 "otsi node should manage a single protocol layer : PHOTONIC_MEDIA");
769 switch (otsiNodeType) {
771 assertEquals(4, nepsE.size(), "Switch-OTSi node should have 4 eNEPs");
772 assertEquals(4, nepsI.size(), "Switch-OTSi node should have 4 iNEPs");
773 assertEquals(4, nepsP.size(), "Switch-OTSi node should have 4 photNEPs");
774 OwnedNodeEdgePoint nep1 = nepsI.get(1);
775 Uuid inepUuid = new Uuid(
776 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
778 checkNepOtsiNode(nep1, inepUuid, nodeId + "+iOTSi+XPDR2-NETWORK2", "iNodeEdgePoint", true);
779 OwnedNodeEdgePoint nep2 = nepsE.get(0);
780 Uuid enepUuid = new Uuid(
781 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
783 checkNepOtsiNode(nep2, enepUuid, nodeId + "+eOTSi+XPDR2-NETWORK2", "eNodeEdgePoint", false);
784 OwnedNodeEdgePoint photNep = nepsP.get(1);
785 Uuid pnepUuid = new Uuid(
786 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2")
787 .getBytes(Charset.forName("UTF-8"))).toString());
788 checkNepOtsiNode(photNep, pnepUuid, nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2", "PhotMedNodeEdgePoint",
790 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
791 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
792 .collect(Collectors.toList());
793 checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
796 assertEquals(1, nepsE.size(), "Mux-OTSi node should have 1 eNEP");
797 assertEquals(1, nepsI.size(), "Mux-OTSi node should have 1 iNEPs");
798 assertEquals(1, nepsP.size(), "Mux-OTSi node should have 1 photNEPs");
799 OwnedNodeEdgePoint nep3 = nepsE.get(0);
800 Uuid enepUuid2 = new Uuid(
801 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
803 checkNepOtsiNode(nep3, enepUuid2, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
804 OwnedNodeEdgePoint nep4 = nepsI.get(0);
805 Uuid inepUuid2 = new Uuid(
806 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
808 checkNepOtsiNode(nep4, inepUuid2, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
809 OwnedNodeEdgePoint photNep1 = nepsP.get(0);
810 Uuid pnep1Uuid = new Uuid(
811 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
812 .getBytes(Charset.forName("UTF-8"))).toString());
813 checkNepOtsiNode(photNep1, pnep1Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
815 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
816 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
817 .collect(Collectors.toList());
818 checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
821 assertEquals(2, nepsE.size(), "Tpdr-OTSi node should have 2 eNEPs");
822 assertEquals(2, nepsI.size(), "Tpdr-OTSi node should have 2 iNEPs");
823 assertEquals(2, nepsP.size(), "Tpdr-OTSi node should have 2 photNEPs");
824 OwnedNodeEdgePoint nep5 = nepsE.get(0);
825 Uuid enepUuid3 = new Uuid(
826 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
828 checkNepOtsiNode(nep5, enepUuid3, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
829 OwnedNodeEdgePoint nep6 = nepsI.get(0);
830 Uuid inepUuid3 = new Uuid(
831 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
833 checkNepOtsiNode(nep6, inepUuid3, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
834 OwnedNodeEdgePoint photNep2 = nepsP.get(0);
835 Uuid pnep2Uuid = new Uuid(
836 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
837 .getBytes(Charset.forName("UTF-8"))).toString());
838 checkNepOtsiNode(photNep2, pnep2Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
840 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
841 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
842 .collect(Collectors.toList());
843 checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
846 assertEquals(10, nepsMc.size(), "Roadm node should have 10 MC NEPs");
847 assertEquals(10, nepsOtsimc.size(), "Roadm node should have 10 OTSiMC NEPs");
848 assertEquals(10, nepsPhot.size(), "Roadm node should have 10 PHOT_MEDIA NEPs");
850 OwnedNodeEdgePoint nep7 = nepsMc.get(6);
851 Uuid mcnepUuid3 = new Uuid(
852 UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX").getBytes(Charset.forName("UTF-8")))
854 checkNepOtsiRdmNode(nep7, mcnepUuid3, nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX",
855 "MEDIA_CHANNELNodeEdgePoint", false);
856 OwnedNodeEdgePoint nep8 = nepsOtsimc.get(0);
857 Uuid otmcnepUuid3 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX")
858 .getBytes(Charset.forName("UTF-8"))).toString());
859 checkNepOtsiRdmNode(nep8, otmcnepUuid3, nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX",
860 "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
861 OwnedNodeEdgePoint photNep3 = nepsPhot.get(3);
862 Uuid pnep3Uuid = new Uuid(
863 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
864 .getBytes(Charset.forName("UTF-8"))).toString());
865 checkNepOtsiRdmNode(photNep3, pnep3Uuid, nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX",
866 "PHOTONIC_MEDIANodeEdgePoint", false);
868 OwnedNodeEdgePoint nep9 = nepsMc.get(0);
869 Uuid mcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX")
870 .getBytes(Charset.forName("UTF-8"))).toString());
871 checkNepOtsiRdmNode(nep9, mcnepUuid4, nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX",
872 "MEDIA_CHANNELNodeEdgePoint", true);
873 OwnedNodeEdgePoint nep10 = nepsOtsimc.get(9);
874 Uuid otmcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX")
875 .getBytes(Charset.forName("UTF-8"))).toString());
876 checkNepOtsiRdmNode(nep10, otmcnepUuid4, nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX",
877 "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
878 OwnedNodeEdgePoint photNep4 = nepsPhot.get(4);
879 Uuid pnep4Uuid = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX")
880 .getBytes(Charset.forName("UTF-8"))).toString());
881 checkNepOtsiRdmNode(photNep4, pnep4Uuid, nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX",
882 "PHOTONIC_MEDIANodeEdgePoint", false);
883 List<NodeRuleGroup> nrgList4 = node.nonnullNodeRuleGroup().values().stream()
884 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
885 .collect(Collectors.toList());
886 checkNodeRuleGroupForRdm(nrgList4, 30);
894 private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
895 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
896 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
897 Name name = nameList.get(0);
898 assertEquals(portName, name.getValue(), "value of client nep should be '" + portName + "'");
899 assertEquals(nepName, name.getValueName(),
900 "value-name of client nep for '" + portName + "' should be '" + nepName + "'");
901 assertEquals(3, nep.getSupportedCepLayerProtocolQualifier().size(), "Client nep should support 3 kind of cep");
902 assertThat("client nep should support 3 kind of cep",
903 nep.getSupportedCepLayerProtocolQualifier(),
904 hasItems(ODUTYPEODU2.VALUE, ODUTYPEODU2E.VALUE, DIGITALSIGNALTYPE10GigELAN.VALUE));
905 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
906 checkCommonPartOfNep(nep, false);
909 private void checkNepeODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
911 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
912 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
913 Name name = nameList.get(0);
914 assertEquals(portName, name.getValue(), "value of eODU nep should be '" + portName + "'");
915 assertEquals(nepName, name.getValueName(),
916 "value-name of eODU nep for '" + portName + "' should be '" + nepName + "'");
917 // TODO: depending on the type of node there is one type or another
918 assertThat("eODU nep should support 1, 2 or 3 kind of cep, depending on client port",
919 nep.getSupportedCepLayerProtocolQualifier().size(), anyOf(is(1), is(2), is(3)));
921 nep.getSupportedCepLayerProtocolQualifier().stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.VALUE)
922 || splc.equals(ODUTYPEODU2.VALUE) || splc.equals(ODUTYPEODU2E.VALUE)
923 || splc.equals(ODUTYPEODU4.VALUE)),
924 "eODU nep should support 1 kind of cep");
925 assertEquals(LayerProtocolName.ODU, nep.getLayerProtocolName(), "eODU nep should be of ODU protocol type");
926 checkCommonPartOfNep(nep, withSip);
929 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
931 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
932 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
933 Name name = nameList.get(0);
934 assertEquals(portName, name.getValue(), "value of network nep should be '" + portName + "'");
935 assertEquals(nepName, name.getValueName(),
936 "value-name of network nep for '" + portName + "' should be '" + nepName + "'");
937 assertEquals(1, nep.getSupportedCepLayerProtocolQualifier().size(), "Network nep should support 1 kind of cep");
938 assertThat("network nep should support 1 kind of cep",
939 nep.getSupportedCepLayerProtocolQualifier(),
940 hasItem(ODUTYPEODU4.VALUE));
941 assertEquals(LayerProtocolName.ODU, nep.getLayerProtocolName(), "network nep should be of ODU protocol type");
942 checkCommonPartOfNep(nep, withSip);
945 private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
947 assertEquals(2, nrgList.size(), "transponder DSR should contain 2 node rule group");
948 for (NodeRuleGroup nodeRuleGroup : nrgList) {
949 assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
950 "each node-rule-group should contain 2 NEP for transponder DSR");
952 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
953 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
954 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
955 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
956 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
957 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
958 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
959 assertEquals(nodeEdgePointList.get(0).getNodeUuid(), nodeUuid,
960 "node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node");
961 assertEquals(nodeEdgePointList.get(1).getNodeUuid(), nodeUuid,
962 "node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node");
963 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
964 assertEquals(1, rule.size(), "node-rule-group nb 1 should contain a single rule");
965 assertEquals("forward", rule.get(0).getLocalId(), "local-id of the rule should be 'forward'");
966 assertEquals(ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule(),
967 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
968 assertEquals(RuleType.FORWARDING, rule.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
971 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
973 assertEquals(4, nrgList.size(), "muxponder DSR should contain 4 node rule group");
974 for (NodeRuleGroup nodeRuleGroup : nrgList) {
975 assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
976 "each node-rule-group should contain 2 NEP for muxponder DSR");
978 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(1).nonnullNodeEdgePoint().values());
979 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
980 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
981 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
982 assertEquals(nodeEdgePointList.get(0).getNodeUuid(), nodeUuid,
983 "node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node");
984 assertEquals(nodeEdgePointList.get(1).getNodeUuid(), nodeUuid,
985 "node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node");
986 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
987 assertEquals(1, rule.size(), "node-rule-group nb 2 should contain a single rule");
988 assertEquals("forward", rule.get(0).getLocalId(), "local-id of the rule should be 'forward'");
989 assertEquals(ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule(),
990 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
991 assertEquals(RuleType.FORWARDING, rule.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
994 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
996 assertEquals(1, nrgList.size(), "Switch-DSR should contain a single node rule group");
997 assertEquals(8, nrgList.get(0).getNodeEdgePoint().size(), "Switch-DSR node-rule-group should contain 8 NEP");
998 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
999 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
1000 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
1001 .collect(Collectors.toList());
1002 assertEquals(networkNepUuid, nrg.get(6).getNodeEdgePointUuid(),
1003 "in the sorted node-rule-group, nep number 7 should be XPDR2-NETWORK1");
1004 assertEquals(clientNepUuid, nrg.get(3).getNodeEdgePointUuid(),
1005 "in the sorted node-rule-group, nep number 4 should be XPDR2-CLIENT4");
1006 assertEquals(nodeUuid, nrg.get(4).getNodeUuid(),
1007 "any item of the node-rule-group should have the same nodeUuid");
1008 assertEquals(nodeUuid, nrg.get(3).getNodeUuid(),
1009 "any item of the node-rule-group should have the same nodeUuid");
1011 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1012 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1013 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1014 assertEquals(ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule(),
1015 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1016 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1019 private void checkNodeRuleGroupForRdm(List<NodeRuleGroup> nrgList, int nbNeps) {
1020 assertEquals(1, nrgList.size(), "RDM infra node - OTSi should contain a single node rule groups");
1022 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1023 assertEquals(nbNeps, nodeEdgePointList.size(),
1024 "RDM infra node -rule-group should contain " + nbNeps + " NEP");
1026 assertNull(nrgList.get(0).getNodeEdgePoint(), "RDM infra node -rule-group should contain no NEP");
1028 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1029 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1030 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1031 assertEquals(ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule(),
1032 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1033 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1036 private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1038 assertEquals(2, nrgList.size(), "Tpdr-OTSi should contain two node rule groups");
1039 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1040 assertEquals(2, nodeEdgePointList.size(), "Tpdr-OTSi node-rule-group should contain 2 NEP");
1041 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1042 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1043 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1044 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1045 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1046 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1047 assertEquals(nodeUuid, nodeEdgePointList.get(0).getNodeUuid(),
1048 "any item of the node-rule-group should have the same nodeUuid");
1049 assertEquals(nodeUuid, nodeEdgePointList.get(1).getNodeUuid(),
1050 "any item of the node-rule-group should have the same nodeUuid");
1051 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1052 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1053 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1054 assertEquals(ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule(),
1055 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1056 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1059 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1061 assertEquals(1, nrgList.size(), "Mux-OTSi should contain a single node rule group");
1062 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1063 assertEquals(2, nodeEdgePointList.size(), "Mux-OTSi node-rule-group should contain 2 NEP");
1064 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1065 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1066 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1067 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1068 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1069 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1070 assertEquals(nodeUuid, nodeEdgePointList.get(0).getNodeUuid(),
1071 "any item of the node-rule-group should have the same nodeUuid");
1072 assertEquals(nodeUuid, nodeEdgePointList.get(1).getNodeUuid(),
1073 "any item of the node-rule-group should have the same nodeUuid");
1074 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1075 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1076 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1077 assertEquals(ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule(),
1078 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1079 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1082 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1084 assertEquals(4, nrgList.size(), "Switch-OTSi should contain 4 node rule group");
1085 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1086 assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
1087 "each node-rule-group should contain 2 NEP for Switch-OTSi");
1089 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
1090 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1091 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
1092 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1093 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1094 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
1095 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1096 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1097 assertEquals(nodeUuid, nodeEdgePointList0.get(0).getNodeUuid(),
1098 "any item of the node-rule-group should have the same nodeUuid");
1099 assertEquals(nodeUuid, nodeEdgePointList0.get(1).getNodeUuid(),
1100 "any item of the node-rule-group should have the same nodeUuid");
1101 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1102 assertEquals(1, ruleList0.size(), "node-rule-group should contain a single rule");
1103 assertEquals("forward", ruleList0.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1104 assertEquals(ForwardingRule.MAYFORWARDACROSSGROUP, ruleList0.get(0).getForwardingRule(),
1105 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1106 assertEquals(RuleType.FORWARDING, ruleList0.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1109 private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1110 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1111 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1112 assertEquals(portName, nameList.get(0).getValue(),
1113 "value of client nep should be '" + portName + "'");
1114 assertEquals(nepName, nameList.get(0).getValueName(),
1115 "value-name of client nep for '" + portName + "' should be '" + nepName + "'");
1116 assertEquals(2, nep.getSupportedCepLayerProtocolQualifier().size(), "Client nep should support 2 kind of cep");
1117 assertThat("client nep should support 2 kind of cep",
1118 nep.getSupportedCepLayerProtocolQualifier(),
1119 hasItems(ODUTYPEODU4.VALUE, DIGITALSIGNALTYPE100GigE.VALUE));
1120 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
1121 checkCommonPartOfNep(nep, false);
1124 private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1125 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1126 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1127 assertEquals(portName, nameList.get(0).getValue(), "value of client nep should be '" + portName + "'");
1128 assertEquals(nepName, nameList.get(0).getValueName(),
1129 "value-name of client nep for '" + portName + "' should be 100G-tpdr'");
1130 assertEquals(1, nep.getSupportedCepLayerProtocolQualifier().size(), "Client nep should support 1 kind of cep");
1131 assertThat("client nep should support 2 kind of cep",
1132 nep.getSupportedCepLayerProtocolQualifier(),
1133 hasItems(DIGITALSIGNALTYPE100GigE.VALUE));
1134 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
1135 checkCommonPartOfNep(nep, false);
1138 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1140 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1141 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1142 assertEquals(portName, nameList.get(0).getValue(), "value of OTSi nep should be '" + portName + "'");
1143 assertEquals(nepName, nameList.get(0).getValueName(), "value-name of OTSi nep should be '" + nepName + "'");
1144 assertEquals(2, nep.getSupportedCepLayerProtocolQualifier().size(),
1145 "OTSi nep should support 2 kind of cep");
1146 assertThat("OTSi nep should support 2 kind of cep",
1147 nep.getSupportedCepLayerProtocolQualifier(),
1148 hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE, PHOTONICLAYERQUALIFIEROTSi.VALUE));
1149 assertEquals(LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName(),
1150 "OTSi nep should be of PHOTONIC_MEDIA protocol type");
1151 checkCommonPartOfNep(nep, withSip);
1154 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1156 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1157 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1158 assertEquals(portName, nameList.get(0).getValue(),
1159 "value of OTSi nep should be '" + portName + "'");
1160 assertEquals(nepName, nameList.get(0).getValueName(),
1161 "value-name of OTSi nep should be '" + nepName + "'");
1162 assertEquals(1, nep.getSupportedCepLayerProtocolQualifier().size(),
1163 "OTSi nep of RDM infra node should support only 1 kind of cep");
1164 assertThat("OTSi nep should support 2 kind of cep",
1165 nep.getSupportedCepLayerProtocolQualifier(),
1166 hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE));
1167 assertEquals(LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName(),
1168 "OTSi nep should be of PHOTONIC_MEDIA protocol type");
1169 checkCommonPartOfNep(nep, withSip);
1172 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean withSip) {
1173 assertEquals(PortDirection.BIDIRECTIONAL, nep.getLinkPortDirection(),
1174 "link port direction should be DIRECTIONAL");
1175 assertEquals(AdministrativeState.UNLOCKED, nep.getAdministrativeState(),
1176 "administrative state should be UNLOCKED");
1177 assertEquals(TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState(),
1178 "termination state should be TERMINATED BIDIRECTIONAL");
1179 assertEquals(LifecycleState.INSTALLED, nep.getLifecycleState(), "life-cycle state should be INSTALLED");
1181 assertEquals(1, nep.getMappedServiceInterfacePoint().size(), "Given nep should support 1 SIP");
1183 assertEquals(TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection(),
1184 "termination direction should be BIDIRECTIONAL");
1185 assertEquals(OperationalState.ENABLED, nep.getOperationalState(),
1186 "operational state of client nep should be ENABLED");
1187 assertEquals(PortRole.SYMMETRIC, nep.getLinkPortRole(),
1188 "link-port-role of client nep should be SYMMETRIC");
1191 private void checkTransitionalLink(
1192 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link, Uuid node1Uuid,
1193 Uuid node2Uuid, String tp1, String tp2, String ietfNodeId) {
1194 Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((tp1 + "to" + tp2).getBytes(Charset.forName("UTF-8")))
1196 assertEquals(linkUuid, link.getUuid(), "bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2);
1197 assertEquals(CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit(),
1198 "Available capacity unit should be GBPS");
1199 assertEquals(Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue(),
1200 "Available capacity -total size value should be 100");
1201 assertEquals(2, link.getTransitionedLayerProtocolName().size(),
1202 "transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA");
1203 assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1204 link.getTransitionedLayerProtocolName(),
1205 hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));
1206 assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),
1207 "transitional link should be BIDIRECTIONAL");
1208 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1209 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1210 assertEquals(topologyUuid, nodeEdgePointList.get(0).getTopologyUuid(),
1211 "topology uuid should be the same for the two termination point of the link");
1212 assertEquals(topologyUuid, nodeEdgePointList.get(1).getTopologyUuid(),
1213 "topology uuid should be the same for the two termination point of the link");
1214 assertThat("transitional links should terminate on DSR node and Photonic node",
1215 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1216 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1217 assertThat("transitional links should terminate on DSR node and Photonic node",
1218 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1219 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1220 Uuid nep1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1.getBytes(Charset.forName("UTF-8"))).toString());
1221 Uuid nep2Uuid = new Uuid(UUID.nameUUIDFromBytes(tp2.getBytes(Charset.forName("UTF-8"))).toString());
1222 assertThat("transitional links should terminate on " + tp1 + " and " + tp2 + " neps",
1223 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1224 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1225 assertThat("transitional links should terminate on DSR node and Photonic node",
1226 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1227 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1230 private void checkOmsLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
1231 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid, String linkName) {
1232 assertEquals(linkName, link.getName().get(new NameKey("OMS link name")).getValue(), "bad name for the link");
1233 assertEquals(linkUuid, link.getUuid(), "bad uuid for link");
1235 LayerProtocolName.PHOTONICMEDIA.getName(),
1236 link.getLayerProtocolName().stream().findFirst().orElseThrow().getName(),
1237 "oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA");
1238 assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),"otn tapi link should be BIDIRECTIONAL");
1239 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1240 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1241 assertEquals(2 , nodeEdgePointList.size(), "oms link should be between 2 neps");
1242 assertEquals(topologyUuid, nodeEdgePointList.get(0).getTopologyUuid(),
1243 "topology uuid should be the same for the two termination point of the link");
1244 assertEquals(topologyUuid, nodeEdgePointList.get(1).getTopologyUuid(),
1245 "topology uuid should be the same for the two termination point of the link");
1246 assertThat("oms links should terminate on two distinct nodes",
1247 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1248 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1249 assertThat("oms links should terminate on two distinct nodes",
1250 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1251 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1252 assertThat("oms links should terminate on two distinct tps",
1253 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1254 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1255 assertThat("oms links should terminate on two distinct tps",
1256 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1257 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1260 private void checkXpdrRdmLink(
1261 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link, Uuid node1Uuid,
1262 Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid, String linkName) {
1263 assertEquals(linkName, link.getName().get(new NameKey("XPDR-RDM link name")).getValue(),
1264 "bad name for the link");
1265 assertEquals(linkUuid, link.getUuid(), "bad uuid for link");
1267 LayerProtocolName.PHOTONICMEDIA.getName(),
1268 link.getLayerProtocolName().stream().findFirst().orElseThrow().getName(),
1269 "oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA");
1270 assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),
1271 "otn tapi link should be BIDIRECTIONAL");
1272 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
1273 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1274 assertEquals(2 , nodeEdgePointList.size(), "oms link should be between 2 neps");
1275 assertEquals(topologyUuid, nodeEdgePointList.get(0).getTopologyUuid(),
1276 "topology uuid should be the same for the two termination point of the link");
1277 assertEquals(topologyUuid, nodeEdgePointList.get(1).getTopologyUuid(),
1278 "topology uuid should be the same for the two termination point of the link");
1279 assertThat("oms links should terminate on two distinct nodes",
1280 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1281 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1282 assertThat("oms links should terminate on two distinct nodes",
1283 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1284 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1285 assertThat("oms links should terminate on two distinct tps",
1286 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1287 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1288 assertThat("oms links should terminate on two distinct tps",
1289 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1290 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1293 private Node changeTerminationPointState(Node initialNode, String tpid, String tpid1, AdminStates admin,
1295 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
1296 = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
1297 initialNode.augmentation(Node1.class));
1298 Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
1299 TerminationPointBuilder tpBldr = new TerminationPointBuilder(
1300 tps.get(new TerminationPointKey(new TpId(tpid))));
1301 tpBldr.addAugmentation(new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class))
1302 .setAdministrativeState(admin)
1303 .setOperationalState(oper)
1305 tps.replace(tpBldr.key(), tpBldr.build());
1306 TerminationPointBuilder tpBldr1 = new TerminationPointBuilder(
1307 tps.get(new TerminationPointKey(new TpId(tpid1))));
1308 tpBldr1.addAugmentation(new TerminationPoint1Builder(tpBldr1.augmentation(TerminationPoint1.class))
1309 .setAdministrativeState(admin)
1310 .setOperationalState(oper)
1312 tps.replace(tpBldr1.key(), tpBldr1.build());
1313 tpdr1Bldr.setTerminationPoint(tps);
1314 return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();