autotest: Migrate network_WiFiSecMat/023CheckWPA_AES_PMF
TEST=This is a test. It passes.
BUG=chromium:255247
Change-Id: I4b4c14f6f514d93941afe70f7b4c14d082849db0
Reviewed-on: https://gerrit.chromium.org/gerrit/60541
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
diff --git a/server/cros/wlan/hostap_config.py b/server/cros/wlan/hostap_config.py
index a1ceb42..d2f9037 100644
--- a/server/cros/wlan/hostap_config.py
+++ b/server/cros/wlan/hostap_config.py
@@ -79,6 +79,14 @@
N_CAPABILITY_SGI20 = object()
N_CAPABILITY_SGI40 = object()
+ PMF_SUPPORT_DISABLED = 0
+ PMF_SUPPORT_ENABLED = 1
+ PMF_SUPPORT_REQUIRED = 2
+ PMF_SUPPORT_VALUES = (PMF_SUPPORT_DISABLED,
+ PMF_SUPPORT_ENABLED,
+ PMF_SUPPORT_REQUIRED)
+
+
@property
def ht_packet_capture_mode(self):
"""Get an appropriate packet capture HT parameter.
@@ -120,7 +128,8 @@
def __init__(self, mode=None, channel=None, frequency=None,
n_capabilities=None, hide_ssid=None, beacon_interval=None,
dtim_period=None, frag_threshold=None, ssid=None, bssid=None,
- force_wmm=None, security_config=None):
+ force_wmm=None, security_config=None,
+ pmf_support=PMF_SUPPORT_DISABLED):
"""Construct a HostapConfig.
You may specify channel or frequency, but not both. Both options
@@ -140,6 +149,8 @@
@param force_wmm True if we should force WMM on, False if we should
force it off, None if we shouldn't force anything.
@param security_config SecurityConfig object.
+ @param pmf_support one of PMF_SUPPORT_* above. Controls whether the
+ client supports/must support 802.11w.
"""
super(HostapConfig, self).__init__()
@@ -228,6 +239,11 @@
self.bssid = bssid
if force_wmm is not None:
self.wmm_enabled = force_wmm
+ if pmf_support not in self.PMF_SUPPORT_VALUES:
+ raise error.TestFail('Invalid value for pmf_support: %r' %
+ pmf_support)
+
+ self.pmf_support = pmf_support
self.security_config = (copy.copy(security_config) or
xmlrpc_security_types.SecurityConfig())
diff --git a/server/site_linux_router.py b/server/site_linux_router.py
index c1e8466..9bac1a6 100644
--- a/server/site_linux_router.py
+++ b/server/site_linux_router.py
@@ -289,6 +289,8 @@
conf['dtim_period'] = configuration.dtim_period
if configuration.frag_threshold:
conf['fragm_threshold'] = configuration.frag_threshold
+ if configuration.pmf_support:
+ conf['ieee80211w'] = configuration.pmf_support
conf.update(configuration.get_security_hostapd_conf())
self.start_hostapd(conf, {})
diff --git a/server/site_tests/network_WiFiSecMat/023CheckWPA_AES_PMF b/server/site_tests/network_WiFiSecMat/023CheckWPA_AES_PMF
deleted file mode 100644
index 980e93b..0000000
--- a/server/site_tests/network_WiFiSecMat/023CheckWPA_AES_PMF
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This tests that the DUT can associate to an AP that requires 802.11w
-# (Protected Management Frame). The DUT must detect that the AP
-# requires this feature.
-
-{ "name":"CheckWPA_PMF",
- "steps":[ # Channel [any]
- [ "create", { "type":"hostap" } ],
- [ "config", { "channel":"2412", "mode":"11g",
- "wpa":"2", "wpa_key_mgmt":"WPA-PSK",
- "wpa_pairwise":"CCMP",
- "wpa_passphrase":"chromeos",
- "ieee80211w":"2" } ], # set PMF to "mandatory"
- [ "connect", { "security":"rsn", "psk":"chromeos" } ],
- [ "client_ping", { "count":"10" } ],
- [ "destroy" ],
- ],
-}
-
-
-
diff --git a/server/site_tests/network_WiFi_SimpleConnect/control.wifi_checkWPA2_PMF b/server/site_tests/network_WiFi_SimpleConnect/control.wifi_checkWPA2_PMF
new file mode 100644
index 0000000..c526d1b
--- /dev/null
+++ b/server/site_tests/network_WiFi_SimpleConnect/control.wifi_checkWPA2_PMF
@@ -0,0 +1,44 @@
+# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = 'wiley@chromium.com'
+NAME = 'network_WiFi_SimpleConnect.wifi_checkWPA2_CCMP_PMF'
+TIME = 'SHORT'
+TEST_TYPE = 'Server'
+SUITE = 'wifi_matfunc'
+DEPENDENCIES = 'wificell'
+
+DOC = """
+This tests verifies that we can connect to an AP broadcasting a WPA2 network
+using AES based CCMP. In addition, the client must also support 802.11w
+protected management frames.
+"""
+
+from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes
+from autotest_lib.client.common_lib.cros.network import xmlrpc_security_types
+from autotest_lib.server.cros.wlan import hostap_config
+
+
+def run(machine):
+ wpa_config = xmlrpc_security_types.WPAConfig(
+ psk='chromeos',
+ wpa_mode=xmlrpc_security_types.WPAConfig.MODE_PURE_WPA2,
+ wpa_ciphers=[xmlrpc_security_types.WPAConfig.CIPHER_CCMP])
+ ap_config = hostap_config.HostapConfig(
+ frequency=2412,
+ mode=hostap_config.HostapConfig.MODE_11G,
+ pmf_support=hostap_config.HostapConfig.PMF_SUPPORT_REQUIRED,
+ security_config=wpa_config)
+ assoc_params = xmlrpc_datatypes.AssociationParameters()
+ assoc_params.security_config = wpa_config
+ configurations = [(ap_config, assoc_params)]
+ host = hosts.create_host(machine)
+ job.run_test('network_WiFi_SimpleConnect',
+ tag=NAME.split('.')[1],
+ host=host,
+ raw_cmdline_args=args,
+ additional_params=configurations)
+
+
+parallel_simple(run, machines)