Commit graph

105,274 commits

Message SHA1
Remove packet type and dst mac when sending raw packet
This is now derived from the passed packet data by
NetworkStack.

Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases:ConnectivityMultiDevicesTest
Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: Ida06c00e6f499b782cb903c9fa0a4154c2d8cf84

Junyu Lai   commited 2024-07-03 12:33:11 +08:00
161dc10f60
Support VirtualEnv and parameterized tests
This commit introduces the use of VirtualEnv to manage test
dependencies. Specifically:
  1. `PythonVirtualenvPreparer` is invoked before running tests
     to set up the isolated Python environment.
  2. The test is declared as a `MoblyBinaryHostTest` to enable
     VirtualEnv compatibility, as `PythonBinaryHostTest` lacks
     this support.
  3. The Mobly test runner is invoked manually to accommodate
     multiple test classes, which is not supported by
     `mobly.test_runner.main()`.
  4. Test classes are refactored to inherit from
     `mobly.BaseTestClass` for compatibility with the Mobly
     test runner.

This change is a prerequisite for subsequent commits that will
install libraries via `pip install`, facilitating isolated
dependency management for improved test reliability and
maintainability.

Also, this commit uses parameterized annotation from absl
to rewrite several tests as paremeterized tests.

Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: Iffa2f8fa81c3913f3e08cca01b2c009ca959db73

Junyu Lai   commited 2024-07-03 02:02:40 +00:00
3085caaac0
Merge "Do not call EthernetManager APIs when tests are skipped" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-02 15:05:51 +00:00
48fea4f49e
Merge "Add support for sending raw packets" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-07-02 08:11:02 +00:00
ea809a8819
Merge "Enforce min_sdk_version=30" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 21:39:46 +00:00
6d864ff9ca
Enforce min_sdk_version=30
These tests are run as part of the MTS suite, setting min_sdk_version
ensures that these tests can be installed on an older device and test
the corresponding mainline module.

Test: atest [<mod_name>...]
Bug: 156476221
Change-Id: Ic94b00ee1818063fc9f13e4ecffaca88f58c30c3

Spandan Das   commited 2024-07-01 17:50:35 +00:00
a9fd04cbb9
Do not call EthernetManager APIs when tests are skipped
Calling setIncludeTestInterfaces(false) in tearDown() is not needed as super.tearDown() already takes care of it. In addition, the parent class's tearDown method also checks whether ethernet is supported and the tests actually ran. Leaving the setIncludeTestInterfaces(true) in setup is fine, as super.setUp() fails with an assumption violation if ethernet is not supported.

Note that this is a bit of a hack. NsdManagerDownstreamTetheringTest should not use EthernetTetheringTestBase as a base class (and EthernetTetheringTestBase should be deleted).

Change-Id: Ie1557250166fbf30c98e87dc2ffb4c3e001be167
Test: TH
Bug: 341063340

Patrick Rohr   commited 2024-07-01 15:34:57 +00:00
405fcea5ee
Merge "Add test construct for RtNetlinkLinkMessage" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2024-07-01 11:10:05 +00:00
edebb957eb
Add support for sending raw packets
This commit includes several new functions to support sending custom
raw Ethernet packets. This includes methods for retrieving
MAC addresses, sending empty EtherCAT packets, and sending
arbitrary raw packets with specified types and destinations.
These functions are primarily intended for testing purposes
and rely on the `send-raw-packet-downstream` command provided
by NetworkStack.

Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: Iae7879bf92e1dda8fbd32b92ff166e82c87593c7

Junyu Lai   commited 2024-07-01 16:53:50 +08:00
4a1baf042b
Merge "Add apf_utils for multi-device tests" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 08:24:57 +00:00
6acc14e048
Merge "Add adb_utils for multidevice test" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 08:12:13 +00:00
e3d4d03fa9
Add apf_utils for multi-device tests
Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: I79064abcb88fbcee00ec9ec998ba5a3e2d3478a6

