net.floodlightcontroller.core
Class OFSwitchBase

java.lang.Object
  extended by net.floodlightcontroller.core.OFSwitchBase
All Implemented Interfaces:
IOFSwitch
Direct Known Subclasses:
OFSwitchImpl

public abstract class OFSwitchBase
extends java.lang.Object
implements IOFSwitch

This is the internal representation of an openflow switch.


Nested Class Summary
protected  class OFSwitchBase.PortManager
          Manages the ports of this switch.
 
Nested classes/interfaces inherited from interface net.floodlightcontroller.core.IOFSwitch
IOFSwitch.OFPortType, IOFSwitch.PortChangeEvent, IOFSwitch.PortChangeType
 
Field Summary
protected  short accessFlowPriority
           
protected  int actions
           
protected  java.util.concurrent.ConcurrentMap<java.lang.Object,java.lang.Object> attributes
           
protected  int buffers
           
protected  int capabilities
           
protected  org.jboss.netty.channel.Channel channel
           
protected  java.util.Date connectedSince
           
protected  short coreFlowPriority
           
protected  long datapathId
           
protected  IDebugCounterService debugCounters
           
protected  OFDescriptionStatistics description
           
protected  IFloodlightProviderService floodlightProvider
           
protected static java.lang.ThreadLocal<java.util.Map<IOFSwitch,java.util.List<OFMessage>>> local_msg_buffer
           
protected static org.slf4j.Logger log
           
static int OFSWITCH_APP_ID
           
protected  boolean packetInThrottleEnabled
           
protected  java.lang.String stringId
           
protected  byte tables
           
protected  IThreadPoolService threadPool
           
 
Fields inherited from interface net.floodlightcontroller.core.IOFSwitch
PROP_REQUIRES_L3_MATCH, PROP_SUPPORTS_NETMASK_TBL, PROP_SUPPORTS_OFPP_FLOOD, PROP_SUPPORTS_OFPP_TABLE, SWITCH_DESCRIPTION_FUTURE, SWITCH_IS_CORE_SWITCH, SWITCH_SUPPORTS_NX_ROLE
 
Constructor Summary
OFSwitchBase()
           
 
Method Summary
 boolean attributeEquals(java.lang.String name, java.lang.Object other)
          Check if the given attribute is present and if so whether it is equal to "other"
 void cancelAllStatisticsReplies()
          Cancel all statistics replies
 void cancelFeaturesReply(int transactionId)
           
 void cancelStatisticsReply(int transactionId)
          Cancel the statistics reply with the given transaction ID
 void clearAllFlowMods()
          Clear all flowmods on this switch
 OrderedCollection<IOFSwitch.PortChangeEvent> comparePorts(java.util.Collection<ImmutablePort> ports)
          Compute the changes that would be required to replace the old ports of this switch with the new ports
 void deliverOFFeaturesReply(OFMessage reply)
          Deliver the featuresReply future reply
 void deliverStatisticsReply(OFStatisticsReply reply)
          Deliver the statistics future reply
 void disconnectOutputStream()
           
protected  void enableWriteThrottle(boolean enable)
           
