From 781806fb26a923dacf85b15074566bb60e82668a Mon Sep 17 00:00:00 2001 From: siqbal1486 Date: Mon, 29 Aug 2022 13:38:56 -0700 Subject: [PATCH] Added support for tunnel route status in show vnet routes all. The status may be active, inactive or not present at all. The status field cna have 3 values. Empty : Configured but not in ASIC Active : Configured and active in ASIC. Inacive : Configured but not in ASIC due to lack ofr BFD session. --- show/vnet.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/show/vnet.py b/show/vnet.py index 21d46af7fa..1aeb4ce355 100644 --- a/show/vnet.py +++ b/show/vnet.py @@ -207,7 +207,8 @@ def all(): """Show all vnet routes""" appl_db = SonicV2Connector() appl_db.connect(appl_db.APPL_DB) - + state_db = SonicV2Connector() + state_db.connect(state_db.STATE_DB) header = ['vnet name', 'prefix', 'nexthop', 'interface'] # Fetching data from appl_db for VNET ROUTES @@ -227,7 +228,7 @@ def all(): click.echo() - header = ['vnet name', 'prefix', 'endpoint', 'mac address', 'vni'] + header = ['vnet name', 'prefix', 'endpoint', 'mac address', 'vni', status'] # Fetching data from appl_db for VNET TUNNEL ROUTES vnet_rt_keys = appl_db.keys(appl_db.APPL_DB, "VNET_ROUTE_TUNNEL_TABLE:*") @@ -237,10 +238,13 @@ def all(): for k in vnet_rt_keys: r = [] r.extend(k.split(":", 2)[1:]) + state_db_key = '|'.join(k.split(":",2)) val = appl_db.get_all(appl_db.APPL_DB, k) + val_state = state_db.get_all(state_db.STATE_DB, state_db_key) r.append(val.get('endpoint')) r.append(val.get('mac_address')) r.append(val.get('vni')) + r.append(val_state.get('state')) table.append(r) click.echo(tabulate(table, header))