Commit graph android_packages_modules_Co.../Tethering/tests/integration
Message SHA1
replace TetherStatsKey with S32
(mostly autogenerated, with minor tweaks to make it build)

Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5a5ba231cb38886b9b681b4c08d89a18ad418f23

Maciej Żenczykowski   commited 2025-08-07 15:48:28 -07:00
b5f97280d6
Merge "Increase WAIT_RA_TIMEOUT_MS" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-06-04 16:17:57 -07:00
4b799ef007
Increase WAIT_RA_TIMEOUT_MS
EthernetTethering tests on auto devices are flaky waiting for RA. Increased timeout will give a more generous window to receive RA.

Flag: EXEMPT bugfix
Bug: 418010532
Test: atest android.net.EthernetTetheringTest#testLocalOnlyTethering --iterations 50
Test: atest android.net.EthernetTetheringTest --iterations 20
Change-Id: I6092ee805267a6d50fa2842d3131eeae544c3443

Chris Desir   commited 2025-06-04 10:39:15 -07:00
f3245684d5
Fix NullPointerException in waitForRouterAdvertisement
The failure is caused by a RA packet read race condition. The test
receives a callback that local-only tethering has started and
immediately begins listening for an RA. However, the system's RA daemon
may not have finished initializing.

The test's packet reader times out waiting for an RA and returns a null
packet. The waitForRouterAdvertisement then uses the null packet
checking for RA, causing NPE. Change modifies waitForRouterAdvertisement
to check if a packet is null before processing it.

Flag: EXEMPT bugfix
Bug: 418010532
Test: atest android.net.EthernetTetheringTest#testLocalOnlyTethering
Change-Id: Ic534c53766958ae48a82687a9bd6d09297f074f2

Chris Desir   commited 2025-05-30 12:33:34 -07:00
6fecb23808
Remove RecorderCallback.
This class doesn't actually serve a purpose, it only makes
TestableNetworkCallbck more complex.

Test: CtsNetTestCases ConnectivityCoverageTests
Flag: EXEMPT test-only
Change-Id: I39a598b82a3215384bdfe04980f4b280ab2c2716

Chalard Jean   commited 2025-05-19 16:35:53 +09:00
f2994122c1
Support Wifi P2P Group Owner local network agent
Flag: EXEMPT Flagged by DeviceCongfig wifip2pgo_local_network_agent
Test: atest ConnectivityCoverageTests:android.net.ip.IpServerTest \
      --update-device
Test: atest TetheringIntegrationTests:android.net.EthernetTetheringTest \
      --update-device
Bug: 406172997
Change-Id: I709082c05b576c17fd2823e687d63028b9b8a309

Junyu Lai   commited 2025-04-01 21:08:04 +08:00
6c6128081f
Disable non-thread local network matching
Currently, apps targeting V can see thread local network.

This change introduces a mechanism to make existing
apps unable to see non-thread local networks to ensure minimal
impact on existing devices and applications while adopting this
behavior. Apps targeting B+ Sdk and run on V+ devices can see
non-thread local networks.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalAgentTests \
      --update-device
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server --update-device
      (on next/trunk_staging release config)
Bug: 349487600
Change-Id: I6aa43cebc20a9017c2d8a8a90ebb1d53040a27bb

Junyu Lai   commited 2025-03-21 19:34:49 +08:00
0b806fd931
Add integration test of tethering local network agent feature
Test: atest TetheringIntegrationTests:android.net.EthernetTetheringTest#testLocalAgent_networkCallbacks \
      --update-device
Bug: 349487600
Change-Id: I3a173f7441a766c33844f89c13ef3cc7930167f1

Junyu Lai   commited 2025-03-21 17:59:00 +08:00
1775349555
testTetherBpfOffloadUdpV4: disable on S/Sv2 with old DnsResolver
This mirrors the bpf_existence_test check:

https://source.corp.google.com/h/android/platform/superproject/main/+/main:packages/modules/Connectivity/bpf/tests/mts/bpf_existence_test.cpp;drc=0b477491fb95c04d908ef83d683c42db9102cf40;l=203


Bug: 401312619
Test: TreeHugger, atest EthernetTetheringTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I95020580655f8ff6b1e8c26bc3f26b4823716dd5