static void flush_all()
           
 void flush()
          Flush all flows queued for this switch in the current thread.
 short getAccessFlowPriority()
          Get the suggested priority to use when installing access flows in this switch.
 int getActions()
           
 java.lang.Object getAttribute(java.lang.String name)
          Set properties for switch specific behavior
 java.util.concurrent.ConcurrentMap<java.lang.Object,java.lang.Object> getAttributes()
          Retrieves attributes of this switch
 int getBuffers()
          Returns switch features from features Reply
 int getCapabilities()
           
 java.util.Date getConnectedSince()
          Retrieves the date the switch connected to this controller
 short getCoreFlowPriority()
          Get the suggested priority to use when installing core flows in this switch.
 OFDescriptionStatistics getDescriptionStatistics()
           
 java.util.Collection<java.lang.Integer> getEnabledPortNumbers()
          Get list of the port numbers of all enabled ports.
 java.util.Collection<ImmutablePort> getEnabledPorts()
          Get list of all enabled ports.
 IFloodlightProviderService.Role getHARole()
          Get the current role of the controller for the switch
 long getId()
          Get the datapathId of the switch
 java.net.SocketAddress getInetAddress()
          Get the IP Address for the switch
 int getNextTransactionId()
          Returns the next available transaction id
 ImmutablePort getPort(int portNumber)
          Retrieve the port object by the port number.
 ImmutablePort getPort(java.lang.String portName)
          Retrieve the port object by the port name.
 java.util.Map<java.lang.Integer,java.lang.Long> getPortBroadcastHits()
          Get the portBroadcastCacheHits
 java.util.Collection<ImmutablePort> getPorts()
          Get list of all ports.
 java.lang.String getStringId()
          Get a string version of the ID for this switch
 byte getTables()
           
 boolean hasAttribute(java.lang.String name)
          Checks if a specific switch property exists for this switch
 boolean inputThrottled(OFMessage ofm)
          Determine if this message should be dropped.
 boolean isActive()
          Check if the switch is active.
 boolean isConnected()
          Check if the switch is connected to this controller.
 boolean isDriverHandshakeComplete()
          Check if the sub-handshake for this switch driver has been completed.
 boolean isOverloaded()
          Return if switch has exceeded the high threshold of packet in rate.
 boolean isWriteThrottleEnabled()
          Return whether write throttling is enabled on the switch
 boolean portEnabled(int portNumber)
           
 boolean portEnabled(java.lang.String portName)
           
 void processDriverHandshakeMessage(OFMessage m)
          Pass the given OFMessage to the driver as part of this driver's sub-handshake.
 OrderedCollection<IOFSwitch.PortChangeEvent> processOFPortStatus(OFPortStatus ps)
          Add or modify a switch port.
 java.util.concurrent.Future<java.util.List<OFStatistics>> queryStatistics(OFStatisticsRequest request)
          Returns a Future object that can be used to retrieve the asynchronous OFStatisticsReply when it is available.
 java.util.concurrent.Future<OFFeaturesReply> querySwitchFeaturesReply()
          Returns a Future object that can be used to retrieve the asynchronous OFStatisticsReply when it is available.
 java.lang.Object removeAttribute(java.lang.String name)
          Set properties for switch specific behavior
 void sendStatsQuery(OFStatisticsRequest request, int xid, IOFMessageListener caller)
          Send a flow statistics request to the switch.
 void setAccessFlowPriority(short accessFlowPriority)
          Set the suggested priority to use when installing access flows in this switch.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set properties for switch specific behavior
 void setChannel(org.jboss.netty.channel.Channel channel)
          Set the netty Channel this switch instance is associated with Called immediately after instantiation
 void setConnected(boolean connected)
          Set whether the switch is connected
 void setCoreFlowPriority(short coreFlowPriority)
          Set the suggested priority to use when installing core flows in this switch.
 void setDebugCounterService(IDebugCounterService debugCounters)
          Set debug counter service for per-switch counters Called immediately after instantiation
 void setFeaturesReply(OFFeaturesReply featuresReply)
          Set the OFFeaturesReply message returned by the switch during initial handshake.
 void setFloodlightProvider(Controller controller)
          Set IFloodlightProviderService for this switch instance Called immediately after instantiation
 void setFloodlightProvider(IFloodlightProviderService floodlightProvider)
           
 void setHARole(IFloodlightProviderService.Role role)
          Set switch's HA role to role.
protected  void setInputThrottleThresholds(int pktInHigh, int pktInLow, int pktInPerMac, int pktInPerPort)
          For switch drivers to set thresholds, all rates in per second
 void setPortDescriptions(java.util.List<OFPortDescription> portDescriptions)
          Set the OFFeaturesReply message returned by the switch during initial handshake.
 OrderedCollection<IOFSwitch.PortChangeEvent> setPorts(java.util.Collection<ImmutablePort> ports)
          Replace the ports of this switch with the given ports.
 void setTableFull(boolean isFull)
          Set the flow table full flag in the switch
 void setThreadPoolService(IThreadPoolService tp)
          Set IThreadPoolService for this switch instance Called immediately after instantiation
 void startDriverHandshake()
          Start this switch driver's sub handshake.
 java.lang.String toString()
           
 boolean updateBroadcastCache(java.lang.Long entry, java.lang.Integer port)
          Update broadcast cache
