From 36b59b0c87376e6b91bf56475343cb0ced1149fb Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 21 Dec 2020 18:23:52 +0100 Subject: smoketest: wifi: add testcase for bridging an AP interface --- smoketest/scripts/cli/test_interfaces_wireless.py | 31 ++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'smoketest') diff --git a/smoketest/scripts/cli/test_interfaces_wireless.py b/smoketest/scripts/cli/test_interfaces_wireless.py index def989e76..70cb5190c 100755 --- a/smoketest/scripts/cli/test_interfaces_wireless.py +++ b/smoketest/scripts/cli/test_interfaces_wireless.py @@ -18,9 +18,10 @@ import os import re import unittest -from vyos.configsession import ConfigSessionError from base_interfaces_test import BasicInterfaceTest +from glob import glob +from vyos.configsession import ConfigSessionError from vyos.util import process_named_running from vyos.util import check_kmod from vyos.util import read_file @@ -207,6 +208,34 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest): # Check for running process self.assertTrue(process_named_running('hostapd')) + def test_access_point_bridge(self): + interface = 'wlan0' + ssid = 'VyOS-Test' + bridge = 'br42477' + + # We need a bridge where we can hook our access-point interface to + bridge_path = ['interfaces', 'bridge', bridge] + self.session.set(bridge_path + ['member', 'interface', interface]) + + self.session.set(self._base_path + [interface, 'ssid', ssid]) + self.session.set(self._base_path + [interface, 'country-code', 'se']) + self.session.set(self._base_path + [interface, 'type', 'access-point']) + + self.session.commit() + + # Check for running process + self.assertTrue(process_named_running('hostapd')) + + bridge_members = [] + for tmp in glob(f'/sys/class/net/{bridge}/lower_*'): + bridge_members.append(os.path.basename(tmp).replace('lower_', '')) + + self.assertIn(interface, bridge_members) + + self.session.delete(bridge_path) + self.session.delete(self._base_path) + self.session.commit() + if __name__ == '__main__': check_kmod('mac80211_hwsim') unittest.main() -- cgit v1.2.3