How are port numbers are determined in mininet?
Asked Answered
A

2

5

I have a network similar to the one in the picture below.

My sample mininet

This is the python code for the network:

net.addLink(s1, s2)
net.addLink(s2, s3)
net.addLink(s3, s4)
net.addLink(s4, s1)

net.addLink(s1, h1)
net.addLink(s3, h2)

How would I go about finding and adding flow tables to the network?

for example below is one of the flow table entry. How was the in_port determined to be 1 and output determined to be 3?

ovs-ofctl add-flow s1 in_port=1,actions=output:3

I am having trouble understanding how the port numbers are determined.

Anastrophe answered 7/12, 2016 at 3:23 Comment(0)
T
5

Please, check Mininet "addLink" API here:
addLink (self, node1, node2, port1=None, port2=None, cls=None, **params)
  There are additional parameters that can specify the port number for the link on each side

Something like this:

addLink(s1, s2, port1=1, port2=2)
addLink(s2, h2, port1=5, port2=6)

which will result in the following output for links and ports:

mininet> links
s1-eth1<->s2-eth2 (OK OK)
s2-eth5<->h2-eth6 (OK OK)
mininet> ports
s1 lo:0 s1-eth1:1 
s2 lo:0 s2-eth2:2 s2-eth5:5 
Truong answered 11/12, 2016 at 13:41 Comment(0)
B
2

Try net at mininet> prompt to get topology details:

$ sudo mn
*** No default OpenFlow controller found for default switch!
*** Falling back to OVS Bridge
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 
*** Adding switches:
s1 
*** Adding links:
(h1, s1) (h2, s1) 
*** Configuring hosts
h1 h2 
*** Starting controller

*** Starting 1 switches
s1 ...
*** Starting CLI:
mininet> net
h1 h1-eth0:s1-eth1
h2 h2-eth0:s1-eth2
s1 lo:  s1-eth1:h1-eth0 s1-eth2:h2-eth0
mininet> 

eth* denotes * port

Batangas answered 10/12, 2016 at 18:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.