Search in sources :

Example 26 with Path

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

the class PathManagerTest method edgeToInfra.

@Test
public void edgeToInfra() {
    HostId src = hid("12:34:56:78:90:ab/1");
    DeviceId dst = did("dst");
    fakeTopoMgr.paths.add(createPath("edge", "middle", "dst"));
    fakeHostMgr.hosts.put(src, 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 27 with Path

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

the class PathManagerTest method edgeToEdge.

@Test
public void edgeToEdge() {
    HostId src = hid("12:34:56:78:90:ab/1");
    HostId dst = hid("12:34:56:78:90:ef/1");
    fakeTopoMgr.paths.add(createPath("srcEdge", "middle", "dstEdge"));
    fakeHostMgr.hosts.put(src, host("12:34:56:78:90:ab/1", "srcEdge"));
    fakeHostMgr.hosts.put(dst, host("12:34:56:78:90:ef/1", "dstEdge"));
    Set<Path> paths = service.getPaths(src, dst);
    validatePaths(paths, 1, 4, src, dst);
    validatePaths(service.getKShortestPaths(src, dst).collect(Collectors.toSet()), 1, 4, src, dst);
}
Also used : Path(org.onosproject.net.Path) HostId(org.onosproject.net.HostId) Test(org.junit.Test)

Example 28 with Path

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

the class PathManagerTest method validatePaths.

// Makes sure the set of paths meets basic expectations.
private void validatePaths(Set<Path> paths, int count, int length, ElementId src, ElementId dst) {
    assertEquals("incorrect path count", count, paths.size());
    for (Path path : paths) {
        assertEquals("incorrect length", length, path.links().size());
        assertEquals("incorrect source", src, path.src().elementId());
        assertEquals("incorrect destination", dst, path.dst().elementId());
    }
}
Also used : Path(org.onosproject.net.Path)

Example 29 with Path

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

the class TopologyManagerTest method precomputedPath.

@Test
public void precomputedPath() {
    submitTopologyGraph();
    Topology topology = service.currentTopology();
    Set<Path> paths = service.getPaths(topology, did("a"), did("c"));
    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(2), path.weight());
}
Also used : Path(org.onosproject.net.Path) Topology(org.onosproject.net.topology.Topology) Test(org.junit.Test)

Example 30 with Path

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

the class VirtualNetworkPathManagerTest method testGetPathsOnEmptyVnet.

/**
 * Tests getPaths(), getDisjointPaths()
 * on an empty virtual network.
 */
@Test
public void testGetPathsOnEmptyVnet() {
    VirtualNetwork vnet = setupEmptyVnet();
    PathService pathService = manager.get(vnet.id(), PathService.class);
    Set<Path> paths = pathService.getPaths(DID1, DID3);
    assertEquals("incorrect path count", 0, paths.size());
    Set<DisjointPath> disjointPaths = pathService.getDisjointPaths(DID1, DID3);
    assertEquals("incorrect path count", 0, disjointPaths.size());
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) Path(org.onosproject.net.Path) DisjointPath(org.onosproject.net.DisjointPath) PathService(org.onosproject.net.topology.PathService) DisjointPath(org.onosproject.net.DisjointPath) Test(org.junit.Test)

Aggregations

Path (org.onosproject.net.Path)60 DeviceId (org.onosproject.net.DeviceId)27 DefaultPath (org.onosproject.net.DefaultPath)24 Link (org.onosproject.net.Link)23 DisjointPath (org.onosproject.net.DisjointPath)22 ConnectPoint (org.onosproject.net.ConnectPoint)18 Test (org.junit.Test)16 ImmutableSet (com.google.common.collect.ImmutableSet)12 ArrayList (java.util.ArrayList)11 List (java.util.List)11 Set (java.util.Set)11 Collectors (java.util.stream.Collectors)10 DefaultLink (org.onosproject.net.DefaultLink)10 Intent (org.onosproject.net.intent.Intent)10 Collections (java.util.Collections)9 Topology (org.onosproject.net.topology.Topology)8 Logger (org.slf4j.Logger)8 Stream (java.util.stream.Stream)7 ScalarWeight (org.onlab.graph.ScalarWeight)7 HostId (org.onosproject.net.HostId)7