Skip to content

Commit bed58ef

Browse files
committed
[show] Fix 'show ipv6 interfaces' prints v4 label (sonic-net#1757)
Signed-off-by: Mykola Horb <[email protected]>
1 parent 709dc85 commit bed58ef

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

scripts/ipintutil

+8-3
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,13 @@ def get_ip_intfs_in_namespace(af, namespace, display):
193193
return ip_intfs
194194

195195

196-
def display_ip_intfs(ip_intfs):
197-
header = ['Interface', 'Master', 'IPv4 address/mask',
196+
def display_ip_intfs(ip_intfs, af):
197+
if af == netifaces.AF_INET:
198+
IP_version = 'IPv4 address/mask'
199+
elif af == netifaces.AF_INET6:
200+
IP_version = 'IPv6 address/mask'
201+
202+
header = ['Interface', 'Master', IP_version,
198203
'Admin/Oper', 'BGP Neighbor', 'Neighbor IP']
199204
data = []
200205
for ip_intf, v in natsorted(ip_intfs.items()):
@@ -265,7 +270,7 @@ def main():
265270

266271
load_db_config()
267272
ip_intfs = get_ip_intfs(af, namespace, display)
268-
display_ip_intfs(ip_intfs)
273+
display_ip_intfs(ip_intfs, af)
269274

270275
sys.exit(0)
271276

tests/show_ip_int_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Vlan100 40.1.1.1/24 error/down N/A N/A"""
2020

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

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

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

0 commit comments

Comments
 (0)