intrig-unicamp / mininet-wifi

Emulator for Software-Defined Wireless Networks
https://mn-wifi.readthedocs.io/
Other
459 stars 245 forks source link

CLI command via script #511

Open andredemori opened 1 year ago

andredemori commented 1 year ago

Is there any way to run a command in the CLI per line of code?

I need to run the following command:

mininet-wifi> sh ifconfig hwsim0 up

but i need to run it via script and not via terminal. Is there a way to include this command in my code?

ramonfontes commented 1 year ago

You can run that command from any node running at root ns.

node.cmd('command')

andredemori commented 1 year ago

I tried, but in Wireshark, when I select hwsim0 it says the device is still down. Only works via CLI.

ramonfontes commented 1 year ago

Did you bring the interface up??

andredemori commented 1 year ago

i'm trying to do it in the code, but only works via CLI

sta1.cmd('sh ifconfig hwsim0 up') --> not works

mininet-wifi> sh ifconfig hwsim0 up --> works

I don't know if there is a way to run this command in the code. only via CLI. Do you know a way?

ramonfontes commented 1 year ago

Is sta1 running at root NS?? And why are you using sh??

andredemori commented 1 year ago

sorry. I don't know how to run sta1 at root NS.

I run with sh because it not works without sh

mininet-wifi> ifconfig hwsim0 up *** Unknown command: ifconfig hwsim0 up

Thanks in advance.