Commit Graph

1239 Commits

Author SHA1 Message Date
Benedict Wong
2cb7034baf Add reflected-packet based data tests
This commit adds tests that reflect outgoing packets, flipping the outer
src/dst headers to avoid the need to tear down and rebuild the outer
TUN.

This allows us to at least test that our implementation can interoperate
with itself.

Bug: 72950854
Test: this, passing
Merged-In: Ia969f78f4c1a0c0a017f5aad425a68852ff4433a
Change-Id: Ia969f78f4c1a0c0a017f5aad425a68852ff4433a
(cherry picked from commit 144937f3df37ee0b1d5484f10e8c86a8a70a9cb5)
2019-05-31 13:00:30 -07:00
Benedict Wong
a0279520f0 Cleanup IPsec CTS tests
This commit addresses comments from aosp/963067 and aosp/959617.

No behavioral/functional changes were made, only renames and minor style
nits addressed.

Bug: 72950854
Test: Ran on devices, working
Merged-In: I1702b91e245412f0142e9e47b7fb373b9b4e8126
Change-Id: I1702b91e245412f0142e9e47b7fb373b9b4e8126
(cherry picked from commit 68237a11f9532ca6c59d579adb374fe40b0b3bee)
2019-05-31 13:00:15 -07:00
paulhu
78e4a184a1 Enable instant app mode for CtsNetTestCases
1. Indicating CtsNetTestCases support instant app mode but
   ignore some tests that cannot run in instant app mode.
2. Move some tests which need to test on API 23 into
   CtsNetApi23TestCases module due to instant app package
   must target at least API 26.

Bug: 123366918
Test: atest CtsNetTestCases --instant
Test: atest CtsNetApi23TestCases
Test: atest FrameworksNetTests

Change-Id: I4e828cbc48143e36c1be38b91c3c698122d4be5a
2019-05-16 16:07:07 +08:00
Benedict Wong
4af108aacf Fix IPsec CTS tests for interface address checking
Fixes two potentially device/kernel specific, or flaky bugs:
1. Java interface checking by name seems to cache the lookup, resulting
in interface address checks occasionally failing (on delete).
2. Link-local addresses appear to be added on all links for some set of
kernels and devices.

This patch addresses both by only checking that the requested address
was added via a address-based NetworkInterface lookup.

Bug: 72950854
Test: Ran on sargo-eng on qt-dev/HEAD
Test: Manually verified that the addresses are indeed added/removed
Change-Id: I3babc72dfe72337c4d68facb1695aec15e504c90
2019-05-15 01:02:28 -07:00
TreeHugger Robot
c7774ffa16 Merge "Enforce IPsec Tunnel mode for Android Q" into qt-dev 2019-05-15 03:58:29 +00:00
junyulai
bbf160a93d add cts for unprivileged keepalive slots
Currently, unprivileged Nat-T keepalives are limited to 1 slot
per uid. Add CTS to verify that the keepalive slots are limited
as customized for unprivileged requests.

Bug: 129371366
Test: atest android.net.cts
      .ConnectivityManagerTest#testSocketKeepaliveUnprivileged
      --generate-new-metrics 10

(Clean cherry-pick of aosp/957205)

Change-Id: I60b9e9ae9cf2b63490493ced9738cd2f402c3f9b
Merged-In: I60b9e9ae9cf2b63490493ced9738cd2f402c3f9b
2019-05-13 22:19:02 +08:00
junyulai
ad4c047f6d [KA14] add cts for keepalive limit test.
Per SDK requirement, OEM is required to support minimum number of
concurrent keepalives. Implement CTS to verify this.

Bug: 129371366
Test: atest android.net.cts
      .ConnectivityManagerTest#testSocketKeepaliveLimit
      --generate-new-metrics 10

(Clean cherry-pick of aosp/937026)

Change-Id: I8be89116bed5c4dedb2ca42b6d633aa9e8c6a49a
Merged-In: I8be89116bed5c4dedb2ca42b6d633aa9e8c6a49a
2019-05-13 22:16:50 +08:00
Benedict Wong
0d08e91fe7 Convert IPsec tests to JUnit4
This patch fixes an incompatibility where some tests in the same
hierarchy were using Junit3, and other Junit4

