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);
}
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);
}
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());
}
}
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());
}
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());
}
Aggregations