-
Notifications
You must be signed in to change notification settings - Fork 77
OpenFlow Java library API Cookbook
Dmitry-Orekhov edited this page Aug 23, 2013
·
23 revisions
(work in progress)
The controller infrastructure is started the next way:
import org.flowforwarding.of.controller.Controller;
/*................*/
Controller.launch (SessionHandler.class); // This launches a controller listening tcp port 6633
Controller.launch (SessionHandler.class, configuration); // This launches a controller listening given tcp port It's a POJO containing some configuration information as tcp port number etc.
import org.flowforwarding.of.controller.Configuration
/*................*/
Configuration config1 = new Configuration(); // tcp port 6633 by default
Configuration config2 = new Configuration(6633);You have to implement your session handler to interact with Controller. Session handlers extend the class OFSessionHandler:
import org.flowforwarding.of.controller.SwitchState;
import org.flowforwarding.of.controller.session.OFSessionHandler;
public class SimpleHandler extends OFSessionHandler {
@Override
protected void handshaked(SwitchState swState) {
super.handshaked(swState);
/*You have to implement your own logic here*/
}
}