LockdownVpnTracker directly uses resources from
com.android.internal.R. This is acceptable because it's platform
code. But ConnectivityServiceTest uses the LockdownVpnTracker
built from the module source tree, and when that code fetches
resources on a previous Android release, it crashes because the
resource IDs don't exist; non-public resource IDs aren't stable.
Fix this by mocking the resources used by LockdownVpnTracker.
Test: atest ConnectivityCoverageTests
Change-Id: I239a18a38d4f1082f76f5ff1b831c15ee753bdfd
This test creates a TUN interface and registers it with
ConnectivityService. For 15 seconds, it continuously writes data to that
interface and measures at what rate it is received.
Data accounting is currently not covered by this test.
Test: atest RateLimitTest
Bug: 172053704
Change-Id: I74f891f3b7113855375c48a10cefbfe47221931b
Currently, there are two EVENT_NETWORK_TESTED message types in
ConnectivityService. One is used by the ConnectivityService
handler to process validation results, and one is used by
ConnectivityDiagnosticsHandler to send connectivity reports.
The two messages have different contents so it is confusing that
they have the same integer and the same name. Rename the second
one to CMD_SEND_CONNECTIVITY_REPORT.
Test: atest ConnectivityServiceTest
Test: atest CtsNetTestCases:android.net.cts.ConnectivityDiagnosticsManagerTest
Change-Id: I77d63dad477315e1fcc7225a5ef03aff2bed8c35
TestNetworkAgentWrapper does not set the interface name in its
LinkProperties causing logwtf to fail tests on -eng build.
Test: atest FrameworksNetTests:ConnectivityServiceTest on -eng build
Change-Id: Ieba0453ce897aa1052cb98f1de4c7bb099383c8d
NetworkStatsService was mainlined in T, so the test does not need to be
run on previous Android versions.
Test: atest CtsNetTestCases:NetworkStatsServiceTest
Change-Id: I8e69746a03ef029b1121cc8fa71e299ac12c2905
Add some happy path logging that informs about active rate limits.
Test: TreeHugger
Bug: 218840346
Change-Id: Iddd50583ca2e90afe83a5c68611418fa794afb3f
All NetworkMonitor messages contain the netId of the source
NetworkMonitor. But the netId is in various places in the
message. It's most frequently in arg2, but sometimes it's boxed
into an Integer in obj, and sometimes it's in another object.
Always pass the netId into arg2. This allows us to write
common code at the beginning of the function that extracts the
netId and nai, and performs common actions on all messages.
Bug: 216567577
Test: atest FrameworksNetTests FrameworksNetIntegrationTests
Test: atest CtsNetTestCases:ConnectivityManageTest
Test: atest CtsNetTestCases:NetworkAgentTest
Change-Id: Idbbe3cddfc5475a2d56df387f840439dc4c9514c
The version of ConnectivityManagerTest#waitForAvailable that
takes a callback and a Network implicitly requires that the
network be validated, because it calls expectAvailableCallbacks
with validated=true.
This is incorrect because a network can become available without
being validated. In particular, testMobileDataPreferredUids is
flaky due to this problem, because it calls connectToCell, which
does not wait for validation, and then calls waitForAvailable,
which expects that the network is already validated.
Fix it by not requiring any particular validation state. This
method is only used by a few tests and they should not be
affected by this change:
- The first two calls in testSetOemNetworkPreferenceForTestPref
happen after waiting for validation, so the network is
validated already. The third call waits for a test network,
and test networks are always validated.
- The first call in testSetOemNetworkPreferenceForTestOnlyPref
waits for a test network, which is always validated. The
second is incorrect because ensureWifiConnected does not
wait for validation, and is fixed by this CL.
- The calls in testMobileDataPreferredUids similarly incorrectly
assume that wifi is validated and are fixed by this CL.
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testMobileDataPreferredUids
Change-Id: I614d0ba87c3931fcbe4011fed379e1736f5c4a44
Remove the include for Connectivity/Tethering TEST_MAPPING as there is
no such file in that directory, add comments on ConnectivityModuleTest
usage, and skip the whole NetworkAgentTest on non-connectivity module
MTS runs.
Bug: 218611855
Test: atest CtsNetTestCasesLatestSdk
Change-Id: Id96ab8a5ae631b0c64f20faedd4a0430eb9318d4
BPF is supported after kernel 4.9. Skip the test on BPF
unsupported device. Ex: walleye.
Bug: 219696135
Test: atest bpf_existence_test on walleye
Change-Id: I583a858587c0501582c9e77c8b584b3136312cd5
Add missing @ConnectivityModuleTest annotations to tests that cover
functionalities that were introduced in a newer connectivity module
update.
Also add CtsNetTestCasesLatestSdk to postsubmit with only APK modules
installed, and with only the connectivity/tethering module installed.
This can then be moved to presubmit to catch such issues before they are
merged.
While doing this cleanup the TEST_MAPPING file in tests/ and merge its
contents into the root TEST_MAPPING file. This does not change anything
for "postsubmit" tests as they are run independently of changes. It only
causes FrameworksNetIntegrationTests to run in presubmit on any change
in modules/Connectivity/ instead of only on modules/Connectivity/tests/
changes, which is how it should be.
Bug: 218611855
Test: TH needs to test TEST_MAPPING
Change-Id: I26629a35d8c2df3db33180ecc22d49d538ad3b8b
Check kernel version to ensure current kernel supports
BPF logic for testcase.
Bug: 217209172
Test: atest DscpPolicyTest
Change-Id: I9e0df7d2e4eb320bd5324e2d13410bd960b75174
One of VpnTest#startVpn overloads didn't propagate "excludedRoutes"
param, due to mistake during conflict resolution in aosp/1941233.
Bug: 214398350
Test: atest HostsideVpnTests --iterations
Change-Id: Icbbe7394f1ff1f676cc671a1fa1c4449f4d585e3
Parse the dumpsys output strings to check that the IPv4 UDP
forwarding rule is added by the UDP conntrack event on
the tethering interface.
Test: atest EthernetTetheringTest
Change-Id: I2f04af72e51ca6b7a37ba51daa4f5125cb11144c