Professional Documents
Culture Documents
Apache license
2
Set-up
Downloads
$ sudo apt-get install build-essential openjdk-7-jdk ant maven python-dev eclipse
3
Web GUI
Start Mininet
4
Architecture
Modular architecture
5
Architecture
Modular architecture
The controller architecture consists of a core module, that's responsible for listening to
the openflow sockets and dispatching events,
and a number of secondary modules that can register with the core module to handle
those events
6
Write a Module
Make working Eclipse project for Floodlight
Open eclipse and create a new workspace
File Import General Existing Projects into Workspace. Then click Next
From Select root directory click Browse. Select the parent directory where you
placed floodlight earlier
Check the box for Floodlight. No other Projects should be present and none should
be selected
Click Finish
7
Write a Module
Create the FloodlightLaunch target
Click Run Run Configurations
Right Click Java Application New
For Name use FloodlightLaunch
For Project use Floodlight
For Main use net.floodlightcontroller.core.Main
Click Apply
8
Write a Module
Add Class in Eclipse
Right Click on the src/main/java folder and choose New Class
Enter net.floodlightcontroller.mactracker in the Package box
Enter MACTracker in the Name box
Next to the Interfaces box, choose Add
Add the IOFMessageListener and the IFloodlightModule, click OK
Click Finish in the dialog
9
Write a Module
Skeleton class
10
Write a Module
Skeleton class (cont)
Add these up front
im port net.fl
oodlightcontroller.core.IFloodlightProviderService;
im port java.util.ArrayList;
im port java.util.concurrent.ConcurrentSkipListSet;
im port java.util.Set;
im port net.fl
oodlightcontroller.packet.Ethernet;
im port org.slf4j.Logger;
im port org.slf4j.LoggerFactory;
11
Write a Module
Registering some member variables
protected IFloodlightProviderService fl
oodlightProvider;
protected Set< Long> m acAddresses;
protected static Logger logger;
12
Write a Module
Tell the module loader we depend on it
Modifying the getModuleDependencies() function
@ O verride
public Collection< Class< ? extends IFloodlightService> > getM oduleD ependencies() {
l.add(IFloodlightProviderService.class);
return l;
13
Write a Module
Init is called early in the controller startup processes
Modifying the init() function
@ O verride
public void init(FloodlightM oduleContext context)
throw s FloodlightM oduleException {
14
Write a Module
Handling the Packet-In message
Register for PACKET_IN messages in our startUp method
@Override
public void startUp(FloodlightModuleContext context) {
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
15
Write a Module
Put in an ID for our OFMessage listener
Modifying getName()
@Override
public String getName() {
return MACTracker.class.getSimpleName();
16
Write a Module
Define the behavior we want for PACKET_IN messages
Note that we return Command.CONTINUE to allow this message to continue to be
handled by other PACKET_IN handlers as well
@Override
public net.floodlightcontroller.core.IListener.Command receive(IOFSwitch sw, OFMessage msg,
FloodlightContext cntx)
Ethernet eth = IFloodlightProviderService.bcStore.get(cntx,
IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
if (!macAddresses.contains(sourceMACHash)) {
macAddresses.add(sourceMACHash);
logger.info("MAC Address: {} seen on switch: {}", eth.getSourceMACAddress().toString(),
sw.getId().toString());
}
return Command.CONTINUE;
}
17
Regist the Module
Tell the loader that the module exists
add the fully qualified module name on it's own line in
src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
net.floodlightcontroller.mactracker.MACTracker
18
Regist the Module
Run the controller
right clicking onMain.javaand choose "Run As.../Java Application/FloodlightLaunch"
19
Regist the Module
Run the controller
right clicking onMain.javaand choose "Run As.../Java Application/FloodlightLaunch"
20
More Floodlight tutorials
https://floodlight.atlassian.net/wiki/display/floodlightcontroller/How+to+Add+Services+to+a+Module
21
END
THANK YOU