|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.floodlightcontroller.firewall.Firewall
public class Firewall
Stateless firewall implemented as a Google Summer of Code project. Configuration done through REST API
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.floodlightcontroller.core.IListener |
---|
IListener.Command |
Field Summary | |
---|---|
static java.lang.String |
COLUMN_ACTION
|
static java.lang.String |
COLUMN_DL_DST
|
static java.lang.String |
COLUMN_DL_SRC
|
static java.lang.String |
COLUMN_DL_TYPE
|
static java.lang.String |
COLUMN_DPID
|
static java.lang.String |
COLUMN_IN_PORT
|
static java.lang.String |
COLUMN_NW_DST_MASKBITS
|
static java.lang.String |
COLUMN_NW_DST_PREFIX
|
static java.lang.String |
COLUMN_NW_PROTO
|
static java.lang.String |
COLUMN_NW_SRC_MASKBITS
|
static java.lang.String |
COLUMN_NW_SRC_PREFIX
|
static java.lang.String |
COLUMN_PRIORITY
|
static java.lang.String |
COLUMN_RULEID
|
static java.lang.String |
COLUMN_TP_DST
|
static java.lang.String |
COLUMN_TP_SRC
|
static java.lang.String |
COLUMN_WILDCARD_DL_DST
|
static java.lang.String |
COLUMN_WILDCARD_DL_SRC
|
static java.lang.String |
COLUMN_WILDCARD_DL_TYPE
|
static java.lang.String |
COLUMN_WILDCARD_DPID
|
static java.lang.String |
COLUMN_WILDCARD_IN_PORT
|
static java.lang.String |
COLUMN_WILDCARD_NW_DST
|
static java.lang.String |
COLUMN_WILDCARD_NW_PROTO
|
static java.lang.String |
COLUMN_WILDCARD_NW_SRC
|
static java.lang.String |
COLUMN_WILDCARD_TP_DST
|
static java.lang.String |
COLUMN_WILDCARD_TP_SRC
|
static java.lang.String[] |
ColumnNames
|
protected boolean |
enabled
|
protected IFloodlightProviderService |
floodlightProvider
|
protected static org.slf4j.Logger |
logger
|
protected IRestApiService |
restApi
|
protected java.util.List<FirewallRule> |
rules
|
protected IStorageSourceService |
storageSource
|
protected int |
subnet_mask
|
static java.lang.String |
TABLE_NAME
|
Constructor Summary | |
---|---|
Firewall()
|
Method Summary | |
---|---|
void |
addRule(FirewallRule rule)
Adds a new Firewall rule |
void |
deleteRule(int ruleid)
Deletes a Firewall rule |
void |
enableFirewall(boolean enabled)
Enables/disables the firewall. |
java.util.Collection<java.lang.Class<? extends IFloodlightService>> |
getModuleDependencies()
Get a list of Modules that this module depends on. |
java.util.Collection<java.lang.Class<? extends IFloodlightService>> |
getModuleServices()
Return the list of interfaces that this module implements. |
java.lang.String |
getName()
The name assigned to this listener |
java.util.List<FirewallRule> |
getRules()
Returns all of the firewall rules |
java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> |
getServiceImpls()
Instantiate (as needed) and return objects that implement each of the services exported by this module. |
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getStorageRules()
Returns all of the firewall rules in storage for debugging and unit-testing purposes |
java.lang.String |
getSubnetMask()
Returns the subnet mask |
void |
init(FloodlightModuleContext context)
This is a hook for each module to do its internal initialization, e.g., call setService(context.getService("Service")) All module dependencies are resolved when this is called, but not every module is initialized. |
protected boolean |
IPIsBroadcast(int IPAddress)
Checks whether an IP address is a broadcast address or not (determines using subnet mask) |
boolean |
isCallbackOrderingPostreq(OFType type,
java.lang.String name)
Check if the module called name is a callback ordering post-requisite for this module. |
boolean |
isCallbackOrderingPrereq(OFType type,
java.lang.String name)
Check if the module called name is a callback ordering prerequisite for this module. |
boolean |
isEnabled()
Returns operational status of the firewall |
protected RuleWildcardsPair |
matchWithRule(IOFSwitch sw,
OFPacketIn pi,
FloodlightContext cntx)
Iterates over the firewall rules and tries to match them with the incoming packet (flow). |
IListener.Command |
processPacketInMessage(IOFSwitch sw,
OFPacketIn pi,
IRoutingDecision decision,
FloodlightContext cntx)
|
protected java.util.ArrayList<FirewallRule> |
readRulesFromStorage()
Reads the rules from the storage and creates a sorted arraylist of FirewallRule from them. |
IListener.Command |
receive(IOFSwitch sw,
OFMessage msg,
FloodlightContext cntx)
This is the method Floodlight uses to call listeners with OpenFlow messages |
void |
setSubnetMask(java.lang.String newMask)
Sets the subnet mask |
void |
startUp(FloodlightModuleContext context)
This is a hook for each module to do its external initializations, e.g., register for callbacks or query for state in other modules It is expected that this function will not block and that modules that want non-event driven CPU will spawn their own threads. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected IFloodlightProviderService floodlightProvider
protected IStorageSourceService storageSource
protected IRestApiService restApi
protected static org.slf4j.Logger logger
protected java.util.List<FirewallRule> rules
protected boolean enabled
protected int subnet_mask
public static final java.lang.String TABLE_NAME
public static final java.lang.String COLUMN_RULEID
public static final java.lang.String COLUMN_DPID
public static final java.lang.String COLUMN_IN_PORT
public static final java.lang.String COLUMN_DL_SRC
public static final java.lang.String COLUMN_DL_DST
public static final java.lang.String COLUMN_DL_TYPE
public static final java.lang.String COLUMN_NW_SRC_PREFIX
public static final java.lang.String COLUMN_NW_SRC_MASKBITS
public static final java.lang.String COLUMN_NW_DST_PREFIX
public static final java.lang.String COLUMN_NW_DST_MASKBITS
public static final java.lang.String COLUMN_NW_PROTO
public static final java.lang.String COLUMN_TP_SRC
public static final java.lang.String COLUMN_TP_DST
public static final java.lang.String COLUMN_WILDCARD_DPID
public static final java.lang.String COLUMN_WILDCARD_IN_PORT
public static final java.lang.String COLUMN_WILDCARD_DL_SRC
public static final java.lang.String COLUMN_WILDCARD_DL_DST
public static final java.lang.String COLUMN_WILDCARD_DL_TYPE
public static final java.lang.String COLUMN_WILDCARD_NW_SRC
public static final java.lang.String COLUMN_WILDCARD_NW_DST
public static final java.lang.String COLUMN_WILDCARD_NW_PROTO
public static final java.lang.String COLUMN_WILDCARD_TP_SRC
public static final java.lang.String COLUMN_WILDCARD_TP_DST
public static final java.lang.String COLUMN_PRIORITY
public static final java.lang.String COLUMN_ACTION
public static java.lang.String[] ColumnNames
Constructor Detail |
---|
public Firewall()
Method Detail |
---|
public java.lang.String getName()
IListener
getName
in interface IListener<OFType>
public boolean isCallbackOrderingPrereq(OFType type, java.lang.String name)
IListener
isCallbackOrderingPrereq
in interface IListener<OFType>
type
- the object type to which this appliesname
- the name of the module
public boolean isCallbackOrderingPostreq(OFType type, java.lang.String name)
IListener
isCallbackOrderingPostreq
in interface IListener<OFType>
type
- the object type to which this appliesname
- the name of the module
public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleServices()
IFloodlightModule
getModuleServices
in interface IFloodlightModule
public java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> getServiceImpls()
IFloodlightModule
getServiceImpls
in interface IFloodlightModule
public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleDependencies()
IFloodlightModule
getModuleDependencies
in interface IFloodlightModule
protected java.util.ArrayList<FirewallRule> readRulesFromStorage()
public void init(FloodlightModuleContext context) throws FloodlightModuleException
IFloodlightModule
init
in interface IFloodlightModule
FloodlightModuleException
public void startUp(FloodlightModuleContext context)
IFloodlightModule
startUp
in interface IFloodlightModule
public IListener.Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx)
IOFMessageListener
receive
in interface IOFMessageListener
sw
- the OpenFlow switch that sent this messagemsg
- the messagecntx
- a Floodlight message context object you can use to pass
information between listeners
public void enableFirewall(boolean enabled)
IFirewallService
enableFirewall
in interface IFirewallService
enabled
- Whether to enable or disable the firewall.public java.util.List<FirewallRule> getRules()
IFirewallService
getRules
in interface IFirewallService
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getStorageRules()
IFirewallService
getStorageRules
in interface IFirewallService
public java.lang.String getSubnetMask()
IFirewallService
getSubnetMask
in interface IFirewallService
public void setSubnetMask(java.lang.String newMask)
IFirewallService
setSubnetMask
in interface IFirewallService
newMask
- The new subnet maskpublic void addRule(FirewallRule rule)
IFirewallService
addRule
in interface IFirewallService
public void deleteRule(int ruleid)
IFirewallService
deleteRule
in interface IFirewallService
protected RuleWildcardsPair matchWithRule(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx)
sw
- the switch instancepi
- the incoming packet data structurecntx
- the floodlight context
protected boolean IPIsBroadcast(int IPAddress)
IPAddress
- the IP address to check
public IListener.Command processPacketInMessage(IOFSwitch sw, OFPacketIn pi, IRoutingDecision decision, FloodlightContext cntx)
public boolean isEnabled()
IFirewallService
isEnabled
in interface IFirewallService
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |