net.floodlightcontroller.staticflowentry
Class StaticFlowEntries

java.lang.Object
  extended by net.floodlightcontroller.staticflowentry.StaticFlowEntries

public class StaticFlowEntries
extends java.lang.Object

Represents static flow entries to be maintained by the controller on the switches.


Field Summary
protected static org.slf4j.Logger log
           
 
Constructor Summary
StaticFlowEntries()
           
 
Method Summary
static long computeEntryCookie(OFFlowMod fm, int userCookie, java.lang.String name)
          This function generates a random hash for the bottom half of the cookie
static java.util.Map<java.lang.String,java.lang.Object> flowModToStorageEntry(OFFlowMod fm, java.lang.String sw, java.lang.String name)
          Parses an OFFlowMod (and it's inner OFMatch) to the storage entry format.
static java.lang.String getEntryNameFromJson(java.lang.String fmJson)
          Gets the entry name of a flow mod
static void initDefaultFlowMod(OFFlowMod fm, java.lang.String entryName)
          Sets defaults for an OFFlowMod
static java.util.Map<java.lang.String,java.lang.Object> jsonToStorageEntry(java.lang.String fmJson)
          Turns a JSON formatted Static Flow Pusher string into a storage entry Expects a string in JSON along the lines of: { "switch": "AA:BB:CC:DD:EE:FF:00:11", "name": "flow-mod-1", "cookie": "0", "priority": "32768", "ingress-port": "1", "actions": "output=2", }
static void parseActionString(OFFlowMod flowMod, java.lang.String actionstr, org.slf4j.Logger log)
          Parses OFFlowMod actions from strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.slf4j.Logger log
Constructor Detail

StaticFlowEntries

public StaticFlowEntries()
Method Detail

computeEntryCookie

public static long computeEntryCookie(OFFlowMod fm,
                                      int userCookie,
                                      java.lang.String name)
This function generates a random hash for the bottom half of the cookie

Parameters:
fm -
userCookie -
name -
Returns:
A cookie that encodes the application ID and a hash

initDefaultFlowMod

public static void initDefaultFlowMod(OFFlowMod fm,
                                      java.lang.String entryName)
Sets defaults for an OFFlowMod

Parameters:
fm - The OFFlowMod to set defaults for
entryName - The name of the entry. Used to compute the cookie.

getEntryNameFromJson

public static java.lang.String getEntryNameFromJson(java.lang.String fmJson)
                                             throws java.io.IOException
Gets the entry name of a flow mod

Parameters:
fmJson - The OFFlowMod in a JSON representation
Returns:
The name of the OFFlowMod, null if not found
Throws:
java.io.IOException - If there was an error parsing the JSON

flowModToStorageEntry

public static java.util.Map<java.lang.String,java.lang.Object> flowModToStorageEntry(OFFlowMod fm,
                                                                                     java.lang.String sw,
                                                                                     java.lang.String name)
Parses an OFFlowMod (and it's inner OFMatch) to the storage entry format.

Parameters:
fm - The FlowMod to parse
sw - The switch the FlowMod is going to be installed on
name - The name of this static flow entry
Returns:
A Map representation of the storage entry

jsonToStorageEntry

public static java.util.Map<java.lang.String,java.lang.Object> jsonToStorageEntry(java.lang.String fmJson)
                                                                           throws java.io.IOException
Turns a JSON formatted Static Flow Pusher string into a storage entry Expects a string in JSON along the lines of: { "switch": "AA:BB:CC:DD:EE:FF:00:11", "name": "flow-mod-1", "cookie": "0", "priority": "32768", "ingress-port": "1", "actions": "output=2", }

Parameters:
fmJson - The JSON formatted static flow pusher entry
Returns:
The map of the storage entry
Throws:
java.io.IOException - If there was an error parsing the JSON

parseActionString

public static void parseActionString(OFFlowMod flowMod,
                                     java.lang.String actionstr,
                                     org.slf4j.Logger log)
Parses OFFlowMod actions from strings.

Parameters:
flowMod - The OFFlowMod to set the actions for
actionstr - The string containing all the actions
log - A logger to log for errors.