educative.io

Typo in topology_reader.py?

I am reading the starter code and it seems that there’s a typo in topology_reader.py at line 15, which reads:

r.add_RIP_entry(None, rtr[0], 0, None)

I think this line is intended to add a forwarding table entry representing “The path for a router to itself has cost 0”. If this is the case, then the 2nd and 3rd argument should be swapped: cost should be 0 and dest_IP_address should be the source itself (rtr[0]). The current code would mean the opposite: cost is rtr[0] and dest_IP_address is 0.


Course: Grokking Computer Networking for Software Engineers - Learn Interactively
Lesson: Programming Challenge: Routing Information Protocol - Grokking Computer Networking for Software Engineers

Hi @Yi_Xie !!
Yes, you’re correct. There seems to be a typo in the line you mentioned in topology_reader.py. The arguments for the add_RIP_entry method are swapped. The corrected line should be:

r.add_RIP_entry(rtr[0], None, 0, None)

This line adds a forwarding table entry for the router’s own IP address with a cost of 0. By swapping the arguments, it correctly assigns the router’s IP address (rtr[0]) as the destination IP address and sets the cost to 0.

Thank you for spotting the error, and we apologize for any confusion it may have caused. We will update this soon. Happy Learning :blush:

It has been updated in the course. Happy Learning :blush:

The correct code r.add_RIP_entry(None, rtr[0], 0, None), otherwise the provided solution doesn’t even pass the tests.


Course: Grokking Computer Networking for Software Engineers - Learn Interactively
Lesson: Programming Challenge: Routing Information Protocol - Grokking Computer Networking for Software Engineers