Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 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} |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 20 | # Ryu configuration |
| 21 | RYU_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 MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 35 | |
| 36 | function configure_ryu() { |
| 37 | setup_develop $RYU_DIR |
| 38 | } |
| 39 | |
| 40 | function 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 Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 45 | sudo chown $STACK_USER $RYU_CONF_DIR |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 46 | RYU_CONF=$RYU_CONF_DIR/ryu.conf |
| 47 | sudo rm -rf $RYU_CONF |
| 48 | |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 49 | echo "${RYU_CONF_CONTENTS}" > $RYU_CONF |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 50 | } |
| 51 | |
Isaku Yamahata | 429b39d | 2013-01-09 18:35:55 +0900 | [diff] [blame^] | 52 | # 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 MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 57 | function install_ryu() { |
Isaku Yamahata | 429b39d | 2013-01-09 18:35:55 +0900 | [diff] [blame^] | 58 | if [[ "$_RYU_INSTALLED" == "False" ]]; then |
| 59 | git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH |
| 60 | _RYU_INSTALLED=True |
| 61 | fi |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 62 | } |
| 63 | |
Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 64 | function start_ryu() { |
| 65 | screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --flagfile $RYU_CONF" |
| 66 | } |
| 67 | |
| 68 | function stop_ryu() { |
| 69 | : |
| 70 | } |
| 71 | |
| 72 | # Restore xtrace |
| 73 | $XTRACE |