Search⌘ K
AI Features

Programming Challenge: Routing Information Protocol

Explore how to implement the Routing Information Protocol (RIP) in Python using a provided network simulator. Learn to work with router objects, ports, and routing tables to simulate real-world routing behavior. This lesson helps you understand and apply fundamental network layer routing concepts through practical coding.

Problem Statement

In this challenge, you will implement the routing information protocol that we just studied in the last lesson! You’re given some starter code files.

Starter Code

For this coding challenge, we are providing you with a network simulator written in python3. The implementation of our simplified version of RIP is also required in Python. Let’s look at the starter code module by module.

topology_reader.py

This is the entry point to our code. It takes a network topology in the form of a Python list as input and returns a list of router objects that reflect that topology. Here’s what the topology looks like:

Sample Input

Python 3.5
topology = [
[1, [11, 2, 21, 1], [12, 4, 41, 1]], # Routers and ports
[2,[21, 1, 11, 1],[22, 5, 53, 1], [23,3,31,1]], #[IP of router, [port of router, IP of destination router, IP of port of destination router, cost]]
[3,[31,2,23,1],[32,5,52,1]],
[4,[41,1,12, 1],[42,5,51,1]],
[5,[51,4,42,1],[52,3,32,1],[53,2,22,1]]
]

The list consists of sublists. Each sublist represents one router. So [1, [11, 2, 21, 1], [12, 4, ...