This class doesn't actually serve a purpose, it only makes
TestableNetworkCallbck more complex.
Test: CtsNetTestCases ConnectivityCoverageTests
Flag: EXEMPT test-only
Change-Id: I39a598b82a3215384bdfe04980f4b280ab2c2716
If client knows network name and passphrase, it can connect to the
server (Group owner) without user interaction. In this case, it needs
to use interface address of group owner, not device address
Bug: 408245757
Test: atest CtsConnectivityMultiDevicesTestCases
Flag: EXEMPT bug fix
Change-Id: I47bc8609e63564f4226a4ef71ea9e382f5f919fe
Signed-off-by: Rohit Kothari <r.kothari@samsung.corp-partner.google.com>
Rohit Kothariauthored and Paul Hucommited 2025-05-07 02:47:38 -07:00
Network name for Wi-Fi Direct group must starts with the prefix DIRECT-xy.
But CTS sometimes makes name with non-character in the position of “xy”.
To prevent issue, network name needs to be generated with the prefix DIRECT-xy.
Bug: 408245757
Test: atest CtsConnectivityMultiDevicesTestCases
Flag: EXEMPT bug fix
Change-Id: Ida07616b920b32dadd76f732ff2d87cc6ecc960d
Signed-off-by: Rohit Kothari <r.kothari@samsung.corp-partner.google.com>
Rohit Kothariauthored and Paul Hucommited 2025-05-07 00:34:24 -07:00
The IA_PD Option is modeled as a separate "packet", because it can
contain various options itself. It turns out that with the current
packet builder architecture, building nested packets (of which DHCPv6 is
an extreme example) is actually quite difficult. We would encounter
similar problems if we ever were to try and build netlink packets.
One thing that could be done is to add another overload for
PacketBuilder#div that takes another PacketBuilder object, allowing an
syntax such as:
dhcp6_header / dhcp6_rt_sol_max / (dhcp6_ia_pd / dhcp6_ia_prefix)
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I35694627285759dd17d8a8bf5994aaa96e6b391d
This adds support for building the Dhcp6Pkt header. Options are added
later.
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I588d8fc6ba68d1132a3beb1b436d8175ac0ae577
Note that a new neighbor can still be added while processing a packet,
which may influence the result, though this shouldn't affect tests.
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: If6860f3a52a406bbbbdd323061bfb918f1fb866c
This is a shared public utility. Its main utility is for methods
that can fail, have an error message of their own, and also want
to take an error message from a caller and want to combine them.
Example use :
fun <T> assertEquals(expected: T, actual: T, msg: String? = null) {
if (expected != null) {
failWithErrorReason(msg, "Expected $expected, got $actual")
}
}
...which allows someone to say
assertEquals(a, b, "Checking a vs b")
Test: TH
Flag: EXEMPT test-only change
Change-Id: Id3eaa8384b4177f38f13576d9b4d742c52027ae4
Update it to follow the latest conventions and add support for
eventuallyExpect.
Test: ConnectivityCoverageTest
Flag: EXEMPT test-only change
Change-Id: Iabc2fad051b874e3e18a0645361409f0427891fb
It was thought originally that it would not make a lot of sense to
offer such a call, but with usage it became clear that there is a
simple, obvious and useful behavior.
In particular this is very useful to mix eventuallyExpect and
expect calls. Interestingly, before this patch, calling
callback.eventuallyExpect<...>()
callback.expect<...>()
does not actually behave like you would intuitively think, because
eventuallyExpect does not advance the read head. When this
utility was made we thought this was the better behavior, but
usage has shown that advancing is both obvious and more useful.
Astonishingly, there seem to be no caller who needs to
eventuallyExpect() and later expect(), meaning that this
behavior change is apparently fine.
Test: ConnectivityCoverageTest and treehugger
Flag: EXEMPT test-only change
Change-Id: I2078330bd913cf0f75240bf3d4852e487e3e0163
Addressing leftover comments in ag/33040619 regarding carrier privilege
acquisition in CarrierConfigRule with the following changes:
1) Refactored CarrierPrivilegeCallback to match records using a lambda.
2) Added various helper methods to handle calls with permissions.
3) Moved wait for carrier privlege to overrideConfigAndWait.
4) Fixed acquireCarrierPrivilege to append to current cert strings
instead of overwriting them.
5) Fixed dropCarrierPrivilege to remove from current cert strings
instead of cleaning up all configs.
Flag: EXEMPT test only change
Bug: 409710349
Test: atest TetheringManagerTest
Change-Id: I1165d95775e809f1aa8905af029fb13df0d3a1a8
Quang Anh Luongcommited 2025-04-25 12:50:32 +09:00
This commit removes the test_igmpv3_general_query_offload() test
logic. This test fails on user builds because they run on non-rootable
devices, preventing the necessary test operations.
Additionally, the APF counter check logic is removed as it was causing
test flakiness and instability.
Bug: 406570694
Test: TH
Flag: EXEMPT test only change
Change-Id: I9f2f32c49737721e537d578d6df41d4062d0684f
Use a common code path for getTestableNetworks, which obtains Wi-Fi and
cellular from network callbacks. This avoids mixing callbacks and
synchronous calls, as getTestableNetworks may be called after
ensureWifiConnected, which uses NetworkCallbacks.
Test: atest
Bug: 253698734
Flag: TEST_ONLY
Change-Id: I8bf946b5258270554286e52b8aa3189aa2ba52e1
@JvmSerializableLambda was used in NetworkAgentTest to get around the
link error caused by JUnit enumerating through lambda methods that
referenced classes that weren't available on older platform versions.
Since this code was ported from NetworkAgentTest to CarrierConfigRule
whose lambda methods are not enumerated by JUnit, this workaround isn't
necessary anymore.
Flag: EXEMPT test only change
Bug: 409710349
Test: atest TetheringManagerTest
Change-Id: Ib876e237b239661548ae3c1d23fcb52f389f6254
Quang Anh Luongcommited 2025-04-17 17:10:44 +09:00
CarrierConfigRule cleanup does not wait for carrier privilege value
to change before continuing to the next test, which may cause test
failures if the value isn't fully reset on time.
Make sure the value has time to properly be reset by waiting for
onCarrierPrivilegesChanged before proceeding.
Flag: EXEMPT test only change.
Bug: 409710349
Test: atest TetheringManagerTest#testCarrierPrivilegedIsTetheringSupported TetheringManagerTest#testCarrierPrivilegedStopTetheringWifiWithConfigSucceeds
Change-Id: If67884514a2c1678834ab9ff67947e75e37db0a7
Quang Anh Luongcommited 2025-04-16 15:02:54 +09:00
Allow module with "sdk_version: module_current" to depend on
net-tests-utils-host-device-common.
This CL also makes this module visible to cronet
Bug: 311792075
Test: TH
Flag: EXEMPT Android.bp sdk_version and visibility change
Change-Id: I3b1068e12d4abbd34006aae69bbd314fcf05d060
Line breaks make tests harder to read, so this change should help
fitting everything on a single line.
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I286c4398a2f738ab82498b93f9f9344577befeb8
Renames srcPort to sport and dstPort to dport and generates a random
port number in the range of [1, 65536) if no argument is passed.
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: If446cde9a7ff414f52c60f70458ff046a2c4dc33
Figuring out what packets were received is useful for debugging.
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I3184845b76e33da186f39a2344548c2d16715173
Bundle the version of the tethering APEX in the build branch into
CtsNetTestCases as a resource, and include it in the failure header on
test failure.
This should make it easy to identify what version of the module matches
the built test when investigating test failures.
Test: atest
Flag: TEST_ONLY
Change-Id: I15a53b3d7649ebde9706b10ee504d08aa78ee7de
Not all U devices support this. It's only supported by U QPR1+.
Bug: 404415649
Test: NetworkAgentTest
Flag: EXEMPT bugfix
Change-Id: I66d30b5f0be5628561bfeb1f90f5318954544e31
Chalard Jeanauthored and Jean Chalardcommited 2025-04-08 00:51:44 -07:00
UDP packets can be built as:
val p = ether / ipv6 / udp / data
val p2 = ether / ipv4 / udp / data
val p3 = ether / ipv4 / udp / ipv4 / udp / data
This also gets rid of Icmp6Pkt in favor of a function call that
calculates the checksum over an L4 packet.
This does add a bit of duplication: the build() function for RA and NA
packets is identical, and UdpPkt#build() is not far off. However, subtle
differences in L4 packet format (namely the checksum and length
positions) make generalizing this code difficult. This is possible by
passing the checksum position, proto byte, and adding an abstract
function that fills in the L4 length field before performing checksum
calculation. However, this complexity is likely not worth it. If the
repetition becomes obvious once more protocols (such as ICMPv4/6 echo,
etc.) are added, this decision will be revisited.
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ia78792418f29a3be091ebdc9bb2c26e45da9f2b1
Patrick Rohrauthored and Maciej Żenczykowskicommited 2025-04-07 14:22:43 -07:00