fix some sonar issues 34/83534/4
authorguillaume.lambert <guillaume.lambert@orange.com>
Mon, 12 Aug 2019 09:20:01 +0000 (11:20 +0200)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Tue, 13 Aug 2019 08:46:42 +0000 (08:46 +0000)
identified with the following tags
- clumsy
- convention
- cwe
- misra
- unused

Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: Ie1c448e81bbf3439655fa6260bc2052350ed9aeb

25 files changed:
common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion121.java
common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion221.java
networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/NetConfTopologyListener.java
networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/listeners/LldpListener.java
networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelServiceImpl.java
networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/TopologyUtils.java
olm/src/main/java/org/opendaylight/transportpce/olm/power/PowerMgmtImpl.java
pce/src/main/java/org/opendaylight/transportpce/pce/PcePathDescription.java
pce/src/main/java/org/opendaylight/transportpce/pce/PceSendingPceRPCs.java
pce/src/main/java/org/opendaylight/transportpce/pce/constraints/PceConstraintsCalc.java
pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/ExtractTopoDataStoreImpl.java
pce/src/main/java/org/opendaylight/transportpce/pce/graph/InAlgoPathValidator.java
pce/src/main/java/org/opendaylight/transportpce/pce/graph/PceGraph.java
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceCalculation.java
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceNode.java
pce/src/main/java/org/opendaylight/transportpce/pce/service/PathComputationServiceImpl.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface221.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/service/ServiceDataStoreOperationsImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/stub/StubPceServiceOperations.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/stub/StubRendererServiceOperations.java

