Skip to content

Commit

Permalink
fix - bgp-asn-community test for sonic nbrs (#15645)
Browse files Browse the repository at this point in the history
This PR fixes 'test_4_byte_asn_community' test for sonic neighbors' case.
The above test fails when asserting 'neighbor_4byte_asn' variable for 'show ipv6 neighbors xxxxx routes' command output.

How to fix:
Assert neighbor_4byte_asn on the line numbers 9 or 10 from the output of 'show ipv6 neighbors xxxxx routes' command.
Because sometimes it may come on line number 10 as shown below,
  • Loading branch information
sanjair-git authored and mssonicbld committed Nov 30, 2024
1 parent e0de2a9 commit 121360a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/bgp/test_4-byte_asn_community.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,12 @@ def run_bgp_4_byte_asn_community_sonic(setup):
output = setup['duthost'].shell("show ip bgp neighbors {} routes".format(setup['neigh_ip_v4']))['stdout']
assert str(neighbor_4byte_asn) in str(output.split('\n')[9].split()[5])
output = setup['duthost'].shell("show ipv6 bgp neighbors {} routes".format(setup['neigh_ip_v6'].lower()))['stdout']
assert str(neighbor_4byte_asn) in str(output.split('\n')[9].split()[5])
# Command output 'show ipv6 bgp neighbors <xxx> routes' may split into two lines, hence checking both the lines
# Network Next Hop Metric LocPrf Weight Path
# *> 2064:100::1/128 fe80::4cc2:44ff:feee:73ff
# 0 400001 i
assert (str(neighbor_4byte_asn) in str(output.split('\n')[9]) or
str(neighbor_4byte_asn) in str(output.split('\n')[10]))

output = setup['neighhost'].shell("show ip bgp summary | grep {}".format(setup['dut_ip_v4']))['stdout']
assert str(dut_4byte_asn) in output.split()[2]
Expand Down

0 comments on commit 121360a

Please sign in to comment.