tests: Add a test case for using TDLS in a P2P group
Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
78ebbf0916
commit
7cb08cdbd6
2 changed files with 42 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
||||||
# This software may be distributed under the terms of the BSD license.
|
# This software may be distributed under the terms of the BSD license.
|
||||||
# See README for more details.
|
# See README for more details.
|
||||||
|
|
||||||
|
import time
|
||||||
import logging
|
import logging
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -42,6 +43,23 @@ def test_autogo_2cli(dev):
|
||||||
dev[1].remove_group()
|
dev[1].remove_group()
|
||||||
dev[0].remove_group()
|
dev[0].remove_group()
|
||||||
|
|
||||||
|
def test_autogo_tdls(dev):
|
||||||
|
autogo(dev[0])
|
||||||
|
connect_cli(dev[0], dev[1])
|
||||||
|
connect_cli(dev[0], dev[2])
|
||||||
|
hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
|
||||||
|
addr2 = dev[2].p2p_interface_addr()
|
||||||
|
dev[1].tdls_setup(addr2)
|
||||||
|
time.sleep(1)
|
||||||
|
hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
|
||||||
|
dev[1].tdls_teardown(addr2)
|
||||||
|
time.sleep(1)
|
||||||
|
hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
|
||||||
|
dev[2].remove_group()
|
||||||
|
dev[1].remove_group()
|
||||||
|
dev[0].remove_group()
|
||||||
|
|
||||||
def add_tests(tests):
|
def add_tests(tests):
|
||||||
tests.append(test_autogo)
|
tests.append(test_autogo)
|
||||||
tests.append(test_autogo_2cli)
|
tests.append(test_autogo_2cli)
|
||||||
|
tests.append(test_autogo_tdls)
|
||||||
|
|
|
@ -54,9 +54,21 @@ class WpaSupplicant:
|
||||||
return value
|
return value
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def get_group_status(self, field):
|
||||||
|
res = self.group_request("STATUS")
|
||||||
|
lines = res.splitlines()
|
||||||
|
for l in lines:
|
||||||
|
[name,value] = l.split('=', 1)
|
||||||
|
if name == field:
|
||||||
|
return value
|
||||||
|
return None
|
||||||
|
|
||||||
def p2p_dev_addr(self):
|
def p2p_dev_addr(self):
|
||||||
return self.get_status("p2p_device_address")
|
return self.get_status("p2p_device_address")
|
||||||
|
|
||||||
|
def p2p_interface_addr(self):
|
||||||
|
return self.get_group_status("address")
|
||||||
|
|
||||||
def p2p_listen(self):
|
def p2p_listen(self):
|
||||||
return self.request("P2P_LISTEN")
|
return self.request("P2P_LISTEN")
|
||||||
|
|
||||||
|
@ -225,3 +237,15 @@ class WpaSupplicant:
|
||||||
self.dump_monitor()
|
self.dump_monitor()
|
||||||
return self.group_form_result(ev)
|
return self.group_form_result(ev)
|
||||||
raise Exception("P2P_CONNECT(join) failed")
|
raise Exception("P2P_CONNECT(join) failed")
|
||||||
|
|
||||||
|
def tdls_setup(self, peer):
|
||||||
|
cmd = "TDLS_SETUP " + peer
|
||||||
|
if "FAIL" in self.group_request(cmd):
|
||||||
|
raise Exception("Failed to request TDLS setup")
|
||||||
|
return None
|
||||||
|
|
||||||
|
def tdls_teardown(self, peer):
|
||||||
|
cmd = "TDLS_TEARDOWN " + peer
|
||||||
|
if "FAIL" in self.group_request(cmd):
|
||||||
|
raise Exception("Failed to request TDLS teardown")
|
||||||
|
return None
|
||||||
|
|
Loading…
Reference in a new issue