Fixed PathManager cost for edge-to-edge path.
Change-Id: I6a6a637839e32159e76df80d721f29fca83bf5ce
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 dc289e2..7dbe782 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
@@ -265,18 +265,23 @@
// Produces a direct edge-to-edge path.
private Path edgeToEdgePath(EdgeLink srcLink, EdgeLink dstLink, Path path) {
List<Link> links = Lists.newArrayListWithCapacity(2);
+ double cost = 0;
+
// 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++;
}
if (path != null) {
links.addAll(path.links());
+ cost += path.cost();
}
if (dstLink != NOT_HOST) {
links.add(dstLink);
+ cost++;
}
- return new DefaultPath(PID, links, 2);
+ return new DefaultPath(PID, links, cost);
}
// Produces a direct edge-to-edge path.