2 * Copyright © 2020 Orange, 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.containsString;
11 import static org.hamcrest.CoreMatchers.either;
12 import static org.hamcrest.CoreMatchers.hasItem;
13 import static org.hamcrest.CoreMatchers.hasItems;
14 import static org.hamcrest.MatcherAssert.assertThat;
15 import static org.junit.Assert.assertEquals;
17 import com.google.common.util.concurrent.FluentFuture;
18 import java.nio.charset.Charset;
19 import java.util.ArrayList;
20 import java.util.Collections;
21 import java.util.Iterator;
22 import java.util.List;
23 import java.util.Optional;
24 import java.util.UUID;
25 import java.util.concurrent.ExecutionException;
26 import java.util.stream.Collectors;
27 import org.eclipse.jdt.annotation.Nullable;
28 import org.junit.BeforeClass;
29 import org.junit.Test;
30 import org.opendaylight.mdsal.binding.api.DataBroker;
31 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
32 import org.opendaylight.transportpce.common.InstanceIdentifiers;
33 import org.opendaylight.transportpce.tapi.utils.TopologyDataUtils;
34 import org.opendaylight.transportpce.test.AbstractTest;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.TerminationPoint1;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev181130.OpenroadmTpType;
37 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
38 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
39 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
40 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
41 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
42 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeKey;
43 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
44 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1;
45 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
46 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
47 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
48 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
49 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
50 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
51 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
52 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
53 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
54 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
55 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
56 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
57 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
58 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
59 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
60 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
61 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
62 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
63 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
64 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
65 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
66 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
67 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
68 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
69 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link;
72 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
73 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
74 import org.opendaylight.yangtools.yang.common.Uint64;
75 import org.slf4j.Logger;
76 import org.slf4j.LoggerFactory;
78 public class ConvertORTopoObjectToTapiTooObjectTest extends AbstractTest {
79 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoObjectToTapiTooObjectTest.class);
81 private static Node otnMuxA;
82 private static Node otnMuxC;
83 private static Node otnSwitch;
84 private static List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
85 .networks.network.Link> otnLinks;
86 private static Uuid topologyUuid;
87 private static DataBroker dataBroker = getDataBroker();
90 public static void setUp() throws InterruptedException, ExecutionException {
91 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
92 TopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
93 TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
94 TopologyDataUtils.OTN_TOPOLOGY_WITH_OTN_LINKS_FILE, InstanceIdentifiers.OTN_NETWORK_II);
95 TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil());
97 KeyedInstanceIdentifier<Node, NodeKey> muxAIID = InstanceIdentifier.create(Networks.class)
98 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
99 .class, new NetworkKey(new NetworkId("otn-topology")))
100 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR1")));
101 FluentFuture<Optional<Node>> muxAFuture = dataBroker.newReadOnlyTransaction()
102 .read(LogicalDatastoreType.CONFIGURATION, muxAIID);
103 KeyedInstanceIdentifier<Node, NodeKey> muxCIID = InstanceIdentifier.create(Networks.class)
104 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
105 .class, new NetworkKey(new NetworkId("otn-topology")))
106 .child(Node.class, new NodeKey(new NodeId("SPDR-SC1-XPDR1")));
107 FluentFuture<Optional<Node>> muxCFuture = dataBroker.newReadOnlyTransaction()
108 .read(LogicalDatastoreType.CONFIGURATION, muxCIID);
109 KeyedInstanceIdentifier<Node, NodeKey> switchIID = InstanceIdentifier.create(Networks.class)
110 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
111 .class, new NetworkKey(new NetworkId("otn-topology")))
112 .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR2")));
113 FluentFuture<Optional<Node>> switchFuture = dataBroker.newReadOnlyTransaction()
114 .read(LogicalDatastoreType.CONFIGURATION, switchIID);
115 otnMuxA = muxAFuture.get().get();
116 otnMuxC = muxCFuture.get().get();
117 otnSwitch = switchFuture.get().get();
119 InstanceIdentifier<Network1> linksIID = InstanceIdentifier.create(Networks.class)
120 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
121 .class, new NetworkKey(new NetworkId("otn-topology")))
122 .augmentation(Network1.class);
123 FluentFuture<Optional<Network1>> linksFuture = dataBroker.newReadOnlyTransaction()
124 .read(LogicalDatastoreType.CONFIGURATION, linksIID);
125 otnLinks = linksFuture.get().get().getLink().values().stream().collect(Collectors.toList());
126 Collections.sort(otnLinks, (l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue()));
127 topologyUuid = new Uuid(UUID.nameUUIDFromBytes("T0 - Multi-layer topology".getBytes(Charset.forName("UTF-8")))
129 LOG.info("TEST SETUP READY");
133 public void convertNodeForOtnMuxponder() {
134 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
135 List<String> networkPortList = new ArrayList<>();
136 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
137 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
138 networkPortList.add(tp.getTpId().getValue());
141 tapiFactory.convertNode(otnMuxA, networkPortList);
142 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
143 = tapiFactory.getTapiNodes().values().stream()
144 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
145 .collect(Collectors.toList());
147 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
148 assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
150 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
152 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, false, "SPDR-SA1-XPDR1");
153 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
155 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "mux", "SPDR-SA1-XPDR1");
157 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
158 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
159 .collect(Collectors.toList());
160 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
161 "SPDR-SA1-XPDR1+DSR+XPDR1-NETWORK1", "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1", "SPDR-SA1-XPDR1");
165 public void convertNodeForOtnSwitch() {
166 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
167 List<String> networkPortList = new ArrayList<>();
168 for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
169 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
170 networkPortList.add(tp.getTpId().getValue());
173 tapiFactory.convertNode(otnSwitch, networkPortList);
174 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
175 = tapiFactory.getTapiNodes().values().stream()
176 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
177 .collect(Collectors.toList());
179 assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
180 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
182 Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+DSR".getBytes(Charset.forName("UTF-8")))
184 checkDsrNode(tapiNodes.get(0), dsrNodeUuid, true, "SPDR-SA1-XPDR2");
185 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+OTSi".getBytes(Charset.forName("UTF-8")))
187 checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "switch", "SPDR-SA1-XPDR2");
189 List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
190 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
191 .collect(Collectors.toList());
192 checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
193 "SPDR-SA1-XPDR2+DSR+XPDR2-NETWORK4", "SPDR-SA1-XPDR2+iOTSi+XPDR2-NETWORK4", "SPDR-SA1-XPDR2");
197 public void convertOtnLink() {
198 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
199 List<String> networkPortListA = new ArrayList<>();
200 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
201 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
202 networkPortListA.add(tp.getTpId().getValue());
205 tapiFactory.convertNode(otnMuxA, networkPortListA);
206 List<String> networkPortListC = new ArrayList<>();
207 for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
208 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
209 networkPortListC.add(tp.getTpId().getValue());
212 tapiFactory.convertNode(otnMuxC, networkPortListC);
213 tapiFactory.convertLinks(otnLinks);
214 assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
216 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
218 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
220 Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
222 Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
224 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR+XPDR1-NETWORK1"
225 .getBytes(Charset.forName("UTF-8"))).toString());
226 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR+XPDR1-NETWORK1"
227 .getBytes(Charset.forName("UTF-8"))).toString());
228 Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1"
229 .getBytes(Charset.forName("UTF-8"))).toString());
230 Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
231 .getBytes(Charset.forName("UTF-8"))).toString());
233 new Uuid(UUID.nameUUIDFromBytes("ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"
234 .getBytes(Charset.forName("UTF-8"))).toString());
236 new Uuid(UUID.nameUUIDFromBytes("OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"
237 .getBytes(Charset.forName("UTF-8"))).toString());
239 List<Link> links = tapiFactory.getTapiLinks().values().stream()
240 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
241 .collect(Collectors.toList());
242 checkOtnLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid,
243 "ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1");
244 checkOtnLink(links.get(2), node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid,
245 "OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1");
249 public void convertRoadmInfrastructureWhenNoXponderAttached() {
250 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
251 tapiFactory.convertRoadmInfrastructure();
253 assertEquals("Node list size should be 1", 1, tapiFactory.getTapiNodes().size());
254 assertEquals("Link list size should be empty", 0, tapiFactory.getTapiLinks().size());
255 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
256 = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
257 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
259 checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "infra", "ROADM-infra");
263 public void convertRoadmInfrastructureWhenOtnMuxAttached() {
264 ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid);
265 List<String> networkPortListA = new ArrayList<>();
266 for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
267 if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
268 networkPortListA.add(tp.getTpId().getValue());
271 tapiFactory.convertNode(otnMuxA, networkPortListA);
272 tapiFactory.convertRoadmInfrastructure();
274 assertEquals("Node list size should be 3", 3, tapiFactory.getTapiNodes().size());
275 assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
276 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
277 = tapiFactory.getTapiNodes().values().stream()
278 .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
279 .collect(Collectors.toList());
280 Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
282 checkOtsiNode(tapiNodes.get(2), otsiNodeUuid, "infra", "ROADM-infra");
284 List<Link> links = tapiFactory.getTapiLinks().values().stream()
285 .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
286 .collect(Collectors.toList());
287 Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
289 Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
291 Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eOTSi+XPDR1-NETWORK1"
292 .getBytes(Charset.forName("UTF-8"))).toString());
293 Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("roadm node+nep+1")
294 .getBytes(Charset.forName("UTF-8"))).toString());
296 new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1--XPDR1-NETWORK1 and ROADM-infra--NodeEdgePoint_1"
297 .getBytes(Charset.forName("UTF-8"))).toString());
298 checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
299 "SPDR-SA1-XPDR1--XPDR1-NETWORK1 and ROADM-infra--NodeEdgePoint_1");
302 private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
303 Uuid nodeUuid, boolean isSwitch, String nodeId) {
304 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
305 assertEquals("incorrect node name", nodeId, node.getName().get(new NameKey("dsr/odu node name")).getValue());
306 assertEquals("administrative state should be UNLOCKED",
307 AdministrativeState.UNLOCKED, node.getAdministrativeState());
308 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
309 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
310 assertEquals("value-name should be 'dsr/odu node name'",
311 "dsr/odu node name", node.nonnullName().values().stream().findFirst().get().getValueName());
312 assertEquals("dsr node should manage 2 protocol layers : dsr and odu",
313 2, node.getLayerProtocolName().size());
314 assertThat("dsr node should manage 2 protocol layers : dsr and odu",
315 node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
316 List<OwnedNodeEdgePoint> neps = node.nonnullOwnedNodeEdgePoint().values().stream()
317 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
318 .collect(Collectors.toList());
320 assertEquals("Switch-DSR node should have 8 NEPs", 8, neps.size());
321 OwnedNodeEdgePoint nep1 = neps.get(3);
322 Uuid client4NepUuid = new Uuid(
323 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
325 checkNepClient100G(nep1, client4NepUuid, "XPDR2-CLIENT4", "NodeEdgePoint_C4");
326 OwnedNodeEdgePoint nep2 = neps.get(4);
327 Uuid networkNepUuid = new Uuid(
328 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
330 checkNepNetworkODU4(nep2, networkNepUuid, "XPDR2-NETWORK1", "NodeEdgePoint_N1");
331 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
332 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
333 .collect(Collectors.toList());
334 checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, networkNepUuid, nodeUuid);
336 assertEquals("Mux-DSR node should have 5 NEPs", 5, neps.size());
337 OwnedNodeEdgePoint nep1 = neps.get(0);
338 Uuid client4NepUuid = new Uuid(
339 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT4").getBytes(Charset.forName("UTF-8")))
341 checkNepClient10G(nep1, client4NepUuid, "XPDR1-CLIENT4", "NodeEdgePoint_C4");
343 OwnedNodeEdgePoint nep2 = neps.get(1);
344 Uuid networkNepUuid = new Uuid(
345 UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
347 checkNepNetworkODU4(nep2, networkNepUuid, "XPDR1-NETWORK1", "NodeEdgePoint_N1");
348 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
349 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
350 .collect(Collectors.toList());
351 checkNodeRuleGroupForMuxDSR(nrgList, client4NepUuid, networkNepUuid, nodeUuid);
355 private void checkOtsiNode(
356 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
357 Uuid nodeUuid, String otsiNodeType, String nodeId) {
358 assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
359 assertEquals("incorrect node name", nodeId, node.getName().get(new NameKey("otsi node name")).getValue());
360 assertEquals("administrative state should be UNLOCKED",
361 AdministrativeState.UNLOCKED, node.getAdministrativeState());
362 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
363 assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
364 assertEquals("value-name should be 'dsr/odu node name'",
365 "otsi node name", node.nonnullName().values().stream().findFirst().get().getValueName());
366 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
367 1, node.getLayerProtocolName().size());
368 assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
369 LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().get(0));
370 List<OwnedNodeEdgePoint> neps = node.nonnullOwnedNodeEdgePoint().values().stream()
371 .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
372 .collect(Collectors.toList());
373 switch (otsiNodeType) {
375 assertEquals("Switch-OTSi node should have 8 NEPs", 8, neps.size());
376 OwnedNodeEdgePoint nep1 = neps.get(2);
377 Uuid inepUuid = new Uuid(
378 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
380 checkNepOtsiNode(nep1, inepUuid, "XPDR2-NETWORK2", "iNodeEdgePoint_2");
381 OwnedNodeEdgePoint nep2 = neps.get(0);
382 Uuid enepUuid = new Uuid(
383 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
385 checkNepOtsiNode(nep2, enepUuid, "XPDR2-NETWORK2", "eNodeEdgePoint_2");
386 List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
387 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
388 .collect(Collectors.toList());
389 checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
392 assertEquals("Mux-OTSi node should have 2 NEPs", 2, neps.size());
393 OwnedNodeEdgePoint nep3 = neps.get(0);
394 Uuid enepUuid2 = new Uuid(
395 UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
397 checkNepOtsiNode(nep3, enepUuid2, "XPDR1-NETWORK1", "eNodeEdgePoint_1");
398 OwnedNodeEdgePoint nep4 = neps.get(1);
399 Uuid inepUuid2 = new Uuid(
400 UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
402 checkNepOtsiNode(nep4, inepUuid2, "XPDR1-NETWORK1", "iNodeEdgePoint_1");
403 List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
404 .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
405 .collect(Collectors.toList());
406 checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
409 Iterator<OwnedNodeEdgePoint> nepIterator = node.nonnullOwnedNodeEdgePoint().values().iterator();
411 while (nepIterator.hasNext()) {
412 OwnedNodeEdgePoint nep = nepIterator.next();
413 Uuid nepUuid = new Uuid(
414 UUID.nameUUIDFromBytes((String.join("+", "roadm node", "nep", String.valueOf(count)))
415 .getBytes(Charset.forName("UTF-8"))).toString());
416 checkNepOtsiRdmNode(nep, nepUuid, new StringBuilder("NodeEdgePoint_").append(count).toString(),
417 "NodeEdgePoint name");
424 private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
425 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
426 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
427 Name name = nameList.get(0);
428 assertEquals("value of client nep should be '" + portName + "'",
429 portName, name.getValue());
430 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
431 nepName, name.getValueName());
432 assertEquals("Client nep should support 2 kind of cep",
433 2, nep.getSupportedCepLayerProtocolQualifier().size());
434 assertThat("client nep should support 2 kind of cep",
435 nep.getSupportedCepLayerProtocolQualifier(),
436 hasItems(ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
437 assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
438 checkCommonPartOfNep(nep, false);
441 private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
442 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
443 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
444 Name name = nameList.get(0);
445 assertEquals("value of network nep should be '" + portName + "'",
446 portName, name.getValue());
447 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
448 nepName, name.getValueName());
449 assertEquals("Network nep should support 1 kind of cep",
450 1, nep.getSupportedCepLayerProtocolQualifier().size());
451 assertThat("network nep should support 1 kind of cep",
452 nep.getSupportedCepLayerProtocolQualifier(),
453 hasItem(ODUTYPEODU4.class));
454 assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
455 checkCommonPartOfNep(nep, false);
458 private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
460 assertEquals("muxponder DSR should contain 4 node rule group", 4, nrgList.size());
461 for (NodeRuleGroup nodeRuleGroup : nrgList) {
462 assertEquals("each node-rule-group should contain 2 NEP for muxponder DSR",
463 2, nodeRuleGroup.getNodeEdgePoint().size());
465 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
466 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
467 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
468 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
469 assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
470 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
471 either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
472 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
473 nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
474 assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
475 nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
476 List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
477 assertEquals("node-rule-group nb 2 should contain a single rule", 1, rule.size());
478 assertEquals("local-id of the rule should be 'forward'",
479 "forward", rule.get(0).getLocalId());
480 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
481 ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
482 assertEquals("the rule type should be 'FORWARDING'",
483 RuleType.FORWARDING, rule.get(0).getRuleType());
486 private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
488 assertEquals("Switch-DSR should contain a single node rule group", 1, nrgList.size());
489 assertEquals("Switch-DSR node-rule-group should contain 8 NEP", 8, nrgList.get(0).getNodeEdgePoint().size());
490 List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
491 .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
492 .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
493 .collect(Collectors.toList());
494 assertEquals("in the sorted node-rule-group, nep number 2 should be XPDR2-NETWORK1",
495 networkNepUuid, nrg.get(4).getNodeEdgePointUuid());
496 assertEquals("in the sorted node-rule-group, nep number 6 should be XPDR2-CLIENT4",
497 clientNepUuid, nrg.get(3).getNodeEdgePointUuid());
498 assertEquals("any item of the node-rule-group should have the same nodeUuid",
499 nodeUuid, nrg.get(4).getNodeUuid());
500 assertEquals("any item of the node-rule-group should have the same nodeUuid",
501 nodeUuid, nrg.get(3).getNodeUuid());
503 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
504 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
505 assertEquals("local-id of the rule should be 'forward'",
506 "forward", ruleList.get(0).getLocalId());
507 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
508 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
509 assertEquals("the rule type should be 'FORWARDING'",
510 RuleType.FORWARDING, ruleList.get(0).getRuleType());
513 private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
515 assertEquals("Mux-OTSi should contain a single node rule group", 1, nrgList.size());
516 List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
517 assertEquals("Mux-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
518 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
519 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
520 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
521 assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
522 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
523 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
524 assertEquals("any item of the node-rule-group should have the same nodeUuid",
525 nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
526 assertEquals("any item of the node-rule-group should have the same nodeUuid",
527 nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
528 List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
529 assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
530 assertEquals("local-id of the rule should be 'forward'",
531 "forward", ruleList.get(0).getLocalId());
532 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
533 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
534 assertEquals("the rule type should be 'FORWARDING'",
535 RuleType.FORWARDING, ruleList.get(0).getRuleType());
538 private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
540 assertEquals("Switch-OTSi should contain 4 node rule group", 4, nrgList.size());
541 for (NodeRuleGroup nodeRuleGroup : nrgList) {
542 assertEquals("each node-rule-group should contain 2 NEP for Switch-OTSi",
543 2, nodeRuleGroup.getNodeEdgePoint().size());
545 List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
546 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
547 nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
548 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
549 assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
550 nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
551 either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
552 List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
553 assertEquals("any item of the node-rule-group should have the same nodeUuid",
554 nodeUuid, nodeEdgePointList0.get(0).getNodeUuid());
555 assertEquals("any item of the node-rule-group should have the same nodeUuid",
556 nodeUuid, nodeEdgePointList0.get(1).getNodeUuid());
557 List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
558 assertEquals("node-rule-group should contain a single rule", 1, ruleList0.size());
559 assertEquals("local-id of the rule should be 'forward'",
560 "forward", ruleList0.get(0).getLocalId());
561 assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
562 ForwardingRule.MAYFORWARDACROSSGROUP, ruleList0.get(0).getForwardingRule());
563 assertEquals("the rule type should be 'FORWARDING'",
564 RuleType.FORWARDING, ruleList0.get(0).getRuleType());
567 private void checkNepClient100G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
568 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
569 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
570 assertEquals("value of client nep should be '" + portName + "'",
571 portName, nameList.get(0).getValue());
572 assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
573 nepName, nameList.get(0).getValueName());
574 assertEquals("Client nep should support 2 kind of cep",
575 2, nep.getSupportedCepLayerProtocolQualifier().size());
576 assertThat("client nep should support 2 kind of cep",
577 nep.getSupportedCepLayerProtocolQualifier(),
578 hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
579 assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
580 checkCommonPartOfNep(nep, false);
583 private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
584 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
585 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
586 assertEquals("value of OTSi nep should be '" + portName + "'",
587 portName, nameList.get(0).getValue());
588 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
589 nepName, nameList.get(0).getValueName());
590 assertEquals("OTSi nep should support 2 kind of cep",
591 2, nep.getSupportedCepLayerProtocolQualifier().size());
592 assertThat("OTSi nep should support 2 kind of cep",
593 nep.getSupportedCepLayerProtocolQualifier(),
594 hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
595 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
596 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
597 assertEquals("OTSi nep should support one SIP", 1, nep.getMappedServiceInterfacePoint().size());
598 checkCommonPartOfNep(nep, false);
601 private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
602 assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
603 List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
604 assertEquals("value of OTSi nep should be '" + portName + "'",
605 portName, nameList.get(0).getValue());
606 assertEquals("value-name of OTSi nep should be '" + nepName + "'",
607 nepName, nameList.get(0).getValueName());
608 assertEquals("OTSi nep of RDM infra node should support only 1 kind of cep",
609 1, nep.getSupportedCepLayerProtocolQualifier().size());
610 assertThat("OTSi nep should support 2 kind of cep",
611 nep.getSupportedCepLayerProtocolQualifier(),
612 hasItems(PHOTONICLAYERQUALIFIEROMS.class));
613 assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
614 LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
615 assertEquals("OTSi nep of RDM infra should support no SIP", 0, nep.nonnullMappedServiceInterfacePoint().size());
616 checkCommonPartOfNep(nep, true);
619 private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean isRdm) {
620 assertEquals("link port direction should be DIRECTIONAL",
621 PortDirection.BIDIRECTIONAL, nep.getLinkPortDirection());
622 assertEquals("administrative state should be UNLOCKED",
623 AdministrativeState.UNLOCKED, nep.getAdministrativeState());
624 assertEquals("termination state should be TERMINATED BIDIRECTIONAL",
625 TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState());
626 assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, nep.getLifecycleState());
628 assertEquals("client nep should support 1 SIP", 1, nep.getMappedServiceInterfacePoint().size());
630 assertEquals("termination direction should be BIDIRECTIONAL",
631 TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection());
632 assertEquals("operational state of client nep should be ENABLED",
633 OperationalState.ENABLED, nep.getOperationalState());
634 assertEquals("link-port-role of client nep should be SYMMETRIC",
635 PortRole.SYMMETRIC, nep.getLinkPortRole());
638 private void checkTransitionalLink(Link link, Uuid node1Uuid, Uuid node2Uuid, String tp1, String tp2,
640 Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((ietfNodeId + "--" + tp1 + "--" + tp2)
641 .getBytes(Charset.forName("UTF-8"))).toString());
642 assertEquals("bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2, linkUuid, link.getUuid());
643 assertEquals("Available capacity unit should be GBPS",
644 CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
645 assertEquals("Available capacity -total size value should be 100",
646 Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue());
647 assertEquals("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
648 2, link.getTransitionedLayerProtocolName().size());
649 assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
650 link.getTransitionedLayerProtocolName(),
651 hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));
652 assertEquals("transitional link should be BIDIRECTIONAL",
653 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
654 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
655 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
656 assertEquals("topology uuid should be the same for the two termination point of the link",
657 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
658 assertEquals("topology uuid should be the same for the two termination point of the link",
659 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
660 assertThat("transitional links should terminate on DSR node and Photonic node",
661 nodeEdgePointList.get(0).getNodeUuid().getValue(),
662 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
663 assertThat("transitional links should terminate on DSR node and Photonic node",
664 nodeEdgePointList.get(1).getNodeUuid().getValue(),
665 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
666 Uuid nep1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1.getBytes(Charset.forName("UTF-8"))).toString());
667 Uuid nep2Uuid = new Uuid(UUID.nameUUIDFromBytes(tp2.getBytes(Charset.forName("UTF-8"))).toString());
668 assertThat("transitional links should terminate on " + tp1 + " and " + tp2 + " neps",
669 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
670 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
671 assertThat("transitional links should terminate on DSR node and Photonic node",
672 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
673 either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
676 private void checkOtnLink(Link link, Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
678 assertEquals("bad name for the link", linkName, link.getName().get(new NameKey("otn link name")).getValue());
679 assertEquals("bad uuid for link", linkUuid, link.getUuid());
680 assertEquals("Available capacity unit should be MBPS",
681 CapacityUnit.MBPS, link.getAvailableCapacity().getTotalSize().getUnit());
682 String prefix = linkName.split("-")[0];
683 if ("OTU4".equals(prefix)) {
684 assertEquals("Available capacity -total size value should be 0",
685 Uint64.valueOf(0), link.getAvailableCapacity().getTotalSize().getValue());
686 } else if ("ODU4".equals(prefix)) {
687 assertEquals("Available capacity -total size value should be 100 000",
688 Uint64.valueOf(100000), link.getAvailableCapacity().getTotalSize().getValue());
690 assertEquals("Total capacity unit should be GBPS",
691 CapacityUnit.GBPS, link.getTotalPotentialCapacity().getTotalSize().getUnit());
692 assertEquals("Total capacity -total size value should be 100",
693 Uint64.valueOf(100), link.getTotalPotentialCapacity().getTotalSize().getValue());
694 if ("OTU4".equals(prefix)) {
695 assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
696 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
697 } else if ("ODU4".equals(prefix)) {
698 assertEquals("otn link should be between 2 nodes of protocol layers ODU",
699 LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName());
701 assertEquals("otn tapi link should be BIDIRECTIONAL",
702 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
703 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
704 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
705 assertEquals("topology uuid should be the same for the two termination point of the link",
706 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
707 assertEquals("topology uuid should be the same for the two termination point of the link",
708 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
709 assertThat("otn links should terminate on two distinct nodes",
710 nodeEdgePointList.get(0).getNodeUuid().getValue(),
711 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
712 assertThat("otn links should terminate on two distinct nodes",
713 nodeEdgePointList.get(1).getNodeUuid().getValue(),
714 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
715 assertThat("otn links should terminate on two distinct tps",
716 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
717 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
718 assertThat("otn links should terminate on two distinct tps",
719 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
720 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
721 assertEquals("operational state should be ENABLED",
722 OperationalState.ENABLED, link.getOperationalState());
723 assertEquals("administrative state should be UNLOCKED",
724 AdministrativeState.UNLOCKED, link.getAdministrativeState());
727 private void checkOmsLink(Link link, Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
729 assertEquals("bad name for the link", linkName, link.getName().get(new NameKey("OMS link name")).getValue());
730 assertEquals("bad uuid for link", linkUuid, link.getUuid());
731 assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
732 LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
733 assertEquals("otn tapi link should be BIDIRECTIONAL",
734 ForwardingDirection.BIDIRECTIONAL, link.getDirection());
735 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
736 .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
737 assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
738 assertEquals("topology uuid should be the same for the two termination point of the link",
739 topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
740 assertEquals("topology uuid should be the same for the two termination point of the link",
741 topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
742 assertThat("oms links should terminate on two distinct nodes",
743 nodeEdgePointList.get(0).getNodeUuid().getValue(),
744 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
745 assertThat("oms links should terminate on two distinct nodes",
746 nodeEdgePointList.get(1).getNodeUuid().getValue(),
747 either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
748 assertThat("oms links should terminate on two distinct tps",
749 nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
750 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
751 assertThat("oms links should terminate on two distinct tps",
752 nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
753 either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));