tests: Add helper functions for connection to an AP
Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
e259d186cf
commit
b61e418c35
2 changed files with 29 additions and 32 deletions
|
@ -301,3 +301,17 @@ class WpaSupplicant:
|
|||
if "FAIL" in self.group_request(cmd):
|
||||
raise Exception("Failed to request TDLS teardown")
|
||||
return None
|
||||
|
||||
def connect(self, ssid, psk=None, proto=None, key_mgmt=None, wep_key0=None):
|
||||
logger.info("Connect STA " + self.ifname + " to AP")
|
||||
id = self.add_network()
|
||||
self.set_network_quoted(id, "ssid", ssid)
|
||||
if psk:
|
||||
self.set_network_quoted(id, "psk", psk)
|
||||
if proto:
|
||||
self.set_network(id, "proto", proto)
|
||||
if key_mgmt:
|
||||
self.set_network(id, "key_mgmt", key_mgmt)
|
||||
if wep_key0:
|
||||
self.set_network(id, "wep_key0", wep_key0)
|
||||
self.connect_network(id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue