Commit Graph

1238 Commits

Author SHA1 Message Date
Xiao Ma
4f4036d085 Merge "Add StructNdOptRdnss class to parse RDNSS option from netlink message." 2021-09-07 03:28:25 +00:00
Mark Chien
5c934df677 Merge "Add initTestNetwork with a list of LinkAddress" am: e0920f08f2
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1810276

Change-Id: I4334c9b01ca1ddf0ce640f1272c6d67f3f6f6020
2021-08-31 08:42:21 +00:00
Mark Chien
5f80e1d036 Merge "Add initTestNetwork with a list of LinkAddress" 2021-08-31 08:23:28 +00:00
markchien
14f746c07a Add initTestNetwork with a list of LinkAddress
To support setup test network with both ipv4 and ipv6. Add overloading
function for initTestNetwork to allow specify mutiple addresses.

Also allow to get TestNetworkInterface from this test network, so the
caller can use it to send and write packets.

Test: atest EthernetTetheringTest
Change-Id: Ic7626582c021dee824f95900e4de8efee861a9ea
2021-08-31 07:42:45 +00:00
Xiao Ma
4d6cafb5ca Parse ND options in netlink message as an ByteBuffer slice.
Parsing ND options as an ByteBuffer slice provides more reliable way to
read raw data from buffer no matter of the option might be malformed,
truncated or options with correct length and value, which doesn't affect
the buffer pointer advances to deal with the remaining data such as
attribute fields even if parsing ND options return null.

Bug: 163492391
Test: atest NetworkStaticLibsTest
Change-Id: Ic348abe6b5d1ceddfde47f19dcaec324927798d1
2021-08-31 02:06:13 +00:00
Xiao Ma
3fe08ae626 Add StructNdOptRdnss class to parse RDNSS option from netlink message.
Bug: 163492391
Test: atest NetworkStaticlibTests
Change-Id: I64059ce3576a3ce9467bd89a9dfcfc7b0498726d
2021-08-31 02:04:20 +00:00
Hungming Chen
f425e08a9e Test CollectionUtils.contains am: 536d685650
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1809998

Change-Id: I87edc84b13db381c364e63c9251fa4a5700876a4
2021-08-30 01:21:42 +00:00
Hungming Chen
5318137ac0 Refactor CollectionUtils.contains for short am: 0a51a235b5
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1810278

Change-Id: I2ade3e9986f1fb02f1f210e5203bd05bb74f020b
2021-08-30 01:21:40 +00:00
Hungming Chen
8ce72e2518 Test CollectionUtils.contains
Test: atest NetworkStaticLibTests
Change-Id: I5a4426001a4ff7c4ca65be92085e9af3a21267e5
2021-08-27 17:38:18 +08:00
Hungming Chen
0ab5f70868 Refactor CollectionUtils.contains for short
Keep the consistent style as CollectionUtils.contains for int because
the compiler already does the optimization.

Test: atest NetworkStaticLibTests
Change-Id: Ide49c3761c552e8e184889a2f8d9f1aa8a130d60
2021-08-27 17:38:05 +08:00
Treehugger Robot
14eb0f3d6a Merge "Add CollectionUtils.contains for short" am: 35570f4599
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1802483

Change-Id: Ib6e05a150e1d72b6c740520c6100935905f8769a
2021-08-27 05:02:15 +00:00
Treehugger Robot
e2ac496990 Merge "Add CollectionUtils.contains for short" 2021-08-27 04:47:38 +00:00
Hungming Chen
ee9a1bad35 Add CollectionUtils.contains for short
Test: atest NetworkStaticLibTests
Change-Id: I0ed29cc5dad20a3c52df8e1643aed65f6b2f50c7
2021-08-24 15:36:16 +08:00
Xin Li
ff5da50661 Merge "Merge sc-dev-plus-aosp-without-vendor@7634622" into stage-aosp-master 2021-08-17 18:14:27 +00:00
Remi NGUYEN VAN
843740592c Add the ConnectivityModuleTest annotation
The annotation will be used to mark tests cases that are part of MTS
modules used by multiple modules, to indicate that the test case should
only be run if the MTS suite should cover an updated Connectivity
(tethering) module.

This allows tests to verify new behavior in the Connectivity module,
without failing if that module is not updated.

