Skip to content

Commit

Permalink
kub: automate custom VLAN tagging on kub-ap1
Browse files Browse the repository at this point in the history
  • Loading branch information
pktpls authored and FFHener committed Aug 27, 2024
1 parent dab772b commit b6c4522
Showing 1 changed file with 48 additions and 0 deletions.
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'

snmp_devices:
- hostname: kub-simeon
Expand Down

0 comments on commit b6c4522

Please sign in to comment.