protected  void write(java.util.List<OFMessage> msglist)
          Not callable by writers, but allow IOFSwitch implementation to override
 void write(java.util.List<OFMessage> msglist, FloodlightContext bc)
          Writes the list of messages to the output stream, bypassing rate limiting.
 void write(OFMessage m, FloodlightContext bc)
          Writes to the OFMessage to the output stream, bypassing rate limiting.
 void writeThrottled(java.util.List<OFMessage> msglist, FloodlightContext bc)
          Writes the list of messages to the output stream, subject to rate limiting.
 void writeThrottled(OFMessage m, FloodlightContext bc)
          Write OFMessage to the output stream, subject to switch rate limiting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.floodlightcontroller.core.IOFSwitch
getPortType, isFastPort, setSwitchProperties
 

Field Detail

log

protected static final org.slf4j.Logger log

attributes

protected java.util.concurrent.ConcurrentMap<java.lang.Object,java.lang.Object> attributes

floodlightProvider

protected IFloodlightProviderService floodlightProvider

threadPool

protected IThreadPoolService threadPool

debugCounters

protected IDebugCounterService debugCounters

connectedSince

protected volatile java.util.Date connectedSince

capabilities

protected int capabilities

buffers

protected int buffers

actions

protected int actions

tables

protected byte tables

datapathId

protected long datapathId

stringId

protected java.lang.String stringId

accessFlowPriority

protected short accessFlowPriority

coreFlowPriority

protected short coreFlowPriority

channel

protected org.jboss.netty.channel.Channel channel

packetInThrottleEnabled

protected boolean packetInThrottleEnabled

description

protected OFDescriptionStatistics description

local_msg_buffer

protected static final java.lang.ThreadLocal<java.util.Map<IOFSwitch,java.util.List<OFMessage>>> local_msg_buffer

OFSWITCH_APP_ID

public static final int OFSWITCH_APP_ID
See Also:
Constant Field Values
Constructor Detail

OFSwitchBase

public OFSwitchBase()
Method Detail

attributeEquals

public boolean attributeEquals(java.lang.String name,
                               java.lang.Object other)
Description copied from interface: IOFSwitch
Check if the given attribute is present and if so whether it is equal to "other"

Specified by:
attributeEquals in interface IOFSwitch
Parameters:
name - the name of the attribute to check
other - the object to compare the attribute against.
Returns:
true iff the specified attribute is set and equals() the given other object.

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Description copied from interface: IOFSwitch
Set properties for switch specific behavior

Specified by:
getAttribute in interface IOFSwitch
Parameters:
name - name of property
Returns:
value for name

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Description copied from interface: IOFSwitch
Set properties for switch specific behavior

Specified by:
setAttribute in interface IOFSwitch
Parameters:
name - name of property
value - value for name

removeAttribute

public java.lang.Object removeAttribute(java.lang.String name)
Description copied from interface: IOFSwitch
Set properties for switch specific behavior

Specified by:
removeAttribute in interface IOFSwitch
Parameters:
name - name of property
Returns:
current value for name or null (if not present)

hasAttribute

public boolean hasAttribute(java.lang.String name)
Description copied from interface: IOFSwitch
Checks if a specific switch property exists for this switch

Specified by:
hasAttribute in interface IOFSwitch
Parameters:
name - name of property
Returns:
value for name

setChannel

public void setChannel(org.jboss.netty.channel.Channel channel)
Description copied from interface: IOFSwitch
Set the netty Channel this switch instance is associated with Called immediately after instantiation

Specified by:
setChannel in interface IOFSwitch

enableWriteThrottle

protected void enableWriteThrottle(boolean enable)

isWriteThrottleEnabled

public boolean isWriteThrottleEnabled()
Description copied from interface: IOFSwitch
Return whether write throttling is enabled on the switch

Specified by:
isWriteThrottleEnabled in interface IOFSwitch

writeThrottled

public void writeThrottled(OFMessage m,
                           FloodlightContext bc)
                    throws java.io.IOException
Description copied from interface: IOFSwitch
Write OFMessage to the output stream, subject to switch rate limiting. The message will be handed to the floodlightProvider for possible filtering and processing by message listeners

Specified by:
writeThrottled in interface IOFSwitch
Throws:
java.io.IOException

writeThrottled

public void writeThrottled(java.util.List<OFMessage> msglist,
                           FloodlightContext bc)
                    throws java.io.IOException
Description copied from interface: IOFSwitch
Writes the list of messages to the output stream, subject to rate limiting. The message will be handed to the floodlightProvider for possible filtering and processing by message listeners.

Specified by:
writeThrottled in interface IOFSwitch
Throws:
java.io.IOException

