Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[show] Fix 'show ipv6 interfaces' prints v4 label (#1757) #1845

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions scripts/ipintutil
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,13 @@ def get_ip_intfs_in_namespace(af, namespace, display):
return ip_intfs


def display_ip_intfs(ip_intfs):
header = ['Interface', 'Master', 'IPv4 address/mask',
def display_ip_intfs(ip_intfs, af):
if af == netifaces.AF_INET:
IP_version = 'IPv4 address/mask'
elif af == netifaces.AF_INET6:
IP_version = 'IPv6 address/mask'

header = ['Interface', 'Master', IP_version,
'Admin/Oper', 'BGP Neighbor', 'Neighbor IP']
data = []
for ip_intf, v in natsorted(ip_intfs.items()):
Expand Down Expand Up @@ -265,7 +270,7 @@ def main():

load_db_config()
ip_intfs = get_ip_intfs(af, namespace, display)
display_ip_intfs(ip_intfs)
display_ip_intfs(ip_intfs, af)

sys.exit(0)

Expand Down
6 changes: 3 additions & 3 deletions tests/show_ip_int_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Vlan100 40.1.1.1/24 error/down N/A N/A"""

show_ipv6_intf_with_multiple_ips = """\
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
Interface Master IPv6 address/mask Admin/Oper BGP Neighbor Neighbor IP
--------------- -------- -------------------------------------------- ------------ -------------- -------------
Ethernet0 2100::1/64 error/down N/A N/A
aa00::1/64 N/A N/A
Expand All @@ -36,7 +36,7 @@
PortChannel0001 20.1.1.1/24 error/down T2-Peer 20.1.1.5"""

show_multi_asic_ipv6_intf = """\
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
Interface Master IPv6 address/mask Admin/Oper BGP Neighbor Neighbor IP
--------------- -------- -------------------------------------- ------------ -------------- -------------
Loopback0 fe80::60a5:9dff:fef4:1696%Loopback0/64 error/down N/A N/A
PortChannel0001 aa00::1/64 error/down N/A N/A
Expand All @@ -54,7 +54,7 @@
veth@eth2 193.1.1.1/24 error/down N/A N/A"""

show_multi_asic_ipv6_intf_all = """\
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
Interface Master IPv6 address/mask Admin/Oper BGP Neighbor Neighbor IP
--------------- -------- -------------------------------------- ------------ -------------- -------------
Loopback0 fe80::60a5:9dff:fef4:1696%Loopback0/64 error/down N/A N/A
PortChannel0001 aa00::1/64 error/down N/A N/A
Expand Down