Example #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)
Example #2
0
    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