Vector cost proposed to TST on 2016-07-13

First part implemented: weight interface introduced and integrated, default weight implementation added.

Change-Id: Ia46f1b44139069aa171a3c13faf168351bd7cc56
diff --git a/core/api/src/main/java/org/onosproject/net/DefaultDisjointPath.java b/core/api/src/main/java/org/onosproject/net/DefaultDisjointPath.java
index c4e0398..b68110d 100644
--- a/core/api/src/main/java/org/onosproject/net/DefaultDisjointPath.java
+++ b/core/api/src/main/java/org/onosproject/net/DefaultDisjointPath.java
@@ -16,6 +16,7 @@
 
 package org.onosproject.net;
 
+import org.onlab.graph.Weight;
 import org.onosproject.net.provider.ProviderId;
 
 import java.util.List;
@@ -40,7 +41,7 @@
      */
     public DefaultDisjointPath(ProviderId providerId, DefaultPath path1, DefaultPath path2) {
         // Note: cost passed to super will never be used
-        super(providerId, path1.links(), path1.cost());
+        super(providerId, path1.links(), path1.weight());
         this.path1 = path1;
         this.path2 = path2;
     }
@@ -66,10 +67,12 @@
 
     @Override
     public double cost() {
-        if (usingPath1) {
-            return path1.cost();
-        }
-        return path2.cost();
+        return usingPath1 ? path1.cost() : path2.cost();
+    }
+
+    @Override
+    public Weight weight() {
+        return usingPath1 ? path1.weight() : path2.weight();
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/DefaultPath.java b/core/api/src/main/java/org/onosproject/net/DefaultPath.java
index e4c3d8c..79677ac 100644
--- a/core/api/src/main/java/org/onosproject/net/DefaultPath.java
+++ b/core/api/src/main/java/org/onosproject/net/DefaultPath.java
@@ -17,6 +17,8 @@
 
 import com.google.common.base.MoreObjects;
 import com.google.common.collect.ImmutableList;
+import org.onlab.graph.ScalarWeight;
+import org.onlab.graph.Weight;
 import org.onosproject.net.provider.ProviderId;
 
 import java.util.List;
@@ -31,7 +33,27 @@
 public class DefaultPath extends DefaultLink implements Path {
 
     private final List<Link> links;
-    private final double cost;
+    private final Weight cost;
+
+    /**
+     * Creates a path from the specified source and destination using the
+     * supplied list of links.
+     *
+     * @param providerId provider identity
+     * @param links      contiguous links that comprise the path
+     * @param cost       unit-less path cost
+     * @param annotations optional key/value annotations
+     *
+     * @deprecated in Junco (1.9.0)
+     */
+    @Deprecated
+    public DefaultPath(ProviderId providerId, List<Link> links, double cost,
+                       Annotations... annotations) {
+        super(providerId, source(links), destination(links), Type.INDIRECT,
+                State.ACTIVE, annotations);
+        this.links = ImmutableList.copyOf(links);
+        this.cost = new ScalarWeight(cost);
+    }
 
     /**
      * Creates a path from the specified source and destination using the
@@ -42,7 +64,7 @@
      * @param cost       unit-less path cost
      * @param annotations optional key/value annotations
      */
-    public DefaultPath(ProviderId providerId, List<Link> links, double cost,
+    public DefaultPath(ProviderId providerId, List<Link> links, Weight cost,
                        Annotations... annotations) {
         super(providerId, source(links), destination(links), Type.INDIRECT, State.ACTIVE, annotations);
         this.links = ImmutableList.copyOf(links);
@@ -56,6 +78,14 @@
 
     @Override
     public double cost() {
+        if (cost instanceof ScalarWeight) {
+            return ((ScalarWeight) cost).value();
+        }
+        return 0;
+    }
+
+    @Override
+    public Weight weight() {
         return cost;
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/Path.java b/core/api/src/main/java/org/onosproject/net/Path.java
index fdff4e0..13fae0a 100644
--- a/core/api/src/main/java/org/onosproject/net/Path.java
+++ b/core/api/src/main/java/org/onosproject/net/Path.java
@@ -15,13 +15,16 @@
  */
 package org.onosproject.net;
 
+import org.onlab.graph.Weight;
+
 import java.util.List;
 
 /**
  * Representation of a contiguous directed path in a network. Path comprises
  * of a sequence of links, where adjacent links must share the same device,
  * meaning that destination of the source of one link must coincide with the
- * destination of the previous link.
+ * destination of the previous link. Path weight (cost) is an aggregation
+ * of the weights of the links the path consists of.
  */
 public interface Path extends Link {
 
@@ -36,7 +39,17 @@
      * Returns the path cost as a unit-less value.
      *
      * @return unit-less path cost
+     *
+     * @deprecated in Junco (1.9.0), use weight() instead
      */
+    @Deprecated
     double cost();
 
+    /**
+     * Returns the path cost as an weight instance.
+     *
+     * @return weight path cost
+     */
+    Weight weight();
+
 }
diff --git a/core/api/src/main/java/org/onosproject/net/topology/AbstractPathService.java b/core/api/src/main/java/org/onosproject/net/topology/AbstractPathService.java
index 8b24cbb..2c43fc7 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/AbstractPathService.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/AbstractPathService.java
@@ -18,6 +18,7 @@
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
+import org.onlab.graph.Weight;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DefaultDisjointPath;
 import org.onosproject.net.DefaultEdgeLink;
@@ -40,6 +41,7 @@
 import java.util.Set;
 
 import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.net.topology.AdapterLinkWeigher.adapt;
 
 /**
  * Helper class for path service.
@@ -56,15 +58,25 @@
     private static final ProviderId PID = new ProviderId("core", "org.onosproject.core");
     private static final PortNumber P0 = PortNumber.portNumber(0);
 
+    protected static final LinkWeigher DEFAULT_WEIGHER =
+            adapt(new HopCountLinkWeight());
+
     protected TopologyService topologyService;
 
     protected HostService hostService;
 
     @Override
     public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight) {
+        return getPaths(src, dst, adapt(weight));
+    }
+
+    @Override
+    public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeigher weigher) {
         checkNotNull(src, ELEMENT_ID_NULL);
         checkNotNull(dst, ELEMENT_ID_NULL);
 
+        LinkWeigher internalWeigher = weigher != null ? weigher : DEFAULT_WEIGHER;
+
         // Get the source and destination edge locations
         EdgeLink srcEdge = getEdgeLink(src, true);
         EdgeLink dstEdge = getEdgeLink(dst, false);
@@ -80,24 +92,30 @@
         // If the source and destination are on the same edge device, there
         // is just one path, so build it and return it.
         if (srcDevice.equals(dstDevice)) {
-            return edgeToEdgePaths(srcEdge, dstEdge);
+            return edgeToEdgePaths(srcEdge, dstEdge, internalWeigher);
         }
 
         // Otherwise get all paths between the source and destination edge
         // devices.
         Topology topology = topologyService.currentTopology();
-        Set<Path> paths = weight == null ?
-                topologyService.getPaths(topology, srcDevice, dstDevice) :
-                topologyService.getPaths(topology, srcDevice, dstDevice, weight);
+        Set<Path> paths = topologyService.getPaths(topology, srcDevice,
+                dstDevice, internalWeigher);
 
-        return edgeToEdgePaths(srcEdge, dstEdge, paths);
+        return edgeToEdgePaths(srcEdge, dstEdge, paths, internalWeigher);
     }
 
     @Override
     public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeight weight) {
+        return getDisjointPaths(src, dst, adapt(weight));
+    }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeigher weigher) {
         checkNotNull(src, ELEMENT_ID_NULL);
         checkNotNull(dst, ELEMENT_ID_NULL);
 
+        LinkWeigher internalWeigher = weigher != null ? weigher : DEFAULT_WEIGHER;
+
         // Get the source and destination edge locations
         EdgeLink srcEdge = getEdgeLink(src, true);
         EdgeLink dstEdge = getEdgeLink(dst, false);
@@ -113,25 +131,32 @@
         // If the source and destination are on the same edge device, there
         // is just one path, so build it and return it.
         if (srcDevice.equals(dstDevice)) {
-            return edgeToEdgePathsDisjoint(srcEdge, dstEdge);
+            return edgeToEdgePathsDisjoint(srcEdge, dstEdge, internalWeigher);
         }
 
         // Otherwise get all paths between the source and destination edge
         // devices.
         Topology topology = topologyService.currentTopology();
-        Set<DisjointPath> paths = weight == null ?
-                topologyService.getDisjointPaths(topology, srcDevice, dstDevice) :
-                topologyService.getDisjointPaths(topology, srcDevice, dstDevice, weight);
+        Set<DisjointPath> paths = topologyService.getDisjointPaths(topology,
+                srcDevice, dstDevice, internalWeigher);
 
-        return edgeToEdgePathsDisjoint(srcEdge, dstEdge, paths);
+        return edgeToEdgePathsDisjoint(srcEdge, dstEdge, paths, internalWeigher);
     }
 
     @Override
     public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeight weight,
                                               Map<Link, Object> riskProfile) {
+        return getDisjointPaths(src, dst, adapt(weight), riskProfile);
+    }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+                                              LinkWeigher weigher, Map<Link, Object> riskProfile) {
         checkNotNull(src, ELEMENT_ID_NULL);
         checkNotNull(dst, ELEMENT_ID_NULL);
 
+        LinkWeigher internalWeigher = weigher != null ? weigher : DEFAULT_WEIGHER;
+
         // Get the source and destination edge locations
         EdgeLink srcEdge = getEdgeLink(src, true);
         EdgeLink dstEdge = getEdgeLink(dst, false);
@@ -147,17 +172,16 @@
         // If the source and destination are on the same edge device, there
         // is just one path, so build it and return it.
         if (srcDevice.equals(dstDevice)) {
-            return edgeToEdgePathsDisjoint(srcEdge, dstEdge);
+            return edgeToEdgePathsDisjoint(srcEdge, dstEdge, internalWeigher);
         }
 
         // Otherwise get all paths between the source and destination edge
         // devices.
         Topology topology = topologyService.currentTopology();
-        Set<DisjointPath> paths = weight == null ?
-                topologyService.getDisjointPaths(topology, srcDevice, dstDevice, riskProfile) :
-                topologyService.getDisjointPaths(topology, srcDevice, dstDevice, weight, riskProfile);
+        Set<DisjointPath> paths = topologyService.getDisjointPaths(topology,
+                srcDevice, dstDevice, internalWeigher, riskProfile);
 
-        return edgeToEdgePathsDisjoint(srcEdge, dstEdge, paths);
+        return edgeToEdgePathsDisjoint(srcEdge, dstEdge, paths, internalWeigher);
     }
 
     // Finds the host edge link if the element ID is a host id of an existing
@@ -178,61 +202,63 @@
 
     // Produces a set of edge-to-edge paths using the set of infrastructure
     // paths and the given edge links.
-    private Set<Path> edgeToEdgePaths(EdgeLink srcLink, EdgeLink dstLink) {
+    private Set<Path> edgeToEdgePaths(EdgeLink srcLink, EdgeLink dstLink, LinkWeigher weigher) {
         Set<Path> endToEndPaths = Sets.newHashSetWithExpectedSize(1);
-        endToEndPaths.add(edgeToEdgePath(srcLink, dstLink, null));
+        endToEndPaths.add(edgeToEdgePath(srcLink, dstLink, null, weigher));
         return endToEndPaths;
     }
 
     // Produces a set of edge-to-edge paths using the set of infrastructure
     // paths and the given edge links.
-    private Set<Path> edgeToEdgePaths(EdgeLink srcLink, EdgeLink dstLink, Set<Path> paths) {
+    private Set<Path> edgeToEdgePaths(EdgeLink srcLink, EdgeLink dstLink, Set<Path> paths,
+                                      LinkWeigher weigher) {
         Set<Path> endToEndPaths = Sets.newHashSetWithExpectedSize(paths.size());
         for (Path path : paths) {
-            endToEndPaths.add(edgeToEdgePath(srcLink, dstLink, path));
+            endToEndPaths.add(edgeToEdgePath(srcLink, dstLink, path, weigher));
         }
         return endToEndPaths;
     }
 
-    private Set<DisjointPath> edgeToEdgePathsDisjoint(EdgeLink srcLink, EdgeLink dstLink) {
+    private Set<DisjointPath> edgeToEdgePathsDisjoint(EdgeLink srcLink, EdgeLink dstLink, LinkWeigher weigher) {
         Set<DisjointPath> endToEndPaths = Sets.newHashSetWithExpectedSize(1);
-        endToEndPaths.add(edgeToEdgePathD(srcLink, dstLink, null));
+        endToEndPaths.add(edgeToEdgePathD(srcLink, dstLink, null, weigher));
         return endToEndPaths;
     }
 
     private Set<DisjointPath> edgeToEdgePathsDisjoint(EdgeLink srcLink, EdgeLink dstLink,
-                                                             Set<DisjointPath> paths) {
+                                                             Set<DisjointPath> paths, LinkWeigher weigher) {
         Set<DisjointPath> endToEndPaths = Sets.newHashSetWithExpectedSize(paths.size());
         for (DisjointPath path : paths) {
-            endToEndPaths.add(edgeToEdgePathD(srcLink, dstLink, path));
+            endToEndPaths.add(edgeToEdgePathD(srcLink, dstLink, path, weigher));
         }
         return endToEndPaths;
     }
 
     // Produces a direct edge-to-edge path.
-    private Path edgeToEdgePath(EdgeLink srcLink, EdgeLink dstLink, Path path) {
+    private Path edgeToEdgePath(EdgeLink srcLink, EdgeLink dstLink, Path path, LinkWeigher weigher) {
         List<Link> links = Lists.newArrayListWithCapacity(2);
-        double cost = 0;
+        Weight cost = weigher.getInitialWeight();
 
         // Add source and destination edge links only if they are real and
         // add the infrastructure path only if it is not null.
         if (srcLink != NOT_HOST) {
             links.add(srcLink);
-            cost++;
+            cost = cost.merge(weigher.weight(new DefaultTopologyEdge(null, null, srcLink)));
         }
         if (path != null) {
             links.addAll(path.links());
-            cost += path.cost();
+            cost = cost.merge(path.weight());
         }
         if (dstLink != NOT_HOST) {
             links.add(dstLink);
-            cost++;
+            cost = cost.merge(weigher.weight(new DefaultTopologyEdge(null, null, srcLink)));
         }
         return new DefaultPath(PID, links, cost);
     }
 
     // Produces a direct edge-to-edge path.
-    private DisjointPath edgeToEdgePathD(EdgeLink srcLink, EdgeLink dstLink, DisjointPath path) {
+    private DisjointPath edgeToEdgePathD(EdgeLink srcLink, EdgeLink dstLink, DisjointPath path,
+                                         LinkWeigher weigher) {
         Path primary = null;
         Path backup = null;
         if (path != null) {
@@ -240,10 +266,12 @@
             backup = path.backup();
         }
         if (backup == null) {
-        return new DefaultDisjointPath(PID, (DefaultPath) edgeToEdgePath(srcLink, dstLink, primary));
+        return new DefaultDisjointPath(PID,
+                (DefaultPath) edgeToEdgePath(srcLink, dstLink, primary, weigher));
         }
-        return new DefaultDisjointPath(PID, (DefaultPath) edgeToEdgePath(srcLink, dstLink, primary),
-                                       (DefaultPath) edgeToEdgePath(srcLink, dstLink, backup));
+        return new DefaultDisjointPath(PID,
+                (DefaultPath) edgeToEdgePath(srcLink, dstLink, primary, weigher),
+                (DefaultPath) edgeToEdgePath(srcLink, dstLink, backup, weigher));
     }
 
 
diff --git a/core/api/src/main/java/org/onosproject/net/topology/AdapterLinkWeigher.java b/core/api/src/main/java/org/onosproject/net/topology/AdapterLinkWeigher.java
new file mode 100644
index 0000000..1bb2729
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/topology/AdapterLinkWeigher.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.topology;
+
+import org.onlab.graph.DefaultEdgeWeigher;
+import org.onlab.graph.ScalarWeight;
+import org.onlab.graph.Weight;
+
+/**
+ * Wrapper which transforms double-based link weigher to {@link Weight}-based
+ * link weigher.
+ */
+public final class AdapterLinkWeigher
+        extends DefaultEdgeWeigher<TopologyVertex, TopologyEdge>
+        implements LinkWeigher {
+
+    private final LinkWeight doubleWeigher;
+
+    private AdapterLinkWeigher(LinkWeight doubleWeigher) {
+        this.doubleWeigher = doubleWeigher;
+    }
+
+    @Override
+    public Weight weight(TopologyEdge edge) {
+        return new ScalarWeight(doubleWeigher.weight(edge));
+    }
+
+    /**
+     * Transforms double-based link weigher to {@link Weight}-based weigher.
+     *
+     * @param lw double-based weigher
+     * @return {@link Weight}-based weigher
+     */
+    public static LinkWeigher adapt(LinkWeight lw) {
+        return lw == null ? null : new AdapterLinkWeigher(lw);
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/topology/LinkWeigher.java b/core/api/src/main/java/org/onosproject/net/topology/LinkWeigher.java
new file mode 100644
index 0000000..9008811
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/topology/LinkWeigher.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.topology;
+
+import org.onlab.graph.EdgeWeigher;
+
+/**
+ * Entity capable of determining cost or weight of a specified topology
+ * graph edge. Returns {@link org.onlab.graph.Weight} instances.
+ */
+public interface LinkWeigher extends EdgeWeigher<TopologyVertex, TopologyEdge> {
+}
diff --git a/core/api/src/main/java/org/onosproject/net/topology/LinkWeight.java b/core/api/src/main/java/org/onosproject/net/topology/LinkWeight.java
index 99fa38c..22eb7d1 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/LinkWeight.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/LinkWeight.java
@@ -15,11 +15,19 @@
  */
 package org.onosproject.net.topology;
 
-import org.onlab.graph.EdgeWeight;
-
 /**
  * Entity capable of determining cost or weight of a specified topology
  * graph edge.
+ * @deprecated in Junco (1.9.0), use {@link LinkWeigher} instead
  */
-public interface LinkWeight extends EdgeWeight<TopologyVertex, TopologyEdge> {
+@Deprecated
+public interface LinkWeight {
+
+    /**
+     * Returns the weight of the given edge.
+     *
+     * @param edge edge to be weighed
+     * @return edge weight
+     */
+    double weight(TopologyEdge edge);
 }
diff --git a/core/api/src/main/java/org/onosproject/net/topology/PathAdminService.java b/core/api/src/main/java/org/onosproject/net/topology/PathAdminService.java
index 0214e57..d88d729 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/PathAdminService.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/PathAdminService.java
@@ -29,10 +29,22 @@
      * used.
      *
      * @param linkWeight default link-weight function
+     *
+     * @deprecated in Junco (1.9.0), use setDefaultLinkWeigher() instead
      */
+    @Deprecated
     void setDefaultLinkWeight(LinkWeight linkWeight);
 
     /**
+     * Sets the specified link-weight function to be used as a default.
+     * If null is specified, the builtin default hop-count link-weight will be
+     * used.
+     *
+     * @param linkWeigher link-weight function to be used as default
+     */
+    void setDefaultLinkWeigher(LinkWeigher linkWeigher);
+
+    /**
      * Sets the specified graph path search algorightm to be used as a default.
      * If null is specified, the builtin default all-shortest-paths Dijkstra
      * algorithm will be used.
diff --git a/core/api/src/main/java/org/onosproject/net/topology/PathService.java b/core/api/src/main/java/org/onosproject/net/topology/PathService.java
index 6ed4799..adfca3d 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/PathService.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/PathService.java
@@ -49,10 +49,25 @@
      * @param dst    destination element
      * @param weight edge-weight entity
      * @return set of all shortest paths between the two element
+     *
+     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
      */
+    @Deprecated
     Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight);
 
     /**
+     * Returns the set of all shortest paths between the specified source and
+     * destination network elements.  The path is computed using the supplied
+     * edge-weight function.
+     *
+     * @param src     source element
+     * @param dst     destination element
+     * @param weigher edge-weight entity
+     * @return set of all shortest paths between the two element
+     */
+    Set<Path> getPaths(ElementId src, ElementId dst, LinkWeigher weigher);
+
+    /**
      * Returns the set of all disjoint shortest path pairs between the
      * specified source and destination elements. The path is computed using
      * the default edge-weight function, which by default is hop-count.
@@ -72,12 +87,28 @@
      * @param dst    destination device
      * @param weight edge-weight entity
      * @return set of all shortest paths between the two devices
+     *
+     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
      */
+    @Deprecated
     Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
                                        LinkWeight weight);
 
     /**
      * Returns the set of all disjoint shortest path pairs between the
+     * specified source and destination elements. The path is computed using
+     * the supplied edge-weight function.
+     *
+     * @param src     source device
+     * @param dst     destination device
+     * @param weigher edge-weight entity
+     * @return set of all shortest paths between the two devices
+     */
+    Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+                                       LinkWeigher weigher);
+
+    /**
+     * Returns the set of all disjoint shortest path pairs between the
      * specified source and destination elements and taking into consideration
      * the provided risk profile. The path is computed using the default
      * edge-weight function, which by default is hop-count.
@@ -101,9 +132,28 @@
      * @param weight      edge-weight entity
      * @param riskProfile map of edges to risk profiles
      * @return set of all shortest paths between the two devices
+     *
+     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
      */
+    @Deprecated
     Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
                                        LinkWeight weight,
                                        Map<Link, Object> riskProfile);
 
+    /**
+     * Returns the set of all disjoint shortest path pairs between the
+     * specified source and destination elements and taking into consideration
+     * the provided risk profile. The path is computed using the supplied
+     * edge-weight function.
+     *
+     * @param src         source device
+     * @param dst         destination device
+     * @param weigher     edge-weight entity
+     * @param riskProfile map of edges to risk profiles
+     * @return set of all shortest paths between the two devices
+     */
+    Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+                                       LinkWeigher weigher,
+                                       Map<Link, Object> riskProfile);
+
 }
diff --git a/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java b/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java
index e4504c5..13d1842 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java
@@ -109,11 +109,27 @@
      * @param dst      destination device
      * @param weight   edge-weight entity
      * @return set of all shortest paths between the two devices
+     *
+     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
      */
+    @Deprecated
     Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
                        LinkWeight weight);
 
     /**
+     * Returns the set of all shortest paths, computed using the supplied
+     * edge-weight entity, between the specified source and destination devices.
+     *
+     * @param topology topology descriptor
+     * @param src      source device
+     * @param dst      destination device
+     * @param weigher  edge-weight entity
+     * @return set of all shortest paths between the two devices
+     */
+    Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
+                       LinkWeigher weigher);
+
+    /**
      * Returns the set of all disjoint shortest path pairs, precomputed in terms of hop-count,
      * between the specified source and destination devices.
      *
@@ -133,11 +149,27 @@
      * @param dst      destination device
      * @param weight   edge-weight entity
      * @return set of all shortest paths between the two devices
+     *
+     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
      */
