diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/utils/tacker-setup.sh | 34 | ||||
-rw-r--r-- | tests/utils/tacker/tacker.conf.sample | 315 | ||||
-rw-r--r-- | tests/vHello_Tacker.sh | 48 |
3 files changed, 363 insertions, 34 deletions
diff --git a/tests/utils/tacker-setup.sh b/tests/utils/tacker-setup.sh index b06a983..8970348 100644 --- a/tests/utils/tacker-setup.sh +++ b/tests/utils/tacker-setup.sh @@ -20,10 +20,11 @@ # Status: this is a work in progress, under test. # # How to use: -# $ bash tacker-setup.sh [init|setup|clean] -# init: Initialize docker container -# setup: Setup of Tacker in the docker container -# clean: Clean +# $ bash tacker-setup.sh [init|setup|clean] [branch] +# init: Initialize docker container +# setup: Setup of Tacker in the docker container +# clean: Clean +# branch: OpenStack branch to install (default: master) trap 'fail' ERR @@ -48,6 +49,7 @@ function setenv () { echo "$0: $(date) Setup shared virtual folders and save this script there" mkdir /tmp/tacker cp $0 /tmp/tacker/. + cp `dirname $0`/tacker/tacker.conf.sample /tmp/tacker/. chmod 755 /tmp/tacker/*.sh echo "$0: $(date) Setup admin-openrc.sh" @@ -60,8 +62,8 @@ function get_external_net () { [[ $(neutron net-show ${id}|grep 'router:external'|grep -i "true") != "" ]] && ext_net_id=${id} done if [[ $ext_net_id ]]; then - EXTERNAL_NETWORK_NAME=$(openstack network show $ext_net_id | awk "/ name / { print \$4 }") - EXTERNAL_SUBNET_ID=$(openstack network show $EXTERNAL_NETWORK_NAME | awk "/ subnets / { print \$4 }") + EXTERNAL_NETWORK_NAME=$(neutron net-show $ext_net_id | awk "/ name / { print \$4 }") + EXTERNAL_SUBNET_ID=$(neutron net-show $EXTERNAL_NETWORK_NAME | awk "/ subnets / { print \$4 }") else echo "$0: $(date) External network not found" exit 1 @@ -109,6 +111,7 @@ install_client () { } function setup () { + branch=$1 echo "$0: $(date) Installing Tacker" # STEP 2: Install Tacker in the container # Per http://docs.openstack.org/developer/tacker/install/manual_installation.html @@ -126,6 +129,8 @@ function setup () { apt-get install -y libssl-dev # newton: tacker uses ping for monitoring VIM (not in default docker containers) apt-get install -y inetutils-ping + # apt-utils is not installed in xenial container image + apt-get install -y apt-utils export MYSQL_PASSWORD=$(/usr/bin/apg -n 1 -m 16 -c cl_seed) echo $MYSQL_PASSWORD >~/mysql debconf-set-selections <<< 'mysql-server mysql-server/root_password password '$MYSQL_PASSWORD @@ -181,7 +186,7 @@ function setup () { if [[ -d /tmp/tacker/tacker ]]; then rm -rf /tmp/tacker/tacker; fi git clone git://git.openstack.org/openstack/tacker cd tacker - git checkout stable/newton + git checkout $branch echo "$0: $(date) Setup Tacker" pip install -r requirements.txt @@ -189,14 +194,15 @@ function setup () { python setup.py install mkdir /var/log/tacker - echo "$0: $(date) install tox" - pip install --upgrade tox - echo "$0: $(date) generate tacker.conf.sample" - tox -e config-gen +# "tox -e config-gen" is throwing errors, disabled - see tacker.conf.sample above +# echo "$0: $(date) install tox" +# pip install --upgrade tox +# echo "$0: $(date) generate tacker.conf.sample" +# tox -e config-gen echo "$0: $(date) Update tacker.conf values" mkdir /usr/local/etc/tacker - cp etc/tacker/tacker.conf.sample /usr/local/etc/tacker/tacker.conf + cp /tmp/tacker/tacker.conf.sample /usr/local/etc/tacker/tacker.conf # [DEFAULT] section (update) sed -i -- 's/#auth_strategy = keystone/auth_strategy = keystone/' /usr/local/etc/tacker/tacker.conf @@ -303,7 +309,7 @@ EOF if [[ -d /tmp/tacker/python-tackerclient ]]; then rm -rf /tmp/tacker/python-tackerclient; fi git clone https://github.com/openstack/python-tackerclient cd python-tackerclient - git checkout stable/newton + git checkout $branch python setup.py install # deferred until its determined how to get this to Horizon @@ -415,7 +421,7 @@ case "$1" in pass ;; "setup") - setup + setup $2 pass ;; "clean") diff --git a/tests/utils/tacker/tacker.conf.sample b/tests/utils/tacker/tacker.conf.sample new file mode 100644 index 0000000..a278fd2 --- /dev/null +++ b/tests/utils/tacker/tacker.conf.sample @@ -0,0 +1,315 @@ +[DEFAULT] + +# +# From tacker.common.config +# + +# The host IP to bind to (string value) +#bind_host = 0.0.0.0 + +# The port to bind to (integer value) +#bind_port = 9890 + +# The API paste config file to use (string value) +#api_paste_config = api-paste.ini + +# The path for API extensions (string value) +#api_extensions_path = + +# The service plugins Tacker will use (list value) +#service_plugins = nfvo,vnfm + +# The policy file to use (string value) +#policy_file = policy.json + +# The type of authentication to use (string value) +#auth_strategy = keystone + +# Allow the usage of the bulk API (boolean value) +#allow_bulk = true + +# Allow the usage of the pagination (boolean value) +#allow_pagination = false + +# Allow the usage of the sorting (boolean value) +#allow_sorting = false + +# The maximum number of items returned in a single response, value was +# 'infinite' or negative integer means no limit (string value) +#pagination_max_limit = -1 + +# The hostname Tacker is running on (string value) +#host = fa719b05f53c + +# URL for connection to nova (string value) +#nova_url = http://127.0.0.1:8774/v2 + +# Username for connecting to nova in admin context (string value) +#nova_admin_username = <None> + +# Password for connection to nova in admin context (string value) +#nova_admin_password = <None> + +# The uuid of the admin nova tenant (string value) +#nova_admin_tenant_id = <None> + +# Authorization URL for connecting to nova in admin context (string value) +#nova_admin_auth_url = http://localhost:5000/v2.0 + +# CA file for novaclient to verify server certificates (string value) +#nova_ca_certificates_file = <None> + +# If True, ignore any SSL validation issues (boolean value) +#nova_api_insecure = false + +# Name of nova region to use. Useful if keystone manages more than one region. +# (string value) +#nova_region_name = <None> + +# Where to store Tacker state files. This directory must be writable by the +# agent. (string value) +#state_path = /var/lib/tacker + +# +# From tacker.service +# + +# Seconds between running periodic tasks (integer value) +#periodic_interval = 40 + +# Number of separate worker processes for service (integer value) +#api_workers = 0 + +# Range of seconds to randomly delay when starting the periodic task scheduler +# to reduce stampeding. (Disable by setting to 0) (integer value) +#periodic_fuzzy_delay = 5 + +# +# From tacker.wsgi +# + +# Number of backlog requests to configure the socket with (integer value) +#backlog = 4096 + +# Sets the value of TCP_KEEPIDLE in seconds for each server socket. Not +# supported on OS X. (integer value) +#tcp_keepidle = 600 + +# Number of seconds to keep retrying to listen (integer value) +#retry_until_window = 30 + +# Max header line to accommodate large tokens (integer value) +#max_header_line = 16384 + +# Enable SSL on the API server (boolean value) +#use_ssl = false + +# CA certificate file to use to verify connecting clients (string value) +#ssl_ca_file = <None> + +# Certificate file to use when starting the server securely (string value) +#ssl_cert_file = <None> + +# Private key file to use when starting the server securely (string value) +#ssl_key_file = <None> + + +[alarm_auth] + +# +# From tacker.alarm_receiver +# + +# User name for alarm monitoring (string value) +#username = tacker + +# password for alarm monitoring (string value) +#password = nomoresecret + +# project name for alarm monitoring (string value) +#project_name = service + +# url for alarm monitoring (string value) +#url = http://localhost:35357/v3 + + +[ceilometer] + +# +# From tacker.vnfm.monitor_drivers.ceilometer.ceilometer +# + +# Address which drivers use to trigger (string value) +#host = fa719b05f53c + +# port number which drivers use to trigger (port value) +# Minimum value: 0 +# Maximum value: 65535 +#port = 9890 + + +[monitor] + +# +# From tacker.vnfm.monitor +# + +# check interval for monitor (integer value) +#check_intvl = 10 + + +[monitor_http_ping] + +# +# From tacker.vnfm.monitor_drivers.http_ping.http_ping +# + +# number of times to retry (integer value) +#retry = 5 + +# number of seconds to wait for a response (integer value) +#timeout = 1 + +# HTTP port number to send request (integer value) +#port = 80 + + +[monitor_ping] + +# +# From tacker.vnfm.monitor_drivers.ping.ping +# + +# number of ICMP packets to send (string value) +#count = 1 + +# number of seconds to wait for a response (string value) +#timeout = 1 + +# number of seconds to wait between packets (string value) +#interval = 1 + + +[nfvo_vim] + +# +# From tacker.nfvo.nfvo_plugin +# + +# VIM driver for launching VNFs (list value) +#vim_drivers = openstack + +# Interval to check for VIM health (integer value) +#monitor_interval = 30 + +# +# From tacker.vnfm.vim_client +# + +# DEPRECATED: Default VIM for launching VNFs. This option is deprecated and +# will be removed in Ocata release. (string value) +# This option is deprecated for removal. +# Its value may be silently ignored in the future. +#default_vim = <None> + + +[openstack_vim] + +# +# From tacker.vnfm.infra_drivers.openstack.openstack +# + +# Number of attempts to retry for stack creation/deletion (integer value) +#stack_retries = 60 + +# Wait time (in seconds) between consecutive stack create/delete retries +# (integer value) +#stack_retry_wait = 5 + +# Flavor Extra Specs (dict value) +#flavor_extra_specs = + + +[openwrt] + +# +# From tacker.vnfm.mgmt_drivers.openwrt.openwrt +# + +# user name to login openwrt (string value) +#user = root + +# password to login openwrt (string value) +#password = + + +[tacker] + +# +# From tacker.vnfm.monitor +# + +# Monitor driver to communicate with Hosting VNF/logical service instance +# tacker plugin will use (list value) +#monitor_driver = ping,http_ping + +# Alarm monitoring driver to communicate with Hosting VNF/logical service +# instance tacker plugin will use (list value) +#alarm_monitor_driver = ceilometer + +# +# From tacker.vnfm.plugin +# + +# MGMT driver to communicate with Hosting VNF/logical service instance tacker +# plugin will use (list value) +#mgmt_driver = noop,openwrt + +# Time interval to wait for VM to boot (integer value) +#boot_wait = 30 + +# Hosting vnf drivers tacker plugin will use (list value) +#infra_driver = nova,heat,noop,openstack + + +[tacker_heat] + +# +# From tacker.vnfm.infra_drivers.heat.heat +# + +# Number of attempts to retry for stack creation/deletion (integer value) +#stack_retries = 60 + +# Wait time (in seconds) between consecutive stack create/delete retries +# (integer value) +#stack_retry_wait = 5 + +# Flavor Extra Specs (dict value) +#flavor_extra_specs = + + +[vim_keys] + +# +# From tacker.nfvo.drivers.vim.openstack_driver +# + +# Dir.path to store fernet keys. (string value) +#openstack = /etc/tacker/vim/fernet_keys + + +[vim_monitor] + +# +# From tacker.nfvo.drivers.vim.openstack_driver +# + +# number of ICMP packets to send (string value) +#count = 1 + +# number of seconds to wait for a response (string value) +#timeout = 1 + +# number of seconds to wait between packets (string value) +#interval = 1 diff --git a/tests/vHello_Tacker.sh b/tests/vHello_Tacker.sh index b89eb9c..934f63c 100644 --- a/tests/vHello_Tacker.sh +++ b/tests/vHello_Tacker.sh @@ -39,7 +39,7 @@ # 1) models-joid-001 | models-apex-001 (installation of OPNFV system) # # Test Steps and Assertions: -# 1) bash vHello_Tacker.sh setup <openrc> +# 1) bash vHello_Tacker.sh setup <openrc> [branch] # models-tacker-001 (Tacker installation in a docker container on the jumphost) # models-nova-001 (Keypair creation) # 2) bash vHello_Tacker.sh start @@ -68,14 +68,16 @@ # How to use: # $ git clone https://gerrit.opnfv.org/gerrit/models # $ cd models/tests -# $ bash vHello_Tacker.sh [setup|start|run|stop|clean] [<openrc>] [<heat_host>] -# setup: setup test environment -# run: setup test environment and run test -# start: install blueprint and run test -# stop: stop test and uninstall blueprint -# clean: cleanup after test -# <openrc>: include for setup|run as location of OpenStack openrc file -# <heat_host>: include for setup|run as IP address of the Heat service +# $ bash vHello_Tacker.sh [setup|run] [<openrc>] [<heat_host>] [branch] +# setup: setup test environment +# <openrc>: location of OpenStack openrc file +# <heat_host>: IP address of the Heat service +# branch: OpenStack branch to install (default: master) +# $ bash vHello_Tacker.sh [start|stop|clean] +# run: setup test environment and run test +# start: install blueprint and run test +# stop: stop test and uninstall blueprint +# clean: cleanup after test trap 'fail' ERR @@ -110,7 +112,7 @@ get_floating_net () { [[ $(neutron net-show ${id}|grep 'router:external'|grep -i "true") != "" ]] && FLOATING_NETWORK_ID=${id} done if [[ $FLOATING_NETWORK_ID ]]; then - FLOATING_NETWORK_NAME=$(openstack network show $FLOATING_NETWORK_ID | awk "/ name / { print \$4 }") + FLOATING_NETWORK_NAME=$(neutron net-show $FLOATING_NETWORK_ID | awk "/ name / { print \$4 }") else echo "$0: $(date) Floating network not found" exit 1 @@ -161,11 +163,11 @@ setup () { fi echo "$0: $(date) Execute tacker-setup.sh in the container" - sudo docker exec -it tacker /bin/bash /tmp/tacker/tacker-setup.sh setup + sudo docker exec -it tacker /bin/bash /tmp/tacker/tacker-setup.sh setup $3 if [ $? -eq 1 ]; then fail; fi else echo "$0: $(date) Execute tacker-setup.sh in the container" - sudo docker exec -i -t tacker /bin/bash /tmp/tacker/tacker-setup.sh setup + sudo docker exec -i -t tacker /bin/bash /tmp/tacker/tacker-setup.sh setup $3 if [ $? -eq 1 ]; then fail; fi fi @@ -214,7 +216,7 @@ start() { while [[ -z $active ]] do active=$(tacker vnf-show hello-world-tacker | grep ACTIVE) - if [ "$(tacker vnf-show hello-world-tacker | grep -c ERROR)" > "0" ]; then + if [[ $(tacker vnf-show hello-world-tacker | grep -c ERROR) > 0 ]]; then echo "$0: $(date) hello-world-tacker VNF creation failed with state ERROR" fail fi @@ -235,16 +237,16 @@ start() { done echo "$0: $(date) directly assign security group (unsupported in Mitaka Tacker)" - if [[ $(openstack security group list | awk "/ vHello / { print \$2 }") ]]; then openstack security group vHello; fi - openstack security group create vHello - openstack security group rule create --ingress --protocol TCP --dst-port 22:22 vHello - openstack security group rule create --ingress --protocol TCP --dst-port 80:80 vHello + if [[ $(neutron security-group-list | awk "/ vHello / { print \$2 }") ]]; then neutron security-group-delete vHello; fi + neutron security-group-create vHello + neutron security-group-rule-create --direction ingress --protocol TCP --port-range-min 22 --port-range-max 22 vHello + neutron security-group-rule-create --direction ingress --protocol TCP --port-range-min 80 --port-range-max 80 vHello openstack server add security group $SERVER_ID vHello openstack server add security group $SERVER_ID default echo "$0: $(date) associate floating IP" get_floating_net - FIP=$(openstack floating ip create $FLOATING_NETWORK_NAME | awk "/floating_ip_address/ { print \$4 }") + FIP=$(nova floating-ip-create $FLOATING_NETWORK_NAME | awk "/public/ { print \$4 }") nova floating-ip-associate $SERVER_ID $FIP # End setup for workarounds @@ -257,6 +259,12 @@ start() { echo "$0: $(date) verify vHello server is running" apt-get install -y curl + count=12 + while [[ $(curl $SERVER_URL | grep -c "Hello World") == 0 ]] + do + sleep 10 + let count=$count-1 + done if [[ $(curl $SERVER_URL | grep -c "Hello World") == 0 ]]; then fail; fi assert "models-vhello-001 (vHello VNF creation)" true assert "models-tacker-003 (VNF creation)" true @@ -304,12 +312,12 @@ dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` case "$1" in setup) - setup $2 $3 + setup $2 $3 $4 if [ $? -eq 1 ]; then fail; fi pass ;; run) - setup $2 $3 + setup $2 $3 $4 forward_to_container start if [ $? -eq 1 ]; then fail; fi pass |