From 0f3f5517e19d775599b612149e63012d8b23b03f Mon Sep 17 00:00:00 2001 From: Jimi Chen Date: Tue, 11 Mar 2025 07:42:51 +0000 Subject: [PATCH] Add Ping4 offload for APFv6 multi-devices tests Introduce Ping4 offload support for improved APFv6 multi-device testing. Adds a decorator to restrict tests to Android B+ capable client device. Test: m connectivity_multi_devices_snippet && atest CtsConnectivityMultiDevicesTestCases Change-Id: I01909c1725ba471726223deef325c3f0a80b5c14 --- tests/cts/multidevices/Android.bp | 1 + tests/cts/multidevices/apfv6_test.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/cts/multidevices/Android.bp b/tests/cts/multidevices/Android.bp index a082a956a8..39cb0ad75e 100644 --- a/tests/cts/multidevices/Android.bp +++ b/tests/cts/multidevices/Android.bp @@ -29,6 +29,7 @@ python_test_host { libs: [ "absl-py", "mobly", + "scapy", "net-tests-utils-host-python-common", ], test_suites: [ diff --git a/tests/cts/multidevices/apfv6_test.py b/tests/cts/multidevices/apfv6_test.py index fc732d229d..61f1bfcd1e 100644 --- a/tests/cts/multidevices/apfv6_test.py +++ b/tests/cts/multidevices/apfv6_test.py @@ -13,6 +13,8 @@ # limitations under the License. from mobly import asserts +from scapy.layers.inet import IP, ICMP +from scapy.layers.l2 import Ether from net_tests_utils.host.python import apf_test_base, apf_utils, adb_utils, assert_utils, packet_utils APFV6_VERSION = 6000 @@ -82,3 +84,18 @@ class ApfV6Test(apf_test_base.ApfTestBase): self.send_packet_and_expect_reply_received( arp_request, "DROPPED_ARP_REQUEST_REPLIED", arp_reply ) + + @apf_utils.at_least_B() + def test_ipv4_icmp_echo_request_offload(self): + eth = Ether(src=self.server_mac_address, dst=self.client_mac_address) + ip = IP(src=self.server_ipv4_addresses[0], dst=self.client_ipv4_addresses[0]) + icmp = ICMP(id=1, seq=123) + echo_request = bytes(eth/ip/icmp/b"hello").hex() + + eth = Ether(src=self.client_mac_address, dst=self.server_mac_address) + ip = IP(src=self.client_ipv4_addresses[0], dst=self.server_ipv4_addresses[0]) + icmp = ICMP(type=0, id=1, seq=123) + expected_echo_reply = bytes(eth/ip/icmp/b"hello").hex() + self.send_packet_and_expect_reply_received( + echo_request, "DROPPED_IPV4_PING_REQUEST_REPLIED", expected_echo_reply + ) \ No newline at end of file