This project is a Python implementation of the link state and distance vector routing protocols. There are two separate programs: one that implements the link state protocol, and one that implements the distance vector protocol. Both programs read and use the same file format for the network’s topology as well as the same format for messages to send.
-
Run
chmod +x dvr.sh lsr.sh
to make the scripts executable. -
Run
python3 -m venv myenv
and thensource myenv/bin/activate
to start a virtual environment. -
Run
pip install -r requirements.txt
in the virtual environment to install dependencies. -
To start a simulation, run one of the following commands:
./dvr.sh <topologyFile> <messageFile> <changesFile> [outputFile]
Example:
./dvr.sh topology.txt message.txt changes.txt
./lsr.sh <topologyFile> <messageFile> <changesFile> [outputFile]
Example:
./lsr.sh topology.txt message.txt changes.txt
-
Run
pytest
to run the tests.NOTE: The tests require
dos2unix
to run on Linux. If you do not already have this package installed please run:sudo apt-get update sudo apt-get install dos2unix
-
Run
deactivate
to stop the virtual environment.
We used Pytest, a Python testing framework, to test our code. These test files can be found in the test
directory.
To run the test suite:
- Complete the first three steps in the instructions to ensure Pytest is installed.
- In the command line, run
pytest
to start the test suite.
Note that you can run the test suite from the root or test
directory.