summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2020-04-23Ensure that the NAT64 prefix is removed when its lifetime expires.Lorenzo Colitti
Bug: 153694684 Test: new test coverage in IpClientIntegrationTest Change-Id: Ie207940d79abbc0d92dd15becee867e72f171786
2020-04-22Fix an issue in TrackRecord.Treehugger Robot
TrackRecord<T> implements List<T> but also has an add(T) method which conflicts with List<T>#add as it has a different return type. As nobody is using the return value of this now, use the signature of List<T>#add to remove the problem. Bug: 153613718 Test: NetworkStackTests FrameworksNetTests Merged-In: Ie9eb4d7158e9583d4052e86f87062e3032b023e3 Change-Id: Ie9eb4d7158e9583d4052e86f87062e3032b023e3
2020-04-21Fix NetworkStackCoverageTests on QRemi NGUYEN VAN
Fix regressions in the coverage tests when run on a Q device: - Do not attempt to verify CaptivePortalData in IpClientIntegrationTest on Q, since it cannot be set considering that the class does not exist on Q. - Replace HexEncoding.encodeToString(byte[], boolean) with HexEncoding.encodeToString(byte[]) in StructNdOptPref64Test. - Skip ModuleNetworkStackClientTest using DevSdkIgnoreRule instead of assumeTrue() in setUp, as the latter would still run tearDown(). - Ignore NetworkStatsUtilsTest: this is a unit test for a test utility, and that utility uses R APIs (so can only be used in R-only tests). - Lazy-initialize LinkProperties with capport attributes in NetworkStackNotifierTest as initializing at class creation would crash. - Manually create a INetworkMonitorCallbacks mock in NetworkMonitorTest, create capport LinkProperties on demand, and skip capport tests that cannot run on Q. Test: atest NetworkStackCoverageTests Bug: 152723363 Merged-In: I3ae98e24a542c6313e06bcc787ad5a0a2a1db723 Change-Id: I3ae98e24a542c6313e06bcc787ad5a0a2a1db723
2020-04-20Get the l2key and grouphint from the initial provisioning configuration.Xiao Ma
The purpose of processing CMD_UPDATE_L2INFO command in the Stopped State is just to update the initial l2key and grouphint which are used when starting DhcpClient (e.g. for INIT-REBOOT). We can get both of l2key and groupHint from the initial prov configuration parcelable instead, then be able to delete CMD_UPDATE_L2INFO from the StoppedState. Bug: 154441742 Test: atest FrameworksNetTests NetworkStackTests Test: atest NetworkStackIntegrationTests Change-Id: I760957017b18975be969a2f519ec09ee4495ebad
2020-04-20Merge "Listen for pref64 RA attributes in IpClientLinkObserver." into rvc-devLorenzo Colitti
2020-04-20Listen for pref64 RA attributes in IpClientLinkObserver.Lorenzo Colitti
This allows IpClient to parse the pref64 RA option and put it in the LinkProperties to be sent to ConnectivityService. IpClientLinkObserver is a natural place for this because it is the part of IpClient that is already tasked with receiving netlink events and storing the results in IpClient's LinkProperties. Instead of using the path used by most attributes, which are parsed by NetlinkHandler, converted to a string array, then re-parsed and sent over binder call to the networkstack, simply open a netlink socket in the networkstack process and read the netlink messages from there. In the future, we can build on this to parse other netlink messages (e.g., IP addresses, routes, RDNSS, etc.) in the networkstack and entirely remove the dependency on netd's NetlinkHandler, which is crufty, hard to extend, and does not support interface indices. This means that the pref64 attribute will not be ordered with respect to other netlink events. This is acceptable because the pref64 attribute does not need to be ordered with any other information and its presence or absence does not cause provisioning to succeed or fail. Today the pref64 is learned through an entirely different codepath (DNS lookups) and that is not ordered in any way either. This CL does not change the threading model: the netlink updates are processed on the handler thread like all the other updates seen by IpClientLinkObserver, and all access to mLinkProperties is synchronized (this). This synchronization is no longer necessary because everything is on the handler thread anyway, but that will be cleaned up in a future CL. Because netlink events contain interface indices, but IpClient and netd deal with interface names, IpClientLinkObserver must be told what the interface index is. This is done when startProvisioning is called, because that is when IpClient fetches the interface parameters including the MAC address and interface index. It cannot be done when IpClientLinkObserver is started, because at that time the interface might not exist, or might exist with a previous interface index. The interface index is cleared when IpClient enters the stopped state and the LinkProperties are cleared. Bug: 153694684 Test: atest NetworkStackNextIntegrationTests:IpClientIntegrationTest#testPref64Option --iterations 100 Change-Id: I3f8d2fbf2e203c6f90029947fa55b5e0b3b06d94
2020-04-20Merge "Refine NetworkMonitorTest#testReadAsString_StreamShorterThanLimit()" ↵Lucas Lin
into rvc-dev
2020-04-18Support constructing a StructNdOptPref64 from data.Lorenzo Colitti
This is mostly useful in tests at the moment. Also address a review comment from a previous CL. Bug: 152723363 Test: atest NetworkStackTests:NduseroptMessageTest NetworkStackTests:StructNdOptPref64Test Merged-In: I29c3967200e1353972503739b9ba4d1194ce162b Change-Id: I29c3967200e1353972503739b9ba4d1194ce162b
2020-04-18Merge "Make IpClientIntegrationTest pass on rvc-dev." into rvc-devLorenzo Colitti
2020-04-18Support serializing a StructNdOptPref64 to a ByteBuffer.Lorenzo Colitti
Bug: 153694684 Test: new unit tests Merged-In: I82a3239a532fe4141627d146f9d47ba99d1622dd Change-Id: I82a3239a532fe4141627d146f9d47ba99d1622dd
2020-04-18Make IpClientIntegrationTest pass on rvc-dev.Lorenzo Colitti
On rvc-dev, IpClientIntegrationTest fails almost all the time because the tap interface disappears before the tests can run. This is due to the ParcelFileDescriptor finalizer, which helpfully closes the fd stored in the object even if it is in use elsewhere. Stash the ParcelFileDescriptor itself in the test class, instead of the actual FileDescriptor which everything uses, in order to ensure that the garbage collector does not finalize it. With this change, IpClientIntegrationTest#testRaRdnss (just an arbitrary test case in that class) goes from 10/10 failures to 10/10 passes. Bug: 152723363 Test: atest NetworkStackNextIntegrationTests:IpClientIntegrationTest#testRaRdnss Merged-In: I1015e7893ba6af74876665826960e8fcc1711476 Change-Id: I1015e7893ba6af74876665826960e8fcc1711476
2020-04-17Refine NetworkMonitorTest#testReadAsString_StreamShorterThanLimit()Lucas Lin
The characters of string may not only contain ASCII characters, so the length of string may not the same as bytes. Replace the string to byte[]. Bug: 154217644 Test: atest NetworkStackTests:NetworkMonitorTest Change-Id: I3c1f826ef1be0302fdb19c294087464af8573105 Merged-In: I6552a6c8a291d54fc16bd3a1df3ab29a4481b20d (cherry picked from commit 57096958ca18bf26ea8bbc7b2fb48619a1756097)
2020-04-17Fix parsing a NduseroptMessage inside a NetlinkMessage.Treehugger Robot
The parsing code inside NduseroptMessage assumed that the message started at the beginning of the buffer. Fix this, and also restore the original endianness and limit of the buffer after parsing. Add tests for this, and make the existing tests a bit more readable. Bug: 153694684 Test: new unit tests Merged-In: Id0b4dc18dd219b4d35846e161022a37c8de3e3bb Change-Id: Id0b4dc18dd219b4d35846e161022a37c8de3e3bb
2020-04-17Merge "Add a new field changePrefixOnDecline in DhcpServingParamsParcel." ↵TreeHugger Robot
into rvc-dev
2020-04-17Merge "Renew previous IP address when roaming happens in certain specific ↵TreeHugger Robot
Wi-Fi networks." into rvc-dev
2020-04-16[MP06] Add test to test multiple probe codeChiachang Wang
Bug: 139034276 Test: atest NetworkStackTests NetworkStackNextTests Change-Id: I4fdff4d13b85a45642774befed16e4948433d35b Merged-In: I4fdff4d13b85a45642774befed16e4948433d35b (cherry picked from commit 7f6885c48a4c6df0f82ab50fa150b347499b333e)
2020-04-16[MP04] Allow to run multiple HTTP and HTTPS probes in parallelChiachang Wang
In certain area, there is no single server that works well. It may result in the validation result varied. Thus, allow device manufacturers to configure these URLs to get expected network status. Bug: 139034276 Test: atest NetworkStackTests NetworkStackNextTests Test: manually test with resource configuration Change-Id: I5327db39b22bf9393e7a397e8f4de786075c841e Merged-In: I5327db39b22bf9393e7a397e8f4de786075c841e (cherry picked from commit 9ce129a8079cf0b0dc1b744738fc7b41fbd40bad)
2020-04-16Renew previous IP address when roaming happens in certain specific Wi-Fi ↵Xiao Ma
networks. Bug: 131797393 Test: atest NetworkStackTests NetworkStackIntegrationTests Test: atest FrameworksNetTests Merged-In: I65ebdd142a2bb402035c63cd282bc2574ddf3d8d Change-Id: I65ebdd142a2bb402035c63cd282bc2574ddf3d8d
2020-04-16Add a new field changePrefixOnDecline in DhcpServingParamsParcel.Xiao Ma
A new boolean flag (changePrefixOnDecline) to be added in the DhcpServingParamsParcel, indicating whether or not the DHCP server should request a new prefix (e.g. a different subnet prefix) from IpServer when receiving DHCPDECLINE message. Bug: 130741856 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: I8cb0f844ef98a5f17d4e07e1812a1abf73aa4c07 Change-Id: I8cb0f844ef98a5f17d4e07e1812a1abf73aa4c07
2020-04-16Merge "Support parsing ND option messages." into rvc-devLorenzo Colitti
2020-04-16Merge "Support decoding the new PREF64 RA option." into rvc-devLorenzo Colitti
2020-04-16Make a customized context when matching a record in MccMncOverrideInfoLucas Lin
MccMncOverrideInfo records the customized carrier id, visited mccmnc, home mccmnc. Once the carrier id and sim's mccmnc are matching a record in MccMncOverrideInfo, make a customized context by changing the mcc/mnc of configuration. Bug: 147075795 Test: atest NetworkStackTests:NetworkMonitorTest Change-Id: I75924f60c637eb93ac99b14b333608b6faeaa24a Merged-In: I20f3c291015a0a79d88e923438d39ff90e1f0752 (cherry picked from commit 6d0b27f8cb8f96eb427609eb03ff6e1a1d490771)
2020-04-16Support parsing ND option messages.Lorenzo Colitti
Define a new StructNduseroptmsg class that is a rough equivalent of the "struct nduseroptmsg" used to pass RA options from the kernel to userspace. Also define a new NdOption class and make the existing pref64 option subclass it. Bug: 153694684 Test: new unit tests Change-Id: I3b71e63ee2cdaa40d095e889188943c5b0cd13af Merged-In: I3b71e63ee2cdaa40d095e889188943c5b0cd13af (cherry picked from commit 48d23146bf3e6e272538f120f1d4af0fef441710)
2020-04-16Support decoding the new PREF64 RA option.Lorenzo Colitti
Bug: 153694684 Test: new unit tests Merged-In: I94346939cda910b01ffee75cf8b62a23ec5314cc Change-Id: I94346939cda910b01ffee75cf8b62a23ec5314cc
2020-04-15Merge "[SP27.2] Rename TestableNetworkStatsProvider" into rvc-devJunyu Lai
2020-04-15[MP03] Refactor probing classChiachang Wang
Refactor probing class to allow sending probe via thread class in legacy send parallel probes function and also refactor for follow up commit to send multiple probes. Bug: 139034276 Test: atest NetworkStackTests NetworkStackNextTests Test: manually test with resource configuration Change-Id: Ia25bfe58b10b0a1a641a2be535ee0d602ffd8cd6 Merged-In: Ia25bfe58b10b0a1a641a2be535ee0d602ffd8cd6 (cherry picked from commit c17b3996f428ac80a2f8b2c4f361b0e18b0b50fa)
2020-04-14Add visibility for TetheringCoverageTestsPaul Hu
1. NetworkStackTestsLib can be visible to TetheringCoverageTests 2. NetworkStackJarJarRules can be visible to TetheringIntegrationTestsDefaults 3. Remove uncessary lib "libartbase" because it's not visible to TetheringCoverageTests. Bug: 148636687 Test: atest NetworkStackTests atest TetheringCoverageTests Change-Id: I0e0d597a968f99f4a99c3d7ab014af4e144ab40f Merged-In: I0e0d597a968f99f4a99c3d7ab014af4e144ab40f (cherry picked from commit 7a95e2e5e9cffbf7cdb67d75306c6bfd2ebc4663)
2020-04-13Add a test runner to ignore tests on old SDKsChalard Jean
Generally DevSdkIgnoreRule should be used for that purpose (using rules is preferable over replacing the test runner), however JUnit runners inspect all methods in the test class before processing test rules. This may cause issues if the test methods are referencing classes that do not exist on the SDK of the device the test is run on. Test: tests in change Iddd00e1c85abe767b1a41a1761d3266ba322dba6 Bug: 150918852 Merged-In: Ia8df394ed65fad3a3333da32c868c4623975ff79 (cherry picked from commit 1d2d5731c2ac4a23904f6093ac0f2a1bf0c11985, aosp/1281921) Change-Id: Iedc8d1f93254146baef61b34b965a89fee1b4c57
2020-04-11Merge "Add assertContainsStringsExactly to MiscAsserts" into rvc-devTreeHugger Robot
2020-04-10Merge "Support specific client address configuration" into rvc-devMark Chien
2020-04-10Refine DNS private IP probesRemi NGUYEN VAN
This addresses comments on the parent change that introduced the optional feature. This change also considers IPv6 ULAs as private addresses, corrects some style and comments. Bug: 136734947 Test: atest NetworkStackTests:NetworkMonitorTest \ NetworkStackTests:NetworkStackUtilsTest Change-Id: I1169320f3a5c09631e754518c60acab337faf49b Merged-In: If4231804b77143b78f26a32c16db53fc4ac44cd8 (cherry picked from commit 0f62e8c6d21afd28280dbae7c3ea216097def466, aosp/1282802)
2020-04-10Support specific client address configurationTreehugger Robot
If specific config "clientAddr" is set, the DHCP server will only offer "clientAddr". This is for peer-to-peer use case. If there are multiple clients for which "clientAddr" is already in use, dhcp server will not offer other addresses to clients. Bug: 141256482 Test: manual atest NetworkStackNextTests Merged-In: I96bc24a9c30bfc48dff38c3c4456085694fd381c Change-Id: I96bc24a9c30bfc48dff38c3c4456085694fd381c
2020-04-10Matches the URL content by regular expressionlucaslin
This patch provides a way to configure the regular expression which is used for matching the URL content. Once the result is matching, then NetworkMonitor will treat the validation result as fail or success. Bug: 141406258 Test: 1. Build pass 2. atest NetworkStackTests Merged-In: I77747b34fad895565d42ea4c017759c256d61489 Change-Id: I77747b34fad895565d42ea4c017759c256d61489
2020-04-10Do not detect portals when DNS returns private IPsRemi NGUYEN VAN
When access points return private IPs (as defined in the NetworkMonitor constant) in response to DNS probes, do not consider the access point as behind a portal, but instead indicate that it has no connectivity. This solves issues with some access points that return private IP responses to DNS queries when they do not have internet access. This feature is turned off by default while investigating its impact. OEMs can force-enable it through a resource overlay: config_force_dns_probe_private_ip_not_portal. Metrics to evaluate the feature will be added in a later change. Bug: 136734947 Test: atest NetworkStackTests Merged-In: I51975e18f424e3b7265011000f073777f376e597 Change-Id: I51975e18f424e3b7265011000f073777f376e597
2020-04-08[SP27.2] Rename TestableNetworkStatsProviderjunyulai
Currently, TestableNetworkStatsProvider is a subclass of INetworkStatsProvider. This is not very accurate naming after API council review feedback since now we have NetworkStatsProvider as a system api interface. Thus, this change rename it to TestableNetworkStatsProviderBinder and create another TestableNetworkStatsProvider to support subsequent test of NetworkStatsProvider. Test: atest FrameworksNetTests TetheringTests Bug: 150643374 Change-Id: I6c359dc718c24c384b827a465980b1c1c24075a0
2020-04-07Merge "Add bssid field in the ScanResultInfo class." into rvc-devXiao Ma
2020-04-07Add tests for IpReachabilityMonitorRemi NGUYEN VAN
The first tests just verify that provisioning is lost if all IPv4/6 DNS servers or gateways are lost. Test: atest NetworkStackTests Bug: 152819907 Merged-In: I8da6a8f4f237ce963c0a1610432d310160fd3f20 Change-Id: I8da6a8f4f237ce963c0a1610432d310160fd3f20
2020-04-07Add bssid field in the ScanResultInfo class.Xiao Ma
This change adds a new filed: bssid in the ScanResultInfo class which are encapsulated by WiFi when connecting to AP successfully, using current connected AP's bssid as a hint to determine whether L2 roaming happened or not. Also adding @NonNull annotation for fields, methods and constructor params. Bug: 131797393 Test: atest NetworkStackIntegrationTests NetworkStackTests Test: atest FrameworksNetTests Change-Id: Ia11f1954124f45f9586495f6be7fb7fb3430ae97
2020-04-07Rename IDhcpLeaseCallbacks to IDhcpEventCallbacks for more generic.Xiao Ma
This change renames IDhcpLeaseCallbacks, easier to expand in the future and adds a new method onNewPrefixRequest which will be called on DHCP server receives DHCPDECLINE message and request a new IPv4 prefix from IpServer. Bug: 130741856 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: Ia7b08bb1e7feda08ffe9fbb8885dbc8b7bdd66c9 Change-Id: Ia7b08bb1e7feda08ffe9fbb8885dbc8b7bdd66c9
2020-04-06Add assertContainsStringsExactly to MiscAssertschenbruce
Bug: 143732914 Test: atest NetworkStackNextTests Change-Id: I9667be7fbc5b3b0cc462421e3dcda9cbe9660b48
2020-04-06[SP26.1] Add assert function for parceling NetworkStatsJunyu Lai
In ParcelUtils there are methods that help to verify parceling correctness. However, they can only be applied to objects which implement equals. For NetworkStats, equals are not overrided due to performace might be impacted if everyone use it. Hence specfic function to verify parceling correectness is needed. Test: atest NetworkStatsApiTest NetworkStackTests Bug: 150644692 Change-Id: I48aa73117bc7db981ffaef5365f96e46d431bd6e Merged-In: I48aa73117bc7db981ffaef5365f96e46d431bd6e
2020-04-03Merge "Getting interface params in ClearingIpAddressState#enter." into rvc-devTreeHugger Robot
2020-04-03Merge "Add ignore class parameters to DevSdkIgnoreRule" into rvc-devRemi NGUYEN VAN
2020-04-03Test that DhcpClient sets the server address in LinkProperties.Lorenzo Colitti
This test should only run on R and above because the DHCP server was added to LinkProperties in R. Bug: 134098566 Test: test-only change Merged-In: Ic99c913f34ecfaca0645c56478d7de75eb176da1 Change-Id: I1162d9d9fd47ffe6d48e962ee7d3b7dbcba93767
2020-04-03Getting interface params in ClearingIpAddressState#enter.Xiao Ma
In case of wifi might stop IpClient and then restart prov immediately to avoid wifi disconnection especially when roaming happens, this might cause getting interface params with incorrect interface mtu when starting provisioning again before interface mtu hasn't been restored. Moving getting interface params to ClearingIpAddressState#enter ensures that interface parameters are fetched on the handler thread so they are properly ordered with other events, such as restoring the interface MTU on teardown. Bug: 152169857 Test: atest NetworkStackIntegrationTests NetworkStackTests Merged-In: Ifd06b8d18ce570b1aa424ad215111c80f094ca97 (cherry picked from commit a6aba532103a3258d09e6931106d6fb05368c130) Change-Id: I0c8c1ed1646ab12bc30da2b7f8e5819d2d9495ba
2020-04-02Add ignore class parameters to DevSdkIgnoreRuleRemi NGUYEN VAN
The parameters are useful to avoid annotating every method in a class with @IgnoreAfter / @IgnoreUpTo. Test: Tests using this class Bug: 150918852 Merged-In: Ic17e7a253c7f3a86011298e177e76b53c966a47b Change-Id: Ic17e7a253c7f3a86011298e177e76b53c966a47b
2020-04-01Correct tests for verifying data stall metricsChiachang Wang
NetworkMonitor sends data stall metrics data via static method. The DataStallStatsUtils object from its constructor is never used. Tests in NetworkMonitorTest that verify the interaction with the mock object are incorrect. Bug: 152374582 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: I308344a80deef6aaf3ed4fb57723f2f210b30483 Change-Id: I308344a80deef6aaf3ed4fb57723f2f210b30483
2020-03-26Add TestNetworkTracker to test utils.Remi NGUYEN VAN
The tracker allows easily creating valid Network objects that are based on test (TUN) interfaces. It is taken from GTS NetworkStack test code and adapted to Kotlin. Test: tests based on this class (e.g. CaptivePortalLoginTests) Bug: 131401028 Merged-In: I6f8d1e36670c46ebcbca01e0a64ce579bcdcc1f9 Change-Id: I6f8d1e36670c46ebcbca01e0a64ce579bcdcc1f9
2020-03-25Move TapPacketReader into its own utility class.Automerger Merge Worker
This class is generally useful for tests that manipulate packets using a TestNetworkInterface. It will be used in upcoming tethering tests. Also make it take a FileDescriptor instead of a ParcelFileDescriptor, since that is more generally more useful. As part of this change, create a filegroup of files that the test utilities can depend on. Bug: 150644681 Test: atest NetworkStackIntegrationTests:IpClientIntegrationTest Change-Id: I73e9c1919956aa665a8cccec11d3444e486426ec Merged-In: I73e9c1919956aa665a8cccec11d3444e486426ec (cherry picked from commit f5e20cdc22dd017adec10efff5346ddf67628230)
2020-03-24Add test to verify make urls configurationChiachang Wang
Follow up from the commit(ChangeId: I66141e4bdc71d19e766aeec6ca33db8e1cb737fe) Bug: 152178565 Test: atest NetworkStackTests NetworkStackNextTests Change-Id: Ib9c25b43a52963e4222de8152c47c9eb26227e65 Merged-In: Ib9c25b43a52963e4222de8152c47c9eb26227e65 (cherry picked from commit 6e30cd8bbaea529bc1661f68a605c9a17476678b) (Clean cherry-pick from internal master)