3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-10-27 23:29:24 +01:00
iwd/autotests/testEAP-TLS/connection_test.py
Andrew Zaborowski 71c15306fd autotests: Test communication when iwd reports connected
Test that the AP interface and the station interface managed by iwd
can actually send and receive ethernet traffic when iwd is in the
connected state.  Due to linux routing none of the high level utilities
like ping or arping can be easily used to test communication between
two interfaces of the same machine so use a method based on the
mac80211_hwsim/tools/hwsim_test.c utility in the wpa_supplicant tree
that uses a raw socket to inject unicast and broadcast frames.

Add this check in three tests of different security type connections
that simulate a single AP, and the two roaming tests with two APs.
Check that the station can't communicate with the other AP's interface.
2017-05-30 17:08:31 -05:00

60 lines
1.5 KiB
Python

#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import NetworkType
import testutil
class Test(unittest.TestCase):
def test_connection_success(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()
ordered_network = ordered_networks[0]
self.assertEqual(ordered_network.name, "ssidEAP-TLS")
self.assertEqual(ordered_network.type, NetworkType.eap)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
ordered_network.network_object.connect()
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
testutil.test_ifaces_connected()
device.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
@classmethod
def setUpClass(cls):
IWD.copy_to_storage('ssidEAP-TLS.8021x')
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)