No functional test changes made

Bug: 72950854
Test: Ran on devices, working
Change-Id: I79d231e202ba25ad5f57b44b387bebd7f012aa95
2019-05-10 20:05:43 +00:00
Benedict Wong
fbbb9c9c04 Enforce IPsec Tunnel mode for Android Q
This commit adds a second condition to whether the device is expected to
have the tunnel mode feature. If a device's first API/launch version is
Q or above, require IPsec tunnels

Bug: 72950854
Test: Ran on device with first API level < Q and == Q.
Merged-In: I545444bb483b0f5de45d00a07dc45aeb9e9cbdf7
Change-Id: I7b849ad24a04b6b7899a80f1856236b5ceb5a839
(cherry picked from commit d2465991d9)
2019-05-10 18:08:48 +00:00
Benedict Wong
817d192bc4 Add IPsec Tunnel mode data tests
This change adds single-direction tests for the IPsec Tunnel Mode API.
In the outbound direction, TUNs are used to capture outgoing packets,
and values are inspected. In the inbound direction, packets are built
manually, using the PacketUtils framework. Additional testing for
end-to-end integration tests will follow in aosp/941021 using packet
reflection via the TUN.

Bug: 72950854
Test: This; passing
Change-Id: Ic4181fc857fa880db5553314efa914f870dbe87c
Merged-In: Ic4181fc857fa880db5553314efa914f870dbe87c
(cherry picked from commit d708a4c217f13c9028427d98031394f0933482bf)
2019-05-09 17:30:32 -07:00
Benedict Wong
2d2a1ab8f7 Add utilities to generate packets
This change adds utility methods to generate packets incrementally. It
supports UDP, ESP, IPv4, IPv6 packet generation.

For ESP, it exclusively does AES-CBC, HMAC-SHA256.

Bug: 72950854
Test: This
Change-Id: Icffeed2ebb2005d79faf04f48fd5126d1d6fb175
Merged-In: Icffeed2ebb2005d79faf04f48fd5126d1d6fb175
(cherry picked from commit 0e4743d56553d698ac45ae548f31019ea6e91541)
2019-05-09 17:30:32 -07:00
Benedict Wong
2742923a63 Add TunUtils as utility to reflect packets
This patch adds a TunUtils class, allowing for packet capture over a TUN
interface, inspection of some basic header fields, and reflection of
packets with flipped src/dst headers.

Bug: 72950854
Test: Ran, passing
Change-Id: I9fdba4a905886c7a4820d86ef52c0cc1843215b2
Merged-In: I9fdba4a905886c7a4820d86ef52c0cc1843215b2
(cherry picked from commit 2f07cd8551d755a4076e94b9e620bc446a66bf54)
2019-05-09 17:30:32 -07:00
Benedict Wong
af4330f777 Check for IPSEC_TUNNELS feature before running CTS tests
If tunnel feature does is not present, skip tests.

Bug: 117183273
Test: This
Change-Id: I62fcc2cbca8bf3d2b70da5646303a7059a0df663
Merged-In: I62fcc2cbca8bf3d2b70da5646303a7059a0df663
(cherry picked from commit 698c99fcf03a4e1afb028ac66852140762a7f2b1)
2019-05-08 04:17:03 +00:00
Hui Yu
dc7e2bb71c Merge "Make sure app_idle_constants is set during setup." into qt-dev 2019-05-02 22:51:17 +00:00
Kweku Adams
42f325acb9 Merge "Testing Data Saver changed broadcast on unsupported devices." into qt-dev 2019-05-02 22:14:37 +00:00
Roshan Pius
5dea0afd70 WifiManagerTest: Allow NETWORK_SETTINGS for apps with BIND_QUICK_SETTINGS_TILE
Bug: 130199973
Test: atest WifiManagerTest
Change-Id: Ia31a56ba5fadb52fd724a7d213116cb0f1d0407a
2019-05-02 16:42:55 +00:00
TreeHugger Robot
5b80d31a46 Merge "Allow NFC to grant NETWORK_SETTINGS permission" into qt-dev 2019-04-30 18:54:53 +00:00
Kweku Adams
3a88dd4732 Testing Data Saver changed broadcast on unsupported devices.
Bug: 114131539
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: I3e8f9297ca49ee86bd26bb3d7a094c38b6203118
2019-04-29 11:25:14 -07:00
Hui Yu
022058ec74 Make sure app_idle_constants is set during setup.
Set app_idle_constants in NetPolicyTestsPreparer is not always successful(suspect timing issue).
Set app_idle_constants in AbstractRestrictBackgroundNetworkTestCase again to make sure.

