def start(self): CompositeNode.start(self) self.bcu_list = [] self.running = 1 if self._who_is_thread is None: #kick off who_is thread network._who_are_devices() self._who_is_thread = _WhoIsThread(self) self._who_is_thread.start()
def listen(self): #called from immortal thread try: while self._continue_running: if self.debug: print '%s.listen(): Broadcasting WHOIS' % self.getName() self.node._device_table_size = 0 #once a minute, force a full discovery network._who_are_devices() time.sleep(self.discover_interval) finally: if self.debug: print '%s.finally' % self.getName()
def change_hardware_settings(self, carrier, interface, network, port): try: if bvlc.BBMD_thread_started: self._interface_node = None bbmd = self.get_child('BBMD') bbmd.disable_bbmd() #no longer will pass bbmd messages bbmd.destroy_table() #persistent table cleared except ENoSuchName: pass except: msglog.exception() config_node = self.parent.parent.get_child('Configuration') device_node = self.parent.parent.get_child('Devices') dn_children = copy(device_node.children_nodes()) #prune all the devices for n in dn_children: n.prune(1) device_node.stop() try: #prune the carrier node under the interface port if config_node.interface_node: intrfc_node = as_node(config_node.interface_node.node_url) intrfc_node.prune(1) except: msglog.exception() for carrier_node in config_node.children_nodes(): for interface_node in carrier_node.children_nodes(): try: interface_node.prune() except: msglog.exception() config_node.stop() self._interface_node = None config_node.change_hardware_settings(carrier, interface, network, port) config_node.start() device_node.start() _network._who_are_devices() time.sleep(3) self.kick_start_discovery()