• 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.test_decorators import test_tracker_info
18from acts_contrib.test_utils.net import connectivity_const
19from acts_contrib.test_utils.net import net_test_utils as nutils
20from acts_contrib.test_utils.wifi import wifi_test_utils as wutils
21from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest
22
23VPN_CONST = connectivity_const.VpnProfile
24VPN_TYPE = connectivity_const.VpnProfileType
25VPN_PARAMS = connectivity_const.VpnReqParams
26
27
28class VpnOverLTETest(WifiBaseTest):
29  """VPN tests over LTE."""
30
31  def setup_class(self):
32    required_params = dir(VPN_PARAMS)
33    required_params = [x for x in required_params if not x.startswith("__")]
34    self.unpack_userparams(req_param_names=required_params)
35
36    for ad in self.android_devices:
37      wutils.wifi_test_device_init(ad)
38      nutils.verify_lte_data_and_tethering_supported(ad)
39    self.tmo_dut = self.android_devices[0]
40    self.vzw_dut = self.android_devices[1]
41
42    self.vpn_params = {
43        "vpn_username": self.vpn_username,
44        "vpn_password": self.vpn_password,
45        "psk_secret": self.psk_secret,
46        "client_pkcs_file_name": self.client_pkcs_file_name,
47        "cert_path_vpnserver": self.cert_path_vpnserver,
48        "cert_password": self.cert_password
49    }
50
51  def on_fail(self, test_name, begin_time):
52    for ad in self.android_devices:
53      ad.take_bug_report(test_name, begin_time)
54
55  ### Test cases ###
56
57  @test_tracker_info(uuid="ea6b1f3e-2791-499d-b696-cacc22ef0476")
58  def test_vpn_l2tp_ipsec_psk_strongswan_tmo(self):
59    """Verify L2TP IPSec PSk VPN over TMO."""
60    vpn = VPN_TYPE.L2TP_IPSEC_PSK
61    vpn_profile = nutils.generate_legacy_vpn_profile(
62        self.tmo_dut, self.vpn_params, vpn,
63        self.vpn_server_addresses[vpn.name][0], self.ipsec_server_type[0],
64        self.log_path)
65    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
66    nutils.legacy_vpn_connection_test_logic(self.tmo_dut, vpn_profile, vpn_addr)
67
68  @test_tracker_info(uuid="5b7e2135-12d8-4775-bcca-5ed6ca96c589")
69  def test_vpn_l2tp_ipsec_rsa_strongswan_tmo(self):
70    """Verify L2TP IPSec RSA VPN over TMO."""
71    vpn = VPN_TYPE.L2TP_IPSEC_RSA
72    vpn_profile = nutils.generate_legacy_vpn_profile(
73        self.tmo_dut, self.vpn_params, vpn,
74        self.vpn_server_addresses[vpn.name][0], self.ipsec_server_type[0],
75        self.log_path)
76    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
77    nutils.legacy_vpn_connection_test_logic(self.tmo_dut, vpn_profile, vpn_addr)
78
79  @test_tracker_info(uuid="dec913c9-e9a0-4744-80c7-9bdacd2f55f0")
80  def test_vpn_ipsec_xauth_psk_strongswan_tmo(self):
81    """Verify IPSec XAUTH PSK over TMO."""
82    vpn = VPN_TYPE.IPSEC_XAUTH_PSK
83    vpn_profile = nutils.generate_legacy_vpn_profile(
84        self.tmo_dut, self.vpn_params, vpn,
85        self.vpn_server_addresses[vpn.name][0], self.ipsec_server_type[0],
86        self.log_path)
87    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
88    nutils.legacy_vpn_connection_test_logic(self.tmo_dut, vpn_profile, vpn_addr)
89
90  @test_tracker_info(uuid="259709fe-158e-4a1b-aece-df584a3836d3")
91  def test_vpn_ipsec_xauth_rsa_strongswan_tmo(self):
92    """Verify IPSec XAUTH RSA over TMO."""
93    vpn = VPN_TYPE.IPSEC_XAUTH_RSA
94    vpn_profile = nutils.generate_legacy_vpn_profile(
95        self.tmo_dut, self.vpn_params, vpn,
96        self.vpn_server_addresses[vpn.name][0], self.ipsec_server_type[0],
97        self.log_path)
98    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
99    nutils.legacy_vpn_connection_test_logic(self.tmo_dut, vpn_profile, vpn_addr)
100
101  @test_tracker_info(uuid="8106eedb-31a9-4855-9afd-5f24ddbb46b0")
102  def test_vpn_ipsec_hybrid_rsa_strongswan_tmo(self):
103    """Verify IPSec Hybrid RSA over TMO."""
104    vpn = VPN_TYPE.IPSEC_HYBRID_RSA
105    vpn_profile = nutils.generate_legacy_vpn_profile(
106        self.tmo_dut, self.vpn_params, vpn,
107        self.vpn_server_addresses[vpn.name][0], self.ipsec_server_type[0],
108        self.log_path)
109    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
110    nutils.legacy_vpn_connection_test_logic(self.tmo_dut, vpn_profile, vpn_addr)
111
112  @test_tracker_info(uuid="0b8d78a9-a7dd-4e8d-ae85-018f5172fa08")
113  def test_vpn_l2tp_ipsec_psk_strongswan_vzw(self):
114    """Verify L2TP IPSec PSk VPN over VZW."""
115    vpn = VPN_TYPE.L2TP_IPSEC_PSK
116    vpn_profile = nutils.generate_legacy_vpn_profile(
117        self.vzw_dut, self.vpn_params, vpn,
118        self.vpn_server_addresses[vpn.name][0], self.ipsec_server_type[0],
119        self.log_path)
120    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
121    nutils.legacy_vpn_connection_test_logic(self.vzw_dut, vpn_profile, vpn_addr)
122
123  @test_tracker_info(uuid="ed0ba740-4fa5-4a32-9013-2aab3563d058")
124  def test_vpn_l2tp_ipsec_rsa_strongswan_vzw(self):
125    """Verify L2TP IPSec RSA VPN over VZW."""
126    vpn = VPN_TYPE.L2TP_IPSEC_RSA
127    vpn_profile = nutils.generate_legacy_vpn_profile(
128        self.vzw_dut, self.vpn_params, vpn,
129        self.vpn_server_addresses[vpn.name][0], self.ipsec_server_type[0],
130        self.log_path)
131    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
132    nutils.legacy_vpn_connection_test_logic(self.vzw_dut, vpn_profile, vpn_addr)
133
134  @test_tracker_info(uuid="c555d6b7-fb42-4b31-8527-d2a065bdcaec")
135  def test_vpn_ipsec_xauth_psk_strongswan_vzw(self):
136    """Verify IPSec XAUTH PSK over VZW."""
137    vpn = VPN_TYPE.IPSEC_XAUTH_PSK
138    vpn_profile = nutils.generate_legacy_vpn_profile(
139        self.vzw_dut, self.vpn_params, vpn,
140        self.vpn_server_addresses[vpn.name][0], self.ipsec_server_type[0],
141        self.log_path)
142    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
143    nutils.legacy_vpn_connection_test_logic(self.vzw_dut, vpn_profile, vpn_addr)
144
145  @test_tracker_info(uuid="cdc65925-8c75-4bf9-9377-3da5a3f0a7d4")
146  def test_vpn_ipsec_xauth_rsa_strongswan_vzw(self):
147    """Verify IPSec XAUTH RSA over VZW."""
148    vpn = VPN_TYPE.IPSEC_XAUTH_RSA
149    vpn_profile = nutils.generate_legacy_vpn_profile(
150        self.vzw_dut, self.vpn_params, vpn,
151        self.vpn_server_addresses[vpn.name][0], self.ipsec_server_type[0],
152        self.log_path)
153    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
154    nutils.legacy_vpn_connection_test_logic(self.vzw_dut, vpn_profile, vpn_addr)
155
156  @test_tracker_info(uuid="e75d6fac-616c-49fb-a2d4-621e1e8c1108")
157  def test_vpn_ipsec_hybrid_rsa_strongswan_vzw(self):
158    """Verify IPSec Hybrid RSA over VZW."""
159    vpn = VPN_TYPE.IPSEC_HYBRID_RSA
160    vpn_profile = nutils.generate_legacy_vpn_profile(
161        self.vzw_dut, self.vpn_params, vpn,
162        self.vpn_server_addresses[vpn.name][0], self.ipsec_server_type[0],
163        self.log_path)
164    vpn_addr = self.vpn_verify_addresses[vpn.name][0]
165    nutils.legacy_vpn_connection_test_logic(self.vzw_dut, vpn_profile, vpn_addr)
166