Skip to content

Commit a8ec74d

Browse files
authored
Add namespace support for show interface neighbor expected (#3781)
What I did Adding namespace support for show interface neighbor expected. So that we can use show interface neighbor expected -n asic0 How I did it How to verify it Verified on T2 testbed Previous command output (if the output of a command-line utility has changed) admin@somehost:/var/log$ show interfaces neighbor expected -n asic1 Usage: show interfaces neighbor expected [OPTIONS] [INTERFACENAME] Try "show interfaces neighbor expected -h" for help. Error: no such option: -n New command output (if the output of a command-line utility has changed) admin@somehost:/var/log$ show interfaces neighbor expected -n asic1 LocalPort Neighbor NeighborPort NeighborLoopback NeighborMgmt NeighborType ----------- ---------- -------------- ------------------ -------------- -------------- Ethernet96 ARISTAXXTX Ethernet1 None XXX.XX.XXX.XX someHub Ethernet104 ARISTAXXTX Ethernet1 None XXX.XX.XXX.XX otherHub ... Signed-off-by: Austin Pham <[email protected]>
1 parent 8fdea8d commit a8ec74d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

doc/Command-Reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5447,7 +5447,7 @@ This command is used to display the list of expected neighbors for all interface
54475447

54485448
- Usage:
54495449
```
5450-
show interfaces neighbor expected [<interface_name>]
5450+
show interfaces neighbor expected [<interface_name>] -n [<namespace>]
54515451
```
54525452

54535453
- Example:

show/interfaces/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,16 +297,20 @@ def neighbor():
297297
# 'expected' subcommand ("show interface neighbor expected")
298298
@neighbor.command()
299299
@click.argument('interfacename', required=False)
300+
@multi_asic_util.multi_asic_click_option_namespace
300301
@clicommon.pass_db
301-
def expected(db, interfacename):
302+
def expected(db, interfacename, namespace):
302303
"""Show expected neighbor information by interfaces"""
303304

304-
neighbor_dict = db.cfgdb.get_table("DEVICE_NEIGHBOR")
305+
if not namespace:
306+
namespace = multi_asic_util.constants.DEFAULT_NAMESPACE
307+
308+
neighbor_dict = db.cfgdb_clients[namespace].get_table("DEVICE_NEIGHBOR")
305309
if neighbor_dict is None:
306310
click.echo("DEVICE_NEIGHBOR information is not present.")
307311
return
308312

309-
neighbor_metadata_dict = db.cfgdb.get_table("DEVICE_NEIGHBOR_METADATA")
313+
neighbor_metadata_dict = db.cfgdb_clients[namespace].get_table("DEVICE_NEIGHBOR_METADATA")
310314
if neighbor_metadata_dict is None:
311315
click.echo("DEVICE_NEIGHBOR_METADATA information is not present.")
312316
return

0 commit comments

Comments
 (0)