Maciej Żenczykowski   commited 2025-03-10 15:53:48 -07:00
bf2c498642
Introduce interfaceName field into TetheringRequestParcel
Bug: 340376953
API-Coverage-Bug: 365678805
Test: Presubmit
Test: atest EthernetTetheringTest
Test: atest TetheringTest
Test: atest NsdManagerDownstreamTetheringTest -b
Test: atest TetheringManagerTest -b

Change-Id: I8025cc2e238b8f9516bf18d8ea0253f1c58a05e6

Seungjae Yoo   authored and   Quang Anh Luong   commited 2024-12-05 08:14:10 +09:00
eab1de47f4
Rename TapPacketReader to PollPacketReader for broader applicability
* Renamed TapPacketReader to PollPacketReader to better reflect its
  functionality beyond TAP interface interaction.
* The class includes general logic for polling and sending packets to
  file descriptors, making it suitable for wider use cases.

Test: TH
Change-Id: Icdf9a9d7ef6f49b589ed9cdbd05159ab95e7e5d9

Yuyang Huang   commited 2024-10-15 13:42:05 +09:00
eb3c631b89
Make java_sdk_library dependencies explicit
modules should specify the submodule of java_sdk_library that the module
actually depends on

Test: CI
Bug: 358613520
Change-Id: I0367068c901df98483f6cf95160d3e7801881b0a

Jihoon Kang   commited 2024-09-10 00:01:31 +00:00
8401b6a9f0
Fix typo in EthernetTetheringTestBase
Bug: 361219545
Test: atest EthernetTetheringTest#testTetherClatBpfOffloadUdp
Change-Id: Ib1e48799f37b19390d304822ec55d5ad3615eaa5

KH Shi   commited 2024-09-06 06:33:32 +00:00
77f6a52083
Fix testTetherClatBpfOffloadUdp test failure
In some cases, the test device may already have an existing CLAT
interface, causing the test to fail because it assumes no CLAT
interface exists before running the test. This change fixes the issue
by retrieving the correct test CLAT interface by its name.

Bug: 361219545
Test: atest EthernetTetheringTest#testTetherClatBpfOffloadUdp
Change-Id: Ie2cdd9c9a6fd143c8419636a448297b36f3c1c40

KH Shi   commited 2024-09-05 07:08:16 +00:00
cf7e5cbf93
Add Fragmented Packet Test to testTetherClatBpfOffloadUdp
Extend testTetherClatBpfOffloadUdp to support fragmented IPv6 packets.
This verifies that downstream fragmented IPv6 UDP packets are
correctly processed by Clatd's BPF offload.

Bug: 285124667
Test: atest TetheringIntegrationTests
Change-Id: Id9c6cfac6fcedbc3615a5502e36851bff62e4dcc

KH Shi   commited 2024-07-08 09:58:08 +00:00
4add163b0c
Add testTetherClatBpfOffloadUdp to TetheringTest
Add a new test case to TetheringTest. It verifies upstream and
downstream UDP packets are actually processed by Clatd's BPF offload.

Bug: 285124667
Test: atest TetheringIntegrationTests
Change-Id: I2f0c3953499af7a701c1b7e72830d502efbd31a1

KH Shi   commited 2024-07-08 09:57:36 +00:00
2ab2a1b0b0
Move MtsEthernetTetheringTest back into TetheringTest
These were originally split in two, so low-level BPF could be changed
more easily. With the introduction of MCTS, updatability of CTS tests is
not a concern anymore, so these tests can be merged back together.

Test: atest TetheringIntegrationTests
Change-Id: Ia0bd91470d445e90230f7a9546de1cb56deef9cc

Patrick Rohr   commited 2024-07-03 14:30:54 +00:00
247e44b2ef
Remove unused import from EthernetTetheringTestBase
Bug: 285124667
Test: m
Change-Id: I9d89ae70ec7d4b52431f8bc992a7cdc1df85d202

KH Shi   commited 2024-06-21 01:57:14 +00:00
f093d22fcc
Increase timeout for waiting for physical interfaces to show up
200ms does not seem to be enough for our test infra. There have been test failures where tethering test was started on devices with physical interfaces that were available for tethering (i.e. cuttlefish on Android R and S).

This change increases the timeout to 1000ms, which unfortunately means the tests will take a bit longer.

Test: TH
Bug: 348044867
Change-Id: I5fe541cf1db1097040066baa73ba949533718ef6

Patrick Rohr   commited 2024-06-19 03:43:33 +00:00
88be5a3a3a
Inline runUdp4Test
runUdp4Test is only used from testTetherUdpV4, so it should be inlined.

