예제 #1
0
    def run(self, prefixes):
        try:
            routes = self.client.getKernelRouteTable()
        except Exception as e:
            print('Failed to get routes from Fib.')
            print('Exception: {}'.format(e))
            sys.exit(1)

        host_id = utils.get_connected_node_name(self.client.host, self.lm_cmd_port)
        caption = '{}\'s kernel routes'.format(host_id)
        utils.print_routes(caption, routes, prefixes)
예제 #2
0
파일: fib.py 프로젝트: Sriharivignesh/openr
    def run(self, prefixes, json_opt=False):
        try:
            routes = self.client.getRouteTableByClient(self.client.client_id)
        except Exception as e:
            print('Failed to get routes from Fib.')
            print('Exception: {}'.format(e))
            return 1

        host_id = utils.get_connected_node_name(self.client.host, self.lm_cmd_port)
        client_id = self.client.client_id

        if json_opt:
            utils.print_json(utils.get_routes_json(
                host_id, client_id, routes, prefixes))
        else:
            caption = '{}\'s FIB routes by client {}'.format(host_id, client_id)
            utils.print_routes(caption, routes, prefixes)

        return 0