Using OpenFaucet in a switch

78 views
Skip to first unread message

Abhishek Chanda

unread,
Oct 22, 2012, 6:43:12 PM10/22/12
to openfauce...@googlegroups.com
Hi Romain,

I am trying to use OpenFaucet in my app to enable it to talk to a OF
controller, FloodLight in this case. I did this:

of = ofproto.OpenflowProtocol()
tr = mock_twisted.MockTransport()
of.makeConnection(tr)
of.send_hello()

I am not sure how do I ask my app to connect to a controller at a
given IP and port. Is this the right way to do this?

Thanks

Romain Lenglet

unread,
Oct 22, 2012, 7:37:36 PM10/22/12
to openfauce...@googlegroups.com
Hi Abhishek,

Using Twisted, one doesn't directly create a protocol object.
You have to setup the Twisted reactor to listen on, or to connect to an address and a port, and to create protocol objects from the type you specify, one for every established connection.
There is a code snippet in OpenFaucet's documentation to start a controller:
http://rlenglet.github.com/openfaucet/controller.html#controller-instantiation

from twisted.internet import reactor
from openfaucet import ofcontroller
factory = ofcontroller.OpenflowControllerStubFactory(controller=MyController)
reactor.connectTCP('switch1.example.com', 6633, factory)
reactor.run()

The address and port of your controller is what you should pass to the reactor.connectTCP() call.
If you switch were to be passive, you'd call reactor.listenTCP() instead of reactor.connectTCP().

Does that answer your question?

Regards,
--
Romain Lenglet
Reply all
Reply to author
Forward
0 new messages