diff --git a/show/main.py b/show/main.py index c1995ad27d..2d331e7da1 100755 --- a/show/main.py +++ b/show/main.py @@ -1437,7 +1437,8 @@ def all(verbose): ns_list = multi_asic.get_namespace_list() for ns in ns_list: ns_config = get_config_json_by_namespace(ns) - ns_config['bgpraw'] = bgp_util.run_bgp_show_command(bgpraw_cmd, ns) + if bgp_util.is_bgp_feature_state_enabled(ns): + ns_config['bgpraw'] = bgp_util.run_bgp_show_command(bgpraw_cmd, ns) output[ns] = ns_config click.echo(json.dumps(output, indent=4)) else: diff --git a/utilities_common/bgp_util.py b/utilities_common/bgp_util.py index 64054662e3..65f9a59496 100644 --- a/utilities_common/bgp_util.py +++ b/utilities_common/bgp_util.py @@ -38,6 +38,15 @@ def is_bgp_neigh_present(neighbor_ip, namespace=multi_asic.DEFAULT_NAMESPACE): return False +def is_bgp_feature_state_enabled(namespace=multi_asic.DEFAULT_NAMESPACE): + config_db = multi_asic.connect_config_db_for_ns(namespace) + bgp= config_db.get_entry("FEATURE","bgp") + if "state" in bgp: + if bgp["state"] == "enabled": + return True + return False + + def is_ipv4_address(ip_address): """ Checks if given ip is ipv4