0

I have a topology in Mininet-Wifi that has 25 stations and 6 access points and I try to examine load balance performance of the controller.

Everything is fine. Code works, load balancer works etc. but it is so boring that start the traffic from xterm window of each station. I have carried out tests for 5 stations but I have bored already.

I have checked some Mininet CLI documentation, tried to execute bash file, etc. but I couldn't find a useful solution. Is there any way for starting traffic from 25 stations with iperf at the same time?

neurocranium
  • 75
  • 10

3 Answers3

0

if you don't want to open an xterm for each node, using the CLI, you can simply do:

NODENAME COMMAND,

mininet> h1 echo 'hello'
hello

this will execute echo 'hello' on host h1.

otherwise, you can build a python script and use the cmd function on the nodes. API

example with pipe: If you want to redirect the out of h1 in h1.txt and then test with iperf.

mininet> h1 iperf -s | tee h1.txt &
mininet> h2 iperf -c 10.0.0.1
------------------------------------------------------------
Client connecting to 10.0.0.1, TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  3] local 10.0.0.2 port 51858 connected with 10.0.0.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  2.43 GBytes  2.08 Gbits/sec
mininet>

in this case, doing cat h1.txt in the directory, I have the log:

root@raspberrypi:~# cat h1.txt
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 10.0.0.1 port 5001 connected with 10.0.0.2 port 51858
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  2.43 GBytes  2.08 Gbits/sec
root@raspberrypi:~#
Giuseppe
  • 658
  • 1
  • 6
  • 14
  • I tried echo command but not works. I ran `h1 echo 'iperf -s | tee h1.txt'` command in Mininet CLI but unfortunately it didnt work. – neurocranium Jul 17 '20 at 20:05
  • Also, I checked Python API but when sending the command above with `h1.cmd`, the program is waiting for the response of this command. But it just does that making server and logging till the end of the simulation. So simulation stucks at that code and therefore pinging can not be started. – neurocranium Jul 17 '20 at 20:15
  • @neurocranium I added the example with the pipe. If you use echo, it will just print the command, and you have to add & at the end, otherwise, you have to wait for the end of the command. – Giuseppe Jul 18 '20 at 07:58
  • when doing iperf did u observe that initially more than one packet in messages are sending to controller by a switch for the same flow.. how to solve this problem. – Vinay Sep 06 '20 at 20:50
0

I think you can do that using threading for example(in python), you have 10 senders or hosts :

finish_time = 0
start_time = time.time()

for i in range(1,10):
       t = threading.Thread(target= Training, args=(net,i,))
       t.setDaemon(True)
       t.start()
while finish_time <60:     
         finish_time = time.time() - start_time


def Training(net,i):
      start_time = time.time()
      finish_time = 0
      while finish_time < 60: 
        client=net.get('h%s'%str(i))
        client.cmdPrint('do something &')         
        t_end = time.time() + 1
        while time.time() < t_end:
            pass #python time sleep function actually stops the execution of current thread only, not the whole program.
        finish_time = time.time() - start_time
0

makeTerm does the work.

from mininet.term import makeTerm
...
...

makeTerm(sta1, title='title', cmd="bash -c 'ping 10.0.0.2;'")

Ramon Fontes
  • 156
  • 4