Merge "Unexpected update in setup script for functional test"

This commit is contained in:
Zuul 2020-07-22 14:24:28 +00:00 committed by Gerrit Code Review
commit 90f267ecea
4 changed files with 67 additions and 21 deletions

View File

@ -436,26 +436,11 @@ function tacker_register_default_vim {
sed -e "s|^auth_url:.*$|auth_url: \'${KEYSTONE_SERVICE_URI}\'|" -i $VIM_CONFIG_FILE
echo "The content of VIM config file $VIM_CONFIG_FILE :"
cat $VIM_CONFIG_FILE
DEFAULT_VIM_NAME="VIM0"
# TODO(tpatil): Remove installing python-tackerclient using pip once
# a solution is available to install it using requirements.
pip_install python-tackerclient
cat >> $TACKER_DIR/tools/test-setup-default-vim.sh <<EOF
openstack --os-username nfv_user --os-project-name nfv --os-password devstack --os-auth-url ${KEYSTONE_SERVICE_URI} --os-project-domain-name Default --os-user-domain-name Default vim register --is-default --description "Default VIM" --config-file $VIM_CONFIG_FILE $DEFAULT_VIM_NAME
EOF
echo "The content of $TACKER_DIR/tools/test-setup-default-vim.sh"
cat $TACKER_DIR/tools/test-setup-default-vim.sh
echo "Update tacker/tests/etc/samples/local-vim.yaml for functional testing"
functional_vim_file="$TACKER_DIR/tacker/tests/etc/samples/local-vim.yaml"
sed -e "s|^auth_url:.*$|auth_url: \'${KEYSTONE_SERVICE_URI}\'|" -i $functional_vim_file
echo "The content of functional VIM config file $functional_vim_file :"
cat $functional_vim_file
echo "Set up target openstack vim resources ..."
openstack --os-cloud=devstack-admin quota set \
--class --instances -1 --cores -1 --ram -1 default

View File

@ -1,14 +1,17 @@
- name: Copy files test setup default vim sh
copy:
remote_src=True
src=/opt/stack/tacker/tools/test-setup-default-vim.sh
src={{ devstack_base_dir }}/tacker/tools/test-setup-default-vim.sh
dest={{ zuul_work_dir }}/tools/test-setup-default-vim.sh
mode=0755
when: inventory_hostname == "controller"
- name: Copy test vim file
copy:
remote_src=True
src=/opt/stack/tacker/tacker/tests/etc/samples/local-vim.yaml
src={{ devstack_base_dir }}/tacker/tacker/tests/etc/samples/local-vim.yaml
dest={{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml
when: inventory_hostname == "controller"
- name: Check if project's tools/test-setup-default-vim.sh exists
stat:
@ -20,10 +23,46 @@
or it doesn't have execute permission.
when: p.stat.exists != True or p.stat.executable != True
- name: Get stackenv from devstack environment
slurp:
src: "{{ devstack_base_dir }}/devstack/.stackenv"
register: stackenv
- name: Set a keystone authentication uri
set_fact:
auth_uri: "{{
stackenv.content
| b64decode
| regex_replace('\n', ' ')
| regex_replace('^.*KEYSTONE_SERVICE_URI=([^ ]+).*$', '\\1')
}}"
when:
- p.stat.exists
- name: Replace the keystone authentication uri in the test-setup-default-vim.sh and local-vim.yaml
replace:
path: "{{ item }}"
regexp: "http://127.0.0.1/identity"
replace: "{{ auth_uri }}"
with_items:
- "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
- "{{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml"
when:
- inventory_hostname == 'controller'
- p.stat.exists
- name: Replace the config file path in the test-setup-default-vim.sh
replace:
path: "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
regexp: '(?<=config-file )([^ ]+)(?= )'
replace: "{{ ansible_env.HOME }}/{{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml"
when: inventory_hostname == 'controller'
- name: Run tools/test-setup-default-vim.sh
command: tools/test-setup-default-vim.sh
args:
chdir: "{{ zuul_work_dir }}"
when:
- inventory_hostname == 'controller'
- p.stat.exists
- p.stat.executable

View File

@ -1,17 +1,17 @@
- name: Print net information
shell: sudo bash -c "ip address > /opt/stack/ipaddress.txt"
shell: sudo bash -c "ip address > {{ devstack_base_dir }}//ipaddress.txt"
- name: Collect net information
fetch:
flat: yes
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/confs/devstack/ipaddress.txt"
src: "/opt/stack/ipaddress.txt"
src: "{{ devstack_base_dir }}//ipaddress.txt"
- name: print ovs information
shell: sudo bash -c "ovs-vsctl show > /opt/stack/ovsvsctl.txt"
shell: sudo bash -c "ovs-vsctl show > {{ devstack_base_dir }}//ovsvsctl.txt"
- name: Collect ovs information
fetch:
flat: yes
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/confs/devstack/ovsvsctl.txt"
src: "/opt/stack/ovsvsctl.txt"
src: "{{ devstack_base_dir }}//ovsvsctl.txt"

View File

@ -4,3 +4,25 @@
# 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
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 \
--is-default \
--description "Default VIM" \
--config-file /opt/stack/tacker/tacker/tests/etc/samples/local-vim.yaml \
VIM0