+    @Deprecated
     Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
                                        LinkWeight weight);
 
     /**
+     * Returns the set of all disjoint shortest path pairs, computed using the supplied
+     * edge-weight entity, between the specified source and destination devices.
+     *
+     * @param topology topology descriptor
+     * @param src      source device
+     * @param dst      destination device
+     * @param weigher  edge-weight entity
+     * @return set of all shortest paths between the two devices
+     */
+    Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+                                       LinkWeigher weigher);
+
+    /**
      * Returns the set of all disjoint shortest path pairs, precomputed in terms of hop-count,
      * between the specified source and destination devices.
      *
@@ -160,11 +192,28 @@
      * @param weight      edge-weight entity
      * @param riskProfile map of edges to risk profiles
      * @return set of all shortest paths between the two devices
+     *
+     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
      */
+    @Deprecated
     Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
                                        LinkWeight weight, Map<Link, Object> riskProfile);
 
     /**
+     * Returns the set of all disjoint shortest path pairs, precomputed in terms of hop-count,
+     * between the specified source and destination devices.
+     *
+     * @param topology    topology descriptor
+     * @param src         source device
+     * @param dst         destination device
+     * @param weigher     edge-weight entity
+     * @param riskProfile map of edges to risk profiles
+     * @return set of all shortest paths between the two devices
+     */
+    Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+                                       LinkWeigher weigher, Map<Link, Object> riskProfile);
+
+    /**
      * Indicates whether the specified connection point is part of the network
      * infrastructure or part of network edge.
      *
diff --git a/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java b/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java
index 61ab526..907beb2 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java
@@ -109,11 +109,26 @@
      * @param dst      destination device
      * @param weight   link weight function
      * @return set of shortest paths
+     *
+     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
      */
