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=1ea280eea518eab4f619722113977af637397c7c;hb=73478a3a5354a2a557520fec6314532bf0ad6a29;hp=7aa43f896d37f484f2b40f149338f235a187321b;hpb=e898e331b55e5886628f5d4617001276d9945aa1;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 7aa43f896..1ea280eea 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 @@ -5,16 +5,20 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.transportpce.renderer.provisiondevice; import com.google.common.collect.Sets; +import com.google.common.util.concurrent.FluentFuture; import java.util.ArrayList; +import java.util.HashMap; 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; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; @@ -22,98 +26,106 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.ReadTransaction; +import org.opendaylight.mdsal.binding.api.WriteTransaction; +import org.opendaylight.mdsal.common.api.CommitInfo; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +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.PortMapping; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces; -import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl; +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.openroadm.common.service.types.rev161014.service.Topology; -import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.get.connection.port.trail.output.Ports; -import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.OrgOpenroadmDevice; -import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnections; -import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnectionsKey; -import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.OchAttributes.ModulationFormat; -import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.R100G; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceList; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesBuilder; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesKey; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.node.interfaces.NodeInterface; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.node.interfaces.NodeInterfaceBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.node.interfaces.NodeInterfaceKey; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.olm.renderer.input.Nodes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.ServiceNodelist; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist.NodelistBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist.NodelistKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.portmapping.rev170228.network.nodes.Mapping; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.CreateOtsOmsInput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.CreateOtsOmsOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.CreateOtsOmsOutputBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.RendererRollbackInput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.RendererRollbackOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.RendererRollbackOutputBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.ServicePathInput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.ServicePathOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.ServicePathOutputBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.renderer.rollback.output.FailedToRollback; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.renderer.rollback.output.FailedToRollbackBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.renderer.rollback.output.FailedToRollbackKey; +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.device.renderer.rev210618.CreateOtsOmsInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.CreateOtsOmsOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.CreateOtsOmsOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.RendererRollbackInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.RendererRollbackOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.RendererRollbackOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.ServicePathInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.ServicePathOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.ServicePathOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.renderer.rollback.output.FailedToRollback; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.renderer.rollback.output.FailedToRollbackBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.renderer.rollback.output.FailedToRollbackKey; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.OpenroadmNodeVersion; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.mapping.Mapping; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.Topology; +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.rev210618.link.tp.LinkTp; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.link.tp.LinkTpBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.node.interfaces.NodeInterface; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.node.interfaces.NodeInterfaceBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.node.interfaces.NodeInterfaceKey; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.optical.renderer.nodes.Nodes; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class DeviceRendererServiceImpl implements DeviceRendererService { +public class DeviceRendererServiceImpl implements DeviceRendererService { + private static final String IS_NOT_MOUNTED_ON_THE_CONTROLLER = " is not mounted on the controller"; + private static final String ODU4 = "-ODU4"; private static final Logger LOG = LoggerFactory.getLogger(DeviceRendererServiceImpl.class); - 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 String serviceName; + private final NetworkModelService networkModelService; public DeviceRendererServiceImpl(DataBroker dataBroker, DeviceTransactionManager deviceTransactionManager, - OpenRoadmInterfaceFactory openRoadmInterfaceFactory, - OpenRoadmInterfaces openRoadmInterfaces, CrossConnect crossConnect, - PortMapping portMapping) { + OpenRoadmInterfaceFactory openRoadmInterfaceFactory, OpenRoadmInterfaces openRoadmInterfaces, + CrossConnect crossConnect, PortMapping portMapping, NetworkModelService networkModelService) { this.dataBroker = dataBroker; this.deviceTransactionManager = deviceTransactionManager; this.openRoadmInterfaceFactory = openRoadmInterfaceFactory; this.openRoadmInterfaces = openRoadmInterfaces; this.crossConnect = crossConnect; this.portMapping = portMapping; - serviceName = "Undefined"; + this.networkModelService = networkModelService; } @Override public ServicePathOutput setupServicePath(ServicePathInput input, ServicePathDirection direction) { - this.serviceName = input.getServiceName(); - List nodes = input.getNodes(); + 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 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(); + // take the index of the node + int nodeIndex = nodes.indexOf(node); LOG.info("Starting provisioning for node : {}", nodeId); List createdEthInterfaces = new ArrayList<>(); List createdOtuInterfaces = new ArrayList<>(); @@ -121,142 +133,157 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { List createdOchInterfaces = new ArrayList<>(); List createdConnections = new ArrayList<>(); 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(); - if ((destTp != null) && destTp.contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN)) { + if ((destTp != null) && destTp.contains(StringConstants.NETWORK_TOKEN)) { + LOG.info("Adding supporting OCH interface for node {}, dest tp {}, spectrumInformation {}", + nodeId, destTp, spectrumInformation); crossConnectFlag++; - // create OpenRoadm Xponder Line Interfaces String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface( - nodeId, destTp, waveNumber, R100G.class, ModulationFormat.DpQpsk,serviceName); + nodeId, destTp, spectrumInformation); createdOchInterfaces.add(supportingOchInterface); - - String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface( - nodeId, destTp, supportingOchInterface,serviceName); + // Here we pass logical connection-point of z-end to set SAPI and DAPI + Nodes tgtNode = null; + if (nodeIndex + 1 == nodes.size()) { + // For the end node, tgtNode becomes the first node in the list + tgtNode = nodes.get(0); + } else { + tgtNode = nodes.get(nodeIndex + 1); + } + // tgtNode srcTp is null in this if cond + String supportingOtuInterface = this.openRoadmInterfaceFactory + .createOpenRoadmOtu4Interface(nodeId, destTp, supportingOchInterface, + tgtNode.getNodeId(), tgtNode.getDestTp()); createdOtuInterfaces.add(supportingOtuInterface); - - createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(nodeId, - destTp, supportingOtuInterface,serviceName)); + if (srcTp == null) { + LinkTp linkTp = new LinkTpBuilder() + .setNodeId(nodeId) + .setTpId(destTp) + .build(); + otnLinkTps.add(linkTp); + } else { + createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(nodeId, + destTp, supportingOtuInterface)); + } } - if ((srcTp != null) && srcTp.contains(OpenRoadmInterfacesImpl.CLIENT_TOKEN)) { + 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,serviceName)); - + createdEthInterfaces.add( + this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(nodeId, srcTp)); } - if ((srcTp != null) && srcTp.contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN)) { + 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, R100G.class, ModulationFormat.DpQpsk,serviceName); + nodeId, srcTp, spectrumInformation); createdOchInterfaces.add(supportingOchInterface); - - String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface( - nodeId, srcTp, supportingOchInterface,serviceName); + String supportingOtuInterface = this.openRoadmInterfaceFactory + .createOpenRoadmOtu4Interface(nodeId, srcTp, supportingOchInterface); createdOtuInterfaces.add(supportingOtuInterface); - createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(nodeId, - srcTp, supportingOtuInterface,serviceName)); + 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)); + } else { + createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(nodeId, + destTp, supportingOtuInterface)); + } } - if ((destTp != null) && destTp.contains(OpenRoadmInterfacesImpl.CLIENT_TOKEN)) { + 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,serviceName)); - + createdEthInterfaces.add( + this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(nodeId, destTp)); } - if ((srcTp != null) && (srcTp.contains(OpenRoadmInterfacesImpl.TTP_TOKEN) || srcTp.contains( - OpenRoadmInterfacesImpl.PP_TOKEN))) { - createdOchInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(nodeId, - srcTp, waveNumber,serviceName)); + if ((srcTp != null) && (srcTp.contains(StringConstants.TTP_TOKEN) + || srcTp.contains(StringConstants.PP_TOKEN))) { + 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(OpenRoadmInterfacesImpl.TTP_TOKEN) || destTp.contains( - OpenRoadmInterfacesImpl.PP_TOKEN))) { - createdOchInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(nodeId, - destTp, waveNumber,serviceName)); + if ((destTp != null) && (destTp.contains(StringConstants.TTP_TOKEN) + || destTp.contains(StringConstants.PP_TOKEN))) { + 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); + destTp, nodeId); + Optional connectionNameOpt = + this.crossConnect.postCrossConnect(nodeId, srcTp, destTp, spectrumInformation); if (connectionNameOpt.isPresent()) { nodesProvisioned.add(nodeId); - List ports = this.crossConnect - .getConnectionPortTrail(nodeId, waveNumber, srcTp, destTp); - if (ServicePathDirection.A_TO_Z.equals(direction)) { - topology.updateAtoZTopologyList(ports, nodeId); - } - if (ServicePathDirection.Z_TO_A.equals(direction)) { - topology.updateZtoATopologyList(ports, nodeId); - - } createdConnections.add(connectionNameOpt.get()); } else { processErrorMessage("Unable to post Roadm-connection for node " + nodeId, forkJoinPool, - results); + results); success.set(false); } } } 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(); - nodeInterfaceBuilder.withKey(new NodeInterfaceKey(nodeId)); - nodeInterfaceBuilder.setNodeId(nodeId); - nodeInterfaceBuilder.setConnectionId(createdConnections); - nodeInterfaceBuilder.setEthInterfaceId(createdEthInterfaces); - nodeInterfaceBuilder.setOtuInterfaceId(createdOtuInterfaces); - nodeInterfaceBuilder.setOduInterfaceId(createdOduInterfaces); - nodeInterfaceBuilder.setOchInterfaceId(createdOchInterfaces); - nodeInterfaces.add(nodeInterfaceBuilder.build()); + NodeInterfaceBuilder nodeInterfaceBuilder = new NodeInterfaceBuilder() + .withKey(new NodeInterfaceKey(nodeId)) + .setNodeId(nodeId) + .setConnectionId(createdConnections) + .setEthInterfaceId(createdEthInterfaces) + .setOtuInterfaceId(createdOtuInterfaces) + .setOduInterfaceId(createdOduInterfaces) + .setOchInterfaceId(createdOchInterfaces); + NodeInterface nodeInterface = nodeInterfaceBuilder.build(); + nodeInterfaces.put(nodeInterface.key(),nodeInterface); })); - try { forkJoinTask.get(); } catch (InterruptedException | ExecutionException e) { LOG.error("Error while setting up service paths!", e); } - forkJoinPool.shutdown(); if (success.get()) { results.add("Roadm-connection successfully created for nodes: " + String.join(", ", nodesProvisioned)); } - ServicePathOutputBuilder setServBldr = new ServicePathOutputBuilder(); - setServBldr.setNodeInterface(new ArrayList<>(nodeInterfaces)); - setServBldr.setSuccess(success.get()); - setServBldr.setResult(String.join("\n", results)); - // setting topology in the service list data store try { setTopologyForService(input.getServiceName(), topology.getTopology()); } 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!!!!"); } - + ServicePathOutputBuilder setServBldr = new ServicePathOutputBuilder() + .setNodeInterface(nodeInterfaces) + .setSuccess(success.get()) + .setResult(String.join("\n", results)) + .setLinkTp(otnLinkTps); return setServBldr.build(); } private ConcurrentLinkedQueue processErrorMessage(String message, ForkJoinPool forkJoinPool, - ConcurrentLinkedQueue messages) { - LOG.warn(message); + ConcurrentLinkedQueue messages) { + LOG.warn("Received error message {}", message); messages.add(message); forkJoinPool.shutdown(); return messages; @@ -266,73 +293,48 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { public ServicePathOutput deleteServicePath(ServicePathInput input) { List nodes = input.getNodes(); AtomicBoolean success = new AtomicBoolean(true); - ConcurrentLinkedQueue results = new ConcurrentLinkedQueue<>(); if (!alarmSuppressionNodeRegistration(input)) { LOG.warn("Alarm suppresion node registraion failed!!!!"); } + 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 = node.getSrcTp(); - String destTp = node.getDestTp(); - Long waveNumber = input.getWaveNumber(); - - if ((srcTp == null) || (destTp == null)) { - LOG.error("Source ({}) or destination ({}) termination point is null.", srcTp, destTp); + String srcTp; + String destTp; + 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 = ""; + LinkTp linkTp = new LinkTpBuilder() + .setNodeId(nodeId) + .setTpId(destTp) + .build(); + otnLinkTps.add(linkTp); } - // if the node is currently mounted then proceed. if (this.deviceTransactionManager.isDeviceMounted(nodeId)) { - if (destTp.contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN) || srcTp.contains( - OpenRoadmInterfacesImpl.CLIENT_TOKEN) || srcTp.contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN) - || destTp.contains(OpenRoadmInterfacesImpl.CLIENT_TOKEN)) { - if (destTp.contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN)) { - interfacesToDelete.add(destTp + "-ODU"); - interfacesToDelete.add(destTp + "-OTU"); - interfacesToDelete.add(this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaceName(destTp, - waveNumber)); - } - if (srcTp.contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN)) { - interfacesToDelete.add(srcTp + "-ODU"); - interfacesToDelete.add(srcTp + "-OTU"); - interfacesToDelete.add(this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaceName(srcTp, - waveNumber)); - } - if (srcTp.contains(OpenRoadmInterfacesImpl.CLIENT_TOKEN)) { - interfacesToDelete.add(srcTp + "-ETHERNET"); - } - if (destTp.contains(OpenRoadmInterfacesImpl.CLIENT_TOKEN)) { - interfacesToDelete.add(destTp + "-ETHERNET"); - } - } else { - String connectionNumber = srcTp + "-" + destTp + "-" + waveNumber; - if (!this.crossConnect.deleteCrossConnect(nodeId, connectionNumber)) { - LOG.error("Failed to delete cross connect {}", connectionNumber); - } - connectionNumber = destTp + "-" + srcTp + "-" + waveNumber; - String interfName = this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaceName(srcTp, - waveNumber); - if (!isUsedByXc(nodeId, interfName, connectionNumber)) { - interfacesToDelete.add(interfName); - } - interfName = this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaceName(destTp, waveNumber); - if (!isUsedByXc(nodeId, interfName, connectionNumber)) { - interfacesToDelete.add(interfName); - } - } + interfacesToDelete.addAll(getInterfaces2delete(nodeId, srcTp, destTp, + input.getLowerSpectralSlotNumber().intValue(), + input.getHigherSpectralSlotNumber().intValue())); } else { - String result = nodeId + " is not mounted on the controller"; + String result = nodeId + IS_NOT_MOUNTED_ON_THE_CONTROLLER; results.add(result); success.set(false); LOG.warn(result); forkJoinPool.shutdown(); - return; // TODO should deletion end here? + return; + //TODO should deletion end here? } - for (String interfaceId : interfacesToDelete) { try { this.openRoadmInterfaces.deleteInterface(nodeId, interfaceId); @@ -344,19 +346,18 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { } } })); - try { forkJoinTask.get(); } catch (InterruptedException | ExecutionException e) { LOG.error("Error while deleting service paths!", e); } - forkJoinPool.shutdown(); if (!alarmSuppressionNodeRemoval(input.getServiceName())) { LOG.error("Alarm suppresion node removal failed!!!!"); } - ServicePathOutputBuilder delServBldr = new ServicePathOutputBuilder(); - delServBldr.setSuccess(success.get()); + ServicePathOutputBuilder delServBldr = new ServicePathOutputBuilder() + .setSuccess(success.get()) + .setLinkTp(otnLinkTps); if (results.isEmpty()) { return delServBldr.setResult("Request processed").build(); } else { @@ -364,15 +365,98 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { } } + 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)); + OpenroadmNodeVersion nodeOpenRoadmVersion = this.portMapping.getNode(nodeId).getNodeInfo() + .getOpenroadmVersion(); + List interfacesToDelete = new LinkedList<>(); + 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)) { + if (nodeOpenRoadmVersion.equals(OpenroadmNodeVersion._71)) { + try { + if (this.openRoadmInterfaces.getInterface(nodeId, destTp + "-ODUFLEX").isPresent()) { + interfacesToDelete.add(destTp + "-ODUFLEX"); + } + if (this.openRoadmInterfaces.getInterface(nodeId, destTp + "-ODUC4").isPresent()) { + interfacesToDelete.add(destTp + "-ODUC4"); + } + } catch (OpenRoadmInterfaceException e) { + LOG.error("impossible to get interface {} or {}", destTp + "-ODUFLEX", destTp + "-ODUC4", e); + } + interfacesToDelete.add(destTp + "-OTUC4"); + interfacesToDelete.add(destTp + "-OTSI-GROUP"); + interfacesToDelete.add(destTp + "-" + lowerSpectralSlotNumber + ":" + higherSpectralSlotNumber); + } else { + 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,spectralSlotName)); + } + } + if (srcTp.contains(StringConstants.NETWORK_TOKEN)) { + if (nodeOpenRoadmVersion.equals(OpenroadmNodeVersion._71)) { + interfacesToDelete.add(srcTp + "-ODUC4"); + interfacesToDelete.add(srcTp + "-OTUC4"); + interfacesToDelete.add(srcTp + "-OTSI-GROUP"); + interfacesToDelete.add(srcTp + "-" + lowerSpectralSlotNumber + ":" + higherSpectralSlotNumber); + } else { + interfacesToDelete.add(srcTp + "-ODU"); + interfacesToDelete.add(srcTp + "-OTU"); + interfacesToDelete + .add(this.openRoadmInterfaceFactory + .createOpenRoadmOchInterfaceName(srcTp, spectralSlotName)); + } + } + if (srcTp.contains(StringConstants.CLIENT_TOKEN)) { + interfacesToDelete.add(srcTp + "-ETHERNET"); + } + if (destTp.contains(StringConstants.CLIENT_TOKEN)) { + interfacesToDelete.add(destTp + "-ETHERNET"); + } + } else { + String connectionNumber = String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, srcTp, destTp, + spectralSlotName); + List intToDelete = this.crossConnect.deleteCrossConnect(nodeId, connectionNumber, false); + connectionNumber = String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, srcTp, spectralSlotName); + if (intToDelete != null) { + for (String interf : intToDelete) { + if (!this.openRoadmInterfaceFactory.isUsedByXc(nodeId, interf, connectionNumber, + this.deviceTransactionManager)) { + interfacesToDelete.add(interf); + } + } + } + } + return interfacesToDelete; + } + @Override public RendererRollbackOutput rendererRollback(RendererRollbackInput input) { boolean success = true; - List failedToRollbackList = new ArrayList<>(); - for (NodeInterface nodeInterfaces : input.getNodeInterface()) { + Map failedToRollbackList = new HashMap<>(); + for (NodeInterface nodeInterfaces : input.nonnullNodeInterface().values()) { List failedInterfaces = new ArrayList<>(); String nodeId = nodeInterfaces.getNodeId(); for (String connectionId : nodeInterfaces.getConnectionId()) { - if (this.crossConnect.deleteCrossConnect(nodeId, connectionId)) { + List listInter = this.crossConnect.deleteCrossConnect(nodeId, connectionId, false); + if (listInter != null) { LOG.info("Cross connect {} on node {} successfully deleted.", connectionId, nodeId); } else { LOG.error("Failed to delete cross connect {} on node {}!", connectionId, nodeId); @@ -398,10 +482,8 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { if (nodeInterfaces.getEthInterfaceId() != null) { interfacesToDelete.addAll(nodeInterfaces.getEthInterfaceId()); } - - LOG.info("Going to execute rollback on node {}. Interfaces to rollback: {}", nodeId, String.join(", ", - interfacesToDelete)); - + LOG.info("Going to execute rollback on node {}. Interfaces to rollback: {}", nodeId, + String.join(", ", interfacesToDelete)); for (String interfaceId : interfacesToDelete) { try { this.openRoadmInterfaces.deleteInterface(nodeId, interfaceId); @@ -412,113 +494,94 @@ 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) - .build(); + .build(); } private boolean alarmSuppressionNodeRegistration(ServicePathInput input) { - NodelistBuilder nodeListBuilder = new NodelistBuilder(); - nodeListBuilder.withKey(new NodelistKey(input.getServiceName())); - nodeListBuilder.setServiceName(input.getServiceName()); - List< - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service - .nodelist.nodelist.Nodes> nodeList = new ArrayList<>(); - for (Nodes node : input.getNodes()) { - nodeList.add( - new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102 - .service.nodelist.nodelist.NodesBuilder().setNodeId(node.getNodeId()).build()); + NodelistBuilder nodeListBuilder = new NodelistBuilder() + .withKey(new NodelistKey(input.getServiceName())) + .setServiceName(input.getServiceName()); + 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< - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist - .Nodelist> nodeListIID = InstanceIdentifier.create(ServiceNodelist.class).child(org.opendaylight.yang - .gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist - .Nodelist.class, new NodelistKey(input.getServiceName())); + 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())); final WriteTransaction writeTransaction = this.dataBroker.newWriteOnlyTransaction(); writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, nodeListIID, nodeListBuilder.build()); - Future submit = writeTransaction.submit(); + FluentFuture commit = writeTransaction.commit(); try { - submit.get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS); + commit.get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS); LOG.info("Nodes are register for alarm suppression for service: {}", input.getServiceName()); return true; - } catch (ExecutionException | InterruptedException | TimeoutException e) { LOG.warn("Failed to alarm suppresslist for service: {}", input.getServiceName(), e); return false; } } - private boolean alarmSuppressionNodeRemoval(String name) { - InstanceIdentifier< - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist - .Nodelist> nodeListIID = InstanceIdentifier.create(ServiceNodelist.class).child(org.opendaylight.yang - .gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist - .Nodelist.class, new NodelistKey(name)); + 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)); final WriteTransaction writeTransaction = this.dataBroker.newWriteOnlyTransaction(); writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, nodeListIID); - Future submit = writeTransaction.submit(); + FluentFuture commit = writeTransaction.commit(); try { - submit.get(Timeouts.DATASTORE_DELETE, TimeUnit.MILLISECONDS); - LOG.info("Nodes are unregister for alarm suppression for service: {}", name); + commit.get(Timeouts.DATASTORE_DELETE, TimeUnit.MILLISECONDS); + LOG.info("Nodes are unregister for alarm suppression for service: {}", serviceName); return true; - } catch (InterruptedException | TimeoutException | ExecutionException e) { - LOG.warn("Failed to alarm suppresslist for service: {}", name, e); + LOG.warn("Failed to alarm suppresslist for service: {}", serviceName, e); return false; } } - private void setTopologyForService(String name, Topology topo) throws InterruptedException, - ExecutionException, TimeoutException { - + private void setTopologyForService(String name, Topology topo) + throws InterruptedException, ExecutionException, TimeoutException { ServicesBuilder servicesBuilder; // Get the service from the service list inventory - ServicesKey serviceKey = new ServicesKey(name); - InstanceIdentifier iid = InstanceIdentifier.create(ServiceList.class).child(Services.class, - serviceKey); + InstanceIdentifier iid = + InstanceIdentifier.create(ServiceList.class).child(Services.class, serviceKey); Optional services; - try (ReadOnlyTransaction readTx = this.dataBroker.newReadOnlyTransaction()) { - Future> future = readTx.read(LogicalDatastoreType.OPERATIONAL, - iid); - services = future.get(Timeouts.DATASTORE_READ, TimeUnit.MILLISECONDS).toJavaUtil(); + try (ReadTransaction readTx = this.dataBroker.newReadOnlyTransaction()) { + Future> future = + readTx.read(LogicalDatastoreType.OPERATIONAL, iid); + services = future.get(Timeouts.DATASTORE_READ, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw e; } - if (services.isPresent()) { - servicesBuilder = new ServicesBuilder(services.get()); - } else { - servicesBuilder = new ServicesBuilder(); - servicesBuilder.withKey(serviceKey); - } - servicesBuilder.setTopology(topo); - - WriteTransaction writeTx = this.dataBroker.newWriteOnlyTransaction(); - writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, servicesBuilder.build()); - writeTx.submit().get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS); - - } - - private boolean isUsedByXc(String nodeid, String interfaceid, String xcid) { - InstanceIdentifier xciid = InstanceIdentifier.create(OrgOpenroadmDevice.class).child( - RoadmConnections.class, new RoadmConnectionsKey(xcid)); - LOG.info("reading xc {} in node {}", xcid, nodeid); - Optional crossconnection = this.deviceTransactionManager.getDataFromDevice(nodeid, - LogicalDatastoreType.CONFIGURATION, xciid, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT); - if (crossconnection.isPresent()) { - RoadmConnections xc = crossconnection.get(); - LOG.info("xd {} found", xcid); - if (xc.getSource().getSrcIf().equals(interfaceid) || xc.getDestination().getDstIf().equals(interfaceid)) { - return true; - } + LOG.info("service {} already exists", name); + servicesBuilder = new ServicesBuilder(services.get()).setTopology(topo); + WriteTransaction writeTx = this.dataBroker.newWriteOnlyTransaction(); + writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, servicesBuilder.build()); + writeTx.commit().get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS); } else { - LOG.info("xd {} not found !", xcid); + LOG.warn("Service {} does not exist - topology can not be updated", name); } - return false; } @Override @@ -528,24 +591,65 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { Boolean success = false; // if the node is currently mounted then proceed. if (this.deviceTransactionManager.isDeviceMounted(input.getNodeId())) { - Mapping mapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint()); - if (mapping != null) { - String otsInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtsInterface(input.getNodeId(), - mapping); - mapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint()); - String omsInterface = this.openRoadmInterfaceFactory.createOpenRoadmOmsInterface(input.getNodeId(), - mapping); - result = "Interfaces " + otsInterface + " - " + omsInterface + " successfully created on node " + input - .getNodeId(); - success = true; + 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(); + + input.getNodeId(); } } else { - result = input.getNodeId() + " is not mounted on the controller"; - LOG.warn(result); + result = input.getNodeId() + IS_NOT_MOUNTED_ON_THE_CONTROLLER; + LOG.warn("{} is not mounted on the controller",input.getNodeId()); } return output.setResult(result).setSuccess(success).build(); } -} \ No newline at end of file + + 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); + } + } + return result; + } +}