Search in sources :

Example 46 with Path

use of org.onosproject.net.Path in project onos by opennetworkinglab.

the class TopologyManagerTest method onDemandPath.

@Test
public void onDemandPath() {
    submitTopologyGraph();
    Topology topology = service.currentTopology();
    LinkWeigher weight = new LinkWeigherAdapter(3.3);
    Set<Path> paths = service.getPaths(topology, did("a"), did("c"), weight);
    assertEquals("wrong path count", 2, paths.size());
    Path path = paths.iterator().next();
    assertEquals("wrong path length", 2, path.links().size());
    assertEquals("wrong path cost", ScalarWeight.toWeight(6.6), path.weight());
}
Also used : LinkWeigherAdapter(org.onosproject.net.topology.LinkWeigherAdapter) Path(org.onosproject.net.Path) LinkWeigher(org.onosproject.net.topology.LinkWeigher) Topology(org.onosproject.net.topology.Topology) Test(org.junit.Test)

Example 47 with Path

use of org.onosproject.net.Path in project onos by opennetworkinglab.

the class PathManagerTest method infraToEdge.

@Test
public void infraToEdge() {
    DeviceId src = did("src");
    HostId dst = hid("12:34:56:78:90:ab/1");
    fakeTopoMgr.paths.add(createPath("src", "middle", "edge"));
    fakeHostMgr.hosts.put(dst, host("12:34:56:78:90:ab/1", "edge"));
    Set<Path> paths = service.getPaths(src, dst);
    validatePaths(paths, 1, 3, src, dst);
}
Also used : Path(org.onosproject.net.Path) DeviceId(org.onosproject.net.DeviceId) HostId(org.onosproject.net.HostId) Test(org.junit.Test)

Example 48 with Path

use of org.onosproject.net.Path in project onos by opennetworkinglab.

the class PathManagerTest method infraToInfra.

@Test
public void infraToInfra() {
    DeviceId src = did("src");
    DeviceId dst = did("dst");
    fakeTopoMgr.paths.add(createPath("src", "middle", "dst"));
    Set<Path> paths = service.getPaths(src, dst);
    validatePaths(paths, 1, 2, src, dst);
    validatePaths(service.getKShortestPaths(src, dst).collect(Collectors.toSet()), 1, 2, src, dst);
}
Also used : Path(org.onosproject.net.Path) DeviceId(org.onosproject.net.DeviceId) Test(org.junit.Test)

Aggregations

Path (org.onosproject.net.Path)48 DisjointPath (org.onosproject.net.DisjointPath)22 DefaultPath (org.onosproject.net.DefaultPath)19 DeviceId (org.onosproject.net.DeviceId)19 Test (org.junit.Test)16 Link (org.onosproject.net.Link)14 ConnectPoint (org.onosproject.net.ConnectPoint)13 ImmutableSet (com.google.common.collect.ImmutableSet)10 Intent (org.onosproject.net.intent.Intent)10 Topology (org.onosproject.net.topology.Topology)10 Set (java.util.Set)9 ArrayList (java.util.ArrayList)8 List (java.util.List)8 Collectors (java.util.stream.Collectors)8 Collections (java.util.Collections)7 Stream (java.util.stream.Stream)7 ScalarWeight (org.onlab.graph.ScalarWeight)7 LinkCollectionIntent (org.onosproject.net.intent.LinkCollectionIntent)7 Activate (org.osgi.service.component.annotations.Activate)7 Component (org.osgi.service.component.annotations.Component)7