From d6b8d9a6af33fcb2ab8f2f500e99193d31c51655 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 25 Nov 2020 04:36:10 +0000 Subject: [PATCH] [show/fgnhg] Fix crash bug --- show/fgnhg.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/show/fgnhg.py b/show/fgnhg.py index caea7a7cef..6ed0b68939 100644 --- a/show/fgnhg.py +++ b/show/fgnhg.py @@ -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 = {} @@ -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]) @@ -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")) @@ -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 = {} @@ -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]) @@ -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])