Giuseppe1992 / Distrinet

Distributed Network emulator, based on Mininet
MIT License
17 stars 16 forks source link

Reachability test fails for certain topologies #50

Closed helllb closed 4 years ago

helllb commented 4 years ago

Hello,

I'm using Distrinet on the R2Lab testbed and almost everything works fine: installation and configuration are OK, ping and iperf work fine on the "linear" topology available by default, however the hosts are not reachable from each other on this simple topology:

class PodTopo(Topo):
    def build(self, p=1, n=1, m=1):
        # server pod
        server_switch = self.addSwitch('ss1')

        for i in range(1, m+1):
            server = self.addHost('sh%i' % i)
            self.addLink(server, server_switch)   

        # client pods
        for i in range(1, p+1):
            client_switch = self.addSwitch('cs%i' % i)

            for j in range(1, n+1):
                client = self.addHost('ch%i%i' % (i, j))
                self.addLink(client, client_switch)

            self.addLink(server_switch, client_switch)

topos = {'pods': PodTopo}

The network doesn't work even when using only 1 worker with Distrinet. However it does work when I emulate it with Mininet. Note also that this topology for p, n, m = 1, 1, 1 is equivalent to the linear topology for n = 2, yet one works fine while the other does not.

Thanks!

Giuseppe1992 commented 4 years ago

Hello, can you please send me the commands that you use to run the script in Distrinet and Mininet, with the output?

Giuseppe

Giuseppe1992 commented 4 years ago

seems that there is a bug,

I tried with this code:

class PodTopo1(Topo):
    def build(self):
        # server pod
        s1 = self.addSwitch('ss1')
        h1 = self.addHost('sh1')
        s2 = self.addSwitch('cs1')
        h2 = self.addHost('ch11')
        self.addLink(h1, s1)
        self.addLink(h2, s2)
        self.addLink(s1, s2)

and I was not pinging. if I try with:

class PodTopo1(Topo):
    def build(self):
        # server pod
        s1 = self.addSwitch('s1')
        h1 = self.addHost('h1')
        s2 = self.addSwitch('s2')
        h2 = self.addHost('h2')
        self.addLink(h1, s1)
        self.addLink(h2, s2)
        self.addLink(s1, s2)

it is working.

helllb commented 4 years ago

Hi Giuseppe,

Indeed it seems that going back to naming switches s1, s2, etc. and hosts h1, h2, etc. does the trick. Thanks for the reply!

dsaucez commented 4 years ago

@helllb currently in Distrinet we always use OVS with a controller which explains why it doesn't work. In Mininet if you use OVS in the same way (e.g., --switch=ovsk) the same issue will happen.

The root of the problem has been pointed out by @Giuseppe1992

seems that there is a bug,

I tried with this code:

class PodTopo1(Topo):
    def build(self):
        # server pod
        s1 = self.addSwitch('ss1')
        h1 = self.addHost('sh1')
        s2 = self.addSwitch('cs1')
        h2 = self.addHost('ch11')
        self.addLink(h1, s1)
        self.addLink(h2, s2)
        self.addLink(s1, s2)

and I was not pinging. if I try with:

class PodTopo1(Topo):
    def build(self):
        # server pod
        s1 = self.addSwitch('s1')
        h1 = self.addHost('h1')
        s2 = self.addSwitch('s2')
        h2 = self.addHost('h2')
        self.addLink(h1, s1)
        self.addLink(h2, s2)
        self.addLink(s1, s2)

it is working.

and he discovered that the first code causes the two switches to have the same DPID in OVS.

This behaviour is normal. Mininet generates a default DPID built on the numerical part of the switch name. In this case if you have multiple switches with the same numerical part in their name then they will have the same DPID, which will prevent the network to work properly. To specify your own DPID, you just have to make it explicit when you add a switch with addSwitch() from the Topo class.

For example, the code of @Giuseppe1992 becomes:

 class PodTopo1(Topo):
     def build(self):
         # server pod
         s1 = self.addSwitch('ss1', dpid='1')
         h1 = self.addHost('sh1')
         s2 = self.addSwitch('cs1', dpid='2')
         h2 = self.addHost('ch11')
         self.addLink(h1, s1)
         self.addLink(h2, s2)
         self.addLink(s1, s2)

