mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
auto-t: modify scan test to include hidden networks
This commit is contained in:
parent
4f953586e6
commit
e64c1e5dc7
@ -1,7 +1,11 @@
|
||||
[SETUP]
|
||||
num_radios=4
|
||||
num_radios=5
|
||||
start_iwd=0
|
||||
max_test_exec_interval_sec=60
|
||||
tmpfs_extra_stuff=../misc/certs:../misc/secrets
|
||||
|
||||
[HOSTAPD]
|
||||
rad0=ssidOpen.conf
|
||||
rad1=ssidTKIP.conf
|
||||
rad2=ssidCCMP.conf
|
||||
rad0=ssid_hidden.conf
|
||||
rad1=ssid_open.conf
|
||||
rad2=ssid_8021x.conf
|
||||
rad3=ssid_psk.conf
|
||||
|
81
autotests/testScan/periodic_scan_test.py
Normal file
81
autotests/testScan/periodic_scan_test.py
Normal file
@ -0,0 +1,81 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
|
||||
sys.path.append('../util')
|
||||
import iwd
|
||||
from iwd import IWD
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
dict = {
|
||||
'ssid_open': False,
|
||||
'ssid_psk': False,
|
||||
'ssid_8021x': False,
|
||||
'ssid_hidden_5': False,
|
||||
'ssid_hidden_6': False,
|
||||
'ssid_hidden_7': False,
|
||||
'ssid_hidden_8': False,
|
||||
'ssid_hidden_9': False,
|
||||
}
|
||||
|
||||
def set_network(self, ssid):
|
||||
if ssid not in self.dict:
|
||||
return;
|
||||
|
||||
if self.dict[ssid]:
|
||||
raise Exception('Duplicated list entry')
|
||||
|
||||
self.dict[ssid] = True
|
||||
|
||||
def validate_scan(self, wd):
|
||||
devices = wd.list_devices(1);
|
||||
self.assertIsNotNone(devices)
|
||||
device = devices[0]
|
||||
|
||||
# Device initiates a passive periodic scan.
|
||||
condition = 'obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
condition = 'not obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
# Hidden networks observed in the scan results, device initialtes a
|
||||
# second active periodic scan to discover the known hidden networks.
|
||||
condition = 'obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
condition = 'not obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
ordered_networks = device.get_ordered_networks()
|
||||
|
||||
for network in ordered_networks:
|
||||
self.set_network(network.name)
|
||||
|
||||
def test_scan(self):
|
||||
wd = IWD(True)
|
||||
|
||||
try:
|
||||
self.validate_scan(wd)
|
||||
except:
|
||||
del wd
|
||||
raise
|
||||
|
||||
del wd
|
||||
|
||||
for ssid, seen in self.dict.items():
|
||||
self.assertEqual(seen, True)
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
IWD.copy_to_storage('ssid_hidden_5.open')
|
||||
IWD.copy_to_storage('ssid_hidden_6.open')
|
||||
IWD.copy_to_storage('ssid_hidden_7.open')
|
||||
IWD.copy_to_storage('ssid_hidden_8.open')
|
||||
IWD.copy_to_storage('ssid_hidden_9.open')
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
IWD.clear_storage()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(exit=True)
|
83
autotests/testScan/requested_scan_test.py
Normal file
83
autotests/testScan/requested_scan_test.py
Normal file
@ -0,0 +1,83 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
|
||||
sys.path.append('../util')
|
||||
import iwd
|
||||
from iwd import IWD
|
||||
from iwd import NetworkType
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
dict = {
|
||||
'ssid_open': False,
|
||||
'ssid_psk': False,
|
||||
'ssid_8021x': False,
|
||||
'ssid_hidden_0': False,
|
||||
'ssid_hidden_1': False,
|
||||
'ssid_hidden_2': False,
|
||||
'ssid_hidden_3': False,
|
||||
'ssid_hidden_4': False,
|
||||
}
|
||||
|
||||
def set_network(self, ssid):
|
||||
if ssid not in self.dict:
|
||||
return;
|
||||
|
||||
if self.dict[ssid]:
|
||||
raise Exception('Duplicated list entry')
|
||||
|
||||
self.dict[ssid] = True
|
||||
|
||||
def validate_scan(self, wd):
|
||||
devices = wd.list_devices(1);
|
||||
self.assertIsNotNone(devices)
|
||||
device = devices[0]
|
||||
|
||||
condition = 'obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition, 20)
|
||||
condition = 'not obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition, 20)
|
||||
|
||||
device.scan()
|
||||
|
||||
condition = 'obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
condition = 'not obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
ordered_networks = device.get_ordered_networks()
|
||||
|
||||
for network in ordered_networks:
|
||||
self.set_network(network.name)
|
||||
|
||||
def test_scan(self):
|
||||
wd = IWD(True)
|
||||
|
||||
try:
|
||||
self.validate_scan(wd)
|
||||
except:
|
||||
del wd
|
||||
raise
|
||||
|
||||
del wd
|
||||
|
||||
for ssid, seen in self.dict.items():
|
||||
self.assertEqual(seen, True)
|
||||
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
IWD.copy_to_storage('ssid_hidden_0.open')
|
||||
IWD.copy_to_storage('ssid_hidden_1.open')
|
||||
IWD.copy_to_storage('ssid_hidden_2.open')
|
||||
IWD.copy_to_storage('ssid_hidden_3.open')
|
||||
IWD.copy_to_storage('ssid_hidden_4.open')
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
IWD.clear_storage()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(exit=True)
|
@ -1,7 +0,0 @@
|
||||
hw_mode=g
|
||||
channel=1
|
||||
ssid=ssidCCMP
|
||||
|
||||
wpa=2
|
||||
wpa_pairwise=CCMP
|
||||
wpa_passphrase=secret123
|
12
autotests/testScan/ssid_8021x.conf
Normal file
12
autotests/testScan/ssid_8021x.conf
Normal file
@ -0,0 +1,12 @@
|
||||
hw_mode=g
|
||||
channel=1
|
||||
ssid=ssid_8021x
|
||||
|
||||
wpa=3
|
||||
wpa_key_mgmt=WPA-EAP
|
||||
ieee8021x=1
|
||||
eap_server=1
|
||||
eap_user_file=/tmp/certs/eap-user-tls.text
|
||||
ca_cert=/tmp/certs/cert-ca.pem
|
||||
server_cert=/tmp/certs/cert-server.pem
|
||||
private_key=/tmp/certs/cert-server-key.pem
|
41
autotests/testScan/ssid_hidden.conf
Normal file
41
autotests/testScan/ssid_hidden.conf
Normal file
@ -0,0 +1,41 @@
|
||||
ssid=ssid_hidden_0
|
||||
interface=wln0
|
||||
hw_mode=g
|
||||
channel=1
|
||||
ignore_broadcast_ssid=1
|
||||
|
||||
bss=wln0_1
|
||||
ssid=ssid_hidden_1
|
||||
ignore_broadcast_ssid=1
|
||||
|
||||
bss=wln0_2
|
||||
ssid=ssid_hidden_2
|
||||
ignore_broadcast_ssid=1
|
||||
|
||||
bss=wln0_3
|
||||
ssid=ssid_hidden_3
|
||||
ignore_broadcast_ssid=1
|
||||
|
||||
bss=wln0_4
|
||||
ssid=ssid_hidden_4
|
||||
ignore_broadcast_ssid=1
|
||||
|
||||
bss=wln0_5
|
||||
ssid=ssid_hidden_5
|
||||
ignore_broadcast_ssid=1
|
||||
|
||||
bss=wln0_6
|
||||
ssid=ssid_hidden_6
|
||||
ignore_broadcast_ssid=1
|
||||
|
||||
bss=wln0_7
|
||||
ssid=ssid_hidden_7
|
||||
ignore_broadcast_ssid=1
|
||||
|
||||
bss=wln0_8
|
||||
ssid=ssid_hidden_8
|
||||
ignore_broadcast_ssid=1
|
||||
|
||||
bss=wln0_9
|
||||
ssid=ssid_hidden_9
|
||||
ignore_broadcast_ssid=1
|
3
autotests/testScan/ssid_hidden_0.open
Normal file
3
autotests/testScan/ssid_hidden_0.open
Normal file
@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
Autoconnect=false
|
||||
Hidden=true
|
3
autotests/testScan/ssid_hidden_1.open
Normal file
3
autotests/testScan/ssid_hidden_1.open
Normal file
@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
Autoconnect=false
|
||||
Hidden=true
|
3
autotests/testScan/ssid_hidden_2.open
Normal file
3
autotests/testScan/ssid_hidden_2.open
Normal file
@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
Autoconnect=false
|
||||
Hidden=true
|
3
autotests/testScan/ssid_hidden_3.open
Normal file
3
autotests/testScan/ssid_hidden_3.open
Normal file
@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
Autoconnect=false
|
||||
Hidden=true
|
3
autotests/testScan/ssid_hidden_4.open
Normal file
3
autotests/testScan/ssid_hidden_4.open
Normal file
@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
Autoconnect=false
|
||||
Hidden=true
|
3
autotests/testScan/ssid_hidden_5.open
Normal file
3
autotests/testScan/ssid_hidden_5.open
Normal file
@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
Autoconnect=false
|
||||
Hidden=true
|
3
autotests/testScan/ssid_hidden_6.open
Normal file
3
autotests/testScan/ssid_hidden_6.open
Normal file
@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
Autoconnect=false
|
||||
Hidden=true
|
3
autotests/testScan/ssid_hidden_7.open
Normal file
3
autotests/testScan/ssid_hidden_7.open
Normal file
@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
Autoconnect=false
|
||||
Hidden=true
|
3
autotests/testScan/ssid_hidden_8.open
Normal file
3
autotests/testScan/ssid_hidden_8.open
Normal file
@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
Autoconnect=false
|
||||
Hidden=true
|
3
autotests/testScan/ssid_hidden_9.open
Normal file
3
autotests/testScan/ssid_hidden_9.open
Normal file
@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
Autoconnect=false
|
||||
Hidden=true
|
@ -1,3 +1,3 @@
|
||||
hw_mode=g
|
||||
channel=1
|
||||
ssid=ssidOpen
|
||||
ssid=ssid_open
|
@ -1,6 +1,6 @@
|
||||
hw_mode=g
|
||||
channel=1
|
||||
ssid=ssidTKIP
|
||||
ssid=ssid_psk
|
||||
|
||||
wpa=1
|
||||
wpa_pairwise=TKIP
|
@ -1,65 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
|
||||
sys.path.append('../util')
|
||||
import iwd
|
||||
from iwd import IWD
|
||||
from iwd import NetworkType
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_scan(self):
|
||||
wd = IWD()
|
||||
|
||||
devices = wd.list_devices();
|
||||
self.assertIsNotNone(devices)
|
||||
device = devices[0]
|
||||
|
||||
condition = 'not obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
device.scan()
|
||||
|
||||
condition = 'not obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
ordered_networks = device.get_ordered_networks()
|
||||
|
||||
seen = [0] * 3
|
||||
for o_n in ordered_networks:
|
||||
if o_n.name == "ssidOpen":
|
||||
self.assertEqual(o_n.type, NetworkType.open)
|
||||
if seen[0]:
|
||||
raise Exception('Duplicated list entry')
|
||||
else:
|
||||
seen[0] = 1
|
||||
elif o_n.name == "ssidTKIP":
|
||||
self.assertEqual(o_n.type, NetworkType.psk)
|
||||
if seen[1]:
|
||||
raise Exception('Duplicated list entry')
|
||||
else:
|
||||
seen[1] = 1
|
||||
elif o_n.name == "ssidCCMP":
|
||||
self.assertEqual(o_n.type, NetworkType.psk)
|
||||
if seen[2]:
|
||||
raise Exception('Duplicated list entry')
|
||||
else:
|
||||
seen[2] = 1
|
||||
else:
|
||||
raise Exception()
|
||||
|
||||
for entry in seen:
|
||||
self.assertNotEqual(entry, 0)
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
IWD.clear_storage()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(exit=True)
|
Loading…
Reference in New Issue
Block a user