Add multicast address cleanup for test failures

This change ensures cleanup to release multicast addresses allocated during the test when a test failure occurs.
Without this cleanup, failed tests could potentially causing issues in subsequent test runs.

Test: atest CtsConnectivityMultiDevicesTestCases
Change-Id: Idf8349c8c075cec8007f5041b1ed8812a006f7f4
This commit is contained in:
Jimi Chen 2025-03-21 01:07:25 +00:00
commit 8e3bf62c74

View file

@ -190,15 +190,18 @@ class ApfV6Test(apf_test_base.ApfTestBase):
igmp = IGMPv3mr(records=mcast_records)
expected_igmpv3_report = bytes(ether/ip/igmpv3_hdr/igmp).hex()
self.send_packet_and_expect_reply_received(
igmpv3_general_query, "DROPPED_IGMP_V3_GENERAL_QUERY_REPLIED", expected_igmpv3_report
)
for addr in mcast_addrs:
adb_utils.adb_shell(
self.clientDevice,
f'ip addr del {addr}/32 dev {self.client_iface_name}'
try:
self.send_packet_and_expect_reply_received(
igmpv3_general_query,
"DROPPED_IGMP_V3_GENERAL_QUERY_REPLIED",
expected_igmpv3_report
)
finally:
for addr in mcast_addrs:
adb_utils.adb_shell(
self.clientDevice,
f'ip addr del {addr}/32 dev {self.client_iface_name}'
)
@apf_utils.at_least_B()
@apf_utils.apf_ram_at_least(3000)