Small improvement in PceGraph
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / graph / PceGraph.java
index 9f876f471d34a2a92b1cf48b05a97d56c99375d8..0c90ce290f3cd350867bf8006c122957a837d7d2 100644 (file)
@@ -108,19 +108,24 @@ public class PceGraph {
             }
 
             shortestPathAtoZ = new ArrayList<>(pathAtoZ);
-            if ((StringConstants.SERVICE_TYPE_100GE.equals(serviceType))
-                    || (StringConstants.SERVICE_TYPE_OTU4.equals(serviceType))) {
-                LOG.info("In calcPath Path FOUND path for wl [{}], min Freq assignment {}, max Freq assignment {},"
+            switch (serviceType) {
+
+                case StringConstants.SERVICE_TYPE_100GE:
+                case StringConstants.SERVICE_TYPE_OTU4:
+                    LOG.info(
+                        "In calcPath Path FOUND path for wl [{}], min Freq assignment {}, max Freq assignment {},"
                         + " hops {}, distance per metrics {}, path AtoZ {}",
                         pceResult.getResultWavelength(), pceResult.getMinFreq(), pceResult.getMaxFreq(),
                         pathAtoZ.size(), path.getWeight(), pathAtoZ);
-                break;
-            } else {
-                // Service is at OTN layer and is relying on a supporting wavelength service
-                LOG.info("In calcPath Path FOUND path for hops {}, distance per metrics {}, path AtoZ {}",
+                    break;
+
+                default:
+                    LOG.info(
+                        "In calcPath Path FOUND path for hops {}, distance per metrics {}, path AtoZ {}",
                         pathAtoZ.size(), path.getWeight(), pathAtoZ);
-                break;
+                    break;
             }
+            break;
 
         }
 
@@ -228,8 +233,8 @@ public class PceGraph {
             case PropagationDelay :
                 weight = link.getLatency();
                 LOG.debug("In PceGraph PropagationDelay is used as a metrics. {}", link);
-                if ((("1GE".equals(serviceType)) || ("10GE".equals(serviceType)) || ("ODU4".equals(serviceType)))
-                        && (weight == 0)) {
+                if ((weight == 0)
+                        && ("1GE".equals(serviceType) || "10GE".equals(serviceType) || "ODU4".equals(serviceType))) {
                     LOG.warn("PropagationDelay set as metric, but latency is null: is latency set for OTN link {}?",
                         link);
                 }