Search in sources :

Example 1 with GraphDescription

use of org.onosproject.net.topology.GraphDescription 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);
}
Also used : Device(org.onosproject.net.Device) DefaultGraphDescription(org.onosproject.net.topology.DefaultGraphDescription) Link(org.onosproject.net.Link) GraphDescription(org.onosproject.net.topology.GraphDescription) DefaultGraphDescription(org.onosproject.net.topology.DefaultGraphDescription)

Example 2 with GraphDescription

use of org.onosproject.net.topology.GraphDescription 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);
    }
}
Also used : DefaultGraphDescription(org.onosproject.net.topology.DefaultGraphDescription) GraphDescription(org.onosproject.net.topology.GraphDescription) DefaultGraphDescription(org.onosproject.net.topology.DefaultGraphDescription)

Example 3 with GraphDescription

use of org.onosproject.net.topology.GraphDescription 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());
}
Also used : DefaultDevice(org.onosproject.net.DefaultDevice) Device(org.onosproject.net.Device) DefaultGraphDescription(org.onosproject.net.topology.DefaultGraphDescription) Link(org.onosproject.net.Link) DefaultLink(org.onosproject.net.DefaultLink) GraphDescription(org.onosproject.net.topology.GraphDescription) DefaultGraphDescription(org.onosproject.net.topology.DefaultGraphDescription) Before(org.junit.Before)

Example 4 with GraphDescription

use of org.onosproject.net.topology.GraphDescription 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);
}
Also used : DefaultDevice(org.onosproject.net.DefaultDevice) Device(org.onosproject.net.Device) DefaultGraphDescription(org.onosproject.net.topology.DefaultGraphDescription) Link(org.onosproject.net.Link) DefaultLink(org.onosproject.net.DefaultLink) GraphDescription(org.onosproject.net.topology.GraphDescription) DefaultGraphDescription(org.onosproject.net.topology.DefaultGraphDescription)

Aggregations

DefaultGraphDescription (org.onosproject.net.topology.DefaultGraphDescription)4 GraphDescription (org.onosproject.net.topology.GraphDescription)4 Device (org.onosproject.net.Device)3 Link (org.onosproject.net.Link)3 DefaultDevice (org.onosproject.net.DefaultDevice)2 DefaultLink (org.onosproject.net.DefaultLink)2 Before (org.junit.Before)1