Test: move getClatIpv6Address to common function

Share with EthernetTetheringTest and MtsEthernetTetheringTest

Bug: 258637850
Test: atest ConnectivityCoverageTests
Change-Id: I41daef082c30fdaafab44426ccaab4cb8b3297f3
This commit is contained in:
Hungming Chen
2023-02-20 18:48:01 +08:00
parent 8cdff6c8cd
commit 2adba0f717
2 changed files with 14 additions and 13 deletions

View File

@@ -62,7 +62,6 @@ import com.android.net.module.util.Struct;
import com.android.net.module.util.structs.EthernetHeader;
import com.android.net.module.util.structs.Icmpv4Header;
import com.android.net.module.util.structs.Ipv4Header;
import com.android.net.module.util.structs.Ipv6Header;
import com.android.net.module.util.structs.UdpHeader;
import com.android.testutils.DevSdkIgnoreRule;
import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
@@ -522,18 +521,6 @@ public class EthernetTetheringTest extends EthernetTetheringTestBase {
runUdp4Test();
}
@NonNull
private Inet6Address getClatIpv6Address(TetheringTester tester, TetheredDevice tethered)
throws Exception {
// Send an IPv4 UDP packet from client and check that a CLAT translated IPv6 UDP packet can
// be found on upstream interface. Get CLAT IPv6 address from the CLAT translated IPv6 UDP
// packet.
byte[] expectedPacket = probeV4TetheringConnectivity(tester, tethered, true /* is4To6 */);
// Above has guaranteed that the found packet is an IPv6 packet without ether header.
return Struct.parse(Ipv6Header.class, ByteBuffer.wrap(expectedPacket)).srcIp;
}
// Test network topology:
//
// public network (rawip) private network