简体   繁体   中英

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 
  • 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM