Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | saveenv=$- |
| 4 | set -e |
Brian Haley | 4f97149 | 2020-02-17 16:40:33 -0500 | [diff] [blame] | 5 | |
| 6 | # install_octavia_tempest_plugin |
| 7 | function install_octavia_tempest_plugin { |
| 8 | setup_dev_lib "octavia-tempest-plugin" |
| 9 | } |
| 10 | |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 11 | function build_backend_test_server { |
| 12 | if is_fedora || is_ubuntu; then |
| 13 | install_package golang |
| 14 | else |
| 15 | die "Distribution not supported. Supported distributions are: RHEL, CentOS, Fedora, Ubuntu" |
| 16 | fi |
| 17 | |
| 18 | go_path=$(find $DEST/tempest/.tox/tempest/ -name test_server.go) |
Michael Johnson | 2735735 | 2020-11-13 13:55:09 -0800 | [diff] [blame] | 19 | sudo mkdir -m755 -p /opt/octavia-tempest-plugin |
| 20 | sudo chown $STACK_USER /opt/octavia-tempest-plugin |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 21 | CGO_ENABLED=0 GOOS=linux go build \ |
Michael Johnson | 2735735 | 2020-11-13 13:55:09 -0800 | [diff] [blame] | 22 | -a -ldflags '-s -w -extldflags -static' \ |
| 23 | -o /opt/octavia-tempest-plugin/test_server.bin \ |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 24 | ${DEST}/octavia-tempest-plugin/octavia_tempest_plugin/contrib/test_server/test_server.go |
| 25 | } |
| 26 | |
Gregory Thiemonge | 54225ad | 2021-02-04 15:25:17 +0100 | [diff] [blame] | 27 | function _configure_tempest { |
| 28 | if [ -n "$Q_ROUTER_NAME" ]; then |
| 29 | iniset $TEMPEST_CONFIG load_balancer default_router "$Q_ROUTER_NAME" |
| 30 | fi |
| 31 | if [ -n "$SUBNETPOOL_NAME_V6" ]; then |
| 32 | iniset $TEMPEST_CONFIG load_balancer default_ipv6_subnetpool "$SUBNETPOOL_NAME_V6" |
| 33 | fi |
| 34 | } |
| 35 | |
Brian Haley | 4f97149 | 2020-02-17 16:40:33 -0500 | [diff] [blame] | 36 | if [[ "$1" == "stack" ]]; then |
| 37 | case "$2" in |
| 38 | install) |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 39 | # Install dev library if |
Brian Haley | 0818205 | 2020-11-18 12:17:30 -0500 | [diff] [blame] | 40 | # - the release is more recent than train (devstack in train would |
| 41 | # try to install it in a python2 env, but octavia-tempest-plugin |
| 42 | # is now a python3-only project) |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 43 | # - or the user explicitly requests it (INSTALL_TEMPEST=True) |
Brian Haley | 0818205 | 2020-11-18 12:17:30 -0500 | [diff] [blame] | 44 | if [[ ! "$DEVSTACK_SERIES" =~ (stein|train) ]] || [[ "$(trueorfalse False INSTALL_TEMPEST)" == "True" ]]; then |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 45 | echo_summary "Installing octavia-tempest-plugin" |
| 46 | install_octavia_tempest_plugin |
| 47 | fi |
| 48 | ;; |
| 49 | test-config) |
| 50 | echo_summary "Building backend test server" |
| 51 | build_backend_test_server |
Gregory Thiemonge | 54225ad | 2021-02-04 15:25:17 +0100 | [diff] [blame] | 52 | _configure_tempest |
Brian Haley | 4f97149 | 2020-02-17 16:40:33 -0500 | [diff] [blame] | 53 | ;; |
| 54 | esac |
| 55 | fi |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 56 | |
| 57 | if [[ $saveenv =~ e ]]; then |
| 58 | set -e |
| 59 | else |
| 60 | set +e |
| 61 | fi |