Junyu Lai   commited 2024-07-01 13:44:12 +08:00
b0f759c42a
Merge "Add assert_utils for multidevice test" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 05:42:09 +00:00
68c8702570
Add adb_utils for multidevice test
This commit adds the necessary code for 'adb_utils' to enable APF
multi-device testing which will be introduced in follow-up patches.
This includes utilities of issuing shell command, parsing dumpsys
key-value pairs, controlling doze mode and screen state.

Additionally, unit tests are added to verify the basic functionality.

Test: atest NetworkStaticLibHostPythonTests

Bug: 335368434
Change-Id: I580e91b494580ec9105c8988972845d38c104031

Junyu Lai   commited 2024-07-01 13:33:13 +08:00
bed4480ffd
Merge "Refactor thread leak monitoring" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 04:25:29 +00:00
584cadc1eb
Add assert_utils for multidevice test
Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: I2a9ee97b84cb16791c0c5e3cb03120e67ffeb0af

Junyu Lai   commited 2024-07-01 12:23:59 +08:00
850e6fae54
Merge "Move utils to staticlib" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 04:18:51 +00:00
f07d4ce9c3
Add test construct for RtNetlinkLinkMessage
Test: TH
Change-Id: I00b8bd394e0666ecd79dc55fb1e53fecd7c94837

Yuyang Huang   commited 2024-06-29 21:42:48 +09:00
7c0f87414c
Merge "Add CTS test for APFv6 ICMPv6 ping reply filtering" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2024-06-28 13:07:08 +00:00
a976f4d608
Add CTS test for APFv6 ICMPv6 ping reply filtering
Added a CTS test case to verify APFv6 implementation by sending an
ICMPv6 ping request with a 56-byte payload. The reply was expected to be
dropped by the APF program. The APF program was expected to sent another
ICMPv6 ping request with a 1-byte payload. The reply was expected to be
accepted by the APF program. Finally, The test confirms if the second
ping reply is received.

Test: TH
Change-Id: I322e7c0674ac9df60579d9e6d44690e383004d36

Yuyang Huang   commited 2024-06-28 21:00:00 +09:00
b41b67a52a
Merge "Do not run mapLockTest on 4.9 kernels" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-28 06:34:27 +00:00
f2315d018b
Move utils to staticlib
This is a no-op refactoring.

Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases
Bug: 335368434
Change-Id: I415cc22f49c437be6fe8e8ae8822af22ebefe8d1

Junyu Lai   commited 2024-06-28 11:19:54 +08:00
79b771f9bb
Merge "Refactor enforceMeteredApnPolicy" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-06-28 02:24:06 +00:00
9f3b991a7a
Do not run mapLockTest on 4.9 kernels
bpfLock() does nothing on 4.9 as it relies on bpfGetFdMapId which is not available until 4.14.

Change-Id: Ib737db61a5d8fb39bcbbe1bb5937afb0c63bd1d1
Test: TH
Bug: 349034378

Patrick Rohr   commited 2024-06-28 00:27:29 +00:00
78ad0039bf
Merge "Replace TetheringRequestParcel with TetheringRequest" into main
Quang Luong   authored and   Gerrit Code Review   commited 2024-06-27 23:00:42 +00:00
73748afc57
Refactor enforceMeteredApnPolicy
Address review comment on aosp/3027487
This CL also adds test for enforceMeteredApnPolicy

Test: CSBlockedReasonsTest
Bug: 344800107
Change-Id: Ib531bf5b34566fc91fec9f977c5257b332189706

Motomu Utsumi   commited 2024-06-27 22:25:47 +09:00
e9c07ffd72
Merge "Document reason for not using SingleWriterBpfMap in ClatCoordinator" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2024-06-27 02:10:04 +00:00
865fcc72c3
Merge "Revert "ClatCoordinator - use SingleWriterBpfMap"" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2024-06-27 02:09:09 +00:00
08af0d01e6
Merge "Revert "Prepare for @RequiresApi class retention"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-26 11:47:49 +00:00
270f0064f6
Document reason for not using SingleWriterBpfMap in ClatCoordinator
Test: m
Change-Id: Ic781baf65be092612db20da73fe3fd340f9828dd

