public abstract class OFModule
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected IOFHandler |
controller
reference to the controller implementation.
|
private java.util.concurrent.ConcurrentMap<org.openflow.protocol.interfaces.OFMessageType,OFMFilter> |
filters
private map that holds filters for OFMessage objects for this module.
|
private static java.util.concurrent.ConcurrentMap<java.lang.Class<? extends IService>,OFModule> |
modules
static map that holds all the references to module instances.
|
| Constructor and Description |
|---|
OFModule() |
| Modifier and Type | Method and Description |
|---|---|
IOFHandler |
getController()
returns the controller that this modules is attached.
|
abstract OFModel[] |
getModels()
returns the array of all
OFModel objects associated with this module. |
static OFModule |
getModule(java.lang.Class<? extends IService> c)
return a module that implements a specific service from the
static map
modules. |
protected abstract boolean |
handleDisconnect(Connection conn)
Process the disconnection event from a switch.
|
protected abstract boolean |
handleHandshakedEvent(Connection conn,
MessageContext context)
An abstract method that all subclasses should implement.
|
protected abstract boolean |
handleMessage(Connection conn,
MessageContext context,
org.openflow.protocol.OFMessage msg,
java.util.List<org.openflow.protocol.OFMessage> outgoing)
Handle incoming messages that pass the test of filters.
|
void |
init(IOFHandler ctrl)
initialize module.
|
protected abstract void |
initialize()
method that initializes this module.
|
boolean |
processDisconnect(Connection conn)
Process the disconnection event from a switch.
|
boolean |
processHandshakeFinished(Connection conn,
MessageContext context)
This method is called after FEATURE-REQUEST and FEATUER-REPLY is correctly exchanged.
|
boolean |
processMessage(Connection conn,
MessageContext context,
org.openflow.protocol.OFMessage msg,
java.util.List<org.openflow.protocol.OFMessage> outgoing)
Handle incoming messages and return the processing result.
|
void |
registerFilter(org.openflow.protocol.interfaces.OFMessageType messageType,
OFMFilter filter)
register a filter that only selects messages that matches
the condition described by the
OFMFilter object. |
static void |
registerModule(java.lang.Class<? extends IService> c,
OFModule m)
register a module to the static map
modules. |
private static java.util.concurrent.ConcurrentMap<java.lang.Class<? extends IService>,OFModule> modules
private java.util.concurrent.ConcurrentMap<org.openflow.protocol.interfaces.OFMessageType,OFMFilter> filters
protected IOFHandler controller
public static void registerModule(java.lang.Class<? extends IService> c, OFModule m)
modules.c - represents a service that the module implementsm - the module instancepublic static OFModule getModule(java.lang.Class<? extends IService> c)
modules.c - class of the service that this module implementspublic void registerFilter(org.openflow.protocol.interfaces.OFMessageType messageType,
OFMFilter filter)
OFMFilter object.messageType - type of the OFMessage that the filter appliesfilter - a filter object to be applied to OFMessage objectspublic final void init(IOFHandler ctrl)
OFController.init().ctrl - reference to the controller implementationpublic IOFHandler getController()
protected abstract void initialize()
OFMLinkDiscovery.initialize().public boolean processHandshakeFinished(Connection conn, MessageContext context)
handleHandshakedEvent(Connection, MessageContext),
which is an abstract method that all subclasses should implement.conn - connection on which the handshaking is donecontext - message context for the handshaking messagesprotected abstract boolean handleHandshakedEvent(Connection conn, MessageContext context)
processHandshakeFinished(Connection, MessageContext).
Normally, most of modules have very simple implementation for this method,
only returning true.conn - connection that the event has occurredcontext - message context for the handshaking messagespublic boolean processMessage(Connection conn, MessageContext context, org.openflow.protocol.OFMessage msg, java.util.List<org.openflow.protocol.OFMessage> outgoing)
handleMessage(Connection, MessageContext, OFMessage, List).conn - connection that the message has arrivedcontext - message context for the messagemsg - the actual message objectoutgoing - responses for the message arrivedprotected abstract boolean handleMessage(Connection conn, MessageContext context, org.openflow.protocol.OFMessage msg, java.util.List<org.openflow.protocol.OFMessage> outgoing)
processMessage(Connection, MessageContext, OFMessage, List).conn - connection that the message has arrivedcontext - message context for the messagemsg - the actual message objectoutgoing - responses for the message arrived, which is filled by the handleMessage implementationpublic boolean processDisconnect(Connection conn)
handleDisconnect(Connection) callback.conn - connection that the event has occurredprotected abstract boolean handleDisconnect(Connection conn)
processDisconnect(Connection).
All subclasses of OFModule should implement this method.conn - connection that the event has occurred