write

public void write(OFMessage m,
                  FloodlightContext bc)
Description copied from interface: IOFSwitch
Writes to the OFMessage to the output stream, bypassing rate limiting. The message will be handed to the floodlightProvider for possible filtering and processing by message listeners

Specified by:
write in interface IOFSwitch

write

public void write(java.util.List<OFMessage> msglist,
                  FloodlightContext bc)
Description copied from interface: IOFSwitch
Writes the list of messages to the output stream, bypassing rate limiting. The message will be handed to the floodlightProvider for possible filtering and processing by message listeners.

Specified by:
write in interface IOFSwitch

write

protected void write(java.util.List<OFMessage> msglist)
Not callable by writers, but allow IOFSwitch implementation to override

Parameters:
msglist -
Throws:
java.io.IOException

disconnectOutputStream

public void disconnectOutputStream()
Specified by:
disconnectOutputStream in interface IOFSwitch

setFeaturesReply

public void setFeaturesReply(OFFeaturesReply featuresReply)
Description copied from interface: IOFSwitch
Set the OFFeaturesReply message returned by the switch during initial handshake.

Specified by:
setFeaturesReply in interface IOFSwitch

setPortDescriptions

public void setPortDescriptions(java.util.List<OFPortDescription> portDescriptions)
Description copied from interface: IOFSwitch
Set the OFFeaturesReply message returned by the switch during initial handshake.

Specified by:
setPortDescriptions in interface IOFSwitch

getEnabledPorts

public java.util.Collection<ImmutablePort> getEnabledPorts()
Description copied from interface: IOFSwitch
Get list of all enabled ports. This will typically be different from the list of ports in the OFPortDescription rpely, since that one is a static snapshot of the ports at the time the switch connected to the controller whereas this port list also reflects the port status messages that have been received.

Specified by:
getEnabledPorts in interface IOFSwitch
Returns:
Unmodifiable list of ports not backed by the underlying collection

getEnabledPortNumbers

public java.util.Collection<java.lang.Integer> getEnabledPortNumbers()
Description copied from interface: IOFSwitch
Get list of the port numbers of all enabled ports. This will typically be different from the list of ports in the OFFeaturesReply, since that one is a static snapshot of the ports at the time the switch connected to the controller whereas this port list also reflects the port status messages that have been received.

Specified by:
getEnabledPortNumbers in interface IOFSwitch
Returns:
Unmodifiable list of ports not backed by the underlying collection

getPort

public ImmutablePort getPort(int portNumber)
Description copied from interface: IOFSwitch
Retrieve the port object by the port number. The port object is the one that reflects the port status updates that have been received, not the one from the features reply.

Specified by:
getPort in interface IOFSwitch
Returns:
port object

getPort

public ImmutablePort getPort(java.lang.String portName)
Description copied from interface: IOFSwitch
Retrieve the port object by the port name. The port object is the one that reflects the port status updates that have been received, not the one from the features reply. Port names are case insentive

Specified by:
getPort in interface IOFSwitch
Returns:
port object

processOFPortStatus

public OrderedCollection<IOFSwitch.PortChangeEvent> processOFPortStatus(OFPortStatus ps)
Description copied from interface: IOFSwitch
Add or modify a switch port. This is called by the core controller code in response to a OFPortStatus message. It should not typically be called by other floodlight applications. OFPPR_MODIFY and OFPPR_ADD will be treated as equivalent. The OpenFlow spec is not clear on whether portNames are portNumbers are considered authoritative identifiers. We treat portNames <-> portNumber mappings as fixed. If they change, we delete all previous conflicting ports and add all new ports.

Specified by:
processOFPortStatus in interface IOFSwitch
Parameters:
ps - the port status message
Returns:
the ordered Collection of changes "applied" to the old ports of the switch according to the PortStatus message. A single PortStatus message can result in multiple changes. If portName <-> portNumber mappings have changed, the iteration order ensures that delete events for old conflicting appear before before events adding new ports

getPorts

public java.util.Collection<ImmutablePort> getPorts()
Description copied from interface: IOFSwitch
Get list of all ports. This will typically be different from the list of ports in the OFFeaturesReply, since that one is a static snapshot of the ports at the time the switch connected to the controller whereas this port list also reflects the port status messages that have been received.

Specified by:
getPorts in interface IOFSwitch
Returns:
Unmodifiable list of ports