Bug: 115393390
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testAppIdleMetered_whenCharging

Change-Id: I41148bc7eea0825537133f0471ceefeb5b05d763
2019-04-26 17:07:34 -07:00
Lorenzo Colitti
5abd1ff346 Add instant and ABI XML tags for hostside networking tests.
These are not multi-ABI because the behaviour does not depend on
the ABI of the app. Some of the APIs are ultimately backed by JNI
code in the system server, but that only depends on the system
server's ABI, not the app's.

Enable instant mode because these applications are subject to the
same network restrictions as other apps.

Fix: 123364589
Test: atest CtsHostsideNetworkTests
Test: cts-tradefed run commandAndExit cts --enable-parameterized-modules --module-parameter instant_app -m CtsHostsideNetworkTests
Change-Id: Ib3c4cd365ffe95889d51a236f035ea84516f0abd
(cherry picked from commit ad17ee9e92)
2019-04-26 12:52:28 -07:00
Jack Yu
7457cd2728 Allow NFC to grant NETWORK_SETTINGS permission
There is use cases in NFC that need this permission.

Bug:131195124
Test: Cts pass after NFC app add NETWORK_SETTINGS permission
Change-Id: Iec5a08721da43767cfd0ced51e73a1b757b0d97a
2019-04-26 11:49:45 +08:00
Chalard Jean
221ac7cdb2 Add a test for a bugfix in UrlQuerySanitizer
...so this does not happen again.
This is a test for the fix in Ic91660d974dce21f2affdcacaeffe9accf8451ac

Bug: 1866121
Test: This
Change-Id: Ib7ee866f65baf99b46a31e2115355a42a829421e
(cherry picked from commit d60c09fd4db5deb81900af5208cc9306e2f77b3b)
Merged-In: Iba7ed3fe8cb23d7d14a29f2259a08e9c833db146
Merged-In: I10882b8d9a62766acfff6ec18afb3d813c631fd3
2019-04-23 05:35:17 +00:00
Varun Anand
5d3ac8f9e1 CTS tests related to VPN meteredness.
(cherry picked from commit d1008aa730)

Tests cover scenarios related to whether VPN has explicitly declared its
underlying networks plus whether it is an always metered VPN.

For each of these scenarios, we ensure VPN meteredness based on its
capabilities and ConnectivityManager#isActiveNetworkMetered matches.

Bug: 123727651
Test: atest HostsideVpnTests

Change-Id: I2dea70c1c432d05b1a22c945f1e3e17166e4132d
Merged-In: I3030e5468a55bbc32be2a753f098dcf7f0256af8
2019-04-15 07:55:58 -07:00
Luke Huang
a0e4104e81 DnsResolver cts changes to match API council requests
Bug: 129261432
Test: atest DnsResolverTest

Merged-In: I42df921cc3bb01ea25a671d5a1af678a6d3f5872
(cherry picked from commit 8999684430)

Change-Id: Ibcb92ac23cf413322234bba9100293ab794cf50e
2019-04-12 06:21:07 +00:00
Adam Vartanian
49a2918a96 Add test for SslError.getCertificate()
Bug: 129200144
Test: cts -m CtsNetTestCases -t android.net.http.cts
Change-Id: I1b23746865a4bffc90847b30384defd2c7d49879
Merged-In: I1b23746865a4bffc90847b30384defd2c7d49879
(cherry picked from commit befb9b0798)
2019-04-11 11:55:38 +00:00
Remi NGUYEN VAN
ef4ac8c021 Add FrameworksNetCommonTests to CTS
The common tests include tests that must be both in CTS and unit tests.

