From 4b26d3191ee82e96fedaffa68362919deb8a3813 Mon Sep 17 00:00:00 2001 From: Sumit Naiksatam Date: Fri, 4 Jan 2013 10:32:54 -0800 Subject: [PATCH] Quantum FloodLight/BigSwitch Plugin Support The patch introduces devstack support for the Quantum FloodLight/BigSwitch RESTProxy Plugin. Change-Id: I8c032fd16723ed6055821de0860fae508df371b7 Implements: blueprint quantum-floodlight-bigswitch-plugin-support --- AUTHORS | 1 + lib/bigswitch_floodlight | 50 ++++++++++++++++++++++++++++++++++++++++ lib/quantum | 18 +++++++++++++-- 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 lib/bigswitch_floodlight diff --git a/AUTHORS b/AUTHORS index ba68e32973..7ec1f663c2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -35,6 +35,7 @@ Matt Joyce Osamu Habuka Russell Bryant Scott Moser +Sumit Naiksatam Thierry Carrez Todd Willey Tres Henry diff --git a/lib/bigswitch_floodlight b/lib/bigswitch_floodlight new file mode 100644 index 0000000000..77aeb61d7c --- /dev/null +++ b/lib/bigswitch_floodlight @@ -0,0 +1,50 @@ +# Big Switch/FloodLight OpenFlow Controller +# ------------------------------------------ + +# Save trace setting +XTRACE=$(set +o | grep xtrace) +set +o xtrace + +BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80} +BS_FL_OF_PORT=${BS_FL_OF_PORT:-6633} +OVS_BRIDGE=${OVS_BRIDGE:-br-int} + +function configure_bigswitch_floodlight() { + : +} + +function init_bigswitch_floodlight() { + install_quantum_agent_packages + + echo -n "Installing OVS managed by the openflow controllers:" + echo ${BS_FL_CONTROLLERS_PORT} + + # Create local OVS bridge and configure it + sudo ovs-vsctl --no-wait -- --if-exists del-br ${OVS_BRIDGE} + sudo ovs-vsctl --no-wait add-br ${OVS_BRIDGE} + sudo ovs-vsctl --no-wait br-set-external-id ${OVS_BRIDGE} bridge-id ${OVS_BRIDGE} + + ctrls= + for ctrl in `echo ${BS_FL_CONTROLLERS_PORT} | tr ',' ' '` + do + ctrl=${ctrl%:*} + ctrls="${ctrls} tcp:${ctrl}:${BS_FL_OF_PORT}" + done + echo "Adding Network conttrollers: " ${ctrls} + sudo ovs-vsctl --no-wait set-controller ${OVS_BRIDGE} ${ctrls} +} + +function install_bigswitch_floodlight() { + : +} + +function start_bigswitch_floodlight() { + : +} + +function stop_bigswitch_floodlight() { + : +} + +# Restore xtrace +$XTRACE diff --git a/lib/quantum b/lib/quantum index f74eead689..b8b115af59 100644 --- a/lib/quantum +++ b/lib/quantum @@ -217,6 +217,8 @@ function create_nova_conf_quantum() { iniset $NOVA_CONF DEFAULT libvirt_ovs_integration_bridge "$OVS_BRIDGE" iniset $NOVA_CONF DEFAULT linuxnet_ovs_ryu_api_host "$RYU_API_HOST:$RYU_API_PORT" iniset $NOVA_CONF DEFAULT libvirt_ovs_ryu_api_host "$RYU_API_HOST:$RYU_API_PORT" + elif [[ "$Q_PLUGIN" = "bigswitch_floodlight" ]]; then + NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"} fi iniset $NOVA_CONF DEFAULT libvirt_vif_driver "$NOVA_VIF_DRIVER" iniset $NOVA_CONF DEFAULT linuxnet_interface_driver "$LINUXNET_VIF_DRIVER" @@ -332,7 +334,7 @@ function install_quantum_agent_packages() { function is_quantum_ovs_base_plugin() { local plugin=$1 - if [[ ",openvswitch,ryu," =~ ,${plugin}, ]]; then + if [[ ",openvswitch,ryu,bigswitch_floodlight," =~ ,${plugin}, ]]; then return 0 fi return 1 @@ -407,6 +409,13 @@ function _configure_quantum_common() { Q_PLUGIN_CONF_FILENAME=ryu.ini Q_DB_NAME="ovs_quantum" Q_PLUGIN_CLASS="quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2" + elif [[ "$Q_PLUGIN" = "bigswitch_floodlight" ]]; then + Q_PLUGIN_CONF_PATH=etc/quantum/plugins/bigswitch + Q_PLUGIN_CONF_FILENAME=restproxy.ini + Q_DB_NAME="restproxy_quantum" + Q_PLUGIN_CLASS="quantum.plugins.bigswitch.plugin.QuantumRestProxyV2" + BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80} + BS_FL_CONTROLLER_TIMEOUT=${BS_FL_CONTROLLER_TIMEOUT:-10} fi if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then @@ -674,6 +683,9 @@ function _configure_quantum_service() { elif [[ "$Q_PLUGIN" = "ryu" ]]; then iniset /$Q_PLUGIN_CONF_FILE OVS openflow_controller $RYU_OFP_HOST:$RYU_OFP_PORT iniset /$Q_PLUGIN_CONF_FILE OVS openflow_rest_api $RYU_API_HOST:$RYU_API_PORT + elif [[ "$Q_PLUGIN" = "bigswitch_floodlight" ]]; then + iniset /$Q_PLUGIN_CONF_FILE RESTPROXY servers $BS_FL_CONTROLLERS_PORT + iniset /$Q_PLUGIN_CONF_FILE RESTPROXY servertimeout $BS_FL_CONTROLLER_TIMEOUT fi } @@ -749,6 +761,8 @@ function _quantum_setup_interface_driver() { iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver elif [[ "$Q_PLUGIN" = "ryu" ]]; then iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver + elif [[ "$Q_PLUGIN" = "bigswitch_floodlight" ]]; then + iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver fi } @@ -835,7 +849,7 @@ function _ssh_check_quantum() { # Quantum 3rd party programs #--------------------------- # A comma-separated list of 3rd party programs -QUANTUM_THIRD_PARTIES="ryu" +QUANTUM_THIRD_PARTIES="ryu,bigswitch_floodlight" for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do source lib/$third_party done