A possible quick fix for your code can be:

class PodTopo(Topo):                                                                                                                                  
    def build(self, p=1, n=1, m=1):
        s = 1
        # server pod
        server_switch = self.addSwitch('ss1', dpid=str(s))
        s=s+1

        for i in range(1, m+1):
            server = self.addHost('sh%i' % i)
            self.addLink(server, server_switch)

        # client pods
        for i in range(1, p+1):
            client_switch = self.addSwitch('cs%i' % i, dpid=str(s))
            s=s+1

            for j in range(1, n+1):
                client = self.addHost('ch%i%i' % (i, j))
                self.addLink(client, client_switch)

            self.addLink(server_switch, client_switch)

please not that the DPID must be string as imposed by Mininet.

Example

Here is an example to show that it works as expected with the fix. The example generated a (p=3,n=3,m=3) topology.

root@484f7d44aca2:~/Distrinet/mininet# python3 bin/dmn --bastion=192.168.69.101 --workers="192.168.69.101,192.168.69.102,192.168.69.103" --controller=lxcremote,ip=192.168.0.1 --custom=custom/is50.py --topo=pods,p=3,n=3,m=3
mininet> nodes
available nodes are: 
c0 ch11 ch12 ch13 ch21 ch22 ch23 ch31 ch32 ch33 cs1 cs2 cs3 sh1 sh2 sh3 ss1
mininet> links
ch11-eth0<->cs1-eth1 (OK OK) 
ch12-eth0<->cs1-eth2 (OK OK) 
ch13-eth0<->cs1-eth3 (OK OK) 
ch21-eth0<->cs2-eth1 (OK OK) 
ch22-eth0<->cs2-eth2 (OK OK) 
ch23-eth0<->cs2-eth3 (OK OK) 
ch31-eth0<->cs3-eth1 (OK OK) 
ch32-eth0<->cs3-eth2 (OK OK) 
ch33-eth0<->cs3-eth3 (OK OK) 
sh1-eth0<->ss1-eth1 (OK OK) 
sh2-eth0<->ss1-eth2 (OK OK) 
sh3-eth0<->ss1-eth3 (OK OK) 
ss1-eth4<->cs1-eth4 (OK OK) 
ss1-eth5<->cs2-eth4 (OK OK) 
ss1-eth6<->cs3-eth4 (OK OK) 
mininet> pingallfull
*** Ping: testing ping reachability
ch11 -> ch12 ch13 ch21 ch22 ch23 ch31 ch32 ch33 sh1 sh2 sh3 
ch12 -> ch11 ch13 ch21 ch22 ch23 ch31 ch32 ch33 sh1 sh2 sh3 
ch13 -> ch11 ch12 ch21 ch22 ch23 ch31 ch32 ch33 sh1 sh2 sh3 
ch21 -> ch11 ch12 ch13 ch22 ch23 ch31 ch32 ch33 sh1 sh2 sh3 
ch22 -> ch11 ch12 ch13 ch21 ch23 ch31 ch32 ch33 sh1 sh2 sh3 
ch23 -> ch11 ch12 ch13 ch21 ch22 ch31 ch32 ch33 sh1 sh2 sh3 
ch31 -> ch11 ch12 ch13 ch21 ch22 ch23 ch32 ch33 sh1 sh2 sh3 
ch32 -> ch11 ch12 ch13 ch21 ch22 ch23 ch31 ch33 sh1 sh2 sh3 
ch33 -> ch11 ch12 ch13 ch21 ch22 ch23 ch31 ch32 sh1 sh2 sh3 
sh1 -> ch11 ch12 ch13 ch21 ch22 ch23 ch31 ch32 ch33 sh2 sh3 
sh2 -> ch11 ch12 ch13 ch21 ch22 ch23 ch31 ch32 ch33 sh1 sh3 
sh3 -> ch11 ch12 ch13 ch21 ch22 ch23 ch31 ch32 ch33 sh1 sh2 
*** Results: 
 ch11->ch12: 1/1, rtt min/avg/max/mdev 30.150/30.150/30.150/0.000 ms
 ch11->ch13: 1/1, rtt min/avg/max/mdev 27.044/27.044/27.044/0.000 ms
 ch11->ch21: 1/1, rtt min/avg/max/mdev 40.191/40.191/40.191/0.000 ms
 ch11->ch22: 1/1, rtt min/avg/max/mdev 32.012/32.012/32.012/0.000 ms
 ch11->ch23: 1/1, rtt min/avg/max/mdev 31.155/31.155/31.155/0.000 ms
 ch11->ch31: 1/1, rtt min/avg/max/mdev 34.303/34.303/34.303/0.000 ms
 ch11->ch32: 1/1, rtt min/avg/max/mdev 28.264/28.264/28.264/0.000 ms
 ch11->ch33: 1/1, rtt min/avg/max/mdev 33.312/33.312/33.312/0.000 ms
 ch11->sh1: 1/1, rtt min/avg/max/mdev 22.344/22.344/22.344/0.000 ms
 ch11->sh2: 1/1, rtt min/avg/max/mdev 21.292/21.292/21.292/0.000 ms
 ch11->sh3: 1/1, rtt min/avg/max/mdev 24.351/24.351/24.351/0.000 ms
 ch12->ch11: 1/1, rtt min/avg/max/mdev 0.447/0.447/0.447/0.000 ms
 ch12->ch13: 1/1, rtt min/avg/max/mdev 20.300/20.300/20.300/0.000 ms
 ch12->ch21: 1/1, rtt min/avg/max/mdev 32.157/32.157/32.157/0.000 ms
 ch12->ch22: 1/1, rtt min/avg/max/mdev 22.746/22.746/22.746/0.000 ms
 ch12->ch23: 1/1, rtt min/avg/max/mdev 27.009/27.009/27.009/0.000 ms
 ch12->ch31: 1/1, rtt min/avg/max/mdev 25.483/25.483/25.483/0.000 ms
 ch12->ch32: 1/1, rtt min/avg/max/mdev 23.656/23.656/23.656/0.000 ms
 ch12->ch33: 1/1, rtt min/avg/max/mdev 22.223/22.223/22.223/0.000 ms
 ch12->sh1: 1/1, rtt min/avg/max/mdev 21.872/21.872/21.872/0.000 ms
 ch12->sh2: 1/1, rtt min/avg/max/mdev 18.916/18.916/18.916/0.000 ms
 ch12->sh3: 1/1, rtt min/avg/max/mdev 19.244/19.244/19.244/0.000 ms
 ch13->ch11: 1/1, rtt min/avg/max/mdev 0.430/0.430/0.430/0.000 ms
 ch13->ch12: 1/1, rtt min/avg/max/mdev 0.760/0.760/0.760/0.000 ms
 ch13->ch21: 1/1, rtt min/avg/max/mdev 40.070/40.070/40.070/0.000 ms
 ch13->ch22: 1/1, rtt min/avg/max/mdev 23.807/23.807/23.807/0.000 ms
 ch13->ch23: 1/1, rtt min/avg/max/mdev 24.927/24.927/24.927/0.000 ms
 ch13->ch31: 1/1, rtt min/avg/max/mdev 26.886/26.886/26.886/0.000 ms
 ch13->ch32: 1/1, rtt min/avg/max/mdev 24.690/24.690/24.690/0.000 ms
 ch13->ch33: 1/1, rtt min/avg/max/mdev 24.334/24.334/24.334/0.000 ms
 ch13->sh1: 1/1, rtt min/avg/max/mdev 19.222/19.222/19.222/0.000 ms
 ch13->sh2: 1/1, rtt min/avg/max/mdev 19.038/19.038/19.038/0.000 ms
 ch13->sh3: 1/1, rtt min/avg/max/mdev 20.550/20.550/20.550/0.000 ms
 ch21->ch11: 1/1, rtt min/avg/max/mdev 1.279/1.279/1.279/0.000 ms
 ch21->ch12: 1/1, rtt min/avg/max/mdev 1.297/1.297/1.297/0.000 ms
 ch21->ch13: 1/1, rtt min/avg/max/mdev 1.049/1.049/1.049/0.000 ms
 ch21->ch22: 1/1, rtt min/avg/max/mdev 28.826/28.826/28.826/0.000 ms
 ch21->ch23: 1/1, rtt min/avg/max/mdev 22.590/22.590/22.590/0.000 ms
 ch21->ch31: 1/1, rtt min/avg/max/mdev 35.422/35.422/35.422/0.000 ms
 ch21->ch32: 1/1, rtt min/avg/max/mdev 23.501/23.501/23.501/0.000 ms
 ch21->ch33: 1/1, rtt min/avg/max/mdev 25.924/25.924/25.924/0.000 ms
 ch21->sh1: 1/1, rtt min/avg/max/mdev 23.902/23.902/23.902/0.000 ms
 ch21->sh2: 1/1, rtt min/avg/max/mdev 27.755/27.755/27.755/0.000 ms
 ch21->sh3: 1/1, rtt min/avg/max/mdev 22.358/22.358/22.358/0.000 ms
 ch22->ch11: 1/1, rtt min/avg/max/mdev 6.971/6.971/6.971/0.000 ms
 ch22->ch12: 1/1, rtt min/avg/max/mdev 6.915/6.915/6.915/0.000 ms
 ch22->ch13: 1/1, rtt min/avg/max/mdev 10.296/10.296/10.296/0.000 ms
 ch22->ch21: 1/1, rtt min/avg/max/mdev 0.756/0.756/0.756/0.000 ms
 ch22->ch23: 1/1, rtt min/avg/max/mdev 24.885/24.885/24.885/0.000 ms
 ch22->ch31: 1/1, rtt min/avg/max/mdev 36.560/36.560/36.560/0.000 ms
 ch22->ch32: 1/1, rtt min/avg/max/mdev 42.349/42.349/42.349/0.000 ms
 ch22->ch33: 1/1, rtt min/avg/max/mdev 31.606/31.606/31.606/0.000 ms
 ch22->sh1: 1/1, rtt min/avg/max/mdev 24.450/24.450/24.450/0.000 ms
 ch22->sh2: 1/1, rtt min/avg/max/mdev 29.647/29.647/29.647/0.000 ms
 ch22->sh3: 1/1, rtt min/avg/max/mdev 25.675/25.675/25.675/0.000 ms
 ch23->ch11: 1/1, rtt min/avg/max/mdev 28.534/28.534/28.534/0.000 ms
 ch23->ch12: 1/1, rtt min/avg/max/mdev 14.409/14.409/14.409/0.000 ms
 ch23->ch13: 1/1, rtt min/avg/max/mdev 20.148/20.148/20.148/0.000 ms
 ch23->ch21: 1/1, rtt min/avg/max/mdev 10.699/10.699/10.699/0.000 ms
 ch23->ch22: 1/1, rtt min/avg/max/mdev 12.458/12.458/12.458/0.000 ms
 ch23->ch31: 1/1, rtt min/avg/max/mdev 31.075/31.075/31.075/0.000 ms
 ch23->ch32: 1/1, rtt min/avg/max/mdev 32.194/32.194/32.194/0.000 ms
 ch23->ch33: 1/1, rtt min/avg/max/mdev 30.044/30.044/30.044/0.000 ms
 ch23->sh1: 1/1, rtt min/avg/max/mdev 21.569/21.569/21.569/0.000 ms
 ch23->sh2: 1/1, rtt min/avg/max/mdev 23.987/23.987/23.987/0.000 ms
 ch23->sh3: 1/1, rtt min/avg/max/mdev 19.932/19.932/19.932/0.000 ms
 ch31->ch11: 1/1, rtt min/avg/max/mdev 13.310/13.310/13.310/0.000 ms
 ch31->ch12: 1/1, rtt min/avg/max/mdev 20.211/20.211/20.211/0.000 ms
 ch31->ch13: 1/1, rtt min/avg/max/mdev 13.348/13.348/13.348/0.000 ms
 ch31->ch21: 1/1, rtt min/avg/max/mdev 15.183/15.183/15.183/0.000 ms
 ch31->ch22: 1/1, rtt min/avg/max/mdev 5.208/5.208/5.208/0.000 ms
 ch31->ch23: 1/1, rtt min/avg/max/mdev 6.737/6.737/6.737/0.000 ms
 ch31->ch32: 1/1, rtt min/avg/max/mdev 19.496/19.496/19.496/0.000 ms
 ch31->ch33: 1/1, rtt min/avg/max/mdev 20.778/20.778/20.778/0.000 ms
 ch31->sh1: 1/1, rtt min/avg/max/mdev 23.880/23.880/23.880/0.000 ms
 ch31->sh2: 1/1, rtt min/avg/max/mdev 24.777/24.777/24.777/0.000 ms
 ch31->sh3: 1/1, rtt min/avg/max/mdev 25.265/25.265/25.265/0.000 ms
 ch32->ch11: 1/1, rtt min/avg/max/mdev 9.472/9.472/9.472/0.000 ms
 ch32->ch12: 1/1, rtt min/avg/max/mdev 11.092/11.092/11.092/0.000 ms
 ch32->ch13: 1/1, rtt min/avg/max/mdev 11.177/11.177/11.177/0.000 ms
 ch32->ch21: 1/1, rtt min/avg/max/mdev 12.641/12.641/12.641/0.000 ms
 ch32->ch22: 1/1, rtt min/avg/max/mdev 5.278/5.278/5.278/0.000 ms
 ch32->ch23: 1/1, rtt min/avg/max/mdev 5.502/5.502/5.502/0.000 ms
 ch32->ch31: 1/1, rtt min/avg/max/mdev 0.800/0.800/0.800/0.000 ms
 ch32->ch33: 1/1, rtt min/avg/max/mdev 19.790/19.790/19.790/0.000 ms
 ch32->sh1: 1/1, rtt min/avg/max/mdev 21.448/21.448/21.448/0.000 ms
 ch32->sh2: 1/1, rtt min/avg/max/mdev 21.455/21.455/21.455/0.000 ms
 ch32->sh3: 1/1, rtt min/avg/max/mdev 22.572/22.572/22.572/0.000 ms
 ch33->ch11: 1/1, rtt min/avg/max/mdev 11.714/11.714/11.714/0.000 ms
 ch33->ch12: 1/1, rtt min/avg/max/mdev 9.813/9.813/9.813/0.000 ms
 ch33->ch13: 1/1, rtt min/avg/max/mdev 11.906/11.906/11.906/0.000 ms
 ch33->ch21: 1/1, rtt min/avg/max/mdev 13.188/13.188/13.188/0.000 ms
 ch33->ch22: 1/1, rtt min/avg/max/mdev 8.034/8.034/8.034/0.000 ms
 ch33->ch23: 1/1, rtt min/avg/max/mdev 8.840/8.840/8.840/0.000 ms
 ch33->ch31: 1/1, rtt min/avg/max/mdev 0.472/0.472/0.472/0.000 ms
 ch33->ch32: 1/1, rtt min/avg/max/mdev 0.517/0.517/0.517/0.000 ms
 ch33->sh1: 1/1, rtt min/avg/max/mdev 22.166/22.166/22.166/0.000 ms
 ch33->sh2: 1/1, rtt min/avg/max/mdev 21.408/21.408/21.408/0.000 ms
 ch33->sh3: 1/1, rtt min/avg/max/mdev 20.595/20.595/20.595/0.000 ms
 sh1->ch11: 1/1, rtt min/avg/max/mdev 4.911/4.911/4.911/0.000 ms
 sh1->ch12: 1/1, rtt min/avg/max/mdev 6.971/6.971/6.971/0.000 ms
 sh1->ch13: 1/1, rtt min/avg/max/mdev 3.448/3.448/3.448/0.000 ms
 sh1->ch21: 1/1, rtt min/avg/max/mdev 9.428/9.428/9.428/0.000 ms
 sh1->ch22: 1/1, rtt min/avg/max/mdev 6.229/6.229/6.229/0.000 ms
 sh1->ch23: 1/1, rtt min/avg/max/mdev 5.815/5.815/5.815/0.000 ms
 sh1->ch31: 1/1, rtt min/avg/max/mdev 5.908/5.908/5.908/0.000 ms
 sh1->ch32: 1/1, rtt min/avg/max/mdev 6.588/6.588/6.588/0.000 ms
 sh1->ch33: 1/1, rtt min/avg/max/mdev 5.400/5.400/5.400/0.000 ms
 sh1->sh2: 1/1, rtt min/avg/max/mdev 25.204/25.204/25.204/0.000 ms
 sh1->sh3: 1/1, rtt min/avg/max/mdev 23.325/23.325/23.325/0.000 ms
 sh2->ch11: 1/1, rtt min/avg/max/mdev 5.052/5.052/5.052/0.000 ms
 sh2->ch12: 1/1, rtt min/avg/max/mdev 5.258/5.258/5.258/0.000 ms
 sh2->ch13: 1/1, rtt min/avg/max/mdev 8.677/8.677/8.677/0.000 ms
 sh2->ch21: 1/1, rtt min/avg/max/mdev 10.656/10.656/10.656/0.000 ms
 sh2->ch22: 1/1, rtt min/avg/max/mdev 7.479/7.479/7.479/0.000 ms
 sh2->ch23: 1/1, rtt min/avg/max/mdev 7.059/7.059/7.059/0.000 ms
 sh2->ch31: 1/1, rtt min/avg/max/mdev 7.025/7.025/7.025/0.000 ms
 sh2->ch32: 1/1, rtt min/avg/max/mdev 4.730/4.730/4.730/0.000 ms
 sh2->ch33: 1/1, rtt min/avg/max/mdev 5.851/5.851/5.851/0.000 ms
 sh2->sh1: 1/1, rtt min/avg/max/mdev 0.587/0.587/0.587/0.000 ms
 sh2->sh3: 1/1, rtt min/avg/max/mdev 21.747/21.747/21.747/0.000 ms
 sh3->ch11: 1/1, rtt min/avg/max/mdev 4.816/4.816/4.816/0.000 ms
 sh3->ch12: 1/1, rtt min/avg/max/mdev 5.985/5.985/5.985/0.000 ms
 sh3->ch13: 1/1, rtt min/avg/max/mdev 7.399/7.399/7.399/0.000 ms
 sh3->ch21: 1/1, rtt min/avg/max/mdev 9.411/9.411/9.411/0.000 ms
 sh3->ch22: 1/1, rtt min/avg/max/mdev 7.770/7.770/7.770/0.000 ms
 sh3->ch23: 1/1, rtt min/avg/max/mdev 4.746/4.746/4.746/0.000 ms
 sh3->ch31: 1/1, rtt min/avg/max/mdev 5.112/5.112/5.112/0.000 ms
 sh3->ch32: 1/1, rtt min/avg/max/mdev 5.023/5.023/5.023/0.000 ms
 sh3->ch33: 1/1, rtt min/avg/max/mdev 4.027/4.027/4.027/0.000 ms
 sh3->sh1: 1/1, rtt min/avg/max/mdev 0.449/0.449/0.449/0.000 ms
 sh3->sh2: 1/1, rtt min/avg/max/mdev 0.705/0.705/0.705/0.000 ms
mininet> iperf
*** Iperf: testing TCP bandwidth between ch11 and sh3 
*** Results: ['91.2 Mbits/sec', '92.6 Mbits/sec']

The test has been run with a cluster of 3 VirtualBox VMs and the remote controller was ryu 4.15 running the simple_switch_stp_13.py app.

dsaucez commented 4 years ago

For a cleaner way of generating a DPID, have a look at How to create a network topology with mininet.

Giuseppe1992 commented 4 years ago

Documentation Updated: limitations