Mininet buyruqlar ichidagi buyruqlar tashqaridan python skriptlarini ishlatish

Mininet uchun yangi. Mininet buyruqlaridan "tugunlar", "dump" kabi python skriptlaridan ishlashni xohlayman. Men topologiyani yaratishim mumkin, ammo bu buyruqlarni skript orqali ishlata olmayman. Men Ubuntu 14.04 dan foydalanmoqdaman.

import subprocess as sb
import os
print "Single Switch and 4 Hosts per switch topology"
print "Creation of topology"
os.system(" sudo mn --topo = single,4",shell=True)
os.system("nodes")

Xato:

sh: 1: nodes: not found
32512

Python skripti orqali topologiyani yaratmoqchi emasman, faqat mininet buyruqlaridan foydalanmoqchiman.

1
mininet pythonic API mavjud. Bash yordamida uni chaqirish uchun sabab bormi?
qo'shib qo'ydi muallif nir0s, manba

6 javoblar

Muammo shundaki, mininet interaktiv CLI. Siz shunchaki qo'ng'iroq qila olmaysiz va interfaol CLI blokirovka bo'lgani uchun boshqa buyruqni topshira olmaysiz.

There are ways to solve that. Look here: Wrapping an interactive CLI in python

interfaol CLI'lar bilan yanada qulay aloqa o'rnatish uchun pexpect ni tekshiring.

1
qo'shib qo'ydi

Glad I found this question. I have a sub-question of a very similar nature. I understand that you can execute a command into the mininet CLI from python using e.g. h1.cmd('ifconfig') , but is there a way to do the same from python to the mininet> prompt ? i.e. not pointing it to a specific host in the topology (I am simulating faults so some hosts are disconnected). Something like net.cmd('python module.py') ? @Abhimanyu singh @nir0s

0
qo'shib qo'ydi
Buni siz yangi savol sifatida so'rashingizni tavsiya qilaman. Siz nima qilishni istaganingizning aniq namunalari bilan.
qo'shib qo'ydi muallif Abhimanyu singh, manba

Glad I found this question. I have a sub-question of a very similar nature. I understand that you can execute a command into the mininet CLI from python using e.g. h1.cmd('ifconfig') , but is there a way to do the same from python to the mininet> prompt ? i.e. not pointing it to a specific host in the topology (I am simulating faults so some hosts are disconnected). Something like net.cmd('python module.py') ? @Abhimanyu singh @nir0s

0
qo'shib qo'ydi
Buni siz yangi savol sifatida so'rashingizni tavsiya qilaman. Siz nima qilishni istaganingizning aniq namunalari bilan.
qo'shib qo'ydi muallif Abhimanyu singh, manba

Glad I found this question. I have a sub-question of a very similar nature. I understand that you can execute a command into the mininet CLI from python using e.g. h1.cmd('ifconfig') , but is there a way to do the same from python to the mininet> prompt ? i.e. not pointing it to a specific host in the topology (I am simulating faults so some hosts are disconnected). Something like net.cmd('python module.py') ? @Abhimanyu singh @nir0s

0
qo'shib qo'ydi
Buni siz yangi savol sifatida so'rashingizni tavsiya qilaman. Siz nima qilishni istaganingizning aniq namunalari bilan.
qo'shib qo'ydi muallif Abhimanyu singh, manba

Glad I found this question. I have a sub-question of a very similar nature. I understand that you can execute a command into the mininet CLI from python using e.g. h1.cmd('ifconfig') , but is there a way to do the same from python to the mininet> prompt ? i.e. not pointing it to a specific host in the topology (I am simulating faults so some hosts are disconnected). Something like net.cmd('python module.py') ? @Abhimanyu singh @nir0s

0
qo'shib qo'ydi
Buni siz yangi savol sifatida so'rashingizni tavsiya qilaman. Siz nima qilishni istaganingizning aniq namunalari bilan.
qo'shib qo'ydi muallif Abhimanyu singh, manba
Python
Python
372 ishtirokchilar

Bu guruh python dasturlash tilini muhokama qilish uchun. Iltimos, o'zingizni hurmat qiling va faqat dasturlash bo'yicha yozing. Botlar mavzusini @botlarhaqida guruhida muhokama qling! FAQ: @PyFAQ Offtopic: @python_uz_offtopic

Python offtopic group !
Python offtopic group !
150 ishtirokchilar

@python_uz gruppasining offtop gruppasi. offtop bo'lsa ham reklama mumkin emas ) Boshqa dasturlash tiliga oid gruppalar @languages_programming