[nox-dev] Question about the Discovery Module
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
Re: [nox-dev] Question about the Discovery Module
Because do you have only one controller and the controller have that send and receive the LLDP packets for all (ports) OpenFlow switches. Do you can to implement Python threads or multiple controller. But do you will have many LLDP packets for treat at the some time. Was that? Greetings, Carlos Macapuna www.macapuna.com.br On Sun, Nov 14, 2010 at 7:03 PM, Alec Story av...@cornell.edu wrote: 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 ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Question about the Discovery Module
Well, there are two things to consider: 1. If by scanning the network simultaneously you mean doing a broadcast at every switch, then you will be a bit handicapped. That's because when you do a broadcast, you have to send the same packet out of every port and so your packet cannot carry the originating port data with it. 2. Now, if you want to just send all packets at once from all switches, then you are risking both a flood on the network and/or overloading the switches' cpu. Hope that helps. On Sun, Nov 14, 2010 at 2:14 PM, Alec Story av...@cornell.edu wrote: But you know (from the lldp packet) where the packet originated, and you know from the dpid and inport argument to your packet handler where the packet ended up, so, as far as I can tell, you can differentiate between multiple packets just fine. On Sun, Nov 14, 2010 at 4:57 PM, Macapuna, Carlos A. B. carlosmacap...@gmail.com wrote: Because do you have only one controller and the controller have that send and receive the LLDP packets for all (ports) OpenFlow switches. Do you can to implement Python threads or multiple controller. But do you will have many LLDP packets for treat at the some time. Was that? Greetings, Carlos Macapuna www.macapuna.com.br On Sun, Nov 14, 2010 at 7:03 PM, Alec Story av...@cornell.edu wrote: 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 -- 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 ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Question about the Discovery Module
Yes! Or you can change the parameters, to send more packets at less time: LLDP_SEND_PERIOD = .10 TIMEOUT_CHECK_PERIOD = 5. LINK_TIMEOUT = 10. But, how said the Ali, you can overload the network/controller. Hope that helps too. Carlos Macapuna www.macapuna.com.br On Sun, Nov 14, 2010 at 8:27 PM, Ali Reza Sharafat ali.shara...@gmail.comwrote: Well, there are two things to consider: 1. If by scanning the network simultaneously you mean doing a broadcast at every switch, then you will be a bit handicapped. That's because when you do a broadcast, you have to send the same packet out of every port and so your packet cannot carry the originating port data with it. 2. Now, if you want to just send all packets at once from all switches, then you are risking both a flood on the network and/or overloading the switches' cpu. Hope that helps. On Sun, Nov 14, 2010 at 2:14 PM, Alec Story av...@cornell.edu wrote: But you know (from the lldp packet) where the packet originated, and you know from the dpid and inport argument to your packet handler where the packet ended up, so, as far as I can tell, you can differentiate between multiple packets just fine. On Sun, Nov 14, 2010 at 4:57 PM, Macapuna, Carlos A. B. carlosmacap...@gmail.com wrote: Because do you have only one controller and the controller have that send and receive the LLDP packets for all (ports) OpenFlow switches. Do you can to implement Python threads or multiple controller. But do you will have many LLDP packets for treat at the some time. Was that? Greetings, Carlos Macapuna www.macapuna.com.br On Sun, Nov 14, 2010 at 7:03 PM, Alec Story av...@cornell.edu wrote: 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 -- 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 ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Question about the Discovery Module
To be precise, what I want to do is iterate over all of the ports and send a packet out of each of them, NOT broadcast - I understand that that wouldn't work if I wanted to get specific port information. My reading of discovery.py (which might not be right, again, I'm new to python) seems to indicate that it has a delay between scans. I'm implementing a system that only scans reactively on events - for example, when a switch comes online I'd like to scan all of its ports (individually, but those packets would all be on the network at once, on different wires). Since this is only at most two packets per link on the network (assuming I don't scan the entire network very frequently), I don't see how this is a threat to overloading the switches if the lldp packets don't get forwarded. I don't think this would be a problem, but since discovery.py implements this delay, I'm afraid I'm missing something. The crux of the issue is this: Would there be a problem with having multiple lldp packets on different wires in the same network? On Sun, Nov 14, 2010 at 5:27 PM, Ali Reza Sharafat ali.shara...@gmail.comwrote: Well, there are two things to consider: 1. If by scanning the network simultaneously you mean doing a broadcast at every switch, then you will be a bit handicapped. That's because when you do a broadcast, you have to send the same packet out of every port and so your packet cannot carry the originating port data with it. 2. Now, if you want to just send all packets at once from all switches, then you are risking both a flood on the network and/or overloading the switches' cpu. Hope that helps. On Sun, Nov 14, 2010 at 2:14 PM, Alec Story av...@cornell.edu wrote: But you know (from the lldp packet) where the packet originated, and you know from the dpid and inport argument to your packet handler where the packet ended up, so, as far as I can tell, you can differentiate between multiple packets just fine. On Sun, Nov 14, 2010 at 4:57 PM, Macapuna, Carlos A. B. carlosmacap...@gmail.com wrote: Because do you have only one controller and the controller have that send and receive the LLDP packets for all (ports) OpenFlow switches. Do you can to implement Python threads or multiple controller. But do you will have many LLDP packets for treat at the some time. Was that? Greetings, Carlos Macapuna www.macapuna.com.br On Sun, Nov 14, 2010 at 7:03 PM, Alec Story av...@cornell.edu wrote: 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
Re: [nox-dev] Question about the Discovery Module
Ok, good, that's what I was hoping for. Thanks! On Sun, Nov 14, 2010 at 5:44 PM, Martin Casado cas...@nicira.com wrote: Would there be a problem with having multiple lldp packets on different wires in the same network? No, there would be no problem. The reason for the delay is to save CPU and control bandwidth. -- 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