From 8e8bbcabdeb6c394a70e70580734d7324bc2d29d Mon Sep 17 00:00:00 2001 From: Jimi Chen Date: Thu, 20 Mar 2025 10:54:12 +0000 Subject: [PATCH] Add IPv6 neighbor solicitation offload for APFv6 multi-devices tests Test: m connectivity_multi_devices_snippet && atest CtsConnectivityMultiDevicesTestCases Change-Id: I97f6a60ddfa3dcaf4aee0ea1db83cc9636031a54 --- tests/cts/multidevices/apfv6_test.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/cts/multidevices/apfv6_test.py b/tests/cts/multidevices/apfv6_test.py index 9a1e225bab..ee2368d823 100644 --- a/tests/cts/multidevices/apfv6_test.py +++ b/tests/cts/multidevices/apfv6_test.py @@ -22,6 +22,10 @@ from scapy.layers.inet6 import ( ICMPv6MLQuery2, ICMPv6MLReport2, ICMPv6MLDMultAddrRec, + ICMPv6NDOptSrcLLAddr, + ICMPv6NDOptDstLLAddr, + ICMPv6ND_NS, + ICMPv6ND_NA, RouterAlert ) from scapy.layers.l2 import Ether @@ -96,6 +100,24 @@ class ApfV6Test(apf_test_base.ApfTestBase): arp_request, "DROPPED_ARP_REQUEST_REPLIED", arp_reply ) + def test_non_dad_ipv6_neighbor_solicitation_offload(self): + eth = Ether(src=self.server_mac_address, dst=self.client_mac_address) + ip = IPv6(src=self.server_ipv6_addresses[0], dst=self.client_ipv6_addresses[0]) + icmpv6 = ICMPv6ND_NS(tgt=self.client_ipv6_addresses[0]) + opt = ICMPv6NDOptSrcLLAddr(lladdr=self.server_mac_address) + neighbor_solicitation = bytes(eth/ip/icmpv6/opt).hex() + + eth = Ether(src=self.client_mac_address, dst=self.server_mac_address) + ip = IPv6(src=self.client_ipv6_addresses[0], dst=self.server_ipv6_addresses[0]) + icmpv6 = ICMPv6ND_NA(tgt=self.client_ipv6_addresses[0], R=1, S=1, O=1) + opt = ICMPv6NDOptDstLLAddr(lladdr=self.client_mac_address) + expected_neighbor_advertisement = bytes(eth/ip/icmpv6/opt).hex() + self.send_packet_and_expect_reply_received( + neighbor_solicitation, + "DROPPED_IPV6_NS_REPLIED_NON_DAD", + expected_neighbor_advertisement + ) + @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)