Add devstack for neutron-dynamic-routing stadium project

Change-Id: I406b276f691e68adac935a4a2119efc055df31b1
Implements: blueprint bgp-spinout
Partial-Bug: #1560003
changes/38/312038/16
steve.ruan 7 years ago
parent af40ec1339
commit fb4c68d620
  1. 40
      devstack/README.rst
  2. 91
      devstack/lib/dr
  3. 23
      devstack/plugin.sh
  4. 66
      devstack/settings

@ -0,0 +1,40 @@
======================
Enabling in Devstack
======================
1. Download devstack::
git clone http://git.openstack.org/openstack-dev/devstack.git
2. Add neutron-dynamic-routing to devstack. The minimal set of critical local.conf
additions are following::
cd devstack
cat << EOF >> local.conf
> enable_plugin neutron-dynamic-routing http://git.openstack.org/openstack/neutron-dynamic-routing
> EOF
3. run devstack::
./stack.sh
Notes:
1. In default case, neutron-dynamic-routing is installed in allinone mode.
In multiple nodes environment, for controller node::
cd devstack
cat << EOF >> local.conf
> enable_plugin neutron-dynamic-routing http://git.openstack.org/openstack/neutron-dynamic-routing
> DR_MODE=dr_plugin
> EOF
For the nodes where you want to run dr-agent::
cd devstack
cat << EOF >> local.conf
> enable_plugin neutron-dynamic-routing http://git.openstack.org/openstack/neutron-dynamic-routing
> DR_MODE=dr_agent
> EOF
2. In default case, protocol BGP is enabled for neutron-dynamic-routing.
You can change "DR_SUPPORTED_PROTOCOLS" in "devstack/settings" to protocols wanted.

@ -0,0 +1,91 @@
function is_protocol_enabled {
local enabled=1
local protocol=$1
for temp in $DR_SUPPORTED_PROTOCOLS ;do
if [ $protocol == $temp ] ; then
enabled=0
fi
done
return $enabled
}
##############################
# BGP Section #
##############################
function configure_dr_agent_bgp_config {
cp $NEUTRON_DYNAMIC_ROUTING_DIR/etc/bgp_dragent.ini.sample $DR_AGENT_BGP_CONF_FILE
iniset $DR_AGENT_BGP_CONF_FILE DEFAULT verbose True
iniset $DR_AGENT_BGP_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
iniset $DR_AGENT_BGP_CONF_FILE BGP bgp_router_id $BGP_ROUTER_ID
}
function configure_dr_agent_bgp_driver {
if [ -z "$BGP_SPEAKER_DRIVER" ] ; then
BGP_SPEAKER_DRIVER=$RYU_BGP_SPEAKER_DRIVER
fi
iniset $DR_AGENT_BGP_CONF_FILE BGP bgp_speaker_driver $BGP_SPEAKER_DRIVER
}
#############################
# Stack Install Section #
#############################
#This API will be called for phase "install"
function dr_configure {
setup_develop $NEUTRON_DYNAMIC_ROUTING_DIR
if is_service_enabled q-dr && is_service_enabled q-svc; then
if is_protocol_enabled BGP; then
_neutron_service_plugin_class_add $BGP_PLUGIN
fi
fi
}
#############################
# Stack Post-config Section #
#############################
#This API will be called for phase "post-config"
function dr_generate_config_files {
(cd $NEUTRON_DYNAMIC_ROUTING_DIR && exec ./tools/generate_config_file_samples.sh)
}
function dr_post_configure {
if is_service_enabled q-dr-agent; then
dr_generate_config_files
if is_protocol_enabled BGP; then
configure_dr_agent_bgp_config
configure_dr_agent_bgp_driver
fi
fi
}
#############################
# Stack Extra Section #
#############################
#This API will be called for phase "extra"
function start_dr_agent {
local process="$DR_AGENT_BINARY --config-file $NEUTRON_CONF "
local bgp_parameter
if is_protocol_enabled BGP; then
bgp_parameter="--config-file $DR_AGENT_BGP_CONF_FILE"
fi
agent_process=$process$bgp_parameter
if is_service_enabled q-dr-agent; then
run_process q-dr-agent "$agent_process"
fi
}
#############################
# Unstack Section #
#############################
#This API will be called for unstack
function stop_dr_agent {
stop_process q-dr-agent
}

@ -0,0 +1,23 @@
LIBDIR=$NEUTRON_DYNAMIC_ROUTING_DIR/devstack/lib
source $LIBDIR/dr
if [[ "$1" == "stack" ]]; then
case "$2" in
install)
echo_summary "Installing neutron-dynamic-routing"
dr_configure
;;
post-config)
echo_summary "Configuring neutron-dynamic-routing"
dr_post_configure
;;
extra)
echo_summary "Launching neutron-dynamic-routing agent"
start_dr_agent
;;
esac
elif [[ "$1" == "unstack" ]]; then
echo_summary "Uninstalling neutron-dynamic-routing"
stop_dr_agent
fi

@ -0,0 +1,66 @@
#########################
# Devstack Settings #
#########################
# Each service you enable has the following meaning:
# q-dr - Add this config flag for Openstack Neutron server node
# q-dr-agent - Add this config flag indicate that dynamic routing agent
# will be running
# This can be overridden in the localrc file
DR_MODE=${DR_MODE:-allinone}
# DR_MODE is used to configure how devstack works with neutron-dynamic-routing.
# You can configure it in there ways:
#
# DR_MODE=allinone
# Use this mode if you want to run neutron server and q-dr-agent on same node.
# Useful for a single node deployment or on the control node of a multi-node
# devstack environment.
#
# DR_MODE=dr_plugin
# Use this to enable dr plugin extension on neutron server
#
# DR_MODE=dr_agent
# Use this for the nodes where you want to run q-dr-agent in a multi-node
# devstack environment.
case $DR_MODE in
allinone)
enable_service q-dr q-dr-agent
;;
dr_plugin)
enable_service q-dr
;;
dr_agent)
enable_service q-dr-agent
;;
esac
# DR_SUPPORTED_PROTOCOLS specifies the list of protocols supported
# by neutron-dynamic-routing project. ONLY BGP is supported as of now
# and it's enabled by default. The protocols may include: "BGP OSPF ISIS RIP".
# It can be overridden in the localrc file.
DR_SUPPORTED_PROTOCOLS=${DR_SUPPORTED_PROTOCOLS:-"BGP"}
#######################
# Binary Settings #
#######################
NEUTRON_DYNAMIC_ROUTING_DIR=$DEST/neutron-dynamic-routing
DR_AGENT_BINARY=${DR_AGENT_BINARY:-"$NEUTRON_BIN_DIR/neutron-bgp-dragent"}
################################
# Protocol Config Settings #
################################
###########
# BGP #
###########
DR_AGENT_BGP_CONF_FILE=${DR_AGENT_BGP_CONF_FILE:-"$NEUTRON_CONF_DIR/bgp_dragent.ini"}
BGP_ROUTER_ID=${BGP_ROUTER_ID:-"127.0.0.1"}
BGP_PLUGIN=${BGP_PLUGIN:-"neutron_dynamic_routing.services.bgp.bgp_plugin.BgpPlugin"}
RYU_BGP_SPEAKER_DRIVER="neutron_dynamic_routing.services.bgp.agent.driver.ryu.driver.RyuBgpDriver"
Loading…
Cancel
Save