• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2#   Copyright 2020 - 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
16
17from acts import base_test
18from acts.test_decorators import test_tracker_info
19from acts.test_utils.net import connectivity_const
20from acts.test_utils.net import net_test_utils as nutils
21from acts.test_utils.wifi import wifi_test_utils as wutils
22
23VPN_CONST = connectivity_const.VpnProfile
24VPN_TYPE = connectivity_const.VpnProfileType
25VPN_PARAMS = connectivity_const.VpnReqParams
26
27
28class IKEv2VpnOverLTETest(base_test.BaseTestClass):
29  """IKEv2 VPN tests."""
30
31  def setup_class(self):
32
33    required_params = dir(VPN_PARAMS)
34    required_params = [x for x in required_params if not x.startswith("__")]
35    self.unpack_userparams(req_param_names=required_params)
36    self.vpn_params = {
37        "vpn_username": self.vpn_username,
38        "vpn_password": self.vpn_password,
39        "psk_secret": self.psk_secret,
40        "client_pkcs_file_name": self.client_pkcs_file_name,
41        "cert_path_vpnserver": self.cert_path_vpnserver,
42        "cert_password": self.cert_password,
43        "vpn_identity": self.vpn_identity,
44    }
45
46    for ad in self.android_devices:
47      wutils.wifi_test_device_init(ad)
48      nutils.verify_lte_data_and_tethering_supported(ad)
49    self.tmo_dut = self.android_devices[0]
50    self.vzw_dut = self.android_devices[1]
51
52  def on_fail(self, test_name, begin_time):
53    for ad in self.android_devices:
54      ad.take_bug_report(test_name, begin_time)
55
56  ### Test cases ###
57
58  @test_tracker_info(uuid="31fac6c5-f76c-403c-8b76-29c01557a48a")
59  def test_ikev2_psk_vpn_tmo(self):
60    vpn = VPN_TYPE.IKEV2_IPSEC_PSK
61    server_addr = self.vpn_server_addresses[vpn.name][0]
62    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
63    vpn_profile = nutils.generate_ikev2_vpn_profile(
64        self.tmo_dut, self.vpn_params, vpn, server_addr, self.log_path)
65    nutils.legacy_vpn_connection_test_logic(self.tmo_dut, vpn_profile, vpn_addr)
66
67  @test_tracker_info(uuid="c28adef0-6578-4841-a833-e52a5b16a390")
68  def test_ikev2_mschapv2_vpn_tmo(self):
69    vpn = VPN_TYPE.IKEV2_IPSEC_USER_PASS
70    server_addr = self.vpn_server_addresses[vpn.name][0]
71    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
72    vpn_profile = nutils.generate_ikev2_vpn_profile(
73        self.tmo_dut, self.vpn_params, vpn, server_addr, self.log_path)
74    nutils.legacy_vpn_connection_test_logic(self.tmo_dut, vpn_profile, vpn_addr)
75
76  @test_tracker_info(uuid="6c7daad9-ae7a-493d-bbab-9001068f22c5")
77  def test_ikev2_rsa_vpn_tmo(self):
78    vpn = VPN_TYPE.IKEV2_IPSEC_RSA
79    server_addr = self.vpn_server_addresses[vpn.name][0]
80    self.vpn_params["server_addr"] = server_addr
81    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
82    vpn_profile = nutils.generate_ikev2_vpn_profile(
83        self.tmo_dut, self.vpn_params, vpn, server_addr, self.log_path)
84    nutils.legacy_vpn_connection_test_logic(self.tmo_dut, vpn_profile, vpn_addr)
85
86  @test_tracker_info(uuid="1275a2f-e939-4557-879d-fbbd9c5dbd93")
87  def test_ikev2_psk_vpn_vzw(self):
88    vpn = VPN_TYPE.IKEV2_IPSEC_PSK
89    server_addr = self.vpn_server_addresses[vpn.name][0]
90    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
91    vpn_profile = nutils.generate_ikev2_vpn_profile(
92        self.vzw_dut, self.vpn_params, vpn, server_addr, self.log_path)
93    nutils.legacy_vpn_connection_test_logic(self.vzw_dut, vpn_profile, vpn_addr)
94
95  @test_tracker_info(uuid="fd146163-f28d-4514-96a0-82f51b70e218")
96  def test_ikev2_mschapv2_vpn_vzw(self):
97    vpn = VPN_TYPE.IKEV2_IPSEC_USER_PASS
98    server_addr = self.vpn_server_addresses[vpn.name][0]
99    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
100    vpn_profile = nutils.generate_ikev2_vpn_profile(
101        self.vzw_dut, self.vpn_params, vpn, server_addr, self.log_path)
102    nutils.legacy_vpn_connection_test_logic(self.vzw_dut, vpn_profile, vpn_addr)
103
104  @test_tracker_info(uuid="722de9b5-834f-4854-b4a6-e31860628fe9")
105  def test_ikev2_rsa_vpn_vzw(self):
106    vpn = VPN_TYPE.IKEV2_IPSEC_RSA
107    server_addr = self.vpn_server_addresses[vpn.name][0]
108    self.vpn_params["server_addr"] = server_addr
109    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
110    vpn_profile = nutils.generate_ikev2_vpn_profile(
111        self.vzw_dut, self.vpn_params, vpn, server_addr, self.log_path)
112    nutils.legacy_vpn_connection_test_logic(self.vzw_dut, vpn_profile, vpn_addr)
113