How to figure out port information in mininet

6.7k views Asked by At

I use python to create a custom mininet topology. To know the topology in detail is not important for the question.

I use ryu as controller. Especially I use the app "ofctl_rest.py". This controller does not install rules in the switch on its own. You have to issue rest - commands to establish rules. In every rest request (rule) you have to specify an outgoing port. To specify this port I need information about the topology of the network.

I need to know which link is connected to a port. I need to know which interface the port runs on. Also helpful would be to know the foreign interface, foreign switch/host, and foraign port of the actual port. How can I retrieve this information???

Please help me. I am really frustrated right now, because I do not know how to figure it out.

1

There are 1 answers

0
nik On BEST ANSWER

Inside the mininet CLI you can use the net command to find out about the topology. The nodes command will show you a list of nodes. You can also use the dump command to display the interface details.

For information on the 'hosts', such as they are, you can run normal linux commands on each host, e.g.

mn> h1 ifconfig

will run ifconfig on host h1, showing you some of the network configuration for that host.

Given that you seem to be running mininet from a custom script, you could start the CLI at the end of your script (if that's possible) e.g.

net = Mininet(your_topo)
net.start()
CLI(net)
net.stop()

Otherwise, you can use the mininet python APIs to find much of the information.

  • the dump* functions in mininet.util will print out lots of information.
  • topo.links() will give you a list of the links in the topology.
  • topo.linkinfo() might give you some extra info.

For flow information you can either run ovs-dpctl, ovs-ofctl etc. outside of mininet (in a normal shell), or run the equivalents without the ovs- prefix inside the mininet CLI.