I have created a topology in mininet. I want to get the dpid or name of a switch from the host it's connected to using xterm or mininet's python API. I looked it up on google but couldn't find anything.
Thanks in advance.
I have created a topology in mininet. I want to get the dpid or name of a switch from the host it's connected to using xterm or mininet's python API. I looked it up on google but couldn't find anything.
Thanks in advance.
from the Mininet CLI, you can do:
py net.getNodeByName("s1").dpid
Example:
root@raspberrypi:~# mn
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2
*** Adding switches:
s1
*** Adding links:
(h1, s1) (h2, s1)
*** Configuring hosts
h1 h2
*** Starting controller
c0
*** Starting 1 switches
s1 ...
*** Starting CLI:
mininet> py net.getNodeByName("s1").dpid
0000000000000001
mininet>
from the python API as explained in the official documentation
print(switch_node.dpid)
Or you can directly see in your host machine or using xterm with:
bash -c 'ovs-ofctl show s1|grep dpid'