mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-20 11:40:40 +01:00
auto-t: add AP test for all pairwise/group cipher combos
Iterates through every possible cipher combination and verifies the AP can authenticate the clients.
This commit is contained in:
parent
13b7aa9715
commit
b9855f7d62
2
autotests/testAP/TestAP2.ap
Normal file
2
autotests/testAP/TestAP2.ap
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=Password2
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/python3
|
#! /usr/bin/python3
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
import os
|
||||||
|
|
||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from config import ctx
|
from config import ctx
|
||||||
@ -8,6 +9,8 @@ from validation import validate, client_connect
|
|||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
def test_connection_success(self):
|
def test_connection_success(self):
|
||||||
|
IWD.copy_to_storage('TestAP1.psk')
|
||||||
|
|
||||||
wd = IWD(True)
|
wd = IWD(True)
|
||||||
|
|
||||||
dev1, dev2 = wd.list_devices(2)
|
dev1, dev2 = wd.list_devices(2)
|
||||||
@ -22,6 +25,8 @@ class Test(unittest.TestCase):
|
|||||||
client_connect(wd, dev1, 'TestAP1')
|
client_connect(wd, dev1, 'TestAP1')
|
||||||
|
|
||||||
def test_client_start_ap(self):
|
def test_client_start_ap(self):
|
||||||
|
IWD.copy_to_storage('TestAP1.psk')
|
||||||
|
|
||||||
wd = IWD(True)
|
wd = IWD(True)
|
||||||
|
|
||||||
dev1, dev2 = wd.list_devices(2)
|
dev1, dev2 = wd.list_devices(2)
|
||||||
@ -39,12 +44,33 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
validate(wd, dev2, dev1, 'TestAP2', 'Password2')
|
validate(wd, dev2, dev1, 'TestAP2', 'Password2')
|
||||||
|
|
||||||
@classmethod
|
def test_valid_ciphers(self):
|
||||||
def setUpClass(cls):
|
ciphers = ['TKIP', 'CCMP-128', 'GCMP-128', 'CCMP-256', 'GCMP-256']
|
||||||
IWD.copy_to_storage('TestAP1.psk')
|
|
||||||
|
|
||||||
@classmethod
|
for group in ciphers:
|
||||||
def tearDownClass(cls):
|
for pairwise in ciphers:
|
||||||
|
IWD.copy_to_ap('TestAP2.ap')
|
||||||
|
os.system('echo "PairwiseCiphers=%s" >> /tmp/iwd/ap/TestAP2.ap' % pairwise)
|
||||||
|
os.system('echo "GroupCipher=%s" >> /tmp/iwd/ap/TestAP2.ap' % group)
|
||||||
|
|
||||||
|
wd = IWD(True)
|
||||||
|
|
||||||
|
dev1, dev2 = wd.list_devices(2)
|
||||||
|
|
||||||
|
dev1.start_ap('TestAP2')
|
||||||
|
|
||||||
|
self.assertTrue(dev1.group_cipher == group)
|
||||||
|
self.assertTrue(dev1.pairwise_ciphers == pairwise)
|
||||||
|
|
||||||
|
try:
|
||||||
|
validate(wd, dev2, dev1, 'TestAP2', 'Password2', ip_checks=False)
|
||||||
|
except:
|
||||||
|
raise Exception("Failed with pairwise=%s group=%s" % (pairwise, group))
|
||||||
|
finally:
|
||||||
|
IWD.clear_storage()
|
||||||
|
del wd
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
IWD.clear_storage()
|
IWD.clear_storage()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user