Search in sources :

Example 1 with Command

use of net.floodlightcontroller.core.IListener.Command in project open-kilda by telstra.

the class MockFloodlightProvider method dispatchMessage.

public void dispatchMessage(IOFSwitch sw, OFMessage msg, FloodlightContext bc) {
    List<IOFMessageListener> theListeners = listeners.get(msg.getType()).getOrderedListeners();
    if (theListeners != null) {
        Command result = Command.CONTINUE;
        Iterator<IOFMessageListener> it = theListeners.iterator();
        if (OFType.PACKET_IN.equals(msg.getType())) {
            OFPacketIn pi = (OFPacketIn) msg;
            Ethernet eth = new Ethernet();
            eth.deserialize(pi.getData(), 0, pi.getData().length);
            IFloodlightProviderService.bcStore.put(bc, IFloodlightProviderService.CONTEXT_PI_PAYLOAD, eth);
        }
        while (it.hasNext() && !Command.STOP.equals(result)) {
            result = it.next().receive(sw, msg, bc);
        }
    }
    // paag
    for (IControllerCompletionListener listener : completionListeners) listener.onMessageConsumed(sw, msg, bc);
}
Also used : IOFMessageListener(net.floodlightcontroller.core.IOFMessageListener) Command(net.floodlightcontroller.core.IListener.Command) Ethernet(net.floodlightcontroller.packet.Ethernet) OFPacketIn(org.projectfloodlight.openflow.protocol.OFPacketIn) IControllerCompletionListener(net.floodlightcontroller.core.IControllerCompletionListener)

Aggregations

IControllerCompletionListener (net.floodlightcontroller.core.IControllerCompletionListener)1 Command (net.floodlightcontroller.core.IListener.Command)1 IOFMessageListener (net.floodlightcontroller.core.IOFMessageListener)1 Ethernet (net.floodlightcontroller.packet.Ethernet)1 OFPacketIn (org.projectfloodlight.openflow.protocol.OFPacketIn)1