|
12 | 12 |
|
13 | 13 | from openr.cli.utils import utils
|
14 | 14 | from openr.cli.utils.commands import OpenrCtrlCmd
|
15 |
| -from openr.clients import decision_client, fib_client, lm_client |
| 15 | +from openr.clients.openr_client import get_openr_ctrl_client |
16 | 16 | from openr.OpenrCtrl import OpenrCtrl
|
17 | 17 | from openr.Platform import ttypes as platform_types
|
18 | 18 | from openr.utils import ipnetwork, printing
|
@@ -172,20 +172,28 @@ def run(self, cli_opts):
|
172 | 172 | all_success = True
|
173 | 173 |
|
174 | 174 | try:
|
175 |
| - # fetch routes from decision module |
| 175 | + decision_route_db = None |
| 176 | + fib_route_db = None |
| 177 | + lm_links = None |
| 178 | + |
| 179 | + with get_openr_ctrl_client(cli_opts.host, cli_opts) as client: |
| 180 | + # fetch routes from decision module |
| 181 | + decision_route_db = client.getRouteDbComputed("") |
| 182 | + # fetch routes from fib module |
| 183 | + fib_route_db = client.getRouteDb() |
| 184 | + # fetch link_db from link-monitor module |
| 185 | + lm_links = client.getInterfaces().interfaceDetails |
| 186 | + |
176 | 187 | (decision_unicast_routes, decision_mpls_routes) = utils.get_shortest_routes(
|
177 |
| - decision_client.DecisionClient(cli_opts).get_route_db() |
| 188 | + decision_route_db |
178 | 189 | )
|
179 |
| - # fetch routes from fib module |
180 | 190 | (fib_unicast_routes, fib_mpls_routes) = utils.get_shortest_routes(
|
181 |
| - fib_client.FibClient(cli_opts).get_route_db() |
| 191 | + fib_route_db |
182 | 192 | )
|
183 | 193 | # fetch route from net_agent module
|
184 | 194 | agent_unicast_routes = self.client.getRouteTableByClient(
|
185 | 195 | self.client.client_id
|
186 | 196 | )
|
187 |
| - # fetch link_db from link-monitor module |
188 |
| - lm_links = lm_client.LMClient(cli_opts).dump_links().interfaceDetails |
189 | 197 |
|
190 | 198 | except Exception as e:
|
191 | 199 | print("Failed to validate Fib routes.")
|
|
0 commit comments