Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[show/fgnhg] Fix crash bug #1272

Merged
merged 1 commit into from
Dec 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions show/fgnhg.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def active_hops(nhg):
table_keys = []
table_keys = state_db.keys(state_db.STATE_DB, _hash)
t_dict = {}
header = ["FG_NHG_PREFIX", "Active Next Hops"]
table = []
output_dict = {}

Expand All @@ -49,7 +50,6 @@ def active_hops(nhg):
output_dict[nhg_prefix] = [nh_ip.split("@")[0]]

nhg_prefix_report = (nhg_prefix.split("|")[1])
header = ["FG_NHG_PREFIX", "Active Next Hops"]
formatted_nhps = ','.replace(',', '\n').join(output_dict[nhg_prefix])
table.append([nhg_prefix_report, formatted_nhps])

Expand Down Expand Up @@ -80,7 +80,6 @@ def active_hops(nhg):
nhg_prefix_report = (nhg_prefix.split("|")[1])
formatted_nhps = ','.replace(',', '\n').join(output_dict[nhg_prefix])
table.append([nhg_prefix_report, formatted_nhps])
header = ["FG_NHG_PREFIX", "Active Next Hops"]
click.echo(tabulate(table, header, tablefmt="grid"))


Expand All @@ -105,6 +104,7 @@ def hash_view(nhg):
table_keys = []
table_keys = state_db.keys(state_db.STATE_DB, _hash)
t_dict = {}
header = ["FG_NHG_PREFIX", "Next Hop", "Hash buckets"]
table = []
output_dict = {}
bank_dict = {}
Expand All @@ -128,7 +128,6 @@ def hash_view(nhg):

bank_dict = OrderedDict(sorted(bank_dict.items()))
nhg_prefix_report = (nhg_prefix.split("|")[1])
header = ["FG_NHG_PREFIX", "Next Hop", "Hash buckets"]

for nhip, val in bank_dict.items():
formatted_banks = ','.replace(',', '\n').join(bank_dict[nhip])
Expand Down Expand Up @@ -163,7 +162,6 @@ def hash_view(nhg):

nhg_prefix_report = (nhg_prefix.split("|")[1])
bank_dict = OrderedDict(sorted(bank_dict.items()))
header = ["FG_NHG_PREFIX", "Next Hop", "Hash buckets"]

for nhip, val in bank_dict.items():
formatted_banks = ','.replace(',', '\n').join(bank_dict[nhip])
Expand Down