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.FORWARDINGRULEMAYFORWARDACROSSGROUP;
91 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.RuleType;
92 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroup;
93 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
94 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
95 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
96 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint;
97 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.Rule;
98 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
99 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
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 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
214 tapiFactory.convertNode(tpdr, networkPortList);
216 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".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");
237 void convertNodeWhenBadStates1() {
238 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
239 AdminStates.OutOfService, State.OutOfService);
240 List<String> networkPortList = new ArrayList<>();
241 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
242 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
243 networkPortList.add(tp.getTpId().getValue());
246 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
247 tapiFactory.convertNode(tpdr, networkPortList);
249 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
251 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node dsrNode = tapiFactory
252 .getTapiNodes().get(new
253 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey(dsrNodeUuid));
254 Uuid enetworkNepUuid = new Uuid(
255 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
257 Uuid inetworkNepUuid = new Uuid(
258 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
260 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
261 assertEquals(AdministrativeState.LOCKED, enepN.getAdministrativeState(),
262 "Administrative State should be Locked");
263 assertEquals(OperationalState.DISABLED, enepN.getOperationalState(), "Operational State should be Disabled");
265 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
266 assertEquals(AdministrativeState.LOCKED, inepN.getAdministrativeState(),
267 "Administrative State should be Locked");
268 assertEquals(OperationalState.DISABLED, inepN.getOperationalState(), "Operational State should be Disabled");
272 void convertNodeWhenBadStates2() {
273 Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", "XPDR1-CLIENT1",
274 AdminStates.Maintenance, State.Degraded);
275 List<String> networkPortList = new ArrayList<>();
276 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
277 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
278 networkPortList.add(tp.getTpId().getValue());
281 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
282 tapiFactory.convertNode(tpdr, networkPortList);
284 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
286 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node dsrNode = tapiFactory
287 .getTapiNodes().get(new
288 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey(dsrNodeUuid));
289 Uuid enetworkNepUuid = new Uuid(
290 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
292 Uuid inetworkNepUuid = new Uuid(
293 UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
295 OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
296 assertEquals(AdministrativeState.LOCKED, enepN.getAdministrativeState(),
297 "Administrative State should be Locked");
298 assertEquals(OperationalState.DISABLED, enepN.getOperationalState(), "Operational State should be Disabled");
300 OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
301 assertEquals(AdministrativeState.LOCKED, inepN.getAdministrativeState(),
302 "Administrative State should be Locked");
303 assertEquals(OperationalState.DISABLED, inepN.getOperationalState(), "Operational State should be Disabled");
308 void convertNodeForTransponder100G() {
309 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
310 List<String> networkPortList = new ArrayList<>();
311 for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
312 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
313 networkPortList.add(tp.getTpId().getValue());
316 tapiFactory.convertNode(tpdr100G, networkPortList);
317 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
318 = tapiFactory.getTapiNodes().values().stream()
319 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
320 .collect(Collectors.toList());
322 assertEquals(1, tapiFactory.getTapiNodes().size(), "Node list size should be 1 (DSR-ODU merged)");
323 assertEquals(0, tapiFactory.getTapiLinks().size(), "Link list size should be 0 : no more transitional link");
325 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
327 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "tpdr", "XPDR-A1-XPDR1");
331 void convertNodeForOtnMuxponder() {
332 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
333 List<String> networkPortList = new ArrayList<>();
334 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
335 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
336 networkPortList.add(tp.getTpId().getValue());
339 tapiFactory.convertNode(otnMuxA, networkPortList);
340 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
341 = tapiFactory.getTapiNodes().values().stream()
342 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
343 .collect(Collectors.toList());
345 assertEquals(1, tapiFactory.getTapiNodes().size(), "Node list size should be 1 (DSR-ODU merged)");
346 assertEquals(0, tapiFactory.getTapiLinks().size(), "Link list size should be 0 : no more transitional link");
347 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
349 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "mux", "SPDR-SA1-XPDR1");
353 void convertNodeForOtnSwitch() {
354 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
355 List<String> networkPortList = new ArrayList<>();
356 for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
357 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
358 networkPortList.add(tp.getTpId().getValue());
361 tapiFactory.convertNode(otnSwitch, networkPortList);
362 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
363 = tapiFactory.getTapiNodes().values().stream()
364 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
365 .collect(Collectors.toList());
367 assertEquals(1, tapiFactory.getTapiNodes().size(), "Node list size should be 1 (DSR-ODU merged)");
368 assertEquals(0, tapiFactory.getTapiLinks().size(), "Link list size should be 0 : no more transitional link");
370 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+XPONDER".getBytes(Charset.forName("UTF-8")))
372 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "switch", "SPDR-SA1-XPDR2");
376 void convertNodeForRoadmWhenNoOtnMuxAttached() {
377 ConvertORTopoToTapiFullTopo tapiFullFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
378 tapiFullFactory.convertRoadmNode(roadmA, openroadmNet);
380 assertEquals(1, tapiFullFactory.getTapiNodes().size(), "Node list size should be 1");
381 assertEquals(0, tapiFullFactory.getTapiLinks().size(), "Link list size should be empty");
382 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
383 = tapiFullFactory.getTapiNodes().values().stream().collect(Collectors.toList());
384 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
385 .getBytes(Charset.forName("UTF-8"))).toString());
386 checkOtsiNode(tapiNodes.get(getNodeRank("ROADM-A1", tapiNodes)), roadmNodeUuid, "roadm", "ROADM-A1");
390 void convertNodeForRoadmWhenRoadmNeighborAttached() {
391 ConvertORTopoToTapiFullTopo tapiFullFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
392 tapiFullFactory.convertRoadmNode(roadmA, openroadmNet);
393 tapiFullFactory.convertRoadmNode(roadmC, openroadmNet);
395 List<Link> rdmTordmLinkList = ortopoLinks.values().stream()
396 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
397 .collect(Collectors.toList());
398 tapiFullFactory.convertRdmToRdmLinks(rdmTordmLinkList);
400 assertEquals(2, tapiFullFactory.getTapiNodes().size(), "Node list size should be 2");
401 assertEquals(1, tapiFullFactory.getTapiLinks().size(), "Link list size should be 1");
403 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
404 = tapiFullFactory.getTapiNodes().values().stream().collect(Collectors.toList());
406 for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node : tapiNodes) {
407 if (node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA)
408 && !node.getLayerProtocolName().contains(LayerProtocolName.DSR)) {
409 LOG.info("LOOP ROADM node found at rank {}, with Name {} and Uuid {}",
410 myInt, node.getName().toString(), node.getUuid());
414 Uuid roadmaNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
415 .getBytes(Charset.forName("UTF-8"))).toString());
416 LOG.info("ROADM node found at rank {} from getrank", getNodeRank("ROADM-A1", tapiNodes));
417 checkOtsiNode(tapiNodes.get(getNodeRank("ROADM-A1", tapiNodes)), roadmaNodeUuid, "roadm", "ROADM-A1");
419 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link> links
420 = tapiFullFactory.getTapiLinks().values().stream()
421 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
422 .collect(Collectors.toList());
423 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
425 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-C1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
427 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA_OTS+DEG2-TTP-TXRX"
428 .getBytes(Charset.forName("UTF-8"))).toString());
429 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-C1+PHOTONIC_MEDIA_OTS+DEG1-TTP-TXRX")
430 .getBytes(Charset.forName("UTF-8"))).toString());
432 new Uuid(UUID.nameUUIDFromBytes(
433 "ROADM-C1+PHOTONIC_MEDIA_OTS+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA_OTS+DEG2-TTP-TXRX"
434 .getBytes(Charset.forName("UTF-8"))).toString());
435 checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
436 "ROADM-C1+PHOTONIC_MEDIA_OTS+DEG1-TTP-TXRXtoROADM-A1+PHOTONIC_MEDIA_OTS+DEG2-TTP-TXRX");
440 void convertNodeForRoadmWhenOtnMuxAttached() {
441 ConvertORTopoToTapiFullTopo tapiFullFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
442 ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
443 List<String> networkPortListA = new ArrayList<>();
444 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
445 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
446 networkPortListA.add(tp.getTpId().getValue());
449 tapiFactory.convertNode(otnMuxA, networkPortListA);
450 tapiFullFactory.setTapiNodes(tapiFactory.getTapiNodes());
451 tapiFullFactory.convertRoadmNode(roadmA, openroadmNet);
452 List<Link> xponderOutLinkList = ortopoLinks.values().stream()
453 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
454 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
455 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
456 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
457 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
458 .collect(Collectors.toList());
459 List<Link> xponderInLinkList = ortopoLinks.values().stream()
460 .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
461 .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
462 || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
463 && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
464 || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
465 .collect(Collectors.toList());
466 xponderInLinkList.addAll(xponderOutLinkList);
467 tapiFullFactory.convertXpdrToRdmLinks(xponderInLinkList);
468 assertEquals(2, tapiFullFactory.getTapiNodes().size(),
469 "Node list size should be 2 (XPDR, DSR-ODU merged; ROADM)");
470 assertEquals(1, tapiFullFactory.getTapiLinks().size(),
471 "Link list size should be 1 : no more transitional link");
472 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey,
473 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeMap =
474 tapiFactory.getTapiNodes();
475 nodeMap.putAll(tapiFullFactory.getTapiNodes());
476 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
477 = nodeMap.values().stream()
478 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
479 .collect(Collectors.toList());
480 Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
481 .getBytes(Charset.forName("UTF-8"))).toString());
482 checkOtsiNode(tapiNodes.get(getNodeRank("ROADM-A1", tapiNodes)), roadmNodeUuid, "roadm", "ROADM-A1");
484 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
486 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
488 LOG.info("ROADM-A1+PHOTONIC_MEDIA UUID is {}", node2Uuid);
489 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1"
490 .getBytes(Charset.forName("UTF-8"))).toString());
491 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-A1+PHOTONIC_MEDIA_OTS+SRG1-PP2-TXRX")
492 .getBytes(Charset.forName("UTF-8"))).toString());
494 new Uuid(UUID.nameUUIDFromBytes(
495 "ROADM-A1+PHOTONIC_MEDIA_OTS+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1"
496 .getBytes(Charset.forName("UTF-8"))).toString());
497 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link> links
498 = tapiFullFactory.getTapiLinks().values().stream()
499 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
500 .collect(Collectors.toList());
501 checkXpdrRdmLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
502 "ROADM-A1+PHOTONIC_MEDIA_OTS+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1");
505 private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node,
506 Uuid node9Uuid, String dsrNodeType, String nodeId) {
507 assertEquals(node9Uuid, node.getUuid(), "incorrect node uuid");
508 assertEquals(nodeId + "+XPONDER", node.getName().get(new NameKey("dsr/odu node name")).getValue(),
509 "incorrect node name");
510 assertEquals(AdministrativeState.UNLOCKED, node.getAdministrativeState(),
511 "administrative state should be UNLOCKED");
512 assertEquals(LifecycleState.INSTALLED, node.getLifecycleState(), "life-cycle state should be INSTALLED");
513 assertEquals(OperationalState.ENABLED, node.getOperationalState(), "operational state should be ENABLED");
514 assertThat("one value-name should be 'dsr/odu node name'",
515 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("dsr/odu node name")));
516 assertEquals(4, node.getLayerProtocolName().size(), "dsr node should manage 4 protocol layers : dsr and odu"
517 + " DIGITALOTN, PHOTONICMEDIA");
518 assertThat("dsr node should manage 2 protocol layers : dsr and odu",
519 node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
520 List<OwnedNodeEdgePoint> inepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
521 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint_N")))
522 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
523 .collect(Collectors.toList());
524 List<OwnedNodeEdgePoint> enepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
525 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint_N")))
526 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
527 .collect(Collectors.toList());
528 List<OwnedNodeEdgePoint> nepsC;
529 switch (dsrNodeType) {
531 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
532 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
533 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
534 .collect(Collectors.toList());
535 assertEquals(4, enepsN.size(), "Switch-DSR node should have 4 eNEPs network");
536 assertEquals(4, inepsN.size(), "Switch-DSR node should have 4 iNEPs network");
537 assertEquals(4, nepsC.size(), "Switch-DSR node should have 4 NEPs client");
538 OwnedNodeEdgePoint nep1 = nepsC.get(2);
539 Uuid client4NepUuid = new Uuid(
540 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
542 checkNepClient100GSwitch(nep1, client4NepUuid, nodeId + "+DSR+XPDR2-CLIENT4", "NodeEdgePoint_C");
543 OwnedNodeEdgePoint enep2 = enepsN.get(2);
544 OwnedNodeEdgePoint inep2 = inepsN.get(3);
545 Uuid enetworkNepUuid = new Uuid(
546 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
548 Uuid inetworkNepUuid = new Uuid(
549 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
551 checkNepeODU4(enep2, enetworkNepUuid, nodeId + "+eODU+XPDR2-CLIENT4", "eNodeEdgePoint_N", false);
552 checkNepNetworkODU4(inep2, inetworkNepUuid, nodeId + "+iODU+XPDR2-NETWORK1", "iNodeEdgePoint_N", true);
553 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
554 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
555 .collect(Collectors.toList());
556 // keep trace of the previous test performed before the structure of the NRG was modified
557 // checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, enetworkNepUuid, node9Uuid);
558 checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, inetworkNepUuid, node9Uuid);
561 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
562 .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
563 .sorted((nep3, nep4) -> nep3.getUuid().getValue().compareTo(nep4.getUuid().getValue()))
564 .collect(Collectors.toList());
565 assertEquals(4, enepsN.size(), "Mux-DSR node should have 4 eNEP network");
566 assertEquals(1, inepsN.size(), "Mux-DSR node should have 1 iNEP network");
567 assertEquals(4, nepsC.size(), "Mux-DSR node should have 4 NEPs client");
568 OwnedNodeEdgePoint nep3 = nepsC.get(2);
569 Uuid client3NepUuid = new Uuid(
570 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
572 checkNepClient10G(nep3, client3NepUuid, nodeId + "+DSR+XPDR1-CLIENT3", "NodeEdgePoint_C");
573 OwnedNodeEdgePoint enep4 = enepsN.get(3);
574 OwnedNodeEdgePoint inep4 = inepsN.get(0);
575 Uuid eclientNepUuid2 = new Uuid(
576 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
578 Uuid inetworkNepUuid2 = new Uuid(
579 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
581 checkNepeODU4(enep4, eclientNepUuid2, nodeId + "+eODU+XPDR1-CLIENT3", "eNodeEdgePoint_N", false);
582 checkNepNetworkODU4(inep4, inetworkNepUuid2, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
584 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
585 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
586 .collect(Collectors.toList());
587 // keep trace of the previous test performed before the structure of the NRG was modified
588 // checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, eclientNepUuid2, node9Uuid);
589 checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, inetworkNepUuid2, node9Uuid);
592 nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
593 .filter(n -> n.getName().containsKey(new NameKey("100G-tpdr")))
594 .sorted((nep5, nep6) -> nep5.getUuid().getValue().compareTo(nep6.getUuid().getValue()))
595 .collect(Collectors.toList());
596 assertEquals(2, enepsN.size(), "Tpdr-DSR node should have 2 eNEPs network");
597 assertEquals(2, inepsN.size(), "Tpdr-DSR node should have 2 iNEPs network");
598 assertEquals(2, nepsC.size(), "Tpdr-DSR node should have 2 NEPs client");
599 OwnedNodeEdgePoint nep5 = nepsC.get(0);
600 Uuid client1NepUuid = new Uuid(
601 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
603 checkNepClient100GTpdr(nep5, client1NepUuid, nodeId + "+DSR+XPDR1-CLIENT1", "100G-tpdr");
604 OwnedNodeEdgePoint enep6 = enepsN.get(0);
605 OwnedNodeEdgePoint inep6 = inepsN.get(1);
606 Uuid enetworkNepUuid3 = new Uuid(
607 UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
609 Uuid inetworkNepUuid3 = new Uuid(
610 UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
612 checkNepeODU4(enep6, enetworkNepUuid3, nodeId + "+eODU+XPDR1-CLIENT1", "eNodeEdgePoint_N", false);
613 checkNepNetworkODU4(inep6, inetworkNepUuid3, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
615 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
616 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
617 .collect(Collectors.toList());
618 // keep trace of the previous test performed before the structure of the NRG was modified
619 // checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, enetworkNepUuid3, node9Uuid);
620 checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, inetworkNepUuid3, node9Uuid);
628 private void checkOtsiNode(
629 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node,
630 Uuid nodeUuid, String otsiNodeType, String nodeId) {
631 if (!node.getUuid().equals(nodeUuid)) {
632 LOG.info("ERRORUUID on Node.getNodeId {}, NodeId {}", node.getName().toString(), nodeId);
633 LOG.info("ERRORUUID TapiUuid {}, transmitted Node Uuid {}", node.getUuid(), nodeUuid);
635 assertEquals(nodeUuid, node.getUuid(), "incorrect node uuid");
636 List<OwnedNodeEdgePoint> nepsI = null;
637 List<OwnedNodeEdgePoint> nepsE = null;
638 List<OwnedNodeEdgePoint> nepsP = null;
639 List<OwnedNodeEdgePoint> nepsOMS = null;
640 List<OwnedNodeEdgePoint> nepsOTS = null;
641 List<OwnedNodeEdgePoint> nepsPhot = null;
642 if (!otsiNodeType.equals("roadm")) {
643 assertEquals(nodeId + "+XPONDER", node.getName().get(new NameKey("dsr/odu node name")).getValue(),
644 "incorrect node name");
645 assertThat("one value-name should be 'dsr/odu node name'",
646 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("dsr/odu node name")));
647 nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
648 .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
649 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
650 .collect(Collectors.toList());
651 nepsE = node.nonnullOwnedNodeEdgePoint().values().stream()
652 .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint")))
653 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
654 .collect(Collectors.toList());
655 nepsP = node.nonnullOwnedNodeEdgePoint().values().stream()
656 .filter(n -> n.getName().containsKey(new NameKey("PhotMedNodeEdgePoint")))
657 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
658 .collect(Collectors.toList());
660 assertEquals(nodeId + "+PHOTONIC_MEDIA", node.getName().get(new NameKey("roadm node name")).getValue(),
661 "incorrect node name");
662 assertThat("one value-name should be 'dsr/odu node name'",
663 new ArrayList<>(node.nonnullName().keySet()), hasItem(new NameKey("roadm node name")));
664 nepsOMS = node.nonnullOwnedNodeEdgePoint().values().stream()
665 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIA_OMSNodeEdgePoint")))
666 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
667 .collect(Collectors.toList());
668 nepsOTS = node.nonnullOwnedNodeEdgePoint().values().stream()
669 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIA_OTSNodeEdgePoint")))
670 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
671 .collect(Collectors.toList());
672 nepsPhot = node.nonnullOwnedNodeEdgePoint().values().stream()
673 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIA_OMSNodeEdgePoint")))
674 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
675 .collect(Collectors.toList());
676 nepsPhot.addAll(node.nonnullOwnedNodeEdgePoint().values().stream()
677 .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIA_OTSNodeEdgePoint")))
678 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
679 .collect(Collectors.toList()));
681 assertEquals(AdministrativeState.UNLOCKED, node.getAdministrativeState(),
682 "administrative state should be UNLOCKED");
683 assertEquals(LifecycleState.INSTALLED, node.getLifecycleState(), "life-cycle state should be INSTALLED");
684 assertEquals(OperationalState.ENABLED, node.getOperationalState(), "operational state should be ENABLED");
685 assertEquals(1, node.getLayerProtocolName().size(),
686 "otsi node should manage a single protocol layer : PHOTONIC_MEDIA");
687 assertEquals(LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().stream().findFirst().orElseThrow(),
688 "otsi node should manage a single protocol layer : PHOTONIC_MEDIA");
690 switch (otsiNodeType) {
692 assertEquals(4, nepsE.size(), "Switch-OTSi node should have 4 eNEPs");
693 assertEquals(4, nepsI.size(), "Switch-OTSi node should have 4 iNEPs");
694 assertEquals(4, nepsP.size(), "Switch-OTSi node should have 4 photNEPs");
695 OwnedNodeEdgePoint nep1 = nepsI.get(1);
696 Uuid inepUuid = new Uuid(
697 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
699 checkNepOtsiNode(nep1, inepUuid, nodeId + "+iOTSi+XPDR2-NETWORK2", "iNodeEdgePoint", true);
700 OwnedNodeEdgePoint nep2 = nepsE.get(0);
701 Uuid enepUuid = new Uuid(
702 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+XPDR2-NETWORK2")
703 .getBytes(Charset.forName("UTF-8")))
705 checkNepOtsiNode(nep2, enepUuid, nodeId + "+PHOTONIC_MEDIA_OTS+XPDR2-NETWORK2",
706 "eNodeEdgePoint", false);
707 OwnedNodeEdgePoint photNep = nepsP.get(1);
708 Uuid pnepUuid = new Uuid(
709 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2")
710 .getBytes(Charset.forName("UTF-8"))).toString());
711 checkNepOtsiNode(photNep, pnepUuid, nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2", "PhotMedNodeEdgePoint",
713 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
714 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
715 .collect(Collectors.toList());
716 checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
719 assertEquals(1, nepsE.size(), "Mux-OTSi node should have 1 eNEP");
720 assertEquals(1, nepsI.size(), "Mux-OTSi node should have 1 iNEPs");
721 assertEquals(1, nepsP.size(), "Mux-OTSi node should have 1 photNEPs");
722 OwnedNodeEdgePoint nep3 = nepsE.get(0);
723 Uuid enepUuid2 = new Uuid(
724 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1")
725 .getBytes(Charset.forName("UTF-8")))
727 checkNepOtsiNode(nep3, enepUuid2, nodeId + "+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1",
728 "eNodeEdgePoint", false);
729 OwnedNodeEdgePoint nep4 = nepsI.get(0);
730 Uuid inepUuid2 = new Uuid(
731 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
733 checkNepOtsiNode(nep4, inepUuid2, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
734 OwnedNodeEdgePoint photNep1 = nepsP.get(0);
735 Uuid pnep1Uuid = new Uuid(
736 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
737 .getBytes(Charset.forName("UTF-8"))).toString());
738 checkNepOtsiNode(photNep1, pnep1Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
740 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
741 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
742 .collect(Collectors.toList());
743 checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
746 assertEquals(2, nepsE.size(), "Tpdr-OTSi node should have 2 eNEPs");
747 assertEquals(2, nepsI.size(), "Tpdr-OTSi node should have 2 iNEPs");
748 assertEquals(2, nepsP.size(), "Tpdr-OTSi node should have 2 photNEPs");
749 OwnedNodeEdgePoint nep5 = nepsE.get(0);
750 Uuid enepUuid3 = new Uuid(
751 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1")
752 .getBytes(Charset.forName("UTF-8")))
754 checkNepOtsiNode(nep5, enepUuid3, nodeId + "+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1",
755 "eNodeEdgePoint", false);
756 OwnedNodeEdgePoint nep6 = nepsI.get(0);
757 Uuid inepUuid3 = new Uuid(
758 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
760 checkNepOtsiNode(nep6, inepUuid3, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
761 OwnedNodeEdgePoint photNep2 = nepsP.get(0);
762 Uuid pnep2Uuid = new Uuid(
763 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
764 .getBytes(Charset.forName("UTF-8"))).toString());
765 checkNepOtsiNode(photNep2, pnep2Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
767 List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
768 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
769 .collect(Collectors.toList());
770 checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
773 // Keep trace of MC NEP test to be restored after the new policy for creating NEP is applied
774 // assertEquals(0, nepsMc.size(), "MC NEP no more configured, Roadm node should have 0 MC NEPs");
775 // assertEquals(0, nepsOtsimc.size(), "Roadm node should have 10 OTSiMC NEPs");
776 assertEquals(12, nepsPhot.size(), "Roadm node should have 12 PHOT_MEDIA NEPs (2x4 OTS +2x(OTS+OMS)");
778 OwnedNodeEdgePoint nep7 = nepsOMS.get(getRank("DEG1-TTP", nepsOMS));
779 Uuid mcnepUuid3 = new Uuid(
780 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OMS+DEG1-TTP-TXRX").getBytes(Charset
781 .forName("UTF-8"))).toString());
782 checkNepOtsiRdmNode(nep7, mcnepUuid3, nodeId + "+PHOTONIC_MEDIA_OMS+DEG1-TTP-TXRX",
783 "PHOTONIC_MEDIA_OMSNodeEdgePoint", false);
784 OwnedNodeEdgePoint nep8 = nepsOTS.get(getRank("DEG1-TTP", nepsOTS));
785 Uuid otmcnepUuid3 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+DEG1-TTP-TXRX")
786 .getBytes(Charset.forName("UTF-8"))).toString());
787 checkNepOtsiRdmNode(nep8, otmcnepUuid3, nodeId + "+PHOTONIC_MEDIA_OTS+DEG1-TTP-TXRX",
788 "PHOTONIC_MEDIA_OTSNodeEdgePoint", false);
789 OwnedNodeEdgePoint omsNep3 = nepsOMS.get(getRank("DEG1-TTP", nepsOMS));
790 Uuid omsNep3Uuid = new Uuid(
791 UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OMS+DEG1-TTP-TXRX")
792 .getBytes(Charset.forName("UTF-8"))).toString());
793 checkNepOtsiRdmNode(omsNep3, omsNep3Uuid, nodeId + "+PHOTONIC_MEDIA_OMS+DEG1-TTP-TXRX",
794 "PHOTONIC_MEDIA_OMSNodeEdgePoint", false);
796 OwnedNodeEdgePoint nep10 = nepsOTS.get(getRank("SRG1-PP1", nepsOTS));
797 Uuid otsnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+SRG1-PP1-TXRX")
798 .getBytes(Charset.forName("UTF-8"))).toString());
799 checkNepOtsiRdmNode(nep10, otsnepUuid4, nodeId + "+PHOTONIC_MEDIA_OTS+SRG1-PP1-TXRX",
800 "PHOTONIC_MEDIA_OTSNodeEdgePoint", false);
801 OwnedNodeEdgePoint otsNep4 = nepsOTS.get(getRank("SRG1-PP3", nepsOTS));
802 Uuid otsNep4Uuid = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA_OTS+SRG1-PP3-TXRX")
803 .getBytes(Charset.forName("UTF-8"))).toString());
804 checkNepOtsiRdmNode(otsNep4, otsNep4Uuid, nodeId + "+PHOTONIC_MEDIA_OTS+SRG1-PP3-TXRX",
805 "PHOTONIC_MEDIA_OTSNodeEdgePoint", false);
806 List<NodeRuleGroup> nrgList4 = node.nonnullNodeRuleGroup().values().stream()
807 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
808 .collect(Collectors.toList());
809 checkNodeRuleGroupForRdm(nrgList4, 12);
817 private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
818 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
819 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
820 Name name = nameList.get(0);
821 assertEquals(portName, name.getValue(), "value of client nep should be '" + portName + "'");
822 assertEquals(nepName, name.getValueName(),
823 "value-name of client nep for '" + portName + "' should be '" + nepName + "'");
824 LOG.info("checkNEPClient10G-NEP {} has following supported CEP {}", nepName, nep
825 .getSupportedCepLayerProtocolQualifierInstances().toString());
826 assertEquals(3, nep.getSupportedCepLayerProtocolQualifierInstances()
827 .size(), "Client nep should support 3 kind of cep");
828 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
829 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
830 .getSupportedCepLayerProtocolQualifierInstances();
831 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
832 lpql.add(entry.getLayerProtocolQualifier());
834 assertEquals(3, lpql.size(), "Client nep should support 3 kind of cep");
835 assertThat("client nep should support 3 kind of cep",
836 lpql, hasItems(ODUTYPEODU2.VALUE, ODUTYPEODU2E.VALUE, DIGITALSIGNALTYPE10GigELAN.VALUE));
838 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
839 checkCommonPartOfNep(nep, false);
842 private void checkNepeODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
844 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
845 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
846 Name name = nameList.get(0);
847 assertEquals(portName, name.getValue(), "value of eODU nep should be '" + portName + "'");
848 assertEquals(nepName, name.getValueName(),
849 "value-name of eODU nep for '" + portName + "' should be '" + nepName + "'");
850 // TODO: depending on the type of node there is one type or another
851 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
852 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
853 .getSupportedCepLayerProtocolQualifierInstances();
854 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
855 lpql.add(entry.getLayerProtocolQualifier());
857 assertThat("eODU nep should support 1, 2 or 3 kind of cep, depending on client port",
858 lpql.size(), anyOf(is(1), is(2), is(3)));
860 lpql.stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.VALUE)
861 || splc.equals(ODUTYPEODU2.VALUE) || splc.equals(ODUTYPEODU2E.VALUE)
862 || splc.equals(ODUTYPEODU4.VALUE)),
863 "eODU nep should support 1 kind of cep");
864 assertEquals(LayerProtocolName.ODU, nep.getLayerProtocolName(), "eODU nep should be of ODU protocol type");
865 checkCommonPartOfNep(nep, withSip);
868 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
870 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
871 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
872 Name name = nameList.get(0);
873 assertEquals(portName, name.getValue(), "value of network nep should be '" + portName + "'");
874 assertEquals(nepName, name.getValueName(),
875 "value-name of network nep for '" + portName + "' should be '" + nepName + "'");
876 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
877 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
878 .getSupportedCepLayerProtocolQualifierInstances();
879 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
880 lpql.add(entry.getLayerProtocolQualifier());
882 assertEquals(1, lpql.size(), "Network nep should support 1 kind of cep");
883 assertThat("network nep should support 1 kind of cep", lpql, hasItem(ODUTYPEODU4.VALUE));
884 assertEquals(LayerProtocolName.ODU, nep.getLayerProtocolName(), "network nep should be of ODU protocol type");
885 checkCommonPartOfNep(nep, withSip);
888 private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
890 assertEquals(4, nrgList.size(), "transponder DSR should contain 4 node rule group (DSR-I_ODU/I-ODU-E_ODU)");
891 for (NodeRuleGroup nodeRuleGroup : nrgList) {
892 assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
893 "each node-rule-group should contain 2 NEP for transponder DSR");
895 Integer indNrg = nrgContainsClientAndNetwork(nrgList, clientNepUuid, networkNepUuid);
896 assertNotNull("One node-rule-group shall contains client and network Neps", indNrg);
897 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(indNrg).nonnullNodeEdgePoint().values());
898 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
899 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
900 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
901 assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
902 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
903 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
904 assertEquals(nodeEdgePointList.get(0).getNodeUuid(), nodeUuid,
905 "node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node");
906 assertEquals(nodeEdgePointList.get(1).getNodeUuid(), nodeUuid,
907 "node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node");
908 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
909 assertEquals(1, rule.size(), "node-rule-group nb 1 should contain a single rule");
910 assertEquals("forward", rule.get(0).getLocalId(), "local-id of the rule should be 'forward'");
911 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, rule.get(0).getForwardingRule(),
912 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
913 assertEquals(RuleType.FORWARDING, rule.get(0).getRuleType().stream().findFirst().orElseThrow(),
914 "the rule type should be 'FORWARDING'");
917 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
919 assertEquals(8, nrgList.size(), "muxponder DSR should contain 8 node rule group (DSR-I_ODU/I-ODU-E_ODU)");
920 Integer indNrg = nrgContainsClientAndNetwork(nrgList, clientNepUuid, networkNepUuid);
921 assertNotNull("One node-rule-group shall contains client and network Neps", indNrg);
922 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(indNrg).nonnullNodeEdgePoint().values());
923 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
924 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
925 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
926 assertEquals(nodeEdgePointList.get(0).getNodeUuid(), nodeUuid,
927 "node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node");
928 assertEquals(nodeEdgePointList.get(1).getNodeUuid(), nodeUuid,
929 "node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node");
930 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
931 assertEquals(1, rule.size(), "node-rule-group nb 2 should contain a single rule");
932 assertEquals("forward", rule.get(0).getLocalId(), "local-id of the rule should be 'forward'");
933 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, rule.get(0).getForwardingRule(),
934 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
935 assertEquals(RuleType.FORWARDING, rule.get(0).getRuleType().stream().findFirst().orElseThrow(),
936 "the rule type should be 'FORWARDING'");
939 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
941 assertEquals(2, nrgList.size(), "Switch-DSR should contain 2 node rule group (DSR-I_ODU/I-ODU-E_ODU)");
942 Integer indNrg = nrgContainsClientAndNetwork(nrgList, clientNepUuid, networkNepUuid);
943 assertNotNull("One node-rule-group shall contains client and network Neps", indNrg);
944 assertEquals(8, nrgList.get(indNrg).getNodeEdgePoint().size(), "Switch-DSR nrg should contain 8 NEP");
945 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
946 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
947 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
948 .collect(Collectors.toList());
950 for (NodeEdgePoint nep : nrg) {
951 LOG.info("nep number {} UUID is {} ", xxxxx, nep.getNodeEdgePointUuid());
954 LOG.info("nep SPDR-SA1-XPDR2+iODU+XPDR2-NETWORK1 UUID is {} ", UUID.nameUUIDFromBytes(
955 ("SPDR-SA1-XPDR2" + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8"))).toString());
956 LOG.info("nep SPDR-SA1-XPDR2+DSR+XPDR2-CLIENT4 UUID is {} ", UUID.nameUUIDFromBytes(
957 ("SPDR-SA1-XPDR2" + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8"))).toString());
958 assertEquals(networkNepUuid, nrg.get(6).getNodeEdgePointUuid(),
959 "in the sorted node-rule-group, nep number 7 should be XPDR2-NETWORK1");
960 assertEquals(clientNepUuid, nrg.get(5).getNodeEdgePointUuid(),
961 "in the sorted node-rule-group, nep number 4 should be XPDR2-CLIENT4");
962 assertEquals(nodeUuid, nrg.get(4).getNodeUuid(),
963 "any item of the node-rule-group should have the same nodeUuid");
964 assertEquals(nodeUuid, nrg.get(3).getNodeUuid(),
965 "any item of the node-rule-group should have the same nodeUuid");
967 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
968 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
969 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
970 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
971 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
972 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType().stream().findFirst().orElseThrow(),
973 "the rule type should be 'FORWARDING'");
976 private void checkNodeRuleGroupForRdm(List<NodeRuleGroup> nrgList, int nbNeps) {
977 assertEquals(1, nrgList.size(), "RDM infra node - OTSi should contain a single node rule groups");
979 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
980 assertEquals(nbNeps, nodeEdgePointList.size(),
981 "RDM infra node -rule-group should contain " + nbNeps + " NEP");
983 assertNull(nrgList.get(0).getNodeEdgePoint(), "RDM infra node -rule-group should contain no NEP");
985 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
986 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
987 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
988 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
989 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
990 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType().stream().findFirst().orElseThrow(),
991 "the rule type should be 'FORWARDING'");
994 private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
996 assertEquals(2, nrgList.size(), "Tpdr-OTSi should contain two node rule groups");
997 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
998 assertEquals(2, nodeEdgePointList.size(), "Tpdr-OTSi node-rule-group should contain 2 NEP");
999 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1000 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1001 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1002 assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1003 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1004 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1005 assertEquals(nodeUuid, nodeEdgePointList.get(0).getNodeUuid(),
1006 "any item of the node-rule-group should have the same nodeUuid");
1007 assertEquals(nodeUuid, nodeEdgePointList.get(1).getNodeUuid(),
1008 "any item of the node-rule-group should have the same nodeUuid");
1009 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1010 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1011 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1012 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
1013 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1014 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType().stream().findFirst().orElseThrow(),
1015 "the rule type should be 'FORWARDING'");
1018 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1020 assertEquals(1, nrgList.size(), "Mux-OTSi should contain a single node rule group");
1021 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1022 assertEquals(2, nodeEdgePointList.size(), "Mux-OTSi node-rule-group should contain 2 NEP");
1023 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1024 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1025 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1026 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
1027 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1028 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1029 assertEquals(nodeUuid, nodeEdgePointList.get(0).getNodeUuid(),
1030 "any item of the node-rule-group should have the same nodeUuid");
1031 assertEquals(nodeUuid, nodeEdgePointList.get(1).getNodeUuid(),
1032 "any item of the node-rule-group should have the same nodeUuid");
1033 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1034 assertEquals(1, ruleList.size(), "node-rule-group should contain a single rule");
1035 assertEquals("forward", ruleList.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1036 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList.get(0).getForwardingRule(),
1037 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1038 assertEquals(RuleType.FORWARDING, ruleList.get(0).getRuleType().stream().findFirst().orElseThrow(),
1039 "the rule type should be 'FORWARDING'");
1042 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
1044 assertEquals(4, nrgList.size(), "Switch-OTSi should contain 4 node rule group");
1045 for (NodeRuleGroup nodeRuleGroup : nrgList) {
1046 assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
1047 "each node-rule-group should contain 2 NEP for Switch-OTSi");
1049 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
1050 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1051 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
1052 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1053 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
1054 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
1055 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
1056 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
1057 assertEquals(nodeUuid, nodeEdgePointList0.get(0).getNodeUuid(),
1058 "any item of the node-rule-group should have the same nodeUuid");
1059 assertEquals(nodeUuid, nodeEdgePointList0.get(1).getNodeUuid(),
1060 "any item of the node-rule-group should have the same nodeUuid");
1061 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
1062 assertEquals(1, ruleList0.size(), "node-rule-group should contain a single rule");
1063 assertEquals("forward", ruleList0.get(0).getLocalId(), "local-id of the rule should be 'forward'");
1064 assertEquals(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, ruleList0.get(0).getForwardingRule(),
1065 "the forwarding rule should be 'MAYFORWARDACROSSGROUP'");
1066 assertEquals(RuleType.FORWARDING, ruleList0.get(0).getRuleType().stream().findFirst().orElseThrow(),
1067 "the rule type should be 'FORWARDING'");
1070 private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1071 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1072 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1073 assertEquals(portName, nameList.get(0).getValue(),
1074 "value of client nep should be '" + portName + "'");
1075 assertEquals(nepName, nameList.get(0).getValueName(),
1076 "value-name of client nep for '" + portName + "' should be '" + nepName + "'");
1077 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1078 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1079 .getSupportedCepLayerProtocolQualifierInstances();
1080 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1081 lpql.add(entry.getLayerProtocolQualifier());
1083 LOG.info("checkNEPClient100G-NEP {} has following supported CEP {}", nepName, nep
1084 .getSupportedCepLayerProtocolQualifierInstances().toString());
1085 assertEquals(2, lpql.size(), "Client nep should support 2 kind of cep");
1086 assertThat("client nep should support 2 kind of cep", lpql,
1087 hasItems(ODUTYPEODU4.VALUE, DIGITALSIGNALTYPE100GigE.VALUE));
1088 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
1089 checkCommonPartOfNep(nep, false);
1092 private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
1093 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1094 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1095 assertEquals(portName, nameList.get(0).getValue(), "value of client nep should be '" + portName + "'");
1096 assertEquals(nepName, nameList.get(0).getValueName(),
1097 "value-name of client nep for '" + portName + "' should be 100G-tpdr'");
1098 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1099 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1100 .getSupportedCepLayerProtocolQualifierInstances();
1101 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1102 lpql.add(entry.getLayerProtocolQualifier());
1104 assertEquals(1, lpql.size(), "Client nep should support 1 kind of cep");
1105 assertThat("client nep should support 2 kind of cep", lpql, hasItems(DIGITALSIGNALTYPE100GigE.VALUE));
1106 assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR protocol type");
1107 checkCommonPartOfNep(nep, false);
1110 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1112 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1113 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1114 assertEquals(portName, nameList.get(0).getValue(), "value of OTSi nep should be '" + portName + "'");
1115 assertEquals(nepName, nameList.get(0).getValueName(), "value-name of OTSi nep should be '" + nepName + "'");
1116 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1117 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1118 .getSupportedCepLayerProtocolQualifierInstances();
1119 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1120 lpql.add(entry.getLayerProtocolQualifier());
1122 assertEquals(2, lpql.size(), "OTSi nep should support 2 kind of cep");
1123 assertThat("OTSi nep should support 2 kind of cep",
1124 lpql, hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE, PHOTONICLAYERQUALIFIEROTSi.VALUE));
1125 assertEquals(LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName(),
1126 "OTSi nep should be of PHOTONIC_MEDIA protocol type");
1127 checkCommonPartOfNep(nep, withSip);
1130 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
1132 if (!nep.getUuid().equals(nepUuid)) {
1133 LOG.info("ERRORUUIDNEP on Nep {}, expected {}", nep.getName().toString(), portName);
1135 assertEquals(nepUuid, nep.getUuid(), "bad uuid for " + portName);
1136 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
1137 assertEquals(portName, nameList.get(0).getValue(),
1138 "value of OTSi nep should be '" + portName + "'");
1139 assertEquals(nepName, nameList.get(0).getValueName(),
1140 "value-name of OTSi nep should be '" + nepName + "'");
1141 List<LAYERPROTOCOLQUALIFIER> lpql = new ArrayList<>();
1142 List<SupportedCepLayerProtocolQualifierInstances> lsclpqi = nep
1143 .getSupportedCepLayerProtocolQualifierInstances();
1144 for (SupportedCepLayerProtocolQualifierInstances entry : lsclpqi) {
1145 lpql.add(entry.getLayerProtocolQualifier());
1147 if (nepName.contains("OMS")) {
1148 assertEquals(1, lpql.size(), "OTSi nep of RDM infra node should support only 1 kind of cep");
1149 assertThat("OTSi nep should support 1 kind of cep", lpql, hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE));
1150 assertEquals(LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName(),
1151 "OTSi nep should be of PHOTONIC_MEDIA protocol type");
1152 } else if (nepName.contains("OTS")) {
1153 assertEquals(1, lpql.size(), "OTSi nep of RDM infra node should support only 1 kind of cep");
1154 assertThat("OTSi nep should support 1 kind of cep", lpql, hasItems(PHOTONICLAYERQUALIFIEROTS.VALUE));
1155 assertEquals(LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName(),
1156 "OTSi nep should be of PHOTONIC_MEDIA protocol type");
1158 checkCommonPartOfNep(nep, withSip);
1161 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean withSip) {
1162 assertEquals(Direction.BIDIRECTIONAL, nep.getDirection(), "link port direction should be DIRECTIONAL");
1163 assertEquals(AdministrativeState.UNLOCKED, nep.getAdministrativeState(),
1164 "administrative state should be UNLOCKED");
1165 // TODO: convert this test since terminationState is migrated to CEP attribute in TAPI 2.4
1166 // assertEquals(TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState(),
1167 // "termination state should be TERMINATED BIDIRECTIONAL");
1168 assertEquals(LifecycleState.INSTALLED, nep.getLifecycleState(), "life-cycle state should be INSTALLED");
1170 assertEquals(1, nep.getMappedServiceInterfacePoint().size(), "Given nep should support 1 SIP");
1172 // TODO: convert this test since terminationState is migrated to CEP attribute in TAPI 2.4
1173 // assertEquals(TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection(),
1174 // "termination direction should be BIDIRECTIONAL");
1175 assertEquals(OperationalState.ENABLED, nep.getOperationalState(),
1176 "operational state of client nep should be ENABLED");
1177 assertEquals(PortRole.SYMMETRIC, nep.getLinkPortRole(),
1178 "link-port-role of client nep should be SYMMETRIC");
1181 private void checkOmsLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link link,
1182 Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid, String linkName) {
1183 assertEquals(linkName, link.getName().get(new NameKey("OMS link name")).getValue(), "bad name for the link");
1184 assertEquals(linkUuid, link.getUuid(), "bad uuid for link");
1186 LayerProtocolName.PHOTONICMEDIA.getName(),
1187 link.getLayerProtocolName().stream().findFirst().orElseThrow().getName(),
1188 "oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA");
1189 assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),"otn tapi link should be BIDIRECTIONAL");
1190 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
1191 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1192 assertEquals(2 , nodeEdgePointList.size(), "oms link should be between 2 neps");
1193 assertEquals(topologyUuid, nodeEdgePointList.get(0).getTopologyUuid(),
1194 "topology uuid should be the same for the two termination point of the link");
1195 assertEquals(topologyUuid, nodeEdgePointList.get(1).getTopologyUuid(),
1196 "topology uuid should be the same for the two termination point of the link");
1197 assertThat("oms links should terminate on two distinct nodes",
1198 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1199 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1200 assertThat("oms links should terminate on two distinct nodes",
1201 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1202 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1203 assertThat("oms links should terminate on two distinct tps",
1204 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1205 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1206 assertThat("oms links should terminate on two distinct tps",
1207 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1208 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1211 private void checkXpdrRdmLink(
1212 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link link, Uuid node1Uuid,
1213 Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid, String linkName) {
1214 assertEquals(linkName, link.getName().get(new NameKey("XPDR-RDM link name")).getValue(),
1215 "bad name for the link");
1216 assertEquals(linkUuid, link.getUuid(), "bad uuid for link");
1218 LayerProtocolName.PHOTONICMEDIA.getName(),
1219 link.getLayerProtocolName().stream().findFirst().orElseThrow().getName(),
1220 "oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA");
1221 assertEquals(ForwardingDirection.BIDIRECTIONAL, link.getDirection(),
1222 "otn tapi link should be BIDIRECTIONAL");
1223 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
1224 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
1225 assertEquals(2 , nodeEdgePointList.size(), "oms link should be between 2 neps");
1226 assertEquals(topologyUuid, nodeEdgePointList.get(0).getTopologyUuid(),
1227 "topology uuid should be the same for the two termination point of the link");
1228 assertEquals(topologyUuid, nodeEdgePointList.get(1).getTopologyUuid(),
1229 "topology uuid should be the same for the two termination point of the link");
1230 assertThat("oms links should terminate on two distinct nodes",
1231 nodeEdgePointList.get(0).getNodeUuid().getValue(),
1232 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1233 assertThat("oms links should terminate on two distinct nodes",
1234 nodeEdgePointList.get(1).getNodeUuid().getValue(),
1235 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
1236 assertThat("oms links should terminate on two distinct tps",
1237 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
1238 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1239 assertThat("oms links should terminate on two distinct tps",
1240 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
1241 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
1244 private Node changeTerminationPointState(Node initialNode, String tpid, String tpid1, AdminStates admin,
1246 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
1247 = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
1248 initialNode.augmentation(Node1.class));
1249 Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
1250 TerminationPointBuilder tpBldr = new TerminationPointBuilder(
1251 tps.get(new TerminationPointKey(new TpId(tpid))));
1252 tpBldr.addAugmentation(new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class))
1253 .setAdministrativeState(admin)
1254 .setOperationalState(oper)
1256 tps.replace(tpBldr.key(), tpBldr.build());
1257 TerminationPointBuilder tpBldr1 = new TerminationPointBuilder(
1258 tps.get(new TerminationPointKey(new TpId(tpid1))));
1259 tpBldr1.addAugmentation(new TerminationPoint1Builder(tpBldr1.augmentation(TerminationPoint1.class))
1260 .setAdministrativeState(admin)
1261 .setOperationalState(oper)
1263 tps.replace(tpBldr1.key(), tpBldr1.build());
1264 tpdr1Bldr.setTerminationPoint(tps);
1265 return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();
1268 private int getRank(String searchedChar, List<OwnedNodeEdgePoint> onepList) {
1269 int foundAtRank = 0;
1271 for (OwnedNodeEdgePoint onep: onepList) {
1272 for (Map.Entry<NameKey, Name> entry: onep.getName().entrySet()) {
1273 if (entry.getValue().getValue().contains(searchedChar)) {
1279 LOG.info("searched Char {} found at rank {}", searchedChar, foundAtRank);
1283 private int getNodeRank(String searchedChar,
1284 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeList) {
1285 int foundAtRank = 0;
1287 for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node: nodeList) {
1288 for (Map.Entry<NameKey, Name> entry: node.getName().entrySet()) {
1289 if (entry.getValue().getValue().contains(searchedChar)) {
1295 LOG.info("searched Char {} found at rank {}", searchedChar, foundAtRank);
1299 private Integer nrgContainsClientAndNetwork(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid) {
1300 // 1 NRG should at least contain the NEP of interest in the NEP List
1301 Boolean foundClient = false;
1302 Boolean foundNetwork = false;
1303 Integer indexNrg = 0;
1304 for (NodeRuleGroup nrg : nrgList) {
1305 for (NodeEdgePoint nep : nrg.nonnullNodeEdgePoint().values()) {
1306 if (nep.getNodeEdgePointUuid().equals(clientNepUuid)) {
1308 } else if (nep.getNodeEdgePointUuid().equals(networkNepUuid)) {
1309 foundNetwork = true;
1312 if (foundClient && foundNetwork) {
1315 foundClient = false;
1316 foundNetwork = false;
1320 if (foundClient && foundNetwork) {