Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Wireless interface connected to a network interface not shown #314

Closed
nemesifier opened this issue Aug 30, 2024 · 0 comments · Fixed by #315
Closed

[bug] Wireless interface connected to a network interface not shown #314

nemesifier opened this issue Aug 30, 2024 · 0 comments · Fixed by #315
Labels

Comments

@nemesifier
Copy link
Member

Describe the bug
When having a wireless interface connected to a virtual or ethernet interface, one of the wireless interface is not generated.

I suspect this is a regression introduced in #298.

Steps To Reproduce

This bug should affect only the latest master. This patch provides a failing test:

diff --git a/tests/openwrt/test_wireless.py b/tests/openwrt/test_wireless.py
index 0943dc3..ccf2ad4 100644
--- a/tests/openwrt/test_wireless.py
+++ b/tests/openwrt/test_wireless.py
@@ -1167,3 +1167,106 @@ config wifi-iface 'wifi_wlan1'
     def test_parse_wireless_only(self):
         o = OpenWrt(native=self._wireless_only_uci)
         self.assertDictEqual(o.config, self._wireless_only_netjson)
+
+    _wpa_eap_sta = {
+        "interfaces": [
+            {
+                "wireless": {
+                    "network": [
+                        "wwan"
+                    ],
+                    "mode": "station",
+                    "radio": "radio1",
+                    "ack_distance": 0,
+                    "rts_threshold": 0,
+                    "frag_threshold": 0,
+                    "ssid": "SSID",
+                    "bssid": "",
+                    "wds": False,
+                    "encryption": {
+                        "cipher": "auto",
+                        "ieee80211w": "1",
+                        "protocol": "wpa2_enterprise",
+                        "eap_type": "ttls",
+                        "auth": "PAP",
+                        "identity": "username",
+                        "password": "password123",
+                        "ca_cert": "",
+                        "client_cert": "",
+                        "priv_key": "",
+                        "priv_key_pwd": ""
+                    }
+                },
+                "type": "wireless",
+                "name": "wwan",
+                "mtu": 1500,
+                "disabled": False,
+                "network": "",
+                "mac": "00:11:22:33:44:55",
+                "autostart": True,
+                "addresses": []
+            },
+            {
+                "type": "virtual",
+                "name": "wwan",
+                "network": "wwan",
+                "addresses": [
+                    {
+                        "proto": "dhcp",
+                        "family": "ipv4"
+                    }
+                ]
+            }
+        ]
+    }
+    _wireless_eap_uci = """package network
+
+config interface 'wwan'
+    option ifname 'wwan'
+    option proto 'dhcp'
+
+package wireless
+
+config wifi-iface 'wifi_wlan0'
+    option device 'radio0'
+    option ifname 'wlan0'
+    option mode 'ap'
+    option network 'vlan10'
+    option ssid 'WifiVLAN10'
+
+config wifi-iface 'wifi_wlan1'
+    option device 'radio0'
+    option ifname 'wlan1'
+    option mode 'ap'
+    option network 'vlan20'
+    option ssid 'WifiVLAN20'
+
+config wifi-iface 'wifi_wwan'
+    option auth 'PAP'
+    option device 'radio1'
+    option disabled '0'
+    option eap_type 'ttls'
+    option encryption 'wpa2'
+    option identity 'username'
+    option ieee80211w '1'
+    option ifname 'wwan'
+    option macaddr '00:11:22:33:44:55'
+    option mode 'sta'
+    option network 'wwan'
+    option password 'password123'
+    option ssid 'SSID'
+    option wds '0'
+"""
+
+    def test_render_wireless_wpa_eap(self):
+        templates = [self._wireless_only_netjson, self._wpa_eap_sta]
+        o = OpenWrt({}, templates=templates)
+        # print(o.render())
+        # print(OpenWrt(self._wpa_eap_sta).render())
+        # print(OpenWrt(self._wpa_eap_sta, templates=[self._wireless_only_netjson]).render())
+        expected = self._tabs(self._wireless_eap_uci)
+        self.assertEqual(o.render(), expected)
+
+    # def test_parse_wireless_wpa_eap(self):
+    #     o = OpenWrt(native=self._wireless_only_uci)
+    #     self.assertDictEqual(o.config, self._wireless_only_netjson)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 participant