• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Lint as: python2, python3
2# Copyright (c) 2020 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.bin import test
9from autotest_lib.client.cros.cellular import cellular_logging
10from autotest_lib.client.cros.cellular import hermes_utils
11
12log = cellular_logging.SetupCellularLogging('HermesSingleProfileTest')
13
14class cellular_Hermes_SingleProfile(test.test):
15    """
16    Tests Enable and Disable functions on active/inactive Euicc present
17
18    This test fails when not able to Enable/Disable a given Euicc profile
19
20    Prerequisites
21
22    1) For test CI:
23       Before running this test on test CI, a profile needs to be created on
24    go/stork-profile. The profile needs to be linked to the EID of the dut.
25    Profiles with class=operational and type=Android GTS test are known to work
26    well with this test.
27
28       We rely on the SMDS event to find the activation code for the test.
29    There is a limit of 99 downloads before the profile needs to be deleted and
30    recreated.(b/181723689)
31
32    2) For prod CI:
33       Install a production profile before running the test.
34
35    """
36    version = 1
37
38    def run_once(self, is_prod_ci=False):
39        """ Enable Disable Euicc by enabling or disabling a profile """
40        self.is_prod_ci = is_prod_ci
41
42        self.mm_proxy, self.hermes_manager, euicc_path = \
43            hermes_utils.initialize_test(is_prod_ci)
44
45        self.installed_iccid = None
46
47        self.installed_iccid = hermes_utils.install_profile(
48        euicc_path, self.hermes_manager, self.is_prod_ci)
49
50        hermes_utils.enable_or_disable_profile_test(
51        euicc_path, self.hermes_manager, self.installed_iccid, True)
52
53        hermes_utils.enable_or_disable_profile_test(
54        euicc_path, self.hermes_manager, self.installed_iccid, False)
55
56        if not self.is_prod_ci:
57            hermes_utils.uninstall_profile_test(
58            euicc_path, self.hermes_manager, self.installed_iccid)
59
60        logging.info('HermesSingleProfileTest Completed')
61