+    @Deprecated
     Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
                        LinkWeight weight);
 
     /**
+     * Computes and returns the set of shortest paths between src and dest.
+     *
+     * @param topology topology descriptor
+     * @param src      source device
+     * @param dst      destination device
+     * @param weigher  link weight function
+     * @return set of shortest paths
+     */
+    Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
+                       LinkWeigher weigher);
+
+    /**
      * Computes and returns the set of disjoint shortest path pairs
      * between src and dst.
      *
@@ -122,7 +137,10 @@
      * @param dst      destination device
      * @param weight   link weight function
      * @return set of shortest paths
+     *
+     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
      */
+    @Deprecated
     Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
                                        LinkWeight weight);
 
@@ -133,6 +151,19 @@
      * @param topology topology descriptor
      * @param src      source device
      * @param dst      destination device
+     * @param weigher  link weight function
+     * @return set of shortest paths
+     */
+    Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+                                       LinkWeigher weigher);
+
+    /**
+     * Computes and returns the set of disjoint shortest path pairs
+     * between src and dst.
+     *
+     * @param topology topology descriptor
+     * @param src      source device
+     * @param dst      destination device
      * @return set of shortest paths
      */
     Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst);
@@ -141,24 +172,42 @@
      * Computes and returns the set of SRLG disjoint shortest path pairs between source
      * and dst, given a mapping of edges to SRLG risk groups.
      *
-     * @param topology topology descriptor
-     * @param src      source device
-     * @param dst      destination device
-     * @param weight   link weight function
-     * @param riskProfile   map of edges to objects. Edges that map to the same object will
+     * @param topology    topology descriptor
+     * @param src         source device
+     * @param dst         destination device
+     * @param weight      link weight function
+     * @param riskProfile map of edges to objects. Edges that map to the same object will
      * be treated as if they were in the same risk group.
      * @return set of shortest paths
+     *
+     * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
      */