Test: TH
Change-Id: I54451c4a707f576d3c5266d7ea8149a831c7cb07

Patrick Rohr   commited 2024-06-10 14:59:39 -07:00
462bd7efe9
Create a tethered interface request in setUp
This CL makes the TetheredInterfaceRequester a class member that gets
initialized (and therefore creates a tethered interface request) in
setup, and releases it again in tearDown. This ensures that when a test
interface is created, ethernet never puts said interface in client mode.

In a previous iteration of this test, there was a race where test
interfaces were briefly put in client mode, which started an IpClient on
the interface. One of the first things the IpClient startup code does is
enable IPv6 which causes RS and MLD packets to be transmitted. This
caused a lot of flaky test failures as the tests were not expecting to
see these packets (and they did not drain the interface appropriately).

Making the tethered interface request permanent during the runtime of
this test solves this issue. As a follow up, the test interfaces should
also be drained when first being passed to TetheringTester.

Test: atest EthernetTetheringTest --iterations 50 (-> there was one
flaky failure that is still being investigated).
Bug: 341800184

Change-Id: Ib0a2518b89d8cc05bb800db6ec5e31f527ba2daa

Patrick Rohr   commited 2024-06-10 14:59:39 -07:00
c06761b877
Merge "Move setupOnce from EthernetTetheringTestBase to EthernetTetheringTest" into main
Mark Chien   authored and   Gerrit Code Review   commited 2024-04-09 07:42:11 +00:00
01e091b1fb
Move setupOnce from EthernetTetheringTestBase to EthernetTetheringTest
If we want to get rid of the flakiness, we may need to change the
production code. You can find a more detailed analysis in
b/318121782/comment#4.

Here's a quick and easy alternative fix: just move setupOnce from
EthernetTetheringTestBase to EthernetTetheringTest. The flakiness
started when I added setupOnce into EthernetTetheringTestBase to
fix flakiness in EthernetTetheringTest.

Bug: 318121782
Test: TH
Change-Id: I0a6fb25773aa60872f71fe4b34e42a0b745a767f

Mark Chien   commited 2024-04-02 05:39:51 +00:00
54fa56def5
Merge "Separate Struct.java into its own lib." into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-03-28 06:23:57 +00:00
68d68d82ed
Separate Struct.java into its own lib.
* Struct.java is removed from net-utils-device-common-bpf and
  net-utils-device-common-struct's source list
* Created a lib net-utils-device-common-struct-base for Struct.java
* Updated libs that require Struct.java to include
  net-utils-device-common-struct-base.
* Replaced net-utils-multicast-forwarding-structs with
  net-utils-device-common-struct in service-connectivity

Bug: 323503345

Test: build tethering module.
Change-Id: I3f60715c3d8043b7569db7612dee9d4fa1ccba59

Yang Sun   commited 2024-03-27 20:15:17 +08:00
3aa62e6773
[EthernetTetheringTest] Don't run setupOnce() if Ethernet is not
supported.

BUG: 323896172
Test: atest CtsTetheringTest

Change-Id: Ibb01d9783a480f0c4acc9385a04527b95ae15fbb
Signed-off-by: Weilun Du <wdu@google.com>

Weilun Du   commited 2024-03-19 21:24:46 +00:00
2881157a6d
Merge "Do not crash on failures in callbacks" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-15 09:17:09 +00:00
028bf79c22
Drop platform_apis from android_library
This property is a no-op for this module type.

Test: m nothing
Bug: 215379393
Change-Id: Ib13007e83c0a6263f36f009ba07407d6ccb50e00

Spandan Das   commited 2024-02-21 15:27:22 +00:00
e84353eaf3
Do not crash on failures in callbacks
Calling fail() in a callback not running in the test thread will crash
the test process, instead of failing the test.

This affects other tests as the whole process dies.

Avoid that by adding errors to a list, which is verified in tearDown().

Test: atest
Change-Id: I354352b61fb1909bcac519bf58d49b36e81c710f

