Skip to content

Commit d305b2e

Browse files
committed
fix: v4/v6 NHG member_port_indexs aliasing
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
1 parent 4af46a7 commit d305b2e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

test/sai_test/config/route_configer.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,13 @@ def create_nexthop_group_by_nexthops(self, nexthopv4_list: List[Nexthop], nextho
626626
nhp_grpv4_members.append(nhp_grpv4_member)
627627
nhp_grpv6_members.append(nhp_grpv6_member)
628628

629+
# Give each NHG its own copy of the member port-index list. The v4 and v6
630+
# groups are mutated independently (remove/re-add member tests), so sharing
631+
# one list object would let a v4 mutation corrupt the v6 group's port list
632+
# (ValueError: x not in list) when both run in the same config group.
629633
member_port_indexs = [17, 18, 19, 20, 21, 22, 23, 24]
630-
nhp_grpv4: NexthopGroup = NexthopGroup(nhop_groupv4_id, nhp_grpv4_members, member_port_indexs)
631-
nhp_grpv6: NexthopGroup = NexthopGroup(nhop_groupv6_id, nhp_grpv6_members, member_port_indexs)
634+
nhp_grpv4: NexthopGroup = NexthopGroup(nhop_groupv4_id, nhp_grpv4_members, list(member_port_indexs))
635+
nhp_grpv6: NexthopGroup = NexthopGroup(nhop_groupv6_id, nhp_grpv6_members, list(member_port_indexs))
632636

633637
self.test_obj.dut.nhp_grpv4_list.append(nhp_grpv4)
634638
self.test_obj.dut.nhp_grpv6_list.append(nhp_grpv6)

0 commit comments

Comments
 (0)