class discovery(Component): def __init__(self, ctxt): Component.__init__(self, ctxt) self._bindings = self.resolve(pybindings_storage) self._user_event_log = self.resolve(pyuser_event_log) self.dps = {} self.lldp_packets = {} self.adjacency_list = {} def configure(self, configuration): arg_len = len(configuration['arguments']) self.lldp_send_period = LLDP_SEND_PERIOD if arg_len == 1: try: val = float(configuration['arguments'][0]) self.lldp_send_period = val lg.debug("Setting LLDP send timer to " + str(val)) except Exception, e: lg.error("unable to convert arg to float " + configuration['arguments'][0]) self.register_event(Link_event.static_get_name()) Link_event.register_event_converter(self.ctxt)
def install(self): self.routing = self.resolve(pyrouting.PyRouting) self.n_received = 0 self.register_handler(Link_event.static_get_name(), self.handle_link_event)