mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
auto-t: prepare autotests for test-runner re-write
The tests basically remained the same with a few minor changes. The wiphy_map and in turn hostapd_map are no longer used. This was already partially converted a long time ago when the 'config' parameter was added to HostapdCLI. This patch fully converts all autotests to use 'config' rather than looking up by interface. Some test scripts were named 'test.py' which was fine before but the new rewrite actually loads each python test as a module. The name 'test' is too ambiguous and causes issues due to a native python module with the same name. All of these files were renamed to 'connection_test.py'.
This commit is contained in:
parent
c7b072ff21
commit
9594b03a35
@ -3,17 +3,17 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import sys, os
|
import sys, os
|
||||||
|
|
||||||
sys.path.append('../util')
|
|
||||||
import iwd
|
import iwd
|
||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
import hostapd
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def client_connect(self, wd, dev):
|
def client_connect(self, wd, dev):
|
||||||
|
hostapd = HostapdCLI(config='psk-ccmp.conf')
|
||||||
|
|
||||||
ordered_network = dev.get_ordered_network('TestAP1', True)
|
ordered_network = dev.get_ordered_network('TestAP1', True)
|
||||||
|
|
||||||
@ -30,8 +30,7 @@ class Test(unittest.TestCase):
|
|||||||
wd.unregister_psk_agent(psk_agent)
|
wd.unregister_psk_agent(psk_agent)
|
||||||
|
|
||||||
testutil.test_iface_operstate(dev.name)
|
testutil.test_iface_operstate(dev.name)
|
||||||
testutil.test_ifaces_connected(list(hostapd.hostapd_map.keys())[0],
|
testutil.test_ifaces_connected(hostapd.ifname, dev.name)
|
||||||
dev.name)
|
|
||||||
|
|
||||||
dev.disconnect()
|
dev.disconnect()
|
||||||
|
|
||||||
@ -57,6 +56,7 @@ class Test(unittest.TestCase):
|
|||||||
wd.wait_for_object_condition(dev2, condition)
|
wd.wait_for_object_condition(dev2, condition)
|
||||||
|
|
||||||
ordered_networks = dev2.get_ordered_networks()
|
ordered_networks = dev2.get_ordered_networks()
|
||||||
|
|
||||||
networks = { n.name: n for n in ordered_networks }
|
networks = { n.name: n for n in ordered_networks }
|
||||||
self.assertEqual(networks['TestAP1'].type, NetworkType.psk)
|
self.assertEqual(networks['TestAP1'].type, NetworkType.psk)
|
||||||
self.assertEqual(networks['TestAP2'].type, NetworkType.psk)
|
self.assertEqual(networks['TestAP2'].type, NetworkType.psk)
|
||||||
@ -66,6 +66,7 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
dev2.disconnect()
|
dev2.disconnect()
|
||||||
|
|
||||||
condition = 'not obj.connected'
|
condition = 'not obj.connected'
|
||||||
wd.wait_for_object_condition(dev2, condition)
|
wd.wait_for_object_condition(dev2, condition)
|
||||||
except:
|
except:
|
@ -8,12 +8,13 @@ import iwd
|
|||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
import hostapd
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def client_connect(self, wd, dev):
|
def client_connect(self, wd, dev):
|
||||||
|
hostapd = HostapdCLI(config='psk-ccmp.conf')
|
||||||
|
|
||||||
ordered_network = dev.get_ordered_network('TestAP1', True)
|
ordered_network = dev.get_ordered_network('TestAP1', True)
|
||||||
|
|
||||||
@ -30,8 +31,7 @@ class Test(unittest.TestCase):
|
|||||||
wd.unregister_psk_agent(psk_agent)
|
wd.unregister_psk_agent(psk_agent)
|
||||||
|
|
||||||
testutil.test_iface_operstate(dev.name)
|
testutil.test_iface_operstate(dev.name)
|
||||||
testutil.test_ifaces_connected(list(hostapd.hostapd_map.keys())[0],
|
testutil.test_ifaces_connected(hostapd.ifname, dev.name)
|
||||||
dev.name)
|
|
||||||
|
|
||||||
dev.disconnect()
|
dev.disconnect()
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@ from iwd import PSKAgent
|
|||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
@ -10,12 +10,8 @@ from iwd import PSKAgent
|
|||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def test_connection_success(self):
|
def test_connection_success(self):
|
||||||
|
@ -10,12 +10,8 @@ from iwd import PSKAgent
|
|||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def test_connection_success(self):
|
def test_connection_success(self):
|
||||||
|
@ -10,7 +10,6 @@ from iwd import PSKAgent
|
|||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
|
|
||||||
|
@ -10,12 +10,8 @@ from iwd import PSKAgent
|
|||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def test_connection_success(self):
|
def test_connection_success(self):
|
||||||
|
@ -12,29 +12,25 @@ import subprocess
|
|||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def check_connection_success(self, ssid):
|
def check_connection_success(self, ssid):
|
||||||
wd = IWD()
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
device = wd.list_devices(1)[0]
|
|
||||||
|
|
||||||
condition = 'not obj.scanning'
|
condition = 'not obj.scanning'
|
||||||
wd.wait_for_object_condition(device, condition)
|
self.wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
ordered_network = device.get_ordered_network(ssid)
|
ordered_network = device.get_ordered_network(ssid)
|
||||||
|
|
||||||
condition = 'obj.connected'
|
condition = 'obj.connected'
|
||||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
self.wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
device.disconnect()
|
device.disconnect()
|
||||||
|
|
||||||
condition = 'not obj.connected'
|
condition = 'not obj.connected'
|
||||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
self.wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
def test_connection_with_passphrase(self):
|
def test_connection_with_passphrase(self):
|
||||||
ssid = 'ssidPassphrase'
|
ssid = 'ssidPassphrase'
|
||||||
|
|
||||||
wd = IWD()
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
device = wd.list_devices(1)[0]
|
|
||||||
|
|
||||||
# Use --dontaks cmd-line option
|
# Use --dontaks cmd-line option
|
||||||
with self.assertRaises(subprocess.CalledProcessError):
|
with self.assertRaises(subprocess.CalledProcessError):
|
||||||
@ -49,9 +45,7 @@ class Test(unittest.TestCase):
|
|||||||
def test_connection_with_username_and_password(self):
|
def test_connection_with_username_and_password(self):
|
||||||
ssid = 'ssidUNameAndPWord'
|
ssid = 'ssidUNameAndPWord'
|
||||||
|
|
||||||
wd = IWD()
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
device = wd.list_devices(1)[0]
|
|
||||||
|
|
||||||
subprocess.check_call(['iwctl', '-u', 'user', '-p', 'password',
|
subprocess.check_call(['iwctl', '-u', 'user', '-p', 'password',
|
||||||
'station', device.name, 'connect', ssid])
|
'station', device.name, 'connect', ssid])
|
||||||
@ -61,9 +55,7 @@ class Test(unittest.TestCase):
|
|||||||
def test_connection_with_password(self):
|
def test_connection_with_password(self):
|
||||||
ssid = 'ssidPWord'
|
ssid = 'ssidPWord'
|
||||||
|
|
||||||
wd = IWD()
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
device = wd.list_devices(1)[0]
|
|
||||||
|
|
||||||
subprocess.check_call(['iwctl', '-p', 'password',
|
subprocess.check_call(['iwctl', '-p', 'password',
|
||||||
'station', device.name, 'connect', ssid])
|
'station', device.name, 'connect', ssid])
|
||||||
@ -73,9 +65,7 @@ class Test(unittest.TestCase):
|
|||||||
def test_connection_failure(self):
|
def test_connection_failure(self):
|
||||||
ssid = 'ssidPassphrase'
|
ssid = 'ssidPassphrase'
|
||||||
|
|
||||||
wd = IWD()
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
device = wd.list_devices(1)[0]
|
|
||||||
|
|
||||||
with self.assertRaises(subprocess.CalledProcessError):
|
with self.assertRaises(subprocess.CalledProcessError):
|
||||||
subprocess.check_call(['iwctl', '-P', 'incorrect_passphrase',
|
subprocess.check_call(['iwctl', '-P', 'incorrect_passphrase',
|
||||||
@ -84,18 +74,14 @@ class Test(unittest.TestCase):
|
|||||||
def test_invalid_command_line_option(self):
|
def test_invalid_command_line_option(self):
|
||||||
ssid = 'ssidPassphrase'
|
ssid = 'ssidPassphrase'
|
||||||
|
|
||||||
wd = IWD()
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
device = wd.list_devices(1)[0]
|
|
||||||
|
|
||||||
with self.assertRaises(subprocess.CalledProcessError):
|
with self.assertRaises(subprocess.CalledProcessError):
|
||||||
subprocess.check_call(['iwctl', '-z',
|
subprocess.check_call(['iwctl', '-z',
|
||||||
'station', device.name, 'connect', ssid])
|
'station', device.name, 'connect', ssid])
|
||||||
|
|
||||||
def test_invalid_command(self):
|
def test_invalid_command(self):
|
||||||
wd = IWD()
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
device = wd.list_devices(1)[0]
|
|
||||||
|
|
||||||
with self.assertRaises(subprocess.CalledProcessError):
|
with self.assertRaises(subprocess.CalledProcessError):
|
||||||
subprocess.check_call(['iwctl', 'inexistent', 'command'])
|
subprocess.check_call(['iwctl', 'inexistent', 'command'])
|
||||||
@ -105,17 +91,17 @@ class Test(unittest.TestCase):
|
|||||||
IWD.copy_to_storage('ssidUNameAndPWord.8021x')
|
IWD.copy_to_storage('ssidUNameAndPWord.8021x')
|
||||||
IWD.copy_to_storage('ssidPWord.8021x')
|
IWD.copy_to_storage('ssidPWord.8021x')
|
||||||
|
|
||||||
wd = IWD()
|
cls.wd = IWD()
|
||||||
|
|
||||||
device = wd.list_devices(1)[0]
|
device = cls.wd.list_devices(1)[0]
|
||||||
|
|
||||||
condition = 'not obj.scanning'
|
condition = 'not obj.scanning'
|
||||||
wd.wait_for_object_condition(device, condition)
|
cls.wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
device.scan()
|
device.scan()
|
||||||
|
|
||||||
condition = 'not obj.scanning'
|
condition = 'not obj.scanning'
|
||||||
wd.wait_for_object_condition(device, condition)
|
cls.wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -10,7 +10,6 @@ from iwd import DeviceState
|
|||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
@ -20,8 +19,7 @@ class Test(unittest.TestCase):
|
|||||||
devices = wd.list_devices(1)
|
devices = wd.list_devices(1)
|
||||||
device = devices[0]
|
device = devices[0]
|
||||||
|
|
||||||
hostapd_if = list(hostapd_map.values())[0]
|
hostapd = HostapdCLI(config='ssidOpen.conf')
|
||||||
hostapd = HostapdCLI(hostapd_if)
|
|
||||||
|
|
||||||
device.scan()
|
device.scan()
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ from iwd import NetworkType
|
|||||||
from hlrauc import AuthCenter
|
from hlrauc import AuthCenter
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ from iwd import NetworkType
|
|||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ from iwd import NetworkType
|
|||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
[General]
|
|
||||||
UseDefaultInterface=true
|
|
@ -10,7 +10,6 @@ from iwd import PSKAgent
|
|||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ from iwd import NetworkType
|
|||||||
from hlrauc import AuthCenter
|
from hlrauc import AuthCenter
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -9,23 +9,18 @@ from iwd import IWD
|
|||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
import testutil
|
import testutil
|
||||||
import hostapd
|
from hostapd import HostapdCLI
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def do_test_connection_success(self, ssid, passphrase=None):
|
def do_test_connection_success(self, ssid, passphrase=None):
|
||||||
|
hostapd = HostapdCLI(config=ssid + '.conf')
|
||||||
wd = IWD()
|
wd = IWD()
|
||||||
|
|
||||||
if passphrase:
|
if passphrase:
|
||||||
psk_agent = PSKAgent(passphrase)
|
psk_agent = PSKAgent(passphrase)
|
||||||
wd.register_psk_agent(psk_agent)
|
wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
hostapd_ifname = None
|
|
||||||
for ifname in hostapd.hostapd_map:
|
|
||||||
if ssid + '.conf' in hostapd.hostapd_map[ifname].config:
|
|
||||||
hostapd_ifname = ifname
|
|
||||||
break
|
|
||||||
|
|
||||||
devices = wd.list_devices(1)
|
devices = wd.list_devices(1)
|
||||||
device = devices[0]
|
device = devices[0]
|
||||||
|
|
||||||
@ -52,7 +47,7 @@ class Test(unittest.TestCase):
|
|||||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
testutil.test_iface_operstate()
|
testutil.test_iface_operstate()
|
||||||
testutil.test_ifaces_connected(hostapd_ifname, device.name)
|
testutil.test_ifaces_connected(hostapd.ifname, device.name)
|
||||||
|
|
||||||
device.disconnect()
|
device.disconnect()
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ from iwd import PSKAgent
|
|||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ from iwd import PSKAgent
|
|||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ from iwd import PSKAgent
|
|||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ from iwd import IWD
|
|||||||
from iwd import DeviceState
|
from iwd import DeviceState
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
@ -32,8 +31,7 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.hostapd_if = list(hostapd_map.values())[0]
|
cls.hostapd = HostapdCLI(config='ssid-wps-small-mtu.conf')
|
||||||
cls.hostapd = HostapdCLI(cls.hostapd_if)
|
|
||||||
|
|
||||||
cls.hostapd.wps_push_button()
|
cls.hostapd.wps_push_button()
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ from iwd import IWD
|
|||||||
from iwd import DeviceState
|
from iwd import DeviceState
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
@ -39,8 +38,7 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.hostapd_if = list(hostapd_map.values())[0]
|
cls.hostapd = HostapdCLI(config='ssidWPS.conf')
|
||||||
cls.hostapd = HostapdCLI(cls.hostapd_if)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -9,7 +9,6 @@ from iwd import IWD
|
|||||||
from iwd import DeviceState
|
from iwd import DeviceState
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
@ -42,8 +41,7 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.hostapd_if = list(hostapd_map.values())[0]
|
cls.hostapd = HostapdCLI(config='ssidWPS.conf')
|
||||||
cls.hostapd = HostapdCLI(cls.hostapd_if)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -9,8 +9,6 @@ from iwd import IWD
|
|||||||
from iwd import DeviceState
|
from iwd import DeviceState
|
||||||
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
from hostapd import hostapd_map
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def push_button_success(self, wd):
|
def push_button_success(self, wd):
|
||||||
@ -38,8 +36,7 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.hostapd_if = list(hostapd_map.values())[0]
|
cls.hostapd = HostapdCLI(config='ssidWPS.conf')
|
||||||
cls.hostapd = HostapdCLI(cls.hostapd_if)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -9,7 +9,6 @@ import iwd
|
|||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hostapd import hostapd_map
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import iwd
|
|||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hostapd import hostapd_map
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import iwd
|
|||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
from hostapd import HostapdCLI, hostapd_map
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
@ -9,7 +9,7 @@ from iwd import IWD
|
|||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
from hostapd import HostapdCLI, hostapd_map
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
@ -9,7 +9,7 @@ from iwd import IWD
|
|||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
from hostapd import HostapdCLI, hostapd_map
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
@ -9,7 +9,7 @@ from iwd import IWD
|
|||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
from hostapd import HostapdCLI, hostapd_map
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
@ -9,7 +9,7 @@ from iwd import IWD
|
|||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
from hostapd import HostapdCLI, hostapd_map
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
@ -24,12 +24,14 @@ class Test(unittest.TestCase):
|
|||||||
rule1.source = self.bss_radio[1].addresses[0]
|
rule1.source = self.bss_radio[1].addresses[0]
|
||||||
rule1.bidirectional = True
|
rule1.bidirectional = True
|
||||||
|
|
||||||
wd = IWD()
|
wd = self.wd
|
||||||
|
|
||||||
psk_agent = PSKAgent("EasilyGuessedPassword")
|
psk_agent = PSKAgent("EasilyGuessedPassword")
|
||||||
wd.register_psk_agent(psk_agent)
|
wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
device = wd.list_devices(1)[0]
|
device = wd.list_devices(1)[0]
|
||||||
|
# prevent autoconnect
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
# Check that iwd selects BSS 0 first
|
# Check that iwd selects BSS 0 first
|
||||||
rule0.signal = -2000
|
rule0.signal = -2000
|
||||||
@ -107,12 +109,14 @@ class Test(unittest.TestCase):
|
|||||||
rule1.source = self.bss_radio[1].addresses[0]
|
rule1.source = self.bss_radio[1].addresses[0]
|
||||||
rule1.bidirectional = True
|
rule1.bidirectional = True
|
||||||
|
|
||||||
wd = IWD()
|
wd = self.wd
|
||||||
|
|
||||||
psk_agent = PSKAgent("EasilyGuessedPassword")
|
psk_agent = PSKAgent("EasilyGuessedPassword")
|
||||||
wd.register_psk_agent(psk_agent)
|
wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
device = wd.list_devices(1)[0]
|
device = wd.list_devices(1)[0]
|
||||||
|
# prevent autoconnect
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
# Check that iwd selects BSS 0 first
|
# Check that iwd selects BSS 0 first
|
||||||
rule0.signal = -2000
|
rule0.signal = -2000
|
||||||
@ -176,6 +180,8 @@ class Test(unittest.TestCase):
|
|||||||
testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
|
testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
|
||||||
self.assertRaises(Exception, testutil.test_ifaces_connected,
|
self.assertRaises(Exception, testutil.test_ifaces_connected,
|
||||||
(self.bss_hostapd[0].ifname, device.name))
|
(self.bss_hostapd[0].ifname, device.name))
|
||||||
|
def setUp(self):
|
||||||
|
self.wd = IWD()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down')
|
os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down')
|
||||||
@ -184,15 +190,14 @@ class Test(unittest.TestCase):
|
|||||||
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
|
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
|
||||||
|
|
||||||
hwsim = Hwsim()
|
hwsim = Hwsim()
|
||||||
wd = IWD()
|
device = self.wd.list_devices(1)[0]
|
||||||
device = wd.list_devices(1)[0]
|
|
||||||
try:
|
try:
|
||||||
device.disconnect()
|
device.disconnect()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.disconnected'
|
condition = 'obj.state == DeviceState.disconnected'
|
||||||
wd.wait_for_object_condition(device, condition)
|
self.wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
for rule in list(hwsim.rules.keys()):
|
for rule in list(hwsim.rules.keys()):
|
||||||
del hwsim.rules[rule]
|
del hwsim.rules[rule]
|
@ -9,7 +9,7 @@ from iwd import IWD
|
|||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
from hostapd import HostapdCLI, hostapd_map
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
@ -9,9 +9,9 @@ from iwd import IWD
|
|||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
from hostapd import HostapdCLI, hostapd_map
|
|
||||||
import testutil
|
import testutil
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
from hostapd import HostapdCLI
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
def do_connect(self, wd, device, hostapd):
|
def do_connect(self, wd, device, hostapd):
|
@ -7,7 +7,6 @@ sys.path.append('../util')
|
|||||||
import iwd
|
import iwd
|
||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hostapd import hostapd_map
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ sys.path.append('../util')
|
|||||||
import iwd
|
import iwd
|
||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hostapd import hostapd_map
|
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from iwd import IWD
|
|||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
from hostapd import HostapdCLI, hostapd_map
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
@ -8,17 +8,13 @@ import iwd
|
|||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hostapd import hostapd_map
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def validate_connection(self, wd):
|
def validate_connection(self, wd):
|
||||||
hostapd_if = None
|
hostapd = HostapdCLI(config='ssidSAE.conf')
|
||||||
|
|
||||||
for hostapd in hostapd_map.values():
|
|
||||||
if hostapd.config == 'ssidSAE.conf':
|
|
||||||
hostapd_if = hostapd.name
|
|
||||||
|
|
||||||
psk_agent = PSKAgent("secret123")
|
psk_agent = PSKAgent("secret123")
|
||||||
wd.register_psk_agent(psk_agent)
|
wd.register_psk_agent(psk_agent)
|
||||||
@ -56,7 +52,7 @@ class Test(unittest.TestCase):
|
|||||||
wd.wait(2)
|
wd.wait(2)
|
||||||
|
|
||||||
testutil.test_iface_operstate(intf=device.name)
|
testutil.test_iface_operstate(intf=device.name)
|
||||||
testutil.test_ifaces_connected(if0=device.name, if1=hostapd_if)
|
testutil.test_ifaces_connected(if0=device.name, if1=hostapd.ifname)
|
||||||
|
|
||||||
device.disconnect()
|
device.disconnect()
|
||||||
|
|
||||||
|
@ -8,17 +8,13 @@ import iwd
|
|||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hostapd import hostapd_map
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def validate_connection(self, wd):
|
def validate_connection(self, wd):
|
||||||
hostapd_if = None
|
hostapd = HostapdCLI(config='ssidSAE-20.conf')
|
||||||
|
|
||||||
for hostapd in hostapd_map.values():
|
|
||||||
if hostapd.config == 'ssidSAE-20.conf':
|
|
||||||
hostapd_if = hostapd.name
|
|
||||||
|
|
||||||
psk_agent = PSKAgent("secret123")
|
psk_agent = PSKAgent("secret123")
|
||||||
wd.register_psk_agent(psk_agent)
|
wd.register_psk_agent(psk_agent)
|
||||||
@ -56,7 +52,7 @@ class Test(unittest.TestCase):
|
|||||||
wd.wait(2)
|
wd.wait(2)
|
||||||
|
|
||||||
testutil.test_iface_operstate(intf=device.name)
|
testutil.test_iface_operstate(intf=device.name)
|
||||||
testutil.test_ifaces_connected(if0=device.name, if1=hostapd_if)
|
testutil.test_ifaces_connected(if0=device.name, if1=hostapd.ifname)
|
||||||
|
|
||||||
device.disconnect()
|
device.disconnect()
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from iwd import IWD
|
|||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
from hostapd import HostapdCLI, hostapd_map
|
from hostapd import HostapdCLI
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import iwd
|
|||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
from hostapd import HostapdCLI, hostapd_map
|
from hostapd import HostapdCLI
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user