use of org.onosproject.net.topology.DefaultGraphDescription in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManager method currentTopology.
@Override
public Topology currentTopology() {
Iterable<Device> devices = manager.getVirtualDevices(networkId()).stream().collect(Collectors.toSet());
Iterable<Link> links = manager.getVirtualLinks(networkId()).stream().collect(Collectors.toSet());
DefaultGraphDescription graph = new DefaultGraphDescription(System.nanoTime(), System.currentTimeMillis(), devices, links);
return new DefaultTopology(PID, graph);
}
use of org.onosproject.net.topology.DefaultGraphDescription in project onos by opennetworkinglab.
the class TopologyManagerTest method submitTopologyGraph.
private void submitTopologyGraph() {
Set<Device> devices = of(device("a"), device("b"), device("c"), device("d"), device("e"), device("f"));
Set<Link> links = of(link("a", 1, "b", 1), link("b", 1, "a", 1), link("b", 2, "c", 1), link("c", 1, "b", 2), link("c", 2, "d", 1), link("d", 1, "c", 2), link("d", 2, "a", 2), link("a", 2, "d", 2), link("e", 1, "f", 1), link("f", 1, "e", 1));
GraphDescription data = new DefaultGraphDescription(4321L, System.currentTimeMillis(), devices, links);
providerService.topologyChanged(data, null);
}
use of org.onosproject.net.topology.DefaultGraphDescription in project onos by opennetworkinglab.
the class DefaultTopologyProvider method buildTopology.
// Builds the topology using the latest device and link information
// and citing the specified events as reasons for the change.
private void buildTopology(List<Event> reasons) {
if (isStarted) {
GraphDescription desc = new DefaultGraphDescription(System.nanoTime(), System.currentTimeMillis(), deviceService.getAvailableDevices(), linkService.getActiveLinks());
providerService.topologyChanged(desc, reasons);
}
}
use of org.onosproject.net.topology.DefaultGraphDescription in project onos by opennetworkinglab.
the class DefaultTopologyTest method setUp.
@Before
public void setUp() {
long now = System.currentTimeMillis();
Set<Device> devices = of(device("1"), device("2"), device("3"), device("4"), device("5"));
Set<Link> links = of(link("1", 1, "2", 1), link("2", 1, "1", 1), link("3", 2, "2", 2), link("2", 2, "3", 2), link("1", 3, "4", 3), link("4", 3, "1", 3), link("3", 4, "4", 4), link("4", 4, "3", 4));
GraphDescription graphDescription = new DefaultGraphDescription(now, System.currentTimeMillis(), devices, links);
dt = new DefaultTopology(PID, graphDescription);
assertEquals("incorrect supplier", PID, dt.providerId());
assertEquals("incorrect time", now, dt.time());
assertEquals("incorrect device count", 5, dt.deviceCount());
assertEquals("incorrect link count", 8, dt.linkCount());
assertEquals("incorrect cluster count", 2, dt.clusterCount());
assertEquals("incorrect broadcast set size", 6, dt.broadcastSetSize(C0));
assertEquals("incorrect root node", V1, dt.getCluster(C0).root());
assertEquals("incorrect root node", V5, dt.getCluster(C1).root());
}
use of org.onosproject.net.topology.DefaultGraphDescription in project onos by opennetworkinglab.
the class MQEventHandlerTest method submitTopologyGraph.
private void submitTopologyGraph() {
Set<Device> devices = of(device("a"), device("b"), device("c"), device("d"), device("e"), device("f"));
Set<Link> links = of(link("a", 1, "b", 1), link("b", 1, "a", 1), link("b", 2, "c", 1), link("c", 1, "b", 2), link("c", 2, "d", 1), link("d", 1, "c", 2), link("d", 2, "a", 2), link("a", 2, "d", 2), link("e", 1, "f", 1), link("f", 1, "e", 1));
GraphDescription data = new DefaultGraphDescription(4321L, System.currentTimeMillis(), devices, links);
providerService.topologyChanged(data, null);
}
Aggregations