i want to create a routing table for my simple network simulator. I need routing tables to be created automatically. I want this table to look this way:
[[destinationInterface, nextHop]
[destinationInterface, nextHop]]
So if router engine gets message addressed to destinationInterface, it sends it to nextHop. What I'm trying to do is this:
for h in self.creator.interfaceList: #checking my all interfaces
for c in h.connectionList: #checking my interfaces connections
self.routingTable.append([c,c]) #add connection as reachable via c
for ic in c.creator.interfaceList: #check all interfeces of c creator
for i in ic.connectionList: # check all connections of interfaces of c
self.routingTable.append([i,c]) #add i as reachable via c, since one of my interfaces is connected to c
#and so on...
for ij in i.creator.interfaceList:
for j in ij.connectionList:
#if self.creator.name=="ap2":
# print j.name
self.routingTable.append([j,c])
for ih in h.creator.interfaceList:
for y in ih.connectionList:
self.routingTable.append([y,c])
But this doesn't work. And I'm really confused about lines that I've put # in front, because this code works different with or without them.