public abstract class ForwardingBase extends OFModule implements IDeviceListener
Modifier and Type | Field and Description |
---|---|
long |
appCookie |
TimedCache<java.lang.Long> |
broadcastCache |
protected boolean |
broadcastCacheFeature |
java.util.Comparator<SwitchPort> |
clusterIdComparator |
protected IDeviceService |
deviceManager |
static short |
FLOWMOD_DEFAULT_HARD_TIMEOUT |
static short |
FLOWMOD_DEFAULT_IDLE_TIMEOUT |
static int |
FORWARDING_APP_ID |
protected OFMessageDamper |
messageDamper |
protected static int |
OFMESSAGE_DAMPER_CAPACITY |
protected static int |
OFMESSAGE_DAMPER_TIMEOUT |
int |
prime1 |
static int |
prime2 |
(package private) OFProtocol |
protocol |
protected IRoutingService |
routingEngine |
protected ITopologyService |
topology |
controller
Constructor and Description |
---|
ForwardingBase() |
Modifier and Type | Method and Description |
---|---|
boolean |
blockHost(SwitchPort sw_tup,
long host_mac,
short hardTimeout,
long cookie)
Creates a flow mod to block the packet based on the given MAC
address and the source switch.
|
void |
deviceAdded(IDevice device)
Called when a new Device is found.
|
void |
deviceIPV4AddrChanged(IDevice device)
Called when a network address has been added or remove from a device.
|
void |
deviceMoved(IDevice device)
Called when a Device has moved to a new location on the network.
|
void |
deviceRemoved(IDevice device)
Called when a Device is removed, this typically occurs when the port the
Device is attached to goes down, or the switch it is attached to is removed.
|
void |
deviceVlanChanged(IDevice device)
Called when a VLAN tag for the device has been added or removed.
|
protected int |
getInputPort(org.openflow.protocol.interfaces.OFPacketIn pi) |
protected boolean |
handleDisconnect(Connection conn)
Process the disconnection event from a switch.
|
protected boolean |
handleHandshakedEvent(Connection sw,
MessageContext context)
An abstract method that all subclasses should implement.
|
protected boolean |
handleMessage(Connection conn,
MessageContext cntx,
org.openflow.protocol.OFMessage msg,
java.util.List<org.openflow.protocol.OFMessage> outgoing)
Initializes this module.
|
void |
initialize()
Adds a listener for device manager and registers for PacketIns
and initializes data structure.
|
protected boolean |
isInBroadcastCache(Connection conn,
org.openflow.protocol.interfaces.OFPacketIn pi,
MessageContext cntx)
Updates the broadcast cache of the switch.
|
protected boolean |
isInSwitchBroadcastCache(Connection conn,
org.openflow.protocol.interfaces.OFPacketIn pi,
MessageContext cntx)
Updates the broadcast cache of the switch.
|
void |
packetOutMultiPort(byte[] packetData,
Connection conn,
short inPort,
java.util.Set<java.lang.Integer> outPorts,
MessageContext cntx)
Writes packet-out message to switch with output actions to one or more
output ports with inPort/outPorts passed in.
|
void |
packetOutMultiPort(IPacket packet,
Connection conn,
short inPort,
java.util.Set<java.lang.Integer> outPorts,
MessageContext cntx)
Accepts an IPacket instead of raw packet data.
|
void |
packetOutMultiPort(org.openflow.protocol.interfaces.OFPacketIn pi,
Connection conn,
short inPort,
java.util.Set<java.lang.Integer> outPorts,
MessageContext cntx)
Accepts a PacketIn instead of raw packet data.
|
abstract boolean |
processPacketInMessage(Connection conn,
org.openflow.protocol.interfaces.OFPacketIn pi,
IRoutingDecision decision,
MessageContext cntx)
All subclasses must define this function if they want any specific
forwarding action.
|
void |
pushPacket(Connection conn,
IPacket packet,
IOFSwitch sw,
int bufferId,
short inPort,
short outPort,
MessageContext cntx)
Pushes a packet-out to a switch.
|
protected void |
pushPacket(Connection conn,
org.openflow.protocol.interfaces.OFMatch match,
org.openflow.protocol.interfaces.OFPacketIn pi,
int outport,
MessageContext cntx)
Pushes a packet-out to a switch.
|
boolean |
pushRoute(Connection conn,
Route route,
org.openflow.protocol.interfaces.OFMatch match,
java.lang.Integer wildcard_hints,
org.openflow.protocol.interfaces.OFPacketIn pi,
long pinSwitch,
long cookie,
MessageContext cntx,
boolean reqeustFlowRemovedNotifn,
boolean doFlush,
org.openflow.protocol.interfaces.OFFlowModCommand flowModCommand)
Pushes routes from back to front.
|
protected org.openflow.protocol.interfaces.OFMatch |
wildcard(org.openflow.protocol.interfaces.OFMatch match,
IOFSwitch sw,
java.lang.Integer wildcard_hints)
Sets wildcards if wildcard_hints is null.
|
getController, getModels, getModule, init, processDisconnect, processHandshakeFinished, processMessage, registerFilter, registerModule
protected static int OFMESSAGE_DAMPER_CAPACITY
protected static int OFMESSAGE_DAMPER_TIMEOUT
public static short FLOWMOD_DEFAULT_IDLE_TIMEOUT
public static short FLOWMOD_DEFAULT_HARD_TIMEOUT
protected IDeviceService deviceManager
protected IRoutingService routingEngine
protected ITopologyService topology
protected OFMessageDamper messageDamper
OFProtocol protocol
protected boolean broadcastCacheFeature
public final int prime1
public static final int prime2
public TimedCache<java.lang.Long> broadcastCache
public static final int FORWARDING_APP_ID
public long appCookie
public java.util.Comparator<SwitchPort> clusterIdComparator
public void initialize()
initialize
in class OFModule
protected boolean handleHandshakedEvent(Connection sw, MessageContext context)
OFModule
OFModule.processHandshakeFinished(Connection, MessageContext)
.
Normally, most of modules have very simple implementation for this method,
only returning true.handleHandshakedEvent
in class OFModule
sw
- connection that the event has occurredcontext
- message context for the handshaking messagesprotected int getInputPort(org.openflow.protocol.interfaces.OFPacketIn pi)
protected boolean handleMessage(Connection conn, MessageContext cntx, org.openflow.protocol.OFMessage msg, java.util.List<org.openflow.protocol.OFMessage> outgoing)
handleMessage
in class OFModule
conn
- the connection to switchcntx
- the MessageContext
msg
- the OFMessage
to handleoutgoing
- public abstract boolean processPacketInMessage(Connection conn, org.openflow.protocol.interfaces.OFPacketIn pi, IRoutingDecision decision, MessageContext cntx)
conn
- the connection that the packet came in frompi
- the packet that came indecision
- any decision made by a policy enginecntx
- the MessageContext
protected boolean handleDisconnect(Connection conn)
OFModule
OFModule.processDisconnect(Connection)
.
All subclasses of OFModule should implement this method.handleDisconnect
in class OFModule
conn
- connection that the event has occurredpublic boolean pushRoute(Connection conn, Route route, org.openflow.protocol.interfaces.OFMatch match, java.lang.Integer wildcard_hints, org.openflow.protocol.interfaces.OFPacketIn pi, long pinSwitch, long cookie, MessageContext cntx, boolean reqeustFlowRemovedNotifn, boolean doFlush, org.openflow.protocol.interfaces.OFFlowModCommand flowModCommand)
conn
- the connection to switchroute
- a route to pushmatch
- openFlow fields to match onwildcard_hints
- wildcard information as integerpi
- packetinpinSwitch
- the switch of packetincookie
- the cookie to set in each flow_modcntx
- the MessageContext
reqeustFlowRemovedNotifn
- true when the switch would send a flow mod
removal notification when the flow mod expiresdoFlush
- true when the flow mod would be immediately written to the switchflowModCommand
- flow mod. command to use, e.g. OFFlowMod.OFPFC_ADD,
OFFlowMod.OFPFC_MODIFY etc.protected org.openflow.protocol.interfaces.OFMatch wildcard(org.openflow.protocol.interfaces.OFMatch match, IOFSwitch sw, java.lang.Integer wildcard_hints)
match
- the OFMatch
sw
- the switch instancewildcard_hints
- wildcard information as integerOFMatch
instanceprotected void pushPacket(Connection conn, org.openflow.protocol.interfaces.OFMatch match, org.openflow.protocol.interfaces.OFPacketIn pi, int outport, MessageContext cntx)
conn
- the connection to the switch that generated the packet-in, and from which packet-out is sentmatch
- the OFMatch
pi
- packetinoutport
- the output portcntx
- the MessageContext
public void pushPacket(Connection conn, IPacket packet, IOFSwitch sw, int bufferId, short inPort, short outPort, MessageContext cntx)
conn
- the connection to switchpacket
- a packet data to sendsw
- the switch from which packet-out is sentbufferId
- the bufferIdinPort
- the input portoutPort
- the output portcntx
- the MessageContext
public void packetOutMultiPort(byte[] packetData, Connection conn, short inPort, java.util.Set<java.lang.Integer> outPorts, MessageContext cntx)
packetData
- the packet to writeconn
- the connection to switchinPort
- input portoutPorts
- output portcntx
- the MessageContext
public void packetOutMultiPort(org.openflow.protocol.interfaces.OFPacketIn pi, Connection conn, short inPort, java.util.Set<java.lang.Integer> outPorts, MessageContext cntx)
pi
- packetinconn
- the connection to switchinPort
- the input portoutPorts
- a set of output portcntx
- the MessageContext
packetOutMultiPort(byte[], etri.sdn.controller.protocol.io.Connection, short, java.util.Set<java.lang.Integer>, etri.sdn.controller.MessageContext)
public void packetOutMultiPort(IPacket packet, Connection conn, short inPort, java.util.Set<java.lang.Integer> outPorts, MessageContext cntx)
packet
- a packet data to sendconn
- the connection to switchinPort
- the input portoutPorts
- a set of output portcntx
- the MessageContext
packetOutMultiPort(byte[], etri.sdn.controller.protocol.io.Connection, short, java.util.Set<java.lang.Integer>, etri.sdn.controller.MessageContext)
protected boolean isInBroadcastCache(Connection conn, org.openflow.protocol.interfaces.OFPacketIn pi, MessageContext cntx)
conn
- the connection to switchpi
- packetincntx
- the MessageContext
protected boolean isInSwitchBroadcastCache(Connection conn, org.openflow.protocol.interfaces.OFPacketIn pi, MessageContext cntx)
conn
- the connection to switchpi
- packetincntx
- the MessageContext
public boolean blockHost(SwitchPort sw_tup, long host_mac, short hardTimeout, long cookie)
sw_tup
- the input port numberhost_mac
- the MAC address to blockhardTimeout
- a timeout valuecookie
- the cookie to set in each flow_modpublic void deviceAdded(IDevice device)
IDeviceListener
deviceAdded
in interface IDeviceListener
device
- the device that changedpublic void deviceRemoved(IDevice device)
IDeviceListener
deviceRemoved
in interface IDeviceListener
device
- the device that changedpublic void deviceMoved(IDevice device)
IDeviceListener
deviceMoved
in interface IDeviceListener
device
- the device that changedpublic void deviceIPV4AddrChanged(IDevice device)
IDeviceListener
deviceIPV4AddrChanged
in interface IDeviceListener
device
- the device that changedpublic void deviceVlanChanged(IDevice device)
IDeviceListener
deviceVlanChanged
in interface IDeviceListener
device
- the device that changed