-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_net_only.py
More file actions
executable file
·49 lines (41 loc) · 1.37 KB
/
run_net_only.py
File metadata and controls
executable file
·49 lines (41 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python3
from python_utils.test_utils import read_topology_to_dict
from python_utils.test_utils import read_test_list_to_list
from python_utils.test_utils import read_test_to_dict
import subprocess
import sys
import time
mininet_dir = "/home/pcc/mininet/"
sys.path.append(mininet_dir)
from python_utils import mininet_utils
from mininet.link import TCLink
from mininet.net import Mininet
default_build_dir = "/home/pcc/pcc_test_scheme/"
tests_to_run = sys.argv[1]
username = "pcc"
def run_net_for_test(test_dict):
print("HI==================HI")
print("Removing any running mininet instance.")
mininet_clean_output = subprocess.check_output(["sudo", "mn", "-c"])
test_topo_dict = read_topology_to_dict(test_dict["Topology"])
test_link_types = test_dict["Link Types"]
topo = mininet_utils.MyTopo(test_topo_dict, test_link_types)
net = Mininet(topo=topo, link=TCLink)
mininet_utils.sshd(net)
topo.start_all_link_managers(net)
while True:
time.sleep(1.0)
##
# Load in the test descriptor files.
##
all_test_names = read_test_list_to_list(tests_to_run)
all_tests = [read_test_to_dict(t) for t in all_test_names]
##
# Run the network for each test. Right now, this only runs the network for the first test, then
# it waits to be killed.
##
try:
for test in all_tests:
run_net_for_test(test)
except Exception as e:
print(e)