+    @Deprecated
     Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
                                        LinkWeight weight, Map<Link, Object> riskProfile);
 
     /**
+     * Computes and returns the set of SRLG disjoint shortest path pairs between source
+     * and dst, given a mapping of edges to SRLG risk groups.
+     *
+     * @param topology    topology descriptor
+     * @param src         source device
+     * @param dst         destination device
+     * @param weigher     link weight function
+     * @param riskProfile map of edges to objects. Edges that map to the same object will
+     * be treated as if they were in the same risk group.
+     * @return set of shortest paths
+     */
+    Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+                                       LinkWeigher weigher, Map<Link, Object> riskProfile);
+
+    /**
      * Returns the set of pre-computed SRLG shortest paths between src and dest.
      *
-     * @param topology topology descriptor
-     * @param src      source device
-     * @param dst      destination device
-     * @param riskProfile   map of edges to objects. Edges that map to the same object will
+     * @param topology    topology descriptor
+     * @param src         source device
+     * @param dst         destination device
+     * @param riskProfile map of edges to objects. Edges that map to the same object will
      * be treated as if they were in the same risk group.
      * @return set of shortest paths
      */
diff --git a/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java b/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
index 931ac72..a944ca6 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
@@ -16,6 +16,7 @@
 package org.onosproject.net.intent;
 
 import com.google.common.base.MoreObjects;
+import org.onlab.graph.Weight;
 import org.onlab.util.Bandwidth;
 import org.onosproject.core.DefaultGroupId;
 import org.onosproject.core.GroupId;
@@ -46,7 +47,7 @@
 import org.onosproject.net.resource.ResourceService;
 import org.onosproject.net.topology.DefaultTopologyEdge;
 import org.onosproject.net.topology.DefaultTopologyVertex;
-import org.onosproject.net.topology.LinkWeight;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.PathServiceAdapter;
 import org.onosproject.net.topology.TopologyVertex;
 import org.onosproject.store.Timestamp;
@@ -159,19 +160,19 @@
         }
 
         @Override
-        public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight) {
-            final Set<Path> paths = getPaths(src, dst);
+        public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeigher weigher) {
+            Set<Path> paths = getPaths(src, dst);
 
             for (Path path : paths) {
-                final DeviceId srcDevice = path.src().elementId() instanceof DeviceId ? path.src().deviceId() : null;
-                final DeviceId dstDevice = path.dst().elementId() instanceof DeviceId ? path.dst().deviceId() : null;
+                DeviceId srcDevice = path.src().elementId() instanceof DeviceId ? path.src().deviceId() : null;
+                DeviceId dstDevice = path.dst().elementId() instanceof DeviceId ? path.dst().deviceId() : null;
                 if (srcDevice != null && dstDevice != null) {
-                    final TopologyVertex srcVertex = new DefaultTopologyVertex(srcDevice);
-                    final TopologyVertex dstVertex = new DefaultTopologyVertex(dstDevice);
-                    final Link link = link(src.toString(), 1, dst.toString(), 1);
+                    TopologyVertex srcVertex = new DefaultTopologyVertex(srcDevice);
+                    TopologyVertex dstVertex = new DefaultTopologyVertex(dstDevice);
+                    Link link = link(src.toString(), 1, dst.toString(), 1);
 
-                    final double weightValue = weight.weight(new DefaultTopologyEdge(srcVertex, dstVertex, link));
-                    if (weightValue < 0) {
+                    Weight weightValue = weigher.weight(new DefaultTopologyEdge(srcVertex, dstVertex, link));
+                    if (weightValue.isNegative()) {
                         return new HashSet<>();
                     }
                 }
@@ -220,7 +221,7 @@
         }
 
         @Override
-        public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight) {
+        public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeigher weigher) {
             final Set<Path> paths = getPaths(src, dst);
 
             for (Path path : paths) {
@@ -231,8 +232,8 @@
                     final TopologyVertex dstVertex = new DefaultTopologyVertex(dstDevice);
                     final Link link = link(src.toString(), 1, dst.toString(), 1);
 
-                    final double weightValue = weight.weight(new DefaultTopologyEdge(srcVertex, dstVertex, link));
-                    if (weightValue < 0) {
+                    final Weight weightValue = weigher.weight(new DefaultTopologyEdge(srcVertex, dstVertex, link));
+                    if (weightValue.isNegative()) {
                         return new HashSet<>();
                     }
                 }
diff --git a/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java b/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java
index eecb73e..f0494b1 100644
--- a/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java
@@ -38,12 +38,25 @@
     }
 
     @Override
+    public Set<Path> getPaths(ElementId src, ElementId dst,
+                              LinkWeigher weigher) {
+        return null;
+    }
+
+    @Override
     public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst) {
         return null;
     }
 
     @Override
-    public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeight weight) {
+    public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+                                              LinkWeight weight) {
+        return null;
+    }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+                                              LinkWeigher weigher) {
         return null;
     }
 
@@ -59,4 +72,11 @@
                                               Map<Link, Object> riskProfile) {
         return null;
     }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+                                              LinkWeigher weigher,
+                                              Map<Link, Object> riskProfile) {
+        return null;
+    }
 }
diff --git a/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java b/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java
index f86bb3b..79ec17c 100644
--- a/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java
@@ -54,12 +54,14 @@
     }
 
     @Override
-    public Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster) {
+    public Set<DeviceId> getClusterDevices(Topology topology,
+                                           TopologyCluster cluster) {
         return null;
     }
 
     @Override
-    public Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster) {
+    public Set<Link> getClusterLinks(Topology topology,
+                                     TopologyCluster cluster) {
         return null;
     }
 
@@ -69,17 +71,26 @@
     }
 
     @Override
-    public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, LinkWeight weight) {
+    public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
+                              LinkWeight weight) {
         return null;
     }
 
     @Override
-    public boolean isInfrastructure(Topology topology, ConnectPoint connectPoint) {
+    public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
+                              LinkWeigher weigher) {
+        return null;
+    }
+
+    @Override
+    public boolean isInfrastructure(Topology topology,
+                                    ConnectPoint connectPoint) {
         return false;
     }
 
     @Override
-    public boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint) {
+    public boolean isBroadcastPoint(Topology topology,
+                                    ConnectPoint connectPoint) {
         return false;
     }
 
@@ -92,18 +103,28 @@
     }
 
     @Override
-    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst) {
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst) {
         return null;
     }
 
     @Override
     public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
-                                              DeviceId dst, LinkWeight weight) {
+                                              DeviceId dst,
+                                              LinkWeight weight) {
         return null;
     }
 
     @Override
-    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst,
+                                              LinkWeigher weigher) {
+        return null;
+    }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst,
                                               Map<Link, Object> riskProfile) {
         return null;
     }
@@ -115,4 +136,12 @@
         return null;
     }
 
+    @Override
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst,
+                                              LinkWeigher weigher,
+                                              Map<Link, Object> riskProfile) {
+        return null;
+    }
+
 }
diff --git a/core/common/src/main/java/org/onosproject/common/DefaultTopology.java b/core/common/src/main/java/org/onosproject/common/DefaultTopology.java
index 8ed8513..53bebb6 100644
--- a/core/common/src/main/java/org/onosproject/common/DefaultTopology.java
+++ b/core/common/src/main/java/org/onosproject/common/DefaultTopology.java
@@ -22,14 +22,17 @@
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.ImmutableSetMultimap;
 import com.google.common.collect.ImmutableSetMultimap.Builder;
+import org.onlab.graph.DefaultEdgeWeigher;
 import org.onlab.graph.DijkstraGraphSearch;
 import org.onlab.graph.DisjointPathPair;
 import org.onlab.graph.GraphPathSearch;
 import org.onlab.graph.GraphPathSearch.Result;
+import org.onlab.graph.ScalarWeight;
 import org.onlab.graph.SrlgGraphSearch;
 import org.onlab.graph.SuurballeGraphSearch;
 import org.onlab.graph.TarjanGraphSearch;
 import org.onlab.graph.TarjanGraphSearch.SccResult;
+import org.onlab.graph.Weight;
 import org.onosproject.net.AbstractModel;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DefaultDisjointPath;
@@ -45,7 +48,7 @@
 import org.onosproject.net.topology.DefaultTopologyVertex;
 import org.onosproject.net.topology.GraphDescription;
 import org.onosproject.net.topology.HopCountLinkWeight;
-import org.onosproject.net.topology.LinkWeight;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.Topology;
 import org.onosproject.net.topology.TopologyCluster;
 import org.onosproject.net.topology.TopologyEdge;
@@ -67,6 +70,7 @@
 import static org.onosproject.core.CoreService.CORE_PROVIDER_ID;
 import static org.onosproject.net.Link.State.INACTIVE;
 import static org.onosproject.net.Link.Type.INDIRECT;
