-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_topo.py
40 lines (32 loc) · 938 Bytes
/
run_topo.py
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
WeChat: cstutorcs
QQ: 749389476
Email: tutorcs@163.com
#!/usr/bin/python
# Distance Vector project for CS 6250: Computer Networks
#
# This how you run the topology and have it execute the Bellman-Ford algorithm.
# Generically, it is run as follows:
# python run_topo.py <topology_file> <log_file>
# For instance, to run topo1.py and log to topo1.log that we created, use the following:
# python run_topo.py topo1 topo1.log
# Note how the topology file doesn't have the .py extension.
#
# Students should not modify this file.
#
# Copyright 2015 Sean Donovan
import sys
from Topology import *
from Node import *
from helpers import *
if len(sys.argv) != 3:
print("Syntax:")
print(" python run_topo.py <topology_file> <log_file>")
exit()
# Start up the logfile
open_log(sys.argv[2])
# Populate the topology
topo = Topology(sys.argv[1])
# Run the topology.
topo.run_topo()
# Close the logfile
finish_log()