summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2020-07-06Merge "Refine validation metrics" into rvc-devRemi NGUYEN VAN
2020-07-06Merge "Injecting network validation stats into statsd" into rvc-devRemi NGUYEN VAN
2020-07-03Refine validation metricsRemi NGUYEN VAN
Rename members for a clearer API, and add try/catch blocks to each NetworkMonitor call to guarantee there will not be any crash. Add a flag allowing to disable all the metrics collection code. Bug: 151796056 Test: atest NetworkStackTests (see also test-only change) Change-Id: I06d6dccc57146b955b15cf36a2109c68a5355494
2020-07-03Merge "Update CapportData in CapportApiProbeResult to be nullable" into rvc-devChiachang Wang
2020-07-03Injecting network validation stats into statsdFrank Li
1. Fill in each field of the NetworkValidationReported 2. Write the NetworkValidationReported into statsd This patch also refactors tryCapportApiProbe to return null when the capport data is incorrect, instead of doing the check after calling the method. This makes it easier to compile capport API probe metrics. Test: atest NetworkStackIntegrationTests NetworkStackTests Test: atest FrameworksNetTests Test: Manual test with statsd_testdrive Bug: 151796056 Original-Change: https://android-review.googlesource.com/1295496 Merged-In: Icf34402d6a293cc76c32d00835cbf358c99a87fa Change-Id: Icf34402d6a293cc76c32d00835cbf358c99a87fa
2020-07-03Update CapportData in CapportApiProbeResult to be nullableChiachang Wang
If capport API does not send any valid rely, the capportData could be null in CapportApiProbeResult. Thus, take null capportData for invalid case. Bug: 154196512 Bug: 139034276 Bug: 151796056 Test: atest NetworkStackTests Merged-In: I99cbff2eb1a9ab87a42011038d911fe15e7344a4 Change-Id: I99cbff2eb1a9ab87a42011038d911fe15e7344a4
2020-07-01Merge "Use FLAG_IMMUTABLE on NetworkStackNotifier intents" into rvc-devRemi NGUYEN VAN
2020-07-01Apply jarjar rules to NetworkStaticLibTestsRemi NGUYEN VAN
Each test target in NetworkStackCoverageTests needs to have appropriate jarjar rules applied: this was not the case for NetworkStaticLibTests, even though jarjar rules are already applied in NetworkStackTests and NetworkStackIntegrationTests. NetworkStaticLib is used by multiple modules that are each supposed to jarjar it to their own package, so jarjar rules cannot be applied on the test target itself. Define an android library to apply the jarjar rules before including the tests into NetworkStaticLibTests. Bug: 152461494 Test: atest NetworkStackCoverageTests Change-Id: I2afebd0e0fbfde2ed8c9daa396077761db23409f
2020-06-30Use FLAG_IMMUTABLE on NetworkStackNotifier intentsRemi NGUYEN VAN
FLAG_UPDATE_CURRENT was not helpful because: - For the venue info notification, the only extra is the Network, and the intent uses the network handle as identifier; meaning that two matching intents would already have the same extra. - The ACTION_WIFI_SETTINGS intent does not have any extra, so there is nothing to update. Bug: 157475111 Test: atest NetworkStackTests; manual: connected to captive portals and used notifications Change-Id: Ifd9e6ff04f2d574f3e28d612c8ea6215a209069e
2020-06-24Fix NullPointerException on addErrorCode when input is Invalid error codeFrank Li
Problem: 1. When the errocode is not defined in DhcpErrorCode enum. Then the DhcpErrorCode.forNumber(errorCode) will return null. 2. Then use null as the parameter cause NullPointerException on addErrorCode. (Because the addErrorCode need nonNullable parameter) Solution: If the errorcode is not defined in the Dhcp ErrorCode enumeration, please use ET_UNKNOWN instead as AddErrorCode parameter, not null. Bug: 151796056 Test: atest Original-Change: https://android-review.googlesource.com/1346103 Merged-In: I43b8415ab98b4cf6520c3240dc544a9f62730a4e Change-Id: I43b8415ab98b4cf6520c3240dc544a9f62730a4e
2020-06-23Fix the mStopTimeNs not be reset in Stopwatch#RestartFrank Li
Bug: 151796056 Test: atest NetworkStackIntegrationTests NetworkStackTests Test: atest FrameworksNetTests Test: Manual test with statsd_testdrive Original-Change: https://android-review.googlesource.com/1343438 Merged-In: Ib83ceb70af3491dacbb4a45f65ef38661ae75e32 Change-Id: Ib83ceb70af3491dacbb4a45f65ef38661ae75e32
2020-06-23Merge "Injecting network ip provision stats into statsd" into rvc-devRemi NGUYEN VAN
2020-06-23Injecting network ip provision stats into statsdlifr
1. Fill in each field of the NetworkIpProvisioningReported 2. Write the NetworkIpProvisioningReported into statsd Bug: 151796056 Test: atest NetworkStackIntegrationTests NetworkStackTests Test: atest FrameworksNetTests Test: Manual test with statsd_testdrive Original-Change: https://android-review.googlesource.com/1313574 Merged-In: If4bc6af1b794a8620a08858d6cfd85e661865bd7 Change-Id: If4bc6af1b794a8620a08858d6cfd85e661865bd7
2020-06-22Merge "Test DataStallStatsUtils.write" into rvc-devChiachang Wang
2020-06-19Retry networkAddInterface on EBUSY errorCodeTreehugger Robot
If wifi and softAp shared with same interface and switching from wifi to sotAp, there is race that tethering fail to set LCAL_NETID to softAp interface because ConnectivityService do not release wifi netid from that interface yet. Bug: 158269544 Test: atest TetheringCoverageTests atest NetworkStackTests Merged-In: I1dcf0a64190106820a93854b2eb53040341a97e6 Change-Id: I1dcf0a64190106820a93854b2eb53040341a97e6
2020-06-19Merge "Move Inet[4]AddressUtils to libs/net" into rvc-devRemi NGUYEN VAN
2020-06-18Transition to appropriate state after all left addresses have been cleared.Treehugger Robot
State machine will transit to RunningState directly after clearing all left addresses even if the preconnection flag is enabled, that seems incorrect to skip PreconnectingState. Rely on the preconnection flag to determine which correct state should transit to. Bug: 159109671 Test: atest NetworkStackIntegrationTests NetworkStackTests Merged-In: I3d520a50f26ba7fac804c85c968013b2cb7cab91 Change-Id: I3d520a50f26ba7fac804c85c968013b2cb7cab91
2020-06-17Test DataStallStatsUtils.writeTreehugger Robot
Bug: 159103861 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: Idee17aa4ab83a89dab6decb274c74cbf24240bc1 Change-Id: Idee17aa4ab83a89dab6decb274c74cbf24240bc1
2020-06-12Move Inet[4]AddressUtils to libs/netRemi NGUYEN VAN
The classes should not be picked up from frameworks/base, as they are part of several mainline modules. Bug: 151052811 Test: m; manual: flashed, wifi and telephony working Test: atest NetworkStackCoverageTests Change-Id: I62da3419408b7eb71ea5319e8717fbb22c76a94e
2020-06-11Remove DhcpResults from NetworkStack shared libRemi NGUYEN VAN
Remove the dependency on DhcpResults in moduleutils by moving toStableParcelable to NetworkStack main code, and fromStableParcelable to the test only. Only NetworkStack should be generating DhcpResultsParcelables, and only the NetworkStack should be using DhcpResults at this point (eventually the class would move from frameworks/base/core to NetworkStack). Test: built, flashed, WiFi working Bug: 149403767 Original-Change: https://android-review.googlesource.com/1277444 Merged-In: I093fa48967a48f594b242b1e05e7d481fa9ee529 Change-Id: I093fa48967a48f594b242b1e05e7d481fa9ee529
2020-06-10Merge "Disable IPv6 stack when IPv6 provisioning is lost but IPv4 is still ↵TreeHugger Robot
alive." into rvc-dev
2020-06-09Disable IPv6 stack when IPv6 provisioning is lost but IPv4 is still alive.Treehugger Robot
When IPv6 provisioning loss happens due to the default route has gone, however, if IPv4 network is still provisioned, we can consider to disable IPv6 stack and still keep the current connection without disconnecting from wifi, applications will be able to reconnect over IPv4 network. Bug: 131781810 Test: atest NetworkStackTests NetworkStackNextTests Test: atest NetworkStackIntegrationTests Merged-In: I8f56a05b38c8387c91306c0dc2bdf4430ec3bd00 Change-Id: I8f56a05b38c8387c91306c0dc2bdf4430ec3bd00
2020-06-09Do not revalidate before network is readyRemi NGUYEN VAN
ConnectivityService sends notifyLinkPropertiesChanged before notifyNetworkConnected. When a captive portal URL is present, this causes NetworkMonitor to revalidate, even though the network is not ready to start validating (DNS servers have not been set yet in particular). ConnectivityService does this because the sending new LinkProperties to NetworkMonitor is part of the standard LinkProperties update flow; NetworkMonitor should be resilient to such behavior. Test: atest NetworkMonitorTest, manual (flashed, wifi working) Bug: 156697983 Original-Change: https://android-review.googlesource.com/1315220 Merged-In: I0619d37a3374726b77e162d174c5b12659db3bbb Change-Id: I0619d37a3374726b77e162d174c5b12659db3bbb
2020-06-05Add a SkipPresubmit annotationTreehugger Robot
The SkipPresubmit annotation allows tests to opt-out of presubmit (instead of opt-in as for @android.platform.test.annotations.Presubmit). Test: m Bug: 158153057 Original-Change: https://android-review.googlesource.com/1324131 Merged-In: Id013732057f9e8fc94be9dccba080a902d409842 Change-Id: Id013732057f9e8fc94be9dccba080a902d409842
2020-06-04Merge "Refactor out the IPv4-only provisioning result verification." into ↵TreeHugger Robot
rvc-dev
2020-06-03Merge "Fix venue info notification not displaying" into rvc-devRemi NGUYEN VAN
2020-06-02Add a null check to prevent NullPointerExceptionLucas Lin
TelephonyManager#getAllCellInfo() may return null, so before running the foreach loop, the null check is needed. Bug: 156567547 Test: atest NetworkStackTests:NetworkMonitorTest Change-Id: I925eefaffeadd87ef1b18204cbf82a9e63779a10 Merged-In: I5d5e98add0ea2abf92156c11188739c535e7e9a8 (cherry picked from commit 9d5cc53017e82505ec29cd2f17736a0dfdc3bb91)
2020-06-02Merge "Fallback if redirect url is not valid for captive portal login" into ↵Chiachang Wang
rvc-dev
2020-06-02Merge "Prevent race in NetworkMonitorTest" into rvc-devChiachang Wang
2020-06-02Fix venue info notification not displayingRemi NGUYEN VAN
The venue info notification was never displayed, because querying the notification channel from UserHandle.ALL returns no channel. Channels must be handled from the NetworkStack (owner) user, not the ALL user that is used to send notifications. Bug: 157203874 Test: atest NetworkStackTests; manual: verified showing or disabling the notification as owner or alternate user. Original-Change: https://android-review.googlesource.com/1321357 Merged-In: I9ce908cebdef81bb524353219f7ee9ead2487056 Change-Id: I9ce908cebdef81bb524353219f7ee9ead2487056
2020-06-01Refactor out the IPv4-only provisioning result verification.Xiao Ma
So far the provisioning verification is included inside handleDhcpPacket and follows DHCP handshake, which works for IPv4-only provisioning, but when IPv6 stack is also enabled in some tests, then IPv6 link-local address will be configured automatically when interface is up. Refactor out the IPv4 provisioning function, then it's flexible to verify something else we are interested in (e.g. IPv6 link-local, privacy addresses). Bug: 131781810 Test: atest NetworkStackIntegrationTests NetworkStackNextIntegrationTests Merged-In: I7f5aba2d19de9bdbd0962bc3268d51c19112d9d2 Change-Id: I7f5aba2d19de9bdbd0962bc3268d51c19112d9d2
2020-06-01Only allow HTTP capport URLs on test networksRemi NGUYEN VAN
HTTP URLs on localhost for the capport API should only be accepted on networks with TRANSPORT_TEST. This change also introduces the first changes to fix thread safety issues in NetworkMonitor, where LinkProperties or NetworkCapabilities are read from the evaluation thread, even though they are updated from the StateMachine thread. The EvaluationThreadDeps class should be augmented in later changes to hold thread-safe copies of what the evaluation thread needs. Bug: 156062304 Bug: 155455470 Test: atest NetworkMonitorTest Original-Change: https://android-review.googlesource.com/1315226 Merged-In: I65bb54c581965159b99d7ac8596304ceb6b5f2cb Change-Id: I65bb54c581965159b99d7ac8596304ceb6b5f2cb
2020-06-01Allow localhost HTTP URLs for the capport APIRemi NGUYEN VAN
Allowing the capport API to be hosted on localhost makes it easy to write fast, stable tests for the feature. This was not possible because: - Pre-validation of the URL used Patterns.WEB_URL, which is over-restrictive and excludes domain names without TLD - NetworkMonitor needs the API to be hosted via HTTPS which is working as intended, however relaxing this requirement only for localhost (for testing) seems reasonable. Bug: 156062304 Test: atest CaptivePortalApiTest in associated change Original-Change: https://android-review.googlesource.com/1309235 Merged-In: I5f2cdd02376785b152e5b9a6e798d797894ea45b Change-Id: I5f2cdd02376785b152e5b9a6e798d797894ea45b
2020-06-01Fallback if redirect url is not valid for captive portal loginChiachang Wang
Wifi AP may send a relative URL or other invalid URL if any network issue or configuration issue happen. In this kind of case, sending a redirect url to captive portal app will fail to open the login page. Thus, fallback to send detection url if the redirect url is a malformed URL. Bug: 157433005 Test: atest NetworkStackTest Merged-In: I6126f5aeb4709a09ec249947b5e59f1310ec7a4b Change-Id: I6126f5aeb4709a09ec249947b5e59f1310ec7a4b
2020-05-29Implement delete methodsChalard Jean
Test: New tests in this patch, IpMemoryStore*Tests Bug: 146460486 Change-Id: Ibda8eeb917c05876e06e78ae600acd626ca94749 Merged-In: I8680164cf34bae2fac1f5431c03a3369dd6318ab (cherry picked from commit 4f81f357bce66c9fca13242d83267ae89cd43f1d, aosp/1311637)
2020-05-29Add utilities to filter packetRemi NGUYEN VAN
The utilities makes it easier to do simple matching of packets received as byte arrays. This is useful for tests operating on tap interfaces. Test: tests based on this utility Bug: 156062304 Original-Change: https://android-review.googlesource.com/1309234 Merged-In: Ie648c4aee1eae94ae01e3e29234fb432b35c108e Change-Id: Ie648c4aee1eae94ae01e3e29234fb432b35c108e
2020-05-29Prevent race in NetworkMonitorTestChiachang Wang
Move setupTcpDataStall to do before preparing test NM. Bug: 157612829 Test: atest com.android.server.connectivity.NetworkMonitorTest\ #testDataStall_StallTcpSuspectedAndSendMetricsOnWifi\ --iterations 30 Change-Id: I764a97b1007613e7d1c19ec6294faac27bea1fef Merged-In: I764a97b1007613e7d1c19ec6294faac27bea1fef
2020-05-29Rename groupHint to cluster.Chalard Jean
Bug: 146460486 Test: atest android.net.IpMemoryStoreTest Test: atest com.android.server.connectivity.ipmemorystore.IpMemoryStoreServiceTest Change-Id: I493472cb65262b04769192b702178351416c9869 Merged-In: I805733e201aa1286477cfac589cdf4ac18bb7e2b (cherry-picked from aosp/1311636)
2020-05-28Merge "Enable DHCP INIT-REBOOT state on R." into rvc-devXiao Ma
2020-05-27Merge "add TCP data stall metrics" into rvc-devChiachang Wang
2020-05-26Merge "Add an eventuallyExpect call that returns null" into rvc-devTreeHugger Robot
2020-05-26Merge "Fix flakes in testMultipleProbes" into rvc-devRemi NGUYEN VAN
2020-05-25Add an eventuallyExpect call that returns nullChalard Jean
Test: GtsNetworkStackHostTestCases Bug: 157284669 Change-Id: Ieba523cd6cebce5f5e6d2fd8b9acd28228403540
2020-05-25Enable DHCP INIT-REBOOT state on R.Xiao Ma
Bug: 156575243 Test: atest NetworkStackTests NetworkStackIntegrationTests Test: atest NetworkStackNextIntegrationTests Test: manual test: 1. connect to AP successfully at the first time 2. disconnect wifi 3. reconnect to the same AP 4. checked client broadcasts REQUEST instead of DISCOVER 5. checked client broadcasts DISCOVER if lease has expired Merged-In: I62d1ab6b94be1ee95fbaa2ecce62eaba01e7892d Change-Id: I62d1ab6b94be1ee95fbaa2ecce62eaba01e7892d
2020-05-25Merge "Mock IpConnectivityLog in IpClientTest" into rvc-devMark Chien
2020-05-25Merge "Support MirrorLink DHCPDECLINE." into rvc-devXiao Ma
2020-05-25Mock IpConnectivityLog in IpClientTestmarkchien
IpConnectivityLog which is used to send metrics need NETWORK_STACK permission. Mock IpConnectivityLog to avoid sending metrics from tests. Also remove platform cert from the network stack unit test because it is not necessary for any signature permission anymore. Bug: 156866746 Test: NetworkStackNextTests, NetworkStackCoverageTests, TetheringTests, TetheringCoverageTests Change-Id: Ibff052b30e000de3c5a08d7265c7642d67d9b0d0
2020-05-25Merge "Avoid rely on NETWORK_STACK permission for InetDiagSocketTest" into ↵Mark Chien
rvc-dev
2020-05-25Avoid rely on NETWORK_STACK permission for InetDiagSocketTestmarkchien
ConnectivityManager#getConnectionOwnerUid required NETWORK_STACK permission. Move related tests from InetDiagSocketTest(unit test) to InetDiagSocketIntegrationTest. The test is an integration test and not a unit test, as its purpose is to exercise the getConnectionOwnerUid platform API. Since network stack unit test is shared with TetheringCoverageTests, this is part of work to avoid rely on platform cert for TetheringCoverageTests. Bug: 156866746 Test: TetheringCoverageTest, NetworkStackNextTests, NetworkStackCoverageTests Change-Id: Ic38852839ead951972daa24f27ac95376787a72c
2020-05-25Merge "Remove unused permission from NetworkStackTests" into rvc-devTreeHugger Robot