2 * Copyright © 2019 AT&T 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.renderer.provisiondevice;
10 import java.util.ArrayList;
11 import java.util.Arrays;
12 import java.util.HashMap;
13 import java.util.LinkedList;
14 import java.util.List;
16 import java.util.Optional;
17 import java.util.concurrent.ConcurrentLinkedQueue;
18 import java.util.concurrent.CopyOnWriteArrayList;
19 import java.util.concurrent.ExecutionException;
20 import java.util.concurrent.ForkJoinPool;
21 import java.util.concurrent.ForkJoinTask;
22 import java.util.concurrent.atomic.AtomicBoolean;
23 import org.opendaylight.transportpce.common.StringConstants;
24 import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
25 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
26 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
27 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
28 import org.opendaylight.transportpce.networkmodel.service.NetworkModelService;
29 import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
30 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.OtnServicePathInput;
31 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.OtnServicePathOutput;
32 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.OtnServicePathOutputBuilder;
33 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.az.api.info.AEndApiInfo;
34 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.az.api.info.ZEndApiInfo;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.OpucnTribSlotDef;
36 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.link.tp.LinkTp;
37 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.link.tp.LinkTpBuilder;
38 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.node.interfaces.NodeInterface;
39 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.node.interfaces.NodeInterfaceBuilder;
40 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.node.interfaces.NodeInterfaceKey;
41 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.otn.renderer.nodes.Nodes;
42 import org.slf4j.Logger;
43 import org.slf4j.LoggerFactory;
46 public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
47 private static final Logger LOG = LoggerFactory.getLogger(OtnDeviceRendererServiceImpl.class);
48 private static final String PT_03 = "03";
49 private static final String PT_07 = "07";
50 private final OpenRoadmInterfaceFactory openRoadmInterfaceFactory;
51 private final CrossConnect crossConnect;
52 private final OpenRoadmInterfaces openRoadmInterfaces;
53 private final DeviceTransactionManager deviceTransactionManager;
54 private final NetworkModelService networkModelService;
56 public OtnDeviceRendererServiceImpl(OpenRoadmInterfaceFactory openRoadmInterfaceFactory, CrossConnect crossConnect,
57 OpenRoadmInterfaces openRoadmInterfaces,
58 DeviceTransactionManager deviceTransactionManager,
59 NetworkModelService networkModelService) {
60 this.openRoadmInterfaceFactory = openRoadmInterfaceFactory;
61 this.crossConnect = crossConnect;
62 this.openRoadmInterfaces = openRoadmInterfaces;
63 this.deviceTransactionManager = deviceTransactionManager;
64 this.networkModelService = networkModelService;
67 //TODO Align log messages and returned results messages
69 public OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input, String serviceType) {
70 LOG.info("Calling setup otn-service path");
71 if (input.getServiceFormat() == null || input.getServiceRate() == null) {
72 return new OtnServicePathOutputBuilder()
74 .setResult("Error - service-type and service-rate must be present")
77 List<NodeInterface> nodeInterfaces = new ArrayList<>();
78 CopyOnWriteArrayList<LinkTp> otnLinkTps = new CopyOnWriteArrayList<>();
80 switch (serviceType) {
81 case StringConstants.SERVICE_TYPE_1GE:
82 case StringConstants.SERVICE_TYPE_10GE:
83 case StringConstants.SERVICE_TYPE_100GE_M:
84 LOG.info("Calling Node interfaces {} {} {} {} {} {} {}",
85 input.getServiceRate(), input.getEthernetEncoding(),
86 input.getServiceFormat(), input.getOperation(), input.getTribPortNumber(),
87 input.getTribSlot(), input.getNodes());
88 if (input.getNodes() != null) {
89 createLowOrderInterfaces(input, nodeInterfaces, otnLinkTps);
90 LOG.info("Node interfaces created just fine ");
93 case StringConstants.SERVICE_TYPE_ODU4:
94 createHighOrderInterfaces(input, nodeInterfaces, otnLinkTps);
96 // For all the intermediate rates, device renderer is generalized as
97 // ODUCnTTPinterface method
98 case StringConstants.SERVICE_TYPE_ODUC2:
99 case StringConstants.SERVICE_TYPE_ODUC3:
100 case StringConstants.SERVICE_TYPE_ODUC4:
101 createOducnTtpInterface(input, nodeInterfaces, otnLinkTps);
103 case StringConstants.SERVICE_TYPE_100GE_S:
104 LOG.info("Calling Node interface for service-type {}", serviceType);
105 if (input.getNodes() != null) {
106 createHighOrderInterfaces(input, nodeInterfaces, otnLinkTps);
107 LOG.info("Node interfaces created");
111 LOG.error("Service-type {} not managed yet", serviceType);
112 return new OtnServicePathOutputBuilder()
114 .setResult("Service-type not managed")
117 } catch (OpenRoadmInterfaceException e) {
118 LOG.warn("Service path set-up failed", e);
119 Map<NodeInterfaceKey,NodeInterface> nodeInterfacesMap = new HashMap<>();
120 for (NodeInterface nodeInterface : nodeInterfaces) {
121 if (nodeInterface != null) {
122 nodeInterfacesMap.put(nodeInterface.key(), nodeInterface);
125 //TODO check if we need to set a NodeInterface Map in the result in that case
126 return new OtnServicePathOutputBuilder()
128 .setNodeInterface(nodeInterfacesMap)
129 .setResult("Service path set-up failed")
130 .setLinkTp(otnLinkTps)
133 LOG.info("Service path set-up succeed");
134 List<String> results = new ArrayList<>();
135 Map<NodeInterfaceKey,NodeInterface> nodeInterfacesMap = new HashMap<>();
136 for (NodeInterface nodeInterface : nodeInterfaces) {
137 if (nodeInterface != null) {
138 results.add("Otn Service path was set up successfully for node :" + nodeInterface.getNodeId());
139 nodeInterfacesMap.put(nodeInterface.key(), nodeInterface);
142 return new OtnServicePathOutputBuilder()
144 .setNodeInterface(nodeInterfacesMap)
145 .setResult(String.join("\n", results))
146 .setLinkTp(otnLinkTps)
150 @SuppressWarnings("rawtypes")
151 // FIXME check if the ForkJoinTask raw type can be avoided
152 // Raw types use are discouraged since they lack type safety.
153 // Resulting Problems are observed at run time and not at compile time
154 public OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input, String serviceType) {
155 if (input.getNodes() == null) {
156 LOG.error("Unable to delete otn service path. input nodes = null");
157 return new OtnServicePathOutputBuilder()
158 .setResult("Unable to delete otn service path. input nodes = null")
162 List<Nodes> nodes = input.getNodes();
163 AtomicBoolean success = new AtomicBoolean(true);
164 ConcurrentLinkedQueue<String> results = new ConcurrentLinkedQueue<>();
165 CopyOnWriteArrayList<LinkTp> otnLinkTps = new CopyOnWriteArrayList<>();
166 ForkJoinPool forkJoinPool = new ForkJoinPool();
167 ForkJoinTask forkJoinTask = forkJoinPool.submit(() -> nodes.parallelStream().forEach(node -> {
168 String nodeId = node.getNodeId();
169 LOG.info("Deleting service setup on node {}", nodeId);
170 String networkTp = node.getNetworkTp();
171 if (networkTp == null || input.getServiceRate() == null || input.getServiceFormat() == null) {
172 LOG.error("destination ({}) or service-rate ({}) or service-format ({}) is null.",
173 networkTp, input.getServiceRate(), input.getServiceFormat());
176 if (!this.deviceTransactionManager.isDeviceMounted(nodeId)) {
177 String result = nodeId + " is not mounted on the controller";
181 forkJoinPool.shutdown();
183 // TODO should deletion end here?
185 // if the node is currently mounted then proceed.
186 List<String> interfacesToDelete = new LinkedList<>();
187 String connectionNumber = "";
188 switch (serviceType) {
189 case StringConstants.SERVICE_TYPE_100GE_S:
190 connectionNumber = getConnectionNumber(node, networkTp, "ODU4");
192 case StringConstants.SERVICE_TYPE_100GE_M:
193 connectionNumber = getConnectionNumber(node, networkTp, "ODU4");
194 otnLinkTps.add(new LinkTpBuilder()
199 case StringConstants.SERVICE_TYPE_ODU4:
200 if (node.getClientTp() == null && node.getNetwork2Tp() == null) {
201 interfacesToDelete.add(networkTp + "-ODU4");
202 otnLinkTps.add(new LinkTpBuilder()
207 if (node.getClientTp() == null && node.getNetwork2Tp() != null) {
208 interfacesToDelete.add(networkTp + "-ODU4");
209 interfacesToDelete.add(node.getNetwork2Tp() + "-ODU4");
210 connectionNumber = getConnectionNumber(node, networkTp, "ODU4");
213 case StringConstants.SERVICE_TYPE_ODUC2:
214 case StringConstants.SERVICE_TYPE_ODUC3:
215 case StringConstants.SERVICE_TYPE_ODUC4:
216 if (node.getClientTp() == null && node.getNetwork2Tp() == null) {
217 // Service-type can be ODUC2, ODUC3, ODUC4
218 interfacesToDelete.add(networkTp + "-" + serviceType);
219 otnLinkTps.add(new LinkTpBuilder()
224 if (node.getClientTp() == null && node.getNetwork2Tp() != null) {
225 interfacesToDelete.add(networkTp + "-" + serviceType);
226 interfacesToDelete.add(node.getNetwork2Tp() + "-" + serviceType);
227 connectionNumber = getConnectionNumber(node, networkTp, serviceType);
230 case StringConstants.SERVICE_TYPE_10GE:
231 connectionNumber = getConnectionNumber(node, networkTp, "ODU2e");
232 otnLinkTps.add(new LinkTpBuilder()
237 case StringConstants.SERVICE_TYPE_1GE:
238 connectionNumber = getConnectionNumber(node, networkTp, "ODU0");
239 otnLinkTps.add(new LinkTpBuilder()
245 LOG.error("service-type {} not managed yet", serviceType);
246 String result = serviceType + " is not supported";
251 List<String> intToDelete = this.crossConnect.deleteCrossConnect(nodeId, connectionNumber, true);
252 for (String interf : intToDelete == null ? new ArrayList<String>() : intToDelete) {
253 if (!this.openRoadmInterfaceFactory.isUsedByOtnXc(nodeId, interf, connectionNumber,
254 this.deviceTransactionManager)) {
255 interfacesToDelete.add(interf);
256 String supportedInterface = this.openRoadmInterfaces.getSupportedInterface(nodeId, interf);
257 if (supportedInterface == null) {
260 // Here ODUC can be ODUC2, ODUC3, ODUC4
261 if ((input.getServiceRate().intValue() == 100 && !supportedInterface.contains("ODUC"))
262 || (input.getServiceRate().intValue() != 100 && !supportedInterface.contains("ODU4"))) {
263 interfacesToDelete.add(supportedInterface);
268 for (String interfaceId : interfacesToDelete) {
270 this.openRoadmInterfaces.deleteInterface(nodeId, interfaceId);
271 } catch (OpenRoadmInterfaceException e) {
272 String result = String.format("Failed to delete interface %s on node %s!", interfaceId, nodeId);
274 LOG.error(result, e);
281 } catch (InterruptedException | ExecutionException e) {
282 LOG.error("Error while deleting service paths!", e);
283 return new OtnServicePathOutputBuilder()
284 .setResult("Error while deleting service paths!")
288 forkJoinPool.shutdown();
289 return new OtnServicePathOutputBuilder()
290 .setSuccess(success.get())
291 .setLinkTp(otnLinkTps)
294 ? "Request processed"
295 : String.join("\n", results))
299 private String getConnectionNumber(Nodes node, String networkTp, String oduType) {
300 List<String> list1 = new ArrayList<>();
301 List<String> list2 = new ArrayList<>(Arrays.asList("x"));
302 if (node.getClientTp() != null) {
303 list1.addAll(Arrays.asList(node.getClientTp(), oduType));
304 list2.addAll(Arrays.asList(networkTp, oduType));
305 } else if (node.getNetwork2Tp() != null) {
306 list1.addAll(Arrays.asList(networkTp, oduType));
307 list2.addAll(Arrays.asList(node.getNetwork2Tp(), oduType));
312 return String.join("-", list1);
315 private Optional<String> postCrossConnect(List<String> createdOduInterfaces, Nodes node)
316 throws OpenRoadmInterfaceException {
317 return this.crossConnect.postOtnCrossConnect(createdOduInterfaces, node);
320 private void createLowOrderInterfaces(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
321 CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
322 for (Nodes node : input.getNodes()) {
323 AEndApiInfo apiInfoA = null;
324 ZEndApiInfo apiInfoZ = null;
325 if (input.getAEndApiInfo() != null && input.getAEndApiInfo().getNodeId().contains(node.getNodeId())) {
326 apiInfoA = input.getAEndApiInfo();
328 if (input.getZEndApiInfo() != null && input.getZEndApiInfo().getNodeId().contains(node.getNodeId())) {
329 apiInfoZ = input.getZEndApiInfo();
331 // check if the node is mounted or not?
332 List<String> createdEthInterfaces = new ArrayList<>();
333 List<String> createdOduInterfaces = new ArrayList<>();
334 switch (input.getServiceRate().intValue()) {
336 LOG.info("Input service is 1G");
337 if (node.getClientTp() != null) {
338 createdEthInterfaces.add(
339 openRoadmInterfaceFactory.createOpenRoadmEth1GInterface(node.getNodeId(),
340 node.getClientTp()));
341 createdOduInterfaces.add(
342 // suppporting interface?, payload ?
343 openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(), node.getClientTp(),
344 input.getServiceName(), false, input.getTribPortNumber(), input.getTribSlot(), apiInfoA,
347 createdOduInterfaces.add(
348 openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(), node.getNetworkTp(),
349 input.getServiceName(), true, input.getTribPortNumber(), input.getTribSlot(), null, null,
352 new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
353 if (node.getNetwork2Tp() != null) {
354 createdOduInterfaces.add(
355 // supporting interface? payload ?
356 openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(),
357 node.getNetwork2Tp(), input.getServiceName(), true, input.getTribPortNumber(),
358 input.getTribSlot(), null, null, null));
360 new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
364 LOG.info("Input service is 10G");
365 if (node.getClientTp() != null) {
366 createdEthInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmEth10GInterface(
367 node.getNodeId(), node.getClientTp()));
368 createdOduInterfaces.add(
369 // suppporting interface?, payload ?
370 openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(),
371 node.getClientTp(), false, input.getTribPortNumber(),
372 input.getTribSlot(), apiInfoA, apiInfoZ, PT_03));
374 createdOduInterfaces.add(
375 // supporting interface? payload ?
376 openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(), node.getNetworkTp(),
377 true, input.getTribPortNumber(), input.getTribSlot(), null,
380 new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
381 if (node.getNetwork2Tp() != null) {
382 createdOduInterfaces.add(
383 // supporting interface? payload ?
384 openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(),
385 node.getNetwork2Tp(), true, input.getTribPortNumber(),
386 input.getTribSlot(), null, null, null));
388 new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
392 LOG.info("Input service is 100G");
393 // Take the first and last value in the list of OpucnTribSlot (assuming SH would provide
394 // min and max value only, size two)
395 OpucnTribSlotDef minOpucnTs = OpucnTribSlotDef.getDefaultInstance(
396 input.getOpucnTribSlots().get(0).getValue());
397 OpucnTribSlotDef maxOpucnTs = OpucnTribSlotDef.getDefaultInstance(
398 input.getOpucnTribSlots().get(1).getValue());
399 if (node.getClientTp() != null) {
400 createdEthInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmEth100GInterface(
401 node.getNodeId(), node.getClientTp()));
402 // OPUCn trib information is optional when creating ODU4 ethernet (client) interface
403 createdOduInterfaces.add(
404 openRoadmInterfaceFactory.createOpenRoadmOtnOdu4LoInterface(node.getNodeId(),
405 node.getClientTp(), input.getServiceName(), PT_07, false, minOpucnTs,
408 // Here payload-type is optional and is not used for interface creation (especially for network)
409 createdOduInterfaces.add(
410 openRoadmInterfaceFactory.createOpenRoadmOtnOdu4LoInterface(node.getNodeId(),
411 node.getNetworkTp(), input.getServiceName(), PT_07, true, minOpucnTs,
414 new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
415 // Here payload-type is optional and is not used for service creation
416 // This is needed if there is an intermediate node
417 if (node.getNetwork2Tp() != null) {
418 createdOduInterfaces.add(
419 openRoadmInterfaceFactory.createOpenRoadmOtnOdu4LoInterface(node.getNodeId(),
420 node.getNetwork2Tp(), input.getServiceName(), PT_07, true, minOpucnTs,
423 new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
427 LOG.error("service rate {} not managed yet", input.getServiceRate());
431 // implement cross connect
432 List<String> createdConnections = new ArrayList<>();
433 if (!createdOduInterfaces.isEmpty()) {
434 Optional<String> connectionNameOpt = postCrossConnect(createdOduInterfaces, node);
435 createdConnections.add(connectionNameOpt.get());
436 LOG.info("Created cross connects");
438 nodeInterfaces.add(new NodeInterfaceBuilder()
439 .withKey(new NodeInterfaceKey(node.getNodeId()))
440 .setNodeId(node.getNodeId())
441 .setConnectionId(createdConnections)
442 .setEthInterfaceId(createdEthInterfaces)
443 .setOduInterfaceId(createdOduInterfaces)
448 private void createHighOrderInterfaces(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
449 CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
450 for (Nodes node : input.nonnullNodes()) {
451 AEndApiInfo apiInfoA = null;
452 ZEndApiInfo apiInfoZ = null;
453 if (input.getAEndApiInfo() != null && input.getAEndApiInfo().getNodeId().contains(node.getNodeId())) {
454 apiInfoA = input.getAEndApiInfo();
456 if (input.getZEndApiInfo() != null && input.getZEndApiInfo().getNodeId().contains(node.getNodeId())) {
457 apiInfoZ = input.getZEndApiInfo();
459 // check if the node is mounted or not?
460 List<String> createdEthInterfaces = new ArrayList<>();
461 List<String> createdOduInterfaces = new ArrayList<>();
462 switch (input.getServiceRate().intValue()) {
464 LOG.info("Input service is 100G");
465 if (node.getClientTp() != null && node.getNetwork2Tp() == null) {
466 createdEthInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmEth100GInterface(
467 node.getNodeId(), node.getClientTp()));
468 createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
469 node.getNodeId(), node.getClientTp(), false, apiInfoA, apiInfoZ, "21"));
470 // supporting interface? payload ?
471 createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
472 node.getNodeId(), node.getNetworkTp(), true, null, null, null));
473 linkTpList.add(new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getClientTp())
476 if (node.getClientTp() == null && node.getNetwork2Tp() == null) {
477 createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
478 node.getNodeId(), node.getNetworkTp(), false, apiInfoA, apiInfoZ, "21"));
479 linkTpList.add(new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp())
482 if (node.getClientTp() == null && node.getNetwork2Tp() != null) {
483 // supporting interface? payload ?
484 createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
485 node.getNodeId(), node.getNetworkTp(), true, null, null, null));
486 createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
487 node.getNodeId(), node.getNetwork2Tp(), true, null, null, null));
491 LOG.error("service rate {} not managed yet", input.getServiceRate());
495 // implement cross connect
496 List<String> createdConnections = new ArrayList<>();
497 if (createdOduInterfaces.size() == 2) {
498 Optional<String> connectionNameOpt = postCrossConnect(createdOduInterfaces, node);
499 createdConnections.add(connectionNameOpt.get());
500 LOG.info("Created cross connects");
502 nodeInterfaces.add(new NodeInterfaceBuilder()
503 .withKey(new NodeInterfaceKey(node.getNodeId()))
504 .setNodeId(node.getNodeId())
505 .setConnectionId(createdConnections)
506 .setEthInterfaceId(createdEthInterfaces)
507 .setOduInterfaceId(createdOduInterfaces)
512 private void createOducnTtpInterface(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
513 CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
514 if (input.getNodes() == null) {
517 if (input.getServiceRate() == null) {
518 LOG.error("Missing service rate for ODUCn interface");
521 LOG.info("Creation of ODUCn TTP interface in OTN service path {}", input);
522 for (int i = 0; i < input.getNodes().size(); i++) {
523 Nodes node = input.getNodes().get(i);
524 // Based on the service rate, we will know if it is a OTUC4, OTUC3 or OTUC2
525 String supportingOtuInterface = node.getNetworkTp();
526 boolean serviceRateNotSupp = false;
528 switch (input.getServiceRate().intValue()) {
530 supportingOtuInterface += "-OTUC2";
533 supportingOtuInterface += "-OTUC3";
536 supportingOtuInterface += "-OTUC4";
539 serviceRateNotSupp = true;
542 if (serviceRateNotSupp) {
543 LOG.error("Service rate {} is not supported", input.getServiceRate());
547 i + 1 == input.getNodes().size()
548 // For the end node, tgtNode becomes the first node in the list
549 ? input.getNodes().get(0)
550 : input.getNodes().get(i + 1);
552 nodeInterfaces.add(new NodeInterfaceBuilder()
553 .withKey(new NodeInterfaceKey(node.getNodeId()))
554 .setNodeId(node.getNodeId())
555 .setOduInterfaceId(List.of(
556 // though this is odu, actually it has ODUCn interfaces
557 openRoadmInterfaceFactory.createOpenRoadmOtnOducnInterface(node.getNodeId(),
558 node.getNetworkTp(), supportingOtuInterface, tgtNode.getNodeId(), tgtNode.getNetworkTp())))
560 linkTpList.add(new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());