CS551: Computer Communications
Spring 2000
Project 1: The Extended Bellman-Ford Algorithm

Due: 11:59pm on Friday March 10

Motivation

In this project you will build a simulated network using UNIX processes and inter-process communication. On this network, you will then demonstrate the extended Bellman-Ford algorithm we discussed in class.

For starters, you should read about socket programming and various system calls related to process management (like fork, kill etc).
 

Project Description

This project has two parts:

  • You will first write a simple program that takes in a description of network connectivity (a connectivity table) and spawns several processes. Each of these processes corresponds to a simulated router in the network.
  • Once each simulated router has figured out its connectivity table, it starts executing the extended Bellman-Ford algorithm (see the Cheng et al paper in the readings for the details). The output of your program must be the final routing table of each node in the network.
Part 1: Configuring the network

To configure the network, you will implement a program called the manager. The manager takes as an argument a single file. This file contains a network topology description. The format of this is as follows:

  • The first line of this table contains a single integer N. This means that there are N nodes in the network, whose addresses are 0, 1, 2, ..., N-1.
  • This line is followed by several lines, one for each point-to-point link in the network. Each line has 3 integers separated by whitespace: X, Y, C. X and Y are node numbers between 0 and N-1, and C is a positive integer that represents the cost of a link between X and Y.
Here is a sample network topology description:
 
10
0 9 40
0 4 60
0 2 40
1 8 70
2 6 70
3 9 20
3 8 70
3 5 70
4 7 70
4 6 40
5 9 70
5 7 40
7 9 60
8 9 70

After the manager reads the program, the following things must happen:

  • The manager must spawn one Unix process for each node in the network. In the subsequent description, we use the term router  to denote this process. 
  • In order to implement the extended Bellman-Ford protocol, each router must listen on a datagram (UDP) socket. Before the protocol message exchange can happen, the router must be told several pieces of information:
    • It's own address (a number between 0..N-1)
    • Its connectivity table (who it's neighbors are, what are the link costs to each neighbor, and the UDP port number for each neighbor).
  • You have to implement a simple protocol between the manager and each router so that the manager can tell the router this information. You should design the message formats for exchanging this information. One way of doing this is:
    • After each router starts up, it opens a TCP connection to the manager (figure out how it does this).
    • Then, the router sends a message to the manager telling it what its own UDP port is.
    • The router then sends a request to the manager to be assigned a node address, and to be given a connectivity table.
  • At this point, each router starts exchanging routing messages, as described below.
Part 2: Implementing the Extended Bellman-Ford Algorithm

The goal of this second part is to implement the Extended Bellman-Ford routing algorithm discussed in class. Once this part is implemented, you should be able to have each router process (after it has received its connectivity table) exchange distance vector messages with each of its neighbors. This distance-vector information should include the head of path data as described in the paper.

In order to implement this functionality:

  • You are expected to design your own C++ classes or C data structures (you may use either language to implement this project), and to design your own packet formats. In particular, your packet formats can be very simple.
  • You may assume that node and link failures do not happen. In particular, this means you do not  need to implement procedures that simulate these failures, and cause triggered routing updates to be sent when this happens.
  • You should carefully read and understand the protocol processing rules. It is useful to work out the algorithm on different simple topologies.
  • You need not implement periodic update routing messages. Rather, each router, after it receives its connectivity table from the manager, it sends out a routing update. Whenever it receives a routing update from a neighbor that causes a change in its own table, the router sends an update. 
  • You should figure out a way to determine when the routing exchange has converged. This can be as simple as waiting for several seconds, or up to a minute. At this time, you should ensure that all your processes terminate gracefully (i.e. the TA/grader does not have to use the kill(1) program to terminate your processes. 
File Layout

I want you to learn some basic concepts about Makefile and compiling programs when written in multiple files. So, your project must have the following:
 

  • Header file: This file contains all the declarations of the data structure, #includes and #define. This header file is then included in other C files.
  • C/C++ files: The whole project should be broken up into atleast two C/C++ files atleast, one for the first part and other for the second part (as described above). If you have a good file hierarchy in mind you can break up into more files but that break up should be logical and not just spreading functions into many files.
  • Makefile: Now that you have have so many files and also a library to link, you will need to create a makefile so that you can do all the compilations by just a word "make" :). Your makefile should take care of cleaning up the directory also, i.e. "make clean" should remove all the old *.o files and all the binary files. Read the make(1) man page.

 
Submitting your project

You should submit the project using submit command. The exact syntax of the command is the following. You have to submit all the files i.e. C/C++ files, *.h files,  and the makefile. 

% submit -user csci551 -tag proj1 file1 [ file2 ... ]

 

Evaluating your project

Here is how we will evaluate your submission. First, we will copy all the files you have submitted into an empty directory, and then type the following command:

% make

You should structure your makefile so that the result of this command is a single executable, called manager. We will then execute one or more of the following commands:

% ./manager test.data

where "test.data" is a file containing a network topology description. This description may not be the same as the example shown above. We will not tell you in advance what topology description we intend to use. You may, however, assume that the topology description will be syntactically correct.

To aid us in evaluating your program, your software should output the following files containing the information specified below. Be sure to adhere to the format suggested below, otherwise you may not get credit for your submission:
 

  • There should be one file named "ports". This file should have exactly as many lines as there are nodes in the network. Each line has two positive integers X and Y, separated by a single space character. X is the address of a router, and Y is the UDP port number assigned to the node. The lines should be sorted in increasing order of router address (that is, the first line should be for router 0, the second for router 1 and so on).
  • For each router, there should be one file containing the final distance vector table.  The name of this file should be the address of the corresponding router. Thus, your output should have N files names 0, 1, 2,..,N-1. This file should contain the routing table of the corresponding router. The format of each file is a sequence of lines. Each line depicts the routing table entry for a single router, say A. The format of a line is:
  • X Y C P1,P2,P3...
    • where X is the address of a router, Y is the address of the next hop from A towards X, C is the cost to reach X, and the remainder of the line describes the simple path from X to A. A single space character separates each element. There should be no spaces between P1,P2 etc.