aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2018-12-08 14:14:42 (GMT)
committerJouni Malinen <j@w1.fi>2018-12-08 14:27:26 (GMT)
commit30810f5d9790f6e1a21d37438502caa9006e1d02 (patch)
treeb82fd3f650baa77ac2a9bc877473ac970820d696 /tests
parent06c00e6d930aedb2619d0bd5f770b3062623cec5 (diff)
downloadhostap-30810f5d9790f6e1a21d37438502caa9006e1d02.zip
hostap-30810f5d9790f6e1a21d37438502caa9006e1d02.tar.gz
hostap-30810f5d9790f6e1a21d37438502caa9006e1d02.tar.bz2
tests: wpa_supplicant config file writing and key_mgmt values
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_wpas_config.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/hwsim/test_wpas_config.py b/tests/hwsim/test_wpas_config.py
index 14258bf..3b88456 100644
--- a/tests/hwsim/test_wpas_config.py
+++ b/tests/hwsim/test_wpas_config.py
@@ -523,3 +523,64 @@ def test_wpas_config_file_set_global(dev):
os.rmdir(config)
except:
pass
+
+def test_wpas_config_file_key_mgmt(dev, apdev, params):
+ """wpa_supplicant config file writing and key_mgmt values"""
+ config = os.path.join(params['logdir'],
+ 'wpas_config_file_key_mgmt.conf')
+ if os.path.exists(config):
+ os.remove(config)
+
+ wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+
+ with open(config, "w") as f:
+ f.write("update_config=1\n")
+
+ wpas.interface_add("wlan5", config=config)
+
+ from test_dpp import params1_csign, params1_sta_connector, params1_sta_netaccesskey
+ id = wpas.add_network()
+ wpas.set_network_quoted(id, "ssid", "foo")
+ wpas.set_network(id, "key_mgmt", "DPP")
+ wpas.set_network(id, "ieee80211w", "2")
+ wpas.set_network_quoted(id, "dpp_csign", params1_csign)
+ wpas.set_network_quoted(id, "dpp_connector", params1_sta_connector)
+ wpas.set_network_quoted(id, "dpp_netaccesskey", params1_sta_netaccesskey)
+ if "OK" not in wpas.request("SAVE_CONFIG"):
+ raise Exception("Failed to save configuration file")
+
+ with open(config, "r") as f:
+ data = f.read()
+ logger.info("Configuration file contents: " + data)
+ if "key_mgmt=DPP" not in data:
+ raise Exception("Missing key_mgmt")
+ if 'dpp_connector="' + params1_sta_connector + '"' not in data:
+ raise Exception("Missing dpp_connector")
+ if 'dpp_netaccesskey="' + params1_sta_netaccesskey + '"' not in data:
+ raise Exception("Missing dpp_netaccesskey")
+ if 'dpp_csign="' + params1_csign + '"' not in data:
+ raise Exception("Missing dpp_csign")
+
+ wpas.set_network(id, "dpp_csign", "NULL")
+ wpas.set_network(id, "dpp_connector", "NULL")
+ wpas.set_network(id, "dpp_netaccesskey", "NULL")
+ wpas.set_network_quoted(id, "psk", "12345678")
+ wpas.set_network(id, "ieee80211w", "0")
+
+ tests = [ "WPA-PSK", "WPA-EAP", "IEEE8021X", "NONE", "WPA-NONE", "FT-PSK",
+ "FT-EAP", "FT-EAP-SHA384", "WPA-PSK-SHA256", "WPA-EAP-SHA256",
+ "SAE", "FT-SAE", "OSEN", "WPA-EAP-SUITE-B",
+ "WPA-EAP-SUITE-B-192", "FILS-SHA256", "FILS-SHA384",
+ "FT-FILS-SHA256", "FT-FILS-SHA384", "OWE", "DPP" ]
+ for key_mgmt in tests:
+ wpas.set_network(id, "key_mgmt", key_mgmt)
+ if "OK" not in wpas.request("SAVE_CONFIG"):
+ raise Exception("Failed to save configuration file")
+ with open(config, "r") as f:
+ data = f.read()
+ logger.info("Configuration file contents: " + data)
+ if "key_mgmt=" + key_mgmt not in data:
+ raise Exception("Missing key_mgmt " + key_mgmt)
+
+ wpas.interface_remove("wlan5")
+ wpas.interface_add("wlan5", config=config)