Search code examples
sdnmininetpox

How to add flow rules in POX controller


I recently started learning SDN and installed mininet to understand its working. I understood how to build basic topologies and how to create flow rules through command line as well. Then i came across POX controller which seems to better than default controller but I am not able to understand how do I insert flow rules to satisfy various types of networks constraints like traffic between 2 hosts should flow through a specific switch only.

After going through a lot of internet sources, I figured out that one way would be, I can create my own python file, but my doubt is that inside the python file , I can write syntax for building the topology and then write flow rules but what is the syntax for writing flow rules is my doubt.

Any material which can explain above issues in detail through examples would be very helpful. Most of the tutorials on github and Internet were tough to understand.


Solution

  • You should go through some of POX APIs in the POX documentation. It has a detailed explanation with some examples, which I find to be enough for getting started with building your own POX Component (i.e. what you referred to as a python file).

    As quoted from this teaching material:

    In general a POX controller consists of three parts:

    1.Listener

    2.Control logic

    3.Messenger

    First you need to figure out the type of the event you want the controller to listen to (e.g., ConnectionUp, PacketIn, etc).

    Then using some logic you can distinguish between different flows and attach a proper action for a specific flow.

    Finally you send the message to the switch to add the new rule in the Openflow table.

    Installing new flow rules falls under the control logic part mentioned above, and is explained, with examples, under the OpenFlow Messages section: Flow table modification.