Add get exclude all host IPv6 multicast addresses function to apf_utils

Test: atest NetworkStaticLibHostPythonTests
Change-Id: Ib05eaf6ac94e9511a43b4b494eb5935746f50aa7
This commit is contained in:
Jimi Chen 2025-03-19 13:37:36 +00:00
commit ceefdceafd

View file

@ -27,6 +27,7 @@ from net_tests_utils.host.python.apf_utils import (
get_apf_counters_from_dumpsys,
get_ipv4_addresses,
get_non_tentative_ipv6_addresses,
get_exclude_all_host_ipv6_multicast_addresses,
get_hardware_address,
is_send_raw_packet_downstream_supported,
is_packet_capture_supported,
@ -170,6 +171,31 @@ IpClient.wlan1
ip_addresses = get_non_tentative_ipv6_addresses(self.mock_ad, "wlan0")
asserts.assert_equal(ip_addresses, [])
@patch("net_tests_utils.host.python.adb_utils.adb_shell")
def test_get_exclude_all_host_ipv6_multicast_addresses_success(
self, mock_adb_shell: MagicMock
) -> None:
mock_adb_shell.return_value = """
47: wlan0
inet6 ff02::1:ff99:37b0
inet6 ff02::1:ffb7:cba2 users 2
inet6 ff02::1
inet6 ff01::1
"""
ip_addresses = get_exclude_all_host_ipv6_multicast_addresses(self.mock_ad, "wlan0")
asserts.assert_equal(ip_addresses,
["ff02::1:ff99:37b0",
"ff02::1:ffb7:cba2"])
@patch("net_tests_utils.host.python.adb_utils.adb_shell")
def test_get_exclude_all_host_ipv6_multicast_addresses_not_found(
self, mock_adb_shell: MagicMock
) -> None:
mock_adb_shell.return_value = ""
ip_addresses = get_exclude_all_host_ipv6_multicast_addresses(self.mock_ad, "wlan0")
asserts.assert_equal(ip_addresses, [])
@patch("net_tests_utils.host.python.adb_utils.adb_shell")
def test_send_raw_packet_downstream_success(
self, mock_adb_shell: MagicMock