+import static org.onosproject.net.topology.AdapterLinkWeigher.adapt;
 
 /**
  * Default implementation of the topology descriptor. This carries the backing
@@ -76,11 +80,14 @@
 
     private static final Logger log = LoggerFactory.getLogger(DefaultTopology.class);
 
-    private static final DijkstraGraphSearch<TopologyVertex, TopologyEdge> DIJKSTRA = new DijkstraGraphSearch<>();
-    private static final TarjanGraphSearch<TopologyVertex, TopologyEdge> TARJAN = new TarjanGraphSearch<>();
-    private static final SuurballeGraphSearch<TopologyVertex, TopologyEdge> SUURBALLE = new SuurballeGraphSearch<>();
+    private static final DijkstraGraphSearch<TopologyVertex, TopologyEdge> DIJKSTRA =
+            new DijkstraGraphSearch<>();
+    private static final TarjanGraphSearch<TopologyVertex, TopologyEdge> TARJAN =
+            new TarjanGraphSearch<>();
+    private static final SuurballeGraphSearch<TopologyVertex, TopologyEdge> SUURBALLE =
+            new SuurballeGraphSearch<>();
 
-    private static LinkWeight defaultLinkWeight = null;
+    private static LinkWeigher defaultLinkWeigher = null;
     private static GraphPathSearch<TopologyVertex, TopologyEdge> defaultGraphPathSearch = null;
 
     private final long time;
@@ -88,7 +95,7 @@
     private final long computeCost;
     private final TopologyGraph graph;
 
-    private final LinkWeight hopCountWeight;
+    private final LinkWeigher hopCountWeigher;
 
     private final Supplier<SccResult<TopologyVertex, TopologyEdge>> clusterResults;
     private final Supplier<ImmutableMap<ClusterId, TopologyCluster>> clusters;
@@ -102,11 +109,11 @@
      * specified, the builtin default link-weight measuring hop-counts will be
      * used.
      *
-     * @param linkWeight new default link-weight
+     * @param linkWeigher new default link-weight
      */
-    public static void setDefaultLinkWeight(LinkWeight linkWeight) {
-        log.info("Setting new default link-weight function to {}", linkWeight);
-        defaultLinkWeight = linkWeight;
+    public static void setDefaultLinkWeigher(LinkWeigher linkWeigher) {
+        log.info("Setting new default link-weight function to {}", linkWeigher);
+        defaultLinkWeigher = linkWeigher;
     }
 
     /**
@@ -115,7 +122,8 @@
      *
      * @param graphPathSearch new default algorithm
      */
-    public static void setDefaultGraphPathSearch(GraphPathSearch<TopologyVertex, TopologyEdge> graphPathSearch) {
+    public static void setDefaultGraphPathSearch(
+            GraphPathSearch<TopologyVertex, TopologyEdge> graphPathSearch) {
         log.info("Setting new default graph path algorithm to {}", graphPathSearch);
         defaultGraphPathSearch = graphPathSearch;
     }
@@ -137,16 +145,16 @@
 
         // Build the graph
         this.graph = new DefaultTopologyGraph(description.vertexes(),
-                                              description.edges());
+                description.edges());
 
-        this.clusterResults = Suppliers.memoize(() -> searchForClusters());
-        this.clusters = Suppliers.memoize(() -> buildTopologyClusters());
+        this.clusterResults = Suppliers.memoize(this::searchForClusters);
+        this.clusters = Suppliers.memoize(this::buildTopologyClusters);
 
-        this.clusterIndexes = Suppliers.memoize(() -> buildIndexes());
+        this.clusterIndexes = Suppliers.memoize(this::buildIndexes);
 
-        this.hopCountWeight = new HopCountLinkWeight(graph.getVertexes().size());
-        this.broadcastSets = Suppliers.memoize(() -> buildBroadcastSets());
-        this.infrastructurePoints = Suppliers.memoize(() -> findInfrastructurePoints());
+        this.hopCountWeigher = adapt(new HopCountLinkWeight(graph.getVertexes().size()));
+        this.broadcastSets = Suppliers.memoize(this::buildBroadcastSets);
+        this.infrastructurePoints = Suppliers.memoize(this::findInfrastructurePoints);
         this.computeCost = Math.max(0, System.nanoTime() - time);
     }
 
@@ -288,7 +296,8 @@
 
         // Find the cluster to which the device belongs.
         TopologyCluster cluster = clustersByDevice().get(connectPoint.deviceId());
-        checkArgument(cluster != null, "No cluster found for device %s", connectPoint.deviceId());
+        checkArgument(cluster != null,
+                "No cluster found for device %s", connectPoint.deviceId());
 
         // If the broadcast set is null or empty, or if the point explicitly
         // belongs to it, return true.
@@ -328,18 +337,17 @@
         return getPaths(src, dst, linkWeight(), ALL_PATHS);
     }
 
-
     /**
      * Computes on-demand the set of shortest paths between source and
      * destination devices.
      *
-     * @param src    source device
-     * @param dst    destination device
-     * @param weight link weight function
+     * @param src     source device
+     * @param dst     destination device
+     * @param weigher link weight function
      * @return set of shortest paths
      */
