blob: 158288646c299c38015e9bc51355348eca182296 [file] [log] [blame]
Girish Moturu383e41a2018-01-02 13:51:15 -08001#
2# Copyright 2018 - The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
Girish Moturu74ff5652019-11-17 13:19:26 -080016import threading
Girish Moturu383e41a2018-01-02 13:51:15 -080017import time
18
19from acts import asserts
20from acts import base_test
Girish Moturu74ff5652019-11-17 13:19:26 -080021from acts import utils
Girish Moturu383e41a2018-01-02 13:51:15 -080022from acts.controllers import adb
David Goldfarb78a3b672020-03-31 12:44:01 -070023from acts.controllers.adb_lib.error import AdbError
Girish Moturu74ff5652019-11-17 13:19:26 -080024from acts.controllers.ap_lib import hostapd_constants
Girish Moturu383e41a2018-01-02 13:51:15 -080025from acts.test_decorators import test_tracker_info
Xianyuan Jia63751fb2020-11-17 00:07:40 +000026from acts_contrib.test_utils.net import connectivity_const as cconst
27from acts_contrib.test_utils.net import connectivity_test_utils as cutils
28from acts_contrib.test_utils.net import net_test_utils as nutils
29from acts_contrib.test_utils.net.net_test_utils import start_tcpdump
30from acts_contrib.test_utils.net.net_test_utils import stop_tcpdump
31from acts_contrib.test_utils.tel import tel_test_utils as ttutils
32from acts_contrib.test_utils.tel.tel_test_utils import get_operator_name
33from acts_contrib.test_utils.tel.tel_test_utils import http_file_download_by_chrome
34from acts_contrib.test_utils.wifi import wifi_test_utils as wutils
Girish Moturu74ff5652019-11-17 13:19:26 -080035import queue
36from queue import Empty
37
Girish Moturu383e41a2018-01-02 13:51:15 -080038
39conn_test_class = "com.android.tests.connectivity.uid.ConnectivityTestActivity"
40android_os_class = "com.quicinc.cne.CNEService.CNEServiceApp"
Girish Moturu74ff5652019-11-17 13:19:26 -080041instr_cmd = ("am instrument -w -e command grant-all "
42 "com.android.permissionutils/.PermissionInstrumentation")
Girish Moturu383e41a2018-01-02 13:51:15 -080043
44HOUR_IN_MILLIS = 1000 * 60 * 60
45BYTE_TO_MB_ANDROID = 1000.0 * 1000.0
46BYTE_TO_MB = 1024.0 * 1024.0
47DOWNLOAD_PATH = "/sdcard/download/"
48DATA_USG_ERR = 2.2
49DATA_ERR = 0.2
50TIMEOUT = 2 * 60
51INC_DATA = 10
Girish Moturu74ff5652019-11-17 13:19:26 -080052AP_PASSPHRASE_LENGTH_2G = hostapd_constants.AP_PASSPHRASE_LENGTH_2G
53AP_SSID_LENGTH_2G = hostapd_constants.AP_SSID_LENGTH_2G
54RETRY_SLEEP = 3
55WIFI_SLEEP = 180
Girish Moturu383e41a2018-01-02 13:51:15 -080056
57
58class DataUsageTest(base_test.BaseTestClass):
Girish Moturu74ff5652019-11-17 13:19:26 -080059 """Data usage tests.
60
61 Requirements:
62 Two Pixel devices - one device with TMO and other with VZW SIM
63 WiFi network - Wifi network to test wifi data usage
64 """
Girish Moturu383e41a2018-01-02 13:51:15 -080065
66 def __init__(self, controllers):
67 base_test.BaseTestClass.__init__(self, controllers)
Girish Moturu383e41a2018-01-02 13:51:15 -080068
69 def setup_class(self):
Girish Moturu74ff5652019-11-17 13:19:26 -080070 """Setup devices for tests and unpack params."""
Girish Moturu383e41a2018-01-02 13:51:15 -080071
72 # unpack user params
Girish Moturu74ff5652019-11-17 13:19:26 -080073 req_params = ("wifi_network",
74 "file_size",
75 "download_file_ipv4",
76 "download_file_ipv6",
77 "dbs_supported_models")
Girish Moturu383e41a2018-01-02 13:51:15 -080078 self.unpack_userparams(req_params)
Girish Moturu74ff5652019-11-17 13:19:26 -080079 self.file_path = DOWNLOAD_PATH + self.download_file_ipv4.split("/")[-1]
80 self.file_size = float(self.file_size)
81
Girish Moturu383e41a2018-01-02 13:51:15 -080082 for ad in self.android_devices:
Girish Moturu74ff5652019-11-17 13:19:26 -080083 self.log.info("Operator on %s is %s" % \
84 (ad.serial, get_operator_name(self.log, ad)))
85 ad.reboot()
86 nutils.verify_lte_data_and_tethering_supported(ad)
87 nutils.set_chrome_browser_permissions(ad)
88 cutils.set_private_dns(ad, cconst.PRIVATE_DNS_MODE_OFF)
Girish Moturu383e41a2018-01-02 13:51:15 -080089 try:
90 ad.adb.shell(instr_cmd)
David Goldfarb78a3b672020-03-31 12:44:01 -070091 except AdbError:
Girish Moturu74ff5652019-11-17 13:19:26 -080092 self.log.warn("cmd %s failed on %s" % (instr_cmd, ad.serial))
93 self.tcpdumps = []
94 self.hs_enabled = []
Girish Moturu383e41a2018-01-02 13:51:15 -080095
Girish Moturu74ff5652019-11-17 13:19:26 -080096 def setup_test(self):
97 for ad in self.android_devices:
98 self.tcpdumps.append(start_tcpdump(ad, self.test_name))
99 ad.droid.wakeLockAcquireBright()
100 ad.droid.wakeUpNow()
101
102 def teardown_test(self):
103 for ad in self.hs_enabled:
104 try:
105 wutils.stop_wifi_tethering(ad)
106 except Exception as e:
107 self.log.warn("Failed to stop wifi tethering: %s" % e)
108 self.hs_enabled = []
109 for i in range(len(self.android_devices)):
110 ad = self.android_devices[i]
111 stop_tcpdump(ad, self.tcpdumps[i], self.test_name)
112 wutils.reset_wifi(ad)
113 sub_id = str(ad.droid.telephonyGetSubscriberId())
114 ad.droid.connectivityFactoryResetNetworkPolicies(sub_id)
115 ad.droid.telephonyToggleDataConnection(True)
116 ad.droid.wakeLockRelease()
117 ad.droid.goToSleepNow()
118 self.tcpdumps = []
Girish Moturu383e41a2018-01-02 13:51:15 -0800119
120 def teardown_class(self):
Girish Moturub9d573e2018-07-17 22:42:18 -0700121 for ad in self.android_devices:
Girish Moturu74ff5652019-11-17 13:19:26 -0800122 cutils.set_private_dns(ad, cconst.PRIVATE_DNS_MODE_OPPORTUNISTIC)
Girish Moturub9d573e2018-07-17 22:42:18 -0700123
124 def on_fail(self, test_name, begin_time):
125 for ad in self.android_devices:
126 ad.take_bug_report(test_name, begin_time)
Girish Moturu383e41a2018-01-02 13:51:15 -0800127
Girish Moturu74ff5652019-11-17 13:19:26 -0800128 ### Helper functions
Girish Moturu383e41a2018-01-02 13:51:15 -0800129
Girish Moturu74ff5652019-11-17 13:19:26 -0800130 def _download_data_through_app(self, ad, file_link):
131 """Download data through app on DUT.
Girish Moturu383e41a2018-01-02 13:51:15 -0800132
133 Args:
Girish Moturu74ff5652019-11-17 13:19:26 -0800134 ad: DUT to download the file on
135 file_link: http link of the file to download
Girish Moturu383e41a2018-01-02 13:51:15 -0800136
137 Returns:
Girish Moturu74ff5652019-11-17 13:19:26 -0800138 True if file download is successful, False if not
Girish Moturu383e41a2018-01-02 13:51:15 -0800139 """
Girish Moturu74ff5652019-11-17 13:19:26 -0800140 intent = ad.droid.createIntentForClassName(conn_test_class)
141 json_obj = {"url": file_link}
Girish Moturu383e41a2018-01-02 13:51:15 -0800142 ad.droid.launchForResultWithIntent(intent, json_obj)
143 download_status = False
144 end_time = time.time() + TIMEOUT
145 while time.time() < end_time:
146 download_status = ttutils._check_file_existance(
147 ad, self.file_path, self.file_size * BYTE_TO_MB)
148 if download_status:
149 self.log.info("Delete file: %s", self.file_path)
150 ad.adb.shell("rm %s" % self.file_path, ignore_status=True)
151 break
Girish Moturu74ff5652019-11-17 13:19:26 -0800152 time.sleep(RETRY_SLEEP*2) # wait to check if download is complete
Girish Moturu383e41a2018-01-02 13:51:15 -0800153 return download_status
154
Girish Moturu74ff5652019-11-17 13:19:26 -0800155 def _get_total_data_usage_for_device(self, ad, conn_type):
156 """Get total data usage in MB for device.
Girish Moturu383e41a2018-01-02 13:51:15 -0800157
158 Args:
Girish Moturu74ff5652019-11-17 13:19:26 -0800159 ad: android device object
160 conn_type: MOBILE/WIFI data usage
Girish Moturu383e41a2018-01-02 13:51:15 -0800161
162 Returns:
163 Data usage in MB
164 """
Girish Moturu74ff5652019-11-17 13:19:26 -0800165 sub_id = str(ad.droid.telephonyGetSubscriberId())
Girish Moturu383e41a2018-01-02 13:51:15 -0800166 end_time = int(time.time() * 1000) + 2 * HOUR_IN_MILLIS
Girish Moturu74ff5652019-11-17 13:19:26 -0800167 data_usage = ad.droid.connectivityQuerySummaryForDevice(
168 conn_type, sub_id, 0, end_time)
Girish Moturu383e41a2018-01-02 13:51:15 -0800169 data_usage /= BYTE_TO_MB_ANDROID
170 self.log.info("Total data usage is: %s" % data_usage)
171 return data_usage
172
173 def _get_data_usage_for_uid_rx(self, ad, conn_type, uid):
Girish Moturu74ff5652019-11-17 13:19:26 -0800174 """Get data usage for UID in Rx Bytes.
Girish Moturu383e41a2018-01-02 13:51:15 -0800175
176 Args:
Girish Moturu74ff5652019-11-17 13:19:26 -0800177 ad: DUT to get data usage from
178 conn_type: MOBILE/WIFI data usage
179 uid: UID of the app
Girish Moturu383e41a2018-01-02 13:51:15 -0800180
181 Returns:
182 Data usage in MB
183 """
184 subscriber_id = ad.droid.telephonyGetSubscriberId()
185 end_time = int(time.time() * 1000) + 2 * HOUR_IN_MILLIS
186 data_usage = ad.droid.connectivityQueryDetailsForUidRxBytes(
187 conn_type, subscriber_id, 0, end_time, uid)
188 return data_usage/BYTE_TO_MB_ANDROID
189
190 def _get_data_usage_for_device_rx(self, ad, conn_type):
Girish Moturu74ff5652019-11-17 13:19:26 -0800191 """Get total data usage in rx bytes for device.
Girish Moturu383e41a2018-01-02 13:51:15 -0800192
193 Args:
Girish Moturu74ff5652019-11-17 13:19:26 -0800194 ad: DUT to get data usage from
195 conn_type: MOBILE/WIFI data usage
Girish Moturu383e41a2018-01-02 13:51:15 -0800196
197 Returns:
198 Data usage in MB
199 """
200 subscriber_id = ad.droid.telephonyGetSubscriberId()
201 end_time = int(time.time() * 1000) + 2 * HOUR_IN_MILLIS
202 data_usage = ad.droid.connectivityQuerySummaryForDeviceRxBytes(
203 conn_type, subscriber_id, 0, end_time)
204 return data_usage/BYTE_TO_MB_ANDROID
205
Girish Moturu74ff5652019-11-17 13:19:26 -0800206 def _get_data_usage(self, ad, conn_type):
207 """Get data usage.
208
209 Args:
210 ad: DUT to get data usage from
211 conn_type: MOBILE/WIFI data usage
212
213 Returns:
214 Tuple of Android Os app, Conn UID app, Total data usages
215 """
216 android_os_uid = ad.droid.getUidForPackage(android_os_class)
217 conn_test_uid = ad.droid.getUidForPackage(conn_test_class)
218 aos = self._get_data_usage_for_uid_rx(ad, conn_type, android_os_uid)
219 app = self._get_data_usage_for_uid_rx(ad, conn_type, conn_test_uid)
220 tot = self._get_data_usage_for_device_rx(ad, conn_type)
221 self.log.info("Android Os data usage: %s" % aos)
222 self.log.info("Conn UID Test data usage: %s" % app)
223 self.log.info("Total data usage: %s" % tot)
224 return (aos, app, tot)
225
226 def _listen_for_network_callback(self, ad, event, q):
227 """Verify network callback for data usage.
228
229 Args:
230 ad: DUT to get the network callback for
231 event: Network callback event
232 q: queue object
233
234 Returns:
235 True: if the expected network callback found, False if not
236 """
237 key = ad.droid.connectivityRegisterDefaultNetworkCallback()
238 ad.droid.connectivityNetworkCallbackStartListeningForEvent(key, event)
239
240 curr_time = time.time()
241 status = False
242 while time.time() < curr_time + TIMEOUT:
243 try:
244 nc_event = ad.ed.pop_event("NetworkCallback")
245 self.log.info("Received: %s" %
246 nc_event["data"]["networkCallbackEvent"])
247 if nc_event["data"]["networkCallbackEvent"] == event:
248 status = True
249 break
250 except Empty:
251 pass
252
253 ad.droid.connectivityNetworkCallbackStopListeningForEvent(key, event)
254 ad.droid.connectivityUnregisterNetworkCallback(key)
255 q.put(status)
256
257 def _test_data_usage_downlink(self,
258 dut_a,
259 dut_b,
260 file_link,
261 data_usage,
262 tethering=False,
263 connect_wifi=False,
264 app_inc=True):
265 """Verify data usage.
266
267 Steps:
268 1. Get the current data usage of ConnUIDTest and Android OS apps
269 2. DUT is on LTE data (on wifi if connect_wifi is True)
270 3. Download file of size xMB through ConnUIDTest app
271 4. Verify that data usage of Android OS app did not change
272 5. Verify that data usage of ConnUIDTest app increased by ~xMB
273 6. Verify that data usage of device also increased by ~xMB
274
275 Args:
276 dut_a: DUT on which data usage need to be verified
277 dut_b: DUT on which data is downloaded
278 file_link: Link used to download data
279 data_usage: specifies if MOBILE or WIFI data is calculated
280 tethering: if True, enable hotspot on dut_a and connect dut_b to it
281 connect_wifi: if True, connect dut_a to a wifi network
282 app_inc: if True, verify app data usage on dut_a is increased
283 """
284 if connect_wifi:
285 dut_a.droid.telephonyToggleDataConnection(False)
286 wutils.start_wifi_connection_scan_and_ensure_network_found(
287 dut_a, self.wifi_network["SSID"])
288 wutils.wifi_connect(dut_a, self.wifi_network)
289 # sleep for some time after connecting to wifi. some apps use wifi
290 # data when connected initially. waiting after connecting to wifi
291 # ensures correct wifi data usage calculation
292 time.sleep(WIFI_SLEEP)
293
294 if tethering:
295 ssid = "hs_%s" % utils.rand_ascii_str(AP_SSID_LENGTH_2G)
296 pwd = utils.rand_ascii_str(AP_PASSPHRASE_LENGTH_2G)
297 network = {wutils.WifiEnums.SSID_KEY: ssid,
298 wutils.WifiEnums.PWD_KEY: pwd}
299 dut_b.droid.telephonyToggleDataConnection(False)
300 wutils.start_wifi_tethering(dut_a,
301 network[wutils.WifiEnums.SSID_KEY],
302 network[wutils.WifiEnums.PWD_KEY])
303 self.hs_enabled.append(dut_a)
304 wutils.start_wifi_connection_scan_and_ensure_network_found(
305 dut_b, network[wutils.WifiEnums.SSID_KEY])
306 wutils.wifi_connect(dut_b, network)
307 # sleep for some time after connecting to wifi. though wifi hotspot
308 # is metered, some apps would still use wifi data when connected
309 # initially. this ensures correct wifi data usage calculation
310 time.sleep(WIFI_SLEEP)
311
312 # get pre data usage
313 (aos_pre, app_pre, total_pre) = self._get_data_usage(dut_a, data_usage)
314
315 # download file through app
316 status = self._download_data_through_app(dut_b, file_link)
317 asserts.assert_true(status, "Failed to download file: %s" % file_link)
318
319 # get new data usage
320 aos_exp = DATA_ERR
321 app_exp = self.file_size + DATA_USG_ERR
322 file_size = self.file_size
323 if not app_inc:
324 app_exp = DATA_ERR
325 file_size = 0
326 total_exp = self.file_size + DATA_USG_ERR
327
328 # somtimes data usage is not increased immediately.
329 # re-tries until the data usage is closed to expected value.
330 curr_time = time.time()
331 while time.time() < curr_time + TIMEOUT:
332 (aos_pst, app_pst, total_pst) = self._get_data_usage(dut_a,
333 data_usage)
334 if total_pst - total_pre >= self.file_size and \
335 app_pst - app_pre >= file_size:
336 # wait for some time to verify that data doesn't increase
337 time.sleep(RETRY_SLEEP*2)
338 break
339 time.sleep(RETRY_SLEEP) # wait before retry
340 (aos_pst, app_pst, total_pst) = self._get_data_usage(dut_a, data_usage)
341
342 # verify data usage
343 aos_diff = aos_pst - aos_pre
344 app_diff = app_pst - app_pre
345 total_diff = total_pst - total_pre
346 self.log.info("Usage of Android OS increased: %sMB, expected: %sMB" % \
347 (aos_diff, aos_exp))
348 self.log.info("Usage of ConnUID app increased: %sMB, expected: %sMB" % \
349 (app_diff, app_exp))
350 self.log.info("Usage on the device increased: %sMB, expected: %sMB" % \
351 (total_diff, total_exp))
352
353 asserts.assert_true(
354 (aos_diff < aos_exp) and (file_size <= app_diff < app_exp) and \
355 (self.file_size <= total_diff < total_exp),
356 "Incorrect data usage count")
357
358 def _test_data_usage_limit_downlink(self,
359 dut_a,
360 dut_b,
361 file_link,
362 data_usage,
363 tethering=False):
364 """Verify data usage limit reached.
365
366 Steps:
367 1. Set the data usage limit to current data usage + 10MB
368 2. If tested for tethered device, start wifi hotspot and
369 connect DUT to it.
370 3. If tested for tethered device, download 20MB data from
371 tethered device else download on the same DUT
372 4. Verify file download stops and data limit reached
373
374 Args:
375 dut_a: DUT on which data usage limit needs to be verified
376 dut_b: DUT on which data needs to be downloaded
377 file_link: specifies if the link is IPv4 or IPv6
378 data_usage: specifies if MOBILE or WIFI data usage
379 tethering: if wifi hotspot should be enabled on dut_a
380 """
381 sub_id = str(dut_a.droid.telephonyGetSubscriberId())
382
383 # enable hotspot and connect dut_b to it.
384 if tethering:
385 ssid = "hs_%s" % utils.rand_ascii_str(AP_SSID_LENGTH_2G)
386 pwd = utils.rand_ascii_str(AP_PASSPHRASE_LENGTH_2G)
387 network = {wutils.WifiEnums.SSID_KEY: ssid,
388 wutils.WifiEnums.PWD_KEY: pwd}
389 dut_b.droid.telephonyToggleDataConnection(False)
390 wutils.start_wifi_tethering(dut_a,
391 network[wutils.WifiEnums.SSID_KEY],
392 network[wutils.WifiEnums.PWD_KEY])
393 self.hs_enabled.append(dut_a)
394 wutils.start_wifi_connection_scan_and_ensure_network_found(
395 dut_b, network[wutils.WifiEnums.SSID_KEY])
396 wutils.wifi_connect(dut_b, network)
397
398 # get pre mobile data usage
399 total_pre = self._get_total_data_usage_for_device(dut_a, data_usage)
400
401 # set data usage limit to current usage limit + 10MB
402 self.log.info("Set data usage limit to %sMB" % (total_pre + INC_DATA))
403 dut_a.droid.connectivitySetDataUsageLimit(
404 sub_id, int((total_pre + INC_DATA) * BYTE_TO_MB_ANDROID))
405
406 # download file on dut_b and look for BlockedStatusChanged callback
407 q = queue.Queue()
408 t = threading.Thread(target=self._listen_for_network_callback,
409 args=(dut_a, "BlockedStatusChanged", q))
410 t.daemon = True
411 t.start()
412 status = http_file_download_by_chrome(
413 dut_b, file_link, self.file_size, True, TIMEOUT)
414 t.join()
415 cb_res = q.get()
416
417 # verify file download fails and expected callback is recevied
418 asserts.assert_true(cb_res,
419 "Failed to verify blocked status network callback")
420 asserts.assert_true(not status,
421 "File download successful. Expected to fail")
422
423 ### Test Cases
Girish Moturu383e41a2018-01-02 13:51:15 -0800424
425 @test_tracker_info(uuid="b2d9b36c-3a1c-47ca-a9c1-755450abb20c")
Girish Moturu74ff5652019-11-17 13:19:26 -0800426 def test_mobile_data_usage_downlink_ipv4_tmo(self):
427 """Verify mobile data usage over IPv4 and TMO carrier."""
428 self._test_data_usage_downlink(self.android_devices[0],
429 self.android_devices[0],
430 self.download_file_ipv4,
431 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800432
Girish Moturu74ff5652019-11-17 13:19:26 -0800433 @test_tracker_info(uuid="fbbb58ed-d573-4bbd-bd5d-0bc540507896")
434 def test_mobile_data_usage_downlink_ipv6_tmo(self):
435 """Verify mobile data usage over IPv6 and TMO carrier."""
436 self._test_data_usage_downlink(self.android_devices[0],
437 self.android_devices[0],
438 self.download_file_ipv6,
439 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800440
Girish Moturu74ff5652019-11-17 13:19:26 -0800441 @test_tracker_info(uuid="6562d626-2271-4d93-96c0-f33138635330")
442 def test_mobile_data_usage_downlink_ipv4_vzw(self):
443 """Verify mobile data usage over IPv4 and VZW carrier."""
444 self._test_data_usage_downlink(self.android_devices[1],
445 self.android_devices[1],
446 self.download_file_ipv4,
447 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800448
Girish Moturu74ff5652019-11-17 13:19:26 -0800449 @test_tracker_info(uuid="2edf94cf-d937-459a-a7e4-2c679803c4d3")
450 def test_mobile_data_usage_downlink_ipv6_vzw(self):
451 """Verify mobile data usage over IPv6 and VZW carrier."""
452 self._test_data_usage_downlink(self.android_devices[1],
453 self.android_devices[1],
454 self.download_file_ipv6,
455 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800456
457 @test_tracker_info(uuid="fe1390e5-635c-49a9-b050-032e66f52f40")
Girish Moturu74ff5652019-11-17 13:19:26 -0800458 def test_wifi_tethering_mobile_data_usage_downlink_ipv4_tmo(self):
459 """Verify mobile data usage with tethered device over IPv4 and TMO."""
460 self._test_data_usage_downlink(self.android_devices[0],
461 self.android_devices[1],
462 self.download_file_ipv4,
463 cconst.TYPE_MOBILE,
464 True,
465 False,
466 False)
Girish Moturu383e41a2018-01-02 13:51:15 -0800467
Girish Moturu74ff5652019-11-17 13:19:26 -0800468 @test_tracker_info(uuid="d7fde6b2-6672-484a-a2fd-47858f5a163f")
469 def test_wifi_tethering_mobile_data_usage_downlink_ipv6_tmo(self):
470 """Verify mobile data usage with tethered device over IPv6 and TMO."""
471 self._test_data_usage_downlink(self.android_devices[0],
472 self.android_devices[1],
473 self.download_file_ipv6,
474 cconst.TYPE_MOBILE,
475 True,
476 False,
477 False)
Girish Moturu383e41a2018-01-02 13:51:15 -0800478
Girish Moturu74ff5652019-11-17 13:19:26 -0800479 @test_tracker_info(uuid="6285ef69-37a8-4069-8cb2-21dc266a57c3")
480 def test_wifi_tethering_mobile_data_usage_downlink_ipv4_vzw(self):
481 """Verify mobile data usage with tethered device over IPv4 and VZW."""
482 self._test_data_usage_downlink(self.android_devices[1],
483 self.android_devices[0],
484 self.download_file_ipv4,
485 cconst.TYPE_MOBILE,
486 True,
487 False,
488 False)
Girish Moturu383e41a2018-01-02 13:51:15 -0800489
Girish Moturu74ff5652019-11-17 13:19:26 -0800490 @test_tracker_info(uuid="565fc7e3-d7cf-43cc-8982-4f17999cf579")
491 def test_wifi_tethering_mobile_data_usage_downlink_ipv6_vzw(self):
492 """Verify mobile data usage with tethered device over IPv6 and VZW."""
493 self._test_data_usage_downlink(self.android_devices[1],
494 self.android_devices[0],
495 self.download_file_ipv6,
496 cconst.TYPE_MOBILE,
497 True,
498 False,
499 False)
Girish Moturu383e41a2018-01-02 13:51:15 -0800500
Girish Moturu74ff5652019-11-17 13:19:26 -0800501 @test_tracker_info(uuid="72ddb42a-5942-4a6a-8b20-2181c41b2765")
502 def test_wifi_data_usage_downlink_ipv4(self):
503 """Verify wifi data usage over IPv4."""
504 self._test_data_usage_downlink(self.android_devices[0],
505 self.android_devices[0],
506 self.download_file_ipv4,
507 cconst.TYPE_WIFI,
508 False,
509 True,
510 True)
Girish Moturu383e41a2018-01-02 13:51:15 -0800511
Girish Moturu74ff5652019-11-17 13:19:26 -0800512 @test_tracker_info(uuid="76b316f5-2946-4757-b5d6-62a8b1fd627e")
513 def test_wifi_data_usage_downlink_ipv6(self):
514 """Verify wifi data usage over IPv6."""
515 self._test_data_usage_downlink(self.android_devices[0],
516 self.android_devices[0],
517 self.download_file_ipv6,
518 cconst.TYPE_WIFI,
519 False,
520 True,
521 True)
Girish Moturu383e41a2018-01-02 13:51:15 -0800522
Girish Moturu74ff5652019-11-17 13:19:26 -0800523 @test_tracker_info(uuid="4be5f2d4-9bc6-4190-813e-044f00d94aa6")
524 def test_wifi_tethering_wifi_data_usage_downlink_ipv4(self):
525 """Verify wifi data usage with tethered device over IPv4."""
526 asserts.skip_if(
527 self.android_devices[0].model not in self.dbs_supported_models,
528 "Device %s does not support dual interfaces." %
529 self.android_devices[0].model)
530 self._test_data_usage_downlink(self.android_devices[0],
531 self.android_devices[1],
532 self.download_file_ipv4,
533 cconst.TYPE_WIFI,
534 True,
535 True,
536 False)
Girish Moturu383e41a2018-01-02 13:51:15 -0800537
538 @test_tracker_info(uuid="ac4750fd-20d9-451d-a85b-79fdbaa7da97")
Girish Moturu74ff5652019-11-17 13:19:26 -0800539 def test_data_usage_limit_downlink_ipv4_tmo(self):
540 """Verify data limit for TMO with IPv4 link."""
541 self._test_data_usage_limit_downlink(self.android_devices[0],
542 self.android_devices[0],
543 self.download_file_ipv4,
544 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800545
Girish Moturu74ff5652019-11-17 13:19:26 -0800546 @test_tracker_info(uuid="6598732e-f4d3-40c7-a73b-e89bb3d196c5")
547 def test_data_usage_limit_downlink_ipv6_tmo(self):
548 """Verify data limit for TMO with IPv6 link."""
549 self._test_data_usage_limit_downlink(self.android_devices[0],
550 self.android_devices[0],
551 self.download_file_ipv6,
552 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800553
Girish Moturu74ff5652019-11-17 13:19:26 -0800554 @test_tracker_info(uuid="d1ef0405-cf58-4141-94c7-cfa0c9d14438")
555 def test_data_usage_limit_downlink_ipv4_vzw(self):
556 """Verify data limit for VZW with IPv4 link."""
557 self._test_data_usage_limit_downlink(self.android_devices[1],
558 self.android_devices[1],
559 self.download_file_ipv4,
560 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800561
Girish Moturu74ff5652019-11-17 13:19:26 -0800562 @test_tracker_info(uuid="18d169d9-fc4f-4782-8f5f-fc96b8976d03")
563 def test_data_usage_limit_downlink_ipv6_vzw(self):
564 """Verify data limit for VZW with IPv6 link."""
565 self._test_data_usage_limit_downlink(self.android_devices[1],
566 self.android_devices[1],
567 self.download_file_ipv6,
568 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800569
570 @test_tracker_info(uuid="7c9ab330-9645-4030-bb1e-dcce126944a2")
Girish Moturu74ff5652019-11-17 13:19:26 -0800571 def test_wifi_tethering_data_usage_limit_downlink_ipv4_tmo(self):
572 """Verify data limit for TMO from tethered device with IPv4 link."""
573 self._test_data_usage_limit_downlink(self.android_devices[0],
574 self.android_devices[1],
575 self.download_file_ipv4,
576 cconst.TYPE_MOBILE,
577 True)
Girish Moturu383e41a2018-01-02 13:51:15 -0800578
Girish Moturu74ff5652019-11-17 13:19:26 -0800579 @test_tracker_info(uuid="1cafdaf7-a41e-4d19-b08a-ae094d796426")
580 def test_wifi_tethering_data_usage_limit_downlink_ipv6_tmo(self):
581 """Verify data limit for TMO from tethered device with IPv6 link."""
582 self._test_data_usage_limit_downlink(self.android_devices[0],
583 self.android_devices[1],
584 self.download_file_ipv6,
585 cconst.TYPE_MOBILE,
586 True)
Girish Moturu383e41a2018-01-02 13:51:15 -0800587
Girish Moturu74ff5652019-11-17 13:19:26 -0800588 @test_tracker_info(uuid="bd5a8f93-4e2f-474d-a01d-4bb5117d5350")
589 def test_wifi_tethering_data_usage_limit_downlink_ipv4_vzw(self):
590 """Verify data limit for VZW from tethered device with IPv4 link."""
591 self._test_data_usage_limit_downlink(self.android_devices[1],
592 self.android_devices[0],
593 self.download_file_ipv4,
594 cconst.TYPE_MOBILE,
595 True)
Girish Moturu383e41a2018-01-02 13:51:15 -0800596
Girish Moturu74ff5652019-11-17 13:19:26 -0800597 @test_tracker_info(uuid="ec082fe5-6af1-425e-ace6-4726930bf62f")
598 def test_wifi_tethering_data_usage_limit_downlink_ipv6_vzw(self):
599 """Verify data limit for VZW from tethered device with IPv6 link."""
600 self._test_data_usage_limit_downlink(self.android_devices[1],
601 self.android_devices[0],
602 self.download_file_ipv6,
603 cconst.TYPE_MOBILE,
604 True)