-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
[feature] Added support for DSA #195 #261
Conversation
In the last review with @nemesisdesign, we discussed the following things:
NetJSON
UCI
NetJSON
UCI
|
In the last review with @nemesisdesign, we concluded the following: We will not add a special interface type "Bridge VLAN Interface" in the schema because this locks down the granularity offered by OpenWrt. Instead, we will direct the users to create interfaces using the existing interface types (Network Interface, Dialup Interface. etc.). If the interface names contains a period ( |
f0d3c13
to
08fa5df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next step: docs.
a2ec357
to
2e16343
Compare
@@ -193,6 +225,17 @@ def _intermediate_vxlan(self, interface): | |||
interface['vid'] = interface.pop('vni') | |||
return interface | |||
|
|||
def _intermediate_8021_vlan(self, interface): | |||
interface['name'] = '{}.{}'.format(interface['ifname'], interface['vid']) | |||
interface['.name'] = '{}_{}'.format(interface['.name'], interface['vid']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all I want to thank you for these features! Really appreciated.
I just have a stupid question: why formatting the name in this way?
For example if I use as logical interface name "CORPORATE_WAN" with vid 201 I'll get VLAN_CORPORATE_WAN_201.
I think that is better to let the user choose the full name.
interface['.name'] = '{}_{}'.format(interface['.name'], interface['vid']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general we shouldn't require the user to mess with these internal details, however it may be good to allow overriding this if needed in some corner case.
'egress_qos_mapping': interface.pop('egress_qos_mapping', []), | ||
} | ||
) | ||
interface['.name'] = 'vlan_{}'.format(interface['.name']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interface['.name'] = 'vlan_{}'.format(interface['.name']) |
And also that.
Hope this can be useful.
Thank you!
While testing I found an error while configuring vlans in bridges. If I create a template where vlan-interface lan.1234 is inside a bridge called br-guest, it works. If I then clone that template where I change lan.1234 to br-lan.1234 and remove the first template and apply the second, the network hangs and the configuration fails to apply. Config with lan.1234 inside bridge {
"interfaces": [
{
"type": "8021q",
"name": "lan",
"mtu": 1500,
"disabled": false,
"network": "",
"mac": "",
"autostart": true,
"addresses": [],
"vid": 1234,
"ingress_qos_mapping": [],
"egress_qos_mapping": []
},
{
"type": "bridge",
"stp": false,
"bridge_members": [
"lan.1234"
],
"name": "br-guest",
"mtu": 1500,
"disabled": false,
"network": "",
"mac": "",
"autostart": true,
"addresses": [],
"igmp_snooping": false,
"multicast_querier": false,
"query_interval": 12500,
"query_response_interval": 1000,
"last_member_interval": 100,
"hash_max": 512,
"robustness": 2,
"forward_delay": 4,
"hello_time": 2,
"priority": 32767,
"ageing_time": 300,
"max_age": 20,
"vlan_filtering": []
}
]
} Config with br-lan.1234 in bridge: {
"interfaces": [
{
"type": "8021q",
"name": "br-lan",
"mtu": 1500,
"disabled": false,
"network": "",
"mac": "",
"autostart": true,
"addresses": [],
"vid": 1234,
"ingress_qos_mapping": [],
"egress_qos_mapping": []
},
{
"type": "bridge",
"stp": false,
"bridge_members": [
"br-lan.1234"
],
"name": "br-guest",
"mtu": 1500,
"disabled": false,
"network": "",
"mac": "",
"autostart": true,
"addresses": [],
"igmp_snooping": false,
"multicast_querier": false,
"query_interval": 12500,
"query_response_interval": 1000,
"last_member_interval": 100,
"hash_max": 512,
"robustness": 2,
"forward_delay": 4,
"hello_time": 2,
"priority": 32767,
"ageing_time": 300,
"max_age": 20,
"vlan_filtering": []
}
]
} Used antenna: Ubiquiti UniFi 6 Lite Steps to reproduce:
After deselecting config 2 in openwisp and hitting save, the config 1 is still present on the antenna in I suspect as both lan and br-lan reference the same physical interface, it fails at registering the vid for both interfaces. The logread during that time is here: logread_vlan_bridge_bug.txt |
@codingHahn I tried to replicate the locally of the configuration that you provided in your example were applied successfully on my router. My router has I have shared the output of logread from applying both configuration on hastebin. My router does not have any |
tests/openwrt/test_interfaces_dsa.py
Outdated
expected['interfaces'][0]['vlan_filtering'][0]['ports'][1][ | ||
'primary_vid' | ||
] = False | ||
expected['interfaces'][0]['name'] = 'br-home_vlan' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After allowing user to set the logical name for VLAN interface, the parsing of the bridge VLAN breaks.
@pandafy Does it also work for you if you use a device with only one physical ethernet port? |
@codingHahn are you able to get the desired results from LuCI? If so, can you share the UCI configuration generated by LuCI? |
In my case i have eth0 as br-lan member (untagged vlan) and other lans (iot, guest, ...) as separate bridges with eth0.X vlans as members. |
@pandafy applying the both configs manually works (both configs work standalone, but when switching configs using OpenWISP, the device's config is left in a corrupted state). It breaks when following the steps outlined in my comment. |
740e470
to
c77078b
Compare
I've been using this successfully on a couple of deployments. @codingHahn @zagi-tng thanks for your comments, @pandafy asked if you had an example of successful configuration applied via LuCi (the OpenWrt web interface) or manually so we could compare that with the result we get from our code and check if there's any difference. |
- Added VLAN 802.1q and VLAN 802.1ad interfaces Closes #195
Rebased on latest master
c77078b
to
acc4192
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please merge (not rebase) the latest master, resolve conflicts and double check the generated output still matches tests and docs? There's been changes on master which may affect tests and docs.
The rest looks good.
Closes #195