OiaSam
OiaSam

Reputation: 560

How to execute a python program in Mininet environment in multiple xterm windows simultaneously?

I have a python program (mypro.py) in which i want to run on all the hosts of my topology simultaneously (i.e., without going to each xtrem window and typing python mypro.py). Is there a way to do that on the xterm of Mininet environment by using a script?

Many thanks

Upvotes: 3

Views: 1239

Answers (2)

N. S.
N. S.

Reputation: 169

py [h.cmd('python mypro.py &') for h in net.hosts]

or If you are running a Mininet script, you can add the following code to execute the installation command on all nodes:

from mininet.net import Mininet
net = Mininet()
net.start()

for host in net.hosts:
    host.cmd('python mypro.py')

net.stop()

Upvotes: 0

Icaro Camelo
Icaro Camelo

Reputation: 382

Suppose you have a simple topology, h1 - s1 - h2, you could forward X11, then:

  1. xterm h1 h2 (To enter into the hosts, then two windows will pop up)
  2. python mypro.py

Upvotes: 0

Related Questions