As quantum plugin support is coming like floodlight, nvp and nec,
it's worth while to refactor quantum plugin logic so that each plugin can
be modified/enhanced intervening with other quantum plugin.
And new plugin support can be added easily (hopefully) without modifying
core logic.
Change-Id: Ic5ab5b993272fdd3b4e779823323777a845ee681
| ... | ... |
@@ -19,6 +19,7 @@ Gabriel Hurley <gabriel@strikeawe.com> |
| 19 | 19 |
Gary Kotton <gkotton@redhat.com> |
| 20 | 20 |
Hengqing Hu <hudayou@hotmail.com> |
| 21 | 21 |
Hua ZHANG <zhuadl@cn.ibm.com> |
| 22 |
+Isaku Yamahata <yamahata@private.email.ne.jp> |
|
| 22 | 23 |
Jake Dahn <admin@jakedahn.com> |
| 23 | 24 |
James E. Blair <james.blair@rackspace.com> |
| 24 | 25 |
Jason Cannavale <jason.cannavale@rackspace.com> |
| 25 | 26 |
deleted file mode 100644 |
| ... | ... |
@@ -1,50 +0,0 @@ |
| 1 |
-# Big Switch/FloodLight OpenFlow Controller |
|
| 2 |
-# ------------------------------------------ |
|
| 3 |
- |
|
| 4 |
-# Save trace setting |
|
| 5 |
-XTRACE=$(set +o | grep xtrace) |
|
| 6 |
-set +o xtrace |
|
| 7 |
- |
|
| 8 |
-BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80}
|
|
| 9 |
-BS_FL_OF_PORT=${BS_FL_OF_PORT:-6633}
|
|
| 10 |
-OVS_BRIDGE=${OVS_BRIDGE:-br-int}
|
|
| 11 |
- |
|
| 12 |
-function configure_bigswitch_floodlight() {
|
|
| 13 |
- : |
|
| 14 |
-} |
|
| 15 |
- |
|
| 16 |
-function init_bigswitch_floodlight() {
|
|
| 17 |
- install_quantum_agent_packages |
|
| 18 |
- |
|
| 19 |
- echo -n "Installing OVS managed by the openflow controllers:" |
|
| 20 |
- echo ${BS_FL_CONTROLLERS_PORT}
|
|
| 21 |
- |
|
| 22 |
- # Create local OVS bridge and configure it |
|
| 23 |
- sudo ovs-vsctl --no-wait -- --if-exists del-br ${OVS_BRIDGE}
|
|
| 24 |
- sudo ovs-vsctl --no-wait add-br ${OVS_BRIDGE}
|
|
| 25 |
- sudo ovs-vsctl --no-wait br-set-external-id ${OVS_BRIDGE} bridge-id ${OVS_BRIDGE}
|
|
| 26 |
- |
|
| 27 |
- ctrls= |
|
| 28 |
- for ctrl in `echo ${BS_FL_CONTROLLERS_PORT} | tr ',' ' '`
|
|
| 29 |
- do |
|
| 30 |
- ctrl=${ctrl%:*}
|
|
| 31 |
- ctrls="${ctrls} tcp:${ctrl}:${BS_FL_OF_PORT}"
|
|
| 32 |
- done |
|
| 33 |
- echo "Adding Network conttrollers: " ${ctrls}
|
|
| 34 |
- sudo ovs-vsctl --no-wait set-controller ${OVS_BRIDGE} ${ctrls}
|
|
| 35 |
-} |
|
| 36 |
- |
|
| 37 |
-function install_bigswitch_floodlight() {
|
|
| 38 |
- : |
|
| 39 |
-} |
|
| 40 |
- |
|
| 41 |
-function start_bigswitch_floodlight() {
|
|
| 42 |
- : |
|
| 43 |
-} |
|
| 44 |
- |
|
| 45 |
-function stop_bigswitch_floodlight() {
|
|
| 46 |
- : |
|
| 47 |
-} |
|
| 48 |
- |
|
| 49 |
-# Restore xtrace |
|
| 50 |
-$XTRACE |
| ... | ... |
@@ -229,7 +229,7 @@ function configure_nova() {
|
| 229 | 229 |
configure_baremetal_nova_dirs |
| 230 | 230 |
fi |
| 231 | 231 |
|
| 232 |
- if is_service_enabled quantum && is_quantum_ovs_base_plugin "$Q_PLUGIN" && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF ; then |
|
| 232 |
+ if is_service_enabled quantum && is_quantum_ovs_base_plugin && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF ; then |
|
| 233 | 233 |
# Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces |
| 234 | 234 |
cat <<EOF | sudo tee -a $QEMU_CONF |
| 235 | 235 |
cgroup_device_acl = [ |
| ... | ... |
@@ -171,6 +171,11 @@ if is_service_enabled quantum; then |
| 171 | 171 |
OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS}
|
| 172 | 172 |
fi |
| 173 | 173 |
|
| 174 |
+# Quantum plugin specific functions |
|
| 175 |
+# --------------------------------- |
|
| 176 |
+# Please refer to lib/quantum_plugins/README.md for details. |
|
| 177 |
+source $TOP_DIR/lib/quantum_plugins/$Q_PLUGIN |
|
| 178 |
+ |
|
| 174 | 179 |
# Entry Points |
| 175 | 180 |
# ------------ |
| 176 | 181 |
|
| ... | ... |
@@ -210,22 +215,9 @@ function create_nova_conf_quantum() {
|
| 210 | 210 |
iniset $NOVA_CONF DEFAULT quantum_admin_tenant_name "$SERVICE_TENANT_NAME" |
| 211 | 211 |
iniset $NOVA_CONF DEFAULT quantum_url "http://$Q_HOST:$Q_PORT" |
| 212 | 212 |
|
| 213 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
| 214 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"}
|
|
| 215 |
- if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
|
| 216 |
- add_nova_opt "xenapi_vif_driver=nova.virt.xenapi.vif.XenAPIOpenVswitchDriver" |
|
| 217 |
- add_nova_opt "xenapi_ovs_integration_bridge=$FLAT_NETWORK_BRIDGE" |
|
| 218 |
- fi |
|
| 219 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
| 220 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver"}
|
|
| 221 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
| 222 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"quantum.plugins.ryu.nova.vif.LibvirtOpenVswitchOFPRyuDriver"}
|
|
| 223 |
- iniset $NOVA_CONF DEFAULT libvirt_ovs_integration_bridge "$OVS_BRIDGE" |
|
| 224 |
- iniset $NOVA_CONF DEFAULT linuxnet_ovs_ryu_api_host "$RYU_API_HOST:$RYU_API_PORT" |
|
| 225 |
- iniset $NOVA_CONF DEFAULT libvirt_ovs_ryu_api_host "$RYU_API_HOST:$RYU_API_PORT" |
|
| 226 |
- elif [[ "$Q_PLUGIN" = "bigswitch_floodlight" ]]; then |
|
| 227 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"}
|
|
| 228 |
- fi |
|
| 213 |
+ # set NOVA_VIF_DRIVER and optionally set options in nova_conf |
|
| 214 |
+ quantum_plugin_create_nova_conf |
|
| 215 |
+ |
|
| 229 | 216 |
iniset $NOVA_CONF DEFAULT libvirt_vif_driver "$NOVA_VIF_DRIVER" |
| 230 | 217 |
iniset $NOVA_CONF DEFAULT linuxnet_interface_driver "$LINUXNET_VIF_DRIVER" |
| 231 | 218 |
if is_service_enabled q-meta; then |
| ... | ... |
@@ -297,7 +289,7 @@ function create_quantum_initial_network() {
|
| 297 | 297 |
EXT_GW_IP=$(quantum subnet-create --ip_version 4 $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2) |
| 298 | 298 |
quantum router-gateway-set $ROUTER_ID $EXT_NET_ID |
| 299 | 299 |
|
| 300 |
- if is_quantum_ovs_base_plugin "$Q_PLUGIN" && [[ "$Q_USE_NAMESPACE" = "True" ]]; then |
|
| 300 |
+ if is_quantum_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then |
|
| 301 | 301 |
CIDR_LEN=${FLOATING_RANGE#*/}
|
| 302 | 302 |
sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE |
| 303 | 303 |
sudo ip link set $PUBLIC_BRIDGE up |
| ... | ... |
@@ -328,29 +320,8 @@ function install_quantumclient() {
|
| 328 | 328 |
|
| 329 | 329 |
# install_quantum_agent_packages() - Collect source and prepare |
| 330 | 330 |
function install_quantum_agent_packages() {
|
| 331 |
- if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then |
|
| 332 |
- # Install deps |
|
| 333 |
- # FIXME add to ``files/apts/quantum``, but don't install if not needed! |
|
| 334 |
- if is_ubuntu; then |
|
| 335 |
- kernel_version=`cat /proc/version | cut -d " " -f3` |
|
| 336 |
- install_package make fakeroot dkms openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version |
|
| 337 |
- else |
|
| 338 |
- ### FIXME(dtroyer): Find RPMs for OpenVSwitch |
|
| 339 |
- echo "OpenVSwitch packages need to be located" |
|
| 340 |
- # Fedora does not started OVS by default |
|
| 341 |
- restart_service openvswitch |
|
| 342 |
- fi |
|
| 343 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
| 344 |
- install_package bridge-utils |
|
| 345 |
- fi |
|
| 346 |
-} |
|
| 347 |
- |
|
| 348 |
-function is_quantum_ovs_base_plugin() {
|
|
| 349 |
- local plugin=$1 |
|
| 350 |
- if [[ ",openvswitch,ryu,bigswitch_floodlight," =~ ,${plugin}, ]]; then
|
|
| 351 |
- return 0 |
|
| 352 |
- fi |
|
| 353 |
- return 1 |
|
| 331 |
+ # install packages that is specific to plugin agent |
|
| 332 |
+ quantum_plugin_install_agent_packages |
|
| 354 | 333 |
} |
| 355 | 334 |
|
| 356 | 335 |
function setup_quantum() {
|
| ... | ... |
@@ -407,29 +378,9 @@ function _configure_quantum_common() {
|
| 407 | 407 |
|
| 408 | 408 |
cp $QUANTUM_DIR/etc/quantum.conf $QUANTUM_CONF |
| 409 | 409 |
|
| 410 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
| 411 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/openvswitch |
|
| 412 |
- Q_PLUGIN_CONF_FILENAME=ovs_quantum_plugin.ini |
|
| 413 |
- Q_DB_NAME="ovs_quantum" |
|
| 414 |
- Q_PLUGIN_CLASS="quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2" |
|
| 415 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
| 416 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/linuxbridge |
|
| 417 |
- Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini |
|
| 418 |
- Q_DB_NAME="quantum_linux_bridge" |
|
| 419 |
- Q_PLUGIN_CLASS="quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2" |
|
| 420 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
| 421 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/ryu |
|
| 422 |
- Q_PLUGIN_CONF_FILENAME=ryu.ini |
|
| 423 |
- Q_DB_NAME="ovs_quantum" |
|
| 424 |
- Q_PLUGIN_CLASS="quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2" |
|
| 425 |
- elif [[ "$Q_PLUGIN" = "bigswitch_floodlight" ]]; then |
|
| 426 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/bigswitch |
|
| 427 |
- Q_PLUGIN_CONF_FILENAME=restproxy.ini |
|
| 428 |
- Q_DB_NAME="restproxy_quantum" |
|
| 429 |
- Q_PLUGIN_CLASS="quantum.plugins.bigswitch.plugin.QuantumRestProxyV2" |
|
| 430 |
- BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80}
|
|
| 431 |
- BS_FL_CONTROLLER_TIMEOUT=${BS_FL_CONTROLLER_TIMEOUT:-10}
|
|
| 432 |
- fi |
|
| 410 |
+ # set plugin-specific variables |
|
| 411 |
+ # Q_PLUGIN_CONF_PATH, Q_PLUGIN_CONF_FILENAME, Q_DB_NAME, Q_PLUGIN_CLASS |
|
| 412 |
+ quantum_plugin_configure_common |
|
| 433 | 413 |
|
| 434 | 414 |
if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then |
| 435 | 415 |
echo "Quantum plugin not set.. exiting" |
| ... | ... |
@@ -463,15 +414,7 @@ function _configure_quantum_debug_command() {
|
| 463 | 463 |
_quantum_setup_keystone $QUANTUM_TEST_CONFIG_FILE DEFAULT set_auth_url |
| 464 | 464 |
_quantum_setup_interface_driver $QUANTUM_TEST_CONFIG_FILE |
| 465 | 465 |
|
| 466 |
- if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then |
|
| 467 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
| 468 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
| 469 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge '' |
|
| 470 |
- fi |
|
| 471 |
- |
|
| 472 |
- if [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
| 473 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
| 474 |
- fi |
|
| 466 |
+ quantum_plugin_configure_debug_command |
|
| 475 | 467 |
} |
| 476 | 468 |
|
| 477 | 469 |
function _configure_quantum_dhcp_agent() {
|
| ... | ... |
@@ -489,9 +432,7 @@ function _configure_quantum_dhcp_agent() {
|
| 489 | 489 |
_quantum_setup_keystone $Q_DHCP_CONF_FILE DEFAULT set_auth_url |
| 490 | 490 |
_quantum_setup_interface_driver $Q_DHCP_CONF_FILE |
| 491 | 491 |
|
| 492 |
- if [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
| 493 |
- iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
| 494 |
- fi |
|
| 492 |
+ quantum_plugin_configure_dhcp_agent |
|
| 495 | 493 |
} |
| 496 | 494 |
|
| 497 | 495 |
function _configure_quantum_l3_agent() {
|
| ... | ... |
@@ -510,16 +451,7 @@ function _configure_quantum_l3_agent() {
|
| 510 | 510 |
_quantum_setup_keystone $Q_L3_CONF_FILE DEFAULT set_auth_url |
| 511 | 511 |
_quantum_setup_interface_driver $Q_L3_CONF_FILE |
| 512 | 512 |
|
| 513 |
- if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then |
|
| 514 |
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
| 515 |
- _quantum_setup_external_bridge $PUBLIC_BRIDGE |
|
| 516 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
| 517 |
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge '' |
|
| 518 |
- fi |
|
| 519 |
- |
|
| 520 |
- if [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
| 521 |
- iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
| 522 |
- fi |
|
| 513 |
+ quantum_plugin_configure_l3_agent |
|
| 523 | 514 |
} |
| 524 | 515 |
|
| 525 | 516 |
function _configure_quantum_metadata_agent() {
|
| ... | ... |
@@ -546,105 +478,7 @@ function _configure_quantum_plugin_agent() {
|
| 546 | 546 |
iniset /$Q_PLUGIN_CONF_FILE AGENT root_helper "$Q_RR_COMMAND" |
| 547 | 547 |
|
| 548 | 548 |
# Configure agent for plugin |
| 549 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
| 550 |
- _configure_quantum_plugin_agent_openvswitch |
|
| 551 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
| 552 |
- _configure_quantum_plugin_agent_linuxbridge |
|
| 553 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
| 554 |
- _configure_quantum_plugin_agent_ryu |
|
| 555 |
- fi |
|
| 556 |
-} |
|
| 557 |
- |
|
| 558 |
-function _configure_quantum_plugin_agent_linuxbridge() {
|
|
| 559 |
- # Setup physical network interface mappings. Override |
|
| 560 |
- # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more |
|
| 561 |
- # complex physical network configurations. |
|
| 562 |
- if [[ "$LB_INTERFACE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then |
|
| 563 |
- LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE |
|
| 564 |
- fi |
|
| 565 |
- if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then |
|
| 566 |
- iniset /$Q_PLUGIN_CONF_FILE LINUX_BRIDGE physical_interface_mappings $LB_INTERFACE_MAPPINGS |
|
| 567 |
- fi |
|
| 568 |
- AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent" |
|
| 569 |
-} |
|
| 570 |
- |
|
| 571 |
-function _configure_quantum_plugin_agent_openvswitch() {
|
|
| 572 |
- # Setup integration bridge |
|
| 573 |
- OVS_BRIDGE=${OVS_BRIDGE:-br-int}
|
|
| 574 |
- _quantum_setup_ovs_bridge $OVS_BRIDGE |
|
| 575 |
- |
|
| 576 |
- # Setup agent for tunneling |
|
| 577 |
- if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then |
|
| 578 |
- # Verify tunnels are supported |
|
| 579 |
- # REVISIT - also check kernel module support for GRE and patch ports |
|
| 580 |
- OVS_VERSION=`ovs-vsctl --version | head -n 1 | awk '{print $4;}'`
|
|
| 581 |
- if [ $OVS_VERSION \< "1.4" ] && ! is_service_enabled q-svc ; then |
|
| 582 |
- echo "You are running OVS version $OVS_VERSION." |
|
| 583 |
- echo "OVS 1.4+ is required for tunneling between multiple hosts." |
|
| 584 |
- exit 1 |
|
| 585 |
- fi |
|
| 586 |
- iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True |
|
| 587 |
- iniset /$Q_PLUGIN_CONF_FILE OVS local_ip $HOST_IP |
|
| 588 |
- fi |
|
| 589 |
- |
|
| 590 |
- # Setup physical network bridge mappings. Override |
|
| 591 |
- # ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` for more |
|
| 592 |
- # complex physical network configurations. |
|
| 593 |
- if [[ "$OVS_BRIDGE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then |
|
| 594 |
- OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE |
|
| 595 |
- |
|
| 596 |
- # Configure bridge manually with physical interface as port for multi-node |
|
| 597 |
- sudo ovs-vsctl --no-wait -- --may-exist add-br $OVS_PHYSICAL_BRIDGE |
|
| 598 |
- fi |
|
| 599 |
- if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then |
|
| 600 |
- iniset /$Q_PLUGIN_CONF_FILE OVS bridge_mappings $OVS_BRIDGE_MAPPINGS |
|
| 601 |
- fi |
|
| 602 |
- AGENT_BINARY="$QUANTUM_DIR/bin/quantum-openvswitch-agent" |
|
| 603 |
- |
|
| 604 |
- if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
|
| 605 |
- # Nova will always be installed along with quantum for a domU |
|
| 606 |
- # devstack install, so it should be safe to rely on nova.conf |
|
| 607 |
- # for xenapi configuration. |
|
| 608 |
- Q_RR_DOM0_COMMAND="$QUANTUM_DIR/bin/quantum-rootwrap-dom0 $NOVA_CONF" |
|
| 609 |
- # Under XS/XCP, the ovs agent needs to target the dom0 |
|
| 610 |
- # integration bridge. This is enabled by using a root wrapper |
|
| 611 |
- # that executes commands on dom0 via a XenAPI plugin. |
|
| 612 |
- iniset /$Q_PLUGIN_CONF_FILE AGENT root_helper "$Q_RR_DOM0_COMMAND" |
|
| 613 |
- |
|
| 614 |
- # FLAT_NETWORK_BRIDGE is the dom0 integration bridge. To |
|
| 615 |
- # ensure the bridge lacks direct connectivity, set |
|
| 616 |
- # VM_VLAN=-1;VM_DEV=invalid in localrc |
|
| 617 |
- iniset /$Q_PLUGIN_CONF_FILE OVS integration_bridge $FLAT_NETWORK_BRIDGE |
|
| 618 |
- |
|
| 619 |
- # The ovs agent needs to ensure that the ports associated with |
|
| 620 |
- # a given network share the same local vlan tag. On |
|
| 621 |
- # single-node XS/XCP, this requires monitoring both the dom0 |
|
| 622 |
- # bridge, where VM's are attached, and the domU bridge, where |
|
| 623 |
- # dhcp servers are attached. |
|
| 624 |
- if is_service_enabled q-dhcp; then |
|
| 625 |
- iniset /$Q_PLUGIN_CONF_FILE OVS domu_integration_bridge $OVS_BRIDGE |
|
| 626 |
- # DomU will use the regular rootwrap |
|
| 627 |
- iniset /$Q_PLUGIN_CONF_FILE AGENT domu_root_helper "$Q_RR_COMMAND" |
|
| 628 |
- # Plug the vm interface into the domU integration bridge. |
|
| 629 |
- sudo ip addr flush dev $GUEST_INTERFACE_DEFAULT |
|
| 630 |
- sudo ip link set $OVS_BRIDGE up |
|
| 631 |
- # Assign the VM IP only if it has been set explicitly |
|
| 632 |
- if [[ "$VM_IP" != "" ]]; then |
|
| 633 |
- sudo ip addr add $VM_IP dev $OVS_BRIDGE |
|
| 634 |
- fi |
|
| 635 |
- sudo ovs-vsctl add-port $OVS_BRIDGE $GUEST_INTERFACE_DEFAULT |
|
| 636 |
- fi |
|
| 637 |
- fi |
|
| 638 |
-} |
|
| 639 |
- |
|
| 640 |
-function _configure_quantum_plugin_agent_ryu() {
|
|
| 641 |
- # Set up integration bridge |
|
| 642 |
- OVS_BRIDGE=${OVS_BRIDGE:-br-int}
|
|
| 643 |
- _quantum_setup_ovs_bridge $OVS_BRIDGE |
|
| 644 |
- if [ -n "$RYU_INTERNAL_INTERFACE" ]; then |
|
| 645 |
- sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE |
|
| 646 |
- fi |
|
| 647 |
- AGENT_BINARY="$QUANTUM_DIR/quantum/plugins/ryu/agent/ryu_quantum_agent.py" |
|
| 549 |
+ quantum_plugin_configure_plugin_agent |
|
| 648 | 550 |
} |
| 649 | 551 |
|
| 650 | 552 |
# _configure_quantum_service() - Set config files for quantum service |
| ... | ... |
@@ -674,57 +508,7 @@ function _configure_quantum_service() {
|
| 674 | 674 |
_quantum_setup_keystone $Q_API_PASTE_FILE filter:authtoken |
| 675 | 675 |
|
| 676 | 676 |
# Configure plugin |
| 677 |
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
|
| 678 |
- if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then |
|
| 679 |
- iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type gre |
|
| 680 |
- iniset /$Q_PLUGIN_CONF_FILE OVS tunnel_id_ranges $TENANT_TUNNEL_RANGES |
|
| 681 |
- elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
| 682 |
- iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type vlan |
|
| 683 |
- else |
|
| 684 |
- echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts." |
|
| 685 |
- fi |
|
| 686 |
- |
|
| 687 |
- # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` |
|
| 688 |
- # for more complex physical network configurations. |
|
| 689 |
- if [[ "$OVS_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
| 690 |
- OVS_VLAN_RANGES=$PHYSICAL_NETWORK |
|
| 691 |
- if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
| 692 |
- OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
| 693 |
- fi |
|
| 694 |
- fi |
|
| 695 |
- if [[ "$OVS_VLAN_RANGES" != "" ]]; then |
|
| 696 |
- iniset /$Q_PLUGIN_CONF_FILE OVS network_vlan_ranges $OVS_VLAN_RANGES |
|
| 697 |
- fi |
|
| 698 |
- |
|
| 699 |
- # Enable tunnel networks if selected |
|
| 700 |
- if [[ $OVS_ENABLE_TUNNELING = "True" ]]; then |
|
| 701 |
- iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True |
|
| 702 |
- fi |
|
| 703 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
| 704 |
- if [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
| 705 |
- iniset /$Q_PLUGIN_CONF_FILE VLANS tenant_network_type vlan |
|
| 706 |
- else |
|
| 707 |
- echo "WARNING - The linuxbridge plugin is using local tenant networks, with no connectivity between hosts." |
|
| 708 |
- fi |
|
| 709 |
- |
|
| 710 |
- # Override ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` |
|
| 711 |
- # for more complex physical network configurations. |
|
| 712 |
- if [[ "$LB_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
| 713 |
- LB_VLAN_RANGES=$PHYSICAL_NETWORK |
|
| 714 |
- if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
| 715 |
- LB_VLAN_RANGES=$LB_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
| 716 |
- fi |
|
| 717 |
- fi |
|
| 718 |
- if [[ "$LB_VLAN_RANGES" != "" ]]; then |
|
| 719 |
- iniset /$Q_PLUGIN_CONF_FILE VLANS network_vlan_ranges $LB_VLAN_RANGES |
|
| 720 |
- fi |
|
| 721 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
| 722 |
- iniset /$Q_PLUGIN_CONF_FILE OVS openflow_controller $RYU_OFP_HOST:$RYU_OFP_PORT |
|
| 723 |
- iniset /$Q_PLUGIN_CONF_FILE OVS openflow_rest_api $RYU_API_HOST:$RYU_API_PORT |
|
| 724 |
- elif [[ "$Q_PLUGIN" = "bigswitch_floodlight" ]]; then |
|
| 725 |
- iniset /$Q_PLUGIN_CONF_FILE RESTPROXY servers $BS_FL_CONTROLLERS_PORT |
|
| 726 |
- iniset /$Q_PLUGIN_CONF_FILE RESTPROXY servertimeout $BS_FL_CONTROLLER_TIMEOUT |
|
| 727 |
- fi |
|
| 677 |
+ quantum_plugin_configure_service |
|
| 728 | 678 |
} |
| 729 | 679 |
|
| 730 | 680 |
# Utility Functions |
| ... | ... |
@@ -784,32 +568,8 @@ function _quantum_setup_keystone() {
|
| 784 | 784 |
rm -f $QUANTUM_AUTH_CACHE_DIR/* |
| 785 | 785 |
} |
| 786 | 786 |
|
| 787 |
-function _quantum_setup_ovs_bridge() {
|
|
| 788 |
- local bridge=$1 |
|
| 789 |
- quantum-ovs-cleanup --ovs_integration_bridge $bridge |
|
| 790 |
- sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge |
|
| 791 |
- sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge |
|
| 792 |
-} |
|
| 793 |
- |
|
| 794 | 787 |
function _quantum_setup_interface_driver() {
|
| 795 |
- local conf_file=$1 |
|
| 796 |
- if [[ "$Q_PLUGIN" == "openvswitch" ]]; then |
|
| 797 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
| 798 |
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then |
|
| 799 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver |
|
| 800 |
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then |
|
| 801 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver |
|
| 802 |
- elif [[ "$Q_PLUGIN" = "bigswitch_floodlight" ]]; then |
|
| 803 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
| 804 |
- fi |
|
| 805 |
-} |
|
| 806 |
- |
|
| 807 |
-function _quantum_setup_external_bridge() {
|
|
| 808 |
- local bridge=$1 |
|
| 809 |
- quantum-ovs-cleanup --external_network_bridge $bridge |
|
| 810 |
- sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge |
|
| 811 |
- # ensure no IP is configured on the public bridge |
|
| 812 |
- sudo ip addr flush dev $bridge |
|
| 788 |
+ quantum_plugin_setup_interface_driver $1 |
|
| 813 | 789 |
} |
| 814 | 790 |
|
| 815 | 791 |
# Functions for Quantum Exercises |
| ... | ... |
@@ -886,55 +646,45 @@ function _ssh_check_quantum() {
|
| 886 | 886 |
|
| 887 | 887 |
# Quantum 3rd party programs |
| 888 | 888 |
#--------------------------- |
| 889 |
-# A comma-separated list of 3rd party programs |
|
| 890 |
-QUANTUM_THIRD_PARTIES="ryu,bigswitch_floodlight" |
|
| 891 |
-for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
|
|
| 892 |
- source lib/$third_party |
|
| 889 |
+# please refer to lib/quantum_thirdparty/README.md for details |
|
| 890 |
+QUANTUM_THIRD_PARTIES="" |
|
| 891 |
+for f in $TOP_DIR/lib/quantum_thirdparty/*; do |
|
| 892 |
+ third_party=$(basename $f) |
|
| 893 |
+ if is_service_enabled $third_party; then |
|
| 894 |
+ source $TOP_DIR/lib/quantum_thirdparty/$third_party |
|
| 895 |
+ QUANTUM_THIRD_PARTIES="$QUANTUM_THIRD_PARTIES,$third_party" |
|
| 896 |
+ fi |
|
| 893 | 897 |
done |
| 894 | 898 |
|
| 895 |
-# configure_quantum_third_party() - Set config files, create data dirs, etc |
|
| 896 |
-function configure_quantum_third_party() {
|
|
| 899 |
+function _quantum_third_party_do() {
|
|
| 897 | 900 |
for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
|
| 898 |
- if is_service_enabled $third_party; then |
|
| 899 |
- configure_${third_party}
|
|
| 900 |
- fi |
|
| 901 |
+ ${1}_${third_party}
|
|
| 901 | 902 |
done |
| 902 | 903 |
} |
| 903 | 904 |
|
| 905 |
+# configure_quantum_third_party() - Set config files, create data dirs, etc |
|
| 906 |
+function configure_quantum_third_party() {
|
|
| 907 |
+ _quantum_third_party_do configure |
|
| 908 |
+} |
|
| 909 |
+ |
|
| 904 | 910 |
# init_quantum_third_party() - Initialize databases, etc. |
| 905 | 911 |
function init_quantum_third_party() {
|
| 906 |
- for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
|
|
| 907 |
- if is_service_enabled $third_party; then |
|
| 908 |
- init_${third_party}
|
|
| 909 |
- fi |
|
| 910 |
- done |
|
| 912 |
+ _quantum_third_party_do init |
|
| 911 | 913 |
} |
| 912 | 914 |
|
| 913 | 915 |
# install_quantum_third_party() - Collect source and prepare |
| 914 | 916 |
function install_quantum_third_party() {
|
| 915 |
- for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
|
|
| 916 |
- if is_service_enabled $third_party; then |
|
| 917 |
- install_${third_party}
|
|
| 918 |
- fi |
|
| 919 |
- done |
|
| 917 |
+ _quantum_third_party_do install |
|
| 920 | 918 |
} |
| 921 | 919 |
|
| 922 | 920 |
# start_quantum_third_party() - Start running processes, including screen |
| 923 | 921 |
function start_quantum_third_party() {
|
| 924 |
- for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
|
|
| 925 |
- if is_service_enabled $third_party; then |
|
| 926 |
- start_${third_party}
|
|
| 927 |
- fi |
|
| 928 |
- done |
|
| 922 |
+ _quantum_third_party_do start |
|
| 929 | 923 |
} |
| 930 | 924 |
|
| 931 | 925 |
# stop_quantum_third_party - Stop running processes (non-screen) |
| 932 | 926 |
function stop_quantum_third_party() {
|
| 933 |
- for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
|
|
| 934 |
- if is_service_enabled $third_party; then |
|
| 935 |
- stop_${third_party}
|
|
| 936 |
- fi |
|
| 937 |
- done |
|
| 927 |
+ _quantum_third_party_do stop |
|
| 938 | 928 |
} |
| 939 | 929 |
|
| 940 | 930 |
|
| 941 | 931 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,34 @@ |
| 0 |
+Quantum plugin specific files |
|
| 1 |
+============================= |
|
| 2 |
+Quantum plugins require plugin specific behavior. |
|
| 3 |
+The files under the directory, ``lib/quantum_plugins/``, will be used |
|
| 4 |
+when their service is enabled. |
|
| 5 |
+Each plugin has ``lib/quantum_plugins/$Q_PLUGIN`` and define the following |
|
| 6 |
+functions. |
|
| 7 |
+Plugin specific configuration variables should be in this file. |
|
| 8 |
+ |
|
| 9 |
+* filename: ``$Q_PLUGIN`` |
|
| 10 |
+ * The corresponding file name MUST be the same to plugin name ``$Q_PLUGIN``. |
|
| 11 |
+ Plugin specific configuration variables should be in this file. |
|
| 12 |
+ |
|
| 13 |
+functions |
|
| 14 |
+--------- |
|
| 15 |
+``lib/quantum`` calls the following functions when the ``$Q_PLUGIN`` is enabled |
|
| 16 |
+ |
|
| 17 |
+* ``quantum_plugin_create_nova_conf`` : |
|
| 18 |
+ set ``NOVA_VIF_DRIVER`` and optionally set options in nova_conf |
|
| 19 |
+ e.g. |
|
| 20 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"}
|
|
| 21 |
+* ``quantum_plugin_install_agent_packages`` : |
|
| 22 |
+ install packages that is specific to plugin agent |
|
| 23 |
+ e.g. |
|
| 24 |
+ install_package bridge-utils |
|
| 25 |
+* ``quantum_plugin_configure_common`` : |
|
| 26 |
+ set plugin-specific variables, ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``, |
|
| 27 |
+ ``Q_DB_NAME``, ``Q_PLUGIN_CLASS`` |
|
| 28 |
+* ``quantum_plugin_configure_debug_command`` |
|
| 29 |
+* ``quantum_plugin_configure_dhcp_agent`` |
|
| 30 |
+* ``quantum_plugin_configure_l3_agent`` |
|
| 31 |
+* ``quantum_plugin_configure_plugin_agent`` |
|
| 32 |
+* ``quantum_plugin_configure_service`` |
|
| 33 |
+* ``quantum_plugin_setup_interface_driver`` |
| 0 | 34 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,55 @@ |
| 0 |
+# Quantum Big Switch/FloodLight plugin |
|
| 1 |
+# ------------------------------------ |
|
| 2 |
+ |
|
| 3 |
+# Save trace setting |
|
| 4 |
+XTRACE=$(set +o | grep xtrace) |
|
| 5 |
+set +o xtrace |
|
| 6 |
+ |
|
| 7 |
+source $TOP_DIR/lib/quantum_plugins/ovs_base |
|
| 8 |
+source $TOP_DIR/lib/quantum_thirdparty/bigswitch_floodlight # for third party service specific configuration values |
|
| 9 |
+ |
|
| 10 |
+function quantum_plugin_create_nova_conf() {
|
|
| 11 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"}
|
|
| 12 |
+} |
|
| 13 |
+ |
|
| 14 |
+function quantum_plugin_install_agent_packages() {
|
|
| 15 |
+ _quantum_ovs_base_install_agent_packages |
|
| 16 |
+} |
|
| 17 |
+ |
|
| 18 |
+function quantum_plugin_configure_common() {
|
|
| 19 |
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/bigswitch |
|
| 20 |
+ Q_PLUGIN_CONF_FILENAME=restproxy.ini |
|
| 21 |
+ Q_DB_NAME="restproxy_quantum" |
|
| 22 |
+ Q_PLUGIN_CLASS="quantum.plugins.bigswitch.plugin.QuantumRestProxyV2" |
|
| 23 |
+ BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80}
|
|
| 24 |
+ BS_FL_CONTROLLER_TIMEOUT=${BS_FL_CONTROLLER_TIMEOUT:-10}
|
|
| 25 |
+} |
|
| 26 |
+ |
|
| 27 |
+function quantum_plugin_configure_debug_command() {
|
|
| 28 |
+ _quantum_ovs_base_configure_debug_command |
|
| 29 |
+} |
|
| 30 |
+ |
|
| 31 |
+function quantum_plugin_configure_dhcp_agent() {
|
|
| 32 |
+ : |
|
| 33 |
+} |
|
| 34 |
+ |
|
| 35 |
+function quantum_plugin_configure_l3_agent() {
|
|
| 36 |
+ _quantum_ovs_base_configure_l3_agent |
|
| 37 |
+} |
|
| 38 |
+ |
|
| 39 |
+function quantum_plugin_configure_plugin_agent() {
|
|
| 40 |
+ : |
|
| 41 |
+} |
|
| 42 |
+ |
|
| 43 |
+function quantum_plugin_configure_service() {
|
|
| 44 |
+ iniset /$Q_PLUGIN_CONF_FILE RESTPROXY servers $BS_FL_CONTROLLERS_PORT |
|
| 45 |
+ iniset /$Q_PLUGIN_CONF_FILE RESTPROXY servertimeout $BS_FL_CONTROLLER_TIMEOUT |
|
| 46 |
+} |
|
| 47 |
+ |
|
| 48 |
+function quantum_plugin_setup_interface_driver() {
|
|
| 49 |
+ local conf_file=$1 |
|
| 50 |
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
| 51 |
+} |
|
| 52 |
+ |
|
| 53 |
+# Restore xtrace |
|
| 54 |
+$XTRACE |
| 0 | 55 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,79 @@ |
| 0 |
+# Quantum Linux Bridge plugin |
|
| 1 |
+# --------------------------- |
|
| 2 |
+ |
|
| 3 |
+# Save trace setting |
|
| 4 |
+XTRACE=$(set +o | grep xtrace) |
|
| 5 |
+set +o xtrace |
|
| 6 |
+ |
|
| 7 |
+function is_quantum_ovs_base_plugin() {
|
|
| 8 |
+ # linuxbridge doesn't use OVS |
|
| 9 |
+ return 1 |
|
| 10 |
+} |
|
| 11 |
+ |
|
| 12 |
+function quantum_plugin_create_nova_conf() {
|
|
| 13 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver"}
|
|
| 14 |
+} |
|
| 15 |
+ |
|
| 16 |
+function quantum_plugin_install_agent_packages() {
|
|
| 17 |
+ install_package bridge-utils |
|
| 18 |
+} |
|
| 19 |
+ |
|
| 20 |
+function quantum_plugin_configure_common() {
|
|
| 21 |
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/linuxbridge |
|
| 22 |
+ Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini |
|
| 23 |
+ Q_DB_NAME="quantum_linux_bridge" |
|
| 24 |
+ Q_PLUGIN_CLASS="quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2" |
|
| 25 |
+} |
|
| 26 |
+ |
|
| 27 |
+function quantum_plugin_configure_debug_command() {
|
|
| 28 |
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge |
|
| 29 |
+} |
|
| 30 |
+ |
|
| 31 |
+function quantum_plugin_configure_dhcp_agent() {
|
|
| 32 |
+ : |
|
| 33 |
+} |
|
| 34 |
+ |
|
| 35 |
+function quantum_plugin_configure_l3_agent() {
|
|
| 36 |
+ iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge |
|
| 37 |
+} |
|
| 38 |
+ |
|
| 39 |
+function quantum_plugin_configure_plugin_agent() {
|
|
| 40 |
+ # Setup physical network interface mappings. Override |
|
| 41 |
+ # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more |
|
| 42 |
+ # complex physical network configurations. |
|
| 43 |
+ if [[ "$LB_INTERFACE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then |
|
| 44 |
+ LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE |
|
| 45 |
+ fi |
|
| 46 |
+ if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then |
|
| 47 |
+ iniset /$Q_PLUGIN_CONF_FILE LINUX_BRIDGE physical_interface_mappings $LB_INTERFACE_MAPPINGS |
|
| 48 |
+ fi |
|
| 49 |
+ AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent" |
|
| 50 |
+} |
|
| 51 |
+ |
|
| 52 |
+function quantum_plugin_configure_service() {
|
|
| 53 |
+ if [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
| 54 |
+ iniset /$Q_PLUGIN_CONF_FILE VLANS tenant_network_type vlan |
|
| 55 |
+ else |
|
| 56 |
+ echo "WARNING - The linuxbridge plugin is using local tenant networks, with no connectivity between hosts." |
|
| 57 |
+ fi |
|
| 58 |
+ |
|
| 59 |
+ # Override ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` |
|
| 60 |
+ # for more complex physical network configurations. |
|
| 61 |
+ if [[ "$LB_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
| 62 |
+ LB_VLAN_RANGES=$PHYSICAL_NETWORK |
|
| 63 |
+ if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
| 64 |
+ LB_VLAN_RANGES=$LB_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
| 65 |
+ fi |
|
| 66 |
+ fi |
|
| 67 |
+ if [[ "$LB_VLAN_RANGES" != "" ]]; then |
|
| 68 |
+ iniset /$Q_PLUGIN_CONF_FILE VLANS network_vlan_ranges $LB_VLAN_RANGES |
|
| 69 |
+ fi |
|
| 70 |
+} |
|
| 71 |
+ |
|
| 72 |
+function quantum_plugin_setup_interface_driver() {
|
|
| 73 |
+ local conf_file=$1 |
|
| 74 |
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver |
|
| 75 |
+} |
|
| 76 |
+ |
|
| 77 |
+# Restore xtrace |
|
| 78 |
+$XTRACE |
| 0 | 79 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,144 @@ |
| 0 |
+# Quantum Open vSwtich plugin |
|
| 1 |
+# --------------------------- |
|
| 2 |
+ |
|
| 3 |
+# Save trace setting |
|
| 4 |
+XTRACE=$(set +o | grep xtrace) |
|
| 5 |
+set +o xtrace |
|
| 6 |
+ |
|
| 7 |
+source $TOP_DIR/lib/quantum_plugins/ovs_base |
|
| 8 |
+ |
|
| 9 |
+function quantum_plugin_create_nova_conf() {
|
|
| 10 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"}
|
|
| 11 |
+ if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
|
| 12 |
+ iniset $NOVA_CONF DEFAULT xenapi_vif_driver nova.virt.xenapi.vif.XenAPIOpenVswitchDriver |
|
| 13 |
+ iniset $NOVA_CONF DEFAULT xenapi_ovs_integration_bridge $FLAT_NETWORK_BRIDGE |
|
| 14 |
+ fi |
|
| 15 |
+} |
|
| 16 |
+ |
|
| 17 |
+function quantum_plugin_install_agent_packages() {
|
|
| 18 |
+ _quantum_ovs_base_install_agent_packages |
|
| 19 |
+} |
|
| 20 |
+ |
|
| 21 |
+function quantum_plugin_configure_common() {
|
|
| 22 |
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/openvswitch |
|
| 23 |
+ Q_PLUGIN_CONF_FILENAME=ovs_quantum_plugin.ini |
|
| 24 |
+ Q_DB_NAME="ovs_quantum" |
|
| 25 |
+ Q_PLUGIN_CLASS="quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2" |
|
| 26 |
+} |
|
| 27 |
+ |
|
| 28 |
+function quantum_plugin_configure_debug_command() {
|
|
| 29 |
+ _quantum_ovs_base_configure_debug_command |
|
| 30 |
+} |
|
| 31 |
+ |
|
| 32 |
+function quantum_plugin_configure_dhcp_agent() {
|
|
| 33 |
+ : |
|
| 34 |
+} |
|
| 35 |
+ |
|
| 36 |
+function quantum_plugin_configure_l3_agent() {
|
|
| 37 |
+ _quantum_ovs_base_configure_l3_agent |
|
| 38 |
+} |
|
| 39 |
+ |
|
| 40 |
+function quantum_plugin_configure_plugin_agent() {
|
|
| 41 |
+ # Setup integration bridge |
|
| 42 |
+ OVS_BRIDGE=${OVS_BRIDGE:-br-int}
|
|
| 43 |
+ _quantum_ovs_base_setup_bridge $OVS_BRIDGE |
|
| 44 |
+ |
|
| 45 |
+ # Setup agent for tunneling |
|
| 46 |
+ if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then |
|
| 47 |
+ # Verify tunnels are supported |
|
| 48 |
+ # REVISIT - also check kernel module support for GRE and patch ports |
|
| 49 |
+ OVS_VERSION=`ovs-vsctl --version | head -n 1 | awk '{print $4;}'`
|
|
| 50 |
+ if [ $OVS_VERSION \< "1.4" ] && ! is_service_enabled q-svc ; then |
|
| 51 |
+ echo "You are running OVS version $OVS_VERSION." |
|
| 52 |
+ echo "OVS 1.4+ is required for tunneling between multiple hosts." |
|
| 53 |
+ exit 1 |
|
| 54 |
+ fi |
|
| 55 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True |
|
| 56 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS local_ip $HOST_IP |
|
| 57 |
+ fi |
|
| 58 |
+ |
|
| 59 |
+ # Setup physical network bridge mappings. Override |
|
| 60 |
+ # ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` for more |
|
| 61 |
+ # complex physical network configurations. |
|
| 62 |
+ if [[ "$OVS_BRIDGE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then |
|
| 63 |
+ OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE |
|
| 64 |
+ |
|
| 65 |
+ # Configure bridge manually with physical interface as port for multi-node |
|
| 66 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $OVS_PHYSICAL_BRIDGE |
|
| 67 |
+ fi |
|
| 68 |
+ if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then |
|
| 69 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS bridge_mappings $OVS_BRIDGE_MAPPINGS |
|
| 70 |
+ fi |
|
| 71 |
+ AGENT_BINARY="$QUANTUM_DIR/bin/quantum-openvswitch-agent" |
|
| 72 |
+ |
|
| 73 |
+ if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
|
| 74 |
+ # Nova will always be installed along with quantum for a domU |
|
| 75 |
+ # devstack install, so it should be safe to rely on nova.conf |
|
| 76 |
+ # for xenapi configuration. |
|
| 77 |
+ Q_RR_DOM0_COMMAND="$QUANTUM_DIR/bin/quantum-rootwrap-dom0 $NOVA_CONF" |
|
| 78 |
+ # Under XS/XCP, the ovs agent needs to target the dom0 |
|
| 79 |
+ # integration bridge. This is enabled by using a root wrapper |
|
| 80 |
+ # that executes commands on dom0 via a XenAPI plugin. |
|
| 81 |
+ iniset /$Q_PLUGIN_CONF_FILE AGENT root_helper "$Q_RR_DOM0_COMMAND" |
|
| 82 |
+ |
|
| 83 |
+ # FLAT_NETWORK_BRIDGE is the dom0 integration bridge. To |
|
| 84 |
+ # ensure the bridge lacks direct connectivity, set |
|
| 85 |
+ # VM_VLAN=-1;VM_DEV=invalid in localrc |
|
| 86 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS integration_bridge $FLAT_NETWORK_BRIDGE |
|
| 87 |
+ |
|
| 88 |
+ # The ovs agent needs to ensure that the ports associated with |
|
| 89 |
+ # a given network share the same local vlan tag. On |
|
| 90 |
+ # single-node XS/XCP, this requires monitoring both the dom0 |
|
| 91 |
+ # bridge, where VM's are attached, and the domU bridge, where |
|
| 92 |
+ # dhcp servers are attached. |
|
| 93 |
+ if is_service_enabled q-dhcp; then |
|
| 94 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS domu_integration_bridge $OVS_BRIDGE |
|
| 95 |
+ # DomU will use the regular rootwrap |
|
| 96 |
+ iniset /$Q_PLUGIN_CONF_FILE AGENT domu_root_helper "$Q_RR_COMMAND" |
|
| 97 |
+ # Plug the vm interface into the domU integration bridge. |
|
| 98 |
+ sudo ip addr flush dev $GUEST_INTERFACE_DEFAULT |
|
| 99 |
+ sudo ip link set $OVS_BRIDGE up |
|
| 100 |
+ # Assign the VM IP only if it has been set explicitly |
|
| 101 |
+ if [[ "$VM_IP" != "" ]]; then |
|
| 102 |
+ sudo ip addr add $VM_IP dev $OVS_BRIDGE |
|
| 103 |
+ fi |
|
| 104 |
+ sudo ovs-vsctl add-port $OVS_BRIDGE $GUEST_INTERFACE_DEFAULT |
|
| 105 |
+ fi |
|
| 106 |
+ fi |
|
| 107 |
+} |
|
| 108 |
+ |
|
| 109 |
+function quantum_plugin_configure_service() {
|
|
| 110 |
+ if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then |
|
| 111 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type gre |
|
| 112 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS tunnel_id_ranges $TENANT_TUNNEL_RANGES |
|
| 113 |
+ elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
| 114 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type vlan |
|
| 115 |
+ else |
|
| 116 |
+ echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts." |
|
| 117 |
+ fi |
|
| 118 |
+ |
|
| 119 |
+ # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` |
|
| 120 |
+ # for more complex physical network configurations. |
|
| 121 |
+ if [[ "$OVS_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
| 122 |
+ OVS_VLAN_RANGES=$PHYSICAL_NETWORK |
|
| 123 |
+ if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
| 124 |
+ OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
| 125 |
+ fi |
|
| 126 |
+ fi |
|
| 127 |
+ if [[ "$OVS_VLAN_RANGES" != "" ]]; then |
|
| 128 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS network_vlan_ranges $OVS_VLAN_RANGES |
|
| 129 |
+ fi |
|
| 130 |
+ |
|
| 131 |
+ # Enable tunnel networks if selected |
|
| 132 |
+ if [[ $OVS_ENABLE_TUNNELING = "True" ]]; then |
|
| 133 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True |
|
| 134 |
+ fi |
|
| 135 |
+} |
|
| 136 |
+ |
|
| 137 |
+function quantum_plugin_setup_interface_driver() {
|
|
| 138 |
+ local conf_file=$1 |
|
| 139 |
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
| 140 |
+} |
|
| 141 |
+ |
|
| 142 |
+# Restore xtrace |
|
| 143 |
+$XTRACE |
| 0 | 144 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,49 @@ |
| 0 |
+# common functions for ovs based plugin |
|
| 1 |
+# ------------------------------------- |
|
| 2 |
+ |
|
| 3 |
+# Save trace setting |
|
| 4 |
+XTRACE=$(set +o | grep xtrace) |
|
| 5 |
+set +o xtrace |
|
| 6 |
+ |
|
| 7 |
+function is_quantum_ovs_base_plugin() {
|
|
| 8 |
+ # Yes, we use OVS. |
|
| 9 |
+ return 0 |
|
| 10 |
+} |
|
| 11 |
+ |
|
| 12 |
+function _quantum_ovs_base_setup_bridge() {
|
|
| 13 |
+ local bridge=$1 |
|
| 14 |
+ quantum-ovs-cleanup --ovs_integration_bridge $bridge |
|
| 15 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge |
|
| 16 |
+ sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge |
|
| 17 |
+} |
|
| 18 |
+ |
|
| 19 |
+function _quantum_ovs_base_install_agent_packages() {
|
|
| 20 |
+ local kernel_version |
|
| 21 |
+ # Install deps |
|
| 22 |
+ # FIXME add to ``files/apts/quantum``, but don't install if not needed! |
|
| 23 |
+ if is_ubuntu; then |
|
| 24 |
+ kernel_version=`cat /proc/version | cut -d " " -f3` |
|
| 25 |
+ install_package make fakeroot dkms openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version |
|
| 26 |
+ else |
|
| 27 |
+ ### FIXME(dtroyer): Find RPMs for OpenVSwitch |
|
| 28 |
+ echo "OpenVSwitch packages need to be located" |
|
| 29 |
+ # Fedora does not started OVS by default |
|
| 30 |
+ restart_service openvswitch |
|
| 31 |
+ fi |
|
| 32 |
+} |
|
| 33 |
+ |
|
| 34 |
+function _quantum_ovs_base_configure_debug_command() {
|
|
| 35 |
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
| 36 |
+} |
|
| 37 |
+ |
|
| 38 |
+function _quantum_ovs_base_configure_l3_agent() {
|
|
| 39 |
+ iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
| 40 |
+ |
|
| 41 |
+ quantum-ovs-cleanup --external_network_bridge $PUBLIC_BRIDGE |
|
| 42 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE |
|
| 43 |
+ # ensure no IP is configured on the public bridge |
|
| 44 |
+ sudo ip addr flush dev $PUBLIC_BRIDGE |
|
| 45 |
+} |
|
| 46 |
+ |
|
| 47 |
+# Restore xtrace |
|
| 48 |
+$XTRACE |
| 0 | 49 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,63 @@ |
| 0 |
+# Quantum Ryu plugin |
|
| 1 |
+# ------------------ |
|
| 2 |
+ |
|
| 3 |
+# Save trace setting |
|
| 4 |
+XTRACE=$(set +o | grep xtrace) |
|
| 5 |
+set +o xtrace |
|
| 6 |
+ |
|
| 7 |
+source $TOP_DIR/lib/quantum_plugins/ovs_base |
|
| 8 |
+source $TOP_DIR/lib/quantum_thirdparty/ryu # for configuration value |
|
| 9 |
+ |
|
| 10 |
+function quantum_plugin_create_nova_conf() {
|
|
| 11 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"}
|
|
| 12 |
+ iniset $NOVA_CONF DEFAULT libvirt_ovs_integration_bridge "$OVS_BRIDGE" |
|
| 13 |
+} |
|
| 14 |
+ |
|
| 15 |
+function quantum_plugin_install_agent_packages() {
|
|
| 16 |
+ _quantum_ovs_base_install_agent_packages |
|
| 17 |
+} |
|
| 18 |
+ |
|
| 19 |
+function quantum_plugin_configure_common() {
|
|
| 20 |
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/ryu |
|
| 21 |
+ Q_PLUGIN_CONF_FILENAME=ryu.ini |
|
| 22 |
+ Q_DB_NAME="ovs_quantum" |
|
| 23 |
+ Q_PLUGIN_CLASS="quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2" |
|
| 24 |
+} |
|
| 25 |
+ |
|
| 26 |
+function quantum_plugin_configure_debug_command() {
|
|
| 27 |
+ _quantum_ovs_base_configure_debug_command |
|
| 28 |
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
| 29 |
+} |
|
| 30 |
+ |
|
| 31 |
+function quantum_plugin_configure_dhcp_agent() {
|
|
| 32 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
| 33 |
+} |
|
| 34 |
+ |
|
| 35 |
+function quantum_plugin_configure_l3_agent() {
|
|
| 36 |
+ iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
| 37 |
+ _quantum_ovs_base_configure_l3_agent |
|
| 38 |
+} |
|
| 39 |
+ |
|
| 40 |
+function quantum_plugin_configure_plugin_agent() {
|
|
| 41 |
+ # Set up integration bridge |
|
| 42 |
+ OVS_BRIDGE=${OVS_BRIDGE:-br-int}
|
|
| 43 |
+ _quantum_ovs_base_setup_bridge $OVS_BRIDGE |
|
| 44 |
+ if [ -n "$RYU_INTERNAL_INTERFACE" ]; then |
|
| 45 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE |
|
| 46 |
+ fi |
|
| 47 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS integration_bridge $OVS_BRIDGE |
|
| 48 |
+ AGENT_BINARY="$QUANTUM_DIR/quantum/plugins/ryu/agent/ryu_quantum_agent.py" |
|
| 49 |
+} |
|
| 50 |
+ |
|
| 51 |
+function quantum_plugin_configure_service() {
|
|
| 52 |
+ iniset /$Q_PLUGIN_CONF_FILE OVS openflow_rest_api $RYU_API_HOST:$RYU_API_PORT |
|
| 53 |
+} |
|
| 54 |
+ |
|
| 55 |
+function quantum_plugin_setup_interface_driver() {
|
|
| 56 |
+ local conf_file=$1 |
|
| 57 |
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
| 58 |
+ iniset $conf_file DEFAULT ovs_use_veth True |
|
| 59 |
+} |
|
| 60 |
+ |
|
| 61 |
+# Restore xtrace |
|
| 62 |
+$XTRACE |
| 0 | 63 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,36 @@ |
| 0 |
+Quantum third party specific files |
|
| 1 |
+================================== |
|
| 2 |
+Some Quantum plugins require third party programs to function. |
|
| 3 |
+The files under the directory, ``lib/quantum_thirdparty/``, will be used |
|
| 4 |
+when their service are enabled. |
|
| 5 |
+Third party program specific configuration variables should be in this file. |
|
| 6 |
+ |
|
| 7 |
+* filename: ``<third_party>`` |
|
| 8 |
+ * The corresponding file name should be same to service name, ``<third_party>``. |
|
| 9 |
+ |
|
| 10 |
+functions |
|
| 11 |
+--------- |
|
| 12 |
+``lib/quantum`` calls the following functions when the ``<third_party>`` is enabled |
|
| 13 |
+ |
|
| 14 |
+functions to be implemented |
|
| 15 |
+* ``configure_<third_party>``: |
|
| 16 |
+ set config files, create data dirs, etc |
|
| 17 |
+ e.g. |
|
| 18 |
+ sudo python setup.py deploy |
|
| 19 |
+ iniset $XXXX_CONF... |
|
| 20 |
+ |
|
| 21 |
+* ``init_<third_party>``: |
|
| 22 |
+ initialize databases, etc |
|
| 23 |
+ |
|
| 24 |
+* ``install_<third_party>``: |
|
| 25 |
+ collect source and prepare |
|
| 26 |
+ e.g. |
|
| 27 |
+ git clone xxx |
|
| 28 |
+ |
|
| 29 |
+* ``start_<third_party>``: |
|
| 30 |
+ start running processes, including screen |
|
| 31 |
+ e.g. |
|
| 32 |
+ screen_it XXXX "cd $XXXXY_DIR && $XXXX_DIR/bin/XXXX-bin" |
|
| 33 |
+ |
|
| 34 |
+* ``stop_<third_party>``: |
|
| 35 |
+ stop running processes (non-screen) |
| 0 | 36 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,50 @@ |
| 0 |
+# Big Switch/FloodLight OpenFlow Controller |
|
| 1 |
+# ------------------------------------------ |
|
| 2 |
+ |
|
| 3 |
+# Save trace setting |
|
| 4 |
+XTRACE=$(set +o | grep xtrace) |
|
| 5 |
+set +o xtrace |
|
| 6 |
+ |
|
| 7 |
+BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80}
|
|
| 8 |
+BS_FL_OF_PORT=${BS_FL_OF_PORT:-6633}
|
|
| 9 |
+OVS_BRIDGE=${OVS_BRIDGE:-br-int}
|
|
| 10 |
+ |
|
| 11 |
+function configure_bigswitch_floodlight() {
|
|
| 12 |
+ : |
|
| 13 |
+} |
|
| 14 |
+ |
|
| 15 |
+function init_bigswitch_floodlight() {
|
|
| 16 |
+ install_quantum_agent_packages |
|
| 17 |
+ |
|
| 18 |
+ echo -n "Installing OVS managed by the openflow controllers:" |
|
| 19 |
+ echo ${BS_FL_CONTROLLERS_PORT}
|
|
| 20 |
+ |
|
| 21 |
+ # Create local OVS bridge and configure it |
|
| 22 |
+ sudo ovs-vsctl --no-wait -- --if-exists del-br ${OVS_BRIDGE}
|
|
| 23 |
+ sudo ovs-vsctl --no-wait add-br ${OVS_BRIDGE}
|
|
| 24 |
+ sudo ovs-vsctl --no-wait br-set-external-id ${OVS_BRIDGE} bridge-id ${OVS_BRIDGE}
|
|
| 25 |
+ |
|
| 26 |
+ ctrls= |
|
| 27 |
+ for ctrl in `echo ${BS_FL_CONTROLLERS_PORT} | tr ',' ' '`
|
|
| 28 |
+ do |
|
| 29 |
+ ctrl=${ctrl%:*}
|
|
| 30 |
+ ctrls="${ctrls} tcp:${ctrl}:${BS_FL_OF_PORT}"
|
|
| 31 |
+ done |
|
| 32 |
+ echo "Adding Network conttrollers: " ${ctrls}
|
|
| 33 |
+ sudo ovs-vsctl --no-wait set-controller ${OVS_BRIDGE} ${ctrls}
|
|
| 34 |
+} |
|
| 35 |
+ |
|
| 36 |
+function install_bigswitch_floodlight() {
|
|
| 37 |
+ : |
|
| 38 |
+} |
|
| 39 |
+ |
|
| 40 |
+function start_bigswitch_floodlight() {
|
|
| 41 |
+ : |
|
| 42 |
+} |
|
| 43 |
+ |
|
| 44 |
+function stop_bigswitch_floodlight() {
|
|
| 45 |
+ : |
|
| 46 |
+} |
|
| 47 |
+ |
|
| 48 |
+# Restore xtrace |
|
| 49 |
+$XTRACE |
| 0 | 50 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,65 @@ |
| 0 |
+# Ryu OpenFlow Controller |
|
| 1 |
+# ----------------------- |
|
| 2 |
+ |
|
| 3 |
+# Save trace setting |
|
| 4 |
+XTRACE=$(set +o | grep xtrace) |
|
| 5 |
+set +o xtrace |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+RYU_DIR=$DEST/ryu |
|
| 9 |
+# Ryu API Host |
|
| 10 |
+RYU_API_HOST=${RYU_API_HOST:-127.0.0.1}
|
|
| 11 |
+# Ryu API Port |
|
| 12 |
+RYU_API_PORT=${RYU_API_PORT:-8080}
|
|
| 13 |
+# Ryu OFP Host |
|
| 14 |
+RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1}
|
|
| 15 |
+# Ryu OFP Port |
|
| 16 |
+RYU_OFP_PORT=${RYU_OFP_PORT:-6633}
|
|
| 17 |
+# Ryu Applications |
|
| 18 |
+RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest}
|
|
| 19 |
+# Ryu configuration |
|
| 20 |
+RYU_CONF_CONTENTS=${RYU_CONF_CONTENTS:-"
|
|
| 21 |
+--app_lists=$RYU_APPS |
|
| 22 |
+--wsapi_host=$RYU_API_HOST |
|
| 23 |
+--wsapi_port=$RYU_API_PORT |
|
| 24 |
+--ofp_listen_host=$RYU_OFP_HOST |
|
| 25 |
+--ofp_tcp_listen_port=$RYU_OFP_PORT |
|
| 26 |
+--quantum_url=http://$Q_HOST:$Q_PORT |
|
| 27 |
+--quantum_admin_username=$Q_ADMIN_USERNAME |
|
| 28 |
+--quantum_admin_password=$SERVICE_PASSWORD |
|
| 29 |
+--quantum_admin_tenant_name=$SERVICE_TENANT_NAME |
|
| 30 |
+--quantum_admin_auth_url=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0 |
|
| 31 |
+--quantum_auth_strategy=$Q_AUTH_STRATEGY |
|
| 32 |
+--quantum_controller_addr=tcp:$RYU_OFP_HOST:$RYU_OFP_PORT |
|
| 33 |
+"} |
|
| 34 |
+ |
|
| 35 |
+function configure_ryu() {
|
|
| 36 |
+ setup_develop $RYU_DIR |
|
| 37 |
+} |
|
| 38 |
+ |
|
| 39 |
+function init_ryu() {
|
|
| 40 |
+ RYU_CONF_DIR=/etc/ryu |
|
| 41 |
+ if [[ ! -d $RYU_CONF_DIR ]]; then |
|
| 42 |
+ sudo mkdir -p $RYU_CONF_DIR |
|
| 43 |
+ fi |
|
| 44 |
+ sudo chown $STACK_USER $RYU_CONF_DIR |
|
| 45 |
+ RYU_CONF=$RYU_CONF_DIR/ryu.conf |
|
| 46 |
+ sudo rm -rf $RYU_CONF |
|
| 47 |
+ |
|
| 48 |
+ echo "${RYU_CONF_CONTENTS}" > $RYU_CONF
|
|
| 49 |
+} |
|
| 50 |
+ |
|
| 51 |
+function install_ryu() {
|
|
| 52 |
+ git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH |
|
| 53 |
+} |
|
| 54 |
+ |
|
| 55 |
+function start_ryu() {
|
|
| 56 |
+ screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --flagfile $RYU_CONF" |
|
| 57 |
+} |
|
| 58 |
+ |
|
| 59 |
+function stop_ryu() {
|
|
| 60 |
+ : |
|
| 61 |
+} |
|
| 62 |
+ |
|
| 63 |
+# Restore xtrace |
|
| 64 |
+$XTRACE |
| 0 | 65 |
deleted file mode 100644 |
| ... | ... |
@@ -1,63 +0,0 @@ |
| 1 |
-# Ryu OpenFlow Controller |
|
| 2 |
-# ----------------------- |
|
| 3 |
- |
|
| 4 |
-# Save trace setting |
|
| 5 |
-XTRACE=$(set +o | grep xtrace) |
|
| 6 |
-set +o xtrace |
|
| 7 |
- |
|
| 8 |
- |
|
| 9 |
-RYU_DIR=$DEST/ryu |
|
| 10 |
-# Ryu API Host |
|
| 11 |
-RYU_API_HOST=${RYU_API_HOST:-127.0.0.1}
|
|
| 12 |
-# Ryu API Port |
|
| 13 |
-RYU_API_PORT=${RYU_API_PORT:-8080}
|
|
| 14 |
-# Ryu OFP Host |
|
| 15 |
-RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1}
|
|
| 16 |
-# Ryu OFP Port |
|
| 17 |
-RYU_OFP_PORT=${RYU_OFP_PORT:-6633}
|
|
| 18 |
-# Ryu Applications |
|
| 19 |
-RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest}
|
|
| 20 |
- |
|
| 21 |
-function configure_ryu() {
|
|
| 22 |
- setup_develop $RYU_DIR |
|
| 23 |
-} |
|
| 24 |
- |
|
| 25 |
-function init_ryu() {
|
|
| 26 |
- RYU_CONF_DIR=/etc/ryu |
|
| 27 |
- if [[ ! -d $RYU_CONF_DIR ]]; then |
|
| 28 |
- sudo mkdir -p $RYU_CONF_DIR |
|
| 29 |
- fi |
|
| 30 |
- sudo chown $STACK_USER $RYU_CONF_DIR |
|
| 31 |
- RYU_CONF=$RYU_CONF_DIR/ryu.conf |
|
| 32 |
- sudo rm -rf $RYU_CONF |
|
| 33 |
- |
|
| 34 |
- cat <<EOF > $RYU_CONF |
|
| 35 |
-EOF |
|
| 36 |
-} |
|
| 37 |
- |
|
| 38 |
-function install_ryu() {
|
|
| 39 |
- git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH |
|
| 40 |
-} |
|
| 41 |
- |
|
| 42 |
-function is_ryu_required() {
|
|
| 43 |
- if is_service_enabled ryu || (is_service_enabled quantum && [[ "$Q_PLUGIN" = "ryu" ]]); then |
|
| 44 |
- return 0 |
|
| 45 |
- fi |
|
| 46 |
- return 1 |
|
| 47 |
-} |
|
| 48 |
- |
|
| 49 |
-function start_ryu() {
|
|
| 50 |
- screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --flagfile $RYU_CONF" |
|
| 51 |
-} |
|
| 52 |
- |
|
| 53 |
-function stop_ryu() {
|
|
| 54 |
- : |
|
| 55 |
-} |
|
| 56 |
- |
|
| 57 |
-# Restore xtrace |
|
| 58 |
-$XTRACE |