comparePorts

public OrderedCollection<IOFSwitch.PortChangeEvent> comparePorts(java.util.Collection<ImmutablePort> ports)
Description copied from interface: IOFSwitch
Compute the changes that would be required to replace the old ports of this switch with the new ports

Specified by:
comparePorts in interface IOFSwitch
Parameters:
ports - new ports to set
Returns:
the ordered collection of changes "applied" to the old ports of the switch in order to set them to the new set. If portName <-> portNumber mappings have changed, the iteration order ensures that delete events for old conflicting appear before before events adding new ports

setPorts

public OrderedCollection<IOFSwitch.PortChangeEvent> setPorts(java.util.Collection<ImmutablePort> ports)
Description copied from interface: IOFSwitch
Replace the ports of this switch with the given ports.

Specified by:
setPorts in interface IOFSwitch
Parameters:
ports - new ports to set
Returns:
the ordered collection of changes "applied" to the old ports of the switch in order to set them to the new set. If portName <-> portNumber mappings have changed, the iteration order ensures that delete events for old conflicting appear before before events adding new ports

portEnabled

public boolean portEnabled(int portNumber)
Specified by:
portEnabled in interface IOFSwitch
Returns:
Whether a port is enabled per latest port status message (not configured down nor link down nor in spanning tree blocking state)

portEnabled

public boolean portEnabled(java.lang.String portName)
Specified by:
portEnabled in interface IOFSwitch
Returns:
Whether a port is enabled per latest port status message (not configured down nor link down nor in spanning tree blocking state)

getId

public long getId()
Description copied from interface: IOFSwitch
Get the datapathId of the switch

Specified by:
getId in interface IOFSwitch
Returns:

getStringId

public java.lang.String getStringId()
Description copied from interface: IOFSwitch
Get a string version of the ID for this switch

Specified by:
getStringId in interface IOFSwitch
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getAttributes

public java.util.concurrent.ConcurrentMap<java.lang.Object,java.lang.Object> getAttributes()
Description copied from interface: IOFSwitch
Retrieves attributes of this switch

Specified by:
getAttributes in interface IOFSwitch
Returns:

getConnectedSince

public java.util.Date getConnectedSince()
Description copied from interface: IOFSwitch
Retrieves the date the switch connected to this controller

Specified by:
getConnectedSince in interface IOFSwitch
Returns:
the date

getNextTransactionId

public int getNextTransactionId()
Description copied from interface: IOFSwitch
Returns the next available transaction id

Specified by:
getNextTransactionId in interface IOFSwitch
Returns:

sendStatsQuery

public void sendStatsQuery(OFStatisticsRequest request,
                           int xid,
                           IOFMessageListener caller)
                    throws java.io.IOException
Description copied from interface: IOFSwitch
Send a flow statistics request to the switch. This call returns after sending the stats. request to the switch.

Specified by:
sendStatsQuery in interface IOFSwitch
Parameters:
request - flow statistics request message
xid - transaction id, must be obtained by using the getXid() API.
caller - the caller of the API. receive() callback of this caller would be called when the reply from the switch is received.
Throws:
java.io.IOException

queryStatistics

public java.util.concurrent.Future<java.util.List<OFStatistics>> queryStatistics(OFStatisticsRequest request)
                                                                          throws java.io.IOException
Description copied from interface: IOFSwitch
Returns a Future object that can be used to retrieve the asynchronous OFStatisticsReply when it is available.

Specified by:
queryStatistics in interface IOFSwitch
Parameters:
request - statistics request
Returns:
Future object wrapping OFStatisticsReply
Throws:
java.io.IOException

deliverStatisticsReply

public void deliverStatisticsReply(OFStatisticsReply reply)
Description copied from interface: IOFSwitch
Deliver the statistics future reply

Specified by:
deliverStatisticsReply in interface IOFSwitch
Parameters:
reply - the reply to deliver

cancelStatisticsReply

public void cancelStatisticsReply(int transactionId)
Description copied from interface: IOFSwitch
Cancel the statistics reply with the given transaction ID

Specified by:
cancelStatisticsReply in interface IOFSwitch
Parameters:
transactionId - the transaction ID

cancelAllStatisticsReplies

public void cancelAllStatisticsReplies()
Description copied from interface: IOFSwitch
Cancel all statistics replies

