예제 #1
0
 def relearn_ports(self, event, log):
     """
     Throws either a port_up or port_down event to listening
     classes.
     """
     e = Event()
     e.dpid = event.dpid
     e.port = event.port
     if event.added:
         # Maybe ARP should be the only reason to acknowledge
         # a port_up. Else if you swap devices, they'll be
         # stale until ARP.
         for h in core.db.find_hosts({
                 'dpid': str(event.dpid),
                 'port_no': str(event.port)
         }):
             h['active'] = True
             core.db.update_host(h)
         self.handle_event("port_up", e)
     elif event.deleted:
         for h in core.db.find_hosts({
                 'dpid': str(event.dpid),
                 'port_no': str(event.port)
         }):
             h['active'] = False
             core.db.update_host(h)
         self.handle_event("port_down", e)
예제 #2
0
 def relearn_ports(self, event, log):
     """
     Throws either a port_up or port_down event to listening
     classes.
     """
     e = Event()
     e.dpid = event.dpid
     e.port = event.port
     if event.added:
         # Maybe ARP should be the only reason to acknowledge
         # a port_up. Else if you swap devices, they'll be
         # stale until ARP.
         for h in core.db.find_hosts({'dpid': str(event.dpid), 'port_no': str(event.port)}):
             h['active'] = True
             core.db.update_host(h)
         self.handle_event("port_up", e)
     elif event.deleted:
         for h in core.db.find_hosts({'dpid': str(event.dpid), 'port_no': str(event.port)}):
             h['active'] = False
             core.db.update_host(h)
         self.handle_event("port_down", e)