tacker/tools/test-setup-k8s-vim.sh
Shuwen Cai 2cbd84c56f Extend vim register function for helm in v2 API
In v2 API, when using vim with `ETSINFV.HELM.V_3` type, you must
set the `ssl_ca_cert` information. Currently, when registering vim
with kubernetes type and use_helm parameter, it will succeed even
if you don't set `ssl_ca_cert` information. This causes v2 APIs to
fail when you use the vimConnectionInfo stored in the database.

This patch added a check in register vim to fix this issue. If the
helm is used to register the vim of kubernetes type, the
`ssl_ca_cert` parameter will be checked. If it's not set, the
registration will fail.

At the same time, FT test items have been added to verify that
v2 API operations perform properly when using the `ETSINFV.HELM.V_3`
type vim that exists in the database.

Implements: blueprint helmchart-k8s-vim
Change-Id: I629e347413b242ab9e1a5db16c52ca222adc3873
2023-02-28 05:11:26 +00:00

48 lines
1.2 KiB
Bash
Executable File

#!/bin/bash -xe
# This script is used to set up default vim
# for functional testing, which cannot be put
# in devstack/plugin.sh because new zuul3 CI
# cannot keep the devstack plugins order
#
# Also, this script updates the following
# parameter which has been modified
# unintentionally by ansible playbook
# `roles/setup-default-vim/tasks/main.yaml`
# according to the execution environment of
# Zuul.
#
# --os-auth-url
# --config-file
conf_dir=/opt/stack/tacker/tacker/tests/etc/samples
register_vim() {
openstack vim register \
--os-username nfv_user \
--os-project-name nfv \
--os-password devstack \
--os-auth-url http://127.0.0.1/identity \
--os-project-domain-name Default \
--os-user-domain-name Default \
--description "Kubernetes VIM" \
--config-file $1 \
$2
}
# register vim with bearer token
register_vim $conf_dir/local-k8s-vim.yaml vim-kubernetes
# register vim with OpenID Connect info
if [ -f /tmp/keycloak.crt ]
then
register_vim $conf_dir/local-k8s-vim-oidc.yaml vim-kubernetes-oidc
fi
# register vim with extra used helm
if [ -f $conf_dir/local-k8s-vim-helm.yaml ]
then
register_vim $conf_dir/local-k8s-vim-helm.yaml vim-kubernetes-helm
fi