예제 #1
0
    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 []
예제 #2
0
파일: decision.py 프로젝트: MOYUMax/openr
    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 []
예제 #3
0
파일: fib.py 프로젝트: gitpop/openr-xr
    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)
예제 #4
0
파일: fib.py 프로젝트: schijioke-uche/openr
 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