Search in sources :

Example 26 with Event

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

the class OpenstackNetworkManagerTest 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 : OpenstackNetworkEvent(org.onosproject.openstacknetworking.api.OpenstackNetworkEvent) Event(org.onosproject.event.Event)

Example 27 with Event

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

the class VirtualNetworkDeviceManagerTest method validateEvents.

/**
 * Method to validate that the actual versus expected virtual network events were
 * received correctly.
 *
 * @param types expected virtual network events.
 */
private void validateEvents(Enum... types) {
    TestTools.assertAfter(100, () -> {
        int i = 0;
        assertEquals("wrong events received", types.length, testListener.events.size());
        for (Event event : testListener.events) {
            assertEquals("incorrect event type", types[i], event.type());
            i++;
        }
        testListener.events.clear();
    });
}
Also used : Event(org.onosproject.event.Event) DeviceEvent(org.onosproject.net.device.DeviceEvent) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 28 with Event

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

the class VirtualListenerRegistryManager method getRegistry.

public ListenerRegistry getRegistry(NetworkId networkId, Class<? extends Event> eventClass) {
    Map<Class<? extends Event>, ListenerRegistry> listenerMapByEvent = listenerMapByNetwork.get(networkId);
    if (listenerMapByEvent == null) {
        listenerMapByEvent = Maps.newConcurrentMap();
        listenerMapByNetwork.putIfAbsent(networkId, listenerMapByEvent);
    }
    ListenerRegistry listenerRegistry = listenerMapByEvent.get(eventClass);
    if (listenerRegistry == null) {
        listenerRegistry = new ListenerRegistry();
        listenerMapByEvent.putIfAbsent(eventClass, listenerRegistry);
    }
    return listenerRegistry;
}
Also used : ListenerRegistry(org.onosproject.event.ListenerRegistry) Event(org.onosproject.event.Event)

Example 29 with Event

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

the class DeviceManagerTest method validateEvents.

protected void validateEvents(Enum... types) {
    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 : Event(org.onosproject.event.Event) DeviceEvent(org.onosproject.net.device.DeviceEvent)

Example 30 with Event

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

the class LinkManagerTest method validateEvents.

protected void validateEvents(Enum... types) {
    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 : LinkEvent(org.onosproject.net.link.LinkEvent) Event(org.onosproject.event.Event) ConnectPoint(org.onosproject.net.ConnectPoint)

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