Skip to content

Commit

Permalink
Added support for tunnel route status in show vnet routes all.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
siqbal1986 committed Aug 29, 2022
1 parent 8f4fc62 commit 781806f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions show/vnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:*")
Expand All @@ -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))
Expand Down

0 comments on commit 781806f

Please sign in to comment.