Skip to content

Commit 311eaff

Browse files
authored
[action] [PR:18081] Fix for lag port selection in test_bgp_update_timer.py (#353)
<!-- Please make sure you've read and understood our contributing guidelines; https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md Please provide following information to help code review process a bit easier: --> ### Description of PR <!-- - Please include a summary of the change and which issue is fixed. - Please also include relevant motivation and context. Where should reviewer start? background context? - List any dependencies that are required for this change. --> The test_bgp_update_timer.py selects the ports via random port selection in setup. The fixture 'common_setup_teardown' fails the test if the ports belong to different asics for mutli-asic chassis. Hence updated the function '_setup_interfaces_t1_or_t2' to apply random selection on the set of interfaces belonging to same asic. Summary: Fixes # (issue) ### Type of change <!-- - Fill x for your type of change. - e.g. - [x] Bug fix --> - [ ] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [x] Test case improvement ### Back port request - [ ] 202012 - [ ] 202205 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [x] 202411 ### Approach #### What is the motivation for this PR? Test failure due to selected ports belonging to different asics #### How did you do it? #### How did you verify/test it? #### Any platform specific information? #### Supported testbed topology if it's a new test case? ### Documentation <!-- (If it's a new feature, new test case) Did you update documentation/Wiki relevant to your implementation? Link to the wiki page? -->
1 parent 66b955f commit 311eaff

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

tests/bgp/conftest.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ def _setup_interfaces_t1_or_t2(mg_facts, peer_count):
346346
if not ipv4_interfaces:
347347
ipv4_interfaces.append(intf["attachto"])
348348
asic_idx = intf_asic_idx
349-
used_subnets.add(ipaddress.ip_network(intf["subnet"]))
350349
else:
351350
if intf_asic_idx != asic_idx:
352351
continue
@@ -359,21 +358,21 @@ def _setup_interfaces_t1_or_t2(mg_facts, peer_count):
359358
for pt in mg_facts["minigraph_portchannel_interfaces"]:
360359
if _is_ipv4_address(pt["addr"]):
361360
pt_members = mg_facts["minigraph_portchannels"][pt["attachto"]]["members"]
361+
pc_asic_idx = duthost.get_asic_index_for_portchannel(pt["attachto"])
362362
# Only use LAG with 1 member for bgpmon session between PTF,
363363
# It's because exabgp on PTF is bind to single interface
364364
if len(pt_members) == 1:
365365
# If first time, we record the asic index
366-
if not ipv4_lag_interfaces:
366+
if not ipv4_interfaces and not ipv4_lag_interfaces:
367+
asic_idx = pc_asic_idx
367368
ipv4_lag_interfaces.append(pt["attachto"])
368-
asic_idx = duthost.get_asic_index_for_portchannel(pt["attachto"])
369-
# Not first time, only append the portchannel that belongs to the same asic in current list
369+
# Not first time, only append the port-channel that belongs to the same asic in current list
370370
else:
371-
asic = duthost.get_asic_index_for_portchannel(pt["attachto"])
372-
if asic != asic_idx:
371+
if pc_asic_idx != asic_idx:
373372
continue
374373
else:
375374
ipv4_lag_interfaces.append(pt["attachto"])
376-
used_subnets.add(ipaddress.ip_network(pt["subnet"]))
375+
used_subnets.add(ipaddress.ip_network(pt["subnet"]))
377376

378377
vlan_sub_interfaces = []
379378
if is_backend_topo:

0 commit comments

Comments
 (0)