16 package org.openkilda.floodlight.service;
18 import com.google.common.collect.ImmutableSet;
19 import net.floodlightcontroller.core.FloodlightContext;
20 import net.floodlightcontroller.core.IFloodlightProviderService;
21 import net.floodlightcontroller.core.IOFMessageListener;
22 import net.floodlightcontroller.core.IOFSwitch;
23 import net.floodlightcontroller.core.module.IFloodlightModuleContext;
24 import org.projectfloodlight.openflow.protocol.OFMessage;
25 import org.projectfloodlight.openflow.protocol.OFType;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
34 protected abstract boolean handle(IOFSwitch sw, OFMessage message, FloodlightContext contest);
37 IFloodlightProviderService flProviderService = moduleContext.getServiceImpl(IFloodlightProviderService.class);
39 for (OFType
target : desiredTypes) {
40 log.debug(
"activateSubscription {} for OFMessage with OFType.{}",
this,
target);
41 flProviderService.addOFMessageListener(
target,
this);
46 return ImmutableSet.of();
50 return ImmutableSet.of();
54 public Command
receive(IOFSwitch sw, OFMessage message, FloodlightContext context) {
58 "{} - receive message (xId: {}, type: {})",
59 getClass().getCanonicalName(), message.getXid(), message.getType());
62 isHandled =
handle(sw, message, context);
63 }
catch (Exception e) {
65 "Unhandled exception during processing OFMessage(xId: {}, type: {})",
66 message.getXid(), message.getType());
73 return Command.CONTINUE;
78 return getClass().getName();
boolean isCallbackOrderingPrereq(OFType type, String name)
Set< String > mustHandleAfter()
void activateSubscription(IFloodlightModuleContext moduleContext, OFType... desiredTypes)
abstract boolean handle(IOFSwitch sw, OFMessage message, FloodlightContext contest)
boolean isCallbackOrderingPostreq(OFType type, String name)
Command receive(IOFSwitch sw, OFMessage message, FloodlightContext context)
Set< String > mustHandleBefore()