Bug: 129199908
Test: atest CtsNetTestCases, IpPrefixCommonTest is run and passes.
Change-Id: I872fb80e8a0b21144f0b66b33645a320dcd5dcf2
(cherry picked from commit 855e7889d6)
2019-04-05 05:52:29 +00:00
Mark Chien
d4ed482869 Merge "[KA09] add cts test for tcp keepalive offload" am: e8fb173b7d am: 25a820bdb9
am: da0ae30f64

Change-Id: I81e91394950f6b88ff10d13c67ce974e5cdd9a39
2019-04-03 03:43:41 -07:00
Mark Chien
e8fb173b7d Merge "[KA09] add cts test for tcp keepalive offload" 2019-04-03 09:36:52 +00:00
markchien
5dc1681823 [KA09] add cts test for tcp keepalive offload
Add a test case to make sure tcp keepalive offload starts
correctly.

Bug: 114151147
Test: atest ConnectivityManagerTest#testCreateTcpKeepalive
Change-Id: Iaf1c2fab755f3df8e866b4988f64c25906e1737a
2019-04-03 13:50:39 +08:00
Junyu Lai
52c4286d77 Merge "Fix tests in TrafficStatsTest that are affected by adb over network" am: 553872fc04 am: 1e68a61016
am: ec75966da1

Change-Id: Iada21760551959e96210bf2f1807f24bc6d82be7
2019-04-01 20:08:12 -07:00
Junyu Lai
553872fc04 Merge "Fix tests in TrafficStatsTest that are affected by adb over network" 2019-04-02 02:00:25 +00:00
Roshan Pius
52b26e2cab Merge "WifiManagerTest: Test for new privileged permission" 2019-04-01 19:57:11 +00:00
Lorenzo Colitti
f0d0a9e352 Merge "Add test coverage for ICMP echo constants." am: 718025ed2c am: 0f6be092bb
am: b452497881

Change-Id: Ic0189e07e2745b721a307754a7bcc6574878ac32
2019-04-01 09:11:18 -07:00
Lorenzo Colitti
718025ed2c Merge "Add test coverage for ICMP echo constants." 2019-04-01 15:08:44 +00:00
junyulai
c1419d913d Fix tests in TrafficStatsTest that are affected by adb over network
If the adb TCP port is opened, this test may be run by adb over
network. Huge amount of data traffic might go through the
network and accounted into total packets stats. The upper bound
check would be meaningless.

Bug: 126320702
Test: atest android.net.cts.TrafficStatsTest 10 trials for both cases

Change-Id: Iaee455826dc01741c6a3a9f5f8096361c69a1e7c
2019-04-01 11:12:16 +08:00
Roshan Pius
478f45e36d WifiManagerTest: Test for new privileged permission
Add a new test to ensure that the NETWORK_CARRIER_PROVISIONING is only
granted to one app.

Bug: 129401919
Test: atest WifiManagerTest
Change-Id: Id2e722d63b02d9cee718dd3af49e9ef113bd5ffb
2019-03-29 12:36:38 -07:00
Lorenzo Colitti
950e10572b Add test coverage for ICMP echo constants.
Bug: 129251251
Test: atest android.net.ipv6.cts.PingTest com.android.cts.net.HostsideVpnTests
Change-Id: Icca18e0870588ca250225ce79cf30dbd8c361e84
2019-03-30 02:11:46 +09:00
Lorenzo Colitti
a7fc792b84 Merge "Add more test for async DNS api" am: 3592095637 am: 05a8151676
am: 4e95f73af9

Change-Id: If53503449da4687d8740485aa80e2a79f2ef4ad2
2019-03-29 08:30:47 -07:00
Luke Huang
8fd0506401 Add more test for async DNS api
Bug: 129395490
Test: atest DnsResolverTest
Change-Id: I4d2cdc2be577846c08dfe994da60965f983acb97
2019-03-29 17:09:57 +08:00
Luke Huang
e36443f4b0 Merge "Improve cancellation test for async DNS API" am: 7ac8a1e73e am: 532f7a7875
am: 4da94c3c61

Change-Id: Iffb26abf97bbcba814ffc6105831aad4667a2aa0
2019-03-28 21:11:44 -07:00
Luke Huang
92f1edd2f0 Improve cancellation test for async DNS API
After having a lock between callback and cancellationsignal,
errno with EBADF should not happen.

Bug: 129317069
Test: atest DnsResolverTest
Change-Id: I08e800b078d40345eb3f46da1323db251c8dcd47
2019-03-28 21:06:30 +08:00
Lorenzo Colitti
bcc22abe3d Merge "Fix expected reverse lookup of Google DNS IP addresses" am: 38ca09669a am: d73366ae68
am: 86effc29ba

Change-Id: Ia5b898185b77aceeb2e3a5fbdd168d3f470fa056
2019-03-28 03:20:35 -07:00
Lorenzo Colitti
3852fd92f5 Fix expected reverse lookup of Google DNS IP addresses
DnsTest.testDnsWorks expects that reverse lookup for the Google
public DNS servers will return something with google.com in the
name. This no longer works because the reverse DNS entries have
changed to dns.google.

Bug: 129452237
Test: atest android.net.cts.DnsTest.testDnsWorks
Change-Id: Iee8bfe418bf6003e5c78df77d75f6f9745249267
2019-03-28 17:41:13 +09:00
Luke Huang
c8bc339f5f Merge "Improve test and fix doulbe-close fd problem for async DNS API cts" am: 277181d9d3 am: af31d7737c
am: db34a5d62e

Change-Id: If254f96b9706913a9a3b8970ccd1264225467bb0
2019-03-26 23:06:33 -07:00
Luke Huang
acadb939b5 Improve test and fix doulbe-close fd problem for async DNS API cts
1. Change test cases for enlarging buffer size of FrameworkListener.
2. Remove test procedure which caused doulbe-close fd.

Bug: 129317069
Bug: 126307309
Test: atest CtsNativeNetDnsTestCases MultinetworkApiTest
Change-Id: I8d871cebca6fa7e298a874ba430ec0aaa05c0eed
2019-03-26 20:33:43 +08:00
Ahmed ElArabawy
329a65aeec Merge "Wifi: Rename class name WifiManager_WifiLockTest" 2019-03-25 21:22:48 +00:00
Lorenzo Colitti
ddc9bbe848 Merge "Enable instant and ABI XML tags for native networking tests." am: d01197426b am: 9c74b46ca4
am: 11e6eac115

Change-Id: I66b3b9e4d7048214dad73147195514485d928f92
2019-03-25 00:05:09 -07:00
Treehugger Robot
d01197426b Merge "Enable instant and ABI XML tags for native networking tests." 2019-03-25 06:31:59 +00:00
Lorenzo Colitti
f011d5f95b Enable instant and ABI XML tags for native networking tests.
These tests include native code so mark them as multi_abi. They
also pass in instant mode so mark them instant_app.

Fix: 123367032
Fix: 123367595
Test: atest CtsNativeNetDnsTestCases CtsNativeNetTestCases
Test: cts-tradefed run commandAndExit cts --enable-parameterized-modules --module-parameter instant_app -m CtsNativeNetDnsTestCases
Test: cts-tradefed run commandAndExit cts --enable-parameterized-modules --module-parameter instant_app -m CtsNativeNetTestCases
Change-Id: Id66705ecb012a07aa34318f41afb1840dd25b9e3
2019-03-25 13:41:38 +09:00
Junyu Lai
06db529877 Merge changes Ic19b3b64,I26ca370f am: c5ceda2354 am: f29182d403
am: 6188ebe70d

Change-Id: I7aa0abf2308ede2025bb8bfdf044fd37275f6afb
2019-03-24 19:30:34 -07:00