Skip to content

Commit

Permalink
JIRA-JRTC-574: Fix "show interfaces neighbor expected" command error
Browse files Browse the repository at this point in the history
Commit 024e61 is based on sonic-buildimage PR sonic-net#3036, but PR sonic-net#3036 is not merged
and aleardy closed, so this commit should be removed.

Revert "Fixing the expected neighbor command due to change in output format under sonic-buildimage/pull/3036 (sonic-net#584)"

This reverts commit 024e61f.
  • Loading branch information
vincentchiang-ec committed Sep 11, 2020
1 parent 7659ff2 commit d6b948c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,32 +931,32 @@ def expected(interfacename):

#Swap Key and Value from interface: name to name: interface
device2interface_dict = {}
for port in natsorted(neighbor_dict['DEVICE_NEIGHBOR'].keys()):
for port in natsorted(neighbor_dict.keys()):
temp_port = port
if get_interface_mode() == "alias":
port = iface_alias_converter.name_to_alias(port)
neighbor_dict['DEVICE_NEIGHBOR'][port] = neighbor_dict['DEVICE_NEIGHBOR'].pop(temp_port)
device2interface_dict[neighbor_dict['DEVICE_NEIGHBOR'][port]['name']] = {'localPort': port, 'neighborPort': neighbor_dict['DEVICE_NEIGHBOR'][port]['port']}
neighbor_dict[port] = neighbor_dict.pop(temp_port)
device2interface_dict[neighbor_dict[port]['name']] = {'localPort': port, 'neighborPort': neighbor_dict[port]['port']}

header = ['LocalPort', 'Neighbor', 'NeighborPort', 'NeighborLoopback', 'NeighborMgmt', 'NeighborType']
body = []
if interfacename:
for device in natsorted(neighbor_metadata_dict['DEVICE_NEIGHBOR_METADATA'].keys()):
for device in natsorted(neighbor_metadata_dict.keys()):
if device2interface_dict[device]['localPort'] == interfacename:
body.append([device2interface_dict[device]['localPort'],
device,
device2interface_dict[device]['neighborPort'],
neighbor_metadata_dict['DEVICE_NEIGHBOR_METADATA'][device]['lo_addr'],
neighbor_metadata_dict['DEVICE_NEIGHBOR_METADATA'][device]['mgmt_addr'],
neighbor_metadata_dict['DEVICE_NEIGHBOR_METADATA'][device]['type']])
neighbor_metadata_dict[device]['lo_addr'],
neighbor_metadata_dict[device]['mgmt_addr'],
neighbor_metadata_dict[device]['type']])
else:
for device in natsorted(neighbor_metadata_dict['DEVICE_NEIGHBOR_METADATA'].keys()):
for device in natsorted(neighbor_metadata_dict.keys()):
body.append([device2interface_dict[device]['localPort'],
device,
device2interface_dict[device]['neighborPort'],
neighbor_metadata_dict['DEVICE_NEIGHBOR_METADATA'][device]['lo_addr'],
neighbor_metadata_dict['DEVICE_NEIGHBOR_METADATA'][device]['mgmt_addr'],
neighbor_metadata_dict['DEVICE_NEIGHBOR_METADATA'][device]['type']])
neighbor_metadata_dict[device]['lo_addr'],
neighbor_metadata_dict[device]['mgmt_addr'],
neighbor_metadata_dict[device]['type']])

click.echo(tabulate(body, header))

Expand Down

0 comments on commit d6b948c

Please sign in to comment.