Bug: 196755836
Test: mts-tradefed run mts-network with exclude-annotation in the config
Change-Id: I05d2200c7ab68042e4e48029e045f164c26b8037
2021-08-16 18:09:41 +09:00
Xin Li
48d2ff347e Merge sc-dev-plus-aosp-without-vendor@7634622
Merged-In: I27c720422d9dce022639dd1ca8463076fc22f135
Change-Id: I93a4188c21bab64d778578dc2d2fbfd6690db757
2021-08-14 06:31:18 +00:00
Nate Jiang
3be7e9b370 Remove NetUtils from filegroup to avoid dulicate
As framework-wifi already include NetUtils by
net-utils-framework-wifi-common-srcs, remove this from
net-utils-wifi-service-common-srcs to avoid Duplicated class in Wifi
Apex

Bug: 195965491
Test: build module
Change-Id: Id8b1c76f6120c02c93225f0b25970b217d88c295
2021-08-11 00:09:16 -07:00
Xiao Ma
8580cd8785 Append link-layer address parameter in makeNewNeighborMessage. am: e26cd34b8a am: e65d03c433
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1788967

Change-Id: I27c720422d9dce022639dd1ca8463076fc22f135
2021-08-06 16:47:42 +00:00
Xiao Ma
da2904c7d1 Append link-layer address parameter in makeNewNeighborMessage.
Append link-layer address parameter in makeNewNeighMessage, the caller
can assign different link-layer address as netlink attributes, which is
helpful for testing and simulating the case although the neighbor is
still reachable, the link-layer address has changed. If no special link
layer address is assigned, just use the default constant MAC address.

Bug: 162944199
Test: atest NetworkStaticLibsTest NetworkStackTests
Change-Id: I49de035075fa97655358be0089f0fbee293823a0
2021-08-06 13:36:07 +00:00
Xiao Ma
049b884c90 Migrate netlink-client to net-utils-device-common-netlink. am: a5abbe6529 am: 3818589c93
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1755889

Change-Id: Ia1a45efa17b46d2787e7385d6fb3e1e4648060fa
2021-08-04 07:56:23 +00:00
Xiao Ma
57b3442c65 Migrate netlink-client to net-utils-device-common-netlink.
Move netlink stuff to frameworks/libs/net/common/device, and build the
source files as an individual libraray. NetworkStack module just depends
on the net-utils-device-common-netlink.

Besides, also fix the incorrect format detected by checkstyle_hook script
such as missing java doc and make some public function as private, rename
the variable and etc.

Bug: 192535368
Test: atest NetworkStaticlibTests
Change-Id: I00e7f30be1bc9ebc2e24d7cd53efc403d6ba3daa
2021-07-29 03:52:09 +00:00
Treehugger Robot
65c85f368e Merge "Add assertNoCallbackThat" am: 5d39cb6ea7 am: 302ee01797
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1765527

Change-Id: Ia6dfe0d043a30df97b6bf3ae696503305e5e491f
2021-07-16 12:55:14 +00:00
Treehugger Robot
5fa15e6098 Merge "Add assertNoCallbackThat" 2021-07-16 12:29:03 +00:00
Chiachang Wang
cdf45529ad Add assertNoCallbackThat
assertNoCallback() fails when any callbacks are received.
In some cases, the test is expected to not to receive certain
callback, like available or lost. Depending on the network
environment, network may trigger linkproperties change. It will
fail the test, but these callback does not go against the
intention of the test. It should not fail the test. Thus, add
this method to allow tests to verify no certain callback received.

Bug: 192239030
Test: atest TestableNetworkCallbackTest
Change-Id: I7db720becb23636f85a9ac21192f8185eceb22fe
2021-07-16 12:19:39 +08:00
Remi NGUYEN VAN
2efe29e156 Merge "Remove TRANSPORT_USB in NetworkCapabilitiesUtils" am: 55b816cb3f am: 8a470b08b6
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1765531

Change-Id: I396b3f68213f33dbce1d6ac016bb9e308ba03bbd
2021-07-15 09:02:04 +00:00
Remi NGUYEN VAN
49ca421baa Merge "Add filterable, sortable to DevSdkIgnoreRunner" am: c0e59172d3 am: b2e757353a
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1754040

Change-Id: Iffb8ca12a771d658a1b5cb98989ab61a8d9ce778
2021-07-15 09:01:58 +00:00
Remi NGUYEN VAN
5f084a4db2 Merge "Remove TRANSPORT_USB in NetworkCapabilitiesUtils" 2021-07-15 04:55:38 +00:00
Remi NGUYEN VAN
47a0448e46 Merge "Add filterable, sortable to DevSdkIgnoreRunner" 2021-07-15 01:03:57 +00:00
Remi NGUYEN VAN
844901b2a7 Remove TRANSPORT_USB in NetworkCapabilitiesUtils
The constant can now be used from the SDK, and will be inlined at
compile time.

This reverts commit 4c087c18114ec0026b5cdf4824b34477cd8f77c2.

Bug: 184158327
Test: m
Change-Id: Ie577677d237ccfbc73fd3924e6a6d32f9f655851
2021-07-14 09:15:14 +00:00
lucaslin
5ecba24e62 Define TRANSPORT_USB in NetworkCapabilitiesUtils temporarily
The new API constant - TRANSPORT_USB didn't in mainline
branch, so the user of TRANSPORT_USB will get build break
when it is built in mainline branch.
Define TRANSPORT_USB in NetworkCapabilitiesUtils temporarily
is a workaround to fix this problem, and it should be removed
once downstream branches are S-based.

(clean cherry-pick)

Bug: 184158327
Test: m
Merged-In: I83560c75761e7008b457a66296364cb4ce24db50
Change-Id: I83560c75761e7008b457a66296364cb4ce24db50
2021-07-14 16:30:10 +09:00
Remi NGUYEN VAN
a7702b6379 Add filterable, sortable to DevSdkIgnoreRunner
Without a Filterable implementation like the AndroidJUnit4 runner,
DevSdkIgnoreRunner will still run tests annotated with @AppModeFull or
@SdkSuppress. Filterable should be implemented by runners that support
filtering as per the JUnit documentation, so the DevSdkIgnoreRunner did
not support filtering and would run all tests.

Add a Filterable implementation based on the base AndroidJUnit4 runner.

Bug: 192530637
Test: atest CtsNetTestCasesLatestSdk adding annotations to tests
Change-Id: Ica9451e34fb5d98675f754269f44c0354bdde1a4
2021-07-14 10:57:04 +09:00
Chalard Jean
7592a34dc9 Support both R and S+ in NetworkFactory
NetworkFactory needs to be backwards compatible as
it is statically linked by the Wifi module, which
needs to run on both R and S.

To achieve this, maintain 2 separate implementations
called NetworkFactoryImpl (S+) and
NetworkFactoryLegacyImpl (R). NetworkFactory itself
becomes a shim that delegates to one of these
implementations depending on the device's SDK version.

CP of ag/14265947

Ignore-AOSP-First: Merge in internal first to fix
                   S-on-R test breakages.
Bug: 183902758
Test: ClientModeImplTest
      OemWifiNetworkFactoryTest
      TelephonyNetworkFactoryTest
      UntrustedWifiNetworkFactoryTest
      WifiNetworkFactoryTest
Change-Id: I6a08f39ad1633dd7c1582c362c97821e24ce6683
Merged-In: I6a08f39ad1633dd7c1582c362c97821e24ce6683
2021-07-08 10:20:58 +00:00
Treehugger Robot
1c5e60835f Merge "Support legacy limit reached callback" am: 38e6f064fb am: 54f6b13dfd
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1748173

Change-Id: Idfbe0ee1e4969572766db13db41c6ef668767f52
2021-06-29 05:24:11 +00:00
Treehugger Robot
1308667155 Merge "Support legacy limit reached callback" 2021-06-29 05:02:47 +00:00
Remi NGUYEN VAN
87e88884b3 Support legacy limit reached callback
Add a callback entry for the older notifyLimitReached callback, that is
used on R devices.

Bug: 182962001
Test: atest OffloadControllerTest
Change-Id: Ic3c40eeb72b58ff1514f35be8e030a1dd9ba95d7
2021-06-28 06:01:10 +00:00
Treehugger Robot
ac32204980 Merge "Use module util HexDump in StructTest" am: b660371d8a am: 0d431094c3
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1745518

Change-Id: Idf66e10f395483cd56f38f80db1e017f5a6975aa
2021-06-24 12:43:07 +00:00
Treehugger Robot
b2cb5e23a1 Merge "Use module util HexDump in StructTest" 2021-06-24 12:17:25 +00:00
Remi NGUYEN VAN
83c7537a18 Use module util HexDump in StructTest
The hidden API HexDump causes issues, as coverage tests jarjar its
package even though it is a dependency on a hidden platform class, and
not included in test packages.

Use the HexDump utility in the com.android.net.module.util package
instead (no import is necessary as this is the same package).

