diff --git a/tests/hwsim/test_p2p_persistent.py b/tests/hwsim/test_p2p_persistent.py index 1bfe82a60..48c2c0609 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 f496724ff..eec21a889 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")