template validation bug?

46 views
Skip to first unread message

yves baumes

unread,
Jul 30, 2021, 8:44:26 AM7/30/21
to OpenWISP
Hello,

here is a TEMPLATE I've created:
```
{
    "radios": [
        {
            "protocol": "802.11n",
            "name": "radio0",
            "phy": "",
            "channel": 0,
            "channel_width": 20,
            "tx_power": 10,
            "country": "FR",
            "disabled": false,
            "driver": "mac80211",
            "hwmode": "11a"
        },
        {
            "protocol": "802.11n",
            "name": "radio1",
            "phy": "",
            "channel": 0,
            "channel_width": 20,
            "tx_power": 10,
            "country": "FR",
            "disabled": false,
            "driver": "mac80211",
            "hwmode": "11g"
        }
    ],
    "switch": [
        {
            "name": "switch0",
            "reset": true,
            "enable_vlan": true,
            "vlan": [
                {
                    "device": "switch0",
                    "vlan": 3170,
                    "ports": "0t 1t"
                }
            ]
        }
    ],
    "interfaces": [
        {
            "wireless": {
                "network": [],
                "mode": "access_point",
                "radio": "radio1",
                "ack_distance": 0,
                "rts_threshold": 0,
                "frag_threshold": 0,
                "ssid": "yves-test",
                "hidden": false,
                "wds": true,
                "encryption": {
                    "protocol": "wpa2_personal",
                    "key": "secretkey",
                    "disabled": false,
                    "cipher": "auto"
                },
                "wmm": true,
                "isolate": false,
                "macfilter": "disable",
                "maclist": []
            },
            "type": "wireless",
            "name": "wlan1",
            "mtu": 1500,
            "mac": "",
            "autostart": true,
            "disabled": false,
            "addresses": [],
            "network": "bb"
        },
        {
            "type": "bridge",
            "stp": false,
            "bridge_members": [
                "eth0"
            ],
            "name": "bb",
            "mtu": 1500,
            "mac": "",
            "autostart": true,
            "disabled": false,
            "addresses": [],
            "network": "",
            "igmp_snooping": true
        }
    ]
}
```

I'm trying to apply it to a device. And the issue is that it is rejeted by the validator with the following message:

"There is a conflict with the specified templates. Invalid configuration triggered by "#/interfaces/1", validator says: {'type': 'bridge', 'stp': False, 'bridge_members': ['eth0', 'eth0'], 'name': 'bb', 'mtu': 1500, 'mac': '', 'autostart': True, 'disabled': False, 'addresses': [], 'network': '', 'igmp_snooping': True} is not valid under any of the given schemas"

As you can see from the configuration json file, there's only one bridge member in this bridge interface. I do not understand why the validator states there's two bridge members: ['eth0','eth0'] , which are both eth0 by the way.. Could it be a bug in openwisp?

Federico Capoano

unread,
Jul 30, 2021, 10:57:18 AM7/30/21
to open...@googlegroups.com
Most likely there's an interface in the device which also defines bridge_members and has eth0 in it, please read:

... elements will be summed in order to create a list which contains elements of both lists.

Best regards
Federico Capoano

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openwisp/961c92ce-f825-40ed-881c-a7278cc95460n%40googlegroups.com.

yves baumes

unread,
Jul 30, 2021, 11:47:02 AM7/30/21
to OpenWISP
I had this issue a couple of times. Another time on the switch interface. I fixed it by removing the annoying field, and re-adding it later. And it passed ok. So it is solved for me. But it looks like a weird problem.

edoard...@gmail.com

unread,
Jul 31, 2021, 7:17:56 AM7/31/21
to OpenWISP
Hello,

I'm not able to reproduce the issue with your template. Maybe it's not the template that is at fault this time? Are there any other configuration files
you are using that could be the source of this double inclusion of the same interface in the same bridge?

The error message starts with "There is a conflict with the specified templates" which might be frustrating when some other configuration
is at fault.

For reference, I copy pasted your template in foo.json and run python bin/netjsonconfig --method validate -b openwrt --config foo.json

Federico Capoano

unread,
Jul 31, 2021, 12:20:58 PM7/31/21
to open...@googlegroups.com
If you can find a way to replicate it consistently let us know. 

Thanks
Best regards
Federico Capoano

yves baumes

unread,
Aug 2, 2021, 3:19:00 AM8/2/21
to OpenWISP
> For reference, I copy pasted your template in foo.json and run python bin/netjsonconfig --method validate -b openwrt --config foo.json
The same for me, it produces no error message. I am not able to try to reproduce right now. If I face the issue one more time later, I'll try to screenshot the whole template at fault and the error message.

Federico Capoano

unread,
Aug 2, 2021, 12:00:20 PM8/2/21
to open...@googlegroups.com
Hey yves,

screenshots are not helpful.

When these kinds of things happen, please try to find out the combination of configurations which causes the issue and send it to us as attachment (anonymizing sensitive data), this should allow us to replicate it and tell you what's going on.

Thanks
Best regards
Federico Capoano
OpenWISP OÜ
Harjumaa, Tallinn, Sepapaja tn 6, 15551
VAT: EE101989729


Reply all
Reply to author
Forward
0 new messages