Fix usage of mac address patterns in schema.py to allow using variables

Open
#238 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@lpalgarvio is already working on this.

Since Jun 20, 2022.

  • #239 by @lpalgarvio — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
networking

Research direction

Start in schema.py and reproduce the save operation using the station WiFi configuration shown in the issue, focusing on the MAC address pattern handling for the BSSID field. Done means a variable in BSSID remains intact after saving and the resulting configuration remains valid JSON.

Written by the indexing model from the issue text.

Description

Hello,
Everytime i try to add a variable to BSSID field on a WiFi interface configured as station,
It breaks the JSON configuration after/during saving.

ie,

        {
            "wireless": {
                "network": [
                    "lan"
                ],
                "mode": "station",
                "radio": "radio1",
                "ssid": "{{wireless_wlan0sta_ssid}}",
                "bssid": "00:11:22:33:44:55",
                "wds": true,
                "encryption": {
                    "protocol": "wpa2_personal",
                    "key": "{{wireless_wlan0sta_key}}",
                    "cipher": "ccmp",
                    "ieee80211w": "1"
                }
            },
            "type": "wireless",
            "name": "radio1sta",
            "network": "wlan1sta"
        },

becomes

        {
            "type": "ethernet",
            "name": "radio1sta",
            "network": "wlan1sta",
            "wireless": {
                "network": [
                    "lan"
                ],
                "mode": "station",
                "radio": "radio1",
                "ssid": "{{wireless_wlan1sta_ssid}}",
                "bssid": "{{wireless_wlan1sta_bsid}}",
                "wds": true,
                "encryption": {
                    "protocol": "wpa2_personal",
                    "key": "{{wireless_wlan1sta_key}}",
                    "cipher": "ccmp",
                    "ieee80211w": "1"
                }
            }
        }

I haven't looked at the code but i can try make a PR sometime later if i find the issue

Dominant language
Python
Stars
389
Forks
97
Avg merge
1d 14m
Merged PRs (30d)
14

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openwisp/netjsonconfig

All issues in openwisp/netjsonconfig

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.