mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
map-controller: validate config options
This commit is contained in:
parent
f27619294e
commit
18c4ab8c9e
1 changed files with 114 additions and 0 deletions
|
|
@ -5,6 +5,8 @@ STOP=20
|
|||
|
||||
USE_PROCD=1
|
||||
|
||||
IS_CFG_VALID=1
|
||||
|
||||
handle_controller_select() {
|
||||
local section="$1"
|
||||
|
||||
|
|
@ -12,10 +14,122 @@ handle_controller_select() {
|
|||
return 1
|
||||
}
|
||||
|
||||
validate_controller_section() {
|
||||
uci_validate_section mapcontroller controller "controller" \
|
||||
'enabled:bool:true' \
|
||||
'registrar:string' \
|
||||
'debug:range(0,16)' \
|
||||
'resend_num:uinteger:0' \
|
||||
'enable_sta_steer:bool:false' \
|
||||
'enable_bsta_steer:bool:false' \
|
||||
'use_bcn_metrics:bool:false' \
|
||||
'use_usta_metrics:bool:false'
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
logger -s -t "mapcontroller" "Validation of controller section failed"
|
||||
IS_CFG_VALID=0
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_ap_section() {
|
||||
local section="$1"
|
||||
|
||||
uci_validate_section mapcontroller $section "${1}" \
|
||||
'band:or("2", "5")' \
|
||||
'ssid:string' \
|
||||
'encryption:or("sae-mixed", "sae", "psk-mixed", "psk2", "psk",
|
||||
"wpa-mixed", "wpa2", "wpa", "none", "open")' \
|
||||
'key:string' \
|
||||
'vid:range(1,65535):1' \
|
||||
'type:or("backhaul", "fronthaul", "combined")' \
|
||||
'disallow_bsta:list(range(0,255)):0' \
|
||||
'enabled:bool:true'
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
logger -s -t "mapcontroller" "Validation of ap section $section failed"
|
||||
IS_CFG_VALID=0
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_node_section() {
|
||||
local section="$1"
|
||||
|
||||
uci_validate_section mapcontroller $section "${1}" \
|
||||
'agent_id:macaddr' \
|
||||
'backhaul_ul_macaddr:macaddr' \
|
||||
'backhaul_dl_macaddr:macaddr' \
|
||||
'backhaul_type:or("none")' \
|
||||
'primary_vid:range(0,255):1' \
|
||||
'primary_pcp:range(0,255):0' \
|
||||
'report_sta_assocfails:bool:false' \
|
||||
'report_sta_assocfails_rate:uinteger' \
|
||||
'report_metric_periodic:range(0,255)' \
|
||||
'report_scan:bool:false' \
|
||||
'steer_exclude:list(macaddr)' \
|
||||
'steer_exclude_btm:list(macaddr)' \
|
||||
'steer_disallow:bool:false' \
|
||||
'coordinated_cac:bool:false' \
|
||||
'traffic_separation:bool:false' \
|
||||
'sta_steer:bool:false'
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
logger -s -t "mapcontroller" "Validation of node section $section failed"
|
||||
IS_CFG_VALID=0
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_radio_section() {
|
||||
local section="$1"
|
||||
|
||||
uci_validate_section mapcontroller $section "${1}" \
|
||||
'agent_id:macaddr' \
|
||||
'macaddr:macaddr' \
|
||||
'band:or("2", "5")' \
|
||||
'steer_policy:range(0,2)' \
|
||||
'util_threshold:range(0,255)' \
|
||||
'rcpi_threshold:range(0,255)' \
|
||||
'report_rcpi_threshold:range(0,255)' \
|
||||
'report_util_threshold:range(0,255)' \
|
||||
'report_rcpi_hysteresis_margin:range(0,255)' \
|
||||
'include_sta_stats:bool:false' \
|
||||
'include_sta_metric:bool:false'
|
||||
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
logger -s -t "mapcontroller" "Validation of radio section $section failed"
|
||||
IS_CFG_VALID=0
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_controller_config() {
|
||||
IS_CFG_VALID=1
|
||||
|
||||
validate_controller_section &&
|
||||
config_foreach validate_ap_section ap &&
|
||||
config_foreach validate_node_section node &&
|
||||
config_foreach validate_radio_section radio
|
||||
|
||||
[ "$IS_CFG_VALID" -ne 1 ] && {
|
||||
logger -s -t "mapcontroller" "Validation of mapcontroller UCI file failed"
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled
|
||||
|
||||
config_load "mapcontroller"
|
||||
validate_controller_config || return 1;
|
||||
|
||||
config_get_bool enabled controller enabled 1
|
||||
[ "$enabled" -eq 0 ] && return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue