pady
pady

Reputation: 15

How to run Python Code in mininet

I write a simple topology with Python in mininet, but I dont know how to execute my code,I searched in internet and find several methods. which one is correct? And what is the difference between them?

  1. Method 1:

    sudo mn --custom ~/mininet/custom/filename.py --topo mytopo
    
  2. Method 2:

    sudo phython filename.py
    
  3. Method 3:

    chmod u+x filename.py
    sudo ./filename.py
    

Upvotes: 1

Views: 3855

Answers (1)

Marievi
Marievi

Reputation: 5009

  • Method 1 is the classical method to deploy a custom topology in Mininet. You can specify in the same command the controller, like this :

    sudo mn --custom ~/mininet/custom/filename.py --topo mytopo --controller=remote,ip=[CONTROLLER_IP],port=6633
    

    or if you don't, Mininet will use the default.

  • Method 2 executes the [FILENAME] file. Note that here you have to specify the controller which you will use inside the python script. This is the difference with Method 1.

  • Method 3 makes the [FILENAME] file executable with the first command, and then executes it. It is the same as Method 2.

Upvotes: 1

Related Questions