Add unit test to test feature
BROADCAST_NETWORK_STATS_UPDATED_RATE_LIMIT_ENABLED_FLAG.
When feature is on, broadcast message should be delivered
with the designated interval(b/343844995),
When feature is off, each message should be delivered
regardless of previous intent.
Test: atest FrameworksNetTests:android.net.connectivity.com.android\
.server.net.NetworkStatsServiceTest\
#testNetworkStatsUpdatedIntentSpam_rateLimitOn
Test: atest FrameworksNetTests:android.net.connectivity.com.android\
.server.net.NetworkStatsServiceTest\
#testNetworkStatsUpdatedIntentSpam_rateLimitOff
Bug: 343844995
Change-Id: I4b89497c336a310c6959db579ca9ae3c572ff70c
Currently, NetworkStats#addEntry creates a new instance
containing the requested result instead of mutating the
original object. This creates a heavy memory footprint
when the caller invokes it in a loop because a new NetworkStats
instance is created whenever an addEntry is called.
This change introduces a new API that allows callers to
add a set of entries to a NetworkStats instance. This new
API will clone the instance only once, return the newly
created (and modified) instance, and ensure that the original
instance remains immutable.
Additionally, the change adopts config libraries for flagging
the API and corresponding CTS tests, since Android U-based
branches are no longer downstream of current development branches.
Test: atest FrameworksNetTests:android.net.connectivity.android.net.netstats.NetworkStatsApiTest
Test: atest CtsNetTestCases:NetworkStatsApiTest
Bug: 335680025
Fix: 357772271
API-Coverage-Bug: 357772271
Change-Id: I58513844e681c0621a6107ec4b198cd3957f289d
ensureValidatedNetwork does not request network.
So this fails if MOBILE_DATA_ALWAYS_ON is disabled and the cell network
is down
Bug: 356291552
Test: ConnectivityManagerTest
Change-Id: I0e5f67467d6ef591028225ddb138d8ed5f4fa32a
OEM VPNs might need to receive packets to VPN address via
non-VPN interface.
Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Ia9000bcbb5b3b9e1e0d396ba78946be36e2fc5ba
This method can remove all services that match the given
CacheKey.
Bug: 355421878
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I83e1a0cbdd4355d92510b5f9a550f96ef0154682
"Shrinked" should actually be "shrunk" or "shrunken"; in any case
"minimized" is simpler and possibly more accurate (it's the minimum size
required to hold the values).
Test: atest
Change-Id: If787d3f3d6e1046338d4e89ed924bce183e74bd6
To avoid filling the binder buffers, and sending unnecessary callbacks
when apps are unfrozen (for example successive LinkProperties changes or
onAvailable+onLost are not useful), queue and aggregate callbacks for
apps that are suspended.
Test: atest
Bug: 327038794
Bug: 279392981
Change-Id: I6de357ac2834f1f7e960dfbaa63adfc3825f2a82
Some legacy VPNs need to receive packets to VPN address via
non-VPN interface.
Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Iad06dc69c5bf5ccda476e89ed9b0fc1bc63d2ebe
This is a no-op refactoring, which is preparation for follow-up
changes to add more apf tests.
This includes:
1. Add a method to send packet and expect counter increases.
2. Inline the packet construction code in the test method.
Test: atest NetworkStaticLibHostPythonTests
Test: m connectivity_multi_devices_snippet && \
atest CtsConnectivityMultiDevicesTestCases
Bug: 350880989
Change-Id: Iadcfd97740033306af1b6a474004cbf0699ddd1b
This is a no-op refactoring, which is preparation for follow-up
changes to add more apf test classes.
This includes:
1. Move initialization code to a base class, which setup a hotspot
and a client connects to it, and enable doze mode to
activate the apf.
2. Check whether send raw packet is supported before testing.
Test: m connectivity_multi_devices_snippet && \
atest CtsConnectivityMultiDevicesTestCases
Test: atest NetworkStaticLibHostPythonTests
Bug: 350880989
Change-Id: I6376935883653182728e473e2f5533407d993d7b
This is a no-op refactoring, which is preparation for follow-up
changes to add more apfv4 tests.
This includes:
1. Add a entry point for multi-device tests to collect
test cases from different files.
2. Move multi-device initialization code to a base class.
3. Make different test classes inherit the base class.
Test: m connectivity_multi_devices_snippet && \
atest CtsConnectivityMultiDevicesTestCases
Bug: 350880989
Change-Id: I294c85d8e09633bbf02ba1543b9f2ea3e988e20d
* changes:
Use AutoCloseTestInterfaceRule in NsdManagerDownstreamTetheringTest
Add auto close rule for test interfaces
Add finalizer to check whether destroy was called
Wrap use of test interface in EthernetTestInterface
Add a class to properly manage ethernet test interfaces
Patrick Rohrauthored and Gerrit Code Reviewcommited 2024-07-31 20:36:45 +00:00
Checking for the existence of ethernet service should be enough.
Ethernet service is also running when there is USB host support.
Test: atest NetworkValidationTest
Change-Id: I0be59107642704d9aeeb1e08d705d1d66dbf72d1
This change also removes the DevSdkIgnoreRule since mainline no longer
ships to devices running Q.
Test: atest NetworkValidationTest
Change-Id: Iaf5f3f9b53b78b91719dfc8d466ca1fa80f9bd21
Obtained with:
prebuilts/ktlint/ktlint.py --format --no-verify-format --file FILE
--no-verify-format is used to ignore checks that are performed by ktfmt
(see ktlint.py).
Test: m
Change-Id: Ief2c146833e43492d0333b05f1c2b67bbfbc16e0
Empty TXT records should not be sent when advertising as per RFC 6763
6.1, although it also specifies that in case they are sent, they must be
treated the same as TXT records with an empty String.
Some recent discovery implementations seem to not be able to find
services that send empty TXT records; ensure MdnsAdvertiser sends TXT
records with an empty attribute instead.
Test: atest
Bug: 351250155
Change-Id: If928e5f7c371faa456535160f10880adb1449b92
Address the TODO to link against the library directly, and add necessary
test filters to only run the test on the primary ABI (because the
library in the apex has only one variant for primary ABI), and to only
run the test on U+.
Bug: 356022894
Test: atest
Change-Id: Ib52bfc1051059aaf9d14d1f7707864206d0bdcd9
Since the target SDK of this test should always equal or be
larger than V, TrafficStats caching is always enabled.
Clearing the cache is needed to avoid rate-limiting on
devices with a mainlined (T+) NetworkStatsService.
Test: atest CtsNetTestCases:android.net.cts.IpSecManagerTest#testIkeOverUdpEncapSocket \
--rerun-until-failure 100 (on T device with latest tethering module)
Fix: 355530686
Change-Id: I9c61b72c78262445632fa7c9a2ce17491b52481d
Developing these tests from within this project causes a lot of
maintenance toil because they are not applicable to the code in the
module. Moving them to be in the cts repo where they're on the same
development cycle as the code they test.
The tests are being moved from tests/cts/hostside-network-policy to
hostsidetests/network-policy to be consistent with the destination
repository's naming conventions.
Test: atest CtsHostsideNetworkPolicyTests
Bug: 322115994
Change-Id: I53bb4a25ef8f3229e8cf5024c59f4f1aa8c63cce
Refactored ApfIntegrationTest to include a verification step after each
program update, ensuring correct installation and improving error
detection.
Bug: 353871015
Test: TH
Change-Id: I9652725241244dbdfa6c6482ffb3d0302cd1978a
Modified testDropPingReply() to clear the entire APF memory instead of
only the first byte. This addresses a known firmware issue with
handling programs smaller than 8 bytes.
Bug: 339147921
Test: TH
Change-Id: I651dae8c9daac24b195196c03b54e69a757de8a7
NsdManagerDownstreamTetheringTest closed the test interface without
waiting on the STATE_ABSENT callback from ethernet service. This meant
that during setUp, an ethernet test interface might
still have been present from the previous test causing the test to be
flaky.
Note that flakiness was not uncovered until a recent change in
EthernetTetheringTestBase, which skips tests when a built-in ethernet
interface is present. This check used to throw an assumption failure if
any interface for tethering was already available, but was recently
changed to only throw the assumption failure if said interface is not
named testtap%d. So this test has always been broken, it just was not
obvious because the flakes would result in the test getting skipped.
Test: atest NsdManagerDownstreamTetheringTest --iterations 20
Bug: 348064142
Change-Id: I15f2aeacdf621a4413bda032331abb64c75d86a7
Tun/tap interfaces are difficult to use in combination with
EthernetManager#setIncludeTestInterfaces(). For one, the test must
ensure that the ethernet service has fully unregistered the interface
before calling setIncludeTestInterfaces(false) at the end of the test.
Otherwise, test setup of the next test might race with interface tear
down processing.
In order to make the correct use of tun/tap interfaces in ethernet
service easier, this class encapsulates the appropriate calls to
setIncludeTestInterfaces() and synchronizes interface creation and
deletion with processing in ethernet service by listening to the
respective callbacks.
Note that tests that do not register their interfaces with ethernet
service could technically still race with tests that do, though setUp()
unlikely to win.
Test: mm
Change-Id: I048512a1e4eef17a6f02d46b8b9f7a16210e3271
Ensure MTS modules are compiled with both 32 and 64 bit ABI, as MTS
attempts to run both.
Recent changes have started failing tests when one of the ABI is
missing, see change ID: I5310ca67879534cb066dcedf6a9102a39e085faf
Test: atest bpf_existence_test -- --abi armeabi-v7a
Fixes: 352592958
Fixes: 354070942
Change-Id: Iea494323ccc12710bff6d488f2b51b13255d841e
This is a no-op refactor. Move some parameters from
QueryTaskConfig to QueryTask, or bring them from public methods.
Bug: 345146854
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I47d420842c4f9cec3fe25b5e2febc84a1e495f40