Skip to content

Commit

Permalink
[sonic-utilities] Fix show vnet [neighbors | routes [all | tunnel]] c…
Browse files Browse the repository at this point in the history
…rashed issue (sonic-net#1263)

When query "NEIGH_TABLE*" or "VNET_ROUTE_TUNNEL_TABLE*" from APPDB,
it may contain a combination of table names with and without ":"

This PR shall skip handling the below entries in APP_DB:

127.0.0.1:6379> keys NEIGH_TABLE*

"NEIGH_TABLE_DEL_SET"
"NEIGH_TABLE_KEY_SET"
  • Loading branch information
CLUDev committed Nov 23, 2020
1 parent f9eb739 commit 9dc58ea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,7 @@ def neighbors():
appl_db.connect(appl_db.APPL_DB)

# Fetching data from appl_db for neighbors
nbrs = appl_db.keys(appl_db.APPL_DB, "NEIGH_TABLE*")
nbrs = appl_db.keys(appl_db.APPL_DB, "NEIGH_TABLE:*")
nbrs_data = {}
for nbr in nbrs if nbrs else []:
tbl, intf, ip = nbr.split(":", 2)
Expand Down Expand Up @@ -2331,7 +2331,7 @@ def all():
header = ['vnet name', 'prefix', 'nexthop', 'interface']

# Fetching data from appl_db for VNET ROUTES
vnet_rt_keys = appl_db.keys(appl_db.APPL_DB, "VNET_ROUTE_TABLE*")
vnet_rt_keys = appl_db.keys(appl_db.APPL_DB, "VNET_ROUTE_TABLE:*")
vnet_rt_keys = natsorted(vnet_rt_keys) if vnet_rt_keys else []

table = []
Expand All @@ -2350,7 +2350,7 @@ def all():
header = ['vnet name', 'prefix', 'endpoint', 'mac address', 'vni']

# Fetching data from appl_db for VNET TUNNEL ROUTES
vnet_rt_keys = appl_db.keys(appl_db.APPL_DB, "VNET_ROUTE_TUNNEL_TABLE*")
vnet_rt_keys = appl_db.keys(appl_db.APPL_DB, "VNET_ROUTE_TUNNEL_TABLE:*")
vnet_rt_keys = natsorted(vnet_rt_keys) if vnet_rt_keys else []

table = []
Expand All @@ -2374,7 +2374,7 @@ def tunnel():
header = ['vnet name', 'prefix', 'endpoint', 'mac address', 'vni']

# Fetching data from appl_db for VNET TUNNEL ROUTES
vnet_rt_keys = appl_db.keys(appl_db.APPL_DB, "VNET_ROUTE_TUNNEL_TABLE*")
vnet_rt_keys = appl_db.keys(appl_db.APPL_DB, "VNET_ROUTE_TUNNEL_TABLE:*")
vnet_rt_keys = natsorted(vnet_rt_keys) if vnet_rt_keys else []

table = []
Expand Down

0 comments on commit 9dc58ea

Please sign in to comment.