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
This commit is contained in:
Jimi Chen 2025-03-11 07:42:51 +00:00
commit 0f3f5517e1
2 changed files with 18 additions and 0 deletions

View file

@ -29,6 +29,7 @@ python_test_host {
libs: [
"absl-py",
"mobly",
"scapy",
"net-tests-utils-host-python-common",
],
test_suites: [

View file

@ -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
)