• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Lint as: python2, python3
2# Copyright (c) 2021 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6import logging
7
8from autotest_lib.client.common_lib import error
9from autotest_lib.server import test
10from autotest_lib.server.cros.cellular.callbox_utils import CallboxLookup as cbl
11from autotest_lib.server.cros.cellular.callbox_utils import cmw500_cellular_simulator as cmw
12from autotest_lib.server.cros.cellular.simulation_utils import ChromebookCellularDut
13from autotest_lib.server.cros.cellular.simulation_utils import LteSimulation
14
15
16class cellular_Callbox_AssertCellularData(test.test):
17    """
18    Asserts that cellular data works.
19
20    The test establishes a connection to the appropriate CMW500 callbox. Then
21    it asserts that the cellular data connection provided to it matches the
22    data connection provided by ethernet. Any differences are considered an
23    error. If the cellular data connection is not provided, the second curl
24    will throw an exception.
25    """
26    version = 1
27
28    def run_once(self, host):
29        """Simple test that asserts that data provided through simulated
30        cellular connection matches network ethernet."""
31        self.log = logging.getLogger()
32        self.sim = cmw.CMW500CellularSimulator(cbl.callboxes[host.hostname],
33                                               5025)
34        self.dut = ChromebookCellularDut.ChromebookCellularDut(host, self.log)
35        self.simulation = LteSimulation.LteSimulation(
36                self.sim, self.log, self.dut, {
37                        'attach_retries': 1,
38                        'attach_timeout': 120
39                }, None)
40        parameter_list = [
41                'band', '2', 'bw', '20', 'mimo', '2x2', 'tm', '1', 'pul', '0',
42                'pdl', 'high'
43        ]
44        self.simulation.parse_parameters(parameter_list)
45        self.simulation.start()
46        a = host.run("curl --interface eth0 google.com")
47        b = host.run("curl --interface rmnet_data0 google.com")
48        if a.stdout != b.stdout:
49            raise error.TestFailure(
50                    "Ethernet and cellular curl output not equal.")
51