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>
This commit is contained in:
Avraham Stern 2016-04-07 13:32:00 +03:00 committed by Jouni Malinen
parent afb2e8b891
commit 5e65346ade
2 changed files with 26 additions and 5 deletions

View file

@ -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()

View file

@ -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")