openvswitch: add option for OpenFlow datapath desc
Add a UCI config option to set the OpenFlow datapath description. This allows setting a human readable description of the bridge, e.g. "Building x, Floor y, AP z", which makes it easier to recognize the AP. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
This commit is contained in:
parent
1a400370c0
commit
c05103da92
4 changed files with 27 additions and 7 deletions
|
@ -17,7 +17,7 @@ include ./openvswitch.mk
|
||||||
#
|
#
|
||||||
PKG_NAME:=openvswitch
|
PKG_NAME:=openvswitch
|
||||||
PKG_VERSION:=$(ovs_version)
|
PKG_VERSION:=$(ovs_version)
|
||||||
PKG_RELEASE:=6
|
PKG_RELEASE:=7
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://www.openvswitch.org/releases/
|
PKG_SOURCE_URL:=https://www.openvswitch.org/releases/
|
||||||
PKG_HASH:=7d5797f2bf2449c6a266149e88f72123540f7fe7f31ad52902057ae8d8f88c38
|
PKG_HASH:=7d5797f2bf2449c6a266149e88f72123540f7fe7f31ad52902057ae8d8f88c38
|
||||||
|
|
|
@ -85,12 +85,13 @@ after adding or changing these options.
|
||||||
The ovs_bridge section also supports the options below,
|
The ovs_bridge section also supports the options below,
|
||||||
for initialising a virtual bridge with an OpenFlow controller.
|
for initialising a virtual bridge with an OpenFlow controller.
|
||||||
|
|
||||||
| Name | Type | Required | Default | Description |
|
| Name | Type | Required | Default | Description |
|
||||||
|-------------|---------|----------|--------------------------------|------------------------------------------------------------|
|
|---------------|---------|----------|--------------------------------|------------------------------------------------------------|
|
||||||
| disabled | boolean | no | 0 | If set to true, disable initialisation of the named bridge |
|
| disabled | boolean | no | 0 | If set to true, disable initialisation of the named bridge |
|
||||||
| name | string | no | Inherits UCI config block name | The name of the switch in the OVS daemon |
|
| name | string | no | Inherits UCI config block name | The name of the switch in the OVS daemon |
|
||||||
| controller | string | no | (none) | The endpoint of an OpenFlow controller for this bridge |
|
| controller | string | no | (none) | The endpoint of an OpenFlow controller for this bridge |
|
||||||
| datapath_id | string | no | (none) | The OpenFlow datapath ID for this bridge |
|
| datapath_id | string | no | (none) | The OpenFlow datapath ID for this bridge |
|
||||||
|
| datapath_desc | string | no | (none) | The OpenFlow datapath description for this bridge |
|
||||||
|
|
||||||
The ovs_port section can be used to add ports to a bridge. It supports the options below.
|
The ovs_port section can be used to add ports to a bridge. It supports the options below.
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ config ovs_bridge
|
||||||
option disabled 1
|
option disabled 1
|
||||||
option name 'my-bridge'
|
option name 'my-bridge'
|
||||||
option controller 'tcp:192.168.0.1'
|
option controller 'tcp:192.168.0.1'
|
||||||
|
option datapath_desc ''
|
||||||
option datapath_id ''
|
option datapath_id ''
|
||||||
|
|
||||||
config ovs_port
|
config ovs_port
|
||||||
|
|
|
@ -187,6 +187,17 @@ ovs_bridge_validate_datapath_id() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ovs_bridge_validate_datapath_desc() {
|
||||||
|
local dpdesc="$1"
|
||||||
|
|
||||||
|
if [ "$(echo $dpdesc | wc -c)" -le 255 ]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
logger -t openvswitch "invalid datapath_desc: $dpdesc"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
ovs_bridge_init() {
|
ovs_bridge_init() {
|
||||||
local cfg="$1"
|
local cfg="$1"
|
||||||
|
|
||||||
|
@ -208,6 +219,13 @@ ovs_bridge_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config_get datapath_desc "$cfg" datapath_desc
|
||||||
|
[ -n "$datapath_desc" ] && {
|
||||||
|
ovs_bridge_validate_datapath_desc "$datapath_desc" && {
|
||||||
|
ovs-vsctl --if-exists set bridge "$name" other-config:dp-desc="$datapath_desc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
config_list_foreach "$cfg" "ports" ovs_bridge_port_add
|
config_list_foreach "$cfg" "ports" ovs_bridge_port_add
|
||||||
config_foreach ovs_bridge_port_add_complex ovs_port "$name"
|
config_foreach ovs_bridge_port_add_complex ovs_port "$name"
|
||||||
config_get_bool drop "$cfg" "drop_unknown_ports" 0
|
config_get_bool drop "$cfg" "drop_unknown_ports" 0
|
||||||
|
|
Loading…
Reference in a new issue