blob: 5717d821c7dde81c66f1504c43ceffdfb8cc1e22 [file] [log] [blame]
Akihiro MOTOKI66afb472012-12-21 15:34:13 +09001# Ryu OpenFlow Controller
2# -----------------------
3
4# Save trace setting
5XTRACE=$(set +o | grep xtrace)
6set +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}
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090020# Ryu configuration
21RYU_CONF_CONTENTS=${RYU_CONF_CONTENTS:-"
22--app_lists=$RYU_APPS
23--wsapi_host=$RYU_API_HOST
24--wsapi_port=$RYU_API_PORT
25--ofp_listen_host=$RYU_OFP_HOST
26--ofp_tcp_listen_port=$RYU_OFP_PORT
27--quantum_url=http://$Q_HOST:$Q_PORT
28--quantum_admin_username=$Q_ADMIN_USERNAME
29--quantum_admin_password=$SERVICE_PASSWORD
30--quantum_admin_tenant_name=$SERVICE_TENANT_NAME
31--quantum_admin_auth_url=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0
32--quantum_auth_strategy=$Q_AUTH_STRATEGY
33--quantum_controller_addr=tcp:$RYU_OFP_HOST:$RYU_OFP_PORT
34"}
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090035
36function configure_ryu() {
37 setup_develop $RYU_DIR
38}
39
40function init_ryu() {
41 RYU_CONF_DIR=/etc/ryu
42 if [[ ! -d $RYU_CONF_DIR ]]; then
43 sudo mkdir -p $RYU_CONF_DIR
44 fi
Attila Fazekas91b8d132013-01-06 22:40:09 +010045 sudo chown $STACK_USER $RYU_CONF_DIR
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090046 RYU_CONF=$RYU_CONF_DIR/ryu.conf
47 sudo rm -rf $RYU_CONF
48
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090049 echo "${RYU_CONF_CONTENTS}" > $RYU_CONF
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090050}
51
Isaku Yamahata429b39d2013-01-09 18:35:55 +090052# install_ryu can be called multiple times as quantum_pluing/ryu may call
53# this function for quantum-ryu-agent
54# Make this function idempotent and avoid cloning same repo many times
55# with RECLONE=yes
56_RYU_INSTALLED=${_RYU_INSTALLED:-False}
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090057function install_ryu() {
Isaku Yamahata429b39d2013-01-09 18:35:55 +090058 if [[ "$_RYU_INSTALLED" == "False" ]]; then
59 git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH
60 _RYU_INSTALLED=True
61 fi
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090062}
63
Akihiro MOTOKI66afb472012-12-21 15:34:13 +090064function start_ryu() {
65 screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --flagfile $RYU_CONF"
66}
67
68function stop_ryu() {
69 :
70}
71
72# Restore xtrace
73$XTRACE