Remove deprecated LinkWeight interface

Change-Id: I4d3edab133d115ba189f317202d2dfba9b100918
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index 3ad3c0e..3612273 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -24,6 +24,8 @@
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.graph.ScalarWeight;
+import org.onlab.graph.Weight;
 import org.onosproject.net.AnnotationKeys;
 import org.onosproject.net.Annotations;
 import org.onosproject.net.ChannelSpacing;
@@ -51,8 +53,7 @@
 import org.onosproject.net.resource.ResourceAllocation;
 import org.onosproject.net.resource.ResourceService;
 import org.onosproject.net.resource.Resources;
-import org.onosproject.net.topology.AdapterLinkWeigher;
-import org.onosproject.net.topology.LinkWeight;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.Topology;
 import org.onosproject.net.topology.TopologyEdge;
 import org.onosproject.net.topology.TopologyService;
@@ -337,34 +338,44 @@
         // Route in WDM topology
         Topology topology = topologyService.currentTopology();
         //TODO: refactor with LinkWeigher class Implementation
-        LinkWeight weight = new LinkWeight() {
+        LinkWeigher weight = new LinkWeigher() {
 
             @Override
-            public double weight(TopologyEdge edge) {
+            public Weight getInitialWeight() {
+                return ScalarWeight.toWeight(0.0);
+            }
+
+            @Override
+            public Weight getNonViableWeight() {
+                return ScalarWeight.NON_VIABLE_WEIGHT;
+            }
+
+            @Override
+            public Weight weight(TopologyEdge edge) {
                 // Disregard inactive or non-optical links
                 if (edge.link().state() == Link.State.INACTIVE) {
-                    return -1;
+                    return ScalarWeight.toWeight(-1);
                 }
                 if (edge.link().type() != Link.Type.OPTICAL) {
-                    return -1;
+                    return ScalarWeight.toWeight(-1);
                 }
                 // Adhere to static port mappings
                 DeviceId srcDeviceId = edge.link().src().deviceId();
                 if (srcDeviceId.equals(intent.getSrc().deviceId())) {
                     ConnectPoint srcStaticPort = staticPort(intent.getSrc());
                     if (srcStaticPort != null) {
-                        return srcStaticPort.equals(edge.link().src()) ? 1 : -1;
+                        return ScalarWeight.toWeight(srcStaticPort.equals(edge.link().src()) ? 1 : -1);
                     }
                 }
                 DeviceId dstDeviceId = edge.link().dst().deviceId();
                 if (dstDeviceId.equals(intent.getDst().deviceId())) {
                     ConnectPoint dstStaticPort = staticPort(intent.getDst());
                     if (dstStaticPort != null) {
-                        return dstStaticPort.equals(edge.link().dst()) ? 1 : -1;
+                        return ScalarWeight.toWeight(dstStaticPort.equals(edge.link().dst()) ? 1 : -1);
                     }
                 }
 
-                return 1;
+                return ScalarWeight.toWeight(1);
             }
         };
 
@@ -393,7 +404,7 @@
         Stream<Path> paths = topologyService.getKShortestPaths(topology,
                 start.deviceId(),
                 end.deviceId(),
-                AdapterLinkWeigher.adapt(weight))
+                weight)
                 .filter(p -> p.links().get(0).src().port().equals(start.port()) &&
                         p.links().get(p.links().size() - 1).dst().port().equals(end.port()));
         if (log.isDebugEnabled()) {
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalOduIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalOduIntentCompiler.java
index 4b386bd..e45bfb1 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalOduIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalOduIntentCompiler.java
@@ -21,6 +21,8 @@
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.graph.ScalarWeight;
+import org.onlab.graph.Weight;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
 import org.onosproject.net.ConnectPoint;
@@ -54,8 +56,9 @@
 import org.onosproject.net.resource.ResourceService;
 import org.onosproject.net.resource.ResourceAllocation;
 import org.onosproject.net.resource.Resources;
-import org.onosproject.net.topology.LinkWeight;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.Topology;
+import org.onosproject.net.topology.TopologyEdge;
 import org.onosproject.net.topology.TopologyService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -256,25 +259,41 @@
         // Route in OTU topology
         Topology topology = topologyService.currentTopology();
 
-        LinkWeight weight = edge -> {
-            // Disregard inactive or non-optical links
-            if (edge.link().state() == Link.State.INACTIVE) {
-                return -1;
+
+        class Weigher implements LinkWeigher {
+            @Override
+            public Weight weight(TopologyEdge edge) {
+                if (edge.link().state() == Link.State.INACTIVE) {
+                    return ScalarWeight.toWeight(-1);
+                }
+                if (edge.link().type() != Link.Type.OPTICAL) {
+                    return ScalarWeight.toWeight(-1);
+                }
+                // Find path with available TributarySlots resources
+                if (!isAvailableTributarySlots(intent, edge.link())) {
+                    return ScalarWeight.toWeight(-1);
+                }
+                return ScalarWeight.toWeight(1);
             }
-            if (edge.link().type() != Link.Type.OPTICAL) {
-                return -1;
+
+            @Override
+            public Weight getInitialWeight() {
+                return null;
             }
-            // Find path with available TributarySlots resources
-            if (!isAvailableTributarySlots(intent, edge.link())) {
-                return -1;
+
+            @Override
+            public Weight getNonViableWeight() {
+                return null;
             }
-            return 1;
-        };
+        }
+
+
+        LinkWeigher weigher = new Weigher();
 
         ConnectPoint start = intent.getSrc();
         ConnectPoint end = intent.getDst();
 
-        return topologyService.getPaths(topology, start.deviceId(), end.deviceId(), weight);
+        return topologyService.getPaths(topology, start.deviceId(), end.deviceId(), weigher);
     }
 
     private boolean isAvailableTributarySlots(OpticalOduIntent intent, Link link) {