|
@@ -144,6 +144,42 @@ ucidef_add_switch_ports() {
|
|
|
json_select ..
|
|
json_select ..
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ucidef_add_switch_port_attr() {
|
|
|
|
|
+ local name=$1
|
|
|
|
|
+ local port=$2
|
|
|
|
|
+ local key=$3
|
|
|
|
|
+ local val=$4
|
|
|
|
|
+ local ports i num
|
|
|
|
|
+
|
|
|
|
|
+ json_select_object switch
|
|
|
|
|
+ json_select_object $name
|
|
|
|
|
+
|
|
|
|
|
+ json_get_keys ports ports
|
|
|
|
|
+ json_select_array ports
|
|
|
|
|
+
|
|
|
|
|
+ for i in $ports; do
|
|
|
|
|
+ json_select $i
|
|
|
|
|
+ json_get_var num num
|
|
|
|
|
+
|
|
|
|
|
+ if [ -n "$num" ] && [ $num -eq $port ]; then
|
|
|
|
|
+ json_select_object attr
|
|
|
|
|
+
|
|
|
|
|
+ case "$val" in
|
|
|
|
|
+ [0-9]) json_add_int "$key" "$val" ;;
|
|
|
|
|
+ *) json_add_string "$key" "$val" ;;
|
|
|
|
|
+ esac
|
|
|
|
|
+
|
|
|
|
|
+ json_select ..
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
|
|
+ json_select ..
|
|
|
|
|
+ done
|
|
|
|
|
+
|
|
|
|
|
+ json_select ..
|
|
|
|
|
+ json_select ..
|
|
|
|
|
+ json_select ..
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
ucidef_add_switch_vlan() {
|
|
ucidef_add_switch_vlan() {
|
|
|
local name=$1
|
|
local name=$1
|
|
|
local vlan=$2
|
|
local vlan=$2
|