Remi NGUYEN VAN   commited 2024-02-01 14:46:22 +09:00
62b3efbaf9
[DON'T BLOCK] Test ownership migration rules
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.

For more details please refer to the link below,
<add g3 doc link>

Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5

Aditya Choudhary   commited 2024-01-31 12:34:50 +00:00
01b5ede2b2
Add reconnectCell util, refactor reconnectWifi
Add a utility to reconnect mobile data, and refactor toggleWifi to match
it.

The new reconnectWifi utils do not support turning wifi on and back off
anymore, but this was dead code as no test was using it (wifi is
supposed to be connected before starting tests).

Bug: 253698734
Test: atest
Change-Id: I2b8b8d186d05bb57c6a45d872febc54def8c6d59

Remi NGUYEN VAN   commited 2024-01-24 17:49:06 +09:00
4d4664d207
Start Ethernet tethering test once before testing
The first tethering test case might have a tethering restart when
handling IP conflicts. Currently, we start a hotspot once before
tethering, but the test is still flaky in Cuttlefish because it
doesn't support hotspots. Instead, we'll start ethernet tethering.

Bug: 254183718
Test: atest CtsTetheringTest
Change-Id: I695d4e1b3f961893bc30b3144faf7ad7d2d70574

Mark   authored and   Mark Chien   commited 2023-12-27 08:57:57 +00:00
2d0652a465
Make isInterfaceForTetheringAvailable and enableEthernetTethering static
Bug: 254183718
Test: atest CtsTetheringTest
Change-Id: Ie8bf908fc926a0b8b58559c8827951cbeaedc2c6

Mark   authored and   Mark Chien   commited 2023-12-27 08:57:48 +00:00
28b3ea4e06
EthernetTetheringTest: make some global variables static
Before making enableEthernetTethering a static function, make its
dependency variable static.

Bug: 254183718
Test: atest CtsTetheringTest
Change-Id: Id3781d67b3abc69b146fa704d4795bcfb2431a2a

Mark   authored and   Mark Chien   commited 2023-12-27 03:50:32 +00:00
1e6e272014
Remove unnecessary dropShellPermissionIdentity
The test doesn't explicitly call adoptShellPermissionIdentity anymore. Instead it use runAsShell everywhere. Remove the dead code.

Bug: 254183718
Change-Id: Ia949e0e315a3b3ae915752e95ef9fe896fdc0f5b
Test: TH

Mark Chien   commited 2023-11-07 08:25:53 +00:00
f05b4475cd
Extend tethering enable/disable timeout to 30 seconds
The dnsmasq in R might block netd for 20 seconds, which can also
block tethering enable/disable for 20 seconds. To fix this, changing
the timeouts from 5 seconds to 30

Bug: 289881008
Test: TH
Change-Id: Ibed5895b2831465d454854d7250fcc44183596e2

Mark   commited 2023-10-17 06:09:45 +00:00
bb6ecfcd58
Merge "Fix EthernetTetheringTest#testLocalOnlyTethering flaky" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-09-14 17:40:06 +00:00
47158c98b5
Add test for downstream tethering
Add end-to-end testing for testing NsdManager advertising and
discovering works fine with downstream tethering interfaces.

Bug: 281639507
Test: atest NsdManagerTest
Change-Id: I5a66423f216cfe0c82db5128502c885980ab264b

Yuyang Huang   commited 2023-09-12 17:53:37 +09:00
fca402abed
Fix EthernetTetheringTest#testLocalOnlyTethering flaky
The testLocalOnlyTethering only verifies whether an IPv6 RA
with a ULA prefix is sent out. If the test interface is killed
after the RA is sent out while the DHCP server is starting,
the error callback with exception is raised. RunDhcp
verification is used to ensure that DHCP server is started.

Bug: 286701571
Test: TH

Change-Id: Iccebcedbba7b2f9cd28bb1cc06af928ff8dfaaca

Mark   commited 2023-09-05 06:14:21 +00:00
801079f25a
Move ArpPacket.java to frameworks/libs/net
Bug: 281639507
Test: TH
Change-Id: I754c3581438d716d2156b80e4ce29b3f2adf76d4

Yuyang Huang   commited 2023-08-23 18:24:35 +09:00
5c2126ed38
Fix EtherentTetheringTest flaky
The first tethering test case may experience tethering restart
with IP conflict handling. Tethering would cache the last
upstreams so that the next enabled tethering avoids
picking up the address that is in conflict with the upstreams.
To protect subsequent tests, turn tethering on and off before
running them.

Bug: 254183718
Test: atest CtsTetheringTest
      atest MtsTetheringTestLatestSdk
Change-Id: I03729d3212a03bd9fcfe2c09cf327840f13b250c

Mark   authored and   Mark Chien   commited 2023-07-27 16:04:28 +00:00
f5e4b90ae2
Merge "Don't run EthernetTetheringTest if Ethernet is not supported"
Mark Chien   authored and   Gerrit Code Review   commited 2023-07-04 09:12:34 +00:00
df41b36fc9
Don't run EthernetTetheringTest if Ethernet is not supported
Bug: 288844185
Test: atest CtsTetheringTest
Change-Id: Ie918a0657ab17900437918f7ae99f7aa2539052c

Mark   commited 2023-07-03 09:25:18 +00:00
dc581e6c8f
EthernetTetheringTest: test RFC 7050 prefix64 discovery
Reply ipv4only.arpa AAAA query with Pref64::WKA for applying test
prefix64 to LinkProperties of test network.
See Nat464Xlat#setNat64PrefixFromDns.

Currently, the test prefix64 is applied directly in test network
initialization. In order to increase the NAT64 test coverage,
the integration test starts to reply prefix64 discovery DNS query
for testing the RFC 7050 prefix discovery.

These clat related tests are still expected to pass since this
prefix64 source change:
- testTetherClatIcmp
- testTetherClatUdp
- testTetherClatTcp

Bug: 259888307
Test: atest EthernetTetheringTest
Change-Id: Ic94ce997dd0b1d718a1074850c01ea90298cc1c3

Hungming Chen   authored and   Mark   commited 2023-06-26 15:51:25 +00:00
05ecb5c19e
Move buildXXXPacket methods into TetheringTester
Move all EthernetTetheringTest buildXXXPacket util into TetheringTester
and make them static public.

Bug: 259888307
Test: atest EthernetTetheringTest
Change-Id: Ice5252c1adfdb98dfaf815f48ac4603711317f65

Mark   authored and   Mark Chien   commited 2023-06-22 07:12:49 +00:00
4845823f48
Add NetworkStackModuleTest annotation on the specific test case.
EthernetTetheringTest#testTetherZeroLengthDhcpPacket requires the latest
NetworkStack module, otherwise, the test will fail due to the loss of
the fix. Apply @NetworkStackModuleTest to exclude this testcase from
target test suite CtsTetheringTestLatestSdk.

Bug: 283200648
Test: atest CtsTetheringTestLatestSdk
Change-Id: Iebfb043e2b71427a6feaf90788fe79b6ab6b678d

Xiao Ma   commited 2023-06-01 18:16:24 +09:00
161b70c587
Update the integration test to verify zero-length DHCP packet.
DHCP packet listener doesn't close socket any more upon receiving a
zero-length DHCP packet with a fix, instead, just ignore the zero-length
packet and continue reading. Also update the integration test logic to
verify the new behavior, i.e. we can send DHCPDISCOVER from a second device
with different mac address to verify the upstream DHCP server doesn't close
the listening socket, and then we will receive the response from server e.g.
DHCPOFFER packet.

Bug: 269692093
Test: atest TetheringIntegrationTests
Change-Id: I183da43ce5a6511714d293318fe6c60ea55999c0

Xiao Ma   commited 2023-05-15 13:27:16 +00:00
d5020111ce
Add an integration test to verify zero-length DHCP packet.
DHCP packet listener closes the listening socket and stops reading
packet upon receiving a zero-length DHCP packet, which will break
the following DHCP handshake. Add an integration test to verify the
current behavior. A follow-up fix will verify if DHCP server will
accept the zero-length DHCP packet and continue reading packet on
that socket.

Bug: 269692093
Test: atest TetheringIntegrationTests
Change-Id: I5990e37cdfad4e8e4337b0bb1a74632286884baf

Xiao Ma   commited 2023-04-28 10:06:54 +08:00
29e92df3f2
Fix testPhysicalEthernet failure for physical ethernet device
Other virtual interface ethernet test cases stop ethernet tethering
by deleting the virtual interface. To disable ethernet tethering for
testPhysicalEthernet, call stopTethering explicitly.

Bug: 271380398
Test: atest EtherentTetheringTest
Change-Id: I19a73f63227bab6a60d57d38b17a20a3f3f6c1d4

Mark   commited 2023-03-30 09:16:47 +00:00
2040551d18
EthernetTetheringTest: join handler thread after calling quitSafely
Somewhat surprisingly, HandlerThread#quitSafely is *not* a synchronous
method, so the tearDown() method still needs to wait for the thread to
join.

Test: TH
Change-Id: I4297ba057b3d4e67c7b462b6995da637f2479d42

Patrick Rohr   commited 2023-03-14 20:24:01 +00:00
68454864fc