eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

timeout_test.py (2638B)


      1 #!/usr/bin/python3
      2 
      3 import unittest
      4 import sys
      5 
      6 sys.path.append('../util')
      7 import iwd
      8 from iwd import IWD
      9 from iwd import PSKAgent
     10 from iwd import NetworkType
     11 from hwsim import Hwsim
     12 from hostapd import HostapdCLI
     13 from config import ctx
     14 
     15 class Test(unittest.TestCase):
     16 
     17     def validate_connection(self, wd):
     18         psk_agent = PSKAgent(["secret123", "secret123"])
     19         wd.register_psk_agent(psk_agent)
     20 
     21         devices = wd.list_devices(1)
     22         self.assertIsNotNone(devices)
     23         device = devices[0]
     24 
     25         network = device.get_ordered_network('ssidSAE')
     26 
     27         self.assertEqual(network.type, NetworkType.psk)
     28 
     29         condition = 'not obj.connected'
     30         wd.wait_for_object_condition(network.network_object, condition)
     31 
     32         network.network_object.connect()
     33 
     34         condition = 'obj.state == DeviceState.connected'
     35         wd.wait_for_object_condition(device, condition)
     36 
     37     def test_not_acked_commit(self):
     38         #
     39         # TODO: This merely forces group 19 by acting as a 'buggy' AP. This is
     40         # needed because the hwsim rule only matches once and must be matched
     41         # on the first commit, not during group negotiation.
     42         #
     43         self.hostapd.set_value('vendor_elements', 'dd0cf4f5e8050500000000000000')
     44         self.hostapd.reload()
     45 
     46         hwsim = Hwsim()
     47         bss_radio = hwsim.get_radio('rad0')
     48 
     49         rule0 = hwsim.rules.create()
     50         rule0.source = bss_radio.addresses[0]
     51         rule0.drop = True
     52         rule0.prefix = 'b0'
     53         rule0.match = '01 00 00 00 13 00'
     54         rule0.match_offset = 26
     55         rule0.match_times = 1
     56         rule0.drop_ack = True
     57         rule0.enabled = True
     58 
     59         wd = IWD(True)
     60         self.validate_connection(wd)
     61 
     62         rule0.remove()
     63 
     64     def test_sta_confirm_not_acked(self):
     65         self.hostapd.set_value('vendor_elements', 'dd0cf4f5e8050500000000000000')
     66         self.hostapd.reload()
     67 
     68         hwsim = Hwsim()
     69         bss_radio = hwsim.get_radio('rad0')
     70 
     71         rule0 = hwsim.rules.create()
     72         rule0.source = bss_radio.addresses[0]
     73         rule0.drop = True
     74         rule0.prefix = 'b0'
     75         rule0.match = '02 00 00 00'
     76         rule0.match_offset = 26
     77         rule0.match_times = 1
     78         rule0.drop_ack = True
     79         rule0.enabled = True
     80 
     81         wd = IWD(True)
     82         self.validate_connection(wd)
     83 
     84         rule0.remove()
     85 
     86     def setUp(self):
     87         self.hostapd = HostapdCLI(config='ssidSAE.conf')
     88         self.hostapd.default()
     89 
     90     @classmethod
     91     def setUpClass(cls):
     92         pass
     93 
     94     @classmethod
     95     def tearDownClass(cls):
     96         IWD.clear_storage()
     97 
     98 if __name__ == '__main__':
     99     unittest.main(exit=True)