Thomas Vachuska

Fixed PathManager cost for edge-to-edge path.

Change-Id: I6a6a637839e32159e76df80d721f29fca83bf5ce
...@@ -265,18 +265,23 @@ public class PathManager implements PathService { ...@@ -265,18 +265,23 @@ public class PathManager implements PathService {
265 // Produces a direct edge-to-edge path. 265 // Produces a direct edge-to-edge path.
266 private Path edgeToEdgePath(EdgeLink srcLink, EdgeLink dstLink, Path path) { 266 private Path edgeToEdgePath(EdgeLink srcLink, EdgeLink dstLink, Path path) {
267 List<Link> links = Lists.newArrayListWithCapacity(2); 267 List<Link> links = Lists.newArrayListWithCapacity(2);
268 + double cost = 0;
269 +
268 // Add source and destination edge links only if they are real and 270 // Add source and destination edge links only if they are real and
269 // add the infrastructure path only if it is not null. 271 // add the infrastructure path only if it is not null.
270 if (srcLink != NOT_HOST) { 272 if (srcLink != NOT_HOST) {
271 links.add(srcLink); 273 links.add(srcLink);
274 + cost++;
272 } 275 }
273 if (path != null) { 276 if (path != null) {
274 links.addAll(path.links()); 277 links.addAll(path.links());
278 + cost += path.cost();
275 } 279 }
276 if (dstLink != NOT_HOST) { 280 if (dstLink != NOT_HOST) {
277 links.add(dstLink); 281 links.add(dstLink);
282 + cost++;
278 } 283 }
279 - return new DefaultPath(PID, links, 2); 284 + return new DefaultPath(PID, links, cost);
280 } 285 }
281 286
282 // Produces a direct edge-to-edge path. 287 // Produces a direct edge-to-edge path.
......