-    public Set<Path> getPaths(DeviceId src, DeviceId dst, LinkWeight weight) {
-        return getPaths(src, dst, weight, ALL_PATHS);
+    public Set<Path> getPaths(DeviceId src, DeviceId dst, LinkWeigher weigher) {
+        return getPaths(src, dst, weigher, ALL_PATHS);
     }
 
     /**
@@ -355,11 +363,11 @@
      *
      * @param src    source device
      * @param dst    destination device
-     * @param weight link weight function
+     * @param weigher link weight function
      * @param maxPaths maximum number of paths
      * @return set of shortest paths
      */
-    public Set<Path> getPaths(DeviceId src, DeviceId dst, LinkWeight weight,
+    public Set<Path> getPaths(DeviceId src, DeviceId dst, LinkWeigher weigher,
                               int maxPaths) {
         DefaultTopologyVertex srcV = new DefaultTopologyVertex(src);
         DefaultTopologyVertex dstV = new DefaultTopologyVertex(dst);
@@ -370,7 +378,7 @@
         }
 
         GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
-                graphPathSearch().search(graph, srcV, dstV, weight, maxPaths);
+                graphPathSearch().search(graph, srcV, dstV, weigher, maxPaths);
         ImmutableSet.Builder<Path> builder = ImmutableSet.builder();
         for (org.onlab.graph.Path<TopologyVertex, TopologyEdge> path : result.paths()) {
             builder.add(networkPath(path));
@@ -380,8 +388,8 @@
 
     /**
      * /**
-     * Returns the set of pre-computed shortest disjoint path pairs between source and
-     * destination devices.
+     * Returns the set of pre-computed shortest disjoint path pairs between
+     * source and destination devices.
      *
      * @param src source device
      * @param dst destination device
@@ -392,15 +400,16 @@
     }
 
     /**
-     * Computes on-demand the set of shortest disjoint path pairs between source and
-     * destination devices.
+     * Computes on-demand the set of shortest disjoint path pairs between
+     * source and destination devices.
      *
-     * @param src    source device
-     * @param dst    destination device
-     * @param weight link weight function
+     * @param src     source device
+     * @param dst     destination device
+     * @param weigher link weight function
      * @return set of disjoint shortest path pairs
      */
-    public Set<DisjointPath> getDisjointPaths(DeviceId src, DeviceId dst, LinkWeight weight) {
+    public Set<DisjointPath> getDisjointPaths(DeviceId src, DeviceId dst,
+                                              LinkWeigher weigher) {
         DefaultTopologyVertex srcV = new DefaultTopologyVertex(src);
         DefaultTopologyVertex dstV = new DefaultTopologyVertex(dst);
         Set<TopologyVertex> vertices = graph.getVertexes();
@@ -410,11 +419,11 @@
         }
 
         GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
-                SUURBALLE.search(graph, srcV, dstV, weight, ALL_PATHS);
+                SUURBALLE.search(graph, srcV, dstV, weigher, ALL_PATHS);
         ImmutableSet.Builder<DisjointPath> builder = ImmutableSet.builder();
         for (org.onlab.graph.Path<TopologyVertex, TopologyEdge> path : result.paths()) {
             DisjointPath disjointPath =
-                    networkDisjointPath((org.onlab.graph.DisjointPathPair<TopologyVertex, TopologyEdge>) path);
+                    networkDisjointPath((DisjointPathPair<TopologyVertex, TopologyEdge>) path);
             if (disjointPath.backup() != null) {
                 builder.add(disjointPath);
             }
@@ -423,16 +432,17 @@
     }
 
     /**
-     * Computes on-demand the set of shortest disjoint risk groups path pairs between source and
-     * destination devices.
+     * Computes on-demand the set of shortest disjoint risk groups path pairs
+     * between source and destination devices.
      *
      * @param src         source device
      * @param dst         destination device
-     * @param weight      edge weight object
+     * @param weigher     edge weight object
      * @param riskProfile map representing risk groups for each edge
      * @return set of shortest disjoint paths
      */
-    private Set<DisjointPath> disjointPaths(DeviceId src, DeviceId dst, LinkWeight weight,
+    private Set<DisjointPath> disjointPaths(DeviceId src, DeviceId dst,
+                                            LinkWeigher weigher,
                                             Map<TopologyEdge, Object> riskProfile) {
         DefaultTopologyVertex srcV = new DefaultTopologyVertex(src);
         DefaultTopologyVertex dstV = new DefaultTopologyVertex(dst);
@@ -443,13 +453,14 @@
             return ImmutableSet.of();
         }
 
-        SrlgGraphSearch<TopologyVertex, TopologyEdge> srlg = new SrlgGraphSearch<>(riskProfile);
+        SrlgGraphSearch<TopologyVertex, TopologyEdge> srlg =
+                new SrlgGraphSearch<>(riskProfile);
         GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
-                srlg.search(graph, srcV, dstV, weight, ALL_PATHS);
+                srlg.search(graph, srcV, dstV, weigher, ALL_PATHS);
         ImmutableSet.Builder<DisjointPath> builder = ImmutableSet.builder();
         for (org.onlab.graph.Path<TopologyVertex, TopologyEdge> path : result.paths()) {
             DisjointPath disjointPath =
-                    networkDisjointPath((org.onlab.graph.DisjointPathPair<TopologyVertex, TopologyEdge>) path);
+                    networkDisjointPath((DisjointPathPair<TopologyVertex, TopologyEdge>) path);
             if (disjointPath.backup() != null) {
                 builder.add(disjointPath);
             }
@@ -458,16 +469,17 @@
     }
 
     /**
-     * Computes on-demand the set of shortest disjoint risk groups path pairs between source and
-     * destination devices.
+     * Computes on-demand the set of shortest disjoint risk groups path pairs
+     * between source and destination devices.
      *
      * @param src         source device
      * @param dst         destination device
-     * @param weight      edge weight object
+     * @param weigher     edge weight object
      * @param riskProfile map representing risk groups for each link
      * @return set of shortest disjoint paths
      */
-    public Set<DisjointPath> getDisjointPaths(DeviceId src, DeviceId dst, LinkWeight weight,
+    public Set<DisjointPath> getDisjointPaths(DeviceId src, DeviceId dst,
+                                              LinkWeigher weigher,
                                               Map<Link, Object> riskProfile) {
         Map<TopologyEdge, Object> riskProfile2 = new HashMap<>();
         for (Link l : riskProfile.keySet()) {
@@ -490,49 +502,53 @@
                 }
             }, riskProfile.get(l));
         }
-        return disjointPaths(src, dst, weight, riskProfile2);
+        return disjointPaths(src, dst, weigher, riskProfile2);
     }
 
     /**
-     * Computes on-demand the set of shortest disjoint risk groups path pairs between source and
-     * destination devices.
+     * Computes on-demand the set of shortest disjoint risk groups path pairs
+     * between source and destination devices.
      *
      * @param src         source device
      * @param dst         destination device
      * @param riskProfile map representing risk groups for each link
      * @return set of shortest disjoint paths
      */
-    public Set<DisjointPath> getDisjointPaths(DeviceId src, DeviceId dst, Map<Link, Object> riskProfile) {
+    public Set<DisjointPath> getDisjointPaths(DeviceId src, DeviceId dst,
+                                              Map<Link, Object> riskProfile) {
         return getDisjointPaths(src, dst, linkWeight(), riskProfile);
     }
 
     // Converts graph path to a network path with the same cost.
     private Path networkPath(org.onlab.graph.Path<TopologyVertex, TopologyEdge> path) {
-        List<Link> links = path.edges().stream().map(TopologyEdge::link).collect(Collectors.toList());
+        List<Link> links = path.edges().stream().map(TopologyEdge::link)
+                .collect(Collectors.toList());
         return new DefaultPath(CORE_PROVIDER_ID, links, path.cost());
     }
 
-    private DisjointPath networkDisjointPath(DisjointPathPair<TopologyVertex, TopologyEdge> path) {
+    private DisjointPath networkDisjointPath(
+            DisjointPathPair<TopologyVertex, TopologyEdge> path) {
         if (!path.hasBackup()) {
             // There was no secondary path available.
             return new DefaultDisjointPath(CORE_PROVIDER_ID,
-                                           (DefaultPath) networkPath(path.primary()),
-                                           null);
+                    (DefaultPath) networkPath(path.primary()),
+                    null);
         }
         return new DefaultDisjointPath(CORE_PROVIDER_ID,
-                                       (DefaultPath) networkPath(path.primary()),
-                                       (DefaultPath) networkPath(path.secondary()));
+                (DefaultPath) networkPath(path.primary()),
+                (DefaultPath) networkPath(path.secondary()));
     }
 
     // Searches for SCC clusters in the network topology graph using Tarjan
     // algorithm.
     private SccResult<TopologyVertex, TopologyEdge> searchForClusters() {
-        return TARJAN.search(graph, new NoIndirectLinksWeight());
+        return TARJAN.search(graph, new NoIndirectLinksWeigher());
     }
 
     // Builds the topology clusters and returns the id-cluster bindings.
     private ImmutableMap<ClusterId, TopologyCluster> buildTopologyClusters() {
-        ImmutableMap.Builder<ClusterId, TopologyCluster> clusterBuilder = ImmutableMap.builder();
+        ImmutableMap.Builder<ClusterId, TopologyCluster> clusterBuilder =
+                ImmutableMap.builder();
         SccResult<TopologyVertex, TopologyEdge> results = clusterResults.get();
 
         // Extract both vertexes and edges from the results; the lists form
@@ -547,9 +563,9 @@
 
             ClusterId cid = ClusterId.clusterId(i);
             DefaultTopologyCluster cluster = new DefaultTopologyCluster(cid,
-                                                                        vertexSet.size(),
-                                                                        edgeSet.size(),
-                                                                        findRoot(vertexSet));
+                    vertexSet.size(),
+                    edgeSet.size(),
+                    findRoot(vertexSet));
             clusterBuilder.put(cid, cluster);
         }
         return clusterBuilder.build();
@@ -580,10 +596,13 @@
     // Finds all broadcast points for the cluster. These are those connection
     // points which lie along the shortest paths between the cluster root and
     // all other devices within the cluster.
-    private void addClusterBroadcastSet(TopologyCluster cluster, Builder<ClusterId, ConnectPoint> builder) {
+    private void addClusterBroadcastSet(TopologyCluster cluster,
+                                        Builder<ClusterId, ConnectPoint> builder) {
         // Use the graph root search results to build the broadcast set.
-        Result<TopologyVertex, TopologyEdge> result = DIJKSTRA.search(graph, cluster.root(), null, hopCountWeight, 1);
-        for (Map.Entry<TopologyVertex, Set<TopologyEdge>> entry : result.parents().entrySet()) {
+        Result<TopologyVertex, TopologyEdge> result =
+                DIJKSTRA.search(graph, cluster.root(), null, hopCountWeigher, 1);
+        for (Map.Entry<TopologyVertex, Set<TopologyEdge>> entry :
+                result.parents().entrySet()) {
             TopologyVertex vertex = entry.getKey();
 
             // Ignore any parents that lead outside the cluster.
@@ -649,24 +668,27 @@
 
         // Finalize all indexes.
         return new ClusterIndexes(clusterBuilder.build(),
-                                  devicesBuilder.build(),
-                                  linksBuilder.build());
+                devicesBuilder.build(),
+                linksBuilder.build());
     }
 
     private GraphPathSearch<TopologyVertex, TopologyEdge> graphPathSearch() {
         return defaultGraphPathSearch != null ? defaultGraphPathSearch : DIJKSTRA;
     }
 
-    private LinkWeight linkWeight() {
-        return defaultLinkWeight != null ? defaultLinkWeight : hopCountWeight;
+    private LinkWeigher linkWeight() {
+        return defaultLinkWeigher != null ? defaultLinkWeigher : hopCountWeigher;
     }
 
     // Link weight for preventing traversal over indirect links.
-    private static class NoIndirectLinksWeight implements LinkWeight {
+    private static class NoIndirectLinksWeigher
+            extends DefaultEdgeWeigher<TopologyVertex, TopologyEdge>
+            implements LinkWeigher {
         @Override
-        public double weight(TopologyEdge edge) {
-            return (edge.link().state() == INACTIVE)
-                    || (edge.link().type() == INDIRECT) ? -1 : 1;
+        public Weight weight(TopologyEdge edge) {
+            return (edge.link().state() == INACTIVE) ||
+                    (edge.link().type() == INDIRECT) ?
+                    getNonViableWeight() : new ScalarWeight(HOP_WEIGHT_VALUE);
         }
     }
 
diff --git a/core/common/src/test/java/org/onosproject/common/DefaultTopologyTest.java b/core/common/src/test/java/org/onosproject/common/DefaultTopologyTest.java
index 2bf8cb7..48403d5 100644
--- a/core/common/src/test/java/org/onosproject/common/DefaultTopologyTest.java
+++ b/core/common/src/test/java/org/onosproject/common/DefaultTopologyTest.java
@@ -17,6 +17,9 @@
 
 import org.junit.Before;
 import org.junit.Test;
+import org.onlab.graph.DefaultEdgeWeigher;
+import org.onlab.graph.ScalarWeight;
+import org.onlab.graph.Weight;
 import org.onlab.packet.ChassisId;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DefaultDevice;
@@ -31,8 +34,9 @@
 import org.onosproject.net.topology.DefaultGraphDescription;
 import org.onosproject.net.topology.DefaultTopologyVertex;
 import org.onosproject.net.topology.GraphDescription;
-import org.onosproject.net.topology.LinkWeight;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.TopologyCluster;
+import org.onosproject.net.topology.TopologyEdge;
 import org.onosproject.net.topology.TopologyVertex;
 
 import java.util.Set;
@@ -61,9 +65,19 @@
     public static final PortNumber P1 = portNumber(1);
     public static final PortNumber P2 = portNumber(2);
 
-    public static final LinkWeight WEIGHT = edge ->
-            edge.src().deviceId().equals(D4) || edge.dst().deviceId().equals(D4)
-                    ? 2.0 : 1.0;
+    public static final class TestLinkWeigher
+            extends DefaultEdgeWeigher<TopologyVertex, TopologyEdge>
+            implements LinkWeigher {
+        @Override
+        public Weight weight(TopologyEdge edge) {
+            double value = edge.src().deviceId().equals(D4) ||
+                    edge.dst().deviceId().equals(D4)
+                    ? 2.0 : HOP_WEIGHT_VALUE;
+            return new ScalarWeight(value);
+        }
+    }
+    public static final LinkWeigher WEIGHER = new TestLinkWeigher();
+
 
     private DefaultTopology dt;
 
@@ -105,7 +119,7 @@
         paths = dt.getPaths(D1, D5);
         assertTrue("no paths expected", paths.isEmpty());
 
-        paths = dt.getPaths(D1, D3, WEIGHT);
+        paths = dt.getPaths(D1, D3, WEIGHER);
         assertEquals("incorrect path count", 1, paths.size());
     }
 
diff --git a/core/common/src/test/java/org/onosproject/store/trivial/SimpleTopologyStore.java b/core/common/src/test/java/org/onosproject/store/trivial/SimpleTopologyStore.java
index 313d08e..708e38d 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SimpleTopologyStore.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SimpleTopologyStore.java
@@ -29,6 +29,7 @@
 import org.onosproject.net.provider.ProviderId;
 import org.onosproject.net.topology.ClusterId;
 import org.onosproject.net.topology.GraphDescription;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.LinkWeight;
 import org.onosproject.net.topology.Topology;
 import org.onosproject.net.topology.TopologyCluster;
@@ -43,6 +44,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import static org.onosproject.net.topology.AdapterLinkWeigher.adapt;
 import static org.slf4j.LoggerFactory.getLogger;
 
 /**
@@ -112,7 +114,13 @@
     @Override
     public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
                               LinkWeight weight) {
-        return defaultTopology(topology).getPaths(src, dst, weight);
+        return getPaths(topology, src, dst, adapt(weight));
+    }
+
+    @Override
+    public Set<Path> getPaths(Topology topology, DeviceId src,
+                              DeviceId dst, LinkWeigher weigher) {
+        return defaultTopology(topology).getPaths(src, dst, weigher);
     }
 
     @Override
@@ -123,7 +131,13 @@
     @Override
     public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
                                               LinkWeight weight) {
-        return defaultTopology(topology).getDisjointPaths(src, dst, weight);
+        return getDisjointPaths(topology, src, dst, adapt(weight));
+    }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst, LinkWeigher weigher) {
+        return defaultTopology(topology).getDisjointPaths(src, dst, weigher);
     }
 
     @Override
@@ -135,7 +149,15 @@
     @Override
     public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
                                                   LinkWeight weight, Map<Link, Object> riskProfile) {
-        return defaultTopology(topology).getDisjointPaths(src, dst, weight, riskProfile);
+        return getDisjointPaths(topology, src, dst, adapt(weight), riskProfile);
+    }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst,
+                                              LinkWeigher weigher,
+                                              Map<Link, Object> riskProfile) {
+        return defaultTopology(topology).getDisjointPaths(src, dst, weigher, riskProfile);
     }
 
     @Override
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java
index cb57aee..81e0fcc8 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java
@@ -20,6 +20,9 @@
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.graph.DefaultEdgeWeigher;
+import org.onlab.graph.ScalarWeight;
+import org.onlab.graph.Weight;
 import org.onosproject.net.DisjointPath;
 import org.onosproject.net.ElementId;
 import org.onosproject.net.Path;
@@ -30,9 +33,10 @@
 import org.onosproject.net.intent.impl.PathNotFoundException;
 import org.onosproject.net.resource.ResourceQueryService;
 import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.topology.LinkWeight;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.PathService;
 import org.onosproject.net.topology.TopologyEdge;
+import org.onosproject.net.topology.TopologyVertex;
 
 import java.util.Collections;
 import java.util.Iterator;
@@ -65,8 +69,8 @@
      * @param constraints path constraints
      * @return edge-weight function
      */
-    protected LinkWeight weight(List<Constraint> constraints) {
-        return new ConstraintBasedLinkWeight(constraints);
+    protected LinkWeigher weigher(List<Constraint> constraints) {
+        return new ConstraintBasedLinkWeigher(constraints);
     }
 
     /**
@@ -115,7 +119,7 @@
      */
     protected Path getPath(ConnectivityIntent intent,
                            ElementId one, ElementId two) {
-        Set<Path> paths = pathService.getPaths(one, two, weight(intent.constraints()));
+        Set<Path> paths = pathService.getPaths(one, two, weigher(intent.constraints()));
         final List<Constraint> constraints = intent.constraints();
         ImmutableList<Path> filtered = FluentIterable.from(paths)
                 .filter(path -> checkPath(path, constraints))
@@ -138,7 +142,7 @@
      */
     protected DisjointPath getDisjointPath(ConnectivityIntent intent,
                            ElementId one, ElementId two) {
-        Set<DisjointPath> paths = pathService.getDisjointPaths(one, two, weight(intent.constraints()));
+        Set<DisjointPath> paths = pathService.getDisjointPaths(one, two, weigher(intent.constraints()));
         final List<Constraint> constraints = intent.constraints();
         ImmutableList<DisjointPath> filtered = FluentIterable.from(paths)
                 .filter(path -> checkPath(path, constraints))
@@ -153,7 +157,8 @@
     /**
      * Edge-weight capable of evaluating link cost using a set of constraints.
      */
-    protected class ConstraintBasedLinkWeight implements LinkWeight {
+    protected class ConstraintBasedLinkWeigher extends DefaultEdgeWeigher<TopologyVertex, TopologyEdge>
+            implements LinkWeigher {
 
         private final List<Constraint> constraints;
 
@@ -163,7 +168,7 @@
          *
          * @param constraints path constraints
          */
-        ConstraintBasedLinkWeight(List<Constraint> constraints) {
+        ConstraintBasedLinkWeigher(List<Constraint> constraints) {
             if (constraints == null) {
                 this.constraints = Collections.emptyList();
             } else {
@@ -172,23 +177,23 @@
         }
 
         @Override
-        public double weight(TopologyEdge edge) {
+        public Weight weight(TopologyEdge edge) {
 
             // iterate over all constraints in order and return the weight of
             // the first one with fast fail over the first failure
             Iterator<Constraint> it = constraints.iterator();
 
             if (!it.hasNext()) {
-                return 1.0;
+                return new ScalarWeight(HOP_WEIGHT_VALUE);
             }
 
             double cost = it.next().cost(edge.link(), resourceService::isAvailable);
             while (it.hasNext() && cost > 0) {
                 if (it.next().cost(edge.link(), resourceService::isAvailable) < 0) {
-                    return -1;
+                    cost = -1;
                 }
             }
-            return cost;
+            return new ScalarWeight(cost);
 
         }
     }
diff --git a/core/net/src/main/java/org/onosproject/net/topology/impl/PathManager.java b/core/net/src/main/java/org/onosproject/net/topology/impl/PathManager.java
index 5c41ff4..ec650da 100644
--- a/core/net/src/main/java/org/onosproject/net/topology/impl/PathManager.java
+++ b/core/net/src/main/java/org/onosproject/net/topology/impl/PathManager.java
@@ -26,6 +26,7 @@
 import org.onosproject.net.Link;
 import org.onosproject.net.Path;
 import org.onosproject.net.host.HostService;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.LinkWeight;
 import org.onosproject.net.topology.PathService;
 import org.onosproject.net.topology.TopologyService;
@@ -74,7 +75,7 @@
     public Set<Path> getPaths(ElementId src, ElementId dst) {
         checkPermission(TOPOLOGY_READ);
 
-        return getPaths(src, dst, null);
+        return getPaths(src, dst, (LinkWeigher) null);
     }
 
     @Override
@@ -83,11 +84,17 @@
         return super.getPaths(src, dst, weight);
     }
 
+    @Override
+    public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeigher weigher) {
+        checkPermission(TOPOLOGY_READ);
+        return super.getPaths(src, dst, weigher);
+    }
+
 
     @Override
     public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst) {
         checkPermission(TOPOLOGY_READ);
-        return getDisjointPaths(src, dst, (LinkWeight) null);
+        return getDisjointPaths(src, dst, (LinkWeigher) null);
     }
 
     @Override
@@ -97,10 +104,16 @@
     }
 
     @Override
+    public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeigher weigher) {
+        checkPermission(TOPOLOGY_READ);
+        return super.getDisjointPaths(src, dst, weigher);
+    }
+
+    @Override
     public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
                                               Map<Link, Object> riskProfile) {
         checkPermission(TOPOLOGY_READ);
-        return getDisjointPaths(src, dst, null, riskProfile);
+        return getDisjointPaths(src, dst, (LinkWeigher) null, riskProfile);
     }
 
     @Override
@@ -110,4 +123,11 @@
         return super.getDisjointPaths(src, dst, weight, riskProfile);
     }
 
+    @Override
+    public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeigher weigher,
+                                              Map<Link, Object> riskProfile) {
+        checkPermission(TOPOLOGY_READ);
+        return super.getDisjointPaths(src, dst, weigher, riskProfile);
+    }
+
 }
diff --git a/core/net/src/main/java/org/onosproject/net/topology/impl/TopologyManager.java b/core/net/src/main/java/org/onosproject/net/topology/impl/TopologyManager.java
index 4203a8e..ecf7e25 100644
--- a/core/net/src/main/java/org/onosproject/net/topology/impl/TopologyManager.java
+++ b/core/net/src/main/java/org/onosproject/net/topology/impl/TopologyManager.java
@@ -31,6 +31,7 @@
 import org.onosproject.net.provider.AbstractProviderService;
 import org.onosproject.net.topology.ClusterId;
 import org.onosproject.net.topology.GraphDescription;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.LinkWeight;
 import org.onosproject.net.topology.Topology;
 import org.onosproject.net.topology.TopologyCluster;
@@ -50,6 +51,7 @@
 import java.util.Map;
 
 import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.net.topology.AdapterLinkWeigher.adapt;
 import static org.onosproject.security.AppGuard.checkPermission;
 import static org.slf4j.LoggerFactory.getLogger;
 import static org.onosproject.security.AppPermission.Type.*;
@@ -154,18 +156,26 @@
     }
 
     @Override
-    public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, LinkWeight weight) {
+    public Set<Path> getPaths(Topology topology, DeviceId src,
+                              DeviceId dst, LinkWeight weight) {
+        return getPaths(topology, src, dst, adapt(weight));
+    }
+
+    @Override
+    public Set<Path> getPaths(Topology topology, DeviceId src,
+                              DeviceId dst, LinkWeigher weigher) {
         checkPermission(TOPOLOGY_READ);
 
         checkNotNull(topology, TOPOLOGY_NULL);
         checkNotNull(src, DEVICE_ID_NULL);
         checkNotNull(dst, DEVICE_ID_NULL);
-        checkNotNull(weight, "Link weight cannot be null");
-        return store.getPaths(topology, src, dst, weight);
+        checkNotNull(weigher, "Link weight cannot be null");
+        return store.getPaths(topology, src, dst, weigher);
     }
 
     @Override
-    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst) {
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst) {
         checkPermission(TOPOLOGY_READ);
         checkNotNull(topology, TOPOLOGY_NULL);
         checkNotNull(src, DEVICE_ID_NULL);
@@ -175,17 +185,26 @@
 
     @Override
     public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
-                                              DeviceId dst, LinkWeight weight) {
+                                              DeviceId dst,
+                                              LinkWeight weight) {
+        return getDisjointPaths(topology, src, dst, adapt(weight));
+    }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst,
+                                              LinkWeigher weigher) {
         checkPermission(TOPOLOGY_READ);
         checkNotNull(topology, TOPOLOGY_NULL);
         checkNotNull(src, DEVICE_ID_NULL);
         checkNotNull(dst, DEVICE_ID_NULL);
-        checkNotNull(weight, LINK_WEIGHT_NULL);
-        return store.getDisjointPaths(topology, src, dst, weight);
+        checkNotNull(weigher, LINK_WEIGHT_NULL);
+        return store.getDisjointPaths(topology, src, dst, weigher);
     }
 
     @Override
-    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst,
                                               Map<Link, Object> riskProfile) {
         checkPermission(TOPOLOGY_READ);
         checkNotNull(topology, TOPOLOGY_NULL);
@@ -198,12 +217,20 @@
     public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
                                               DeviceId dst, LinkWeight weight,
                                               Map<Link, Object> riskProfile) {
+        return getDisjointPaths(topology, src, dst, adapt(weight), riskProfile);
+    }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst,
+                                              LinkWeigher weigher,
+                                              Map<Link, Object> riskProfile) {
         checkPermission(TOPOLOGY_READ);
         checkNotNull(topology, TOPOLOGY_NULL);
         checkNotNull(src, DEVICE_ID_NULL);
         checkNotNull(dst, DEVICE_ID_NULL);
-        checkNotNull(weight, LINK_WEIGHT_NULL);
-        return store.getDisjointPaths(topology, src, dst, weight, riskProfile);
+        checkNotNull(weigher, LINK_WEIGHT_NULL);
+        return store.getDisjointPaths(topology, src, dst, weigher, riskProfile);
     }
 
     @Override
