Search in sources :

Example 21 with Event

use of org.onosproject.event.Event in project onos by opennetworkinglab.

the class TopologyEventsListCommand method doExecute.

@Override
protected void doExecute() {
    TopologyMetricsService service = get(TopologyMetricsService.class);
    if (outputJson()) {
        print("%s", json(service.getEvents()));
    } else {
        for (Event event : service.getEvents()) {
            print(FORMAT_EVENT, event);
            if (event instanceof TopologyEvent) {
                TopologyEvent topologyEvent = (TopologyEvent) event;
                for (Event reason : topologyEvent.reasons()) {
                    print(FORMAT_REASON, reason);
                }
            }
            // Extra empty line for clarity
            print("");
        }
    }
}
Also used : TopologyMetricsService(org.onosproject.metrics.topology.TopologyMetricsService) TopologyEvent(org.onosproject.net.topology.TopologyEvent) TopologyEvent(org.onosproject.net.topology.TopologyEvent) Event(org.onosproject.event.Event)

Example 22 with Event

use of org.onosproject.event.Event in project onos by opennetworkinglab.

the class HostManagerTest method validateEvents.

private void validateEvents(Enum... types) {
    TestTools.assertAfter(100, () -> {
        int i = 0;
        assertEquals("wrong events received", types.length, listener.events.size());
        for (Event event : listener.events) {
            assertEquals("incorrect event type", types[i], event.type());
            i++;
        }
        listener.events.clear();
    });
}
Also used : HostEvent(org.onosproject.net.host.HostEvent) Event(org.onosproject.event.Event)

Example 23 with Event

use of org.onosproject.event.Event in project onos by opennetworkinglab.

the class KubevirtApiConfigManagerTest method validateEvents.

private void validateEvents(Enum... types) {
    int i = 0;
    assertEquals("Number of events did not match", types.length, testListener.events.size());
    for (Event event : testListener.events) {
        assertEquals("Incorrect event received", types[i], event.type());
        i++;
    }
    testListener.events.clear();
}
Also used : KubevirtApiConfigEvent(org.onosproject.kubevirtnode.api.KubevirtApiConfigEvent) Event(org.onosproject.event.Event) KubevirtNodeUtil.endpoint(org.onosproject.kubevirtnode.util.KubevirtNodeUtil.endpoint)

Example 24 with Event

use of org.onosproject.event.Event in project onos by opennetworkinglab.

the class OpenstackSecurityGroupManagerTest method validateEvents.

private void validateEvents(Enum... types) {
    int i = 0;
    assertEquals("Number of events did not match", types.length, testOpenstackSecurityGroupListener.events.size());
    for (Event event : testOpenstackSecurityGroupListener.events) {
        assertEquals("Incorrect event received", types[i], event.type());
        i++;
    }
    testOpenstackSecurityGroupListener.events.clear();
}
Also used : OpenstackSecurityGroupEvent(org.onosproject.openstacknetworking.api.OpenstackSecurityGroupEvent) Event(org.onosproject.event.Event)

Example 25 with Event

use of org.onosproject.event.Event in project onos by opennetworkinglab.

the class InstancePortManagerTest method validateEvents.

private void validateEvents(Enum... types) {
    int i = 0;
    assertEquals("Number of events did not match", types.length, testInstancePortListener.events.size());
    for (Event event : testInstancePortListener.events) {
        assertEquals("Incorrect event received", types[i], event.type());
        i++;
    }
    testInstancePortListener.events.clear();
}
Also used : InstancePortEvent(org.onosproject.openstacknetworking.api.InstancePortEvent) Event(org.onosproject.event.Event)

Aggregations

Event (org.onosproject.event.Event)47 TopologyEvent (org.onosproject.net.topology.TopologyEvent)9 DeviceEvent (org.onosproject.net.device.DeviceEvent)7 LinkEvent (org.onosproject.net.link.LinkEvent)6 ConnectPoint (org.onosproject.net.ConnectPoint)5 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 HostEvent (org.onosproject.net.host.HostEvent)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 Map (java.util.Map)2 Set (java.util.Set)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 ExecutorService (java.util.concurrent.ExecutorService)2 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)2 Collectors (java.util.stream.Collectors)2 ClusterEvent (org.onosproject.cluster.ClusterEvent)2 MastershipEvent (org.onosproject.mastership.MastershipEvent)2 Link (org.onosproject.net.Link)2 IntentEvent (org.onosproject.net.intent.IntentEvent)2