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.rev221121.AdministrativeState;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.CAPACITYUNITGBPS;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Direction;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.ForwardingDirection;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LAYERPROTOCOLQUALIFIER;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LayerProtocolName;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LifecycleState;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.OperationalState;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.PortRole;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
79 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.Name;
80 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameKey;
81 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU0;
82 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2;
83 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2E;
84 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU4;
85 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE100GigE;
86 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE10GigELAN;
87 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROMS;
88 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTSi;
89 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULEMAYFORWARDACROSSGROUP;
90 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.RuleType;
91 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroup;
92 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
93 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
94 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
95 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint;
96 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.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.rev221121.topology.Node dsrNode = tapiFactory
219 .getTapiNodes().get(new
220 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.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.rev221121.topology.Node otsiNode = tapiFactory
238 .getTapiNodes().get(new
239 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.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.rev221121.topology.Node dsrNode = tapiFactory
278 .getTapiNodes().get(new
279 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.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.rev221121.topology.Node otsiNode = tapiFactory
299 .getTapiNodes().get(new
300 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.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.rev221121.topology.Node dsrNode = tapiFactory
342 .getTapiNodes().get(new
343 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.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.rev221121.topology.Node otsiNode = tapiFactory
363 .getTapiNodes().get(new
364 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.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.rev221121.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.rev221121.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.rev221121.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.rev221121.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.rev221121.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.rev221121.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.rev221121.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.rev221121.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.rev221121.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.rev221121.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.rev221121.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.rev221121.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.rev221121.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.getSupportedCepLayerProtocolQualifierInstances()
902 .size(), "Client nep should support 3 kind of cep");
903 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
904 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
905 .getSupportedCepLayerProtocolQualifierInstances();
906 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
907 lpql.add(entry.getLayerProtocolQualifier());
909 assertEquals(3, lpql.size(), "Client nep should support 3 kind of cep");
910 assertThat("client nep should support 3 kind of cep",
911 lpql, hasItems(ODUTYPEODU2.VALUE, ODUTYPEODU2E.VALUE, DIGITALSIGNALTYPE10GigELAN.VALUE));
913 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
914 checkCommonPartOfNep(nep, false);
917 private void checkNepeODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
919 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
920 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
921 Name name = nameList.get(0);
922 assertEquals(portName, name.getValue(), "value of eODU nep should be '" + portName + "'");
923 assertEquals(nepName, name.getValueName(),
924 "value-name of eODU nep for '" + portName + "' should be '" + nepName + "'");
925 // TODO: depending on the type of node there is one type or another
926 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
927 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
928 .getSupportedCepLayerProtocolQualifierInstances();
929 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
930 lpql.add(entry.getLayerProtocolQualifier());
932 assertThat("eODU nep should support 1, 2 or 3 kind of cep, depending on client port",
933 lpql.size(), anyOf(is(1), is(2), is(3)));
935 lpql.stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.VALUE)
936 || splc.equals(ODUTYPEODU2.VALUE) || splc.equals(ODUTYPEODU2E.VALUE)
937 || splc.equals(ODUTYPEODU4.VALUE)),
938 "eODU nep should support 1 kind of cep");
939 assertEquals(LayerProtocolName.ODU, nep.getLayerProtocolName(), "eODU nep should be of ODU protocol type");
940 checkCommonPartOfNep(nep, withSip);
943 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
945 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
946 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
947 Name name = nameList.get(0);
948 assertEquals(portName, name.getValue(), "value of network nep should be '" + portName + "'");
949 assertEquals(nepName, name.getValueName(),
950 "value-name of network nep for '" + portName + "' should be '" + nepName + "'");
951 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
952 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
953 .getSupportedCepLayerProtocolQualifierInstances();
954 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
955 lpql.add(entry.getLayerProtocolQualifier());
957 assertEquals(1, lpql.size(), "Network nep should support 1 kind of cep");
958 assertThat("network nep should support 1 kind of cep", lpql, hasItem(ODUTYPEODU4.VALUE));
959 assertEquals(LayerProtocolName.ODU, nep.getLayerProtocolName(), "network nep should be of ODU protocol type");
960 checkCommonPartOfNep(nep, withSip);
963 private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
965 assertEquals(2, nrgList.size(), "transponder DSR should contain 2 node rule group");
966 for (NodeRuleGroup nodeRuleGroup : nrgList) {
967 assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
968 "each node-rule-group should contain 2 NEP for transponder DSR");
970 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
971 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
972 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
973 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
974 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
975 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
976 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
977 assertEquals(nodeEdgePointList.get(0).getNodeUuid(), nodeUuid,
978 "node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node");
979 assertEquals(nodeEdgePointList.get(1).getNodeUuid(), nodeUuid,
980 "node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node");
981 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
982 assertEquals(1, rule.size(), "node-rule-group nb 1 should contain a single rule");
983 assertEquals("forward", rule.get(0).getLocalId(), "local-id of the rule should be 'forward'");
984 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, rule.get(0).getForwardingRule(),
985 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
986 assertEquals(RuleType.FORWARDING, rule.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
989 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
991 assertEquals(4, nrgList.size(), "muxponder DSR should contain 4 node rule group");
992 for (NodeRuleGroup nodeRuleGroup : nrgList) {
993 assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
994 "each node-rule-group should contain 2 NEP for muxponder DSR");
996 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(1).nonnullNodeEdgePoint().values());
997 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
998 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
999 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
1000 assertEquals(nodeEdgePointList.get(0).getNodeUuid(), nodeUuid,
1001 "node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node");
1002 assertEquals(nodeEdgePointList.get(1).getNodeUuid(), nodeUuid,
1003 "node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node");
1004 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
1005 assertEquals(1, rule.size(), "node-rule-group nb 2 should contain a single rule");
1006 assertEquals("forward", rule.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1007 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, rule.get(0).getForwardingRule(),
1008 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1009 assertEquals(RuleType.FORWARDING, rule.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1012 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
1014 assertEquals(1, nrgList.size(), "Switch-DSR should contain a single node rule group");
1015 assertEquals(8, nrgList.get(0).getNodeEdgePoint().size(), "Switch-DSR node-rule-group should contain 8 NEP");
1016 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
1017 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
1018 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
1019 .collect(Collectors.toList());
1020 assertEquals(networkNepUuid, nrg.get(6).getNodeEdgePointUuid(),
1021 "in the sorted node-rule-group, nep number 7 should be XPDR2-NETWORK1");
1022 assertEquals(clientNepUuid, nrg.get(3).getNodeEdgePointUuid(),
1023 "in the sorted node-rule-group, nep number 4 should be XPDR2-CLIENT4");
1024 assertEquals(nodeUuid, nrg.get(4).getNodeUuid(),
1025 "any item of the node-rule-group should have the same nodeUuid");
1026 assertEquals(nodeUuid, nrg.get(3).getNodeUuid(),
1027 "any item of the node-rule-group should have the same nodeUuid");
1029 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1030 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1031 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1032 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
1033 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1034 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1037 private void checkNodeRuleGroupForRdm(List<NodeRuleGroup> nrgList, int nbNeps) {
1038 assertEquals(1, nrgList.size(), "RDM infra node - OTSi should contain a single node rule groups");
1040 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1041 assertEquals(nbNeps, nodeEdgePointList.size(),
1042 "RDM infra node -rule-group should contain " + nbNeps + " NEP");
1044 assertNull(nrgList.get(0).getNodeEdgePoint(), "RDM infra node -rule-group should contain no NEP");
1046 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1047 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1048 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1049 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
1050 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1051 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1054 private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1056 assertEquals(2, nrgList.size(), "Tpdr-OTSi should contain two node rule groups");
1057 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1058 assertEquals(2, nodeEdgePointList.size(), "Tpdr-OTSi node-rule-group should contain 2 NEP");
1059 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1060 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1061 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1062 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1063 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1064 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1065 assertEquals(nodeUuid, nodeEdgePointList.get(0).getNodeUuid(),
1066 "any item of the node-rule-group should have the same nodeUuid");
1067 assertEquals(nodeUuid, nodeEdgePointList.get(1).getNodeUuid(),
1068 "any item of the node-rule-group should have the same nodeUuid");
1069 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1070 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1071 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1072 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
1073 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1074 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1077 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1079 assertEquals(1, nrgList.size(), "Mux-OTSi should contain a single node rule group");
1080 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1081 assertEquals(2, nodeEdgePointList.size(), "Mux-OTSi node-rule-group should contain 2 NEP");
1082 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1083 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1084 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1085 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1086 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1087 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1088 assertEquals(nodeUuid, nodeEdgePointList.get(0).getNodeUuid(),
1089 "any item of the node-rule-group should have the same nodeUuid");
1090 assertEquals(nodeUuid, nodeEdgePointList.get(1).getNodeUuid(),
1091 "any item of the node-rule-group should have the same nodeUuid");
1092 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1093 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1094 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1095 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
1096 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1097 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1100 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1102 assertEquals(4, nrgList.size(), "Switch-OTSi should contain 4 node rule group");
1103 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1104 assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
1105 "each node-rule-group should contain 2 NEP for Switch-OTSi");
1107 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
1108 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1109 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
1110 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1111 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1112 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
1113 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1114 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1115 assertEquals(nodeUuid, nodeEdgePointList0.get(0).getNodeUuid(),
1116 "any item of the node-rule-group should have the same nodeUuid");
1117 assertEquals(nodeUuid, nodeEdgePointList0.get(1).getNodeUuid(),
1118 "any item of the node-rule-group should have the same nodeUuid");
1119 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1120 assertEquals(1, ruleList0.size(), "node-rule-group should contain a single rule");
1121 assertEquals("forward", ruleList0.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1122 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList0.get(0).getForwardingRule(),
1123 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1124 assertEquals(RuleType.FORWARDING, ruleList0.get(0).getRuleType(), "the rule type should be 'FORWARDING'");
1127 private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1128 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1129 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1130 assertEquals(portName, nameList.get(0).getValue(),
1131 "value of client nep should be '" + portName + "'");
1132 assertEquals(nepName, nameList.get(0).getValueName(),
1133 "value-name of client nep for '" + portName + "' should be '" + nepName + "'");
1134 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1135 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1136 .getSupportedCepLayerProtocolQualifierInstances();
1137 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1138 lpql.add(entry.getLayerProtocolQualifier());
1140 assertEquals(2, lpql.size(), "Client nep should support 2 kind of cep");
1141 assertThat("client nep should support 2 kind of cep", lpql,
1142 hasItems(ODUTYPEODU4.VALUE, DIGITALSIGNALTYPE100GigE.VALUE));
1143 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
1144 checkCommonPartOfNep(nep, false);
1147 private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1148 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1149 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1150 assertEquals(portName, nameList.get(0).getValue(), "value of client nep should be '" + portName + "'");
1151 assertEquals(nepName, nameList.get(0).getValueName(),
1152 "value-name of client nep for '" + portName + "' should be 100G-tpdr'");
1153 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1154 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1155 .getSupportedCepLayerProtocolQualifierInstances();
1156 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1157 lpql.add(entry.getLayerProtocolQualifier());
1159 assertEquals(1, lpql.size(), "Client nep should support 1 kind of cep");
1160 assertThat("client nep should support 2 kind of cep", lpql, hasItems(DIGITALSIGNALTYPE100GigE.VALUE));
1161 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
1162 checkCommonPartOfNep(nep, false);
1165 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1167 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1168 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1169 assertEquals(portName, nameList.get(0).getValue(), "value of OTSi nep should be '" + portName + "'");
1170 assertEquals(nepName, nameList.get(0).getValueName(), "value-name of OTSi nep should be '" + nepName + "'");
1171 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1172 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1173 .getSupportedCepLayerProtocolQualifierInstances();
1174 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1175 lpql.add(entry.getLayerProtocolQualifier());
1177 assertEquals(2, lpql.size(), "OTSi nep should support 2 kind of cep");
1178 assertThat("OTSi nep should support 2 kind of cep",
1179 lpql, hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE, PHOTONICLAYERQUALIFIEROTSi.VALUE));
1180 assertEquals(LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName(),
1181 "OTSi nep should be of PHOTONIC_MEDIA protocol type");
1182 checkCommonPartOfNep(nep, withSip);
1185 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1187 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1188 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1189 assertEquals(portName, nameList.get(0).getValue(),
1190 "value of OTSi nep should be '" + portName + "'");
1191 assertEquals(nepName, nameList.get(0).getValueName(),
1192 "value-name of OTSi nep should be '" + nepName + "'");
1193 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1194 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1195 .getSupportedCepLayerProtocolQualifierInstances();
1196 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1197 lpql.add(entry.getLayerProtocolQualifier());
1199 assertEquals(1, lpql.size(), "OTSi nep of RDM infra node should support only 1 kind of cep");
1200 assertThat("OTSi nep should support 2 kind of cep", lpql, hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE));
1201 assertEquals(LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName(),
1202 "OTSi nep should be of PHOTONIC_MEDIA protocol type");
1203 checkCommonPartOfNep(nep, withSip);
1206 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean withSip) {
1207 assertEquals(Direction.BIDIRECTIONAL, nep.getDirection(), "link port direction should be DIRECTIONAL");
1208 assertEquals(AdministrativeState.UNLOCKED, nep.getAdministrativeState(),
1209 "administrative state should be UNLOCKED");
1210 // TODO: convert this test since terminationState is migrated to CEP attribute in TAPI 2.4
1211 // assertEquals(TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState(),
1212 // "termination state should be TERMINATED BIDIRECTIONAL");
1213 assertEquals(LifecycleState.INSTALLED, nep.getLifecycleState(), "life-cycle state should be INSTALLED");
1215 assertEquals(1, nep.getMappedServiceInterfacePoint().size(), "Given nep should support 1 SIP");
1217 // TODO: convert this test since terminationState is migrated to CEP attribute in TAPI 2.4
1218 // assertEquals(TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection(),
1219 // "termination direction should be BIDIRECTIONAL");
1220 assertEquals(OperationalState.ENABLED, nep.getOperationalState(),
1221 "operational state of client nep should be ENABLED");
1222 assertEquals(PortRole.SYMMETRIC, nep.getLinkPortRole(),
1223 "link-port-role of client nep should be SYMMETRIC");
1226 private void checkTransitionalLink(
1227 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link link, Uuid node1Uuid,
1228 Uuid node2Uuid, String tp1, String tp2, String ietfNodeId) {
1229 Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((tp1 + "to" + tp2).getBytes(Charset.forName("UTF-8")))
1231 assertEquals(linkUuid, link.getUuid(), "bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2);
1232 assertEquals(CAPACITYUNITGBPS.VALUE, link.getAvailableCapacity().getTotalSize().getUnit(),
1233 "Available capacity unit should be GBPS");
1234 assertEquals(Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue(),
1235 "Available capacity -total size value should be 100");
1236 assertEquals(2, link.getTransitionedLayerProtocolName().size(),
1237 "transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA");
1238 assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
1239 link.getTransitionedLayerProtocolName(),
1240 hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));
1241 assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),
1242 "transitional link should be BIDIRECTIONAL");
1243 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
1244 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1245 assertEquals(topologyUuid, nodeEdgePointList.get(0).getTopologyUuid(),
1246 "topology uuid should be the same for the two termination point of the link");
1247 assertEquals(topologyUuid, nodeEdgePointList.get(1).getTopologyUuid(),
1248 "topology uuid should be the same for the two termination point of the link");
1249 assertThat("transitional links should terminate on DSR node and Photonic node",
1250 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1251 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1252 assertThat("transitional links should terminate on DSR node and Photonic node",
1253 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1254 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1255 Uuid nep1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1.getBytes(Charset.forName("UTF-8"))).toString());
1256 Uuid nep2Uuid = new Uuid(UUID.nameUUIDFromBytes(tp2.getBytes(Charset.forName("UTF-8"))).toString());
1257 assertThat("transitional links should terminate on " + tp1 + " and " + tp2 + " neps",
1258 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1259 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1260 assertThat("transitional links should terminate on DSR node and Photonic node",
1261 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1262 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
1265 private void checkOmsLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link link,
1266 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid, String linkName) {
1267 assertEquals(linkName, link.getName().get(new NameKey("OMS link name")).getValue(), "bad name for the link");
1268 assertEquals(linkUuid, link.getUuid(), "bad uuid for link");
1270 LayerProtocolName.PHOTONICMEDIA.getName(),
1271 link.getLayerProtocolName().stream().findFirst().orElseThrow().getName(),
1272 "oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA");
1273 assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),"otn tapi link should be BIDIRECTIONAL");
1274 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
1275 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1276 assertEquals(2 , nodeEdgePointList.size(), "oms link should be between 2 neps");
1277 assertEquals(topologyUuid, nodeEdgePointList.get(0).getTopologyUuid(),
1278 "topology uuid should be the same for the two termination point of the link");
1279 assertEquals(topologyUuid, nodeEdgePointList.get(1).getTopologyUuid(),
1280 "topology uuid should be the same for the two termination point of the link");
1281 assertThat("oms links should terminate on two distinct nodes",
1282 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1283 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1284 assertThat("oms links should terminate on two distinct nodes",
1285 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1286 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1287 assertThat("oms links should terminate on two distinct tps",
1288 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1289 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1290 assertThat("oms links should terminate on two distinct tps",
1291 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1292 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1295 private void checkXpdrRdmLink(
1296 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link link, Uuid node1Uuid,
1297 Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid, String linkName) {
1298 assertEquals(linkName, link.getName().get(new NameKey("XPDR-RDM link name")).getValue(),
1299 "bad name for the link");
1300 assertEquals(linkUuid, link.getUuid(), "bad uuid for link");
1302 LayerProtocolName.PHOTONICMEDIA.getName(),
1303 link.getLayerProtocolName().stream().findFirst().orElseThrow().getName(),
1304 "oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA");
1305 assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),
1306 "otn tapi link should be BIDIRECTIONAL");
1307 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
1308 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1309 assertEquals(2 , nodeEdgePointList.size(), "oms link should be between 2 neps");
1310 assertEquals(topologyUuid, nodeEdgePointList.get(0).getTopologyUuid(),
1311 "topology uuid should be the same for the two termination point of the link");
1312 assertEquals(topologyUuid, nodeEdgePointList.get(1).getTopologyUuid(),
1313 "topology uuid should be the same for the two termination point of the link");
1314 assertThat("oms links should terminate on two distinct nodes",
1315 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1316 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1317 assertThat("oms links should terminate on two distinct nodes",
1318 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1319 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1320 assertThat("oms links should terminate on two distinct tps",
1321 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1322 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1323 assertThat("oms links should terminate on two distinct tps",
1324 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1325 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1328 private Node changeTerminationPointState(Node initialNode, String tpid, String tpid1, AdminStates admin,
1330 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
1331 = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
1332 initialNode.augmentation(Node1.class));
1333 Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
1334 TerminationPointBuilder tpBldr = new TerminationPointBuilder(
1335 tps.get(new TerminationPointKey(new TpId(tpid))));
1336 tpBldr.addAugmentation(new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class))
1337 .setAdministrativeState(admin)
1338 .setOperationalState(oper)
1340 tps.replace(tpBldr.key(), tpBldr.build());
1341 TerminationPointBuilder tpBldr1 = new TerminationPointBuilder(
1342 tps.get(new TerminationPointKey(new TpId(tpid1))));
1343 tpBldr1.addAugmentation(new TerminationPoint1Builder(tpBldr1.augmentation(TerminationPoint1.class))
1344 .setAdministrativeState(admin)
1345 .setOperationalState(oper)
1347 tps.replace(tpBldr1.key(), tpBldr1.build());
1348 tpdr1Bldr.setTerminationPoint(tps);
1349 return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();