Skip to content

Commit 557c243

Browse files
xiangxu1121facebook-github-bot
authored andcommitted
remove decision_client (6/N)
Summary: This diff is straightforward. We just remove all of the usage for decision_client across the whole code base and replace with openrctrl_client API for easy usage. Reviewed By: jstrizich Differential Revision: D15706523 fbshipit-source-id: 325f8b2759a7c89adff3cde77c44a73c15eea6b3
1 parent c0b683a commit 557c243

File tree

3 files changed

+15
-155
lines changed

3 files changed

+15
-155
lines changed

openr/py/openr/cli/commands/fib.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from openr.cli.utils import utils
1414
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
1616
from openr.OpenrCtrl import OpenrCtrl
1717
from openr.Platform import ttypes as platform_types
1818
from openr.utils import ipnetwork, printing
@@ -172,20 +172,28 @@ def run(self, cli_opts):
172172
all_success = True
173173

174174
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+
176187
(decision_unicast_routes, decision_mpls_routes) = utils.get_shortest_routes(
177-
decision_client.DecisionClient(cli_opts).get_route_db()
188+
decision_route_db
178189
)
179-
# fetch routes from fib module
180190
(fib_unicast_routes, fib_mpls_routes) = utils.get_shortest_routes(
181-
fib_client.FibClient(cli_opts).get_route_db()
191+
fib_route_db
182192
)
183193
# fetch route from net_agent module
184194
agent_unicast_routes = self.client.getRouteTableByClient(
185195
self.client.client_id
186196
)
187-
# fetch link_db from link-monitor module
188-
lm_links = lm_client.LMClient(cli_opts).dump_links().interfaceDetails
189197

190198
except Exception as e:
191199
print("Failed to validate Fib routes.")

openr/py/openr/clients/decision_client.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

openr/py/openr/clients/tests/decision_client_tests.py

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)