Example #1
0
 def log(self, evt=None, p=None, *args, **kwargs):
     """Overloaded to check verbose level and set common annotations."""
     force = False
     if ('verbose' in kwargs): force = (kwargs['verbose']>ROUTING_VERBOSE)
     if self.verbose>ROUTING_VERBOSE or force:
         kwargs.update(self.get_route_anno(p))
         kwargs.update(self.get_ip_anno(p))
         NET.log(self, evt, p, *args, **kwargs)
Example #2
0
 def __init__(self, **kwargs):
     """Constructor."""
     self.__table = None
     NET.__init__(self, **kwargs)
     assert isinstance(self.table, RouteTable), \
             "[ROUTING]: Must have valid RouteTable!"
     assert self.hasroute(self.address), \
             "[ROUTING]: RouteTable has no entry for local address!"
     assert self.hasroute(self.address), \
             "[ROUTING]: RouteTable has no entry for broadcast address!"
Example #3
0
 def configure(self, **kwargs):
     """Call `NET.configure()`, initialize routing table, add ports, and
     spawn `FSM` to run static routing algorithm."""
     NET.configure(self, **kwargs)
     self.table = self.newchild('routetable', RouteTable, \
                                name=self.name+".rtable", \
                                tracename=self.tracename+".RTABLE")
     self.addport("TXU")     # port to send traffic to upstream protocol
     self.addport("RXU")     # port to recv traffic from upstream protocol
     # create FSM to manage send/recv execution of routing
     txfsm = self.newchild("txfsm", FSM, tracename=self.tracename+".TX")
     rxfsm = self.newchild("rxfsm", FSM, tracename=self.tracename+".RX")
     txfsm.goto(self.SEND)
     rxfsm.goto(self.RECV)