diff --git a/core/net/src/test/java/org/onosproject/net/topology/impl/PathManagerTest.java b/core/net/src/test/java/org/onosproject/net/topology/impl/PathManagerTest.java
index 18e6402..cca8b4a 100644
--- a/core/net/src/test/java/org/onosproject/net/topology/impl/PathManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/topology/impl/PathManagerTest.java
@@ -26,7 +26,7 @@
 import org.onosproject.net.Path;
 import org.onosproject.net.host.HostServiceAdapter;
 import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.topology.LinkWeight;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.PathService;
 import org.onosproject.net.topology.Topology;
 import org.onosproject.net.topology.TopologyServiceAdapter;
@@ -140,12 +140,14 @@
         Set<Path> paths = new HashSet<>();
 
         @Override
-        public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst) {
+        public Set<Path> getPaths(Topology topology, DeviceId src,
+                                  DeviceId dst) {
             return paths;
         }
 
         @Override
-        public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, LinkWeight weight) {
+        public Set<Path> getPaths(Topology topology, DeviceId src,
+                                  DeviceId dst, LinkWeigher weight) {
             return paths;
         }
     }
diff --git a/core/store/dist/src/main/java/org/onosproject/store/topology/impl/DistributedTopologyStore.java b/core/store/dist/src/main/java/org/onosproject/store/topology/impl/DistributedTopologyStore.java
index cbfacad..db5b83b 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/topology/impl/DistributedTopologyStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/topology/impl/DistributedTopologyStore.java
@@ -40,6 +40,7 @@
 import org.onosproject.net.topology.DefaultGraphDescription;
 import org.onosproject.net.topology.GeoDistanceLinkWeight;
 import org.onosproject.net.topology.GraphDescription;
