summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Sullivan <bryan.sullivan@att.com>2017-01-22 19:03:40 -0800
committerBryan Sullivan <bryan.sullivan@att.com>2017-01-23 08:31:54 -0800
commit0fa11c3ca480d11ca43f8accd94a2427742c7103 (patch)
treee82b02db4ca298e337cd7712a27a020540184f63
parent36d8a91bc1be3d2c5e7fccfd847110cedcd0a848 (diff)
Update for Danube/Newton, support Devstack testing.
JIRA: MODELS-23 tacker-setup.sh: Update comments and usage. Remove OPNFV-specific env setup, add openrc and Heat host params. Add OSC setup from github branch. Install ping in tacker container. Setup tacker as mysql user vs root. Move tacker user cleanup to setup() function. Update git branch to Newton. Uncomment tox generation of tacker.conf.sample. Update tacker.conf for newton. Address tacker bug (?) in vim-config.yaml. Add more vim-config.yaml fields found to be needed in testing. Update tacker commands for changes to "--name" parameter. Move tacker container cleanup to vHello_Tacker.sh. vHello_Tacker.sh: Update comments and usage. Update admin-openrc.sh setup. Update calls to tacker-setup.sh for new params. Add TODOs for things. Improve test for JuJu command use. Fix bugs in assertion tests. Add devstack local.conf to utils/devstack Change-Id: I31fdb6be8f198cc245c259378922650bae095496 Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
-rw-r--r--tests/utils/devstack/local.conf102
-rw-r--r--tests/utils/tacker-setup.sh238
-rw-r--r--tests/vHello_Tacker.sh118
3 files changed, 317 insertions, 141 deletions
diff --git a/tests/utils/devstack/local.conf b/tests/utils/devstack/local.conf
new file mode 100644
index 0000000..2b29ca8
--- /dev/null
+++ b/tests/utils/devstack/local.conf
@@ -0,0 +1,102 @@
+[[local|localrc]]
+# Use eth1 for stacking (host-only network)
+HOST_IP_IFACE=ens3
+
+# While ``stack.sh`` is happy to run without ``localrc``, devlife is better when
+# there are a few minimal variables set:
+
+# If the ``*_PASSWORD`` variables are not set here you will be prompted to enter
+# values for them by ``stack.sh``and they will be added to ``local.conf``.
+ADMIN_PASSWORD=opnfv
+DATABASE_PASSWORD=opnfvdb
+RABBIT_PASSWORD=hopper
+SERVICE_PASSWORD=$ADMIN_PASSWORD
+
+# ``HOST_IP`` and ``HOST_IPV6`` should be set manually for best results if
+# the NIC configuration of the host is unusual, i.e. ``eth1`` has the default
+# route but ``eth0`` is the public interface. They are auto-detected in
+# ``stack.sh`` but often is indeterminate on later runs due to the IP moving
+# from an Ethernet interface to a bridge on the host. Setting it here also
+# makes it available for ``openrc`` to include when setting ``OS_AUTH_URL``.
+# Neither is set by default.
+#HOST_IP=w.x.y.z
+#HOST_IPV6=2001:db8::7
+
+# By default stack.sh only installs Python packages if no version is currently
+# installed or the current version does not match a specified requirement.
+# If PIP_UPGRADE is set to True then existing required Python packages will
+# be upgraded to the most recent version that matches requirements.
+PIP_UGRADE=True
+
+# Logging
+# -------
+
+# By default ``stack.sh`` output only goes to the terminal where it runs. It can
+# be configured to additionally log to a file by setting ``LOGFILE`` to the full
+# path of the destination log file. A timestamp will be appended to the given name.
+LOGFILE=$DEST/logs/stack.sh.log
+
+# Old log files are automatically removed after 7 days to keep things neat. Change
+# the number of days by setting ``LOGDAYS``.
+LOGDAYS=2
+
+# Nova logs will be colorized if ``SYSLOG`` is not set; turn this off by setting
+# ``LOG_COLOR`` false.
+#LOG_COLOR=False
+
+
+# Using milestone-proposed branches
+# ---------------------------------
+
+# Uncomment these to grab the milestone-proposed branches from the
+# repos:
+#CINDER_BRANCH=milestone-proposed
+#GLANCE_BRANCH=milestone-proposed
+#HORIZON_BRANCH=milestone-proposed
+#KEYSTONE_BRANCH=milestone-proposed
+#KEYSTONECLIENT_BRANCH=milestone-proposed
+#NOVA_BRANCH=milestone-proposed
+#NOVACLIENT_BRANCH=milestone-proposed
+#NEUTRON_BRANCH=milestone-proposed
+#SWIFT_BRANCH=milestone-proposed
+
+# Using git versions of clients
+# -----------------------------
+# By default clients are installed from pip. See LIBS_FROM_GIT in
+# stackrc for details on getting clients from specific branches or
+# revisions. e.g.
+# LIBS_FROM_GIT="python-ironicclient"
+# IRONICCLIENT_BRANCH=refs/changes/44/2.../1
+
+# Disable Identity API v2
+# The Identity API v2 is deprecated as of Mitaka and it is recommended to only use the v3 API.
+# It is possible to setup keystone without v2 API, by doing:
+#ENABLE_IDENTITY_V2=False -- this is causing an issue with Congress
+
+# Turn on Neutron
+disable_service n-net
+enable_service neutron
+enable_service q-svc q-agt q-dhcp q-l3 q-meta
+Q_ML2_PLUGIN_EXT_DRIVERS=port_security
+
+# Turn on Swift (Object Store) without replication
+enable_service s-proxy s-object s-container s-account
+SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
+SWIFT_REPLICAS=1
+SWIFT_DATA_DIR=$DEST/data/swift
+
+# Since Newton release, Heat is available as a devstack plugin
+enable_plugin heat https://git.openstack.org/openstack/heat stable/newton
+# Download and register a VM image that Heat can launch
+IMAGE_URL_SITE="https://cloud-images.ubuntu.com"
+IMAGE_URL_PATH="/xenial/current/"
+IMAGE_URL_FILE="xenial-server-cloudimg-amd64-disk1.img"
+IMAGE_URLS+=","$IMAGE_URL_SITE$IMAGE_URL_PATH$IMAGE_URL_FILE
+
+#Enable Tacker
+#enable_plugin tacker https://git.openstack.org/openstack/tacker stable/newton
+
+# Enable Congress
+enable_plugin congress http://git.openstack.org/openstack/congress stable/newton
+enable_plugin ceilometer http://git.openstack.org/openstack/ceilometer stable/newton
+
diff --git a/tests/utils/tacker-setup.sh b/tests/utils/tacker-setup.sh
index 4935d93..da9e4a1 100644
--- a/tests/utils/tacker-setup.sh
+++ b/tests/utils/tacker-setup.sh
@@ -14,14 +14,13 @@
# limitations under the License.
#
# What this is: Setup script for the OpenStack Tacker VNF Manager starting from
-# an Unbuntu Xenial docker container.
+# an Unbuntu Xenial docker container. This script is intended to be in an
+# OPNFV environment, or an plain OpenStack environment (e.g. Devstack).
#
# Status: this is a work in progress, under test.
#
# How to use:
-# $ bash tacker-setup.sh [tacker-cli|tacker-api] [init|setup|clean]
-# tacker-cli: use Tacker CLI
-# tacker-api: use Tacker RESTful API
+# $ bash tacker-setup.sh [init|setup|clean]
# init: Initialize docker container
# setup: Setup of Tacker in the docker container
# clean: Clean
@@ -52,54 +51,7 @@ function setenv () {
chmod 755 /tmp/tacker/*.sh
echo "$0: $(date) Setup admin-openrc.sh"
-
- if [ "$dist" == "Ubuntu" ]; then
- echo "$0: $(date) Ubuntu-based install"
- echo "$0: $(date) Create the environment file"
- KEYSTONE_HOST=$(juju status --format=short | awk "/keystone\/0/ { print \$3 }")
- cat <<EOF >/tmp/tacker/admin-openrc.sh
-export CONGRESS_HOST=$(juju status --format=short | awk "/openstack-dashboard/ { print \$3 }")
-export HORIZON_HOST=$(juju status --format=short | awk "/openstack-dashboard/ { print \$3 }")
-export KEYSTONE_HOST=$KEYSTONE_HOST
-export CEILOMETER_HOST=$(juju status --format=short | awk "/ceilometer\/0/ { print \$3 }")
-export CINDER_HOST=$(juju status --format=short | awk "/cinder\/0/ { print \$3 }")
-export GLANCE_HOST=$(juju status --format=short | awk "/glance\/0/ { print \$3 }")
-export NEUTRON_HOST=$(juju status --format=short | awk "/neutron-api\/0/ { print \$3 }")
-export NOVA_HOST=$(juju status --format=short | awk "/nova-cloud-controller\/0/ { print \$3 }")
-export HEAT_HOST=$(juju status --format=short | awk "/heat\/0/ { print \$3 }")
-export OS_USERNAME=admin
-export OS_PASSWORD=openstack
-export OS_TENANT_NAME=admin
-export OS_AUTH_URL=http://$KEYSTONE_HOST:5000/v2.0
-export OS_REGION_NAME=RegionOne
-EOF
- else
- # Centos
- echo "$0: $(date) Centos-based install"
- echo "$0: $(date) Setup undercloud environment so we can get overcloud Controller server address"
- source ~/stackrc
- echo "$0: $(date) Get address of Controller node"
- export CONTROLLER_HOST1=$(openstack server list | awk "/overcloud-controller-0/ { print \$8 }" | sed 's/ctlplane=//g')
- echo "$0: $(date) Create the environment file"
- cat <<EOF >/tmp/tacker/admin-openrc.sh
-export CONGRESS_HOST=$CONTROLLER_HOST1
-export KEYSTONE_HOST=$CONTROLLER_HOST1
-export CEILOMETER_HOST=$CONTROLLER_HOST1
-export CINDER_HOST=$CONTROLLER_HOST1
-export GLANCE_HOST=$CONTROLLER_HOST1
-export NEUTRON_HOST=$CONTROLLER_HOST1
-export NOVA_HOST=$CONTROLLER_HOST1
-export HEAT_HOST=$CONTROLLER_HOST1
-EOF
- cat ~/overcloudrc >>/tmp/tacker/admin-openrc.sh
- source ~/overcloudrc
- export OS_REGION_NAME=$(openstack endpoint list | awk "/ nova / { print \$4 }")
- # sed command below is a workaound for a bug - region shows up twice for some reason
- cat <<EOF | sed '$d' >>/tmp/tacker/admin-openrc.sh
-export OS_REGION_NAME=$OS_REGION_NAME
-EOF
- fi
-source /tmp/tacker/admin-openrc.sh
+ source /tmp/tacker/admin-openrc.sh
}
function get_external_net () {
@@ -145,6 +97,17 @@ EOF
fi
}
+
+install_client () {
+ echo "$0: $(date) Install $1"
+ git clone https://github.com/openstack/$1.git
+ cd $1
+ if [ $# -eq 2 ]; then git checkout $2; fi
+ pip install -r requirements.txt
+ pip install .
+ cd ..
+}
+
function setup () {
echo "$0: $(date) Installing Tacker"
# STEP 2: Install Tacker in the container
@@ -161,6 +124,8 @@ function setup () {
apt-get install -y apg
apt-get install -y libffi-dev
apt-get install -y libssl-dev
+ # newton: tacker uses ping for monitoring VIM (not in default docker containers)
+ apt-get install -y inetutils-ping
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
@@ -172,17 +137,28 @@ function setup () {
cd /tmp/tacker
echo "$0: $(date) create Tacker database"
- mysql --user=root --password=$MYSQL_PASSWORD -e "CREATE DATABASE tacker; GRANT ALL PRIVILEGES ON tacker.* TO 'root@localhost' IDENTIFIED BY '"$MYSQL_PASSWORD"'; GRANT ALL PRIVILEGES ON tacker.* TO 'root'@'%' IDENTIFIED BY '"$MYSQL_PASSWORD"';"
+ mysql --user=root --password=$MYSQL_PASSWORD -e "CREATE DATABASE tacker; GRANT ALL PRIVILEGES ON tacker.* TO 'root@localhost' IDENTIFIED BY '"$MYSQL_PASSWORD"'; GRANT ALL PRIVILEGES ON tacker.* TO 'tacker'@'%' IDENTIFIED BY '"$MYSQL_PASSWORD"';"
echo "$0: $(date) Upgrage pip again - needs to be the latest version due to errors found in earlier testing"
pip install --upgrade pip
- echo "$0: $(date) install python-openstackclient python-glanceclient"
- pip install --upgrade python-openstackclient python-glanceclient python-neutronclient keystonemiddleware
+ echo "$0: $(date) Install OpenStack clients"
+ install_client python-openstackclient $branch
+ install_client python-neutronclient $branch
+
+# pip install --upgrade python-openstackclient python-glanceclient python-neutronclient keystonemiddleware
echo "$0: $(date) Setup admin-openrc.sh"
source /tmp/tacker/admin-openrc.sh
+ uid=$(openstack user list | awk "/ tacker / { print \$2 }")
+ if [[ $uid ]]; then
+ echo "$0: $(date) Remove prior Tacker user etc"
+ openstack user delete tacker
+ openstack service delete tacker
+ # Note: deleting the service deletes the endpoint
+ fi
+
echo "$0: $(date) Setup Tacker user in OpenStack"
service_project=$(openstack project list | awk "/service/ { print \$4 }")
openstack user create --project $service_project --password tacker tacker
@@ -205,7 +181,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/mitaka
+ git checkout stable/newton
echo "$0: $(date) Setup Tacker"
pip install -r requirements.txt
@@ -213,34 +189,109 @@ function setup () {
python setup.py install
mkdir /var/log/tacker
- # Following lines apply to master and not stable/mitaka
- #echo "$0: $(date) install tox"
- #pip install tox
- #echo "$0: $(date) generate tacker.conf.sample"
- #tox -e config-gen
+ 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 /usr/local/etc/tacker/tacker.conf
- sed -i -- 's/# auth_strategy = keystone/auth_strategy = keystone/' /usr/local/etc/tacker/tacker.conf
- sed -i -- 's/# debug = False/debug = True/' /usr/local/etc/tacker/tacker.conf
- sed -i -- 's/# use_syslog = False/use_syslog = False/' /usr/local/etc/tacker/tacker.conf
- sed -i -- 's~# state_path = /var/lib/tacker~state_path = /var/lib/tacker~' /usr/local/etc/tacker/tacker.conf
- sed -i -- "s/project_name = service/project_name = $service_project/g" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s/password = service-password/password = tacker/" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s/username = tacker/username = tacker/" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s~auth_url = http://127.0.0.1:35357~auth_url = http://$KEYSTONE_HOST:35357~" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s~identity_uri = http://127.0.0.1:5000~# identity_uri = http://127.0.0.1:5000~" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s~auth_uri = http://127.0.0.1:5000~auth_uri = http://$KEYSTONE_HOST:5000~" /usr/local/etc/tacker/tacker.conf
- # Not sure what the effect of the next line is, given that we are running as root
+ cp etc/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
+ # [DEFAULT] section (add to)
+ sed -i -- "/\[DEFAULT\]/adebug = True" /usr/local/etc/tacker/tacker.conf
+ sed -i -- "/\[DEFAULT\]/ause_syslog = False" /usr/local/etc/tacker/tacker.conf
+ sed -i -- "/\[DEFAULT\]/alogging_context_format_string = %(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s" /usr/local/etc/tacker/tacker.conf
+ sed -i -- 's~#policy_file = policy.json~policy_file = /usr/local/etc/tacker/policy.json~' /usr/local/etc/tacker/tacker.conf
+ sed -i -- 's~#state_path = /var/lib/tacker~state_path = /var/lib/tacker~' /usr/local/etc/tacker/tacker.conf
+
+ # Not sure what the effect of the next line is, given that we are running as root in the container
#sed -i -- "s~# root_helper = sudo~root_helper = sudo /usr/local/bin/tacker-rootwrap /usr/local/etc/tacker/rootwrap.conf~" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s~# connection = mysql://root:pass@127.0.0.1:3306/tacker~connection = mysql://root:$MYSQL_PASSWORD@localhost:3306/tacker?charset=utf8~" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s~heat_uri = http://localhost:8004/v1~heat_uri = http://$HEAT_HOST:8004/v1~" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s~# api_paste_config = api-paste.ini~api_paste_config = /tmp/tacker/tacker/etc/tacker/api-paste.ini~" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s/# bind_host = 0.0.0.0/bind_host = $ip/" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s/# bind_port = 8888/bind_port = 9890/" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s/stack_retries = 60/stack_retries = 10/" /usr/local/etc/tacker/tacker.conf
- sed -i -- "s/stack_retry_wait = 5/stack_retry_wait = 60/" /usr/local/etc/tacker/tacker.conf
+ sed -i -- "s~#api_paste_config = api-paste.ini~api_paste_config = /tmp/tacker/tacker/etc/tacker/api-paste.ini~" /usr/local/etc/tacker/tacker.conf
+ sed -i -- "s/#bind_host = 0.0.0.0/bind_host = $ip/" /usr/local/etc/tacker/tacker.conf
+ sed -i -- "s/#bind_port = 8888/bind_port = 9890/" /usr/local/etc/tacker/tacker.conf
+
+# Newton changes, based upon sample newton gate test conf file provided by sridhar_ram on #tacker
+ region=$(openstack endpoint list | awk "/ nova / { print \$4 }")
+ sed -i -- "s/#nova_region_name = <None>/#nova_region_name = $region/" /usr/local/etc/tacker/tacker.conf
+ sed -i -- "s/#nova_api_insecure = false/nova_api_insecure = False/" /usr/local/etc/tacker/tacker.conf
+ sed -i -- "s/#nova_ca_certificates_file = <None>/nova_ca_certificates_file =/" /usr/local/etc/tacker/tacker.conf
+ keystone_adminurl=$(openstack endpoint show keystone | awk "/ adminurl / { print \$4 }")
+ sed -i -- "s~#nova_admin_auth_url = http://localhost:5000/v2.0~nova_admin_auth_url = $keystone_adminurl~" /usr/local/etc/tacker/tacker.conf
+ # TODO: don't hard-code service tenant ID
+ sed -i -- "s/#nova_admin_tenant_id = <None>/nova_admin_tenant_id = service/" /usr/local/etc/tacker/tacker.conf
+ sed -i -- "s/#nova_admin_password = <None>/nova_admin_password = $OS_PASSWORD/" /usr/local/etc/tacker/tacker.conf
+ # this diff seems superfluous < nova_admin_user_name = nova
+ # only one ref in tacker (setting the default value)
+ # devstack/lib/tacker: iniset $TACKER_CONF DEFAULT nova_admin_user_name nova
+ # set nova_url to "/v2" (normal value is "/v2.1") due to tacker API version compatibility (?)
+ nova_ipport=$(openstack endpoint show nova | awk "/ adminurl / { print \$4 }" | awk -F'[/]' '{print $3}')
+ sed -i -- "s~#nova_url = http://127.0.0.1:8774/v2~nova_url = http://$nova_ipport/v2~" /usr/local/etc/tacker/tacker.conf
+ mkdir /var/lib/tacker
+ sed -i -- "s~#state_path = /var/lib/tacker~state_path = /var/lib/tacker~" /usr/local/etc/tacker/tacker.conf
+
+ # [alarm_auth] section - optional (?)
+ # < url = http://15.184.66.78:35357/v3
+ # < project_name = service
+ # < password = secretservice
+ # < uername = tacker
+
+ # [nfvo_vim] section
+ sed -i -- "s/#default_vim = <None>/default_vim = VIM0/" /usr/local/etc/tacker/tacker.conf
+
+ # [openstack_vim] section
+ sed -i -- "s/#stack_retries = 60/stack_retries = 10/" /usr/local/etc/tacker/tacker.conf
+ sed -i -- "s/#stack_retry_wait = 5/stack_retry_wait = 60/" /usr/local/etc/tacker/tacker.conf
+
+ # newton: add [keystone_authtoken] missing in generated tacker.conf.sample, excluding the following
+ # (not referenced) memcached_servers = 15.184.66.78:11211
+ # (not referenced) signing_dir = /var/cache/tacker
+ # (not referenced) cafile = /opt/stack/data/ca-bundle.pem
+ # (not referenced) auth_uri = http://15.184.66.78/identity
+ cat >>/usr/local/etc/tacker/tacker.conf <<EOF
+[keystone_authtoken]
+auth_url = $(openstack endpoint show keystone | awk "/ internalurl / { print \$4 }")
+project_domain_name = Default
+project_name = $service_project
+user_domain_name = Default
+password = tacker
+username = tacker
+auth_type = password
+EOF
+
+ # these diffs seem superfluous - not referenced at all:
+ # < transport_url = rabbit://stackrabbit:secretrabbit@15.184.66.78:5672/
+ # < heat_uri = http://15.184.66.78:8004/v1
+
+ # newton: add [tacker_heat] missing in generated tacker.conf.sample
+ cat >>/usr/local/etc/tacker/tacker.conf <<EOF
+[tacker_heat]
+stack_retry_wait = 10
+stack_retries = 60
+heat_uri = http://$HEAT_HOST:8004/v1
+EOF
+
+ # newton: add [database] missing in generated tacker.conf.sample
+ cat >>/usr/local/etc/tacker/tacker.conf <<EOF
+[database]
+connection = mysql://tacker:$MYSQL_PASSWORD@localhost:3306/tacker?charset=utf8
+EOF
+
+ # newton: add [tacker_nova] missing in generated tacker.conf.sample, excluding the following
+ # these diffs seem superfluous - the only ref'd field is region_name:
+ # project_domain_id = default
+ # project_name = service
+ # user_domain_id = default
+ # password = secretservice
+ # username = nova
+ # auth_url = http://15.184.66.78/identity_v2_admin
+ # auth_plugin = password
+ cat >>/usr/local/etc/tacker/tacker.conf <<EOF
+[tacker_nova]
+region_name = $region
+EOF
echo "$0: $(date) Populate Tacker database"
/usr/local/bin/tacker-db-manage --config-file /usr/local/etc/tacker/tacker.conf upgrade head
@@ -250,7 +301,7 @@ function setup () {
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/mitaka
+ git checkout stable/newton
python setup.py install
# deferred until its determined how to get this to Horizon
@@ -271,14 +322,22 @@ function setup () {
echo "$0: $(date) Register default VIM"
cd /tmp/tacker
+ # TODO: bug in https://github.com/openstack/python-tackerclient/blob/stable/newton/tackerclient/common/utils.py
+ # expects that there will be a port specified in the auth_url
+ # TODO: bug: user_domain_name: Default is required even for identity v2
cat <<EOF >vim-config.yaml
-auth_url: $OS_AUTH_URL
+auth_url: http://$KEYSTONE_HOST:5000/identity/v2.0
username: $OS_USERNAME
password: $OS_PASSWORD
project_name: admin
+project_domain_name: Default
+user_domain_name: Default
+user_id: $(openstack user list | awk "/ admin / { print \$2 }")
EOF
- tacker vim-register --config-file vim-config.yaml --description OpenStack --name VIM0
+ # newton: NAME (was "--name") is now a positional parameter
+ tacker vim-register --config-file vim-config.yaml --description OpenStack VIM0
+ if [ $? -eq 1 ]; then fail; fi
setup_test_environment
}
@@ -343,22 +402,13 @@ function clean () {
pid=($(neutron router-port-list vnf_private_router|grep -v name|awk '{print $2}')); for id in ${pid[@]}; do neutron router-interface-delete vnf_private_router vnf_private; done
neutron router-delete vnf_private_router
neutron net-delete vnf_private
- sudo docker stop $(sudo docker ps -a | awk "/tacker/ { print \$1 }")
- sudo docker rm -v $(sudo docker ps -a | awk "/tacker/ { print \$1 }")
}
start=`date +%s`
dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'`
-case "$2" in
+case "$1" in
"init")
setenv
- uid=$(openstack user list | awk "/ tacker / { print \$2 }")
- if [[ $uid ]]; then
- echo "$0: $(date) Remove prior Tacker user etc"
- openstack user delete tacker
- openstack service delete tacker
- # Note: deleting the service deletes the endpoint
- fi
create_container
pass
;;
@@ -371,7 +421,7 @@ case "$2" in
pass
;;
*)
- echo "usage: bash tacker-setup.sh [tacker-cli|tacker-api] [init|setup|clean]"
+ echo "usage: bash tacker-setup.sh [init|setup|clean]"
echo "init: Initialize docker container"
echo "setup: Setup of Tacker in the docker container"
echo "clean: remove Tacker service"
diff --git a/tests/vHello_Tacker.sh b/tests/vHello_Tacker.sh
index 669ee3b..b89eb9c 100644
--- a/tests/vHello_Tacker.sh
+++ b/tests/vHello_Tacker.sh
@@ -24,24 +24,36 @@
# Mitaka.
#
# Pre-State:
-# models-joid-001 | models-apex-001 (installation of OPNFV system)
+# This test can be run in either an OPNFV environment, or an plain OpenStack
+# environment (e.g. Devstack).
+# For Devstack running in a VM on the host, you must first enable the host to
+# access the VMs running under Devstack:
+# 1) In devstack VM:
+# $ sudo iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
+# Sub the primary interface of your devstack VM for ens3, as needed.
+# 2) On the host (e.g linux):
+# $ sudo route add -net 172.24.0.0/16 gw 192.168.122.112
+# Sub your devstack Public network subnet for 172.24.0.0/16, and
+# your devstack VM IP address on the host for 192.168.122.112
+# For OPNFV-based tests, pre-requisites are
+# 1) models-joid-001 | models-apex-001 (installation of OPNFV system)
#
# Test Steps and Assertions:
-# 1) bash vHello_Tacker.sh tacker-cli setup|start|run|stop|clean]
+# 1) bash vHello_Tacker.sh setup <openrc>
# models-tacker-001 (Tacker installation in a docker container on the jumphost)
# models-nova-001 (Keypair creation)
-# 2) bash vHello_Tacker.sh tacker-cli start
+# 2) bash vHello_Tacker.sh start
# models-tacker-002 (VNFD creation)
# models-tacker-003 (VNF creation)
# models-tacker-vnfd-001 (config_drive creation)
# models-tacker-vnfd-002 (artifacts creation)
# models-tacker-vnfd-003 (user_data creation)
# models-vhello-001 (vHello VNF creation)
-# 3) bash vHello_Tacker.sh tacker-cli stop
+# 3) bash vHello_Tacker.sh stop
# models-tacker-004 (VNF deletion)
# models-tacker-005 (VNFD deletion)
# models-tacker-vnfd-004 (artifacts deletion)
-# 4) bash vHello_Tacker.sh tacker-cli clean
+# 4) bash vHello_Tacker.sh clean
# TODO: add assertions
#
# Post-State:
@@ -51,19 +63,19 @@
# After step 3, the VNF is deleted and the system returned to step 1 post-state.
# After step 4, the system returned to test pre-state.
#
-# Cleanup: bash vHello_Tacker.sh tacker-cli clean
+# Cleanup: bash vHello_Tacker.sh clean
#
# How to use:
# $ git clone https://gerrit.opnfv.org/gerrit/models
# $ cd models/tests
-# $ bash vHello_Tacker.sh [tacker-cli|tacker-api] [setup|start|run|stop|clean]
-# tacker-cli: use Tacker CLI
-# tacker-api: use Tacker RESTful API (not yet implemented)
+# $ bash vHello_Tacker.sh [setup|start|run|stop|clean] [<openrc>] [<heat_host>]
# setup: setup test environment
-# start: install blueprint and run test
# 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
trap 'fail' ERR
@@ -123,23 +135,38 @@ setup () {
mkdir -p /tmp/tacker
chmod 777 /tmp/tacker/
cp $0 /tmp/tacker/.
+ cp $1 /tmp/tacker/admin-openrc.sh
+ source /tmp/tacker/admin-openrc.sh
+ echo "export HEAT_HOST=$2" >>/tmp/tacker/admin-openrc.sh
+ echo "export KEYSTONE_HOST=$(echo $OS_AUTH_URL | awk -F'[/]' '{print $3}')" >>/tmp/tacker/admin-openrc.sh
chmod 755 /tmp/tacker/*.sh
echo "$0: $(date) tacker-setup part 1"
- bash utils/tacker-setup.sh $1 init
+ bash utils/tacker-setup.sh init
+ if [ $? -eq 1 ]; then fail; fi
echo "$0: $(date) tacker-setup part 2"
- CONTAINER=$(sudo docker ps -l | awk "/tacker/ { print \$1 }")
+# TODO: find a generic way to set extension_drivers = port_security in ml2_conf.ini
+ # On the neutron service host, update ml2_conf.ini and and restart neutron service
+ # sed -i -- 's~#extension_drivers =~extension_drivers = port_security~' /etc/neutron/plugins/ml2/ml2_conf.ini
+ # For devstack, set in local.conf per http://docs.openstack.org/developer/devstack/guides/neutron.html
+ # Q_ML2_PLUGIN_EXT_DRIVERS=port_security
+
dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'`
if [ "$dist" == "Ubuntu" ]; then
- echo "$0: $(date) JOID workaround for Colorado - enable ML2 port security"
- juju set neutron-api enable-ml2-port-security=true
+ dpkg -l juju
+ if [[ $? -eq 0 ]]; then
+ echo "$0: $(date) JOID workaround for Colorado - enable ML2 port security"
+ juju set neutron-api enable-ml2-port-security=true
+ fi
echo "$0: $(date) Execute tacker-setup.sh in the container"
- sudo docker exec -it $CONTAINER /bin/bash /tmp/tacker/tacker-setup.sh $1 setup
+ sudo docker exec -it tacker /bin/bash /tmp/tacker/tacker-setup.sh setup
+ if [ $? -eq 1 ]; then fail; fi
else
echo "$0: $(date) Execute tacker-setup.sh in the container"
- sudo docker exec -i -t $CONTAINER /bin/bash /tmp/tacker/tacker-setup.sh $1 setup
+ sudo docker exec -i -t tacker /bin/bash /tmp/tacker/tacker-setup.sh setup
+ if [ $? -eq 1 ]; then fail; fi
fi
assert "models-tacker-001 (Tacker installation in a docker container on the jumphost)" true
@@ -150,7 +177,9 @@ setup () {
echo "$0: $(date) copy tosca-vnfd-hello-world-tacker to blueprints folder"
cp -r blueprints/tosca-vnfd-hello-world-tacker /tmp/tacker/blueprints
+}
+start() {
echo "$0: $(date) setup OpenStack CLI environment"
source /tmp/tacker/admin-openrc.sh
@@ -164,22 +193,20 @@ setup () {
echo "$0: $(date) Inject public key into blueprint"
pubkey=$(cat /tmp/tacker/vHello.pub)
sed -i -- "s~<pubkey>~$pubkey~" /tmp/tacker/blueprints/tosca-vnfd-hello-world-tacker/blueprint.yaml
-}
-
-start() {
- echo "$0: $(date) setup OpenStack CLI environment"
- source /tmp/tacker/admin-openrc.sh
echo "$0: $(date) Get external network for Floating IP allocations"
+ get_floating_net
echo "$0: $(date) create VNFD"
cd /tmp/tacker/blueprints/tosca-vnfd-hello-world-tacker
- tacker vnfd-create --vnfd-file blueprint.yaml --name hello-world-tacker
+ # newton: NAME (was "--name") is now a positional parameter
+ tacker vnfd-create --vnfd-file blueprint.yaml hello-world-tacker
if [ $? -eq 1 ]; then fail; fi
assert "models-tacker-002 (VNFD creation)" true
echo "$0: $(date) create VNF"
- tacker vnf-create --vnfd-name hello-world-tacker --name hello-world-tacker
+ # newton: NAME (was "--name") is now a positional parameter
+ tacker vnf-create --vnfd-name hello-world-tacker hello-world-tacker
if [ $? -eq 1 ]; then fail; fi
echo "$0: $(date) wait for hello-world-tacker to go ACTIVE"
@@ -187,7 +214,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)" == "1" ]; 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
@@ -248,13 +275,15 @@ stop() {
echo "$0: $(date) uninstall vHello blueprint via CLI"
vid=($(tacker vnf-list|grep hello-world-tacker|awk '{print $2}')); for id in ${vid[@]}; do tacker vnf-delete ${id}; done
- assert "models-tacker-004 (VNF deletion)" [[ -z "$(tacker vnf-list|grep hello-world-tacker|awk '{print $2}'))" ]]
+ assert "models-tacker-004 (VNF deletion)" [[ -z "$(tacker vnf-list|grep hello-world-tacker|awk '{print $2}')" ]]
+
+ vid=($(tacker vnfd-list|grep hello-world-tacker|awk '{print $2}')); for id in ${vid[@]}; do try 10 10 "tacker vnfd-delete ${id}"; done
+ assert "models-tacker-005 (VNFD deletion)" [[ -z "$(tacker vnfd-list|grep hello-world-tacker|awk '{print $2}')" ]]
- vid=($(tacker vnfd-list|grep hello-world-tacker|awk '{print $2}')); for id in ${vid[@]}; do tacker vnfd-delete ${id}; done
- assert "models-tacker-005 (VNFD deletion)" [[ -z "$(tacker vnfd-list|grep hello-world-tacker|awk '{print $2}'))" ]]
+ for id in ${sg[@]}; do try 5 5 "openstack security group delete ${id}"; done
iid=($(openstack image list|grep VNFImage|awk '{print $2}')); for id in ${iid[@]}; do openstack image delete ${id}; done
- assert "models-tacker-vnfd-004 (artifacts deletion)" [[ -z "$(openstack image list|grep VNFImage|awk '{print $2}'))" ]]
+ assert "models-tacker-vnfd-004 (artifacts deletion)" [[ -z "$(openstack image list|grep VNFImage|awk '{print $2}')" ]]
# Cleanup for workarounds
fip=($(neutron floatingip-list|grep -v "+"|grep -v id|awk '{print $2}')); for id in ${fip[@]}; do neutron floatingip-delete ${id}; done
@@ -264,52 +293,47 @@ stop() {
}
forward_to_container () {
- echo "$0: $(date) pass $2 command to vHello.sh in tacker container"
+ echo "$0: $(date) pass $1 command to vHello.sh in tacker container"
CONTAINER=$(sudo docker ps -a | awk "/tacker/ { print \$1 }")
- sudo docker exec $CONTAINER /bin/bash /tmp/tacker/vHello_Tacker.sh $1 $2 $2
+ sudo docker exec $CONTAINER /bin/bash /tmp/tacker/vHello_Tacker.sh $1
if [ $? -eq 1 ]; then fail; fi
}
test_start=`date +%s`
dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'`
-if [[ "$1" == "tacker-api" ]]; then
- echo "$0: $(date) Tacker API use is not yet implemented"
- fail
-fi
-
-case "$2" in
+case "$1" in
setup)
- setup $1
+ setup $2 $3
if [ $? -eq 1 ]; then fail; fi
pass
;;
run)
- setup $1
- forward_to_container $1 start
+ setup $2 $3
+ forward_to_container start
if [ $? -eq 1 ]; then fail; fi
pass
;;
start|stop)
- if [[ $# -eq 2 ]]; then forward_to_container $1 $2
+ if [[ -f /.dockerenv ]]; then
+ $1
else
- # running inside the tacker container, ready to go
- $2 $1
+ forward_to_container $1
fi
if [ $? -eq 1 ]; then fail; fi
pass
;;
clean)
- forward_to_container stop $2
echo "$0: $(date) Uninstall Tacker and test environment"
- bash utils/tacker-setup.sh $1 clean
+ forward_to_container stop
+ sudo docker exec -it tacker /bin/bash /tmp/tacker/tacker-setup.sh clean
+ sudo docker stop tacker
+ sudo docker rm -v tacker
if [ $? -eq 1 ]; then fail; fi
pass
;;
*)
- echo "usage: bash vHello_Tacker.sh [tacker-cli|tacker-api] [setup|start|run|clean]"
- echo "tacker-cli: use Tacker CLI"
- echo "tacker-api: use Tacker RESTful API (not yet implemented)"
+ echo "usage: bash vHello_Tacker.sh [setup|start|run|stop|clean]"
echo "setup: setup test environment"
echo "start: install blueprint and run test"
echo "run: setup test environment and run test"