Search in sources :

Example 1 with Weight

use of org.onlab.graph.Weight in project onos by opennetworkinglab.

the class AbstractPathService method edgeToEdgePath.

// Produces a direct edge-to-edge path.
private Path edgeToEdgePath(EdgeLink srcLink, EdgeLink dstLink, Path path, LinkWeigher weigher) {
    List<Link> links = Lists.newArrayListWithCapacity(2);
    Weight cost = weigher.getInitialWeight();
    // add the infrastructure path only if it is not null.
    if (srcLink != NOT_HOST) {
        links.add(srcLink);
        cost = cost.merge(weigher.weight(new DefaultTopologyEdge(null, null, srcLink)));
    }
    if (path != null) {
        links.addAll(path.links());
        cost = cost.merge(path.weight());
    }
    if (dstLink != NOT_HOST) {
        links.add(dstLink);
        cost = cost.merge(weigher.weight(new DefaultTopologyEdge(null, null, dstLink)));
    }
    return new DefaultPath(PID, links, cost);
}
Also used : DefaultPath(org.onosproject.net.DefaultPath) Link(org.onosproject.net.Link) DefaultEdgeLink(org.onosproject.net.DefaultEdgeLink) EdgeLink(org.onosproject.net.EdgeLink) Weight(org.onlab.graph.Weight)

Aggregations

Weight (org.onlab.graph.Weight)1 DefaultEdgeLink (org.onosproject.net.DefaultEdgeLink)1 DefaultPath (org.onosproject.net.DefaultPath)1 EdgeLink (org.onosproject.net.EdgeLink)1 Link (org.onosproject.net.Link)1