From a16a91fe5f93921b172ef8cacad21e65246552a7 Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Sun, 15 May 2022 16:34:04 -0400 Subject: [PATCH] [fix] Fixed parsing wifi interface boolean typecasting --- netjsonconfig/backends/openwrt/converters/wireless.py | 8 +++++++- tests/openwrt/test_wireless.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/netjsonconfig/backends/openwrt/converters/wireless.py b/netjsonconfig/backends/openwrt/converters/wireless.py index 23aa97cd6..e0a404cf1 100644 --- a/netjsonconfig/backends/openwrt/converters/wireless.py +++ b/netjsonconfig/backends/openwrt/converters/wireless.py @@ -209,6 +209,12 @@ def __netjson_wifi_typecast(self, wifi): 'ft_psk_generate_local', 'ieee80211r', 'rsn_preauth', + 'isolate', + 'doth', + 'wmm', + 'short_preamble', + 'start_disabled', + 'default_disabled', ]: if attr in wifi: wifi[attr] = wifi[attr] == '1' @@ -255,7 +261,7 @@ def __netjson_wifi_typecast(self, wifi): 'wps_pin', ] - def __netjson_encryption(self, wifi): # noqa: max-complexity: 11 + def __netjson_encryption(self, wifi): # noqa: C901 if 'encryption' not in wifi: return settings = {} diff --git a/tests/openwrt/test_wireless.py b/tests/openwrt/test_wireless.py index cfe084104..6dda7511f 100644 --- a/tests/openwrt/test_wireless.py +++ b/tests/openwrt/test_wireless.py @@ -30,6 +30,7 @@ class TestWireless(unittest.TestCase, _TabsMixin): "ack_distance": 300, "rts_threshold": 1300, "frag_threshold": 1500, + "isolate": True, }, } ] @@ -53,6 +54,7 @@ class TestWireless(unittest.TestCase, _TabsMixin): option frag '1500' option hidden '1' option ifname 'wlan0' + option isolate '1' option mode 'ap' option network 'wlan0' option rts '1300'