OLM bug correction in rpc span-loss-current 80/77180/1
authorGilles Thouenon <gilles.thouenon@orange.com>
Fri, 19 Oct 2018 15:27:45 +0000 (17:27 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Mon, 22 Oct 2018 15:07:57 +0000 (17:07 +0200)
- remove internal class which defined ROADM links
- bug correction in calculateSpanlossBase and calculateSpanlossCurrent
methods of OlmPowerServiceImpl class
- adapt olm yang model to return the list of roadm links with their
associated spanloss

Change-Id: I4c9477d873aad17791347a803b0d7f67f202ca0e
JIRA: TRNSPRTPCE-47
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Co-authored-by: Christophe Betoule <christophe.betoule@orange.com>
api/src/main/yang/olm@2017-04-18.yang
olm/src/main/java/org/opendaylight/transportpce/olm/power/PowerMgmt.java
olm/src/main/java/org/opendaylight/transportpce/olm/service/OlmPowerServiceImpl.java
olm/src/main/java/org/opendaylight/transportpce/olm/spanloss/RoadmLinks.java [deleted file]

index 541b429ccc3aca83f9ebce32a3fd493243d10fde..b970eccbc696f48bb212d9cf06d0c4c232e9abae 100644 (file)
@@ -123,6 +123,14 @@ module olm {
          leaf result{
            type string;
          }
+         list spans {
+             leaf link-id {
+                 type ietf-network-topology:link-id;
+             }
+             leaf spanloss {
+                 type string;
+             }
+         }
        }
   }
   rpc calculate-spanloss-current{
index 9ab8ce393f4ae2aae0afe17f0f88a7a78d2f486a..82b11c0b95dfcab73f5f83a5b0731692b9cf37bd 100644 (file)
@@ -372,7 +372,8 @@ public class PowerMgmt {
                 powerRangeMap.put("MinTx", port.getTransponderPort().getPortPowerCapabilityMinTx().getValue()
                         .doubleValue());
             } else {
-                LOG.warn("Port {} of ciruit-pack {} has no power capability values", port.getPortName(), circuitPackName);
+                LOG.warn("Port {} of ciruit-pack {} has no power capability values",
+                    port.getPortName(), circuitPackName);
             }
         }
         return powerRangeMap;
index d06f64042a803f524d9d296155b9a3bd13a96f8e..700409635aac0fb13be7e34b2dbd6917a065b869 100644 (file)
@@ -14,8 +14,12 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Optional;
+import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
@@ -33,7 +37,6 @@ import org.opendaylight.transportpce.common.mapping.PortMapping;
 import org.opendaylight.transportpce.olm.power.PowerMgmt;
 import org.opendaylight.transportpce.olm.util.OlmUtils;
 import org.opendaylight.transportpce.olm.util.OtsPmHolder;
