Computer Networking, Fall 2021
Assignment 3: Routing Simulation
2021.11.20
1 Introduction
In this assignment, you will implement the distance vector routing protocol. You are
asked to writing two programs: router and agent. A router program represents a router
process. You may need to invoke multiple router programs. On the other hand, the
agent program is a centralized control agent that triggers the route updates of the
routers.
2 Protocol Description
2.1 Configuration files
We need to prepare two configuration files in advance before we start the router and
agent programs. They are the router location file and the topology configuration file.
2.1.1 Router location file
The router location file maps a unique router ID to a router process. Each router is
defined by a 3-tuple:
Each router is assigned a unique identifier router id. It runs on IP router IP,
and listens on port router port for two pieces of information: (i) commands from the
agent and (ii) messages from other routers. For example, the router location file can
be represented as follows:
6
137.189.88.101,13001,1
1
137.189.88.101,13002,2
137.189.88.101,13003,3
137.189.88.102,13001,4
137.189.88.102,13002,5
137.189.88.102,13003,100
Both the routers and the agent need to parse the router location file. The first
line denotes the number of routers in the network, while the following lines define the
configuration of each router. Note that the router IDs may not be consecutive. For
instance, it is possible to have a network composed of routers with IDs 1, 2, and 4
without the ID 3. For simplicity, we make the following assumptions:
• The router location file is error-free, in the sense that (i) there is no formatting
error, (ii) the router ID in each row is unique, (iii) there is no conflict of router
port numbers, and (iv) the IP addresses and port numbers are actually used by
the corresponding router (the details of how we invoke a router are discussed
later).
• Router IDs are all integers.
• The network has at most 10 routers.
2.1.2 Topology configuration file
The topology configuration file specifies the router topology. Here, the distance between
two neighboring routers is unidirectional, i.e., the distance from router 1 to router 2 may
be different from the distance from router 2 to router 1. The topology configuration
file is a text file composed of a number of topology tuples. The format of a topology
tuple is shown below: