Commit graph android_packages_modules_Co.../Tethering/tests
Message SHA1
Merge "Load ncm regexs config to tetherableUsbRegexs if isUsingNcm=true" am: 844ca1290e am: 51f5f61742
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755176

Change-Id: Iceb3d25f31da76f4f12115a7ceabd68a81faebfa

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-07-06 04:04:42 +00:00
25423d4f5e
Merge "Enable and disable usb IpServer according to ACTION_USB_STATE" am: d479e694f0 am: 736df2cb2f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1731453

Change-Id: I334710d0bbbe18a769a79fb58d10a558dd8f7b37

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-07-06 04:04:36 +00:00
86d7e6bbb4
Merge "Load ncm regexs config to tetherableUsbRegexs if isUsingNcm=true"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-07-06 03:39:31 +00:00
844ca1290e
Merge "Enable and disable usb IpServer according to ACTION_USB_STATE"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-07-06 03:39:15 +00:00
d479e694f0
Load ncm regexs config to tetherableUsbRegexs if isUsingNcm=true
If config_tether_ncm_regexs is configured, load it to
tetherableUsbRegexs if ncm is used for TETHERING_USB. Load it to
tetherableNcmRegexs if ncm is used for TETHERING_NCM.

Bug: 185649441
Test: atest TetheringTests
Change-Id: I0c542560bd04e8c0a6a78d632da5a00a34d9a3fa

markchien   commited 2021-07-05 23:11:50 +08:00
b28740ec89
Enable and disable usb IpServer according to ACTION_USB_STATE
Before this change, usb IpServer would be created if corresponding
interface is available even there is no enable tethering attempt. And
usb IpServer only be disabled when interface is removed. Usb tethering
could not be stopped if interface is always avaialbe.
After this change, usb IpServer would be enabled and disabled according
to ACTION_USB_STATE.

Bug: 185649441
Test: atest TetheringCoverageTests
      atest MtsTetheringTestLatestSdk
      atest CtsTetheringTest
Change-Id: I8375e3f998d677dc658370b2553facaec0d5ff7c

markchien   commited 2021-07-05 22:53:07 +08:00
b41a00e778
Merge "Apply jarjar rules on coverage tests" am: d590b30f72 am: 073f6e299a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749680

Change-Id: I80209723541bdfb8f5b08cd5e9cf0e76afa3593e

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-07-01 01:08:32 +00:00
4a980eebf5
Merge "Apply jarjar rules on coverage tests"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-30 23:53:57 +00:00
d590b30f72
Apply jarjar rules on coverage tests
Apply their respective jarjar rules on tethering and general
connectivity tests, then merge both into the coverage tests suite.
This is necessary to ensure that classes covered by tests have names
matching classes used in code.

Also fix IpConnectivityLogTest to use the module utility instead of the
hidden BitUtils, as the test would fail after internal utils are
jarjared.

Bug: 187935317
Test: atest ConnectivityCoverageTests TetheringCoverageTests
Change-Id: Ib95b58dab93f7adebc445b662a6d15db1ce0e7c2

Remi NGUYEN VAN   commited 2021-06-30 16:00:26 +09:00
8ea5ee6d33
Merge "Fix OffloadControllerTest on R" am: 767b2180e9 am: 634ad9792d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1748154

Change-Id: I2cd282bf6d7a4638cbb65f20f2ccd886ec113713

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-06-29 05:24:11 +00:00
897ed3fc3d
Merge "Fix OffloadControllerTest on R"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-29 05:02:47 +00:00
767b2180e9
Merge "Fix ConnectivityManagerTest initialization on Q" am: 72f59b3019 am: 82a32e3f4a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1740779

Change-Id: I40abcac7db563480fe3c13fb5e0178d7a3629652

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-28 07:40:27 +00:00
9f4a31af59
Merge "Fix ConnectivityManagerTest initialization on Q"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-28 07:24:49 +00:00
72f59b3019
Merge "Fix and test usb function configuration change" am: 840e2efd7f am: 717c8ff590
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1740778

Change-Id: Iac2ab9a589c878bee92179956df7802ea51c7a3e

Mark Chien   authored and   Automerger Merge Worker   commited 2021-06-28 04:39:21 +00:00
4114bb1a2a
Merge "Fix and test usb function configuration change"
Mark Chien   authored and   Gerrit Code Review   commited 2021-06-28 04:16:14 +00:00
840e2efd7f
Fix and test usb function configuration change
Allow stop TETHERING_NCM no matter ncm is used for TETHERING_USB or
TETHERING_NCM.

Add a test:
1. NCM is started for TETHERING_NCM
2. The config changes to use NCM for TETHERING_USB.
3. Then the config changes to use RNDIS for TETHERING_USB.

Also let some logs not only print in dumpsys, but also in logcat to
easiler debug unit test.

Bug: 185649441
Test: atest TetheringTests
Change-Id: Ia8d76a29646f36941cbb16cd68ae6887100ec8ec

markchien   authored and   Mark Chien   commited 2021-06-28 02:59:33 +00:00
34f7857b07
Fix ConnectivityManagerTest initialization on Q
The test can't have TetheringManager as an argument to methods or a
field, otherwise the test runner will crash when scanning the class for
tests because TetheringManager did not exist in Q. Although
testFactoryReset is already skipped on Q, the test runner would fail
at initialization time, before starting the run.

Use CtsTetheringUtils instead. This ensures that TetheringManager does
not have method signatures or members that reference classes that do not
exist on Q, so the test runner can scan the class successfully before
starting the run.

Bug: 188851796
Test: atest ConnectivityManagerTest on Q
Change-Id: I87488d0f23628a1ef2d7af0242513fcc5401d598

Remi NGUYEN VAN   commited 2021-06-28 11:24:27 +09:00
0d54d7992d
Fix OffloadControllerTest on R
Data warning is not supported on R, and the notifyWarningOrLimitReached
callback also only exists in S.

Bug: 182962001
Test: atest OffloadControllerTest
Change-Id: I4914240967bba341f16e505acd29b80b90ab8569

Remi NGUYEN VAN   commited 2021-06-28 10:15:57 +09:00
9207702d66
Merge "Improve TestConnectivityManager readability" am: 883df67f3f am: 265ec28e25
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1733779

Change-Id: Ic81a3604724855233dffc4e989bcee69feb8d91c

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-28 00:13:10 +00:00
59be04dcca
Merge "Improve TestConnectivityManager readability"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-27 23:47:45 +00:00
883df67f3f
Merge "Refresh conntrack entry timeout" am: a569410667 am: a729b103ff
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1566871

Change-Id: I5508b5b47d17c01d2ce95fb30d9dfc14e279f932

Nucca Chen   authored and   Automerger Merge Worker   commited 2021-06-25 18:55:47 +00:00
2791e3fe11
Merge "Clear IPv4 offload rules when tethering stopped" am: 7238b31c15 am: 70504b2f6b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1579873

Change-Id: Ibfea3e14e0e06a59c3b29534ab5ffbf4d4bd2148

Nucca Chen   authored and   Automerger Merge Worker   commited 2021-06-25 18:55:09 +00:00
8516b3f120
Merge "Refresh conntrack entry timeout"
Nucca Chen   authored and   Gerrit Code Review   commited 2021-06-25 18:34:22 +00:00
a569410667
Merge "Clear IPv4 offload rules when tethering stopped"
Nucca Chen   authored and   Gerrit Code Review   commited 2021-06-25 17:56:21 +00:00
7238b31c15
Merge "Update TetheringTests for new connectivity shims"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-25 05:42:14 +00:00
86b39c8c34
[SP35] Pass data warning to tethering offload
This is supported by:
  1. Utilize the new API from both NetworkStatsProvider
     and IOffloadControl to send data warning quota to hardware.
     And pass the warning reached notification back to NPMS.
  2. Disable software solution introduced in R release for
     V1.1+ hardware, since now we can fully offload data warning
     and limit notification to hardware.

Test: atest TetheringTests
Fix: 149467454
Merged-In: Ie49461694d77ab7f25a549433b01b5b0167bd489
Change-Id: Ie49461694d77ab7f25a549433b01b5b0167bd489
  (cherry-picked from ag/13981692)

junyulai   authored and   Junyu Lai   commited 2021-06-24 08:33:28 +00:00
991433d8c8
[SP34] Adapt onSetWarningAndLimit
This is a no-op change that just adapt new API from
NetworkStatsProvider to get warning and limit bytes at the same
time. This change also stores them locally for subsequent
patches to set warning bytes to hardware.

Test: Will be included in the subsequent patch.
Bug: 149467454
Merged-In: Iec01cb01fd1ce481ce0bd736762baddde1e38084
Change-Id: Iec01cb01fd1ce481ce0bd736762baddde1e38084
  (cherry-picked from ag/13981691)

junyulai   authored and   Junyu Lai   commited 2021-06-24 08:33:28 +00:00
da52dab266
[SP33] Adapt ITetheringOffloadCallback V1.1
This is a no-op change that redirect both V1.0 and V1.1 callback
events to the same handling function. Since the V1.1 callback
is extended from V1.0 callback, we can safely use V1.1
callback for both V1.0 and V1.1 control.

The change also provides interface for subsequent
OffloadController changes to set warning and limit at the
same time.

Test: atest TetheringTests
Bug: 149467454
Merged-In: I6505a04de8c57357dd1fa9ce898c13395e497816
Change-Id: I6505a04de8c57357dd1fa9ce898c13395e497816
  (cherry-picked from ag/13973147)

junyulai   authored and   Junyu Lai   commited 2021-06-24 08:33:28 +00:00
37a7e620b4
Improve TestConnectivityManager readability
Remove NetworkCallbackInfo to use Handler directly, and separate
registerSystemDefaultNetworkCallback from requestNetwork.

Also verify that requestNetwork is only used with a default-like network
request on R, as S should be using registerSystemDefaultNetworkCallback.

Test: atest TetheringTests
Bug: 189581241
Change-Id: If6b9124b2d795b9db1e85256c694d0120c852542

Remi NGUYEN VAN   commited 2021-06-24 17:17:54 +09:00
2e0f0da0b7
Update TetheringTests for new connectivity shims
The stable connectivity shims are updated to now contain S API, so
tethering tests that assumed that compatibility R behavior was used need
to be updated.

To avoid such failures Tethering tests should have a test target using
updated shims (TetheringNextTests), but this was not done in S
timeframe.

Bug: 189581241
Test: atest TetheringTests
Merged-In: Ibc04e64a1e9d82b67aff10d1a6d77f9e6b1bbdfb
Change-Id: Ibc04e64a1e9d82b67aff10d1a6d77f9e6b1bbdfb

Remi NGUYEN VAN   commited 2021-06-24 17:17:54 +09:00
11e5cf0b0b
Refresh conntrack entry timeout
Needed because the BPF maps offloads IPv4 traffic. The kernel can't
trace the offloaded traffic to keep the conntrack entry.

Bug: 190783768
Test: atest TetheringCoverageTests
Change-Id: Idbcf686c9b2124b192944156ac5111be741744fb

Hungming Chen   commited 2021-06-23 15:41:30 +08:00
c27ec7c4a2
Clear IPv4 offload rules when tethering stopped
The condition for deleting IPv4 forwarding rules.
1. When the tethering client has gone, deletes the client and its
   rules.
2. When the upstream has gone, deletes all rules.
3. When the upstream has changed, deletes all rules.

Test: atest TetheringCoverageTests and check IPv4 offload rules
via dumpsys tethering in the following test cases.

Bug: 190783768

Test cases:
a. Loss upstream interface while tethering
  1. Enable WIFI tethering
  2. Disable upstream interface
  3. Check the rules are removed.
b. Loss downstream interfaces while tethering
  1. Enable WIFI tethering
  2. Enable BT tethering
  3. Disable BT tethering
  4. Check the BT tether rules are removed.
  5. Disable WIFI tethering
  6. Check the WIFI tether rules are removed.
c. Switch upstream interface while tethering
  1. Enable WIFI tethering
  2. Enable BT tethering
  3. Switch upstream interface from cellular to wifi.
  4. Check all rules are removed.
d. Enable NAT failure (manual)

Log:
The rule deletion in each case.
- IpServer#stopIPv4: case b and case d.
- BpfCoordinator#updateUpstreamNetworkState: case a and case c.

Test case a
06-23 09:58:59.245  [...] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear wlan2

Test case b
06-07 22:17:51.886  [..] Tethering: [bt-pan] cleanupUpstream bt-pan
06-07 22:17:51.888  [..] Tethering: [bt-pan] stopIPv4 bt-pan
06-07 22:18:23.769  [..] Tethering: [wlan2] cleanupUpstream wlan2
06-07 22:18:23.772  [..] Tethering: [wlan2] stopIPv4 wlan2

Test case c
06-08 11:11:48.277  [..] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear bt-pan
06-08 11:11:48.396  [..] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear wlan2
06-08 11:11:48.579  [..] Tethering: [wlan2] cleanupUpstreamInterface
    wlan2
06-08 11:11:48.808  [..] Tethering: [bt-pan] cleanupUpstreamInterface
    bt-pan

Enabling NAT failure
06-08 13:04:18.117  [..] Tethering: [wlan2] Exception enabling NAT [..]
06-08 13:04:18.234  [..] Tethering: [wlan2] cleanupUpstream wlan2
06-08 13:04:18.246  [..] Tethering: [wlan2] stopIPv4 wlan2

Change-Id: Id505a3deb277bbe0f44403234d8ca8bbf01eec80

Hungming Chen   commited 2021-06-23 15:41:27 +08:00
a6e7869646
Merge "[SP32] Try to get 1.1 OffloadControl hardware if available"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-06-22 20:31:18 +00:00
69bc4fede1
Merge changes I270ff43c,Ifc7eee24 am: cec294d1b4 am: 82b26e0d1f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1730548

Change-Id: I382f551487f70865761b4dcd0dcdcdb425538f3e

Mark Chien   authored and   Automerger Merge Worker   commited 2021-06-21 13:57:31 +00:00
0e57c7e589
Merge "Add connectivity coverage tests" am: cc79d7c0f8 am: 68114fe408
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1731232

Change-Id: I6cc7f3a3abe97fccc59e14e77e99a0843f3363bb

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-21 13:56:37 +00:00
3d25f6e8a7
Merge changes I270ff43c,Ifc7eee24
* changes:
  Add enable and disable ip serving common functions
  Allow to use ncm function for usb tethering

Mark Chien   authored and   Gerrit Code Review   commited 2021-06-21 10:56:45 +00:00
cec294d1b4
Merge "Allow mocking permission in TetheringServiceTest" am: ec48bb82aa am: 4abe3f8db3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1731231

Change-Id: Ic54d721af3ea589f3383cfe9c6dfb32928ba80ac

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-21 10:35:50 +00:00
381358371f
Allow to use ncm function for usb tethering
Adding the configuration to decide using rndis or ncm for usb tethering.
If ncm is configured for TETHEIRNG_USB, then TETHERING_NCM is not
available.

Bug: 162920185
Test: atest TetheringTests
      manul testing usb tethering
Change-Id: Ifc7eee2457a950a0e2d1c3cc89a3373a7ad23c9c

markchien   commited 2021-06-18 11:20:26 +08:00
cab01b7ebc
Add connectivity coverage tests
The coverage tests will allow measuring code coverage for all
Connectivity+Tethering code.

This is a combination of the current TetheringCoverageTests, and
FrameworksNetTests.

Adding min_sdk_version to the test prevents it from using deprecated
IoUtils utilities. Replace it with the non-deprecated alternative.

Test: atest ConnectivityCoverageTests
Change-Id: I5366e1cc9cd6ddb41f24718246381cc2b1cc1383

Remi NGUYEN VAN   commited 2021-06-16 19:45:20 +09:00
fe20e1317d
Allow mocking permission in TetheringServiceTest
The test will currently fail if it is run in a package that has
ACCESS_NETWORK_STATE. Add utilities to mock permissions, and mock the
ACCESS_NETWORK_STATE permission to be denied.

Bug: 187935317
Test: atest TetheringServiceTest
Change-Id: I8df5f2ac21bf0314098e8c2e5ba583676ae8ab38

Remi NGUYEN VAN   commited 2021-06-16 17:53:10 +09:00
0ae7e5bdcd
Merge "Update TetheringTests for new connectivity shims" into sc-dev am: b81724602f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14928587

Change-Id: I3827d12719ddc930a18e8651dd66a2e28b6f92f6

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-10 14:03:59 +00:00
79471813b4
Update TetheringTests for new connectivity shims
The stable connectivity shims are updated to now contain S API, so
tethering tests that assumed that compatibility R behavior was used need
to be updated.

To avoid such failures Tethering tests should have a test target using
updated shims (TetheringNextTests), but this was not done in S
timeframe.

Ignore-AOSP-First: topic needs differences in AOSP
Bug: 189581241
Test: atest TetheringTests
Change-Id: Ibc04e64a1e9d82b67aff10d1a6d77f9e6b1bbdfb

