This patch allows using the Quantum Ryu plugin.
Ryu plugin lets Quantum link Open vSwitch and Ryu OpenFlow controller[1].
Ryu OpenFlow controller is not Openstack component, but I added some
processing that is related with Ryu to stack.sh for the convenience of
the person who intend to try the plugin.
Instructions for using Ryu plugin:
1. Enable services: "q-svc", "q-agt", "q-dhcp", "q-l3", "quantum", "ryu"
2. Set Q_PLUGIN to "ryu"
3. Set an internal network interface name to connect br-int on plural
hosts to RYU_INTERNAL_INTERFACE (optional)
Example localrc:
disable_service n-net
enable_service q-svc q-agt q-dhcp q-l3 quantum ryu
Q_PLUGIN=ryu
RYU_INTERNAL_INTERFACE=eth1
[1] http://osrg.github.com/ryu/
Change-Id: Ic1da132fa421f1c70c10a319ee3239831b0f956f
... | ... |
@@ -213,7 +213,7 @@ function configure_nova() { |
213 | 213 |
fi |
214 | 214 |
fi |
215 | 215 |
|
216 |
- if is_service_enabled quantum && [[ $Q_PLUGIN = "openvswitch" ]] && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF ; then |
|
216 |
+ if is_service_enabled quantum && is_quantum_ovs_base_plugin "$Q_PLUGIN" && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF ; then |
|
217 | 217 |
# Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces |
218 | 218 |
cat <<EOF | sudo tee -a $QEMU_CONF |
219 | 219 |
cgroup_device_acl = [ |
... | ... |
@@ -33,5 +33,29 @@ function quantum_setup_ovs_bridge() { |
33 | 33 |
sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge |
34 | 34 |
} |
35 | 35 |
|
36 |
+function quantum_setup_external_bridge() { |
|
37 |
+ local bridge=$1 |
|
38 |
+ # Create it if it does not exist |
|
39 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge |
|
40 |
+ # remove internal ports |
|
41 |
+ for PORT in `sudo ovs-vsctl --no-wait list-ports $bridge`; do |
|
42 |
+ TYPE=$(sudo ovs-vsctl get interface $PORT type) |
|
43 |
+ if [[ "$TYPE" == "internal" ]]; then |
|
44 |
+ echo `sudo ip link delete $PORT` > /dev/null |
|
45 |
+ sudo ovs-vsctl --no-wait del-port $bridge $PORT |
|
46 |
+ fi |
|
47 |
+ done |
|
48 |
+ # ensure no IP is configured on the public bridge |
|
49 |
+ sudo ip addr flush dev $bridge |
|
50 |
+} |
|
51 |
+ |
|
52 |
+function is_quantum_ovs_base_plugin() { |
|
53 |
+ local plguin=$1 |
|
54 |
+ if [[ ",openvswitch,ryu," =~ ,${plugin}, ]]; then |
|
55 |
+ return 0 |
|
56 |
+ fi |
|
57 |
+ return 1 |
|
58 |
+} |
|
59 |
+ |
|
36 | 60 |
# Restore xtrace |
37 | 61 |
$XTRACE |
... | ... |
@@ -342,6 +342,18 @@ Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP=:-True} |
342 | 342 |
# Meta data IP |
343 | 343 |
Q_META_DATA_IP=${Q_META_DATA_IP:-$HOST_IP} |
344 | 344 |
|
345 |
+RYU_DIR=$DEST/ryu |
|
346 |
+# Ryu API Host |
|
347 |
+RYU_API_HOST=${RYU_API_HOST:-127.0.0.1} |
|
348 |
+# Ryu API Port |
|
349 |
+RYU_API_PORT=${RYU_API_PORT:-8080} |
|
350 |
+# Ryu OFP Host |
|
351 |
+RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1} |
|
352 |
+# Ryu OFP Port |
|
353 |
+RYU_OFP_PORT=${RYU_OFP_PORT:-6633} |
|
354 |
+# Ryu Applications |
|
355 |
+RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest} |
|
356 |
+ |
|
345 | 357 |
# Name of the LVM volume group to use/create for iscsi volumes |
346 | 358 |
VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes} |
347 | 359 |
VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-} |
... | ... |
@@ -773,7 +785,7 @@ if is_service_enabled horizon; then |
773 | 773 |
fi |
774 | 774 |
|
775 | 775 |
if is_service_enabled q-agt; then |
776 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
776 |
+ if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then |
|
777 | 777 |
# Install deps |
778 | 778 |
# FIXME add to files/apts/quantum, but don't install if not needed! |
779 | 779 |
if [[ "$os_PACKAGE" = "deb" ]]; then |
... | ... |
@@ -875,7 +887,9 @@ fi |
875 | 875 |
if is_service_enabled tempest; then |
876 | 876 |
install_tempest |
877 | 877 |
fi |
878 |
- |
|
878 |
+if is_service_enabled ryu || (is_service_enabled quantum && [[ "$Q_PLUGIN" = "ryu" ]]); then |
|
879 |
+ git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH |
|
880 |
+fi |
|
879 | 881 |
|
880 | 882 |
# Initialization |
881 | 883 |
# ============== |
... | ... |
@@ -924,6 +938,9 @@ fi |
924 | 924 |
if is_service_enabled tempest; then |
925 | 925 |
configure_tempest |
926 | 926 |
fi |
927 |
+if is_service_enabled ryu || (is_service_enabled quantum && [[ "$Q_PLUGIN" = "ryu" ]]); then |
|
928 |
+ setup_develop $RYU_DIR |
|
929 |
+fi |
|
927 | 930 |
|
928 | 931 |
if [[ $TRACK_DEPENDS = True ]] ; then |
929 | 932 |
$DEST/.venv/bin/pip freeze > $DEST/requires-post-pip |
... | ... |
@@ -1132,6 +1149,31 @@ if is_service_enabled g-reg; then |
1132 | 1132 |
fi |
1133 | 1133 |
|
1134 | 1134 |
|
1135 |
+# Ryu |
|
1136 |
+# --- |
|
1137 |
+# Ryu is not a part of OpenStack project. Please ignore following block if |
|
1138 |
+# you are not interested in Ryu. |
|
1139 |
+# launch ryu manager |
|
1140 |
+if is_service_enabled ryu; then |
|
1141 |
+ RYU_CONF_DIR=/etc/ryu |
|
1142 |
+ if [[ ! -d $RYU_CONF_DIR ]]; then |
|
1143 |
+ sudo mkdir -p $RYU_CONF_DIR |
|
1144 |
+ fi |
|
1145 |
+ sudo chown `whoami` $RYU_CONF_DIR |
|
1146 |
+ RYU_CONF=$RYU_CONF_DIR/ryu.conf |
|
1147 |
+ sudo rm -rf $RYU_CONF |
|
1148 |
+ |
|
1149 |
+ cat <<EOF > $RYU_CONF |
|
1150 |
+--app_lists=$RYU_APPS |
|
1151 |
+--wsapi_host=$RYU_API_HOST |
|
1152 |
+--wsapi_port=$RYU_API_PORT |
|
1153 |
+--ofp_listen_host=$RYU_OFP_HOST |
|
1154 |
+--ofp_tcp_listen_port=$RYU_OFP_PORT |
|
1155 |
+EOF |
|
1156 |
+ screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --flagfile $RYU_CONF" |
|
1157 |
+fi |
|
1158 |
+ |
|
1159 |
+ |
|
1135 | 1160 |
# Quantum |
1136 | 1161 |
# ------- |
1137 | 1162 |
|
... | ... |
@@ -1219,6 +1261,11 @@ if is_service_enabled quantum; then |
1219 | 1219 |
Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini |
1220 | 1220 |
Q_DB_NAME="quantum_linux_bridge" |
1221 | 1221 |
Q_PLUGIN_CLASS="quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2" |
1222 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1223 |
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/ryu |
|
1224 |
+ Q_PLUGIN_CONF_FILENAME=ryu.ini |
|
1225 |
+ Q_DB_NAME="ovs_quantum" |
|
1226 |
+ Q_PLUGIN_CLASS="quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2" |
|
1222 | 1227 |
else |
1223 | 1228 |
echo "Unknown Quantum plugin '$Q_PLUGIN'.. exiting" |
1224 | 1229 |
exit 1 |
... | ... |
@@ -1314,6 +1361,9 @@ if is_service_enabled q-svc; then |
1314 | 1314 |
if [[ "$LB_VLAN_RANGES" != "" ]]; then |
1315 | 1315 |
iniset /$Q_PLUGIN_CONF_FILE VLANS network_vlan_ranges $LB_VLAN_RANGES |
1316 | 1316 |
fi |
1317 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1318 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS openflow_controller $RYU_OFP_HOST:$RYU_OFP_PORT |
|
1319 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS openflow_rest_api $RYU_API_HOST:$RYU_API_PORT |
|
1317 | 1320 |
fi |
1318 | 1321 |
fi |
1319 | 1322 |
|
... | ... |
@@ -1363,6 +1413,14 @@ if is_service_enabled q-agt; then |
1363 | 1363 |
iniset /$Q_PLUGIN_CONF_FILE LINUX_BRIDGE physical_interface_mappings $LB_INTERFACE_MAPPINGS |
1364 | 1364 |
fi |
1365 | 1365 |
AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent" |
1366 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1367 |
+ # Set up integration bridge |
|
1368 |
+ OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
1369 |
+ quantum_setup_ovs_bridge $OVS_BRIDGE |
|
1370 |
+ if [ -n "$RYU_INTERNAL_INTERFACE" ]; then |
|
1371 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE |
|
1372 |
+ fi |
|
1373 |
+ AGENT_BINARY="$QUANTUM_DIR/quantum/plugins/ryu/agent/ryu_quantum_agent.py" |
|
1366 | 1374 |
fi |
1367 | 1375 |
# Update config w/rootwrap |
1368 | 1376 |
iniset /$Q_PLUGIN_CONF_FILE AGENT root_helper "$Q_RR_COMMAND" |
... | ... |
@@ -1391,6 +1449,9 @@ if is_service_enabled q-dhcp; then |
1391 | 1391 |
iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
1392 | 1392 |
elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
1393 | 1393 |
iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver |
1394 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1395 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver |
|
1396 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
1394 | 1397 |
fi |
1395 | 1398 |
fi |
1396 | 1399 |
|
... | ... |
@@ -1417,21 +1478,16 @@ if is_service_enabled q-l3; then |
1417 | 1417 |
iniset $Q_L3_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
1418 | 1418 |
iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
1419 | 1419 |
# Set up external bridge |
1420 |
- # Create it if it does not exist |
|
1421 |
- sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE |
|
1422 |
- # remove internal ports |
|
1423 |
- for PORT in `sudo ovs-vsctl --no-wait list-ports $PUBLIC_BRIDGE`; do |
|
1424 |
- TYPE=$(sudo ovs-vsctl get interface $PORT type) |
|
1425 |
- if [[ "$TYPE" == "internal" ]]; then |
|
1426 |
- echo `sudo ip link delete $PORT` > /dev/null |
|
1427 |
- sudo ovs-vsctl --no-wait del-port $bridge $PORT |
|
1428 |
- fi |
|
1429 |
- done |
|
1430 |
- # ensure no IP is configured on the public bridge |
|
1431 |
- sudo ip addr flush dev $PUBLIC_BRIDGE |
|
1420 |
+ quantum_setup_external_bridge $PUBLIC_BRIDGE |
|
1432 | 1421 |
elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
1433 | 1422 |
iniset $Q_L3_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver |
1434 | 1423 |
iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge '' |
1424 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1425 |
+ iniset $Q_L3_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver |
|
1426 |
+ iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
1427 |
+ iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
1428 |
+ # Set up external bridge |
|
1429 |
+ quantum_setup_external_bridge $PUBLIC_BRIDGE |
|
1435 | 1430 |
fi |
1436 | 1431 |
fi |
1437 | 1432 |
|
... | ... |
@@ -1599,8 +1655,8 @@ if is_service_enabled swift; then |
1599 | 1599 |
iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth operator_roles |
1600 | 1600 |
iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth operator_roles "Member, admin" |
1601 | 1601 |
|
1602 |
- if is_service_enabled swift3;then |
|
1603 |
- cat <<EOF>>${SWIFT_CONFIG_PROXY_SERVER} |
|
1602 |
+ if is_service_enabled swift3; then |
|
1603 |
+ cat <<EOF >>${SWIFT_CONFIG_PROXY_SERVER} |
|
1604 | 1604 |
# NOTE(chmou): s3token middleware is not updated yet to use only |
1605 | 1605 |
# username and password. |
1606 | 1606 |
[filter:s3token] |
... | ... |
@@ -1753,6 +1809,11 @@ if is_service_enabled quantum; then |
1753 | 1753 |
NOVA_VIF_DRIVER="nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver" |
1754 | 1754 |
elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
1755 | 1755 |
NOVA_VIF_DRIVER="nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver" |
1756 |
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
1757 |
+ NOVA_VIF_DRIVER="quantum.plugins.ryu.nova.vif.LibvirtOpenVswitchOFPRyuDriver" |
|
1758 |
+ add_nova_opt "libvirt_ovs_integration_bridge=$OVS_BRIDGE" |
|
1759 |
+ add_nova_opt "linuxnet_ovs_ryu_api_host=$RYU_API_HOST:$RYU_API_PORT" |
|
1760 |
+ add_nova_opt "libvirt_ovs_ryu_api_host=$RYU_API_HOST:$RYU_API_PORT" |
|
1756 | 1761 |
fi |
1757 | 1762 |
add_nova_opt "libvirt_vif_driver=$NOVA_VIF_DRIVER" |
1758 | 1763 |
add_nova_opt "linuxnet_interface_driver=$LINUXNET_VIF_DRIVER" |
... | ... |
@@ -1899,7 +1960,7 @@ if is_service_enabled q-svc; then |
1899 | 1899 |
EXT_NET_ID=$(quantum net-create ext_net -- --router:external=True | grep ' id ' | get_field 2) |
1900 | 1900 |
EXT_GW_IP=$(quantum subnet-create --ip_version 4 $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2) |
1901 | 1901 |
quantum router-gateway-set $ROUTER_ID $EXT_NET_ID |
1902 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]] && [[ "$Q_USE_NAMESPACE" = "True" ]]; then |
|
1902 |
+ if is_quantum_ovs_base_plugin "$Q_PLUGIN" && [[ "$Q_USE_NAMESPACE" = "True" ]]; then |
|
1903 | 1903 |
CIDR_LEN=${FLOATING_RANGE#*/} |
1904 | 1904 |
sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE |
1905 | 1905 |
sudo ip link set $PUBLIC_BRIDGE up |
... | ... |
@@ -101,6 +101,10 @@ TEMPEST_BRANCH=master |
101 | 101 |
HEAT_REPO=${GIT_BASE}/heat-api/heat.git |
102 | 102 |
HEAT_BRANCH=master |
103 | 103 |
|
104 |
+# ryu service |
|
105 |
+RYU_REPO=https://github.com/osrg/ryu.git |
|
106 |
+RYU_BRANCH=master |
|
107 |
+ |
|
104 | 108 |
# Nova hypervisor configuration. We default to libvirt with **kvm** but will |
105 | 109 |
# drop back to **qemu** if we are unable to load the kvm module. ``stack.sh`` can |
106 | 110 |
# also install an **LXC** or **OpenVZ** based system. |