def dump_network(self): correlation_id = self.correlation_id step = "Init" logger.info('Dump network request: timestamp=%s, correlation_id=%s', self.timestamp, correlation_id) try: step = "Switches" switches = self.get_switches() logger.debug("%s: %s", step, switches) step = "ISLs" isls = self.get_isls() logger.debug("%s: %s", step, isls) step = "Flows" flows = flow_utils.get_flows() logger.debug("%s: %s", step, flows) step = "Send" payload = { 'switches': switches, 'isls': isls, 'flows': flows, 'message_type': "network"} message_utils.send_message( payload, correlation_id, "INFO", "WFM_CACHE") except Exception as e: logger.exception('Can not dump network: %s', e.message) message_utils.send_error_message( correlation_id, "INTERNAL_ERROR", e.message, step, "WFM_CACHE") raise return True
def dump_network(self): correlation_id = self.correlation_id step = "Init" logger.info('Dump network request: timestamp=%s, correlation_id=%s', self.timestamp, correlation_id) try: step = "Switches" switches = self.get_switches() logger.debug("%s: %s", step, switches) step = "ISLs" isls = self.get_isls() logger.debug("%s: %s", step, isls) step = "Flows" flows = flow_utils.get_flows() logger.debug("%s: %s", step, flows) step = "Send" message_utils.send_network_dump(correlation_id, switches, isls, flows) except Exception as e: logger.exception('Can not dump network: %s', e.message) message_utils.send_error_message(correlation_id, "INTERNAL_ERROR", e.message, step, "WFM_CACHE", config.KAFKA_CACHE_TOPIC) raise return True
def handle_flow_topology_sync(self): payload = { 'switches': [], 'isls': [], 'flows': flow_utils.get_flows(), 'clazz': MT_NETWORK} message_utils.send_to_topic( payload, self.correlation_id, message_utils.MT_INFO, destination="WFM_FLOW_LCM", topic=config.KAFKA_FLOW_TOPIC)