def _connect_switches(self, switch_id, switch_info, timestamp): switch = self.graph_db.get_node_by_uuid(switch_id) for dev_id in switch_info.get('connected-devices', []): device = self._the_node(dev_id) if device: self.graph_db.add_edge(device, switch, timestamp, "COMMUNICATES") else: LOG.warning("Couldn't connect device '%s' to switch '%s'", dev_id, switch_id)
def on_connection_error(self, exc, interval): """ Method called when there is a connection problem. :param exc: The connection exception. :param interval: The interval until the next reconnect attempt is made. """ super(OSMQueueConsumer, self).on_connection_error(exc, interval) self.retry_tracker += 1 err_msg = "Broker connection error: %s. Attempting reconnect " \ "(%s/%s) in %ss." LOG.warning(err_msg, exc, self.retry_tracker, self.connect_max_retries, interval)
def _add_switch(self, switch_id, switch_info, timestamp): # Add the switch node. iden, state = self._create_switch_nodes(switch_info) switch = self.graph_db.add_node(switch_id, iden, state, timestamp) # Connect the switch node to the nics for mac in switch_info.get('connected-devices', []): nic = self._nic_node(mac) if nic: self.graph_db.add_edge(nic, switch, timestamp, "COMMUNICATES") else: LOG.warning("Couldn't connect device '%s' to switch '%s'", mac, switch_id)