Bug: 187935317
Test: atest StructTest
Change-Id: If319a3c20a750c890f8400f1a7104462b41ed556
2021-06-24 17:49:07 +09:00
Dennis Liao
34db409225 Revert "Add OnSetWarningAndLimit into TestableNetworkStatsProvider"
This reverts commit d44e8af26a04fb0b8d73483d7a777cfa94888809.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_rvc-qpr-dev-plus-aosp&target=test_suites_x86_64&lkgb=7487730&lkbb=7488089&fkbb=7487865, bug b/191937497

Change-Id: I21bfa4c481db4e5e5e038a5dd4de432f879aca57
2021-06-24 06:24:07 +00:00
Junyu Lai
a7ace49440 Add OnSetWarningAndLimit into TestableNetworkStatsProvider
This change also address left comments at ag/15010113.

Test: m gts && atest \
      GtsNetworkStackHostTestCases:NetworkStatsHostTest#testNetworkStatsProvider
Bug: 191327585
Merged-In: I100668cc6d4cecbaff29d027d37d313dd48854f3
Change-Id: I100668cc6d4cecbaff29d027d37d313dd48854f3
  (cherry-picked from ag/15061296)
2021-06-24 01:19:25 +00:00
Junyu Lai
ead0d3b52c Merge "Add OnSetWarningAndLimit into TestableNetworkStatsProvider" into sc-dev am: 1db2e1600b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/libs/net/+/15061296

Change-Id: I1163bb9a241742984bd48dbf996aae4a6cdc8a42
2021-06-23 20:40:03 +00:00
Junyu Lai
1f29499c64 Merge "Add OnSetWarningAndLimit into TestableNetworkStatsProvider" into sc-dev 2021-06-23 20:32:02 +00:00
Junyu Lai
8dc6e175cc Merge "Revert "Revert "Allow expect onRequestStatsUpdated with any token""" 2021-06-23 03:48:38 +00:00
Chiachang Wang
7dc43667f0 Add fall back to createTunInterface when running on R
TNM.createTunInterface() takes different parameter from S.
GTS is multi-release, so it should be compatible with S
and before S build. Add sdk version check to support it.

Bug: 186680038
Test: atest GtsNetworkStackHostTestCases:\
      com.google.android.gts.networkstack.NetworkStackHostTest#\
      testNetworkStack
Original-Change: https://android-review.googlesource.com/1742033
Merged-In: I5a08068db43e507637a53a32c15a5eb453d50c32
Change-Id: I5a08068db43e507637a53a32c15a5eb453d50c32
2021-06-23 00:54:52 +00:00
Junyu Lai
4046a83b12 Revert "Revert "Allow expect onRequestStatsUpdated with any token""
This reverts commit 886c3f16352f372f8e384c2dafd74c304008af38.

Reason for revert: From result of forrest, it turns out the culprit is not the CL. Hence the revert is not necessary.
See https://buganizer.corp.google.com/issues/191742804#comment10 for more detail.

Change-Id: If8492233c69d7947300f35f764199a7db1bd0045
2021-06-23 00:33:48 +00:00
Lorenzo Colitti
84d357d510 Merge "Supports to add a response for the given headers" into sc-dev 2021-06-22 22:53:26 +00:00
Roy Want
d1573ed5e5 Merge "Revert "Allow expect onRequestStatsUpdated with any token"" 2021-06-22 22:25:27 +00:00
Roy Want
75b9e6773b Revert "Allow expect onRequestStatsUpdated with any token"
This reverts commit 6b547a5fce031d25f2640f5da373aac8897634a2.

Reason for revert: DroidMonitor: Potential culprit for Bug 191742804 - verifying through Forrest before revert submission. This is part of the standard investigation process: RESULT: Out of the two CL's pointed at by this bug, this CL appeared to be the cause of the failure; submitting revert.

Change-Id: Ia727b13b11e9b863a702f83f68da12bbff3bcf3f
2021-06-22 22:20:02 +00:00
Chiachang Wang
c26c836c02 Merge "Add fall back to createTunInterface when running on R" am: 80ce99810c am: 682f69146a
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1742033

Change-Id: I845db2f17d53fa6827224d4ffee2548dfce4fec5
2021-06-22 13:15:21 +00:00
Chiachang Wang
c0786a5ec8 Merge "Add fall back to createTunInterface when running on R" 2021-06-22 12:47:59 +00:00