Remi NGUYEN VAN   commited 2021-06-10 13:44:00 +00:00
c94a1ffd55
Fix TetheringTest crash on eng build
startTrackDefaultNetwork was allowed to called multiple times
before even though there is no one actually do it. However,
in the TetheringTest#verifyDefaultNetworkRequestFiled, a
manual invocation is used to ensure that function supports
multiple entrance.

But with aosp/1697371, startTrackDefaultNetwork is no longer
allowed to be called multiple times, it would lead to log.wtf
and crash system in eng build.

Since the manual invocation of startTrackDefaultNetwork is not
realistic and no longer valid anymore, remove the invocation
that caused the trouble.

Test: atest TetheringCoverageTests
Bug: 188613493
Merged-In: I61f6088783d521fd17ae1e87370842b4239fbe75
Change-Id: I61f6088783d521fd17ae1e87370842b4239fbe75
  (cherry-picked from aosp/1711433)

junyulai   authored and   Junyu Lai   commited 2021-06-09 01:57:37 +00:00
9c5d40beca
Correct the logic for CtsTetheringUtils.isWifiTetheringSupported
The existing isWifiTetheringSupported only check if tethering side
supports wifi tethering or not but not wifi side. A expected
behavior should include both of them, so add the wifi side check
into the helper function. Also update in the existing caller side
due to a new parameter added.

Bug: 186061922
Test: atest MtsTetheringTestLatestSdk
Megred-In: Id69ac1d30ab2bbf23e870193335b139f54672636
Change-Id: Id69ac1d30ab2bbf23e870193335b139f54672636
Ignore-AOSP-First: cherry-pick

Chiachang Wang   commited 2021-06-04 13:29:38 +00:00
0acaa74538
Merge changes I5d3e448e,Id69ac1d3 am: 02eea987c0 am: b675eba4c1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1711429

Change-Id: Iede15400f50e5e0f37a95f59b924d8b7dd698509

Chiachang Wang   authored and   Automerger Merge Worker   commited 2021-06-03 09:22:36 +00:00
a3df1ed5f1
Correct the logic for CtsTetheringUtils.isWifiTetheringSupported
The existing isWifiTetheringSupported only check if tethering side
supports wifi tethering or not but not wifi side. A expected
behavior should include both of them, so add the wifi side check
into the helper function. Also update in the existing caller side
due to a new parameter added.

Bug: 186061922
Test: atest MtsTetheringTestLatestSdk
Change-Id: Id69ac1d30ab2bbf23e870193335b139f54672636

Chiachang Wang   commited 2021-06-01 15:08:48 +08:00
4f5c4c4323
Test tethered callback with TetheringInterface
The old callback only report interface list, new callback could provide
the mapping of interface and type. Replace old callback usage in cts
with new callback and check whether old callback could get the correct
interface list by comparing the result between old and new callback.

Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S
      atest CtsTetheringTestLatestSdk on R
      atest MtsTetheringTestLatestSdk on S and R
Merged-In: I2a0b8c43fb340c3eaed7f0f90464199222a24280
Change-Id: I2a0b8c43fb340c3eaed7f0f90464199222a24280

markchien   authored and   Chiachang Wang   commited 2021-06-01 14:36:09 +08:00
3a23d2e2a6
Add the tethering type to TetheringEventCallback methods
Before this change, tethering always report a list of tethered
interfaces and the caller need to use each tethering type's interface
regex to matching tethered list to manual implement the mapping of
tethering type and interface. This change allow caller to get rid of
tethering interface regex.

Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S

Merged-In: I91bcccd676d109c1b974497ac29bd366a41b8899
Change-Id: I91bcccd676d109c1b974497ac29bd366a41b8899

markchien   authored and   Chiachang Wang   commited 2021-06-01 14:35:39 +08:00
35ad54b25e
Merge "Disable tryCell when UpstreamMonitor stop" am: 011552cc54 am: bed1ae7b4c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1715791

Change-Id: I4f55ae5885e3904d0d2d17384875cb00809a0eed

Mark Chien   authored and   Automerger Merge Worker   commited 2021-05-24 03:00:20 +00:00
1217274ac0
Merge "Disable tryCell when UpstreamMonitor stop"
Mark Chien   authored and   Gerrit Code Review   commited 2021-05-24 02:27:13 +00:00
011552cc54