blob: 98011d876f831248bffe360ac54db79649f84056 [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
Girish Moturu74ff5652019-11-17 13:19:26 -080023from acts.controllers.ap_lib import hostapd_constants
Girish Moturu383e41a2018-01-02 13:51:15 -080024from acts.test_decorators import test_tracker_info
25from acts.test_utils.net import connectivity_const as cconst
Girish Moturu74ff5652019-11-17 13:19:26 -080026from acts.test_utils.net import connectivity_test_utils as cutils
27from acts.test_utils.net import net_test_utils as nutils
28from acts.test_utils.net.net_test_utils import start_tcpdump
29from acts.test_utils.net.net_test_utils import stop_tcpdump
Girish Moturu383e41a2018-01-02 13:51:15 -080030from acts.test_utils.tel import tel_test_utils as ttutils
Girish Moturu74ff5652019-11-17 13:19:26 -080031from acts.test_utils.tel.tel_test_utils import get_operator_name
32from acts.test_utils.tel.tel_test_utils import http_file_download_by_chrome
Girish Moturu383e41a2018-01-02 13:51:15 -080033from acts.test_utils.wifi import wifi_test_utils as wutils
Girish Moturu74ff5652019-11-17 13:19:26 -080034import queue
35from queue import Empty
36
Girish Moturu383e41a2018-01-02 13:51:15 -080037
38conn_test_class = "com.android.tests.connectivity.uid.ConnectivityTestActivity"
39android_os_class = "com.quicinc.cne.CNEService.CNEServiceApp"
Girish Moturu74ff5652019-11-17 13:19:26 -080040instr_cmd = ("am instrument -w -e command grant-all "
41 "com.android.permissionutils/.PermissionInstrumentation")
Girish Moturu383e41a2018-01-02 13:51:15 -080042
43HOUR_IN_MILLIS = 1000 * 60 * 60
44BYTE_TO_MB_ANDROID = 1000.0 * 1000.0
45BYTE_TO_MB = 1024.0 * 1024.0
46DOWNLOAD_PATH = "/sdcard/download/"
47DATA_USG_ERR = 2.2
48DATA_ERR = 0.2
49TIMEOUT = 2 * 60
50INC_DATA = 10
Girish Moturu74ff5652019-11-17 13:19:26 -080051AP_PASSPHRASE_LENGTH_2G = hostapd_constants.AP_PASSPHRASE_LENGTH_2G
52AP_SSID_LENGTH_2G = hostapd_constants.AP_SSID_LENGTH_2G
53RETRY_SLEEP = 3
54WIFI_SLEEP = 180
Girish Moturu383e41a2018-01-02 13:51:15 -080055
56
57class DataUsageTest(base_test.BaseTestClass):
Girish Moturu74ff5652019-11-17 13:19:26 -080058 """Data usage tests.
59
60 Requirements:
61 Two Pixel devices - one device with TMO and other with VZW SIM
62 WiFi network - Wifi network to test wifi data usage
63 """
Girish Moturu383e41a2018-01-02 13:51:15 -080064
65 def __init__(self, controllers):
66 base_test.BaseTestClass.__init__(self, controllers)
Girish Moturu383e41a2018-01-02 13:51:15 -080067
68 def setup_class(self):
Girish Moturu74ff5652019-11-17 13:19:26 -080069 """Setup devices for tests and unpack params."""
Girish Moturu383e41a2018-01-02 13:51:15 -080070
71 # unpack user params
Girish Moturu74ff5652019-11-17 13:19:26 -080072 req_params = ("wifi_network",
73 "file_size",
74 "download_file_ipv4",
75 "download_file_ipv6",
76 "dbs_supported_models")
Girish Moturu383e41a2018-01-02 13:51:15 -080077 self.unpack_userparams(req_params)
Girish Moturu74ff5652019-11-17 13:19:26 -080078 self.file_path = DOWNLOAD_PATH + self.download_file_ipv4.split("/")[-1]
79 self.file_size = float(self.file_size)
80
Girish Moturu383e41a2018-01-02 13:51:15 -080081 for ad in self.android_devices:
Girish Moturu74ff5652019-11-17 13:19:26 -080082 self.log.info("Operator on %s is %s" % \
83 (ad.serial, get_operator_name(self.log, ad)))
84 ad.reboot()
85 nutils.verify_lte_data_and_tethering_supported(ad)
86 nutils.set_chrome_browser_permissions(ad)
87 cutils.set_private_dns(ad, cconst.PRIVATE_DNS_MODE_OFF)
Girish Moturu383e41a2018-01-02 13:51:15 -080088 try:
89 ad.adb.shell(instr_cmd)
90 except adb.AdbError:
Girish Moturu74ff5652019-11-17 13:19:26 -080091 self.log.warn("cmd %s failed on %s" % (instr_cmd, ad.serial))
92 self.tcpdumps = []
93 self.hs_enabled = []
Girish Moturu383e41a2018-01-02 13:51:15 -080094
Girish Moturu74ff5652019-11-17 13:19:26 -080095 def setup_test(self):
96 for ad in self.android_devices:
97 self.tcpdumps.append(start_tcpdump(ad, self.test_name))
98 ad.droid.wakeLockAcquireBright()
99 ad.droid.wakeUpNow()
100
101 def teardown_test(self):
102 for ad in self.hs_enabled:
103 try:
104 wutils.stop_wifi_tethering(ad)
105 except Exception as e:
106 self.log.warn("Failed to stop wifi tethering: %s" % e)
107 self.hs_enabled = []
108 for i in range(len(self.android_devices)):
109 ad = self.android_devices[i]
110 stop_tcpdump(ad, self.tcpdumps[i], self.test_name)
111 wutils.reset_wifi(ad)
112 sub_id = str(ad.droid.telephonyGetSubscriberId())
113 ad.droid.connectivityFactoryResetNetworkPolicies(sub_id)
114 ad.droid.telephonyToggleDataConnection(True)
115 ad.droid.wakeLockRelease()
116 ad.droid.goToSleepNow()
117 self.tcpdumps = []
Girish Moturu383e41a2018-01-02 13:51:15 -0800118
119 def teardown_class(self):
Girish Moturub9d573e2018-07-17 22:42:18 -0700120 for ad in self.android_devices:
Girish Moturu74ff5652019-11-17 13:19:26 -0800121 cutils.set_private_dns(ad, cconst.PRIVATE_DNS_MODE_OPPORTUNISTIC)
Girish Moturub9d573e2018-07-17 22:42:18 -0700122
123 def on_fail(self, test_name, begin_time):
124 for ad in self.android_devices:
125 ad.take_bug_report(test_name, begin_time)
Girish Moturu383e41a2018-01-02 13:51:15 -0800126
Girish Moturu74ff5652019-11-17 13:19:26 -0800127 ### Helper functions
Girish Moturu383e41a2018-01-02 13:51:15 -0800128
Girish Moturu74ff5652019-11-17 13:19:26 -0800129 def _download_data_through_app(self, ad, file_link):
130 """Download data through app on DUT.
Girish Moturu383e41a2018-01-02 13:51:15 -0800131
132 Args:
Girish Moturu74ff5652019-11-17 13:19:26 -0800133 ad: DUT to download the file on
134 file_link: http link of the file to download
Girish Moturu383e41a2018-01-02 13:51:15 -0800135
136 Returns:
Girish Moturu74ff5652019-11-17 13:19:26 -0800137 True if file download is successful, False if not
Girish Moturu383e41a2018-01-02 13:51:15 -0800138 """
Girish Moturu74ff5652019-11-17 13:19:26 -0800139 intent = ad.droid.createIntentForClassName(conn_test_class)
140 json_obj = {"url": file_link}
Girish Moturu383e41a2018-01-02 13:51:15 -0800141 ad.droid.launchForResultWithIntent(intent, json_obj)
142 download_status = False
143 end_time = time.time() + TIMEOUT
144 while time.time() < end_time:
145 download_status = ttutils._check_file_existance(
146 ad, self.file_path, self.file_size * BYTE_TO_MB)
147 if download_status:
148 self.log.info("Delete file: %s", self.file_path)
149 ad.adb.shell("rm %s" % self.file_path, ignore_status=True)
150 break
Girish Moturu74ff5652019-11-17 13:19:26 -0800151 time.sleep(RETRY_SLEEP*2) # wait to check if download is complete
Girish Moturu383e41a2018-01-02 13:51:15 -0800152 return download_status
153
Girish Moturu74ff5652019-11-17 13:19:26 -0800154 def _get_total_data_usage_for_device(self, ad, conn_type):
155 """Get total data usage in MB for device.
Girish Moturu383e41a2018-01-02 13:51:15 -0800156
157 Args:
Girish Moturu74ff5652019-11-17 13:19:26 -0800158 ad: android device object
159 conn_type: MOBILE/WIFI data usage
Girish Moturu383e41a2018-01-02 13:51:15 -0800160
161 Returns:
162 Data usage in MB
163 """
Girish Moturu74ff5652019-11-17 13:19:26 -0800164 sub_id = str(ad.droid.telephonyGetSubscriberId())
Girish Moturu383e41a2018-01-02 13:51:15 -0800165 end_time = int(time.time() * 1000) + 2 * HOUR_IN_MILLIS
Girish Moturu74ff5652019-11-17 13:19:26 -0800166 data_usage = ad.droid.connectivityQuerySummaryForDevice(
167 conn_type, sub_id, 0, end_time)
Girish Moturu383e41a2018-01-02 13:51:15 -0800168 data_usage /= BYTE_TO_MB_ANDROID
169 self.log.info("Total data usage is: %s" % data_usage)
170 return data_usage
171
172 def _get_data_usage_for_uid_rx(self, ad, conn_type, uid):
Girish Moturu74ff5652019-11-17 13:19:26 -0800173 """Get data usage for UID in Rx Bytes.
Girish Moturu383e41a2018-01-02 13:51:15 -0800174
175 Args:
Girish Moturu74ff5652019-11-17 13:19:26 -0800176 ad: DUT to get data usage from
177 conn_type: MOBILE/WIFI data usage
178 uid: UID of the app
Girish Moturu383e41a2018-01-02 13:51:15 -0800179
180 Returns:
181 Data usage in MB
182 """
183 subscriber_id = ad.droid.telephonyGetSubscriberId()
184 end_time = int(time.time() * 1000) + 2 * HOUR_IN_MILLIS
185 data_usage = ad.droid.connectivityQueryDetailsForUidRxBytes(
186 conn_type, subscriber_id, 0, end_time, uid)
187 return data_usage/BYTE_TO_MB_ANDROID
188
189 def _get_data_usage_for_device_rx(self, ad, conn_type):
Girish Moturu74ff5652019-11-17 13:19:26 -0800190 """Get total data usage in rx bytes for device.
Girish Moturu383e41a2018-01-02 13:51:15 -0800191
192 Args:
Girish Moturu74ff5652019-11-17 13:19:26 -0800193 ad: DUT to get data usage from
194 conn_type: MOBILE/WIFI data usage
Girish Moturu383e41a2018-01-02 13:51:15 -0800195
196 Returns:
197 Data usage in MB
198 """
199 subscriber_id = ad.droid.telephonyGetSubscriberId()
200 end_time = int(time.time() * 1000) + 2 * HOUR_IN_MILLIS
201 data_usage = ad.droid.connectivityQuerySummaryForDeviceRxBytes(
202 conn_type, subscriber_id, 0, end_time)
203 return data_usage/BYTE_TO_MB_ANDROID
204
Girish Moturu74ff5652019-11-17 13:19:26 -0800205 def _get_data_usage(self, ad, conn_type):
206 """Get data usage.
207
208 Args:
209 ad: DUT to get data usage from
210 conn_type: MOBILE/WIFI data usage
211
212 Returns:
213 Tuple of Android Os app, Conn UID app, Total data usages
214 """
215 android_os_uid = ad.droid.getUidForPackage(android_os_class)
216 conn_test_uid = ad.droid.getUidForPackage(conn_test_class)
217 aos = self._get_data_usage_for_uid_rx(ad, conn_type, android_os_uid)
218 app = self._get_data_usage_for_uid_rx(ad, conn_type, conn_test_uid)
219 tot = self._get_data_usage_for_device_rx(ad, conn_type)
220 self.log.info("Android Os data usage: %s" % aos)
221 self.log.info("Conn UID Test data usage: %s" % app)
222 self.log.info("Total data usage: %s" % tot)
223 return (aos, app, tot)
224
225 def _listen_for_network_callback(self, ad, event, q):
226 """Verify network callback for data usage.
227
228 Args:
229 ad: DUT to get the network callback for
230 event: Network callback event
231 q: queue object
232
233 Returns:
234 True: if the expected network callback found, False if not
235 """
236 key = ad.droid.connectivityRegisterDefaultNetworkCallback()
237 ad.droid.connectivityNetworkCallbackStartListeningForEvent(key, event)
238
239 curr_time = time.time()
240 status = False
241 while time.time() < curr_time + TIMEOUT:
242 try:
243 nc_event = ad.ed.pop_event("NetworkCallback")
244 self.log.info("Received: %s" %
245 nc_event["data"]["networkCallbackEvent"])
246 if nc_event["data"]["networkCallbackEvent"] == event:
247 status = True
248 break
249 except Empty:
250 pass
251
252 ad.droid.connectivityNetworkCallbackStopListeningForEvent(key, event)
253 ad.droid.connectivityUnregisterNetworkCallback(key)
254 q.put(status)
255
256 def _test_data_usage_downlink(self,
257 dut_a,
258 dut_b,
259 file_link,
260 data_usage,
261 tethering=False,
262 connect_wifi=False,
263 app_inc=True):
264 """Verify data usage.
265
266 Steps:
267 1. Get the current data usage of ConnUIDTest and Android OS apps
268 2. DUT is on LTE data (on wifi if connect_wifi is True)
269 3. Download file of size xMB through ConnUIDTest app
270 4. Verify that data usage of Android OS app did not change
271 5. Verify that data usage of ConnUIDTest app increased by ~xMB
272 6. Verify that data usage of device also increased by ~xMB
273
274 Args:
275 dut_a: DUT on which data usage need to be verified
276 dut_b: DUT on which data is downloaded
277 file_link: Link used to download data
278 data_usage: specifies if MOBILE or WIFI data is calculated
279 tethering: if True, enable hotspot on dut_a and connect dut_b to it
280 connect_wifi: if True, connect dut_a to a wifi network
281 app_inc: if True, verify app data usage on dut_a is increased
282 """
283 if connect_wifi:
284 dut_a.droid.telephonyToggleDataConnection(False)
285 wutils.start_wifi_connection_scan_and_ensure_network_found(
286 dut_a, self.wifi_network["SSID"])
287 wutils.wifi_connect(dut_a, self.wifi_network)
288 # sleep for some time after connecting to wifi. some apps use wifi
289 # data when connected initially. waiting after connecting to wifi
290 # ensures correct wifi data usage calculation
291 time.sleep(WIFI_SLEEP)
292
293 if tethering:
294 ssid = "hs_%s" % utils.rand_ascii_str(AP_SSID_LENGTH_2G)
295 pwd = utils.rand_ascii_str(AP_PASSPHRASE_LENGTH_2G)
296 network = {wutils.WifiEnums.SSID_KEY: ssid,
297 wutils.WifiEnums.PWD_KEY: pwd}
298 dut_b.droid.telephonyToggleDataConnection(False)
299 wutils.start_wifi_tethering(dut_a,
300 network[wutils.WifiEnums.SSID_KEY],
301 network[wutils.WifiEnums.PWD_KEY])
302 self.hs_enabled.append(dut_a)
303 wutils.start_wifi_connection_scan_and_ensure_network_found(
304 dut_b, network[wutils.WifiEnums.SSID_KEY])
305 wutils.wifi_connect(dut_b, network)
306 # sleep for some time after connecting to wifi. though wifi hotspot
307 # is metered, some apps would still use wifi data when connected
308 # initially. this ensures correct wifi data usage calculation
309 time.sleep(WIFI_SLEEP)
310
311 # get pre data usage
312 (aos_pre, app_pre, total_pre) = self._get_data_usage(dut_a, data_usage)
313
314 # download file through app
315 status = self._download_data_through_app(dut_b, file_link)
316 asserts.assert_true(status, "Failed to download file: %s" % file_link)
317
318 # get new data usage
319 aos_exp = DATA_ERR
320 app_exp = self.file_size + DATA_USG_ERR
321 file_size = self.file_size
322 if not app_inc:
323 app_exp = DATA_ERR
324 file_size = 0
325 total_exp = self.file_size + DATA_USG_ERR
326
327 # somtimes data usage is not increased immediately.
328 # re-tries until the data usage is closed to expected value.
329 curr_time = time.time()
330 while time.time() < curr_time + TIMEOUT:
331 (aos_pst, app_pst, total_pst) = self._get_data_usage(dut_a,
332 data_usage)
333 if total_pst - total_pre >= self.file_size and \
334 app_pst - app_pre >= file_size:
335 # wait for some time to verify that data doesn't increase
336 time.sleep(RETRY_SLEEP*2)
337 break
338 time.sleep(RETRY_SLEEP) # wait before retry
339 (aos_pst, app_pst, total_pst) = self._get_data_usage(dut_a, data_usage)
340
341 # verify data usage
342 aos_diff = aos_pst - aos_pre
343 app_diff = app_pst - app_pre
344 total_diff = total_pst - total_pre
345 self.log.info("Usage of Android OS increased: %sMB, expected: %sMB" % \
346 (aos_diff, aos_exp))
347 self.log.info("Usage of ConnUID app increased: %sMB, expected: %sMB" % \
348 (app_diff, app_exp))
349 self.log.info("Usage on the device increased: %sMB, expected: %sMB" % \
350 (total_diff, total_exp))
351
352 asserts.assert_true(
353 (aos_diff < aos_exp) and (file_size <= app_diff < app_exp) and \
354 (self.file_size <= total_diff < total_exp),
355 "Incorrect data usage count")
356
357 def _test_data_usage_limit_downlink(self,
358 dut_a,
359 dut_b,
360 file_link,
361 data_usage,
362 tethering=False):
363 """Verify data usage limit reached.
364
365 Steps:
366 1. Set the data usage limit to current data usage + 10MB
367 2. If tested for tethered device, start wifi hotspot and
368 connect DUT to it.
369 3. If tested for tethered device, download 20MB data from
370 tethered device else download on the same DUT
371 4. Verify file download stops and data limit reached
372
373 Args:
374 dut_a: DUT on which data usage limit needs to be verified
375 dut_b: DUT on which data needs to be downloaded
376 file_link: specifies if the link is IPv4 or IPv6
377 data_usage: specifies if MOBILE or WIFI data usage
378 tethering: if wifi hotspot should be enabled on dut_a
379 """
380 sub_id = str(dut_a.droid.telephonyGetSubscriberId())
381
382 # enable hotspot and connect dut_b to it.
383 if tethering:
384 ssid = "hs_%s" % utils.rand_ascii_str(AP_SSID_LENGTH_2G)
385 pwd = utils.rand_ascii_str(AP_PASSPHRASE_LENGTH_2G)
386 network = {wutils.WifiEnums.SSID_KEY: ssid,
387 wutils.WifiEnums.PWD_KEY: pwd}
388 dut_b.droid.telephonyToggleDataConnection(False)
389 wutils.start_wifi_tethering(dut_a,
390 network[wutils.WifiEnums.SSID_KEY],
391 network[wutils.WifiEnums.PWD_KEY])
392 self.hs_enabled.append(dut_a)
393 wutils.start_wifi_connection_scan_and_ensure_network_found(
394 dut_b, network[wutils.WifiEnums.SSID_KEY])
395 wutils.wifi_connect(dut_b, network)
396
397 # get pre mobile data usage
398 total_pre = self._get_total_data_usage_for_device(dut_a, data_usage)
399
400 # set data usage limit to current usage limit + 10MB
401 self.log.info("Set data usage limit to %sMB" % (total_pre + INC_DATA))
402 dut_a.droid.connectivitySetDataUsageLimit(
403 sub_id, int((total_pre + INC_DATA) * BYTE_TO_MB_ANDROID))
404
405 # download file on dut_b and look for BlockedStatusChanged callback
406 q = queue.Queue()
407 t = threading.Thread(target=self._listen_for_network_callback,
408 args=(dut_a, "BlockedStatusChanged", q))
409 t.daemon = True
410 t.start()
411 status = http_file_download_by_chrome(
412 dut_b, file_link, self.file_size, True, TIMEOUT)
413 t.join()
414 cb_res = q.get()
415
416 # verify file download fails and expected callback is recevied
417 asserts.assert_true(cb_res,
418 "Failed to verify blocked status network callback")
419 asserts.assert_true(not status,
420 "File download successful. Expected to fail")
421
422 ### Test Cases
Girish Moturu383e41a2018-01-02 13:51:15 -0800423
424 @test_tracker_info(uuid="b2d9b36c-3a1c-47ca-a9c1-755450abb20c")
Girish Moturu74ff5652019-11-17 13:19:26 -0800425 def test_mobile_data_usage_downlink_ipv4_tmo(self):
426 """Verify mobile data usage over IPv4 and TMO carrier."""
427 self._test_data_usage_downlink(self.android_devices[0],
428 self.android_devices[0],
429 self.download_file_ipv4,
430 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800431
Girish Moturu74ff5652019-11-17 13:19:26 -0800432 @test_tracker_info(uuid="fbbb58ed-d573-4bbd-bd5d-0bc540507896")
433 def test_mobile_data_usage_downlink_ipv6_tmo(self):
434 """Verify mobile data usage over IPv6 and TMO carrier."""
435 self._test_data_usage_downlink(self.android_devices[0],
436 self.android_devices[0],
437 self.download_file_ipv6,
438 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800439
Girish Moturu74ff5652019-11-17 13:19:26 -0800440 @test_tracker_info(uuid="6562d626-2271-4d93-96c0-f33138635330")
441 def test_mobile_data_usage_downlink_ipv4_vzw(self):
442 """Verify mobile data usage over IPv4 and VZW carrier."""
443 self._test_data_usage_downlink(self.android_devices[1],
444 self.android_devices[1],
445 self.download_file_ipv4,
446 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800447
Girish Moturu74ff5652019-11-17 13:19:26 -0800448 @test_tracker_info(uuid="2edf94cf-d937-459a-a7e4-2c679803c4d3")
449 def test_mobile_data_usage_downlink_ipv6_vzw(self):
450 """Verify mobile data usage over IPv6 and VZW carrier."""
451 self._test_data_usage_downlink(self.android_devices[1],
452 self.android_devices[1],
453 self.download_file_ipv6,
454 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800455
456 @test_tracker_info(uuid="fe1390e5-635c-49a9-b050-032e66f52f40")
Girish Moturu74ff5652019-11-17 13:19:26 -0800457 def test_wifi_tethering_mobile_data_usage_downlink_ipv4_tmo(self):
458 """Verify mobile data usage with tethered device over IPv4 and TMO."""
459 self._test_data_usage_downlink(self.android_devices[0],
460 self.android_devices[1],
461 self.download_file_ipv4,
462 cconst.TYPE_MOBILE,
463 True,
464 False,
465 False)
Girish Moturu383e41a2018-01-02 13:51:15 -0800466
Girish Moturu74ff5652019-11-17 13:19:26 -0800467 @test_tracker_info(uuid="d7fde6b2-6672-484a-a2fd-47858f5a163f")
468 def test_wifi_tethering_mobile_data_usage_downlink_ipv6_tmo(self):
469 """Verify mobile data usage with tethered device over IPv6 and TMO."""
470 self._test_data_usage_downlink(self.android_devices[0],
471 self.android_devices[1],
472 self.download_file_ipv6,
473 cconst.TYPE_MOBILE,
474 True,
475 False,
476 False)
Girish Moturu383e41a2018-01-02 13:51:15 -0800477
Girish Moturu74ff5652019-11-17 13:19:26 -0800478 @test_tracker_info(uuid="6285ef69-37a8-4069-8cb2-21dc266a57c3")
479 def test_wifi_tethering_mobile_data_usage_downlink_ipv4_vzw(self):
480 """Verify mobile data usage with tethered device over IPv4 and VZW."""
481 self._test_data_usage_downlink(self.android_devices[1],
482 self.android_devices[0],
483 self.download_file_ipv4,
484 cconst.TYPE_MOBILE,
485 True,
486 False,
487 False)
Girish Moturu383e41a2018-01-02 13:51:15 -0800488
Girish Moturu74ff5652019-11-17 13:19:26 -0800489 @test_tracker_info(uuid="565fc7e3-d7cf-43cc-8982-4f17999cf579")
490 def test_wifi_tethering_mobile_data_usage_downlink_ipv6_vzw(self):
491 """Verify mobile data usage with tethered device over IPv6 and VZW."""
492 self._test_data_usage_downlink(self.android_devices[1],
493 self.android_devices[0],
494 self.download_file_ipv6,
495 cconst.TYPE_MOBILE,
496 True,
497 False,
498 False)
Girish Moturu383e41a2018-01-02 13:51:15 -0800499
Girish Moturu74ff5652019-11-17 13:19:26 -0800500 @test_tracker_info(uuid="72ddb42a-5942-4a6a-8b20-2181c41b2765")
501 def test_wifi_data_usage_downlink_ipv4(self):
502 """Verify wifi data usage over IPv4."""
503 self._test_data_usage_downlink(self.android_devices[0],
504 self.android_devices[0],
505 self.download_file_ipv4,
506 cconst.TYPE_WIFI,
507 False,
508 True,
509 True)
Girish Moturu383e41a2018-01-02 13:51:15 -0800510
Girish Moturu74ff5652019-11-17 13:19:26 -0800511 @test_tracker_info(uuid="76b316f5-2946-4757-b5d6-62a8b1fd627e")
512 def test_wifi_data_usage_downlink_ipv6(self):
513 """Verify wifi data usage over IPv6."""
514 self._test_data_usage_downlink(self.android_devices[0],
515 self.android_devices[0],
516 self.download_file_ipv6,
517 cconst.TYPE_WIFI,
518 False,
519 True,
520 True)
Girish Moturu383e41a2018-01-02 13:51:15 -0800521
Girish Moturu74ff5652019-11-17 13:19:26 -0800522 @test_tracker_info(uuid="4be5f2d4-9bc6-4190-813e-044f00d94aa6")
523 def test_wifi_tethering_wifi_data_usage_downlink_ipv4(self):
524 """Verify wifi data usage with tethered device over IPv4."""
525 asserts.skip_if(
526 self.android_devices[0].model not in self.dbs_supported_models,
527 "Device %s does not support dual interfaces." %
528 self.android_devices[0].model)
529 self._test_data_usage_downlink(self.android_devices[0],
530 self.android_devices[1],
531 self.download_file_ipv4,
532 cconst.TYPE_WIFI,
533 True,
534 True,
535 False)
Girish Moturu383e41a2018-01-02 13:51:15 -0800536
537 @test_tracker_info(uuid="ac4750fd-20d9-451d-a85b-79fdbaa7da97")
Girish Moturu74ff5652019-11-17 13:19:26 -0800538 def test_data_usage_limit_downlink_ipv4_tmo(self):
539 """Verify data limit for TMO with IPv4 link."""
540 self._test_data_usage_limit_downlink(self.android_devices[0],
541 self.android_devices[0],
542 self.download_file_ipv4,
543 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800544
Girish Moturu74ff5652019-11-17 13:19:26 -0800545 @test_tracker_info(uuid="6598732e-f4d3-40c7-a73b-e89bb3d196c5")
546 def test_data_usage_limit_downlink_ipv6_tmo(self):
547 """Verify data limit for TMO with IPv6 link."""
548 self._test_data_usage_limit_downlink(self.android_devices[0],
549 self.android_devices[0],
550 self.download_file_ipv6,
551 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800552
Girish Moturu74ff5652019-11-17 13:19:26 -0800553 @test_tracker_info(uuid="d1ef0405-cf58-4141-94c7-cfa0c9d14438")
554 def test_data_usage_limit_downlink_ipv4_vzw(self):
555 """Verify data limit for VZW with IPv4 link."""
556 self._test_data_usage_limit_downlink(self.android_devices[1],
557 self.android_devices[1],
558 self.download_file_ipv4,
559 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800560
Girish Moturu74ff5652019-11-17 13:19:26 -0800561 @test_tracker_info(uuid="18d169d9-fc4f-4782-8f5f-fc96b8976d03")
562 def test_data_usage_limit_downlink_ipv6_vzw(self):
563 """Verify data limit for VZW with IPv6 link."""
564 self._test_data_usage_limit_downlink(self.android_devices[1],
565 self.android_devices[1],
566 self.download_file_ipv6,
567 cconst.TYPE_MOBILE)
Girish Moturu383e41a2018-01-02 13:51:15 -0800568
569 @test_tracker_info(uuid="7c9ab330-9645-4030-bb1e-dcce126944a2")
Girish Moturu74ff5652019-11-17 13:19:26 -0800570 def test_wifi_tethering_data_usage_limit_downlink_ipv4_tmo(self):
571 """Verify data limit for TMO from tethered device with IPv4 link."""
572 self._test_data_usage_limit_downlink(self.android_devices[0],
573 self.android_devices[1],
574 self.download_file_ipv4,
575 cconst.TYPE_MOBILE,
576 True)
Girish Moturu383e41a2018-01-02 13:51:15 -0800577
Girish Moturu74ff5652019-11-17 13:19:26 -0800578 @test_tracker_info(uuid="1cafdaf7-a41e-4d19-b08a-ae094d796426")
579 def test_wifi_tethering_data_usage_limit_downlink_ipv6_tmo(self):
580 """Verify data limit for TMO from tethered device with IPv6 link."""
581 self._test_data_usage_limit_downlink(self.android_devices[0],
582 self.android_devices[1],
583 self.download_file_ipv6,
584 cconst.TYPE_MOBILE,
585 True)
Girish Moturu383e41a2018-01-02 13:51:15 -0800586
Girish Moturu74ff5652019-11-17 13:19:26 -0800587 @test_tracker_info(uuid="bd5a8f93-4e2f-474d-a01d-4bb5117d5350")
588 def test_wifi_tethering_data_usage_limit_downlink_ipv4_vzw(self):
589 """Verify data limit for VZW from tethered device with IPv4 link."""
590 self._test_data_usage_limit_downlink(self.android_devices[1],
591 self.android_devices[0],
592 self.download_file_ipv4,
593 cconst.TYPE_MOBILE,
594 True)
Girish Moturu383e41a2018-01-02 13:51:15 -0800595
Girish Moturu74ff5652019-11-17 13:19:26 -0800596 @test_tracker_info(uuid="ec082fe5-6af1-425e-ace6-4726930bf62f")
597 def test_wifi_tethering_data_usage_limit_downlink_ipv6_vzw(self):
598 """Verify data limit for VZW from tethered device with IPv6 link."""
599 self._test_data_usage_limit_downlink(self.android_devices[1],
600 self.android_devices[0],
601 self.download_file_ipv6,
602 cconst.TYPE_MOBILE,
603 True)