Specified by:
cancelAllStatisticsReplies in interface IOFSwitch

setFloodlightProvider

public void setFloodlightProvider(IFloodlightProviderService floodlightProvider)
Parameters:
floodlightProvider - the floodlightProvider to set

setThreadPoolService

public void setThreadPoolService(IThreadPoolService tp)
Description copied from interface: IOFSwitch
Set IThreadPoolService for this switch instance Called immediately after instantiation

Specified by:
setThreadPoolService in interface IOFSwitch

setDebugCounterService

public void setDebugCounterService(IDebugCounterService debugCounters)
                            throws IDebugCounterService.CounterException
Description copied from interface: IOFSwitch
Set debug counter service for per-switch counters Called immediately after instantiation

Specified by:
setDebugCounterService in interface IOFSwitch
Throws:
IDebugCounterService.CounterException

isConnected

public boolean isConnected()
Description copied from interface: IOFSwitch
Check if the switch is connected to this controller. Whether a switch is connected is independent of whether the switch is active

Specified by:
isConnected in interface IOFSwitch
Returns:
whether the switch is still disconnected

isActive

public boolean isActive()
Description copied from interface: IOFSwitch
Check if the switch is active. I.e., the switch is connected to this controller and is in master role

Specified by:
isActive in interface IOFSwitch
Returns:

setConnected

public void setConnected(boolean connected)
Description copied from interface: IOFSwitch
Set whether the switch is connected

Specified by:
setConnected in interface IOFSwitch
Parameters:
connected - whether the switch is connected

getHARole

public IFloodlightProviderService.Role getHARole()
Description copied from interface: IOFSwitch
Get the current role of the controller for the switch

Specified by:
getHARole in interface IOFSwitch
Returns:
the role of the controller

setHARole

public void setHARole(IFloodlightProviderService.Role role)
Description copied from interface: IOFSwitch
Set switch's HA role to role. The haRoleReplyReceived indicates if a reply was received from the switch (error replies excluded). If role is null, the switch should close the channel connection.

Specified by:
setHARole in interface IOFSwitch

clearAllFlowMods

public void clearAllFlowMods()
Description copied from interface: IOFSwitch
Clear all flowmods on this switch

Specified by:
clearAllFlowMods in interface IOFSwitch

updateBroadcastCache

public boolean updateBroadcastCache(java.lang.Long entry,
                                    java.lang.Integer port)
Description copied from interface: IOFSwitch
Update broadcast cache

Specified by:
updateBroadcastCache in interface IOFSwitch
Returns:
true if there is a cache hit false if there is no cache hit.

getPortBroadcastHits

public java.util.Map<java.lang.Integer,java.lang.Long> getPortBroadcastHits()
Description copied from interface: IOFSwitch
Get the portBroadcastCacheHits

Specified by:
getPortBroadcastHits in interface IOFSwitch
Returns:

flush

public void flush()
Description copied from interface: IOFSwitch
Flush all flows queued for this switch in the current thread. NOTE: The contract is limited to the current thread

Specified by:
flush in interface IOFSwitch

flush_all

public static void flush_all()

getInetAddress

public java.net.SocketAddress getInetAddress()
Get the IP Address for the switch

Specified by:
getInetAddress in interface IOFSwitch
Returns:
the inet address

querySwitchFeaturesReply

public java.util.concurrent.Future<OFFeaturesReply> querySwitchFeaturesReply()
                                                                      throws java.io.IOException
Description copied from interface: IOFSwitch
Returns a Future object that can be used to retrieve the asynchronous OFStatisticsReply when it is available.

Specified by:
querySwitchFeaturesReply in interface IOFSwitch
Returns:
Future object wrapping OFStatisticsReply
Throws:
java.io.IOException

deliverOFFeaturesReply

public void deliverOFFeaturesReply(OFMessage reply)
Description copied from interface: IOFSwitch
Deliver the featuresReply future reply

Specified by:
deliverOFFeaturesReply in interface IOFSwitch
Parameters:
reply - the reply to deliver

cancelFeaturesReply

public void cancelFeaturesReply(int transactionId)
Specified by:
cancelFeaturesReply in interface IOFSwitch

getBuffers

public int getBuffers()
Description copied from interface: IOFSwitch
Returns switch features from features Reply

Specified by:
getBuffers in interface IOFSwitch
Returns:

getActions

public int getActions()
Specified by:
getActions in interface IOFSwitch

