2 * Copyright © 2021 Nokia, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.tapi.topology;
10 import static org.hamcrest.CoreMatchers.anyOf;
11 import static org.hamcrest.CoreMatchers.containsString;
12 import static org.hamcrest.CoreMatchers.either;
13 import static org.hamcrest.CoreMatchers.hasItem;
14 import static org.hamcrest.CoreMatchers.hasItems;
15 import static org.hamcrest.CoreMatchers.is;
16 import static org.hamcrest.MatcherAssert.assertThat;
17 import static org.junit.Assert.assertNotNull;
18 import static org.junit.jupiter.api.Assertions.assertEquals;
19 import static org.junit.jupiter.api.Assertions.assertNull;
20 import static org.junit.jupiter.api.Assertions.assertTrue;
21 import static org.junit.jupiter.api.Assertions.fail;
23 import com.google.common.util.concurrent.FluentFuture;
24 import java.nio.charset.Charset;
25 import java.util.ArrayList;
26 import java.util.HashMap;
27 import java.util.List;
29 import java.util.Optional;
30 import java.util.UUID;
31 import java.util.concurrent.ExecutionException;
32 import java.util.stream.Collectors;
33 import org.eclipse.jdt.annotation.Nullable;
34 import org.junit.jupiter.api.BeforeAll;
35 import org.junit.jupiter.api.Test;
36 import org.opendaylight.mdsal.binding.api.DataBroker;
37 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
38 import org.opendaylight.transportpce.common.InstanceIdentifiers;
39 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
40 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
41 import org.opendaylight.transportpce.tapi.TapiStringConstants;
42 import org.opendaylight.transportpce.tapi.utils.TapiLink;
43 import org.opendaylight.transportpce.tapi.utils.TapiLinkImpl;
44 import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils;
45 import org.opendaylight.transportpce.test.AbstractTest;
46 import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Link1;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1Builder;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmLinkType;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmTpType;
54 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
55 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
56 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
57 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
58 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
59 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
60 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeBuilder;
61 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeKey;
62 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
63 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1;
64 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
65 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
66 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.LinkKey;
67 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
68 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointBuilder;
69 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointKey;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.AdministrativeState;
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.PHOTONICLAYERQUALIFIEROTS;
89 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTSi;
90 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULECANNOTFORWARDACROSSGROUP;
91 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULEMAYFORWARDACROSSGROUP;
92 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.RuleType;
93 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroup;
94 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
95 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
96 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
97 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint;
98 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.Rule;
99 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
100 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
101 import org.slf4j.Logger;
102 import org.slf4j.LoggerFactory;
104 public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
105 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToFullTapiTopoTest.class);
107 private static Node otnMuxA;
108 private static Node otnSwitch;
109 private static Node tpdr100G;
110 private static Node roadmA;
111 private static Node roadmC;
112 private static Network openroadmNet;
113 private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
114 .networks.network.Link> ortopoLinks;
115 private static Uuid topologyUuid;
116 private static NetworkTransactionService networkTransactionService;
117 private static TapiLink tapiLink;
118 private static DataBroker dataBroker = getDataBroker();
121 static void setUp() throws InterruptedException, ExecutionException {
122 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
123 TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
124 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
125 TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II);
126 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
127 TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
128 TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
129 TapiTopologyDataUtils.PORTMAPPING_FILE);
131 KeyedInstanceIdentifier<Node, NodeKey> muxAIID = InstanceIdentifier.create(Networks.class)
132 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
133 .class, new NetworkKey(new NetworkId("otn-topology")))
134 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR1")));
135 FluentFuture<Optional<Node>> muxAFuture = dataBroker.newReadOnlyTransaction()
136 .read(LogicalDatastoreType.CONFIGURATION, muxAIID);
137 otnMuxA = muxAFuture.get().orElseThrow();
138 KeyedInstanceIdentifier<Node, NodeKey> muxCIID = InstanceIdentifier.create(Networks.class)
139 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
140 .class, new NetworkKey(new NetworkId("otn-topology")))
141 .child(Node.class, new NodeKey(new NodeId("SPDR-SC1-XPDR1")));
142 FluentFuture<Optional<Node>> muxCFuture = dataBroker.newReadOnlyTransaction()
143 .read(LogicalDatastoreType.CONFIGURATION, muxCIID);
144 muxCFuture.get().orElseThrow();
145 KeyedInstanceIdentifier<Node, NodeKey> switchIID = InstanceIdentifier.create(Networks.class)
146 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
147 .class, new NetworkKey(new NetworkId("otn-topology")))
148 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR2")));
149 FluentFuture<Optional<Node>> switchFuture = dataBroker.newReadOnlyTransaction()
150 .read(LogicalDatastoreType.CONFIGURATION, switchIID);
151 otnSwitch = switchFuture.get().orElseThrow();
152 KeyedInstanceIdentifier<Node, NodeKey> roadmaIID = InstanceIdentifier.create(Networks.class)
153 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
154 .class, new NetworkKey(new NetworkId("openroadm-network")))
155 .child(Node.class, new NodeKey(new NodeId("ROADM-A1")));
156 FluentFuture<Optional<Node>> roadmaFuture = dataBroker.newReadOnlyTransaction()
157 .read(LogicalDatastoreType.CONFIGURATION, roadmaIID);
158 roadmA = roadmaFuture.get().orElseThrow();
159 KeyedInstanceIdentifier<Node, NodeKey> roadmcIID = InstanceIdentifier.create(Networks.class)
160 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
161 .class, new NetworkKey(new NetworkId("openroadm-network")))
162 .child(Node.class, new NodeKey(new NodeId("ROADM-C1")));
163 FluentFuture<Optional<Node>> roadmcFuture = dataBroker.newReadOnlyTransaction()
164 .read(LogicalDatastoreType.CONFIGURATION, roadmcIID);
165 roadmC = roadmcFuture.get().orElseThrow();
167 KeyedInstanceIdentifier<Node, NodeKey> tpdrIID = InstanceIdentifier.create(Networks.class)
168 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
169 .class, new NetworkKey(new NetworkId("otn-topology")))
170 .child(Node.class, new NodeKey(new NodeId("XPDR-A1-XPDR1")));
171 FluentFuture<Optional<Node>> tpdrFuture = dataBroker.newReadOnlyTransaction()
172 .read(LogicalDatastoreType.CONFIGURATION, tpdrIID);
173 tpdr100G = tpdrFuture.get().orElseThrow();
175 InstanceIdentifier<Network1> linksIID = InstanceIdentifier.create(Networks.class)
176 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
177 .class, new NetworkKey(new NetworkId("otn-topology")))
178 .augmentation(Network1.class);
179 FluentFuture<Optional<Network1>> linksFuture = dataBroker.newReadOnlyTransaction()
180 .read(LogicalDatastoreType.CONFIGURATION, linksIID);
181 linksFuture.get().orElseThrow().getLink();
183 InstanceIdentifier<Network1> links1IID = InstanceIdentifier.create(Networks.class)
184 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
185 .class, new NetworkKey(new NetworkId("openroadm-topology")))
186 .augmentation(Network1.class);
187 FluentFuture<Optional<Network1>> links1Future = dataBroker.newReadOnlyTransaction()
188 .read(LogicalDatastoreType.CONFIGURATION, links1IID);
189 ortopoLinks = links1Future.get().orElseThrow().getLink();
191 InstanceIdentifier<Network> ortopo1IID = InstanceIdentifier.create(Networks.class)
192 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
193 .class, new NetworkKey(new NetworkId("openroadm-topology")));
194 FluentFuture<Optional<Network>> ortopoFuture = dataBroker.newReadOnlyTransaction()
195 .read(LogicalDatastoreType.CONFIGURATION, ortopo1IID);
196 openroadmNet = ortopoFuture.get().orElseThrow();
198 topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
199 Charset.forName("UTF-8"))).toString());
200 networkTransactionService = new NetworkTransactionImpl(getDataBroker());
201 tapiLink = new TapiLinkImpl(networkTransactionService);
202 LOG.info("TEST SETUP READY");
206 void convertNodeWhenNoStates() {
207 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1", null, null);
208 List<String> networkPortList = new ArrayList<>();
209 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
210 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
211 networkPortList.add(tp.getTpId().getValue());
214 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
215 tapiFactory.convertNode(tpdr, networkPortList);
217 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
219 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node dsrNode = tapiFactory
220 .getTapiNodes().get(new
221 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey(dsrNodeUuid));
222 Uuid enetworkNepUuid = new Uuid(
223 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
225 Uuid inetworkNepUuid = new Uuid(
226 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
228 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
229 assertNull(enepN.getAdministrativeState(), "Administrative State should not be present");
230 assertNull(enepN.getOperationalState(), "Operational State should not be present");
232 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
233 assertNull(inepN.getAdministrativeState(), "Administrative State should not be present");
234 assertNull(inepN.getOperationalState(), "Operational State should not be present");
238 void convertNodeWhenBadStates1() {
239 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
240 AdminStates.OutOfService, State.OutOfService);
241 List<String> networkPortList = new ArrayList<>();
242 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
243 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
244 networkPortList.add(tp.getTpId().getValue());
247 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
248 tapiFactory.convertNode(tpdr, networkPortList);
250 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
252 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node dsrNode = tapiFactory
253 .getTapiNodes().get(new
254 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey(dsrNodeUuid));
255 Uuid enetworkNepUuid = new Uuid(
256 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
258 Uuid inetworkNepUuid = new Uuid(
259 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
261 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
262 assertEquals(AdministrativeState.LOCKED, enepN.getAdministrativeState(),
263 "Administrative State should be Locked");
264 assertEquals(OperationalState.DISABLED, enepN.getOperationalState(), "Operational State should be Disabled");
266 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
267 assertEquals(AdministrativeState.LOCKED, inepN.getAdministrativeState(),
268 "Administrative State should be Locked");
269 assertEquals(OperationalState.DISABLED, inepN.getOperationalState(), "Operational State should be Disabled");
273 void convertNodeWhenBadStates2() {
274 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
275 AdminStates.Maintenance, State.Degraded);
276 List<String> networkPortList = new ArrayList<>();
277 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
278 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
279 networkPortList.add(tp.getTpId().getValue());
282 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
283 tapiFactory.convertNode(tpdr, networkPortList);
285 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
287 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node dsrNode = tapiFactory
288 .getTapiNodes().get(new
289 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey(dsrNodeUuid));
290 Uuid enetworkNepUuid = new Uuid(
291 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
293 Uuid inetworkNepUuid = new Uuid(
294 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
296 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
297 assertEquals(AdministrativeState.LOCKED, enepN.getAdministrativeState(),
298 "Administrative State should be Locked");
299 assertEquals(OperationalState.DISABLED, enepN.getOperationalState(), "Operational State should be Disabled");
301 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
302 assertEquals(AdministrativeState.LOCKED, inepN.getAdministrativeState(),
303 "Administrative State should be Locked");
304 assertEquals(OperationalState.DISABLED, inepN.getOperationalState(), "Operational State should be Disabled");
309 void convertNodeForTransponder100G() {
310 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
311 List<String> networkPortList = new ArrayList<>();
312 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
313 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
314 networkPortList.add(tp.getTpId().getValue());
317 tapiFactory.convertNode(tpdr100G, networkPortList);
318 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
319 = tapiFactory.getTapiNodes().values().stream()
320 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
321 .collect(Collectors.toList());
323 assertEquals(1, tapiFactory.getTapiNodes().size(), "Node list size should be 1 (DSR-ODU merged)");
324 assertEquals(0, tapiFactory.getTapiLinks().size(), "Link list size should be 0 : no more transitional link");
326 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
328 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "tpdr", "XPDR-A1-XPDR1");
332 void convertNodeForOtnMuxponder() {
333 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
334 List<String> networkPortList = new ArrayList<>();
335 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
336 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
337 networkPortList.add(tp.getTpId().getValue());
340 tapiFactory.convertNode(otnMuxA, networkPortList);
341 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
342 = tapiFactory.getTapiNodes().values().stream()
343 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
344 .collect(Collectors.toList());
346 assertEquals(1, tapiFactory.getTapiNodes().size(), "Node list size should be 1 (DSR-ODU merged)");
347 assertEquals(0, tapiFactory.getTapiLinks().size(), "Link list size should be 0 : no more transitional link");
348 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
350 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "mux", "SPDR-SA1-XPDR1");
354 void convertNodeForOtnSwitch() {
355 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
356 List<String> networkPortList = new ArrayList<>();
357 for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
358 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
359 networkPortList.add(tp.getTpId().getValue());
362 tapiFactory.convertNode(otnSwitch, networkPortList);
363 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
364 = tapiFactory.getTapiNodes().values().stream()
365 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
366 .collect(Collectors.toList());
368 assertEquals(1, tapiFactory.getTapiNodes().size(), "Node list size should be 1 (DSR-ODU merged)");
369 assertEquals(0, tapiFactory.getTapiLinks().size(), "Link list size should be 0 : no more transitional link");
371 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+XPONDER".getBytes(Charset.forName("UTF-8")))
373 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "switch", "SPDR-SA1-XPDR2");
377 void convertNodeForRoadmWhenNoOtnMuxAttached() {
378 ConvertORTopoToTapiFullTopo tapiFullFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
379 tapiFullFactory.convertRoadmNode(roadmA, openroadmNet, "Full");
381 assertEquals(1, tapiFullFactory.getTapiNodes().size(), "Node list size should be 1");
382 assertEquals(0, tapiFullFactory.getTapiLinks().size(), "Link list size should be empty");
383 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
384 = tapiFullFactory.getTapiNodes().values().stream().collect(Collectors.toList());
385 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
386 .getBytes(Charset.forName("UTF-8"))).toString());
387 checkOtsiNode(tapiNodes.get(getNodeRank("ROADM-A1", tapiNodes)), roadmNodeUuid, "roadm", "ROADM-A1");
391 void convertNodeForRoadmWhenRoadmNeighborAttached() {
392 ConvertORTopoToTapiFullTopo tapiFullFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
393 tapiFullFactory.convertRoadmNode(roadmA, openroadmNet, "Full");
394 tapiFullFactory.convertRoadmNode(roadmC, openroadmNet, "Full");
396 List<Link> rdmTordmLinkList = ortopoLinks.values().stream()
397 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
398 .collect(Collectors.toList());
399 tapiFullFactory.convertRdmToRdmLinks(rdmTordmLinkList);
401 assertEquals(2, tapiFullFactory.getTapiNodes().size(), "Node list size should be 2");
402 assertEquals(1, tapiFullFactory.getTapiLinks().size(), "Link list size should be 1");
404 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
405 = tapiFullFactory.getTapiNodes().values().stream().collect(Collectors.toList());
407 for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node : tapiNodes) {
408 if (node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA)
409 && !node.getLayerProtocolName().contains(LayerProtocolName.DSR)) {
410 LOG.info("LOOP ROADM node found at rank {}, with Name {} and Uuid {}",
411 myInt, node.getName().toString(), node.getUuid());
415 Uuid roadmaNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
416 .getBytes(Charset.forName("UTF-8"))).toString());
417 LOG.info("ROADM node found at rank {} from getrank", getNodeRank("ROADM-A1", tapiNodes));
418 checkOtsiNode(tapiNodes.get(getNodeRank("ROADM-A1", tapiNodes)), roadmaNodeUuid, "roadm", "ROADM-A1");
420 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link> links
421 = tapiFullFactory.getTapiLinks().values().stream()
422 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
423 .collect(Collectors.toList());
424 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
426 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-C1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
428 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA_OTS+DEG2-TTP-TXRX"
429 .getBytes(Charset.forName("UTF-8"))).toString());
430 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-C1+PHOTONIC_MEDIA_OTS+DEG1-TTP-TXRX")
431 .getBytes(Charset.forName("UTF-8"))).toString());
433 new Uuid(UUID.nameUUIDFromBytes(
434 "ROADM-C1+PHOTONIC_MEDIA_OTS+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA_OTS+DEG2-TTP-TXRX"
435 .getBytes(Charset.forName("UTF-8"))).toString());
436 checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
437 "ROADM-C1+PHOTONIC_MEDIA_OTS+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA_OTS+DEG2-TTP-TXRX");
441 void convertNodeForRoadmWhenOtnMuxAttached() {
442 ConvertORTopoToTapiFullTopo tapiFullFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
443 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
444 List<String> networkPortListA = new ArrayList<>();
445 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
446 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
447 networkPortListA.add(tp.getTpId().getValue());
450 tapiFactory.convertNode(otnMuxA, networkPortListA);
451 tapiFullFactory.setTapiNodes(tapiFactory.getTapiNodes());
452 tapiFullFactory.convertRoadmNode(roadmA, openroadmNet, "Full");
453 List<Link> xponderOutLinkList = ortopoLinks.values().stream()
454 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
455 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
456 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
457 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
458 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
459 .collect(Collectors.toList());
460 List<Link> xponderInLinkList = ortopoLinks.values().stream()
461 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
462 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
463 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
464 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
465 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
466 .collect(Collectors.toList());
467 xponderInLinkList.addAll(xponderOutLinkList);
468 tapiFullFactory.convertXpdrToRdmLinks(xponderInLinkList);
469 assertEquals(2, tapiFullFactory.getTapiNodes().size(),
470 "Node list size should be 2 (XPDR, DSR-ODU merged; ROADM)");
471 assertEquals(1, tapiFullFactory.getTapiLinks().size(),
472 "Link list size should be 1 : no more transitional link");
473 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey,
474 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeMap =
475 tapiFactory.getTapiNodes();
476 nodeMap.putAll(tapiFullFactory.getTapiNodes());
477 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
478 = nodeMap.values().stream()
479 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
480 .collect(Collectors.toList());
481 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
482 .getBytes(Charset.forName("UTF-8"))).toString());
483 checkOtsiNode(tapiNodes.get(getNodeRank("ROADM-A1", tapiNodes)), roadmNodeUuid, "roadm", "ROADM-A1");
485 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
487 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
489 LOG.info("ROADM-A1+PHOTONIC_MEDIA UUID is {}", node2Uuid);
490 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1"
491 .getBytes(Charset.forName("UTF-8"))).toString());
492 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-A1+PHOTONIC_MEDIA_OTS+SRG1-PP2-TXRX")
493 .getBytes(Charset.forName("UTF-8"))).toString());
495 new Uuid(UUID.nameUUIDFromBytes(
496 "ROADM-A1+PHOTONIC_MEDIA_OTS+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1"
497 .getBytes(Charset.forName("UTF-8"))).toString());
498 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link> links
499 = tapiFullFactory.getTapiLinks().values().stream()
500 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
501 .collect(Collectors.toList());
502 checkXpdrRdmLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
503 "ROADM-A1+PHOTONIC_MEDIA_OTS+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1");
506 private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node,
507 Uuid node9Uuid, String dsrNodeType, String nodeId) {
508 assertEquals(node9Uuid, node.getUuid(), "incorrect node uuid");
509 assertEquals(nodeId + "+XPONDER", node.getName().get(new NameKey("dsr/odu node name")).getValue(),
510 "incorrect node name");
511 assertEquals(AdministrativeState.UNLOCKED, node.getAdministrativeState(),
512 "administrative state should be UNLOCKED");
513 assertEquals(LifecycleState.INSTALLED, node.getLifecycleState(), "life-cycle state should be INSTALLED");
514 assertEquals(OperationalState.ENABLED, node.getOperationalState(), "operational state should be ENABLED");
515 assertThat("one value-name should be 'dsr/odu node name'",
516 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("dsr/odu node name")));
517 assertEquals(4, node.getLayerProtocolName().size(), "dsr node should manage 4 protocol layers : dsr and odu"
518 + " DIGITALOTN, PHOTONICMEDIA");
519 assertThat("dsr node should manage 2 protocol layers : dsr and odu",
520 node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
521 List<OwnedNodeEdgePoint> inepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
522 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint_N")))
523 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
524 .collect(Collectors.toList());
525 List<OwnedNodeEdgePoint> enepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
526 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint_N")))
527 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
528 .collect(Collectors.toList());
529 List<OwnedNodeEdgePoint> nepsC;
530 switch (dsrNodeType) {
532 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
533 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
534 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
535 .collect(Collectors.toList());
536 assertEquals(4, enepsN.size(), "Switch-DSR node should have 4 eNEPs network");
537 assertEquals(4, inepsN.size(), "Switch-DSR node should have 4 iNEPs network");
538 assertEquals(4, nepsC.size(), "Switch-DSR node should have 4 NEPs client");
539 OwnedNodeEdgePoint nep1 = nepsC.get(2);
540 Uuid client4NepUuid = new Uuid(
541 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
543 checkNepClient100GSwitch(nep1, client4NepUuid, nodeId + "+DSR+XPDR2-CLIENT4", "NodeEdgePoint_C");
544 OwnedNodeEdgePoint enep2 = enepsN.get(2);
545 OwnedNodeEdgePoint inep2 = inepsN.get(3);
546 Uuid enetworkNepUuid = new Uuid(
547 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
549 Uuid inetworkNepUuid = new Uuid(
550 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
552 checkNepeODU4(enep2, enetworkNepUuid, nodeId + "+eODU+XPDR2-CLIENT4", "eNodeEdgePoint_N", false);
553 checkNepNetworkODU4(inep2, inetworkNepUuid, nodeId + "+iODU+XPDR2-NETWORK1", "iNodeEdgePoint_N", true);
554 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
555 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
556 .collect(Collectors.toList());
557 // keep trace of the previous test performed before the structure of the NRG was modified
558 // checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, enetworkNepUuid, node9Uuid);
559 checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, inetworkNepUuid, node9Uuid);
562 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
563 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
564 .sorted((nep3, nep4) -> nep3.getUuid().getValue().compareTo(nep4.getUuid().getValue()))
565 .collect(Collectors.toList());
566 assertEquals(4, enepsN.size(), "Mux-DSR node should have 4 eNEP network");
567 assertEquals(1, inepsN.size(), "Mux-DSR node should have 1 iNEP network");
568 assertEquals(4, nepsC.size(), "Mux-DSR node should have 4 NEPs client");
569 OwnedNodeEdgePoint nep3 = nepsC.get(2);
570 Uuid client3NepUuid = new Uuid(
571 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
573 checkNepClient10G(nep3, client3NepUuid, nodeId + "+DSR+XPDR1-CLIENT3", "NodeEdgePoint_C");
574 OwnedNodeEdgePoint enep4 = enepsN.get(3);
575 OwnedNodeEdgePoint inep4 = inepsN.get(0);
576 Uuid eclientNepUuid2 = new Uuid(
577 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
579 Uuid inetworkNepUuid2 = new Uuid(
580 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
582 checkNepeODU4(enep4, eclientNepUuid2, nodeId + "+eODU+XPDR1-CLIENT3", "eNodeEdgePoint_N", false);
583 checkNepNetworkODU4(inep4, inetworkNepUuid2, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
585 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
586 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
587 .collect(Collectors.toList());
588 // keep trace of the previous test performed before the structure of the NRG was modified
589 // checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, eclientNepUuid2, node9Uuid);
590 checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, inetworkNepUuid2, node9Uuid);
593 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
594 .filter(n -> n.getName().containsKey(new NameKey("100G-tpdr")))
595 .sorted((nep5, nep6) -> nep5.getUuid().getValue().compareTo(nep6.getUuid().getValue()))
596 .collect(Collectors.toList());
597 assertEquals(2, enepsN.size(), "Tpdr-DSR node should have 2 eNEPs network");
598 assertEquals(2, inepsN.size(), "Tpdr-DSR node should have 2 iNEPs network");
599 assertEquals(2, nepsC.size(), "Tpdr-DSR node should have 2 NEPs client");
600 OwnedNodeEdgePoint nep5 = nepsC.get(0);
601 Uuid client1NepUuid = new Uuid(
602 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
604 checkNepClient100GTpdr(nep5, client1NepUuid, nodeId + "+DSR+XPDR1-CLIENT1", "100G-tpdr");
605 OwnedNodeEdgePoint enep6 = enepsN.get(0);
606 OwnedNodeEdgePoint inep6 = inepsN.get(1);
607 Uuid enetworkNepUuid3 = new Uuid(
608 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
610 Uuid inetworkNepUuid3 = new Uuid(
611 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
613 checkNepeODU4(enep6, enetworkNepUuid3, nodeId + "+eODU+XPDR1-CLIENT1", "eNodeEdgePoint_N", false);
614 checkNepNetworkODU4(inep6, inetworkNepUuid3, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
616 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
617 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
618 .collect(Collectors.toList());
619 // keep trace of the previous test performed before the structure of the NRG was modified
620 // checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, enetworkNepUuid3, node9Uuid);
621 checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, inetworkNepUuid3, node9Uuid);
629 private void checkOtsiNode(
630 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node,
631 Uuid nodeUuid, String otsiNodeType, String nodeId) {
632 if (!node.getUuid().equals(nodeUuid)) {
633 LOG.info("ERRORUUID on Node.getNodeId {}, NodeId {}", node.getName().toString(), nodeId);
634 LOG.info("ERRORUUID TapiUuid {}, transmitted Node Uuid {}", node.getUuid(), nodeUuid);
636 assertEquals(nodeUuid, node.getUuid(), "incorrect node uuid");
637 List<OwnedNodeEdgePoint> nepsI = null;
638 List<OwnedNodeEdgePoint> nepsE = null;
639 List<OwnedNodeEdgePoint> nepsP = null;
640 List<OwnedNodeEdgePoint> nepsOMS = null;
641 List<OwnedNodeEdgePoint> nepsOTS = null;
642 List<OwnedNodeEdgePoint> nepsPhot = null;
643 if (!otsiNodeType.equals("roadm")) {
644 assertEquals(nodeId + "+XPONDER", node.getName().get(new NameKey("dsr/odu node name")).getValue(),
645 "incorrect node name");
646 assertThat("one value-name should be 'dsr/odu node name'",
647 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("dsr/odu node name")));
648 nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
649 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
650 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
651 .collect(Collectors.toList());
652 nepsE = node.nonnullOwnedNodeEdgePoint().values().stream()
653 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint")))
654 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
655 .collect(Collectors.toList());
656 nepsP = node.nonnullOwnedNodeEdgePoint().values().stream()
657 .filter(n -> n.getName().containsKey(new NameKey("PhotMedNodeEdgePoint")))
658 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
659 .collect(Collectors.toList());
661 assertEquals(nodeId + "+PHOTONIC_MEDIA", node.getName().get(new NameKey("roadm node name")).getValue(),
662 "incorrect node name");
663 assertThat("one value-name should be 'dsr/odu node name'",
664 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("roadm node name")));
665 nepsOMS = node.nonnullOwnedNodeEdgePoint().values().stream()
666 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIA_OMSNodeEdgePoint")))
667 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
668 .collect(Collectors.toList());
669 nepsOTS = node.nonnullOwnedNodeEdgePoint().values().stream()
670 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIA_OTSNodeEdgePoint")))
671 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
672 .collect(Collectors.toList());
673 nepsPhot = node.nonnullOwnedNodeEdgePoint().values().stream()
674 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIA_OMSNodeEdgePoint")))
675 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
676 .collect(Collectors.toList());
677 nepsPhot.addAll(node.nonnullOwnedNodeEdgePoint().values().stream()
678 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIA_OTSNodeEdgePoint")))
679 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
680 .collect(Collectors.toList()));
682 assertEquals(AdministrativeState.UNLOCKED, node.getAdministrativeState(),
683 "administrative state should be UNLOCKED");
684 assertEquals(LifecycleState.INSTALLED, node.getLifecycleState(), "life-cycle state should be INSTALLED");
685 assertEquals(OperationalState.ENABLED, node.getOperationalState(), "operational state should be ENABLED");
686 assertEquals(1, node.getLayerProtocolName().size(),
687 "otsi node should manage a single protocol layer : PHOTONIC_MEDIA");
688 assertEquals(LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().stream().findFirst().orElseThrow(),
689 "otsi node should manage a single protocol layer : PHOTONIC_MEDIA");
691 switch (otsiNodeType) {
693 assertEquals(4, nepsE.size(), "Switch-OTSi node should have 4 eNEPs");
694 assertEquals(4, nepsI.size(), "Switch-OTSi node should have 4 iNEPs");
695 assertEquals(4, nepsP.size(), "Switch-OTSi node should have 4 photNEPs");
696 OwnedNodeEdgePoint nep1 = nepsI.get(1);
697 Uuid inepUuid = new Uuid(
698 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
700 checkNepOtsiNode(nep1, inepUuid, nodeId + "+iOTSi+XPDR2-NETWORK2", "iNodeEdgePoint", true);
701 OwnedNodeEdgePoint nep2 = nepsE.get(0);
702 Uuid enepUuid = new Uuid(
703 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+XPDR2-NETWORK2")
704 .getBytes(Charset.forName("UTF-8")))
706 checkNepOtsiNode(nep2, enepUuid, nodeId + "+PHOTONIC_MEDIA_OTS+XPDR2-NETWORK2",
707 "eNodeEdgePoint", false);
708 OwnedNodeEdgePoint photNep = nepsP.get(1);
709 Uuid pnepUuid = new Uuid(
710 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2")
711 .getBytes(Charset.forName("UTF-8"))).toString());
712 checkNepOtsiNode(photNep, pnepUuid, nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2", "PhotMedNodeEdgePoint",
714 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
715 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
716 .collect(Collectors.toList());
717 checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
720 assertEquals(1, nepsE.size(), "Mux-OTSi node should have 1 eNEP");
721 assertEquals(1, nepsI.size(), "Mux-OTSi node should have 1 iNEPs");
722 assertEquals(1, nepsP.size(), "Mux-OTSi node should have 1 photNEPs");
723 OwnedNodeEdgePoint nep3 = nepsE.get(0);
724 Uuid enepUuid2 = new Uuid(
725 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1")
726 .getBytes(Charset.forName("UTF-8")))
728 checkNepOtsiNode(nep3, enepUuid2, nodeId + "+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1",
729 "eNodeEdgePoint", false);
730 OwnedNodeEdgePoint nep4 = nepsI.get(0);
731 Uuid inepUuid2 = new Uuid(
732 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
734 checkNepOtsiNode(nep4, inepUuid2, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
735 OwnedNodeEdgePoint photNep1 = nepsP.get(0);
736 Uuid pnep1Uuid = new Uuid(
737 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
738 .getBytes(Charset.forName("UTF-8"))).toString());
739 checkNepOtsiNode(photNep1, pnep1Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
741 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
742 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
743 .collect(Collectors.toList());
744 checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
747 assertEquals(2, nepsE.size(), "Tpdr-OTSi node should have 2 eNEPs");
748 assertEquals(2, nepsI.size(), "Tpdr-OTSi node should have 2 iNEPs");
749 assertEquals(2, nepsP.size(), "Tpdr-OTSi node should have 2 photNEPs");
750 OwnedNodeEdgePoint nep5 = nepsE.get(0);
751 Uuid enepUuid3 = new Uuid(
752 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1")
753 .getBytes(Charset.forName("UTF-8")))
755 checkNepOtsiNode(nep5, enepUuid3, nodeId + "+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1",
756 "eNodeEdgePoint", false);
757 OwnedNodeEdgePoint nep6 = nepsI.get(0);
758 Uuid inepUuid3 = new Uuid(
759 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
761 checkNepOtsiNode(nep6, inepUuid3, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
762 OwnedNodeEdgePoint photNep2 = nepsP.get(0);
763 Uuid pnep2Uuid = new Uuid(
764 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
765 .getBytes(Charset.forName("UTF-8"))).toString());
766 checkNepOtsiNode(photNep2, pnep2Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
768 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
769 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
770 .collect(Collectors.toList());
771 checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
774 // Keep trace of MC NEP test to be restored after the new policy for creating NEP is applied
775 // assertEquals(0, nepsMc.size(), "MC NEP no more configured, Roadm node should have 0 MC NEPs");
776 // assertEquals(0, nepsOtsimc.size(), "Roadm node should have 10 OTSiMC NEPs");
777 assertEquals(12, nepsPhot.size(), "Roadm node should have 12 PHOT_MEDIA NEPs (2x4 OTS +2x(OTS+OMS)");
779 OwnedNodeEdgePoint nep7 = nepsOMS.get(getRank("DEG1-TTP", nepsOMS));
780 Uuid mcnepUuid3 = new Uuid(
781 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OMS+DEG1-TTP-TXRX").getBytes(Charset
782 .forName("UTF-8"))).toString());
783 checkNepOtsiRdmNode(nep7, mcnepUuid3, nodeId + "+PHOTONIC_MEDIA_OMS+DEG1-TTP-TXRX",
784 "PHOTONIC_MEDIA_OMSNodeEdgePoint", false);
785 OwnedNodeEdgePoint nep8 = nepsOTS.get(getRank("DEG1-TTP", nepsOTS));
786 Uuid otmcnepUuid3 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+DEG1-TTP-TXRX")
787 .getBytes(Charset.forName("UTF-8"))).toString());
788 checkNepOtsiRdmNode(nep8, otmcnepUuid3, nodeId + "+PHOTONIC_MEDIA_OTS+DEG1-TTP-TXRX",
789 "PHOTONIC_MEDIA_OTSNodeEdgePoint", false);
790 OwnedNodeEdgePoint omsNep3 = nepsOMS.get(getRank("DEG1-TTP", nepsOMS));
791 Uuid omsNep3Uuid = new Uuid(
792 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OMS+DEG1-TTP-TXRX")
793 .getBytes(Charset.forName("UTF-8"))).toString());
794 checkNepOtsiRdmNode(omsNep3, omsNep3Uuid, nodeId + "+PHOTONIC_MEDIA_OMS+DEG1-TTP-TXRX",
795 "PHOTONIC_MEDIA_OMSNodeEdgePoint", false);
797 OwnedNodeEdgePoint nep10 = nepsOTS.get(getRank("SRG1-PP1", nepsOTS));
798 Uuid otsnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+SRG1-PP1-TXRX")
799 .getBytes(Charset.forName("UTF-8"))).toString());
800 checkNepOtsiRdmNode(nep10, otsnepUuid4, nodeId + "+PHOTONIC_MEDIA_OTS+SRG1-PP1-TXRX",
801 "PHOTONIC_MEDIA_OTSNodeEdgePoint", false);
802 OwnedNodeEdgePoint otsNep4 = nepsOTS.get(getRank("SRG1-PP3", nepsOTS));
803 Uuid otsNep4Uuid = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+SRG1-PP3-TXRX")
804 .getBytes(Charset.forName("UTF-8"))).toString());
805 checkNepOtsiRdmNode(otsNep4, otsNep4Uuid, nodeId + "+PHOTONIC_MEDIA_OTS+SRG1-PP3-TXRX",
806 "PHOTONIC_MEDIA_OTSNodeEdgePoint", false);
807 List<NodeRuleGroup> nrgList4 = node.nonnullNodeRuleGroup().values().stream()
808 .sorted((nrg1, nrg2) -> nrg1.getName().entrySet().iterator().next().getValue().toString()
809 .compareTo(nrg2.getName().entrySet().iterator().next().getValue().toString()))
810 .collect(Collectors.toList());
811 LOG.info("NODERULEGROUP List nrgLIst4 is as follows {}", nrgList4.toString());
812 List<Integer> nepNumber = new ArrayList<>(List.of(2, 4, 4));
813 checkNodeRuleGroupForRdm(nrgList4, nepNumber);
821 private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
822 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
823 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
824 Name name = nameList.get(0);
825 assertEquals(portName, name.getValue(), "value of client nep should be '" + portName + "'");
826 assertEquals(nepName, name.getValueName(),
827 "value-name of client nep for '" + portName + "' should be '" + nepName + "'");
828 LOG.info("checkNEPClient10G-NEP {} has following supported CEP {}", nepName, nep
829 .getSupportedCepLayerProtocolQualifierInstances().toString());
830 assertEquals(3, nep.getSupportedCepLayerProtocolQualifierInstances()
831 .size(), "Client nep should support 3 kind of cep");
832 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
833 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
834 .getSupportedCepLayerProtocolQualifierInstances();
835 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
836 lpql.add(entry.getLayerProtocolQualifier());
838 assertEquals(3, lpql.size(), "Client nep should support 3 kind of cep");
839 assertThat("client nep should support 3 kind of cep",
840 lpql, hasItems(ODUTYPEODU2.VALUE, ODUTYPEODU2E.VALUE, DIGITALSIGNALTYPE10GigELAN.VALUE));
842 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
843 checkCommonPartOfNep(nep, false);
846 private void checkNepeODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
848 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
849 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
850 Name name = nameList.get(0);
851 assertEquals(portName, name.getValue(), "value of eODU nep should be '" + portName + "'");
852 assertEquals(nepName, name.getValueName(),
853 "value-name of eODU nep for '" + portName + "' should be '" + nepName + "'");
854 // TODO: depending on the type of node there is one type or another
855 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
856 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
857 .getSupportedCepLayerProtocolQualifierInstances();
858 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
859 lpql.add(entry.getLayerProtocolQualifier());
861 assertThat("eODU nep should support 1, 2 or 3 kind of cep, depending on client port",
862 lpql.size(), anyOf(is(1), is(2), is(3)));
864 lpql.stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.VALUE)
865 || splc.equals(ODUTYPEODU2.VALUE) || splc.equals(ODUTYPEODU2E.VALUE)
866 || splc.equals(ODUTYPEODU4.VALUE)),
867 "eODU nep should support 1 kind of cep");
868 assertEquals(LayerProtocolName.ODU, nep.getLayerProtocolName(), "eODU nep should be of ODU protocol type");
869 checkCommonPartOfNep(nep, withSip);
872 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
874 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
875 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
876 Name name = nameList.get(0);
877 assertEquals(portName, name.getValue(), "value of network nep should be '" + portName + "'");
878 assertEquals(nepName, name.getValueName(),
879 "value-name of network nep for '" + portName + "' should be '" + nepName + "'");
880 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
881 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
882 .getSupportedCepLayerProtocolQualifierInstances();
883 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
884 lpql.add(entry.getLayerProtocolQualifier());
886 assertEquals(1, lpql.size(), "Network nep should support 1 kind of cep");
887 assertThat("network nep should support 1 kind of cep", lpql, hasItem(ODUTYPEODU4.VALUE));
888 assertEquals(LayerProtocolName.ODU, nep.getLayerProtocolName(), "network nep should be of ODU protocol type");
889 checkCommonPartOfNep(nep, withSip);
892 private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
894 assertEquals(4, nrgList.size(), "transponder DSR should contain 4 node rule group (DSR-I_ODU/I-ODU-E_ODU)");
895 for (NodeRuleGroup nodeRuleGroup : nrgList) {
896 assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
897 "each node-rule-group should contain 2 NEP for transponder DSR");
899 Integer indNrg = nrgContainsClientAndNetwork(nrgList, clientNepUuid, networkNepUuid);
900 assertNotNull("One node-rule-group shall contains client and network Neps", indNrg);
901 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(indNrg).nonnullNodeEdgePoint().values());
902 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
903 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
904 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
905 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
906 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
907 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
908 assertEquals(nodeEdgePointList.get(0).getNodeUuid(), nodeUuid,
909 "node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node");
910 assertEquals(nodeEdgePointList.get(1).getNodeUuid(), nodeUuid,
911 "node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node");
912 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
913 assertEquals(1, rule.size(), "node-rule-group nb 1 should contain a single rule");
914 assertEquals("forward", rule.get(0).getLocalId(), "local-id of the rule should be 'forward'");
915 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, rule.get(0).getForwardingRule(),
916 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
917 assertEquals(RuleType.FORWARDING, rule.get(0).getRuleType().stream().findFirst().orElseThrow(),
918 "the rule type should be 'FORWARDING'");
921 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
923 assertEquals(8, nrgList.size(), "muxponder DSR should contain 8 node rule group (DSR-I_ODU/I-ODU-E_ODU)");
924 Integer indNrg = nrgContainsClientAndNetwork(nrgList, clientNepUuid, networkNepUuid);
925 assertNotNull("One node-rule-group shall contains client and network Neps", indNrg);
926 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(indNrg).nonnullNodeEdgePoint().values());
927 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
928 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
929 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
930 assertEquals(nodeEdgePointList.get(0).getNodeUuid(), nodeUuid,
931 "node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node");
932 assertEquals(nodeEdgePointList.get(1).getNodeUuid(), nodeUuid,
933 "node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node");
934 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
935 assertEquals(1, rule.size(), "node-rule-group nb 2 should contain a single rule");
936 assertEquals("forward", rule.get(0).getLocalId(), "local-id of the rule should be 'forward'");
937 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, rule.get(0).getForwardingRule(),
938 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
939 assertEquals(RuleType.FORWARDING, rule.get(0).getRuleType().stream().findFirst().orElseThrow(),
940 "the rule type should be 'FORWARDING'");
943 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
945 assertEquals(2, nrgList.size(), "Switch-DSR should contain 2 node rule group (DSR-I_ODU/I-ODU-E_ODU)");
946 Integer indNrg = nrgContainsClientAndNetwork(nrgList, clientNepUuid, networkNepUuid);
947 assertNotNull("One node-rule-group shall contains client and network Neps", indNrg);
948 assertEquals(8, nrgList.get(indNrg).getNodeEdgePoint().size(), "Switch-DSR nrg should contain 8 NEP");
949 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
950 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
951 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
952 .collect(Collectors.toList());
954 for (NodeEdgePoint nep : nrg) {
955 LOG.info("nep number {} UUID is {} ", xxxxx, nep.getNodeEdgePointUuid());
958 LOG.info("nep SPDR-SA1-XPDR2+iODU+XPDR2-NETWORK1 UUID is {} ", UUID.nameUUIDFromBytes(
959 ("SPDR-SA1-XPDR2" + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8"))).toString());
960 LOG.info("nep SPDR-SA1-XPDR2+DSR+XPDR2-CLIENT4 UUID is {} ", UUID.nameUUIDFromBytes(
961 ("SPDR-SA1-XPDR2" + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8"))).toString());
962 assertEquals(networkNepUuid, nrg.get(6).getNodeEdgePointUuid(),
963 "in the sorted node-rule-group, nep number 7 should be XPDR2-NETWORK1");
964 assertEquals(clientNepUuid, nrg.get(5).getNodeEdgePointUuid(),
965 "in the sorted node-rule-group, nep number 4 should be XPDR2-CLIENT4");
966 assertEquals(nodeUuid, nrg.get(4).getNodeUuid(),
967 "any item of the node-rule-group should have the same nodeUuid");
968 assertEquals(nodeUuid, nrg.get(3).getNodeUuid(),
969 "any item of the node-rule-group should have the same nodeUuid");
971 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
972 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
973 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
974 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
975 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
976 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType().stream().findFirst().orElseThrow(),
977 "the rule type should be 'FORWARDING'");
980 private void checkNodeRuleGroupForRdm(List<NodeRuleGroup> nrgList, List<Integer> nbNeps) {
981 assertEquals(3, nrgList.size(), "RDM infra node - OTS should contain 3 node rule groups");
983 for (NodeRuleGroup nrg : nrgList) {
984 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrg.getNodeEdgePoint().values());
985 assertEquals(nbNeps.get(index), nodeEdgePointList.size(),
986 "RDM infra node -rule-group should contain " + nbNeps.get(index) + " NEP");
987 List<Rule> ruleList = new ArrayList<>(nrg.nonnullRule().values());
988 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
989 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
990 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType().stream().findFirst().orElseThrow(),
991 "the rule type should be 'FORWARDING'");
992 if (nrg.getName().entrySet().iterator().next().getValue().toString().contains("DEG")) {
993 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
994 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
996 assertEquals(FORWARDINGRULECANNOTFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
997 "the forwarding rule should be 'CANNOTFORWARDACROSSGROUP'");
1003 private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1005 assertEquals(2, nrgList.size(), "Tpdr-OTSi should contain two node rule groups");
1006 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1007 assertEquals(2, nodeEdgePointList.size(), "Tpdr-OTSi node-rule-group should contain 2 NEP");
1008 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1009 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1010 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1011 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1012 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1013 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1014 assertEquals(nodeUuid, nodeEdgePointList.get(0).getNodeUuid(),
1015 "any item of the node-rule-group should have the same nodeUuid");
1016 assertEquals(nodeUuid, nodeEdgePointList.get(1).getNodeUuid(),
1017 "any item of the node-rule-group should have the same nodeUuid");
1018 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1019 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1020 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1021 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
1022 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1023 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType().stream().findFirst().orElseThrow(),
1024 "the rule type should be 'FORWARDING'");
1027 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1029 assertEquals(1, nrgList.size(), "Mux-OTSi should contain a single node rule group");
1030 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1031 assertEquals(2, nodeEdgePointList.size(), "Mux-OTSi node-rule-group should contain 2 NEP");
1032 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1033 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1034 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1035 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1036 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1037 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1038 assertEquals(nodeUuid, nodeEdgePointList.get(0).getNodeUuid(),
1039 "any item of the node-rule-group should have the same nodeUuid");
1040 assertEquals(nodeUuid, nodeEdgePointList.get(1).getNodeUuid(),
1041 "any item of the node-rule-group should have the same nodeUuid");
1042 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1043 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1044 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1045 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
1046 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1047 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType().stream().findFirst().orElseThrow(),
1048 "the rule type should be 'FORWARDING'");
1051 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1053 assertEquals(4, nrgList.size(), "Switch-OTSi should contain 4 node rule group");
1054 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1055 assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
1056 "each node-rule-group should contain 2 NEP for Switch-OTSi");
1058 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
1059 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1060 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
1061 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1062 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1063 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
1064 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1065 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1066 assertEquals(nodeUuid, nodeEdgePointList0.get(0).getNodeUuid(),
1067 "any item of the node-rule-group should have the same nodeUuid");
1068 assertEquals(nodeUuid, nodeEdgePointList0.get(1).getNodeUuid(),
1069 "any item of the node-rule-group should have the same nodeUuid");
1070 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1071 assertEquals(1, ruleList0.size(), "node-rule-group should contain a single rule");
1072 assertEquals("forward", ruleList0.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1073 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList0.get(0).getForwardingRule(),
1074 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1075 assertEquals(RuleType.FORWARDING, ruleList0.get(0).getRuleType().stream().findFirst().orElseThrow(),
1076 "the rule type should be 'FORWARDING'");
1079 private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1080 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1081 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1082 assertEquals(portName, nameList.get(0).getValue(),
1083 "value of client nep should be '" + portName + "'");
1084 assertEquals(nepName, nameList.get(0).getValueName(),
1085 "value-name of client nep for '" + portName + "' should be '" + nepName + "'");
1086 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1087 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1088 .getSupportedCepLayerProtocolQualifierInstances();
1089 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1090 lpql.add(entry.getLayerProtocolQualifier());
1092 LOG.info("checkNEPClient100G-NEP {} has following supported CEP {}", nepName, nep
1093 .getSupportedCepLayerProtocolQualifierInstances().toString());
1094 assertEquals(2, lpql.size(), "Client nep should support 2 kind of cep");
1095 assertThat("client nep should support 2 kind of cep", lpql,
1096 hasItems(ODUTYPEODU4.VALUE, DIGITALSIGNALTYPE100GigE.VALUE));
1097 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
1098 checkCommonPartOfNep(nep, false);
1101 private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1102 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1103 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1104 assertEquals(portName, nameList.get(0).getValue(), "value of client nep should be '" + portName + "'");
1105 assertEquals(nepName, nameList.get(0).getValueName(),
1106 "value-name of client nep for '" + portName + "' should be 100G-tpdr'");
1107 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1108 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1109 .getSupportedCepLayerProtocolQualifierInstances();
1110 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1111 lpql.add(entry.getLayerProtocolQualifier());
1113 assertEquals(1, lpql.size(), "Client nep should support 1 kind of cep");
1114 assertThat("client nep should support 2 kind of cep", lpql, hasItems(DIGITALSIGNALTYPE100GigE.VALUE));
1115 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
1116 checkCommonPartOfNep(nep, false);
1119 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1121 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1122 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1123 assertEquals(portName, nameList.get(0).getValue(), "value of OTSi nep should be '" + portName + "'");
1124 assertEquals(nepName, nameList.get(0).getValueName(), "value-name of OTSi nep should be '" + nepName + "'");
1125 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1126 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1127 .getSupportedCepLayerProtocolQualifierInstances();
1128 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1129 lpql.add(entry.getLayerProtocolQualifier());
1131 assertEquals(2, lpql.size(), "OTSi nep should support 2 kind of cep");
1132 assertThat("OTSi nep should support 2 kind of cep",
1133 lpql, hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE, PHOTONICLAYERQUALIFIEROTSi.VALUE));
1134 assertEquals(LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName(),
1135 "OTSi nep should be of PHOTONIC_MEDIA protocol type");
1136 checkCommonPartOfNep(nep, withSip);
1139 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1141 if (!nep.getUuid().equals(nepUuid)) {
1142 LOG.info("ERRORUUIDNEP on Nep {}, expected {}", nep.getName().toString(), portName);
1144 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1145 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1146 assertEquals(portName, nameList.get(0).getValue(),
1147 "value of OTSi nep should be '" + portName + "'");
1148 assertEquals(nepName, nameList.get(0).getValueName(),
1149 "value-name of OTSi nep should be '" + nepName + "'");
1150 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1151 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1152 .getSupportedCepLayerProtocolQualifierInstances();
1153 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1154 lpql.add(entry.getLayerProtocolQualifier());
1156 if (nepName.contains("OMS")) {
1157 assertEquals(1, lpql.size(), "OTSi nep of RDM infra node should support only 1 kind of cep");
1158 assertThat("OTSi nep should support 1 kind of cep", lpql, hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE));
1159 assertEquals(LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName(),
1160 "OTSi nep should be of PHOTONIC_MEDIA protocol type");
1161 } else if (nepName.contains("OTS")) {
1162 assertEquals(1, lpql.size(), "OTSi nep of RDM infra node should support only 1 kind of cep");
1163 assertThat("OTSi nep should support 1 kind of cep", lpql, hasItems(PHOTONICLAYERQUALIFIEROTS.VALUE));
1164 assertEquals(LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName(),
1165 "OTSi nep should be of PHOTONIC_MEDIA protocol type");
1167 checkCommonPartOfNep(nep, withSip);
1170 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean withSip) {
1171 assertEquals(Direction.BIDIRECTIONAL, nep.getDirection(), "link port direction should be DIRECTIONAL");
1172 assertEquals(AdministrativeState.UNLOCKED, nep.getAdministrativeState(),
1173 "administrative state should be UNLOCKED");
1174 // TODO: convert this test since terminationState is migrated to CEP attribute in TAPI 2.4
1175 // assertEquals(TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState(),
1176 // "termination state should be TERMINATED BIDIRECTIONAL");
1177 assertEquals(LifecycleState.INSTALLED, nep.getLifecycleState(), "life-cycle state should be INSTALLED");
1179 assertEquals(1, nep.getMappedServiceInterfacePoint().size(), "Given nep should support 1 SIP");
1181 // TODO: convert this test since terminationState is migrated to CEP attribute in TAPI 2.4
1182 // assertEquals(TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection(),
1183 // "termination direction should be BIDIRECTIONAL");
1184 assertEquals(OperationalState.ENABLED, nep.getOperationalState(),
1185 "operational state of client nep should be ENABLED");
1186 assertEquals(PortRole.SYMMETRIC, nep.getLinkPortRole(),
1187 "link-port-role of client nep should be SYMMETRIC");
1190 private void checkOmsLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link link,
1191 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid, String linkName) {
1192 assertEquals(linkName, link.getName().get(new NameKey("OMS link name")).getValue(), "bad name for the link");
1193 assertEquals(linkUuid, link.getUuid(), "bad uuid for link");
1195 LayerProtocolName.PHOTONICMEDIA.getName(),
1196 link.getLayerProtocolName().stream().findFirst().orElseThrow().getName(),
1197 "oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA");
1198 assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),"otn tapi link should be BIDIRECTIONAL");
1199 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
1200 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1201 assertEquals(2 , nodeEdgePointList.size(), "oms link should be between 2 neps");
1202 assertEquals(topologyUuid, nodeEdgePointList.get(0).getTopologyUuid(),
1203 "topology uuid should be the same for the two termination point of the link");
1204 assertEquals(topologyUuid, nodeEdgePointList.get(1).getTopologyUuid(),
1205 "topology uuid should be the same for the two termination point of the link");
1206 assertThat("oms links should terminate on two distinct nodes",
1207 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1208 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1209 assertThat("oms links should terminate on two distinct nodes",
1210 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1211 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1212 assertThat("oms links should terminate on two distinct tps",
1213 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1214 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1215 assertThat("oms links should terminate on two distinct tps",
1216 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1217 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1220 private void checkXpdrRdmLink(
1221 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link link, Uuid node1Uuid,
1222 Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid, String linkName) {
1223 assertEquals(linkName, link.getName().get(new NameKey("XPDR-RDM link name")).getValue(),
1224 "bad name for the link");
1225 assertEquals(linkUuid, link.getUuid(), "bad uuid for link");
1227 LayerProtocolName.PHOTONICMEDIA.getName(),
1228 link.getLayerProtocolName().stream().findFirst().orElseThrow().getName(),
1229 "oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA");
1230 assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),
1231 "otn tapi link should be BIDIRECTIONAL");
1232 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
1233 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1234 assertEquals(2 , nodeEdgePointList.size(), "oms link should be between 2 neps");
1235 assertEquals(topologyUuid, nodeEdgePointList.get(0).getTopologyUuid(),
1236 "topology uuid should be the same for the two termination point of the link");
1237 assertEquals(topologyUuid, nodeEdgePointList.get(1).getTopologyUuid(),
1238 "topology uuid should be the same for the two termination point of the link");
1239 assertThat("oms links should terminate on two distinct nodes",
1240 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1241 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1242 assertThat("oms links should terminate on two distinct nodes",
1243 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1244 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1245 assertThat("oms links should terminate on two distinct tps",
1246 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1247 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1248 assertThat("oms links should terminate on two distinct tps",
1249 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1250 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1253 private Node changeTerminationPointState(Node initialNode, String tpid, String tpid1, AdminStates admin,
1255 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
1256 = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
1257 initialNode.augmentation(Node1.class));
1258 Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
1259 TerminationPointBuilder tpBldr = new TerminationPointBuilder(
1260 tps.get(new TerminationPointKey(new TpId(tpid))));
1261 tpBldr.addAugmentation(new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class))
1262 .setAdministrativeState(admin)
1263 .setOperationalState(oper)
1265 tps.replace(tpBldr.key(), tpBldr.build());
1266 TerminationPointBuilder tpBldr1 = new TerminationPointBuilder(
1267 tps.get(new TerminationPointKey(new TpId(tpid1))));
1268 tpBldr1.addAugmentation(new TerminationPoint1Builder(tpBldr1.augmentation(TerminationPoint1.class))
1269 .setAdministrativeState(admin)
1270 .setOperationalState(oper)
1272 tps.replace(tpBldr1.key(), tpBldr1.build());
1273 tpdr1Bldr.setTerminationPoint(tps);
1274 return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();
1277 private int getRank(String searchedChar, List<OwnedNodeEdgePoint> onepList) {
1278 int foundAtRank = 0;
1280 for (OwnedNodeEdgePoint onep: onepList) {
1281 for (Map.Entry<NameKey, Name> entry: onep.getName().entrySet()) {
1282 if (entry.getValue().getValue().contains(searchedChar)) {
1288 LOG.info("searched Char {} found at rank {}", searchedChar, foundAtRank);
1292 private int getNodeRank(String searchedChar,
1293 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeList) {
1294 int foundAtRank = 0;
1296 for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node: nodeList) {
1297 for (Map.Entry<NameKey, Name> entry: node.getName().entrySet()) {
1298 if (entry.getValue().getValue().contains(searchedChar)) {
1304 LOG.info("searched Char {} found at rank {}", searchedChar, foundAtRank);
1308 private Integer nrgContainsClientAndNetwork(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid) {
1309 // 1 NRG should at least contain the NEP of interest in the NEP List
1310 Integer indexNrg = 0;
1311 for (NodeRuleGroup nrg : nrgList) {
1312 Boolean foundClient = false;
1313 Boolean foundNetwork = false;
1314 for (NodeEdgePoint nep : nrg.nonnullNodeEdgePoint().values()) {
1315 foundClient = foundClient || nep.getNodeEdgePointUuid().equals(clientNepUuid);
1316 foundNetwork = foundNetwork || nep.getNodeEdgePointUuid().equals(networkNepUuid);
1318 if (foundClient && foundNetwork) {