示例#1
0
文件: fib.py 项目: weizai118/openr
 def run(self, prefixes, json):
     route_db = self.client.get_route_db()
     if json:
         route_db_dict = {route_db.thisNodeName: utils.route_db_to_dict(route_db)}
         utils.print_routes_json(route_db_dict, prefixes)
     else:
         utils.print_routes_table(route_db, prefixes)
示例#2
0
 def _run(
     self, client: OpenrCtrl.Client, prefixes: Any, labels: Any, json: bool
 ) -> None:
     route_db = client.getRouteDbUnInstallable()
     if json:
         route_db_dict = {route_db.thisNodeName: utils.route_db_to_dict(route_db)}
         utils.print_routes_json(route_db_dict, prefixes, labels)
     else:
         utils.print_route_db(route_db, prefixes, labels)
示例#3
0
 def run(self, nodes, json):
     if 'all' in nodes:
         nodes = self._get_all_nodes()
     if json:
         route_db_dict = {}
         for node in nodes:
             route_db = self.client.get_route_db(node)
             route_db_dict[node] = utils.route_db_to_dict(route_db)
         utils.print_routes_json(route_db_dict)
     else:
         for node in nodes:
             route_db = self.client.get_route_db(node)
             utils.print_routes_table(route_db)
示例#4
0
 def run(self, nodes, prefixes, labels, json):
     if "all" in nodes:
         nodes = self._get_all_nodes()
     if json:
         route_db_dict = {}
         for node in nodes:
             route_db = self.client.get_route_db(node)
             route_db_dict[node] = utils.route_db_to_dict(route_db)
         utils.print_routes_json(route_db_dict, prefixes, labels)
     else:
         for node in nodes:
             route_db = self.client.get_route_db(node)
             utils.print_route_db(route_db, prefixes, labels)
示例#5
0
 def _run(
     self, client: OpenrCtrl.Client, prefixes: Any, labels: Any, json: bool
 ) -> None:
     route_db = client.getRouteDbComputed("")
     # Filter out all MPLS routes
     route_db.mplsRoutes = []
     # Filter unicast routes on `doNotInstall` attribute
     route_db.unicastRoutes = [r for r in route_db.unicastRoutes if r.doNotInstall]
     if json:
         route_db_dict = {route_db.thisNodeName: utils.route_db_to_dict(route_db)}
         utils.print_routes_json(route_db_dict, prefixes, labels)
     else:
         utils.print_route_db(route_db, prefixes, labels)
示例#6
0
 def _run(
     self,
     client: OpenrCtrl.Client,
     nodes: set,
     prefixes: Any,
     labels: Any,
     json: bool,
 ) -> None:
     if "all" in nodes:
         nodes = self._get_all_nodes(client)
     if json:
         route_db_dict = {}
         for node in nodes:
             route_db = client.getRouteDbComputed(node)
             route_db_dict[node] = utils.route_db_to_dict(route_db)
         utils.print_routes_json(route_db_dict, prefixes, labels)
     else:
         for node in nodes:
             route_db = client.getRouteDbComputed(node)
             utils.print_route_db(route_db, prefixes, labels)