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

kub: automate VLAN taggings, fix DSA ports #939

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion group_vars/model_cudy_x6_v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ brand_nice: Cudy
model_nice: X6
version_nice: v1

int_port: lan
dsa_ports:
- lan1
- lan2
- lan3
- lan4
- wan

wireless_devices:
- name: 11a_standard
Expand Down
48 changes: 48 additions & 0 deletions locations/kub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,54 @@ hosts:
- hostname: kub-ap1
role: ap
model: "cudy_x6-v1"
host__rclocal__to_merge:
- '#'
- '# This script adjusts the configuration of vlans. This is especially'
- '# useful with uswflex and custom port configs'
- '#'
- ''
- '. /lib/functions.sh'
- ''
- 'handle_vlans() {'
- ' # untag the vlans on different ports based on their id'
- ' local uci_section="$1"'
- ''
- ' config_get vlan "$uci_section" vlan'
- ' config_get ports "$uci_section" ports'
- ''
- ''
- ' case "$vlan" in'
- ' 40)'
- ' # untag DHCP on LAN 1 and LAN 2'
- " port_config='wan:t lan1 lan2 lan3:t lan4:t'"
- ' ;;'
- ' *)'
- ' # do nothing for the other vlans'
- ' printf "Done.\n"'
- ' return'
- ' esac'
- ''
- ' # abort if config is applied already'
- ' if [ "$ports" = "$port_config" ]; then'
- ' printf "Vlan %d applied already.\n" "$vlan"'
- ' return'
- ' fi'
- ''
- ' printf "Port number: %d\n" "$vlan"'
- ' printf "Port config: %s\n" "$port_config"'
- ''
- ' printf "Configuring %s... " "$uci_section"'
- ' uci_set network "$uci_section" ports "$port_config"'
- ' printf "Done.\n"'
- '}'
- ''
- 'config_load network'
- ''
- 'config_foreach handle_vlans "bridge-vlan"'
- ''
- 'uci commit network'
- 'sync'
- 'reload_config'

FFHener marked this conversation as resolved.
Show resolved Hide resolved
snmp_devices:
- hostname: kub-simeon
Expand Down