|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.floodlightcontroller.virtualnetwork.VirtualNetworkFilter
public class VirtualNetworkFilter
A simple Layer 2 (MAC based) network virtualization module. This module allows you to create simple L2 networks (host + gateway) and will drop traffic if they are not on the same virtual network. LIMITATIONS - This module does not allow overlapping of IPs or MACs - You can only have 1 gateway per virtual network (can be shared) - There is filtering of multicast/broadcast traffic - All DHCP traffic will be allowed, regardless of unicast/broadcast
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.floodlightcontroller.core.IListener |
---|
IListener.Command |
Field Summary | |
---|---|
protected net.floodlightcontroller.virtualnetwork.VirtualNetworkFilter.DeviceListenerImpl |
deviceListener
|
protected java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> |
gatewayToGuid
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
guidToGateway
|
protected static org.slf4j.Logger |
log
|
protected java.util.Map<MACAddress,java.lang.Integer> |
macToGateway
|
protected java.util.Map<MACAddress,java.lang.String> |
macToGuid
|
protected java.util.Map<java.lang.String,java.lang.String> |
nameToGuid
|
protected java.util.Map<java.lang.String,MACAddress> |
portToMac
|
protected java.util.Map<java.lang.String,VirtualNetwork> |
vNetsByGuid
|
Constructor Summary | |
---|---|
VirtualNetworkFilter()
|
Method Summary | |
---|---|
protected void |
addGateway(java.lang.String guid,
java.lang.Integer ip)
Adds a gateway to a virtual network. |
void |
addHost(MACAddress mac,
java.lang.String guid,
java.lang.String port)
Adds a host to a virtual network. |
void |
createNetwork(java.lang.String guid,
java.lang.String network,
java.lang.Integer gateway)
Creates a new virtual network. |
protected void |
deleteGateway(java.lang.String guid)
Deletes a gateway for a virtual network. |
void |
deleteHost(MACAddress mac,
java.lang.String port)
Deletes a host from a virtual network. |
void |
deleteNetwork(java.lang.String guid)
Deletes a virtual network. |
protected void |
doDropFlow(IOFSwitch sw,
OFPacketIn pi,
FloodlightContext cntx)
Writes a FlowMod to a switch that inserts a drop flow. |
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.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> |
getServiceImpls()
Instantiate (as needed) and return objects that implement each of the services exported by this module. |
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. |
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. |
protected boolean |
isDefaultGateway(Ethernet frame)
Checks whether the frame is destined to or from a gateway. |
protected boolean |
isDhcpPacket(Ethernet frame)
Checks to see if an Ethernet frame is a DHCP packet. |
java.util.Collection<VirtualNetwork> |
listNetworks()
Return list of all virtual networks. |
protected boolean |
oneSameNetwork(MACAddress m1,
MACAddress m2)
Checks to see if two MAC Addresses are on the same network. |
protected IListener.Command |
processPacketIn(IOFSwitch sw,
OFPacketIn msg,
FloodlightContext cntx)
Processes an OFPacketIn message and decides if the OFPacketIn should be dropped or the processing should continue. |
IListener.Command |
receive(IOFSwitch sw,
OFMessage msg,
FloodlightContext cntx)
This is the method Floodlight uses to call listeners with OpenFlow messages |
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 static org.slf4j.Logger log
protected java.util.Map<java.lang.String,VirtualNetwork> vNetsByGuid
protected java.util.Map<java.lang.String,java.lang.String> nameToGuid
protected java.util.Map<java.lang.String,java.lang.Integer> guidToGateway
protected java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> gatewayToGuid
protected java.util.Map<MACAddress,java.lang.Integer> macToGateway
protected java.util.Map<MACAddress,java.lang.String> macToGuid
protected java.util.Map<java.lang.String,MACAddress> portToMac
protected net.floodlightcontroller.virtualnetwork.VirtualNetworkFilter.DeviceListenerImpl deviceListener
Constructor Detail |
---|
public VirtualNetworkFilter()
Method Detail |
---|
protected void addGateway(java.lang.String guid, java.lang.Integer ip)
guid
- The ID (not name) of the network.ip
- The IP addresses of the gateway.protected void deleteGateway(java.lang.String guid)
guid
- The ID (not name) of the network to delete
the gateway for.public void createNetwork(java.lang.String guid, java.lang.String network, java.lang.Integer gateway)
IVirtualNetworkService
createNetwork
in interface IVirtualNetworkService
guid
- The ID of the network. Must be unique.network
- The network name. Must be unique.gateway
- The IP address of the network gateway, null if none.public void deleteNetwork(java.lang.String guid)
IVirtualNetworkService
deleteNetwork
in interface IVirtualNetworkService
guid
- The ID (not name) of virtual network to delete.public void addHost(MACAddress mac, java.lang.String guid, java.lang.String port)
IVirtualNetworkService
addHost
in interface IVirtualNetworkService
mac
- The MAC address of the host to add.guid
- The network to add the host to.port
- The logical port name to attach the host to. Must be unique.public void deleteHost(MACAddress mac, java.lang.String port)
IVirtualNetworkService
deleteHost
in interface IVirtualNetworkService
mac
- The MAC address to delete.port
- The logical port the host is attached to.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
public void init(FloodlightModuleContext context) throws FloodlightModuleException
IFloodlightModule
init
in interface IFloodlightModule
FloodlightModuleException
public void startUp(FloodlightModuleContext context)
IFloodlightModule
startUp
in interface IFloodlightModule
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 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
protected boolean isDefaultGateway(Ethernet frame)
frame
- The ethernet frame to check.
protected boolean oneSameNetwork(MACAddress m1, MACAddress m2)
m1
- The first MAC.m2
- The second MAC.
protected boolean isDhcpPacket(Ethernet frame)
frame
- The Ethernet frame.
protected IListener.Command processPacketIn(IOFSwitch sw, OFPacketIn msg, FloodlightContext cntx)
sw
- The switch the PacketIn came from.msg
- The OFPacketIn message from the switch.cntx
- The FloodlightContext for this message.
protected void doDropFlow(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx)
sw
- The switch to write the FlowMod to.pi
- The corresponding OFPacketIn. Used to create the OFMatch structure.cntx
- The FloodlightContext that gets passed to the switch.public java.util.Collection<VirtualNetwork> listNetworks()
IVirtualNetworkService
listNetworks
in interface IVirtualNetworkService
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |