mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
map-agent: validate config options
This commit is contained in:
parent
18c4ab8c9e
commit
cf44c1a030
1 changed files with 129 additions and 0 deletions
|
|
@ -5,6 +5,8 @@ STOP=20
|
||||||
|
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
|
|
||||||
|
IS_CFG_VALID=1
|
||||||
|
|
||||||
MAP_DEV="map_dev"
|
MAP_DEV="map_dev"
|
||||||
MAP_IF="map"
|
MAP_IF="map"
|
||||||
|
|
||||||
|
|
@ -66,10 +68,137 @@ start_dynbhd_service() {
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validate_agent_section() {
|
||||||
|
uci_validate_section mapagent agent "agent" \
|
||||||
|
'enabled:bool:true' \
|
||||||
|
'debug:range(0,16)' \
|
||||||
|
'profile:range(1,2):2' \
|
||||||
|
'brcm_setup:bool:false' \
|
||||||
|
'controller_macaddr:macaddr' \
|
||||||
|
'al_bridge:string' \
|
||||||
|
'netdev:string' \
|
||||||
|
'vlan_segregation:bool:false' \
|
||||||
|
'resend_num:uinteger:0' \
|
||||||
|
'dyn_cntlr_sync:bool:true'
|
||||||
|
|
||||||
|
[ "$?" -ne 0 ] && {
|
||||||
|
logger -s -t "mapagent" "Validation of agent section failed"
|
||||||
|
IS_CFG_VALID=0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_cs_section() {
|
||||||
|
local section="$1"
|
||||||
|
|
||||||
|
uci_validate_section mapagent $section "${section}" \
|
||||||
|
'local:bool:false' \
|
||||||
|
'id:string' \
|
||||||
|
'probe_int:range(0,1000):20' \
|
||||||
|
'retry_int:range(0,255):3' \
|
||||||
|
'autostart:bool:false'
|
||||||
|
|
||||||
|
[ "$?" -ne 0 ] && {
|
||||||
|
logger -s -t "mapagent" "Validation of controller_select section failed"
|
||||||
|
IS_CFG_VALID=0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_ap_section() {
|
||||||
|
local section="$1"
|
||||||
|
|
||||||
|
uci_validate_section mapagent $section "${1}" \
|
||||||
|
'ifname:string' \
|
||||||
|
'device:string' \
|
||||||
|
'band:or("2", "5")' \
|
||||||
|
'enabled:bool:true' \
|
||||||
|
'onboarded:bool:false' \
|
||||||
|
'ssid:string' \
|
||||||
|
'key:string' \
|
||||||
|
'encryption:string' \
|
||||||
|
'disallow_bsta_p1:bool:false' \
|
||||||
|
'disallow_bsta_p2:bool:false'
|
||||||
|
|
||||||
|
[ "$?" -ne 0 ] && {
|
||||||
|
logger -s -t "mapagent" "Validation of ap section failed"
|
||||||
|
IS_CFG_VALID=0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_radio_section() {
|
||||||
|
local section="$1"
|
||||||
|
|
||||||
|
uci_validate_section mapagent $section "${1}" \
|
||||||
|
'device:string' \
|
||||||
|
'band:or("2", "5")' \
|
||||||
|
'configured:bool:false' \
|
||||||
|
'onboarded:bool:false' \
|
||||||
|
'dedicated_backhaul:bool:false' \
|
||||||
|
'steer_policy:range(0,255)' \
|
||||||
|
'util_threshold:range(0,255)' \
|
||||||
|
'rcpi_threshold:range(0,255)' \
|
||||||
|
'report_rcpi_threshold:range(0,255)' \
|
||||||
|
'include_sta_stats:bool:false' \
|
||||||
|
'include_sta_metric:bool:false' \
|
||||||
|
'rcpi_hysteresis_margin:range(0,255)' \
|
||||||
|
'report_util_threshold:range(0,255)'
|
||||||
|
|
||||||
|
[ "$?" -ne 0 ] && {
|
||||||
|
logger -s -t "mapagent" "Validation of radio section failed"
|
||||||
|
IS_CFG_VALID=0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_policy_section() {
|
||||||
|
local section="$1"
|
||||||
|
|
||||||
|
uci_validate_section mapagent $section "${1}" \
|
||||||
|
'report_interval:range(0,255)' \
|
||||||
|
'pvid:uinteger' \
|
||||||
|
'report_interval:range(0,255)' \
|
||||||
|
'pcp_default:range(0,255)' \
|
||||||
|
'report_scan:bool' \
|
||||||
|
'report_sta_assocfails:bool' \
|
||||||
|
'report_sta_assocfails_rate:uinteger' \
|
||||||
|
'steer_exclude:list(macaddr)' \
|
||||||
|
'steer_exclude_btm:list(macaddr)' \
|
||||||
|
|
||||||
|
[ "$?" -ne 0 ] && {
|
||||||
|
logger -s -t "mapagent" "Validation of policy section failed"
|
||||||
|
IS_CFG_VALID=0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_agent_config() {
|
||||||
|
IS_CFG_VALID=1
|
||||||
|
|
||||||
|
validate_agent_section &&
|
||||||
|
config_foreach validate_cs_section controller_select &&
|
||||||
|
config_foreach validate_ap_section ap &&
|
||||||
|
config_foreach validate_radio_section radio &&
|
||||||
|
config_foreach validate_policy_section policy
|
||||||
|
|
||||||
|
[ "$IS_CFG_VALID" -ne 1 ] && {
|
||||||
|
logger -s -t "mapagent" "Validation of mapagent UCI file failed"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
[ -f /usr/sbin/dynbhd ] && start_dynbhd_service
|
[ -f /usr/sbin/dynbhd ] && start_dynbhd_service
|
||||||
|
|
||||||
config_load "mapagent"
|
config_load "mapagent"
|
||||||
|
validate_agent_config || return 1;
|
||||||
|
|
||||||
ubus -t 5 wait_for wifi
|
ubus -t 5 wait_for wifi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue