Commit 86c517e2 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Added an extra field as a placeholder for loss in the initial-conditions...

Added an extra field as a placeholder for loss in the initial-conditions format as per Mike's request.
parent 04cc73f3
10.0.0.1 10.0.0.2 20 2000
10.0.0.2 10.0.0.1 20 2000
10.0.0.1 10.0.0.2 20 2000 0
10.0.0.2 10.0.0.1 20 2000 0
......@@ -175,7 +175,7 @@ def populate_ip_tables():
# Format of an initial conditions file is:
#
# List of lines, where each line is of the format:
# <source-ip> <dest-ip> <delay> <bandwidth>
# <source-ip> <dest-ip> <delay> <bandwidth> <loss>
#
# Where source and dest ip addresses are in x.x.x.x format, and delay and
# bandwidth are integral values in milliseconds and kilobits per second
......@@ -184,8 +184,9 @@ def read_initial_conditions():
input = open(initial_filename, 'r')
line = input.readline()
while line != '':
fields = line.strip().split(' ', 3)
if len(fields) == 4 and fields[0] == this_ip:
# Don't worry about loss for now. Just discard the value.
fields = line.strip().split(' ', 4)
if len(fields) == 5 and fields[0] == this_ip:
set_link(fields[0], fields[1], 'delay=' + str(int(fields[2])/2))
set_link(fields[0], fields[1], 'bandwidth=' + fields[3])
connection_bandwidth[fields[1]] = int(fields[3])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment