Skip to content

Commit c061a18

Browse files
dpritalqiluo-msft
authored andcommitted
Fix header for the output table following 'show ipv6 interface' command (#2219)
- What I did Fix the header for "show ipv6 interface" output that display "IPv4" instead of "IPv6" This PR fix the following issue: sonic-net/sonic-buildimage#11124 - How I did it Check if the table is for IPv4 or IPv6 and present the header accordingly. In addition, adjust the UT - How to verify it Run "show ip interface" CLi command and verify that the output header present "IPv4" Run "show ipv6 interface" CLi command and verify that the output header present "IPv6"
1 parent 62c1640 commit c061a18

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

scripts/ipintutil

+6-2
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,13 @@ def get_ip_intfs_in_namespace(af, namespace, display):
192192
return ip_intfs
193193

194194

195-
def display_ip_intfs(ip_intfs):
195+
def display_ip_intfs(ip_intfs,address_family):
196196
header = ['Interface', 'Master', 'IPv4 address/mask',
197197
'Admin/Oper', 'BGP Neighbor', 'Neighbor IP']
198+
199+
if address_family == 'ipv6':
200+
header[2] = 'IPv6 address/mask'
201+
198202
data = []
199203
for ip_intf, v in natsorted(ip_intfs.items()):
200204
ip_address = v['ipaddr'][0][1]
@@ -264,7 +268,7 @@ def main():
264268

265269
SonicDBConfig.load_sonic_global_db_config()
266270
ip_intfs = get_ip_intfs(af, namespace, display)
267-
display_ip_intfs(ip_intfs)
271+
display_ip_intfs(ip_intfs,args.address_family)
268272

269273
sys.exit(0)
270274

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)