-import org.opendaylight.transportpce.olm.util.RoadmLinks;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.RatioDB;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.Interface;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.InterfaceBuilder;
@@ -55,6 +58,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev150608.network.Node;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev150608.network.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev150608.network.node.SupportingNode;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.LinkId;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.Network1;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.network.Link;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.CalculateSpanlossBaseInput;
@@ -75,6 +79,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev1
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.ServicePowerTurndownInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.ServicePowerTurndownOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.ServicePowerTurndownOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.calculate.spanloss.base.output.Spans;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.calculate.spanloss.base.output.SpansBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.get.pm.output.Measurements;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.portmapping.rev170228.network.nodes.Mapping;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -92,7 +98,7 @@ public class OlmPowerServiceImpl implements OlmPowerService {
     private final PortMapping portMapping;
 
     public OlmPowerServiceImpl(DataBroker dataBroker, PowerMgmt powerMgmt,
-            DeviceTransactionManager deviceTransactionManager, PortMapping portMapping) {
+        DeviceTransactionManager deviceTransactionManager, PortMapping portMapping) {
         this.dataBroker = dataBroker;
         this.powerMgmt = powerMgmt;
         this.portMapping = portMapping;
@@ -107,7 +113,6 @@ public class OlmPowerServiceImpl implements OlmPowerService {
         LOG.info("close ...");
     }
 
-
     @Override
     public GetPmOutput getPm(GetPmInput pmInput) {
         GetPmOutputBuilder pmOutputBuilder = OlmUtils.pmFetch(pmInput, this.deviceTransactionManager);
@@ -129,7 +134,7 @@ public class OlmPowerServiceImpl implements OlmPowerService {
 
     @Override
     public ServicePowerTurndownOutput servicePowerTurndown(
-            ServicePowerTurndownInput powerTurndownInput) {
+        ServicePowerTurndownInput powerTurndownInput) {
 
         ServicePowerTurndownOutputBuilder powerTurnDownOutput = new ServicePowerTurndownOutputBuilder();
         // TODO add flag or return failure instead of string
@@ -152,28 +157,22 @@ public class OlmPowerServiceImpl implements OlmPowerService {
             return new CalculateSpanlossBaseOutputBuilder().setResult(FAILED).build();
         }
 
-        if (! CalculateSpanlossBaseInput.SrcType.All.equals(spanlossBaseInput.getSrcType())) {
+        if (!CalculateSpanlossBaseInput.SrcType.All.equals(spanlossBaseInput.getSrcType())) {
             networkLinks = networkLinks.stream()
-                    .filter(link -> link.getLinkId().equals(spanlossBaseInput.getLinkId()))
-                    .collect(Collectors.toList());
+                .filter(link -> link.getLinkId().equals(spanlossBaseInput.getLinkId()))
+                .collect(Collectors.toList());
         }
 
-        List<RoadmLinks> roadmLinks = new ArrayList<>();
+        List<Link> roadmLinks = new ArrayList<>();
         for (Link link : networkLinks) {
             Link1 roadmLinkAugmentation = link.augmentation(Link1.class);
             if (roadmLinkAugmentation == null) {
                 LOG.debug("Missing OpenRoadm link augmentation in link {} from {} topology.",
-                        link.getLinkId().getValue(), NetworkUtils.OVERLAY_NETWORK_ID);
+                    link.getLinkId().getValue(), NetworkUtils.OVERLAY_NETWORK_ID);
                 continue;
             }
             if (OpenroadmLinkType.ROADMTOROADM.equals(roadmLinkAugmentation.getLinkType())) {
-                // Only calculate spanloss for Roadm-to-Roadm links
-                RoadmLinks roadmLink = new RoadmLinks();
-                roadmLink.setSrcNodeId(link.getSource().getSourceNode().getValue());
-                roadmLink.setSrcTpId(link.getSource().getSourceTp().toString());
-                roadmLink.setDestNodeId(link.getDestination().getDestNode().getValue());
-                roadmLink.setDestTpid(link.getDestination().getDestTp().toString());
-                roadmLinks.add(roadmLink);
+                roadmLinks.add(link);
             }
         }
 
@@ -182,10 +181,19 @@ public class OlmPowerServiceImpl implements OlmPowerService {
             return new CalculateSpanlossBaseOutputBuilder().setResult(FAILED).build();
         }
 
-        boolean spanLossResult = getLinkSpanloss(roadmLinks);
+        Map<LinkId, BigDecimal> spanLossResult = getLinkSpanloss(roadmLinks);
         CalculateSpanlossBaseOutputBuilder spanLossBaseBuilder = new CalculateSpanlossBaseOutputBuilder();
-        if (spanLossResult) {
+
+        if (spanLossResult != null && !spanLossResult.isEmpty()) {
             spanLossBaseBuilder.setResult(SUCCESS);
+            List<Spans> listSpans = new ArrayList<>();
+            Set<Entry<LinkId, BigDecimal>> spanLossResultSet = spanLossResult.entrySet();
+            for (Entry<LinkId, BigDecimal> entry : spanLossResultSet) {
+                Spans span = new SpansBuilder().setLinkId(entry.getKey()).setSpanloss(entry.getValue().toString())
+                    .build();
+                listSpans.add(span);
+            }
+            spanLossBaseBuilder.setSpans(listSpans);
             return spanLossBaseBuilder.build();
         } else {
             LOG.warn("Spanloss calculation failed");
@@ -203,22 +211,17 @@ public class OlmPowerServiceImpl implements OlmPowerService {
             LOG.warn("Failed to get links form {} topology.", NetworkUtils.OVERLAY_NETWORK_ID);
             return null;
         }
-        List<RoadmLinks> roadmLinks = new ArrayList<>();
+        List<Link> roadmLinks = new ArrayList<>();
         for (Link link : networkLinks) {
             Link1 roadmLinkAugmentation = link.augmentation(Link1.class);
             if (roadmLinkAugmentation == null) {
                 LOG.debug("Missing OpenRoadm link augmentation in link {} from {} topology.",
-                        link.getLinkId().getValue(), NetworkUtils.OVERLAY_NETWORK_ID);
+                    link.getLinkId().getValue(), NetworkUtils.OVERLAY_NETWORK_ID);
                 continue;
             }
             if (OpenroadmLinkType.ROADMTOROADM.equals(roadmLinkAugmentation.getLinkType())) {
                 // Only calculate spanloss for Roadm-to-Roadm links
-                RoadmLinks roadmLink = new RoadmLinks();
-                roadmLink.setSrcNodeId(link.getSource().getSourceNode().toString());
-                roadmLink.setSrcTpId(link.getSource().getSourceTp().toString());
-                roadmLink.setDestNodeId(link.getDestination().getDestNode().toString());
-                roadmLink.setDestTpid(link.getDestination().getDestTp().toString());
-                roadmLinks.add(roadmLink);
+                roadmLinks.add(link);
             }
         }
 
@@ -227,9 +230,9 @@ public class OlmPowerServiceImpl implements OlmPowerService {
             return null;
         }
 
-        boolean spanLossResult = getLinkSpanloss(roadmLinks);
+        Map<LinkId, BigDecimal> spanLossResult = getLinkSpanloss(roadmLinks);
         CalculateSpanlossCurrentOutputBuilder spanLossCurrentBuilder = new CalculateSpanlossCurrentOutputBuilder();
-        if (spanLossResult) {
+        if (spanLossResult != null && !spanLossResult.isEmpty()) {
             spanLossCurrentBuilder.setResult(SUCCESS);
             return spanLossCurrentBuilder.build();
         } else {
@@ -249,21 +252,22 @@ public class OlmPowerServiceImpl implements OlmPowerService {
         NetworkKey overlayTopologyKey = new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID));
 
         InstanceIdentifier<Network1> networkIID = InstanceIdentifier.builder(Network.class, overlayTopologyKey)
-                .augmentation(Network1.class)
-                .build();
+            .augmentation(Network1.class)
+            .build();
         Optional<Network1> networkOptional;
         try (ReadOnlyTransaction rtx = this.dataBroker.newReadOnlyTransaction()) {
-            //TODO change to constant from Timeouts class when it will be merged.
+            // TODO change to constant from Timeouts class when it will be
+            // merged.
             networkOptional = rtx.read(LogicalDatastoreType.CONFIGURATION, networkIID).get(Timeouts.DATASTORE_READ,
-                    TimeUnit.MILLISECONDS).toJavaUtil();
+                TimeUnit.MILLISECONDS).toJavaUtil();
         } catch (InterruptedException | ExecutionException | TimeoutException e) {
             LOG.warn("Read of {} topology failed", NetworkUtils.OVERLAY_NETWORK_ID);
             return Collections.emptyList();
         }
 
-        if (! networkOptional.isPresent()) {
+        if (!networkOptional.isPresent()) {
             LOG.warn("Network augmentation with links data is not present in {} topology.",
-                    NetworkUtils.OVERLAY_NETWORK_ID);
+                NetworkUtils.OVERLAY_NETWORK_ID);
             return Collections.emptyList();
         }
 
@@ -276,16 +280,21 @@ public class OlmPowerServiceImpl implements OlmPowerService {
     }
 
     /**
-     * This method retrieves OTS PM from current PM list by nodeId and TPId: Steps:
+     * This method retrieves OTS PM from current PM list by nodeId and TPId:
+     * Steps:
      *
      * <p>
-     * 1. Get OTS interface name from port mapping by TPId 2. Call getPm RPC to get OTS PM
+     * 1. Get OTS interface name from port mapping by TPId 2. Call getPm RPC to
+     * get OTS PM
      *
      * <p>
      *
-     * @param nodeId Node-id of the NE.
-     * @param tpID Termination point Name.
-     * @param pmName PM name which need to be retrieved
+     * @param nodeId
+     *            Node-id of the NE.
+     * @param tpID
+     *            Termination point Name.
+     * @param pmName
+     *            PM name which need to be retrieved
      * @return reference to OtsPmHolder
      */
     private OtsPmHolder getPmMeasurements(String nodeId, String tpID, String pmName) {
@@ -295,10 +304,10 @@ public class OlmPowerServiceImpl implements OlmPowerService {
             return null;
         }
         GetPmInput getPmInput = new GetPmInputBuilder().setNodeId(realNodeId)
-                .setResourceType(ResourceTypeEnum.Interface).setGranularity(PmGranularity._15min)
-                .setResourceIdentifier(
-                        new ResourceIdentifierBuilder().setResourceName(mapping.getSupportingOts()).build())
-                .build();
+            .setResourceType(ResourceTypeEnum.Interface).setGranularity(PmGranularity._15min)
+            .setResourceIdentifier(
+                new ResourceIdentifierBuilder().setResourceName(mapping.getSupportingOts()).build())
+            .build();
         GetPmOutput otsPmOutput = getPm(getPmInput);
 
         if (otsPmOutput == null) {
@@ -309,7 +318,7 @@ public class OlmPowerServiceImpl implements OlmPowerService {
             for (Measurements measurement : otsPmOutput.getMeasurements()) {
                 if (pmName.equals(measurement.getPmparameterName())) {
                     return new OtsPmHolder(pmName, Double.parseDouble(measurement.getPmparameterValue()),
-                            mapping.getSupportingOts());
+                        mapping.getSupportingOts());
                 }
             }
         } catch (NumberFormatException e) {
@@ -327,21 +336,35 @@ public class OlmPowerServiceImpl implements OlmPowerService {
      * <p>
      * 2. Set spanloss
      *
-     * @param nodeId nodeId of NE on which spanloss need to be updated
-     * @param interfaceName OTS interface for NE on which spanloss is cacluated
-     * @param spanLoss calculated spanloss value
-     * @param direction for which spanloss is calculated.It can be either Tx or Rx
+     * @param nodeId
+     *            nodeId of NE on which spanloss need to be updated
+     * @param interfaceName
+     *            OTS interface for NE on which spanloss is cacluated
+     * @param spanLoss
+     *            calculated spanloss value
+     * @param direction
+     *            for which spanloss is calculated.It can be either Tx or Rx
      * @return true/false
      */
     private boolean setSpanLoss(String nodeId, String interfaceName, BigDecimal spanLoss, String direction) {
         String realNodeId = getRealNodeId(nodeId);
-        LOG.info("Setting Spanloss in device for {}, InterfaceName: {}", realNodeId, interfaceName);
+        switch (direction) {
+            case "TX":
+                LOG.info("Setting 'span-loss-transmit' in device:  {}, Interface: {}", realNodeId, interfaceName);
+                break;
+            case "RX":
+                LOG.info("Setting 'span-loss-receive' in device:  {}, Interface: {}", realNodeId, interfaceName);
+                break;
+            default:
+                LOG.error("Impossible to set spanloss in device:  {}, Interface: {}", realNodeId, interfaceName);
+                break;
+        }
         InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
-                .child(Interface.class, new InterfaceKey(interfaceName));
+            .child(Interface.class, new InterfaceKey(interfaceName));
         com.google.common.base.Optional<Interface> interfaceObject;
         try {
             Future<Optional<DeviceTransaction>> deviceTxFuture =
-                    this.deviceTransactionManager.getDeviceTransaction(realNodeId);
+                this.deviceTransactionManager.getDeviceTransaction(realNodeId);
             java.util.Optional<DeviceTransaction> deviceTxOpt = deviceTxFuture.get();
             DeviceTransaction deviceTx;
             if (deviceTxOpt.isPresent()) {
@@ -378,7 +401,7 @@ public class OlmPowerServiceImpl implements OlmPowerService {
                 interfaceBuilder.addAugmentation(Interface1.class, intf1Builder.setOts(otsBuilder.build()).build());
                 deviceTx.put(LogicalDatastoreType.CONFIGURATION, interfacesIID, interfaceBuilder.build());
                 ListenableFuture<Void> submit =
-                        deviceTx.submit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
+                    deviceTx.submit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
                 submit.get();
                 LOG.info("Spanloss Value update completed successfully");
                 return true;
@@ -398,41 +421,43 @@ public class OlmPowerServiceImpl implements OlmPowerService {
      * <p>
      * 2. Set Spanloss value for interface
      *
-     * @param roadmLinks reference to list of RoadmLinks
-     * @return true/false
+     * @param roadmLinks
+     *            reference to list of RoadmLinks
+     * @return map with list of spans with their spanloss value
      */
-    private boolean getLinkSpanloss(List<RoadmLinks> roadmLinks) {
+    private Map<LinkId, BigDecimal> getLinkSpanloss(List<Link> roadmLinks) {
+        Map<LinkId, BigDecimal> map = new HashMap<LinkId, BigDecimal>();
         LOG.info("Executing GetLinkSpanLoss");
         BigDecimal spanLoss = new BigDecimal(0);
-        for (int i = 0; i < roadmLinks.size(); i++) {
-
-            OtsPmHolder srcOtsPmHoler = getPmMeasurements(roadmLinks.get(i).getSrcNodeId(),
-                    roadmLinks.get(i).getSrcTpId(), "OpticalPowerOutput");
-            OtsPmHolder destOtsPmHoler = getPmMeasurements(roadmLinks.get(i).getDestNodeId(),
-                    roadmLinks.get(i).getDestTpid(), "OpticalPowerInput");
+        for (Link link : roadmLinks) {
+            String sourceNodeId = link.getSource().getSourceNode().getValue();
+            String sourceTpId = link.getSource().getSourceTp().toString();
+            String destNodeId = link.getDestination().getDestNode().getValue();
+            String destTpId = link.getDestination().getDestTp().toString();
+            OtsPmHolder srcOtsPmHoler = getPmMeasurements(sourceNodeId, sourceTpId, "OpticalPowerOutput");
+            OtsPmHolder destOtsPmHoler = getPmMeasurements(destNodeId, destTpId, "OpticalPowerInput");
             spanLoss = new BigDecimal(srcOtsPmHoler.getOtsParameterVal() - destOtsPmHoler.getOtsParameterVal())
-                    .setScale(0, RoundingMode.HALF_UP);
+                .setScale(0, RoundingMode.HALF_UP);
             LOG.info("Spanloss Calculated as :" + spanLoss + "=" + srcOtsPmHoler.getOtsParameterVal() + "-"
-                    + destOtsPmHoler.getOtsParameterVal());
+                + destOtsPmHoler.getOtsParameterVal());
             if ((spanLoss.doubleValue() < 28) && (spanLoss.doubleValue() > 0)) {
-                if (!setSpanLoss(roadmLinks.get(i).getSrcNodeId(), srcOtsPmHoler.getOtsInterfaceName(), spanLoss,
-                        "TX")) {
-                    LOG.info("Setting spanLoss failed for " + roadmLinks.get(i).getSrcNodeId());
-                    return false;
+                if (!setSpanLoss(sourceNodeId, srcOtsPmHoler.getOtsInterfaceName(), spanLoss, "TX")) {
+                    LOG.info("Setting spanLoss failed for " + sourceNodeId);
+                    return null;
                 }
-                if (!setSpanLoss(roadmLinks.get(i).getDestNodeId(), destOtsPmHoler.getOtsInterfaceName(), spanLoss,
-                        "RX")) {
-                    LOG.info("Setting spanLoss failed for " + roadmLinks.get(i).getDestNodeId());
-                    return false;
+                if (!setSpanLoss(destNodeId, destOtsPmHoler.getOtsInterfaceName(), spanLoss, "RX")) {
+                    LOG.info("Setting spanLoss failed for " + destNodeId);
+                    return null;
                 }
+                map.put(link.getLinkId(), spanLoss);
             }
         }
-        return true;
+        return map;
     }
 
     private String getRealNodeId(String mappedNodeId) {
         KeyedInstanceIdentifier<Node, NodeKey> mappedNodeII =
-                InstanceIdentifiers.OVERLAY_NETWORK_II.child(Node.class, new NodeKey(new NodeId(mappedNodeId)));
+            InstanceIdentifiers.OVERLAY_NETWORK_II.child(Node.class, new NodeKey(new NodeId(mappedNodeId)));
         com.google.common.base.Optional<Node> realNode;
         try (ReadOnlyTransaction readOnlyTransaction = this.dataBroker.newReadOnlyTransaction()) {
             realNode = readOnlyTransaction.read(LogicalDatastoreType.CONFIGURATION, mappedNodeII).get();
@@ -442,16 +467,16 @@ public class OlmPowerServiceImpl implements OlmPowerService {
         }
         if (!realNode.isPresent() || (realNode.get().getSupportingNode() == null)) {
             throw new IllegalArgumentException(
-                    String.format("Could not find node %s, or supporting node is not present", mappedNodeId));
+                String.format("Could not find node %s, or supporting node is not present", mappedNodeId));
         }
         List<SupportingNode> collect = realNode.get().getSupportingNode().stream()
-                .filter(node -> (node.getNetworkRef() != null)
-                        && NetworkUtils.UNDERLAY_NETWORK_ID.equals(node.getNetworkRef().getValue())
-                        && (node.getNodeRef() != null) && !Strings.isNullOrEmpty(node.getNodeRef().getValue()))
-                .collect(Collectors.toList());
+            .filter(node -> (node.getNetworkRef() != null)
+                && NetworkUtils.UNDERLAY_NETWORK_ID.equals(node.getNetworkRef().getValue())
+                && (node.getNodeRef() != null) && !Strings.isNullOrEmpty(node.getNodeRef().getValue()))
+            .collect(Collectors.toList());
         if (collect.isEmpty() || (collect.size() > 1)) {
             throw new IllegalArgumentException(String.format("Invalid support node count [%d] was found for node %s",
-                    collect.size(), mappedNodeId));
+                collect.size(), mappedNodeId));
         }
         return collect.iterator().next().getNodeRef().getValue();
     }
diff --git a/olm/src/main/java/org/opendaylight/transportpce/olm/spanloss/RoadmLinks.java b/olm/src/main/java/org/opendaylight/transportpce/olm/spanloss/RoadmLinks.java
deleted file mode 100644 (file)
index d3e0414..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright © 2017 AT&T and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * 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.olm.spanloss;
-/**
- * The Class RoadmLinks.
- */
-public class RoadmLinks {
-
-    /** The src node id. */
-    private String srcNodeId;
-
-    /** The src tp id. */
-    private String srcTpId;
-
-    /** The dest node id. */
-    private String destNodeId;
-
-    /** The dest tpid. */
-    private String destTpid;
-
-    /**
-     * Gets the src node id.
-     *
-     * @return the src node id
-     */
-    public String getSrcNodeId() {
-        return srcNodeId;
-    }
-
-    /**
-     * Sets the src node id.
-     *
-     * @param srcNodeId the new src node id
-     */
-    public void setSrcNodeId(String srcNodeId) {
-        this.srcNodeId = srcNodeId;
-    }
-
-    /**
-     * Gets the src tp id.
-     *
-     * @return the src tp id
-     */
-    public String getSrcTpId() {
-        return srcTpId;
-    }
-
-    /**
-     * Sets the src tp id.
-     *
-     * @param srcTpId the new src tp id
-     */
-    public void setSrcTpId(String srcTpId) {
-        this.srcTpId = srcTpId;
-    }
-
-    /**
-     * Gets the dest node id.
-     *
-     * @return the dest node id
-     */
-    public String getDestNodeId() {
-        return destNodeId;
-    }
-
-    /**
-     * Sets the dest node id.
-     *
-     * @param destNodeId the new dest node id
-     */
-    public void setDestNodeId(String destNodeId) {
-        this.destNodeId = destNodeId;
-    }
-
-    /**
-     * Gets the dest tpid.
-     *
-     * @return the dest tpid
-     */
-    public String getDestTpid() {
-        return destTpid;
-    }
-
-    /**
-     * Sets the dest tpid.
-     *
-     * @param destTpid the new dest tpid
-     */
-    public void setDestTpid(String destTpid) {
-        this.destTpid = destTpid;
-    }
-
-}