X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=renderer%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Frenderer%2Fprovisiondevice%2FDeviceRendererServiceImpl.java;h=2ffa8be2598540b41541a52d4276b223cacf7004;hb=f327d205217ec8eefa4326881f8d06f1378db37a;hp=40a2a20ff4f0da824881deba319b706f4492b9d9;hpb=20b2ae818f0b19079c176fffa65a8e96af435375;p=transportpce.git diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java index 40a2a20ff..2ffa8be25 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java @@ -9,11 +9,17 @@ package org.opendaylight.transportpce.renderer.provisiondevice; import com.google.common.collect.Sets; import com.google.common.util.concurrent.FluentFuture; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutionException; @@ -33,180 +39,229 @@ import org.opendaylight.transportpce.common.StringConstants; import org.opendaylight.transportpce.common.Timeouts; import org.opendaylight.transportpce.common.crossconnect.CrossConnect; import org.opendaylight.transportpce.common.device.DeviceTransactionManager; +import org.opendaylight.transportpce.common.fixedflex.GridConstant; +import org.opendaylight.transportpce.common.fixedflex.GridUtils; +import org.opendaylight.transportpce.common.fixedflex.SpectrumInformation; +import org.opendaylight.transportpce.common.mapping.MappingUtils; import org.opendaylight.transportpce.common.mapping.PortMapping; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces; -import org.opendaylight.transportpce.networkmodel.service.NetworkModelService; import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory; import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServiceListTopology; import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServicePathDirection; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.ServiceNodelist; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service.nodelist.NodelistBuilder; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service.nodelist.NodelistKey; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev200429.network.nodes.Mapping; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.CreateOtsOmsInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.CreateOtsOmsOutput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.CreateOtsOmsOutputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.RendererRollbackInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.RendererRollbackOutput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.RendererRollbackOutputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.ServicePathInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.ServicePathOutput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.ServicePathOutputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.renderer.rollback.output.FailedToRollback; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.renderer.rollback.output.FailedToRollbackBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.renderer.rollback.output.FailedToRollbackKey; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.Topology; -import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.OchAttributes.ModulationFormat; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceList; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesKey; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200615.node.interfaces.NodeInterface; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200615.node.interfaces.NodeInterfaceBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200615.node.interfaces.NodeInterfaceKey; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200615.olm.renderer.input.Nodes; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev200129.OtnLinkType; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.CreateOtsOmsInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.CreateOtsOmsOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.CreateOtsOmsOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.RendererRollbackInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.RendererRollbackOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.RendererRollbackOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.ServicePathInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.ServicePathOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.ServicePathOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.az.api.info.AEndApiInfo; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.az.api.info.ZEndApiInfo; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.renderer.rollback.output.FailedToRollback; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.renderer.rollback.output.FailedToRollbackBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.renderer.rollback.output.FailedToRollbackKey; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.OpenroadmNodeVersion; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.mapping.Mapping; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.Topology; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceList; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.Services; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.ServicesBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.ServicesKey; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.link.tp.LinkTp; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.link.tp.LinkTpBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.node.interfaces.NodeInterface; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.node.interfaces.NodeInterfaceBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.node.interfaces.NodeInterfaceKey; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.optical.renderer.nodes.Nodes; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - +@Component public class DeviceRendererServiceImpl implements DeviceRendererService { - private static final String ODU4 = "-ODU4"; + private static final String IS_NOT_MOUNTED_ON_THE_CONTROLLER = " is not mounted on the controller"; private static final Logger LOG = LoggerFactory.getLogger(DeviceRendererServiceImpl.class); + private static final String PT_07 = "07"; private final DataBroker dataBroker; private final DeviceTransactionManager deviceTransactionManager; private final OpenRoadmInterfaceFactory openRoadmInterfaceFactory; private final OpenRoadmInterfaces openRoadmInterfaces; private final CrossConnect crossConnect; private final PortMapping portMapping; - private final NetworkModelService networkModelService; - public DeviceRendererServiceImpl(DataBroker dataBroker, DeviceTransactionManager deviceTransactionManager, - OpenRoadmInterfaceFactory openRoadmInterfaceFactory, OpenRoadmInterfaces openRoadmInterfaces, - CrossConnect crossConnect, PortMapping portMapping, NetworkModelService networkModelService) { + @Activate + public DeviceRendererServiceImpl(@Reference DataBroker dataBroker, + @Reference DeviceTransactionManager deviceTransactionManager, + @Reference OpenRoadmInterfaces openRoadmInterfaces, + @Reference CrossConnect crossConnect, + @Reference MappingUtils mappingUtils, + @Reference PortMapping portMapping) { this.dataBroker = dataBroker; this.deviceTransactionManager = deviceTransactionManager; - this.openRoadmInterfaceFactory = openRoadmInterfaceFactory; this.openRoadmInterfaces = openRoadmInterfaces; this.crossConnect = crossConnect; this.portMapping = portMapping; - this.networkModelService = networkModelService; + this.openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(mappingUtils, portMapping, openRoadmInterfaces); } + @SuppressWarnings("rawtypes") + // FIXME check if the ForkJoinTask raw type can be avoided + // Raw types use are discouraged since they lack type safety. + // Resulting Problems are observed at run time and not at compile time @Override public ServicePathOutput setupServicePath(ServicePathInput input, ServicePathDirection direction) { - List nodes = input.getNodes(); - Nodes srcNode = nodes.get(0); - // If the Node list size is one, then src and tgt are same; - // sapi/dapi all have the same value - Nodes tgtNode = nodes.get(nodes.size() - 1); - - + LOG.info("setup service path for input {} and direction {}", input, direction); + List nodes = new ArrayList<>(); + if (input.getNodes() != null) { + nodes.addAll(input.getNodes()); + } + SpectrumInformation spectrumInformation = GridUtils.initSpectrumInformationFromServicePathInput(input); // Register node for suppressing alarms if (!alarmSuppressionNodeRegistration(input)) { LOG.warn("Alarm suppresion node registration failed!!!!"); } ConcurrentLinkedQueue results = new ConcurrentLinkedQueue<>(); - Set nodeInterfaces = Sets.newConcurrentHashSet(); + Map nodeInterfaces = new ConcurrentHashMap<>(); Set nodesProvisioned = Sets.newConcurrentHashSet(); - CopyOnWriteArrayList otnNodesProvisioned = new CopyOnWriteArrayList<>(); + CopyOnWriteArrayList otnLinkTps = new CopyOnWriteArrayList<>(); ServiceListTopology topology = new ServiceListTopology(); AtomicBoolean success = new AtomicBoolean(true); ForkJoinPool forkJoinPool = new ForkJoinPool(); ForkJoinTask forkJoinTask = forkJoinPool.submit(() -> nodes.parallelStream().forEach(node -> { String nodeId = node.getNodeId(); LOG.info("Starting provisioning for node : {}", nodeId); - List createdEthInterfaces = new ArrayList<>(); - List createdOtuInterfaces = new ArrayList<>(); - List createdOduInterfaces = new ArrayList<>(); - List createdOchInterfaces = new ArrayList<>(); - List createdConnections = new ArrayList<>(); + AEndApiInfo apiInfoA = null; + ZEndApiInfo apiInfoZ = null; + if (input.getAEndApiInfo() != null && input.getAEndApiInfo().getNodeId().contains(nodeId)) { + apiInfoA = input.getAEndApiInfo(); + } + if (input.getZEndApiInfo() != null && input.getZEndApiInfo().getNodeId().contains(nodeId)) { + apiInfoZ = input.getZEndApiInfo(); + } + Set createdEthInterfaces = new HashSet<>(); + Set createdOtuInterfaces = new HashSet<>(); + Set createdOduInterfaces = new HashSet<>(); + Set createdOchInterfaces = new HashSet<>(); + Set createdConnections = new HashSet<>(); int crossConnectFlag = 0; try { // if the node is currently mounted then proceed if (this.deviceTransactionManager.isDeviceMounted(nodeId)) { String srcTp = node.getSrcTp(); String destTp = node.getDestTp(); - Long waveNumber = input.getWaveNumber().toJava(); if ((destTp != null) && destTp.contains(StringConstants.NETWORK_TOKEN)) { + LOG.info("Adding supporting OCH interface for node {}, dest tp {}, spectrumInformation {}", + nodeId, destTp, spectrumInformation); crossConnectFlag++; String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface( - nodeId, destTp, waveNumber, ModulationFormat.DpQpsk); - createdOchInterfaces.add(supportingOchInterface); - // Here we pass logical connection-point of z-end to set SAPI and DAPI - String znodeId = tgtNode.getNodeId(); - String zlogicalConnection = tgtNode.getDestTp(); - if (nodeId.equals(tgtNode.getNodeId())) { - znodeId = srcNode.getNodeId(); // if it is final node, then set zSide as source side - zlogicalConnection = srcNode.getDestTp(); - } + nodeId, destTp, spectrumInformation); + // Split the string based on # pass the last element as the supported Interface + // This is needed for 7.1 device models with B100G, we have OTSI, OTSI-group combined as OCH + String[] listOfSuppOchInf = supportingOchInterface.split("#"); + List createdOchInf = Arrays.asList(listOfSuppOchInf); + createdOchInterfaces.addAll(createdOchInf); + LOG.info("DEST all otsi interfaces {}", createdOchInterfaces); + // Taking the last element + supportingOchInterface = listOfSuppOchInf[createdOchInf.size() - 1]; String supportingOtuInterface = this.openRoadmInterfaceFactory - .createOpenRoadmOtu4Interface(nodeId, destTp, supportingOchInterface, - znodeId, zlogicalConnection); + .createOpenRoadmOtu4Interface(nodeId, destTp, supportingOchInterface, apiInfoA, + apiInfoZ); createdOtuInterfaces.add(supportingOtuInterface); + LOG.info("all dest otu interfaces {}", createdOtuInterfaces); if (srcTp == null) { - otnNodesProvisioned.add(node); + otnLinkTps.add(new LinkTpBuilder().setNodeId(nodeId).setTpId(destTp).build()); + } else if (srcTp.contains(StringConstants.NETWORK_TOKEN)) { + // If src and dest tp contains the network token, then it is regenerator + LOG.info("Create the ODUCn for regen on the dest-tp"); + // Here we first create ODUCn interface for the Regen + createdOduInterfaces.add(this.openRoadmInterfaceFactory + .createOpenRoadmOducn(nodeId, destTp)); + LOG.info("all dest odu interfaces {}", createdOduInterfaces); } else { - createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(nodeId, - destTp, supportingOtuInterface)); + // This is needed for 7.1 device models for 400GE, since we have ODUC4 and ODUflex + // are combined + createdOduInterfaces = Set.of(this.openRoadmInterfaceFactory + .createOpenRoadmOdu4HOInterface( + nodeId, destTp, false, apiInfoA, apiInfoZ, PT_07).split("#")); } } if ((srcTp != null) && srcTp.contains(StringConstants.CLIENT_TOKEN)) { + LOG.info("Adding supporting EThernet interface for node {}, src tp {}", nodeId, srcTp); crossConnectFlag++; // create OpenRoadm Xponder Client Interfaces - createdEthInterfaces.add( - this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(nodeId, srcTp)); + createdEthInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmEthInterface( + nodeId, srcTp)); } if ((srcTp != null) && srcTp.contains(StringConstants.NETWORK_TOKEN)) { + LOG.info("Adding supporting OCH interface for node {}, src tp {}, spectrumInformation {}", + nodeId, srcTp, spectrumInformation); crossConnectFlag++; // create OpenRoadm Xponder Line Interfaces String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface( - nodeId, srcTp, waveNumber, ModulationFormat.DpQpsk); - createdOchInterfaces.add(supportingOchInterface); - String supportingOtuInterface = this.openRoadmInterfaceFactory - .createOpenRoadmOtu4Interface(nodeId, srcTp, supportingOchInterface); + nodeId, srcTp, spectrumInformation); + // createdOchInterfaces.add(supportingOchInterface); + // Split the string based on # pass the last element as the supported Interface + // This is needed for 7.1 device models with B100G, we have OTSI, OTSI-group combined as OCH + String[] listOfSuppOchInf = supportingOchInterface.split("#"); + List tmpCreatedOchInterfaces = Arrays.asList(listOfSuppOchInf); + createdOchInterfaces.addAll(tmpCreatedOchInterfaces); + // Taking the last element + supportingOchInterface = tmpCreatedOchInterfaces.get(tmpCreatedOchInterfaces.size() - 1); + String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface( + nodeId, srcTp, supportingOchInterface, apiInfoA, apiInfoZ); createdOtuInterfaces.add(supportingOtuInterface); - createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(nodeId, - srcTp, supportingOtuInterface)); - Mapping mapping = this.portMapping.getMapping(nodeId,srcTp); - if (mapping != null && mapping.getXponderType() != null - && (mapping.getXponderType().getIntValue() == 3 - || mapping.getXponderType().getIntValue() == 2)) { - createdOduInterfaces.add(this.openRoadmInterfaceFactory - .createOpenRoadmOtnOdu4Interface(nodeId, destTp, supportingOtuInterface)); + if (destTp == null) { + otnLinkTps.add(new LinkTpBuilder().setNodeId(nodeId).setTpId(srcTp).build()); + } else if (destTp.contains(StringConstants.NETWORK_TOKEN)) { + // If the src and dest tp have network-token, then it is a regen + LOG.info("Create the regen-interfaces on the src-tp"); + // Here we first create ODUCn interface for the Regen + createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOducn(nodeId, + srcTp)); + LOG.info("all src odu interfaces {}", createdOduInterfaces); } else { - createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(nodeId, - destTp, supportingOtuInterface)); + createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface( + nodeId, srcTp, false, apiInfoA, apiInfoZ, PT_07)); } } if ((destTp != null) && destTp.contains(StringConstants.CLIENT_TOKEN)) { + LOG.info("Adding supporting EThernet interface for node {}, dest tp {}", nodeId, destTp); crossConnectFlag++; // create OpenRoadm Xponder Client Interfaces - createdEthInterfaces.add( - this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(nodeId, destTp)); + createdEthInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmEthInterface( + nodeId, destTp)); } if ((srcTp != null) && (srcTp.contains(StringConstants.TTP_TOKEN) || srcTp.contains(StringConstants.PP_TOKEN))) { - createdOchInterfaces.addAll( - this.openRoadmInterfaceFactory - .createOpenRoadmOchInterface(nodeId, srcTp, waveNumber)); + LOG.info("Adding supporting OCH interface for node {}, src tp {}, spectrumInformation {}", + nodeId, srcTp, spectrumInformation); + createdOchInterfaces.addAll(this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaces( + nodeId, srcTp, spectrumInformation)); } if ((destTp != null) && (destTp.contains(StringConstants.TTP_TOKEN) || destTp.contains(StringConstants.PP_TOKEN))) { - createdOchInterfaces.addAll( - this.openRoadmInterfaceFactory - .createOpenRoadmOchInterface(nodeId, destTp, waveNumber)); + LOG.info("Adding supporting OCH interface for node {}, dest tp {}, spectrumInformation {}", + nodeId, destTp, spectrumInformation); + createdOchInterfaces.addAll(this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaces( + nodeId, destTp, spectrumInformation)); } if (crossConnectFlag < 1) { LOG.info("Creating cross connect between source {} and destination {} for node {}", srcTp, destTp, nodeId); Optional connectionNameOpt = - this.crossConnect.postCrossConnect(nodeId, waveNumber, srcTp, destTp); + this.crossConnect.postCrossConnect(nodeId, srcTp, destTp, spectrumInformation); if (connectionNameOpt.isPresent()) { nodesProvisioned.add(nodeId); - createdConnections.add(connectionNameOpt.get()); + createdConnections.add(connectionNameOpt.orElseThrow()); } else { processErrorMessage("Unable to post Roadm-connection for node " + nodeId, forkJoinPool, results); @@ -214,22 +269,23 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { } } } else { - processErrorMessage(nodeId + " is not mounted on the controller", forkJoinPool, results); + processErrorMessage(nodeId + IS_NOT_MOUNTED_ON_THE_CONTROLLER, forkJoinPool, results); success.set(false); } } catch (OpenRoadmInterfaceException ex) { processErrorMessage("Setup service path failed! Exception:" + ex.toString(), forkJoinPool, results); success.set(false); } - NodeInterfaceBuilder nodeInterfaceBuilder = new NodeInterfaceBuilder() + NodeInterface nodeInterface = new NodeInterfaceBuilder() .withKey(new NodeInterfaceKey(nodeId)) .setNodeId(nodeId) .setConnectionId(createdConnections) .setEthInterfaceId(createdEthInterfaces) .setOtuInterfaceId(createdOtuInterfaces) .setOduInterfaceId(createdOduInterfaces) - .setOchInterfaceId(createdOchInterfaces); - nodeInterfaces.add(nodeInterfaceBuilder.build()); + .setOchInterfaceId(createdOchInterfaces) + .build(); + nodeInterfaces.put(nodeInterface.key(),nodeInterface); })); try { forkJoinTask.get(); @@ -239,23 +295,23 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { forkJoinPool.shutdown(); if (success.get()) { - results.add("Roadm-connection successfully created for nodes: " + String.join(", ", nodesProvisioned)); + results.add("Interfaces created successfully for nodes: " + String.join(", ", nodesProvisioned)); } // setting topology in the service list data store try { setTopologyForService(input.getServiceName(), topology.getTopology()); - updateOtnTopology(otnNodesProvisioned, false); } catch (InterruptedException | TimeoutException | ExecutionException e) { LOG.warn("Failed to write topologies for service {}.", input.getServiceName(), e); } if (!alarmSuppressionNodeRemoval(input.getServiceName())) { - LOG.error("Alarm suppresion node removal failed!!!!"); + LOG.error("Alarm suppression node removal failed!!!!"); } - ServicePathOutputBuilder setServBldr = new ServicePathOutputBuilder() - .setNodeInterface(new ArrayList<>(nodeInterfaces)) - .setSuccess(success.get()) - .setResult(String.join("\n", results)); - return setServBldr.build(); + return new ServicePathOutputBuilder() + .setNodeInterface(nodeInterfaces) + .setSuccess(success.get()) + .setResult(String.join("\n", results)) + .setLinkTp(otnLinkTps) + .build(); } private ConcurrentLinkedQueue processErrorMessage(String message, ForkJoinPool forkJoinPool, @@ -266,40 +322,29 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { return messages; } + @SuppressWarnings("rawtypes") + // FIXME check if the ForkJoinTask raw type can be avoided + // Raw types use are discouraged since they lack type safety. + // Resulting Problems are observed at run time and not at compile time @Override public ServicePathOutput deleteServicePath(ServicePathInput input) { + if (!alarmSuppressionNodeRegistration(input)) { + LOG.warn("Alarm suppression node registration failed!!!!"); + } List nodes = input.getNodes(); AtomicBoolean success = new AtomicBoolean(true); ConcurrentLinkedQueue results = new ConcurrentLinkedQueue<>(); - if (!alarmSuppressionNodeRegistration(input)) { - LOG.warn("Alarm suppresion node registraion failed!!!!"); - } - CopyOnWriteArrayList otnNodesProvisioned = new CopyOnWriteArrayList<>(); + CopyOnWriteArrayList otnLinkTps = new CopyOnWriteArrayList<>(); ForkJoinPool forkJoinPool = new ForkJoinPool(); ForkJoinTask forkJoinTask = forkJoinPool.submit(() -> nodes.parallelStream().forEach(node -> { - List interfacesToDelete = new LinkedList<>(); String nodeId = node.getNodeId(); LOG.info("Deleting service setup on node {}", nodeId); - String srcTp; - String destTp; - Long waveNumber = input.getWaveNumber().toJava(); if (node.getDestTp() == null) { LOG.error("Destination termination point must not be null."); return; - } else { - destTp = node.getDestTp(); - } - if (node.getSrcTp() != null) { - srcTp = node.getSrcTp(); - } else { - srcTp = ""; - otnNodesProvisioned.add(node); } - // if the node is currently mounted then proceed. - if (this.deviceTransactionManager.isDeviceMounted(nodeId)) { - interfacesToDelete.addAll(getInterfaces2delete(nodeId, srcTp, destTp, waveNumber)); - } else { - String result = nodeId + " is not mounted on the controller"; + if (!this.deviceTransactionManager.isDeviceMounted(nodeId)) { + String result = nodeId + IS_NOT_MOUNTED_ON_THE_CONTROLLER; results.add(result); success.set(false); LOG.warn(result); @@ -307,6 +352,22 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { return; //TODO should deletion end here? } + // if the node is currently mounted then proceed. + + String destTp = node.getDestTp(); + String srcTp = ""; + if (node.getSrcTp() == null) { + otnLinkTps.add(new LinkTpBuilder() + .setNodeId(nodeId) + .setTpId(destTp) + .build()); + } else { + srcTp = node.getSrcTp(); + } + List interfacesToDelete = new LinkedList<>(); + interfacesToDelete.addAll(getInterfaces2delete(nodeId, srcTp, destTp, + input.getLowerSpectralSlotNumber().intValue(), + input.getHigherSpectralSlotNumber().intValue())); for (String interfaceId : interfacesToDelete) { try { this.openRoadmInterfaces.deleteInterface(nodeId, interfaceId); @@ -324,76 +385,128 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { LOG.error("Error while deleting service paths!", e); } forkJoinPool.shutdown(); - updateOtnTopology(otnNodesProvisioned, true); if (!alarmSuppressionNodeRemoval(input.getServiceName())) { LOG.error("Alarm suppresion node removal failed!!!!"); } - ServicePathOutputBuilder delServBldr = new ServicePathOutputBuilder(); - delServBldr.setSuccess(success.get()); - if (results.isEmpty()) { - return delServBldr.setResult("Request processed").build(); - } else { - return delServBldr.setResult(String.join("\n", results)).build(); - } + return new ServicePathOutputBuilder() + .setSuccess(success.get()) + .setLinkTp(otnLinkTps) + .setResult( + results.isEmpty() + ? "Request processed" + : String.join("\n", results)) + .build(); } - private List getInterfaces2delete( - String nodeId, String srcTp, String destTp, Long waveNumber) { - List interfacesToDelete = new LinkedList<>(); + private List getInterfaces2delete( + String nodeId, String srcTp, String destTp, int lowerSpectralSlotNumber, int higherSpectralSlotNumber) { + String spectralSlotName = String.join(GridConstant.SPECTRAL_SLOT_SEPARATOR, + String.valueOf(lowerSpectralSlotNumber), + String.valueOf(higherSpectralSlotNumber)); + if (destTp.contains(StringConstants.NETWORK_TOKEN) || srcTp.contains(StringConstants.CLIENT_TOKEN) || srcTp.contains(StringConstants.NETWORK_TOKEN) || destTp.contains(StringConstants.CLIENT_TOKEN)) { - if (destTp.contains(StringConstants.NETWORK_TOKEN)) { - try { - if (this.openRoadmInterfaces.getInterface(nodeId, destTp + "-ODU").isPresent()) { - interfacesToDelete.add(destTp + "-ODU"); - } - if (this.openRoadmInterfaces.getInterface(nodeId, destTp + ODU4).isPresent()) { - interfacesToDelete.add(destTp + ODU4); - } - } - catch (OpenRoadmInterfaceException e) { - LOG.error("impossible to get interface {} or {}", destTp + "-ODU", destTp + ODU4, e); - } - interfacesToDelete.add(destTp + "-OTU"); - interfacesToDelete.add( - this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaceName(destTp, waveNumber)); - } - if (srcTp.contains(StringConstants.NETWORK_TOKEN)) { - interfacesToDelete.add(srcTp + "-ODU"); - interfacesToDelete.add(srcTp + "-OTU"); - interfacesToDelete - .add(this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaceName(srcTp, waveNumber)); - } - if (srcTp.contains(StringConstants.CLIENT_TOKEN)) { - interfacesToDelete.add(srcTp + "-ETHERNET"); + return getInterfacesTodelete(nodeId, srcTp, destTp, spectralSlotName); + } + + List interfacesToDelete = new LinkedList<>(); + String connectionNumber = String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, srcTp, destTp, spectralSlotName); + List intToDelete = this.crossConnect.deleteCrossConnect(nodeId, connectionNumber, false); + for (String interf : intToDelete == null ? new ArrayList() : intToDelete) { + if (!this.openRoadmInterfaceFactory.isUsedByXc( + nodeId, interf, connectionNumber, this.deviceTransactionManager)) { + interfacesToDelete.add(interf); } - if (destTp.contains(StringConstants.CLIENT_TOKEN)) { - interfacesToDelete.add(destTp + "-ETHERNET"); + } + return interfacesToDelete; + } + + private List getInterfacesTodelete(String nodeId, String srcTp, String destTp, String spectralSlotName) { + + OpenroadmNodeVersion nodeOpenRoadmVersion = + this.portMapping.getNode(nodeId).getNodeInfo().getOpenroadmVersion(); + + List interfacesToDelete = new LinkedList<>(); + Map> suffixListMap = + nodeOpenRoadmVersion.equals(OpenroadmNodeVersion._71) + ? Map.of( + // We don't need ODUC2, ODUC3 here, since they are handled in OTN service-path + // This has to be in an order of deletion + "ODU", List.of("ODU4", "ODUFLEX", "ODUC4", "ODUC1"), + // Add intermediate OTUCn rates (OTUC2, OTUC3) + // OTU4 is used in 100G service on 7.1 model + "other", List.of("OTU4", "OTUC1", "OTUC2", "OTUC3", "OTUC4", + "OTSIGROUP-400G", "OTSIGROUP-300G", "OTSIGROUP-200G", "OTSIGROUP-100G", + spectralSlotName)) + : Map.of( + "ODU", List.of("ODU", "ODU4"), + "other", List.of("OTU", spectralSlotName)); + // this last suffix used to be retrieved from openRoadmInterfaceFactory.createOpenRoadmOchInterfaceName + // i.e. String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, spectralSlotName) with + // common GridConstant that states NAME_PARAMETERS_SEPARATOR = "-" + + if (destTp.contains(StringConstants.NETWORK_TOKEN)) { + interfacesToDelete.addAll(inf2Del(destTp, suffixListMap, nodeId)); + } + if (srcTp.contains(StringConstants.NETWORK_TOKEN)) { + // For a regen case, the srcTp can also contain the network-token + interfacesToDelete.addAll(inf2Del(srcTp, suffixListMap, nodeId)); + } + if (srcTp.contains(StringConstants.CLIENT_TOKEN)) { + interfacesToDelete.add(String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, srcTp, "ETHERNET")); + } + if (destTp.contains(StringConstants.CLIENT_TOKEN)) { + interfacesToDelete.add(String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, "ETHERNET")); + } + return interfacesToDelete; + } + + private List inf2Del(String termPoint, Map> suffixListMap, String nodeId) { + List inf2Del = new LinkedList<>(); + try { + for (String suffix : suffixListMap.get("ODU")) { + if (this.openRoadmInterfaces.getInterface( + nodeId, String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, termPoint, suffix)).isPresent()) { + inf2Del.add(String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, termPoint, suffix)); + } } - } else { - String connectionNumber = srcTp + "-" + destTp + "-" + waveNumber; - List intToDelete = this.crossConnect.deleteCrossConnect(nodeId, connectionNumber, false); - connectionNumber = destTp + "-" + srcTp + "-" + waveNumber; - if (intToDelete != null) { - for (String interf : intToDelete) { - if (!this.openRoadmInterfaceFactory.isUsedByXc(nodeId, interf, connectionNumber, - this.deviceTransactionManager)) { - interfacesToDelete.add(interf); - } + } + catch (OpenRoadmInterfaceException e) { + LOG.error("impossible to get one of the interfaces {}", + termPoint + GridConstant.NAME_PARAMETERS_SEPARATOR + String.join( + " or " + termPoint + GridConstant.NAME_PARAMETERS_SEPARATOR, + suffixListMap.get("ODU")), + e); + } + try { + for (String suffix : suffixListMap.get("other")) { + if (this.openRoadmInterfaces.getInterface( + nodeId, String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, termPoint, suffix)).isPresent()) { + LOG.info("Deleting the interface {}", + String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, termPoint, suffix)); + inf2Del.add(String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, termPoint, suffix)); } } } - return interfacesToDelete; + catch (OpenRoadmInterfaceException e) { + LOG.error("impossible to get one of the interfaces {}", + termPoint + GridConstant.NAME_PARAMETERS_SEPARATOR + String.join( + " or " + termPoint + GridConstant.NAME_PARAMETERS_SEPARATOR, + suffixListMap.get("ODU")), + e); + } + return inf2Del; } + @Override public RendererRollbackOutput rendererRollback(RendererRollbackInput input) { boolean success = true; - List failedToRollbackList = new ArrayList<>(); - for (NodeInterface nodeInterfaces : input.getNodeInterface()) { - List failedInterfaces = new ArrayList<>(); + Map failedToRollbackList = new HashMap<>(); + for (NodeInterface nodeInterfaces : input.nonnullNodeInterface().values()) { + Set failedInterfaces = new HashSet<>(); String nodeId = nodeInterfaces.getNodeId(); for (String connectionId : nodeInterfaces.getConnectionId()) { List listInter = this.crossConnect.deleteCrossConnect(nodeId, connectionId, false); @@ -435,35 +548,43 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { failedInterfaces.add(interfaceId); } } - failedToRollbackList.add(new FailedToRollbackBuilder().withKey(new FailedToRollbackKey(nodeId)) - .setNodeId(nodeId).setInterface(failedInterfaces).build()); + FailedToRollback failedToRollack = new FailedToRollbackBuilder().withKey(new FailedToRollbackKey(nodeId)) + .setNodeId(nodeId).setInterface(failedInterfaces).build(); + failedToRollbackList.put(failedToRollack.key(),failedToRollack); } - return new RendererRollbackOutputBuilder().setSuccess(success).setFailedToRollback(failedToRollbackList) + return new RendererRollbackOutputBuilder() + .setSuccess(success) + .setFailedToRollback(failedToRollbackList) .build(); } private boolean alarmSuppressionNodeRegistration(ServicePathInput input) { - NodelistBuilder nodeListBuilder = new NodelistBuilder() - .withKey(new NodelistKey(input.getServiceName())) - .setServiceName(input.getServiceName()); - List nodeList = - new ArrayList<>(); - for (Nodes node : input.getNodes()) { - nodeList.add( - new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102 - .service.nodelist.nodelist.NodesBuilder() - .setNodeId(node.getNodeId()).build()); + Map nodeList = new HashMap<>(); + if (input.getNodes() != null) { + for (Nodes node : input.getNodes()) { + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102 + .service.nodelist.nodelist.Nodes nodes = + new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102 + .service.nodelist.nodelist.NodesBuilder().setNodeId(node.getNodeId()).build(); + nodeList.put(nodes.key(),nodes); + } } - nodeListBuilder.setNodes(nodeList); InstanceIdentifier nodeListIID = - InstanceIdentifier.create(ServiceNodelist.class).child( - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression - .rev171102.service.nodelist.Nodelist.class, - new NodelistKey(input.getServiceName())); + InstanceIdentifier.create(ServiceNodelist.class) + .child(org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102 + .service.nodelist.Nodelist.class, new NodelistKey(input.getServiceName())); final WriteTransaction writeTransaction = this.dataBroker.newWriteOnlyTransaction(); - writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, nodeListIID, nodeListBuilder.build()); + writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, + nodeListIID, + new NodelistBuilder() + .withKey(new NodelistKey(input.getServiceName())) + .setServiceName(input.getServiceName()) + .setNodes(nodeList) + .build()); FluentFuture commit = writeTransaction.commit(); try { commit.get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS); @@ -478,10 +599,9 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { private boolean alarmSuppressionNodeRemoval(String serviceName) { InstanceIdentifier nodeListIID = - InstanceIdentifier.create(ServiceNodelist.class).child( - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression - .rev171102.service.nodelist.Nodelist.class, - new NodelistKey(serviceName)); + InstanceIdentifier.create(ServiceNodelist.class) + .child(org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102 + .service.nodelist.Nodelist.class, new NodelistKey(serviceName)); final WriteTransaction writeTransaction = this.dataBroker.newWriteOnlyTransaction(); writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, nodeListIID); FluentFuture commit = writeTransaction.commit(); @@ -512,7 +632,7 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { } if (services.isPresent()) { LOG.info("service {} already exists", name); - servicesBuilder = new ServicesBuilder(services.get()).setTopology(topo); + servicesBuilder = new ServicesBuilder(services.orElseThrow()).setTopology(topo); WriteTransaction writeTx = this.dataBroker.newWriteOnlyTransaction(); writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, servicesBuilder.build()); writeTx.commit().get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS); @@ -521,88 +641,70 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { } } + @SuppressFBWarnings( + value = "SLF4J_FORMAT_SHOULD_BE_CONST", + justification = "Log messages content needs to be formatted before" + + "since they are used in the returned object") @Override public CreateOtsOmsOutput createOtsOms(CreateOtsOmsInput input) throws OpenRoadmInterfaceException { - CreateOtsOmsOutputBuilder output = new CreateOtsOmsOutputBuilder(); - String result = ""; - Boolean success = false; + if (!this.deviceTransactionManager.isDeviceMounted(input.getNodeId())) { + String result = input.getNodeId() + IS_NOT_MOUNTED_ON_THE_CONTROLLER; + LOG.warn(result); + return new CreateOtsOmsOutputBuilder().setResult(result).setSuccess(false).build(); + } // if the node is currently mounted then proceed. - if (this.deviceTransactionManager.isDeviceMounted(input.getNodeId())) { - Mapping oldMapping = null; - Mapping newMapping = null; - oldMapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint()); - if (oldMapping != null) { - String otsInterface = - this.openRoadmInterfaceFactory.createOpenRoadmOtsInterface(input.getNodeId(), oldMapping); - newMapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint()); - int count = 0; - Boolean isSupportingOtsPresent = isSupportingOtsPresent(newMapping); - while (!isSupportingOtsPresent && (count < 6)) { - LOG.info("waiting for post interface operation on node '{}'...", input.getNodeId()); - try { - Thread.sleep(10000); - this.portMapping.updateMapping(input.getNodeId(), oldMapping); - } catch (InterruptedException e) { - LOG.error("Failed to wait for post interface operation "); - } - newMapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint()); - isSupportingOtsPresent = isSupportingOtsPresent(newMapping); - count++; - } - if (count < 6) { - String omsInterface = - this.openRoadmInterfaceFactory.createOpenRoadmOmsInterface(input.getNodeId(), newMapping); - if (omsInterface != null) { - result = "Interfaces " + otsInterface + " - " + omsInterface + " successfully created on node " - + input.getNodeId(); - success = true; - } else { - LOG.error("Fail to create OpenRoadmOms Interface for node '{}'", input.getNodeId()); - result = "Fail to create OpenRoadmOms Interface for node : " + input.getNodeId(); - } - } else { - LOG.error("Unable to get ots interface from mapping {} for node {}", - oldMapping.getLogicalConnectionPoint(), input.getNodeId()); - result = String.format("Unable to get ots interface from mapping %s - %s", - oldMapping.getLogicalConnectionPoint(), input.getNodeId()); - } - } else { - result = "Logical Connection point " + input.getLogicalConnectionPoint() + " does not exist for " - + input.getNodeId(); - } - } else { - result = input.getNodeId() + " is not mounted on the controller"; - LOG.warn("{} is not mounted on the controller",input.getNodeId()); + Mapping oldMapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint()); + if (oldMapping == null) { + return new CreateOtsOmsOutputBuilder() + .setResult(String.format("Logical Connection point %s does not exist for %s", + input.getLogicalConnectionPoint(), input.getNodeId())) + .setSuccess(false) + .build(); } - return output.setResult(result).setSuccess(success).build(); - } - private Boolean isSupportingOtsPresent(Mapping mapping) { - Boolean result = false; - if (mapping != null) { - if (mapping.getSupportingOts() != null) { - LOG.info("SupportingOts info is present in mapping {}", mapping); - result = true; - } else { - LOG.warn("SupportingOts info not present in mapping {}", mapping); + String otsInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtsInterface(input.getNodeId(), oldMapping); + int count = 0; + Mapping newMapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint()); + while (!isSupportingOtsPresent(newMapping)) { + LOG.info("waiting for post interface operation on node '{}'...", input.getNodeId()); + try { + Thread.sleep(10000); + this.portMapping.updateMapping(input.getNodeId(), oldMapping); + } catch (InterruptedException e) { + LOG.error("Failed to wait for post interface operation"); } + count++; + if (count >= 6) { + String result = String.format("Unable to get ots interface from mapping %s - %s", + oldMapping.getLogicalConnectionPoint(), input.getNodeId()); + LOG.error(result); + return new CreateOtsOmsOutputBuilder().setResult(result).setSuccess(false).build(); + } + newMapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint()); + } + + String omsInterface = this.openRoadmInterfaceFactory.createOpenRoadmOmsInterface(input.getNodeId(), newMapping); + if (omsInterface == null) { + String result = String.format("Fail to create OpenRoadmOms Interface for node : %s", input.getNodeId()); + LOG.error(result); + return new CreateOtsOmsOutputBuilder().setResult(result).setSuccess(false).build(); } - return result; + return new CreateOtsOmsOutputBuilder() + .setResult(String.format("Interfaces %s - %s successfully created on node %s", + otsInterface, omsInterface, input.getNodeId())) + .setSuccess(true) + .build(); } - private void updateOtnTopology(CopyOnWriteArrayList nodes, boolean isDeletion) { - if (nodes.size() != 2) { - LOG.error("Error with OTU4 links to update in otn-topology"); - return; + private Boolean isSupportingOtsPresent(Mapping mapping) { + if (mapping == null) { + return false; } - if (isDeletion) { - LOG.info("updating otn-topology removing OTU4 links"); - this.networkModelService.deleteOtnLinks(nodes.get(0).getNodeId(), nodes.get(0).getDestTp(), - nodes.get(1).getNodeId(), nodes.get(1).getDestTp(), OtnLinkType.OTU4); - } else { - LOG.info("updating otn-topology adding OTU4 links"); - this.networkModelService.createOtnLinks(nodes.get(0).getNodeId(), nodes.get(0).getDestTp(), - nodes.get(1).getNodeId(), nodes.get(1).getDestTp(), OtnLinkType.OTU4); + if (mapping.getSupportingOts() == null) { + LOG.warn("SupportingOts info is not present in mapping {}", mapping); + return false; } + LOG.info("SupportingOts info is present in mapping {}", mapping); + return true; } }