From 535aba79a91f8c9351e6bbe799ed1829cb270866 Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Date: Wed, 7 Nov 2018 18:16:32 +0100 Subject: [PATCH] Add NFV orchestration services CI job Change-Id: I33484d0961f1cd17ed05dd124eba68d99b4db83f --- tests/deploy.sh | 10 ++++ tests/run.yml | 8 +++ tests/templates/globals-default.j2 | 9 ++++ tests/test-openstack.sh | 10 ---- tests/test-scenario-nfv.sh | 78 ++++++++++++++++++++++++++++++ tools/setup_gate.sh | 4 ++ zuul.d/jobs.yaml | 11 +++++ zuul.d/project.yaml | 4 ++ 8 files changed, 124 insertions(+), 10 deletions(-) create mode 100755 tests/test-scenario-nfv.sh diff --git a/tests/deploy.sh b/tests/deploy.sh index c06ef46534..91e4a5f960 100755 --- a/tests/deploy.sh +++ b/tests/deploy.sh @@ -22,6 +22,16 @@ function deploy { tools/kolla-ansible -i ${RAW_INVENTORY} -vvv deploy > /tmp/logs/ansible/deploy tools/kolla-ansible -i ${RAW_INVENTORY} -vvv post-deploy > /tmp/logs/ansible/post-deploy tools/kolla-ansible -i ${RAW_INVENTORY} -vvv check > /tmp/logs/ansible/check-deploy + . /etc/kolla/admin-openrc.sh + # Wait for service ready + sleep 15 + + if ! openstack image show cirros >/dev/null 2>&1; then + echo "Initialising OpenStack resources via init-runonce" + tools/init-runonce + else + echo "Not running init-runonce - resources exist" + fi } diff --git a/tests/run.yml b/tests/run.yml index 04554b16eb..18c7574e19 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -174,6 +174,14 @@ chdir: "{{ kolla_ansible_src_dir }}" environment: ACTION: "{{ scenario }}" + when: scenario not in ['scenario_nfv'] + + - name: Run test-scenario-nfv.sh script + shell: + cmd: tests/test-scenario-nfv.sh + executable: /bin/bash + chdir: "{{ kolla_ansible_src_dir }}" + when: scenario == "scenario_nfv" - name: Run reconfigure.sh script shell: diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2 index bb4392c497..d041df23b7 100644 --- a/tests/templates/globals-default.j2 +++ b/tests/templates/globals-default.j2 @@ -42,3 +42,12 @@ enable_kuryr: "yes" enable_etcd: "yes" docker_custom_option: " -H unix:///var/run/docker.sock -H tcp://{{ api_interface_address }}:2375 --cluster-store=etcd://{{ api_interface_address }}:2379 --cluster-advertise={{ api_interface_address }}:2375" {% endif %} + +{% if scenario == "scenario_nfv" %} +glance_api_hosts: ["{{ inventory_hostname }}"] +enable_tacker: "yes" +enable_neutron_sfc: "yes" +enable_mistral: "yes" +enable_redis: "yes" +enable_barbican: "yes" +{% endif %} diff --git a/tests/test-openstack.sh b/tests/test-openstack.sh index d7337822a5..dbaddadada 100755 --- a/tests/test-openstack.sh +++ b/tests/test-openstack.sh @@ -8,21 +8,11 @@ export PYTHONUNBUFFERED=1 function test_openstack_logged { - # Wait for service ready - sleep 15 - . /etc/kolla/admin-openrc.sh openstack --debug compute service list openstack --debug network agent list - if ! openstack image show cirros >/dev/null 2>&1; then - echo "Initialising OpenStack resources via init-runonce" - tools/init-runonce - else - echo "Not running init-runonce - resources exist" - fi - echo "TESTING: Server creation" openstack server create --wait --image cirros --flavor m1.tiny --key-name mykey --network demo-net kolla_boot_test openstack --debug server list diff --git a/tests/test-scenario-nfv.sh b/tests/test-scenario-nfv.sh new file mode 100755 index 0000000000..5fe01340be --- /dev/null +++ b/tests/test-scenario-nfv.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +set -o xtrace +set -o errexit + +# Enable unbuffered output for Ansible in Jenkins. +export PYTHONUNBUFFERED=1 + + +function test_tacker { + echo "TESTING: Tacker VIM,VNFD and VNF creation" + sh contrib/demos/tacker/deploy-tacker-demo + openstack vim list + openstack vnf list + openstack vnf descriptor list + + while [[ $(openstack vnf show kolla-sample-vnf -f value -c status) != "ACTIVE" ]]; do + echo "VNF not running yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 10 ]]; then + echo "VNF failed to start" + openstack vnf show kolla-sample-vnf + return 1 + fi + sleep 10 + done +} + +function test_barbican { + echo "TESTING: Barbican" + openstack secret list +} + +function test_mistral { + echo "TESTING: Mistral" + openstack workflow list + openstack workflow execution list + openstack action execution list +} + +function test_nova { + echo "TESTING: Nova" + openstack server list +} + +function test_heat { + echo "TESTING: Heat" + openstack stack list +} + +function install_requirements { + echo "TESTING: Install requirements" + sudo -H pip install --ignore-installed -U "python-tackerclient" "python-heatclient" "networking-sfc" "python-mistralclient" "python-barbicanclient" +} + +function test_scenario_nfv_logged { + . /etc/kolla/admin-openrc.sh + install_requirements + test_tacker + test_barbican + test_mistral + test_nova + test_heat +} + +function test_scenario_nfv { + echo "Testing Scenario NFV" + test_scenario_nfv_logged > /tmp/logs/ansible/test-scenario-nfv 2>&1 + result=$? + if [[ $result != 0 ]]; then + echo "Testing Scenario NFV failed. See ansible/test-scenario-nfv for details" + else + echo "Successfully Scenario NFV. See ansible/test-scenario-nfv for details" + fi + return $result +} + +test_scenario_nfv diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh index 922a72109d..971d1f76eb 100755 --- a/tools/setup_gate.sh +++ b/tools/setup_gate.sh @@ -48,6 +48,10 @@ EOF GATE_IMAGES+=",zun,kuryr,etcd" fi + if [[ $ACTION == "scenario_nfv" ]]; then + GATE_IMAGES+=",tacker,mistral,redis,barbican" + fi + cat <