index c9ec9779aac1e41b63a2904a9f2312572124f9ec..6eda98e65406727f4a66aaa5e7e3bcf2a242cbb4 100644 (file)
@@ -189,7 +189,8 @@ public class PortMappingVersion121 {
         int client = 1;
         if (!deviceObject.isPresent() || deviceObject.get().getCircuitPacks() == null) {
             LOG.warn("Circuit Packs are not present for {}", nodeId);
-            return false; // TODO return false or continue?
+            return false;
+            // TODO return false or continue?
         }
         Map<String, String> lcpMap = new HashMap<>();
         Map<String, Mapping> mappingMap = new HashMap<>();
@@ -342,7 +343,8 @@ public class PortMappingVersion121 {
         return cpPerSrg;
     }
 
-    @SuppressWarnings("checkstyle:linelength")  //last LOG info message in this method is too long
+    //last LOG info message in this method is too long
+    @SuppressWarnings("checkstyle:linelength")
     private boolean createPpPortMapping(String nodeId, Info deviceInfo, List<Mapping> portMapList) {
         // Creating mapping data for SRG's PP
         HashMap<Integer, List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.srg.CircuitPacks>> srgCps
@@ -670,7 +672,8 @@ public class PortMappingVersion121 {
         return mpBldr.build();
     }
 
-    @SuppressWarnings("checkstyle:linelength")  // some LOG messages are too long
+    // some LOG messages are too long
+    @SuppressWarnings("checkstyle:linelength")
     private boolean createTtpPortMapping(String nodeId, Info deviceInfo, List<Mapping> portMapList) {
         // Creating mapping data for degree TTP's
         List<Degree> degrees = getDegrees(nodeId, deviceInfo);
index aecbe926d40887118c4463a7bf1bf7d86022737d..cb3ca129bcf3c67654dd4fa8fb17d4e69204866c 100644 (file)
@@ -186,7 +186,8 @@ public class PortMappingVersion221 {
         int client = 1;
         if (!deviceObject.isPresent() || deviceObject.get().getCircuitPacks() == null) {
             LOG.warn("Circuit Packs are not present for {}", nodeId);
-            return false; // TODO return false or continue?
+            return false;
+            // TODO return false or continue?
         }
         Map<String, String> lcpMap = new HashMap<>();
         Map<String, Mapping> mappingMap = new HashMap<>();
@@ -339,7 +340,8 @@ public class PortMappingVersion221 {
         return cpPerSrg;
     }
 
-    @SuppressWarnings("checkstyle:linelength")  //last LOG info message in this method is too long
+    //last LOG info message in this method is too long
+    @SuppressWarnings("checkstyle:linelength")
     private boolean createPpPortMapping(String nodeId, Info deviceInfo, List<Mapping> portMapList) {
         // Creating mapping data for SRG's PP
         HashMap<Integer, List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.srg.CircuitPacks>> srgCps
@@ -665,7 +667,8 @@ public class PortMappingVersion221 {
         return mpBldr.build();
     }
 
-    @SuppressWarnings("checkstyle:linelength")  //some LOG messages are too long
+    //some LOG messages are too long
+    @SuppressWarnings("checkstyle:linelength")
     private boolean createTtpPortMapping(String nodeId, Info deviceInfo, List<Mapping> portMapList) {
         // Creating mapping data for degree TTP's
         List<Degree> degrees = getDegrees(nodeId, deviceInfo);
index 4d6579ae42220768266012866c0416242b288d13..4740bff236a858f949e758574145d0f901668dbb 100644 (file)
@@ -24,10 +24,8 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.controller.md.sal.binding.api.MountPoint;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.transportpce.common.StringConstants;
-import org.opendaylight.transportpce.common.Timeouts;
 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
 import org.opendaylight.transportpce.networkmodel.dto.NodeRegistration;
 import org.opendaylight.transportpce.networkmodel.dto.NodeRegistration22;
@@ -47,14 +45,11 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev161014.OrgOpenroad
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.NotificationsService;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.Netconf;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.Streams;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapability;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -63,7 +58,6 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
     private static final Logger LOG = LoggerFactory.getLogger(NetConfTopologyListener.class);
 
     private final NetworkModelService networkModelService;
-    //private final R2RLinkDiscovery linkDiscovery;
     private final DataBroker dataBroker;
     private final DeviceTransactionManager deviceTransactionManager;
     private final Map<String, NodeRegistration> registrations;
@@ -72,7 +66,6 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
     public NetConfTopologyListener(final NetworkModelService networkModelService, final DataBroker dataBroker,
              DeviceTransactionManager deviceTransactionManager) {
         this.networkModelService = networkModelService;
-        //this.linkDiscovery = linkDiscovery;
         this.dataBroker = dataBroker;
         this.deviceTransactionManager = deviceTransactionManager;
         this.registrations = new ConcurrentHashMap<>();
@@ -117,17 +110,12 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
             final ListenerRegistration<OrgOpenroadmDeviceListener> accessDeviceNotificationListenerRegistration =
                 notificationService.get().registerNotificationListener(deviceListener);
 
-//            final OrgOpenroadmLldpListener lldpListener = new LldpListener(this.linkDiscovery, nodeId);
-//            LOG.info("Registering notification listener on OrgOpenroadmLldpListener for node: {}", nodeId);
-//            final ListenerRegistration<OrgOpenroadmLldpListener> accessLldpNotificationListenerRegistration =
-//                notificationService.get().registerNotificationListener(lldpListener);
-
             TcaListener tcaListener = new TcaListener();
             LOG.info("Registering notification listener on OrgOpenroadmTcaListener for node: {}", nodeId);
             final ListenerRegistration<OrgOpenroadmTcaListener> accessTcaNotificationListenerRegistration =
                 notificationService.get().registerNotificationListener(tcaListener);
 
-            String streamName = "NETCONF"; //getSupportedStream(nodeId);
+            String streamName = "NETCONF";
 
             if (streamName == null) {
                 streamName = "OPENROADM";
@@ -177,13 +165,6 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
                 .OrgOpenroadmDeviceListener> accessDeviceNotificationListenerRegistration =
                 notificationService.get().registerNotificationListener(deviceListener);
 
-//            final org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev181019.OrgOpenroadmLldpListener
-//                lldpListener = new LldpListener221(linkDiscovery, nodeId);
-//            LOG.info("Registering notification listener on OrgOpenroadmLldpListener for node: {}", nodeId);
-//            final ListenerRegistration<org.opendaylight.yang.gen.v1.http.org.openroadm
-//                .lldp.rev181019.OrgOpenroadmLldpListener> accessLldpNotificationListenerRegistration =
-//                notificationService.get().registerNotificationListener(lldpListener);
-
             final org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev181019.OrgOpenroadmTcaListener
                 tcaListener = new TcaListener221();
             LOG.info("Registering notification listener on OrgOpenroadmTcaListener for node: {}", nodeId);
@@ -193,7 +174,6 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
 
 
             String streamName = "NETCONF";
-            //getSupportedStream(nodeId);
             if (streamName == null) {
                 streamName = "OPENROADM";
             }
@@ -229,7 +209,6 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
             nodeRegistration.getAccessAlarmNotificationListenerRegistration().close();
             nodeRegistration.getAccessDeOperationasNotificationListenerRegistration().close();
             nodeRegistration.getAccessDeviceNotificationListenerRegistration().close();
-//            nodeRegistration.getAccessLldpNotificationListenerRegistration().close();
             nodeRegistration.getAccessTcaNotificationListenerRegistration().close();
         }
     }
@@ -303,7 +282,7 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
     }
 
 
-    private String getSupportedStream(String nodeId) {
+    /*private String getSupportedStream(String nodeId) {
         InstanceIdentifier<Streams> streamsIID = InstanceIdentifier.create(Netconf.class).child(Streams.class);
         try {
             Optional<Streams> ordmInfoObject =
@@ -325,5 +304,5 @@ public class NetConfTopologyListener implements DataTreeChangeListener<Node> {
             LOG.error("NullPointerException thrown while getting Info from a non Open ROADM device {}", nodeId);
             return "NETCONF";
         }
-    }
+    }*/
 }
index 90d8d80dbff3a56fdcdc78d76fc5f32be1d1a829..726389ebbca0a27f90ab0aac3188f3937f7c16c5 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.transportpce.networkmodel.listeners;
 
 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.LldpNbrInfoChange;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.OrgOpenroadmLldpListener;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.types.rev161014.ResourceNotificationType;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -18,7 +17,6 @@ import org.slf4j.LoggerFactory;
 public class LldpListener implements OrgOpenroadmLldpListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(LldpListener.class);
-    //private final R2RLinkDiscovery linkDiscovery;
     private final NodeId nodeId;
 
     public LldpListener(final String nodeId) {
@@ -32,14 +30,5 @@ public class LldpListener implements OrgOpenroadmLldpListener {
     @Override
     public void onLldpNbrInfoChange(LldpNbrInfoChange notification) {
         LOG.info("Notification {} received {}", LldpNbrInfoChange.QNAME, notification);
-        if (notification.getNotificationType().equals(ResourceNotificationType.ResourceCreation)) {
-            /*linkDiscovery.createR2RLink(nodeId,notification.getResource(),
-                                                notification.getNbrInfo().getRemoteSysName(),
-                                                notification.getNbrInfo().getRemotePortId());*/
-        } else if (notification.getNotificationType().equals(ResourceNotificationType.ResourceDeletion)) {
-            /*linkDiscovery.deleteR2RLink(nodeId,notification.getResource(),
-                                                notification.getNbrInfo().getRemoteSysName(),
-                                                notification.getNbrInfo().getRemotePortId());*/
-        }
     }
 }
index 445a5f35c50e80df9e043226226620790ac8d329..984005862d9a5a449a34ca45fdda319eff605f58 100644 (file)
@@ -45,7 +45,6 @@ public class NetworkModelServiceImpl implements NetworkModelService {
     private static final boolean CREATE_MISSING_PARENTS = true;
 
     private NetworkTransactionService networkTransactionService;
-    //private final R2RLinkDiscoveryFactoryMethod linkDiscovery;
     private final R2RLinkDiscovery linkDiscovery;
     private final DeviceTransactionManager deviceTransactionManager;
     private final OpenRoadmFactory openRoadmFactory;
@@ -134,7 +133,6 @@ public class NetworkModelServiceImpl implements NetworkModelService {
                     openRoadmTopologyLink, CREATE_MISSING_PARENTS);
             }
             networkTransactionService.submit().get();
-            //linkDiscovery.readLLDP(nodeId);
             LOG.info("all nodes and links created");
         } catch (InterruptedException | ExecutionException e) {
             LOG.error("ERROR: ", e);
index cf59315c38303e76a53cace547e7d7faeb072295..ce80652b6faafe9a4d73b76fbb11379b21262040 100644 (file)
@@ -94,7 +94,6 @@ public  final class TopologyUtils {
             if (link.isPresent()) {
                 LinkBuilder linkBuilder = new LinkBuilder(link.get());
                 Link1Builder link1Builder = new Link1Builder(linkBuilder.augmentation(Link1.class));
-//                link1Builder.setAdministrativeState(State.OutOfService);
                 linkBuilder.removeAugmentation(Link1.class);
                 linkBuilder.addAugmentation(Link1.class,link1Builder.build());
                 networkTransactionService.merge(LogicalDatastoreType.CONFIGURATION, linkIID.build(),
index 079a6918655745bac3620eba7c12c79ba77944f1..0f6c81106792f71c98ef6f0c6545d19e7e8b4456 100644 (file)
@@ -344,7 +344,7 @@ public class PowerMgmtImpl implements PowerMgmt {
         return true;
     }
 
-    /**
+    /*
      * This method does an edit-config on roadm connection subtree for a given
      * connection number in order to set power level for use by the optical
      * power control.
@@ -361,7 +361,7 @@ public class PowerMgmtImpl implements PowerMgmt {
      *            WaveLength number part of request
      * @return true/false based on status of operation.
      */
-    private boolean setTransponderPowerTx(Nodes inputNode, String destTpId, String srgId,
+    /*private boolean setTransponderPowerTx(Nodes inputNode, String destTpId, String srgId,
                                           String nextNodeId, Long waveLength) {
         Map<String, Double> txPowerRangeMap = null;
         Map<String, Double> rxSRGPowerRangeMap = null;
@@ -455,7 +455,7 @@ public class PowerMgmtImpl implements PowerMgmt {
             LOG.info("Mapping object not found for nodeId: {}", nodeId);
             return false;
         }
-    }
+    }*/
 
     /**
      * This method retrieves transponder OCH interface and
@@ -512,7 +512,7 @@ public class PowerMgmtImpl implements PowerMgmt {
         }
     }
 
-    /**
+    /*
      * This method retrieves transponder OCH interface and
      * sets power.
      *
@@ -526,7 +526,7 @@ public class PowerMgmtImpl implements PowerMgmt {
      *            Wavelength Number    *
      * @return true/false based on status of operation
      */
-    private boolean callSetRoadmPowerTx(String nodeId, String interfaceName,
+    /*private boolean callSetRoadmPowerTx(String nodeId, String interfaceName,
                                         OpenroadmVersion openroadmVersion,
                                         Long wavelength, String connectionNumber) {
         if (interfaceName == null) {
@@ -594,6 +594,6 @@ public class PowerMgmtImpl implements PowerMgmt {
             return false;
         }
         return false;
-    }
+    }*/
 
 }
index 287e74ecc3fa04f3d1aa1738e049607e671ba370..842529a5251fbccb31e68cd8a34d8f921ff64044 100644 (file)
@@ -130,7 +130,6 @@ public class PcePathDescription {
 
             // Resource
             AToZKey srcTPKey = new AToZKey(index.toString());
-            // tpName);
             Resource tpResource1 = new ResourceBuilder().setResource(stp).build();
             AToZ stpResource = new AToZBuilder().setId(tpName).withKey(srcTPKey).setResource(tpResource1).build();
             index++;
index 96161a249984770b75c5cb17851d4b8dd24e89da..bf60b4d026d9e9356c234908ff7e91944a9eb68b 100755 (executable)
@@ -249,11 +249,11 @@ public class PceSendingPceRPCs {
         return rc.getResponseCode();
     }
 
-    public GnpyResult getGnpy_AtoZ() {
+    public GnpyResult getGnpyAtoZ() {
         return gnpyAtoZ;
     }
 
-    public GnpyResult getGnpy_ZtoA() {
+    public GnpyResult getGnpyZtoA() {
         return gnpyZtoA;
     }
 }
index 1b8372ef683b08b457205ae25cd2d4ff47d33e6f..b3f7a17f21e2a14f7b1236f15832c5b73de63af2 100644 (file)
@@ -331,8 +331,6 @@ public class PceConstraintsCalc {
                     result = Optional.of(path);
                 }
             }
-//            return pathDescReadTx.read(LogicalDatastoreType.CONFIGURATION, pathDescriptionIID)
-//                    .get(Timeouts.DATASTORE_READ, TimeUnit.MILLISECONDS);
         } catch (InterruptedException | ExecutionException | TimeoutException e) {
             LOG.warn(
                 "PCE diversity constraints: Exception while getting path description from datastore {} for service {}!",
index 09c8511b217753b9dac80b9672827e9d8a3c48ea..645911402265b123c28d1016ec2bb96091969756 100644 (file)
@@ -295,7 +295,7 @@ public class ExtractTopoDataStoreImpl {
                                                     destId = element1.getUid();
                                                     destIp = null;
                                                     // Create a new link
-                                                    if (srcId != destId) {
+                                                    if (!destId.equals(srcId)) {
                                                         Connections connection = createNewConnection(srcId, srcIp,
                                                                 destId, destIp);
                                                         topoConnections.add(connection);
@@ -339,7 +339,7 @@ public class ExtractTopoDataStoreImpl {
                                         // Create a new link
                                         destId = element1.getUid();
                                         destIp = null;
-                                        if (srcId != destId) {
+                                        if (!destId.equals(srcId)) {
                                             Connections connection = createNewConnection(srcId, srcIp, destId, destIp);
                                             topoConnections.add(connection);
                                             srcId = destId;
@@ -359,7 +359,7 @@ public class ExtractTopoDataStoreImpl {
                                         // Create a new link
                                         destId = element1.getUid();
                                         destIp = null;
-                                        if (srcId != destId) {
+                                        if (!destId.equals(srcId)) {
                                             Connections connection = createNewConnection(srcId, srcIp, destId, destIp);
                                             topoConnections.add(connection);
                                             srcId = destId;
@@ -423,7 +423,7 @@ public class ExtractTopoDataStoreImpl {
                     IpAddress ipAddress = mapNodeRefIp.get(nodeRef);
                     for (Elements element : elements) {
                         if (element.getUid().contains(ipAddress.getIpv4Address().getValue().toString())) {
-                            if ((ipAddressCurrent == null) || (ipAddressCurrent != ipAddress)) {
+                            if ((ipAddressCurrent == null) || (!ipAddress.equals(ipAddressCurrent))) {
                                 ipAddressCurrent = ipAddress;
                                 // Fill in routeObjectIncludeExcludes
                                 RouteObjectIncludeExclude routeObjectIncludeExclude1 = addRouteObjectIncludeExclude(
@@ -510,7 +510,7 @@ public class ExtractTopoDataStoreImpl {
                     IpAddress ipAddress = mapNodeRefIp.get(nodeRef);
                     for (Elements element : elements) {
                         if (element.getUid().contains(ipAddress.getIpv4Address().getValue().toString())) {
-                            if ((ipAddressCurrent == null) || (ipAddressCurrent != ipAddress)) {
+                            if ((ipAddressCurrent == null) || (!ipAddress.equals(ipAddressCurrent))) {
                                 ipAddressCurrent = ipAddress;
                                 // Fill in routeObjectIncludeExcludes
                                 RouteObjectIncludeExclude routeObjectIncludeExclude1 = addRouteObjectIncludeExclude(
index 2ce1f62a46c241118ed7679daebc58c08c65ea83..768fb41f84c370bb0893663a0522083338bb76b4 100644 (file)
@@ -42,17 +42,13 @@ public class InAlgoPathValidator implements PathValidator<String, PceGraphEdge>
         LOG.debug("InAlgoPathValidator: partialPath size: {} prev edge {} new edge {}",
             size, edge.link().getlinkType(), partialPath.getEdgeList().get(size - 1).link().getlinkType());
 
-        if (!checkTurn(partialPath.getEdgeList().get(size - 1).link().getlinkType(), edge.link().getlinkType())) {
-            return false;
-        }
-        if (!checkLimits(partialPath, edge, pceHardConstraints)) {
-            return false;
-        }
-        if (!checkInclude(partialPath, edge, zendNode, pceHardConstraints)) {
+        if ((!checkTurn(partialPath.getEdgeList().get(size - 1).link().getlinkType(), edge.link().getlinkType()))
+            || (!checkLimits(partialPath, edge, pceHardConstraints))
+            || (!checkInclude(partialPath, edge, zendNode, pceHardConstraints))) {
             return false;
+        } else {
+            return true;
         }
-
-        return true;
     }
 
     private boolean checkTurn(OpenroadmLinkType prevType, OpenroadmLinkType nextType) {
@@ -149,7 +145,8 @@ public class InAlgoPathValidator implements PathValidator<String, PceGraphEdge>
         listOfElementsCLLI.addAll(listOfElementsBuild(pathEdges, PceConstraints.ResourceType.CLLI));
 
         List<String> listOfElementsSRLG = new ArrayList<String>();
-        listOfElementsSRLG.add("NONE"); // first link is XPONDEROUTPUT, no SRLG for it
+        // first link is XPONDEROUTPUT, no SRLG for it
+        listOfElementsSRLG.add("NONE");
         listOfElementsSRLG.addAll(listOfElementsBuild(pathEdges, PceConstraints.ResourceType.SRLG));
 
         // validation: check each type for each element
@@ -220,7 +217,7 @@ public class InAlgoPathValidator implements PathValidator<String, PceGraphEdge>
                             continue;
                         }
                     }
-                    if (found == false) {
+                    if (!found) {
                         // there is no specific srlg to include. thus add to list just the first one
                         listOfElements.add("NONE");
                     }
index 0aeadeb292ec63ddc91e97a5e21b46b24e0886ae..711cbcebe2d165e0d468a7b20fb1a4b3f7bd494c 100644 (file)
@@ -34,8 +34,10 @@ public class PceGraph {
     private static final Logger LOG = LoggerFactory.getLogger(PceGraph.class);
 
     ////////////////////////// for Graph ///////////////////////////
-    int kpathsToBring = 10; // how many paths to bring
-    int mhopsPerPath = 50; // max #hops
+    // how many paths to bring
+    int kpathsToBring = 10;
+    // max #hops
+    int mhopsPerPath = 50;
 
     // input
     private Map<NodeId, PceNode> allPceNodes = new HashMap<NodeId, PceNode>();
@@ -67,8 +69,6 @@ public class PceGraph {
         LOG.info("In GraphCalculator: A and Z = {} / {} ", aendNode.toString(), zendNode.toString());
         LOG.debug("In GraphCalculator: allPceNodes size {}, nodes {} ", allPceNodes.size(), allPceNodes.toString());
 
-        // PceCalculation.printNodesInfo(allPceNodes);
-
     }
 
     public boolean calcPath() {
index 7ce9b80d11f253c60b0990cf8c868c5d7a262be1..692d49a4478682ef6b28f982846135481dfc7c8f 100644 (file)
@@ -52,7 +52,6 @@ public class PceCalculation {
     private String znodeId = "";
 
     private PceConstraints pceHardConstraints;
-//    private PceConstraints pceSoftConstraints;
 
     ///////////// Intermediate data/////////////////
     private List<PceLink> addLinks = new ArrayList<PceLink>();
@@ -84,7 +83,6 @@ public class PceCalculation {
         this.returnStructure = rc;
 
         this.pceHardConstraints = pceHardConstraints;
-//        this.pceSoftConstraints = pceSoftConstraints;
         parseInput();
     }
 
@@ -105,7 +103,6 @@ public class PceCalculation {
         }
 
         printNodesInfo(allPceNodes);
-        // printLinksInfo(allPceLinks);
 
         returnStructure.setRC(ResponseCodes.RESPONSE_OK);
         return;
@@ -312,7 +309,8 @@ public class PceCalculation {
                 LOG.debug("validateLink: DROP-LINK saved  {}", pcelink.toString());
                 break;
             case XPONDERINPUT :
-                azSrgs.add(sourceId); // store separately all SRG links directly
+                // store separately all SRG links directly
+                azSrgs.add(sourceId);
                 // connected to A/Z
                 if (!dest.checkTP(pcelink.getDestTP().toString())) {
                     LOG.debug("validateLink: XPONDER-INPUT is rejected as NW port is busy - {} ", pcelink.toString());
@@ -323,8 +321,10 @@ public class PceCalculation {
                 source.addOutgoingLink(pcelink);
                 LOG.debug("validateLink: XPONDER-INPUT link added to allPceLinks {}", pcelink.toString());
                 break;
-            case XPONDEROUTPUT : // does it mean XPONDER==>>SRG ?
-                azSrgs.add(destId); // store separately all SRG links directly
+            // does it mean XPONDER==>>SRG ?
+            case XPONDEROUTPUT :
+                // store separately all SRG links directly
+                azSrgs.add(destId);
                 // connected to A/Z
                 if (!source.checkTP(pcelink.getSourceTP().toString())) {
                     LOG.debug("validateLink: XPONDER-OUTPUT is rejected as NW port is busy - {} ", pcelink.toString());
@@ -370,15 +370,11 @@ public class PceCalculation {
                 break;
         }
 
-        if (pceNode.getSupNodeIdPceNode().equals(anodeId)) {
-            if (endPceNode(nodeType,pceNode.getNodeId(), pceNode)) {
-                this.aendPceNode = pceNode;
-            }
+        if ((pceNode.getSupNodeIdPceNode().equals(anodeId)) && (endPceNode(nodeType,pceNode.getNodeId(), pceNode))) {
+            this.aendPceNode = pceNode;
         }
-        if (pceNode.getSupNodeIdPceNode().equals(znodeId)) {
-            if (endPceNode(nodeType,pceNode.getNodeId(), pceNode)) {
-                this.zendPceNode = pceNode;
-            }
+        if ((pceNode.getSupNodeIdPceNode().equals(znodeId)) && (endPceNode(nodeType,pceNode.getNodeId(), pceNode))) {
+            this.zendPceNode = pceNode;
         }
 
         allPceNodes.put(pceNode.getNodeId(), pceNode);
@@ -482,11 +478,11 @@ public class PceCalculation {
         }
     }
 
-    private static void printLinksInfo(Map<LinkId, PceLink> allpcelinks) {
+    /*private static void printLinksInfo(Map<LinkId, PceLink> allpcelinks) {
         Iterator<Map.Entry<LinkId, PceLink>> links = allpcelinks.entrySet().iterator();
         while (links.hasNext()) {
             LOG.info("In printLinksInfo link {} : ", links.next().getValue().toString());
         }
-    }
+    }*/
 
 }
index 72adcb7f94274a87faac613887f38afeda190bdf..3dc56b225c2172ea2ba9ad4e913d32bb4c309a3c 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.transportpce.pce.networkanalyzer;
 
 import java.util.List;
 
-import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.transportpce.pce.constraints.PceConstraints;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.Link1;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.networks.network.link.oms.attributes.Span;
@@ -91,7 +90,7 @@ public class PceLink {
         LOG.debug("PceLink: created PceLink  {}", toString());
     }
 
-    private OpenroadmLinkType calcType(Link link) {
+    /*private OpenroadmLinkType calcType(Link link) {
         org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.@Nullable Link1 link1 = null;
         OpenroadmLinkType tmplinkType = null;
 
@@ -111,7 +110,7 @@ public class PceLink {
             return null;
         }
         return tmplinkType;
-    }
+    }*/
 
     private LinkId calcOpposite(Link link) {
         // opposite link
@@ -142,7 +141,7 @@ public class PceLink {
         // sum of 1 over the span OSNRs (linear units)
         double sum = 0;
         // link OSNR, in dB
-        double linkOsnrDb;
+        //double linkOsnrDb;
         // link OSNR, in dB
         double linkOsnrLu;
         // span OSNR, in dB
@@ -150,7 +149,7 @@ public class PceLink {
         // span OSNR, in linear units
         double spanOsnrLu;
         // default amplifier noise value, in dB
-        double ampNoise = 5.5;
+        //double ampNoise = 5.5;
         // fiber span measured loss, in dB
         double loss;
         // launch power, in dB
@@ -213,7 +212,6 @@ public class PceLink {
         spanOsnrLu = Math.pow(10, (spanOsnrDb / 10.0));
         sum = PceConstraints.CONST_OSNR / spanOsnrLu;
         linkOsnrLu = sum;
-        //link_osnr_dB = 10 * Math.log10(1 / sum);
         LOG.debug("In retrieveosnr: link osnr is {} dB", linkOsnrLu);
         return linkOsnrLu;
     }
index 2fcc5df57a014750d42dc0816f2a13cbe031d2d3..326a33e4fce11481a53844f7a86dd32ddc5a02af 100644 (file)
@@ -126,26 +126,6 @@ public class PceNode {
         return;
     }
 
-
-
-/*    public PceNode(Node node, OpenroadmNodeType nodeType, NodeId nodeId,
-            String supNodeId, String clli) {
-        this.node = node;
-        this.nodeId = nodeId;
-        this.nodeType = nodeType;
-        this.supNodeId = supNodeId;
-        this.clli = clli;
-
-        if ((node == null) || (nodeId == null) || (nodeType == null)
-                || (supNodeId == null) || (clli == null)) {
-            LOG.error(
-                    "PceNode: one of parameters is not populated : nodeId, node type, supporting nodeId");
-            valid = false;
-        }
-
-        LOG.debug(" PceNode built :{}", this.toString());
-    }
-*/
     public void initWLlist() {
         this.availableWLindex.clear();
         if (!isValid()) {
@@ -270,7 +250,8 @@ public class PceNode {
         if (!this.availableSrgPp.isEmpty()) {
             Optional<String> client = null;
             final OpenroadmTpType openType = srgType;
-            client = this.availableSrgPp.entrySet().stream().filter(pp -> pp.getValue().getName() == openType.getName())
+            client = this.availableSrgPp.entrySet()
+                    .stream().filter(pp -> pp.getValue().getName().equals(openType.getName()))
                     .map(Map.Entry::getKey)
                     .sorted(new SortPortsByName())
                     .findFirst();
index 48a19ef4674b76677c703c08610e9d7c36506d7d..66765d289842c70828da88b7c98567677a4d134b 100644 (file)
@@ -187,8 +187,8 @@ public class PathComputationServiceImpl implements PathComputationService {
                         .setResponseParameters(rpb.build());
 
               //add the GNPy result
-                GnpyResult gnpyAtoZ = sendingPCE.getGnpy_AtoZ();
-                GnpyResult gnpyZtoA = sendingPCE.getGnpy_ZtoA();
+                GnpyResult gnpyAtoZ = sendingPCE.getGnpyAtoZ();
+                GnpyResult gnpyZtoA = sendingPCE.getGnpyZtoA();
                 List<GnpyResponse> listResponse = new ArrayList<>();
                 if (gnpyAtoZ != null) {
                     GnpyResponse respAtoZ = generateGnpyResponse(gnpyAtoZ.getResponse(),"A-to-Z");
@@ -258,4 +258,4 @@ public class PathComputationServiceImpl implements PathComputationService {
         return gnpypResp;
     }
 
-}
\ No newline at end of file
+}
index 4b063ab4f5b4063cc594f5cceb8b9d1c843d8b8e..2aebfcbeba599e194e0017d73ec50a4536226388 100644 (file)
@@ -85,11 +85,8 @@ public class OpenRoadmInterface221 {
 
         // Ethernet interface specific data
         EthernetBuilder ethIfBuilder = new EthernetBuilder();
-        //ethIfBuilder.setAutoNegotiation(EthAttributes.AutoNegotiation.Enabled);
-        //ethIfBuilder.setDuplex(EthAttributes.Duplex.Full);
         ethIfBuilder.setFec(EthAttributes.Fec.Off);
         ethIfBuilder.setSpeed(100000L);
-        //ethIfBuilder.setMtu(9000L);
 
         InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.class,
             logicalConnPoint + "-ETHERNET");
index 74a8c5ff0cd7d2c2923bb8778f567612e55d9907..bfd232880859173cac04d65c1d0662c5053753a1 100644 (file)
@@ -293,7 +293,8 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
                 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 {
index a8052aa607a0c85fcdc5db192de5bbcb559dfbf4..1338356330ec3b62c014815674f07b019f9c79e6 100644 (file)
@@ -415,7 +415,8 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
             GetPmOutput getPmOutput = getPmRpcResult.getResult();
             if ((getPmOutput != null) && (getPmOutput.getNodeId() != null)) {
                 LOG.info("successfully finished calling OLM's get PM");
-                return getPmOutput.getMeasurements(); // may return null
+                return getPmOutput.getMeasurements();
+                // may return null
             } else {
                 LOG.warn("OLM's get PM failed for node {} and tp {}", nodeId, tp);
             }
index 842a84404ef5edec049fa7a65f65440b56027f06..2a4b5a43ccb0c54ea592ef7e59212ccaa345c684 100644 (file)
@@ -59,7 +59,8 @@ public class PceListenerImpl implements TransportpcePceListener {
             servicePathRpcResult = notification;
             PathDescription pathDescription = null;
             switch (servicePathRpcResult.getNotificationType().getIntValue()) {
-                case 1: /** path-computation-request. */
+                /* path-computation-request. */
+                case 1:
                     LOG.info("PCE '{}' Notification received : {}",servicePathRpcResult.getNotificationType().getName(),
                             notification);
                     if (servicePathRpcResult.getStatus() == RpcStatusEx.Successful) {
@@ -116,7 +117,8 @@ public class PceListenerImpl implements TransportpcePceListener {
                         return;
                     }
                     break;
-                case 2: /** cancel-resource-reserve. */
+                /* cancel-resource-reserve. */
+                case 2:
                     if (servicePathRpcResult.getStatus() == RpcStatusEx.Successful) {
                         LOG.info("PCE cancel resource done OK !");
                         OperationResult deleteServicePathOperationResult =
@@ -166,13 +168,13 @@ public class PceListenerImpl implements TransportpcePceListener {
             if (servicePathRpcResult.getNotificationType() != notification.getNotificationType()) {
                 result = false;
             }
-            if (servicePathRpcResult.getServiceName() != notification.getServiceName()) {
+            if (!servicePathRpcResult.getServiceName().equals(notification.getServiceName())) {
                 result = false;
             }
             if (servicePathRpcResult.getStatus() != notification.getStatus()) {
                 result = false;
             }
-            if (servicePathRpcResult.getStatusMessage() != notification.getStatusMessage()) {
+            if (!servicePathRpcResult.getStatusMessage().equals(notification.getStatusMessage())) {
                 result = false;
             }
         }
index 8adb6d1b9ee662a5b59299a458e29ba8ea02765f..601d5402f499da46c305fbab17cfce9e4711b972 100644 (file)
@@ -52,7 +52,8 @@ public class RendererListenerImpl implements TransportpceRendererListener {
             LOG.info("Renderer '{}' Notification received : {}", serviceRpcResultSp.getNotificationType().getName(),
                     notification);
             switch (notifType) {
-                case 3 : /** service-implementation-request. */
+                /* service-implementation-request. */
+                case 3 :
                     if (serviceRpcResultSp.getStatus() == RpcStatusEx.Successful) {
                         LOG.info("Service implemented !");
                         OperationResult operationResult = null;
@@ -93,8 +94,8 @@ public class RendererListenerImpl implements TransportpceRendererListener {
                         }
                     }
                     break;
-
-                case 4 : /** service-delete. */
+                /* service-delete. */
+                case 4 :
                     if (serviceRpcResultSp.getStatus() == RpcStatusEx.Successful) {
                         LOG.info("Service '{}' deleted !", serviceName);
                         if (this.input != null) {
@@ -125,13 +126,13 @@ public class RendererListenerImpl implements TransportpceRendererListener {
             if (serviceRpcResultSp.getNotificationType() != notification.getNotificationType()) {
                 result = false;
             }
-            if (serviceRpcResultSp.getServiceName() != notification.getServiceName()) {
+            if (!serviceRpcResultSp.getServiceName().equals(notification.getServiceName())) {
                 result = false;
             }
             if (serviceRpcResultSp.getStatus() != notification.getStatus()) {
                 result = false;
             }
-            if (serviceRpcResultSp.getStatusMessage() != notification.getStatusMessage()) {
+            if (!serviceRpcResultSp.getStatusMessage().equals(notification.getStatusMessage())) {
                 result = false;
             }
         }
index 5e91b983ab3736764b8b7c81af771eba26f7e388..d6bf58df8776fd2262c6efa9e93ceb01e4497e59 100644 (file)
@@ -341,7 +341,10 @@ public class ServiceDataStoreOperationsImpl implements ServiceDataStoreOperation
                 result = "Failed to " + action + " service from Service List";
             }
         } else {
-            if (choice == 2) { /* Write Service */
+            /*
+             * Write Service.
+             */
+            if (choice == 2) {
                 LOG.debug("Writing '{}' Service", serviceName);
                 InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class)
                         .child(Services.class, new ServicesKey(serviceName));
index e73fbe6ff594dcee0e7cddd90f16f374e965bc38..5db07fa0c058ec6cc86553287b6405985784f4ef 100644 (file)
@@ -79,7 +79,7 @@ public class StubPceServiceOperations implements PathComputationService {
                 CancelResourceReserveOutput output = null;
                 try {
                     LOG.info("Wait for 5s til beginning the PCE cancel resource request");
-                    Thread.sleep(5000); // sleep for 1s
+                    Thread.sleep(5000);
                 } catch (InterruptedException e) {
                     message = "path computation service failed !";
                     LOG.error("path computation service failed !", e);
@@ -143,7 +143,7 @@ public class StubPceServiceOperations implements PathComputationService {
                 PathComputationRequestOutput output = null;
                 try {
                     LOG.info("Wait for 5s til beginning the PCE pathComputation request");
-                    Thread.sleep(5000); // sleep for 1s
+                    Thread.sleep(5000);
                 } catch (InterruptedException e) {
                     message = "path computation service failed !";
                     LOG.error("path computation service failed !", e);
index bd091a9a6604f1a06401f74f9f1d3c54552a31ca..9dcf3780aa401251d9311bf211429cade9c6b0e8 100644 (file)
@@ -97,7 +97,7 @@ public class StubRendererServiceOperations implements RendererServiceOperations
                 ServiceImplementationRequestOutput output = null;
                 try {
                     LOG.info("Wait for 5s til beginning the Renderer serviceImplementation request");
-                    Thread.sleep(5000); // sleep for 1s
+                    Thread.sleep(5000);
                 } catch (InterruptedException e) {
                     message = "renderer failed !";
                     rpcStatusEx = RpcStatusEx.Failed;
@@ -171,7 +171,7 @@ public class StubRendererServiceOperations implements RendererServiceOperations
                 ServiceDeleteOutput output = null;
                 try {
                     LOG.info("Wait for 5s til beginning the Renderer serviceDelete request");
-                    Thread.sleep(5000); // sleep for 1s
+                    Thread.sleep(5000);
                 } catch (InterruptedException e) {
                     message = "deleting service failed !";
                     LOG.error("deleting service failed !", e);