Brodie Anderson
Brodie Anderson

Reputation: 11

PYTHON script using OS commands to start ONOS controller, RYU Controller and add ISP router flows? (GNS3)

Within a UBUNTU VM, using GNS3 I created code that is an attempt to perform 3 different outcomes, since these programs can't run mutally in the same terminal however I'm not sure how to seperate them into seperate terminals and add delays inbetween to prevent any issues that might occur.

    #!/usr/bin/python3

    import os
    import subprocess

    os.system("cd /home/sdn/Downloads/ryu/ryu/app")
    print("The working directory : ")
    os.system("pwd")
    print('\n')

    #insert time delay and open new terminal
    os.system('./rest_router.py')
    os.system('./gui_topology.py')

    #insert time delay and open new terminal
    os.system('sudo /opt/onos/bin/onos-service start')

    #insert time delay
    #these curl commands are apparently wrong syntax?
    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)

Upvotes: 1

Views: 133

Answers (0)

Related Questions