KH Shi   commited 2024-06-26 11:30:05 +00:00
fbe570b69d
Revert "Prepare for @RequiresApi class retention"
This reverts commit 53da9ac34c.
And fixes the linter errors.

Bug: 328190227
Test: TH
Change-Id: I92e0f268c770b6e46bdc781d4867f1e0b505d4ad

Motomu Utsumi   commited 2024-06-26 19:14:30 +09:00
a1a0034f0e
Revert "ClatCoordinator - use SingleWriterBpfMap"
This reverts commit I93b8b94dcad8f2bc4d022314372fb97109ed8f2f.

Reason for revert: ClatIngress6Value and ClatEgress4Value are written to by the clatd.c program (reference aosp/3002596). Due to this, SingleWriterBpfMap is unsuitable in this scenario, as it can only be used when no BPF program ever writes to the map.

Change-Id: I382bbfc8554391c6c83a39bbea155114202b71a8

Yuyang Huang   commited 2024-06-26 10:09:52 +00:00
a793772808
Refactor thread leak monitoring
Preparation to add default network restore monitor(aosp/3037352)

Test: TH
Bug: 328870515
Change-Id: I0f9deede6075bccaa26ee7f286a42dd60413fac3

Motomu Utsumi   commited 2024-06-26 18:39:10 +09:00
8ab6a6b512
Merge "Thread: fill in ticks in active timestamp" into main
Yakun Xu   authored and   Gerrit Code Review   commited 2024-06-26 09:33:38 +00:00
4355dae9d8
Thread: fill in ticks in active timestamp
This commit fills in the ticks of active timestamp of randomly generated
dataset as defined in Thread spec.

Bug: 347838683
Change-Id: I5d8ba3ca7728e1890996fdd64198f7bc90bfb1fa

Yakun Xu   commited 2024-06-26 15:56:57 +08:00
e2ab96f3c7
Merge "Only send callbacks when overridden" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-26 07:35:45 +00:00
e1c10b08a2
Replace TetheringRequestParcel with TetheringRequest
Replace TetheringRequestParcel with TetheringRequest in the service
code. This makes future changes easier since TetheringRequest is a
proper class and not an AIDL object.

Bug: 216524590
Test: atest TetheringTest TetheringManagerTest
Change-Id: I0cdee597d393e53feb9fe9aff4d6c67330c88599

Quang Anh Luong   commited 2024-06-26 16:25:13 +09:00
3e65131ba3
Only send callbacks when overridden
Most users of NetworkCallback do not override all methods, so callbacks
from ConnectivityService end up being unused by the app.

To save resources, check which callback methods are overridden in
ConnectivityManager, and inform ConnectivityService so it can skip
preparing and sending the corresponding binder calls when the callback
is not used by the app.

This is flagged off by default.

Test: flag enabled: atest CtsNetTestCases ConnectivityCoverageTests
Bug: 327038794
Bug: 279392981

Change-Id: Iaf490f416fb6e1437d40497fba1a40a899a9f523

Remi NGUYEN VAN   commited 2024-06-26 12:39:47 +09:00
2fd3823cbc
Merge "Make firewall bpf code multi-user aware" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-25 14:55:20 +00:00
51741a1633
Merge "Exempt Wear on Arm from 64-bit userspace requirement check." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-25 11:57:58 +00:00
038d4cf49d
Exempt Wear on Arm from 64-bit userspace requirement check.
Arm-only because the 32 bit userspace vs 64-bit kernel
issues are worse on x86 because of some extra 4 vs 8 byte
alignment (when included in structs) ABI issues.

