def get_fib_path(self, src, dst_prefix, fib_agent_port, timeout): try: client = utils.get_fib_agent_client(src, fib_agent_port, timeout) routes = client.getRouteTableByClient(client.client_id) except Exception: try: client = utils.get_fib_agent_client(src, fib_agent_port, timeout) routes = client.getRouteTableByClient(client.client_id) except Exception: return [] for route in routes: if utils.sprint_prefix(route.dest) == dst_prefix: return route.nexthops return []
def get_fib_path(self, src, dst_prefix, fib_agent_port, timeout): src_addr = self.get_loopback_addr(src) if src_addr is None: return [] try: client = utils.get_fib_agent_client(src_addr, fib_agent_port, timeout) routes = client.getRouteTableByClient(client.client_id) except Exception: return [] for route in routes: if ipnetwork.sprint_prefix(route.dest) == dst_prefix: return route.nexthops return []
def __init__(self, cli_opts): ''' initialize the Fib agent client ''' self.lm_cmd_port = cli_opts.lm_cmd_port self.decision_rep_port = cli_opts.decision_rep_port try: self.client = utils.get_fib_agent_client(cli_opts.host, cli_opts.fib_agent_port, cli_opts.timeout, cli_opts.client_id) except Exception as e: print('Failed to get communicate to Fib. {}'.format(e)) print('Note: Specify correct host with -H/--host option and ' + 'make sure that Fib is running on the host or ports ' + 'are open on that box for network communication.') sys.exit(1)
def __init__(self, cli_opts): """ initialize the Fib agent client """ self.cli_opts = cli_opts try: self.client = utils.get_fib_agent_client( cli_opts.host, cli_opts.fib_agent_port, cli_opts.timeout, cli_opts.client_id, ) except Exception as e: print("Failed to get communicate to Fib. {}".format(e)) print("Note: Specify correct host with -H/--host option and " + "make sure that Fib is running on the host or ports " + "are open on that box for network communication.") raise