I'm trying to understand discovery.py's use of lldp scanning.  I'm
relatively new to python, but it looks like it only sends one lldp packet on
the network at a time (lines 315-350), but I can't figure out why this would
be.  Since the lldp packets have no rule for forwarding, they should only
travel over one network edge, and have no chance of being received by some
switch other than the one on the other end of that pipe - why only send one
out at a time, rather than scanning the whole network simultaneously?

The code in question, for convenience:

>     def start_lldp_timer_thread(self):
>
>
> #----------------------------------------------------------------------
>         # Generator which iterates over a set of dp's and sends an LLDP
> packet
>         # out of each port.
>
> #----------------------------------------------------------------------
>
>         def send_lldp (packets):
>             for dp in packets:
>                 # if they've left, ignore
>                 if not dp in self.dps:
>                     continue
>                 try:
>                     for port in packets[dp]:
>                         #print 'Sending packet out of
> ',longlong_to_octstr(dp), ' port ',str(port)
>                         self.send_openflow_packet(dp,
> packets[dp][port].tostring(), port)
>                         yield dp
>                 except Exception, e:
>                     # catch exception while yielding
>                     lg.error('Caught exception while yielding'+str(e))
>
>         def build_lldp_generator():
>
>             def g():
>                 try:
>                     g.sendfunc.next()
>                 except StopIteration, e:
>                     g.sendfunc =
> send_lldp(copy.deepcopy(self.lldp_packets))
>                 except Exception, e:
>                     lg.error('Caught exception from generator '+str(e))
>                     g.sendfunc =
> send_lldp(copy.deepcopy(self.lldp_packets))
>                 self.post_callback(self.lldp_send_period, g)
>             g.sendfunc = send_lldp(copy.deepcopy(self.lldp_packets))
>             return g
>
>         self.post_callback(self.lldp_send_period, build_lldp_generator())
>         self.post_callback(TIMEOUT_CHECK_PERIOD, lambda :
> discovery.timeout_links(self)
>
-- 
Alec Story
Cornell University
Biological Sciences, Computer Science 2012
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

Reply via email to