getCapabilities

public int getCapabilities()
Specified by:
getCapabilities in interface IOFSwitch

getTables

public byte getTables()
Specified by:
getTables in interface IOFSwitch

getDescriptionStatistics

public OFDescriptionStatistics getDescriptionStatistics()
Specified by:
getDescriptionStatistics in interface IOFSwitch
Returns:
a copy of the description statistics for this switch

setFloodlightProvider

public void setFloodlightProvider(Controller controller)
Description copied from interface: IOFSwitch
Set IFloodlightProviderService for this switch instance Called immediately after instantiation

Specified by:
setFloodlightProvider in interface IOFSwitch

setInputThrottleThresholds

protected void setInputThrottleThresholds(int pktInHigh,
                                          int pktInLow,
                                          int pktInPerMac,
                                          int pktInPerPort)
For switch drivers to set thresholds, all rates in per second

Parameters:
pktInHigh - - above this start throttling
pktInLow - - below this stop throttling
pktInPerMac - - block host if unique pktIn rate reaches this
pktInPerPort - - block port if unique pktIn rate reaches this

isOverloaded

public boolean isOverloaded()
Return if switch has exceeded the high threshold of packet in rate.

Specified by:
isOverloaded in interface IOFSwitch
Returns:

inputThrottled

public boolean inputThrottled(OFMessage ofm)
Determine if this message should be dropped. We compute the current rate by taking a timestamp every 100 messages. Could change to a more complex scheme if more accuracy is needed. Enable throttling if the rate goes above packetInRateThresholdHigh Disable throttling when the rate drops below packetInRateThresholdLow While throttling is enabled, we do the following: - Remove duplicate packetIn's mapped to the same OFMatch - After filtering, if packetIn rate per host (mac) is above packetInRatePerMacThreshold, push a flow mod to block mac on port - After filtering, if packetIn rate per port is above packetInRatePerPortThreshold, push a flow mod to block port - Allow blocking flow mods have a hard timeout and expires automatically TODO: keep a history of all events related in input throttling

Specified by:
inputThrottled in interface IOFSwitch
Parameters:
ofm -
Returns:

setTableFull

public void setTableFull(boolean isFull)
Description copied from interface: IOFSwitch
Set the flow table full flag in the switch

Specified by:
setTableFull in interface IOFSwitch

getAccessFlowPriority

public short getAccessFlowPriority()
Description copied from interface: IOFSwitch
Get the suggested priority to use when installing access flows in this switch.

Specified by:
getAccessFlowPriority in interface IOFSwitch

getCoreFlowPriority

public short getCoreFlowPriority()
Description copied from interface: IOFSwitch
Get the suggested priority to use when installing core flows in this switch.

Specified by:
getCoreFlowPriority in interface IOFSwitch

setAccessFlowPriority

public void setAccessFlowPriority(short accessFlowPriority)
Description copied from interface: IOFSwitch
Set the suggested priority to use when installing access flows in this switch.

Specified by:
setAccessFlowPriority in interface IOFSwitch

setCoreFlowPriority

public void setCoreFlowPriority(short coreFlowPriority)
Description copied from interface: IOFSwitch
Set the suggested priority to use when installing core flows in this switch.

Specified by:
setCoreFlowPriority in interface IOFSwitch

startDriverHandshake

public void startDriverHandshake()
Description copied from interface: IOFSwitch
Start this switch driver's sub handshake. This might be a no-op but this method must be called at least once for the switch to be become ready. This method must only be called from the I/O thread

Specified by:
startDriverHandshake in interface IOFSwitch

isDriverHandshakeComplete

public boolean isDriverHandshakeComplete()
Description copied from interface: IOFSwitch
Check if the sub-handshake for this switch driver has been completed. This method can only be called after startDriverHandshake() This methods must only be called from the I/O thread

Specified by:
isDriverHandshakeComplete in interface IOFSwitch
Returns:
true if the sub-handshake has been completed. False otherwise

processDriverHandshakeMessage

public void processDriverHandshakeMessage(OFMessage m)
Description copied from interface: IOFSwitch
Pass the given OFMessage to the driver as part of this driver's sub-handshake. Must not be called after the handshake has been completed This methods must only be called from the I/O thread

Specified by:
processDriverHandshakeMessage in interface IOFSwitch
Parameters:
m - The message that the driver should process