Wear is unlikely to ever run on comparatively high
power usage x86 cpus, so this should be fine.

Manually tested by adding:
  if (isWear()) ALOGI("Wear!");
and additionally logging 'bool watch' within isWear()
on 'cf_gwear_x86-trunk_staging-userdebug'.
Resulting output:
  I NetBpfLoad: NetBpfLoad v0.46 (/apex/com.android.tethering/bin/netbpfload) api:35/36 kver:601004b (32-on-x86-64) uid:0 rc:01
  I NetBpfLoad: isWear(ro.cw_build.wear_sdk.version=6[6] ro.build.characteristics='nosdcard,watch'[1]): true
  I NetBpfLoad: Wear!

Bug: 346252668
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9b2a3b88095264245935950bd1a7dfbb5293334b

Maciej Żenczykowski   commited 2024-06-25 10:39:43 +00:00
6e6b2096e1
Merge "Add test for FILTER_AGE_16384THS increment in APFv6 interpreter" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-25 07:26:32 +00:00
b3d0259c42
Make firewall bpf code multi-user aware
The check is_system_uid should mirror the definition of core_uids in
UserHandle.isCore until it is available to be read from mainline code.
isUidNetworkingBlocked should also do the same.

Test: All existing tests should pass.
Test: atest CtsHostsideNetworkPolicyTests
Test: atest FrameworksNetTests

Bug: 348316140
Change-Id: Id5e01289b301a725b162ef249062e0f2806876dc

Suprabh Shukla   commited 2024-06-25 00:21:27 -07:00
3d00262fe7
Add test for FILTER_AGE_16384THS increment in APFv6 interpreter
Introduced a test case to verify the correct incrementing of the
FILTER_AGE_16384THS counter when using the APFv6 interpreter.

Test: TH
Change-Id: Idbb31580d6489865c05e4a35760f1ea26f779f17

Yuyang Huang   commited 2024-06-25 15:24:59 +09:00
8722953649
Merge "Add mulit devices mdns tests" into main
Paul Hu   authored and   Gerrit Code Review   commited 2024-06-24 15:19:27 +00:00
2d68bc2135
Merge changes from topic "thread-configuration-api" into main
* changes:
  [Thread] support ThreadConfiguration API at ThreadNetworkControllerService
  [Thread] add support for configuration at ThreadNetworkController

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-24 10:03:18 +00:00
bc9c0e2b03
[Thread] support ThreadConfiguration API at ThreadNetworkControllerService
Bug: 342519412
Test: atest CtsThreadNetworkTestCases

Change-Id: I7b84a64d24e513bd6ba07bb26e3801b72c250810

Handa Wang   commited 2024-06-24 07:50:37 +00:00
4688910810
[Thread] add support for configuration at ThreadNetworkController
This CL adds methods for setting the ThreadConfiguration and
subscribing/unsubscribing to Configuration changes. The ThreadConfiguration
is used for controlling Thread features for the device.

Bug: 342519412
Change-Id: I9e20391eb3b2f20312a2cb0b587cc5bdf200d24d

Handa Wang   commited 2024-06-24 07:50:34 +00:00
7520abf333
Add mulit devices mdns tests
Add tests to verify mdns advertising, discovery, and resolution
over a hotspot connection using multiple devices.

Bug: 343311941
Test: atest CtsConnectivityMultiDevicesTestCases
Change-Id: I9f52a271385cddc12c8f57b188e080ad69651f9f

Paul Hu   commited 2024-06-24 06:47:24 +00:00
7d42feb303
[mdns] Update doc for NsdServiceInfo
This CL updates the javadoc for NsdServiceInfo to make it clearer that a client must contain all the desired address records for the hostname, and all the other registrations must not have any address records for the same hostname.

Bug: 344799768
Test: None

Change-Id: I8eea39adf870a75de23bcafaf8e13d78ee330da4

Handa Wang   commited 2024-06-24 06:27:21 +00:00
0f5ae1fd08