blob: f1e9e7c495401074ad35811f082c71802c9d459c [file] [log] [blame]
Akihiro MOTOKI66afb472012-12-21 15:34:13 +09001# Ryu OpenFlow Controller
2# -----------------------
3
4# Save trace setting
Dean Troyer8d55be32013-02-07 17:16:35 -06005MY_XTRACE=$(set +o | grep xtrace)
Akihiro MOTOKI66afb472012-12-21 15:34:13 +09006set +o xtrace
7
8
9RYU_DIR=$DEST/ryu
10# Ryu API Host
11RYU_API_HOST=${RYU_API_HOST:-127.0.0.1}
12# Ryu API Port
13RYU_API_PORT=${RYU_API_PORT:-8080}
14# Ryu OFP Host
15RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1}
16# Ryu OFP Port
17RYU_OFP_PORT=${RYU_OFP_PORT:-6633}
18# Ryu Applications
19RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest}
20
Isaku Yamahata2cef6fb2013-02-12 23:05:40 +090021# configure_ryu can be called multiple times as quantum_pluing/ryu may call
22# this function for quantum-ryu-agent
23_RYU_CONFIGURED=${_RYU_CONFIGURED:-False}
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090024function configure_ryu() {
Isaku Yamahata2cef6fb2013-02-12 23:05:40 +090025 if [[ "$_RYU_CONFIGURED" == "False" ]]; then
26 setup_develop $RYU_DIR
27 _RYU_CONFIGURED=True
28 fi
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090029}
30
31function init_ryu() {
32 RYU_CONF_DIR=/etc/ryu
33 if [[ ! -d $RYU_CONF_DIR ]]; then
34 sudo mkdir -p $RYU_CONF_DIR
35 fi
Attila Fazekas91b8d132013-01-06 22:40:09 +010036 sudo chown $STACK_USER $RYU_CONF_DIR
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090037 RYU_CONF=$RYU_CONF_DIR/ryu.conf
38 sudo rm -rf $RYU_CONF
39
Isaku Yamahata2cef6fb2013-02-12 23:05:40 +090040 # Ryu configuration
41 RYU_CONF_CONTENTS=${RYU_CONF_CONTENTS:-"[DEFAULT]
42app_lists=$RYU_APPS
43wsapi_host=$RYU_API_HOST
44wsapi_port=$RYU_API_PORT
45ofp_listen_host=$RYU_OFP_HOST
46ofp_tcp_listen_port=$RYU_OFP_PORT
47quantum_url=http://$Q_HOST:$Q_PORT
48quantum_admin_username=$Q_ADMIN_USERNAME
49quantum_admin_password=$SERVICE_PASSWORD
50quantum_admin_tenant_name=$SERVICE_TENANT_NAME
51quantum_admin_auth_url=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0
52quantum_auth_strategy=$Q_AUTH_STRATEGY
53quantum_controller_addr=tcp:$RYU_OFP_HOST:$RYU_OFP_PORT
54"}
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090055 echo "${RYU_CONF_CONTENTS}" > $RYU_CONF
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090056}
57
Isaku Yamahata429b39d2013-01-09 18:35:55 +090058# install_ryu can be called multiple times as quantum_pluing/ryu may call
59# this function for quantum-ryu-agent
60# Make this function idempotent and avoid cloning same repo many times
61# with RECLONE=yes
62_RYU_INSTALLED=${_RYU_INSTALLED:-False}
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090063function install_ryu() {
Isaku Yamahata429b39d2013-01-09 18:35:55 +090064 if [[ "$_RYU_INSTALLED" == "False" ]]; then
65 git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH
66 _RYU_INSTALLED=True
67 fi
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090068}
69
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090070function start_ryu() {
Isaku Yamahata2cef6fb2013-02-12 23:05:40 +090071 screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --config-file $RYU_CONF"
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090072}
73
74function stop_ryu() {
75 :
76}
77
78# Restore xtrace
Dean Troyer8d55be32013-02-07 17:16:35 -060079$MY_XTRACE