openvswitch: adds new UCI section ovs_bridge

This new config section in package openvswitch
supports creating a named bridge, and setting
its' OpenFlow controller end-point.

An example config is included in /rom/etc/config/openvswitch

Signed-off-by: Simon Kinane <skinane@fb.com>
This commit is contained in:
Simon Kinane
2020-07-26 20:58:53 +01:00
committed by Yousong Zhou
parent f4897d2ae8
commit d7507146e8
4 changed files with 44 additions and 2 deletions
+21 -1
View File
@@ -36,6 +36,8 @@ ovs_action() {
for cfgtype in ovs ovn_northd ovn_controller; do
config_foreach "ovs_xx" "$cfgtype" "$action" "$cfgtype"
done
config_foreach ovs_bridge_init "ovs_bridge"
}
ovs_xx() {
@@ -51,7 +53,7 @@ ovs_xx() {
status|stop) ;;
*)
config_get_bool disabled "$cfg" disabled 0
[ "$disabled" -le 0 ] || return
[ "$disabled" == "0" ] || return
;;
esac
@@ -65,3 +67,21 @@ ovs_xx() {
;;
esac
}
ovs_bridge_init() {
local cfg="$1"
local disabled
local name
local controller
config_get_bool disabled "$cfg" disabled 0
[ "$disabled" == "0" ] || return
config_get name "$cfg" name $cfg
ovs-vsctl --may-exist add-br "$name"
config_get controller "$cfg" controller
[ -n "$controller" ] && \
ovs-vsctl set-controller "$name" "$controller"
}