base-files: add support for the new ar8xxx MIB counters settings

Commit "generic: ar8216: add mib_poll_interval switch attribute" has
added mib_poll_interval global config option and commit "generic:
ar8216: group MIB counters and use two basic ones only by default" has
added mib_type config option.

So this patch adds ucidef_set_ar8xxx_switch_mib helper function which
would allow configuration of the above mentioned new switch config
options.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
This commit is contained in:
Petr Štetiar 2019-05-17 10:53:18 +02:00
parent 2c26dc7b41
commit aac8b52184
2 changed files with 17 additions and 1 deletions

View File

@ -213,7 +213,8 @@ generate_switch() {
json_select switch json_select switch
json_select "$key" json_select "$key"
json_get_vars enable reset blinkrate cpu_port json_get_vars enable reset blinkrate cpu_port \
ar8xxx_mib_type ar8xxx_mib_poll_interval
uci -q batch <<-EOF uci -q batch <<-EOF
add network switch add network switch
@ -221,6 +222,8 @@ generate_switch() {
set network.@switch[-1].reset='$reset' set network.@switch[-1].reset='$reset'
set network.@switch[-1].enable_vlan='$enable' set network.@switch[-1].enable_vlan='$enable'
set network.@switch[-1].blinkrate='$blinkrate' set network.@switch[-1].blinkrate='$blinkrate'
set network.@switch[-1].ar8xxx_mib_type='$ar8xxx_mib_type'
set network.@switch[-1].ar8xxx_mib_poll_interval='$ar8xxx_mib_poll_interval'
EOF EOF
generate_switch_vlans_ports "$1" generate_switch_vlans_ports "$1"

View File

@ -182,6 +182,19 @@ _ucidef_finish_switch_roles() {
done done
} }
ucidef_set_ar8xxx_switch_mib() {
local name="$1"
local type="$2"
local interval="$3"
json_select_object switch
json_select_object "$name"
json_add_int ar8xxx_mib_type $type
json_add_int ar8xxx_mib_poll_interval $interval
json_select ..
json_select ..
}
ucidef_add_switch() { ucidef_add_switch() {
local name="$1"; shift local name="$1"; shift
local port num role device index need_tag prev_role local port num role device index need_tag prev_role