netjsonconfig icon indicating copy to clipboard operation
netjsonconfig copied to clipboard

[feature] Add support for DSA

Open mips171 opened this issue 3 years ago • 8 comments

DSA is becoming the default switch configuration mechanism, replacing swconfig for many OpenWrt targets in the upcoming stable release. OpenWISP does not yet support DSA.

Docs https://openwrt.org/docs/guide-user/network/dsa/start

mips171 avatar Aug 23 '21 23:08 mips171

What the openwrt docs do not explain is that with the new syntax, we have to move any bridge related configuration to the "device" config types. However, since we need to be backward compatibile with the older versions of OpenWrt, I think we need to continue also doing what we are doing now (support both).

nemesifier avatar Mar 04 '22 16:03 nemesifier

For now we will focus on supporting the new bridge definition.

Defining DSA vlans can then be done with this custom config:

{
    "network": [
        {
            "config_name": "bridge-vlan",
            "config_value": "vlan1",
            "vlan": 1,
            "ports": [
                "lan1:u*",
                "lan2:u*",
                "lan3:u*",
                "lan4:u*"
            ]
        }
    ]
}

In the next release we can add a schema for this new syntax but before doing so we have to discuss a bit more and moreover wait for DSA to be implemented in all the devices, collect more feedback and make sure we implement it correctly.

nemesifier avatar Mar 14 '22 17:03 nemesifier

There's a dedicated issue for the new bridge syntax definition: https://github.com/openwisp/netjsonconfig/issues/195.

nemesifier avatar Mar 14 '22 17:03 nemesifier

I tried reading the examples and docs in the OpenWrt wiki but it's not really clear to me, moreover the last example is not clear at all.

I cannot implement something if I don't understand the schema of the configuration, what the possible values are, the wiki mentions only examples but there's no explanation of the schema and possible values the configuration can have.

I hope someone can help clarify the situation a bit, but until then it will be pretty hard to implement something which is not even documented, nor I know at what source code to look at to figure it out.

nemesifier avatar Mar 18 '22 22:03 nemesifier

Maybe this video explains it better, I will look into it: https://www.youtube.com/watch?v=qeuZqRqH-ug.

nemesifier avatar Mar 18 '22 23:03 nemesifier

openwisp dsa

That's so much to draw to get

config bridge-vlan 'bridge_vlan10' option device 'br0' list ports 'wan:t' list ports 'lan1:t' list ports 'lan2:t' list ports 'lan3:t' list ports 'lan4:t' option vlan '10'

nikolya-prodigy avatar Jun 07 '22 07:06 nikolya-prodigy

Exampe custom syntax provided by @nikolya-prodigy to achieve what he wrote above:

{
    "interfaces": [
        {
            "type": "ethernet",
            "name": "br0.10",
            "mtu": 1500,
            "disabled": false,
            "network": "br0_vlan10",
            "mac": "",
            "autostart": true,
            "addresses": [
                {
                    "proto": "dhcp",
                    "family": "ipv4"
                }
            ]
        }
    ],
    "network": [
        {
            "config_name": "bridge-vlan",
            "config_value": "bridge_vlan10",
            "device": "br0",
            "vlan": 10,
            "ports": [
                "wan:t",
                "lan1:t",
                "lan2:t",
                "lan3:t",
                "lan4:t"
            ]
        }
    ]
}

nemesifier avatar Jun 11 '22 20:06 nemesifier