Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

deleted 393 characters in body
Source Link
Michael M.
  • 11.2k
  • 11
  • 22
  • 46

Within a UBUNTU VM, using GNS3 I created code that is an attempt to after the user's input perform one of 3 different outcomes, however, the if statements don't work, the python files can't be found which I was trying to point to this the cd/home.. command. And the curl commands are apparently the incorrect syntax even though that is what I would enter fofor them to work. please help me out and get this working.enter image description here

enter image description here

This is what I tried:

#!/usr/bin/python3
import os
import subprocess
#os.system("cd /home/sdn/Downloads/ryu/ryu/app")
Code = input("Enter RYU, ONOS or CURL:")
print("Command entered was: " + Code)
if input == 'RYU':
 os.system('rest_router.py')
 os.system('gui_topology.py')
elif input == "ONOS":
 os.system('sudo /opt/onos/bin/onos-service start')
#elif input == "CURL":
# os.system('curl -X POST -d '{"address":"10.1.1.2/24"}' http://localhost:8080/router/000056e95a9e4843')
# os.system('curl -X POST -d '{"address":"10.2.2.2/24"}' http://localhost:8080/router/000056e95a9e4843')
# os.system('curl -X POST -d '{"address":"10.3.3.2/24"}' http://localhost:8080/router/000056e95a9e4843')

Within a UBUNTU VM, using GNS3 I created code that is an attempt to after the user's input perform one of 3 different outcomes, however, the if statements don't work, the python files can't be found which I was trying to point to this the cd/home.. command. And the curl commands are apparently the incorrect syntax even though that is what I would enter fo them to work. please help me out and get this working.enter image description here enter image description here

This is what I tried:

#!/usr/bin/python3
import os
import subprocess
#os.system("cd /home/sdn/Downloads/ryu/ryu/app")
Code = input("Enter RYU, ONOS or CURL:")
print("Command entered was: " + Code)
if input == 'RYU':
 os.system('rest_router.py')
 os.system('gui_topology.py')
elif input == "ONOS":
 os.system('sudo /opt/onos/bin/onos-service start')
#elif input == "CURL":
# os.system('curl -X POST -d '{"address":"10.1.1.2/24"}' http://localhost:8080/router/000056e95a9e4843')
# os.system('curl -X POST -d '{"address":"10.2.2.2/24"}' http://localhost:8080/router/000056e95a9e4843')
# os.system('curl -X POST -d '{"address":"10.3.3.2/24"}' http://localhost:8080/router/000056e95a9e4843')

Within a UBUNTU VM, using GNS3 I created code that is an attempt to after the user's input perform one of 3 different outcomes, however, the if statements don't work, the python files can't be found which I was trying to point to this the cd/home.. command. And the curl commands are apparently the incorrect syntax even though that is what I would enter for them to work. please help me out and get this working.

enter image description here

This is what I tried:

#!/usr/bin/python3
import os
import subprocess
Code = input("Enter RYU, ONOS or CURL:")
print("Command entered was: " + Code)
if input == 'RYU':
 os.system('rest_router.py')
 os.system('gui_topology.py')
elif input == "ONOS":
 os.system('sudo /opt/onos/bin/onos-service start')
Source Link

PYTHON Script not using OS Commands

Within a UBUNTU VM, using GNS3 I created code that is an attempt to after the user's input perform one of 3 different outcomes, however, the if statements don't work, the python files can't be found which I was trying to point to this the cd/home.. command. And the curl commands are apparently the incorrect syntax even though that is what I would enter fo them to work. please help me out and get this working. enter image description here enter image description here

This is what I tried:

#!/usr/bin/python3
import os
import subprocess
#os.system("cd /home/sdn/Downloads/ryu/ryu/app")
Code = input("Enter RYU, ONOS or CURL:")
print("Command entered was: " + Code)
if input == 'RYU':
 os.system('rest_router.py')
 os.system('gui_topology.py')
elif input == "ONOS":
 os.system('sudo /opt/onos/bin/onos-service start')
#elif input == "CURL":
# os.system('curl -X POST -d '{"address":"10.1.1.2/24"}' http://localhost:8080/router/000056e95a9e4843')
# os.system('curl -X POST -d '{"address":"10.2.2.2/24"}' http://localhost:8080/router/000056e95a9e4843')
# os.system('curl -X POST -d '{"address":"10.3.3.2/24"}' http://localhost:8080/router/000056e95a9e4843')
lang-py

AltStyle によって変換されたページ (->オリジナル) /