+import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.LinkWeight;
 import org.onosproject.net.topology.MetricLinkWeight;
 import org.onosproject.net.topology.PathAdminService;
@@ -72,6 +73,7 @@
 import static com.google.common.base.Preconditions.checkArgument;
 import static org.onlab.util.Tools.get;
 import static org.onlab.util.Tools.isNullOrEmpty;
+import static org.onosproject.net.topology.AdapterLinkWeigher.adapt;
 import static org.onosproject.net.topology.TopologyEvent.Type.TOPOLOGY_CHANGED;
 import static org.slf4j.LoggerFactory.getLogger;
 
@@ -214,7 +216,13 @@
     @Override
     public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
                               LinkWeight weight) {
-        return defaultTopology(topology).getPaths(src, dst, weight);
+        return getPaths(topology, src, dst, adapt(weight));
+    }
+
+    @Override
+    public Set<Path> getPaths(Topology topology, DeviceId src,
+                              DeviceId dst, LinkWeigher weigher) {
+        return defaultTopology(topology).getPaths(src, dst, weigher);
     }
 
     @Override
@@ -225,7 +233,13 @@
     @Override
     public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
                                               LinkWeight weight) {
-        return defaultTopology(topology).getDisjointPaths(src, dst, weight);
+        return getDisjointPaths(topology, src, dst, adapt(weight));
+    }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst, LinkWeigher weigher) {
+        return defaultTopology(topology).getDisjointPaths(src, dst, weigher);
     }
 
     @Override
@@ -237,7 +251,14 @@
     @Override
     public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
                                               LinkWeight weight, Map<Link, Object> riskProfile) {
-        return defaultTopology(topology).getDisjointPaths(src, dst, weight, riskProfile);
+        return getDisjointPaths(topology, src, dst, adapt(weight), riskProfile);
+    }
+
+    @Override
+    public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                              DeviceId dst, LinkWeigher weigher,
+                                              Map<Link, Object> riskProfile) {
+        return defaultTopology(topology).getDisjointPaths(src, dst, weigher, riskProfile);
     }
 
     @Override
@@ -315,7 +336,12 @@
 
     @Override
     public void setDefaultLinkWeight(LinkWeight linkWeight) {
-        DefaultTopology.setDefaultLinkWeight(linkWeight);
+        DefaultTopology.setDefaultLinkWeigher(adapt(linkWeight));
+    }
+
+    @Override
+    public void setDefaultLinkWeigher(LinkWeigher linkWeigher) {
+        DefaultTopology.setDefaultLinkWeigher(linkWeigher);
     }
 
     @Override