aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvraham Stern <avraham.stern@intel.com>2016-04-07 10:32:00 (GMT)
committerJouni Malinen <j@w1.fi>2016-04-24 20:45:16 (GMT)
commit5e65346ade64a7e873812c84ba061214bd9a263e (patch)
treee63df7033ad5e78c20218a6cfad88144848495ab
parentafb2e8b8913f131e5fb3a1031aacae3ab2b91287 (diff)
downloadhostap-5e65346ade64a7e873812c84ba061214bd9a263e.zip
hostap-5e65346ade64a7e873812c84ba061214bd9a263e.tar.gz
hostap-5e65346ade64a7e873812c84ba061214bd9a263e.tar.bz2
tests: persistent_group_profile_add to support P2P Device interface
Modify the persistent_group_profile_add test to support configurations that use a dedicated P2P Device interface by sending the ADD_NETWORK and SET_NETWORK commands on the global control interface and specifying the P2P Device interface name. Signed-off-by: Avraham Stern <avraham.stern@intel.com>
-rw-r--r--tests/hwsim/test_p2p_persistent.py10
-rw-r--r--tests/hwsim/wpasupplicant.py21
2 files changed, 26 insertions, 5 deletions
diff --git a/tests/hwsim/test_p2p_persistent.py b/tests/hwsim/test_p2p_persistent.py
index 1bfe82a..48c2c06 100644
--- a/tests/hwsim/test_p2p_persistent.py
+++ b/tests/hwsim/test_p2p_persistent.py
@@ -541,11 +541,11 @@ def test_persistent_group_missed_inv_resp(dev):
def test_persistent_group_profile_add(dev):
"""Create a P2P persistent group with ADD_NETWORK"""
passphrase="passphrase here"
- id = dev[0].add_network()
- dev[0].set_network_quoted(id, "ssid", "DIRECT-ab")
- dev[0].set_network_quoted(id, "psk", passphrase)
- dev[0].set_network(id, "mode", "3")
- dev[0].set_network(id, "disabled", "2")
+ id = dev[0].p2pdev_add_network()
+ dev[0].p2pdev_set_network_quoted(id, "ssid", "DIRECT-ab")
+ dev[0].p2pdev_set_network_quoted(id, "psk", passphrase)
+ dev[0].p2pdev_set_network(id, "mode", "3")
+ dev[0].p2pdev_set_network(id, "disabled", "2")
dev[0].p2p_start_go(persistent=id, freq=2412)
pin = dev[1].wps_read_pin()
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index f496724..eec21a8 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -248,6 +248,27 @@ class WpaSupplicant:
raise Exception("SET_NETWORK failed")
return None
+ def p2pdev_request(self, cmd):
+ return self.global_request("IFNAME=" + self.p2p_dev_ifname + " " + cmd)
+
+ def p2pdev_add_network(self):
+ id = self.p2pdev_request("ADD_NETWORK")
+ if "FAIL" in id:
+ raise Exception("p2pdev ADD_NETWORK failed")
+ return int(id)
+
+ def p2pdev_set_network(self, id, field, value):
+ res = self.p2pdev_request("SET_NETWORK " + str(id) + " " + field + " " + value)
+ if "FAIL" in res:
+ raise Exception("p2pdev SET_NETWORK failed")
+ return None
+
+ def p2pdev_set_network_quoted(self, id, field, value):
+ res = self.p2pdev_request("SET_NETWORK " + str(id) + " " + field + ' "' + value + '"')
+ if "FAIL" in res:
+ raise Exception("p2pdev SET_NETWORK failed")
+ return None
+
def list_networks(self, p2p=False):
if p2p:
res = self.global_request("LIST_NETWORKS")