From 9f585b8d5eb8bffcb2040ef97ec8300c1af10d1f Mon Sep 17 00:00:00 2001 From: Fatih Degirmenci Date: Wed, 24 Jan 2018 16:08:57 +0100 Subject: xci: Integrate functest This change integrates functest in most easiest and messy way to get it up and running to bring functest into CI. The reason for this is that there are strange failures during functest healthcheck and it is important to look into those rather than beautifying how functest is integrated at this phase. Change-Id: I42e993be4aa15da022fa1e0069338447780f177e Signed-off-by: Fatih Degirmenci --- xci/playbooks/prepare-tests.yml | 19 ------------- .../roles/prepare-functest/defaults/main.yml | 14 ---------- .../roles/prepare-functest/tasks/main.yml | 32 ---------------------- .../roles/prepare-functest/templates/env.j2 | 4 --- .../templates/prepare-functest.sh.j2 | 12 -------- xci/playbooks/roles/run-functest/defaults/main.yml | 14 ++++++++++ xci/playbooks/roles/run-functest/tasks/main.yml | 32 ++++++++++++++++++++++ xci/playbooks/roles/run-functest/templates/env.j2 | 4 +++ .../run-functest/templates/run-functest.sh.j2 | 19 +++++++++++++ xci/playbooks/run-functest.yml | 20 ++++++++++++++ 10 files changed, 89 insertions(+), 81 deletions(-) delete mode 100644 xci/playbooks/prepare-tests.yml delete mode 100644 xci/playbooks/roles/prepare-functest/defaults/main.yml delete mode 100644 xci/playbooks/roles/prepare-functest/tasks/main.yml delete mode 100644 xci/playbooks/roles/prepare-functest/templates/env.j2 delete mode 100644 xci/playbooks/roles/prepare-functest/templates/prepare-functest.sh.j2 create mode 100644 xci/playbooks/roles/run-functest/defaults/main.yml create mode 100644 xci/playbooks/roles/run-functest/tasks/main.yml create mode 100644 xci/playbooks/roles/run-functest/templates/env.j2 create mode 100644 xci/playbooks/roles/run-functest/templates/run-functest.sh.j2 create mode 100644 xci/playbooks/run-functest.yml (limited to 'xci/playbooks') diff --git a/xci/playbooks/prepare-tests.yml b/xci/playbooks/prepare-tests.yml deleted file mode 100644 index ee30094d..00000000 --- a/xci/playbooks/prepare-tests.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -# Copyright 2017, SUSE LINUX GmbH. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -- name: Setup functest installing required packages and create the public network - hosts: opnfv - roles: - - role: "prepare-functest" diff --git a/xci/playbooks/roles/prepare-functest/defaults/main.yml b/xci/playbooks/roles/prepare-functest/defaults/main.yml deleted file mode 100644 index a3638302..00000000 --- a/xci/playbooks/roles/prepare-functest/defaults/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# Gateway parameters -gateway_ip: "10.10.10.1" -gateway_ip_mask: "10.10.10.1/24" -broadcast_ip: "10.10.10.255" -gateway_interface: "br-vlan" - -# Network parameters -external_network: "ext-net" - -# Subnet parameters -subnet_name: "ext-subnet" -allocation_pool: "start=10.10.10.5,end=10.10.10.254" -subnet_cidr: "10.10.10.0/24" diff --git a/xci/playbooks/roles/prepare-functest/tasks/main.yml b/xci/playbooks/roles/prepare-functest/tasks/main.yml deleted file mode 100644 index 9a380cd1..00000000 --- a/xci/playbooks/roles/prepare-functest/tasks/main.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -# SPDX-license-identifier: Apache-2.0 -############################################################################## -# Copyright (c) 2017 SUSE Linux GmbH -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -- name: check if the gateway was already set - shell: "ip a | grep {{ gateway_ip }}" - register: gateway_ip_result - ignore_errors: True - -- name: add public network gateway - command: "ip addr add {{ gateway_ip_mask }} brd {{ broadcast_ip }} dev {{ gateway_interface }}" - when: gateway_ip_result|failed - -- name: prepare script to create networks for functest - template: - src: prepare-functest.sh.j2 - dest: /root/prepare-functest.sh - mode: 0755 - -- name: Create networks - shell: "/root/prepare-functest.sh" - -- name: prepare environment file for functest - template: - src: env.j2 - dest: /root/env - mode: 0755 diff --git a/xci/playbooks/roles/prepare-functest/templates/env.j2 b/xci/playbooks/roles/prepare-functest/templates/env.j2 deleted file mode 100644 index 87093325..00000000 --- a/xci/playbooks/roles/prepare-functest/templates/env.j2 +++ /dev/null @@ -1,4 +0,0 @@ -INSTALLER_TYPE=osa -INSTALLER_IP=192.168.122.2 -EXTERNAL_NETWORK={{ external_network }} -DEPLOY_SCENARIO="os-nosdn-nofeature-noha" diff --git a/xci/playbooks/roles/prepare-functest/templates/prepare-functest.sh.j2 b/xci/playbooks/roles/prepare-functest/templates/prepare-functest.sh.j2 deleted file mode 100644 index febe8369..00000000 --- a/xci/playbooks/roles/prepare-functest/templates/prepare-functest.sh.j2 +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -source /root/openrc - -openstack --insecure network create --external \ - --provider-physical-network flat \ - --provider-network-type flat {{ external_network }} - -openstack --insecure subnet create --network {{ external_network }} \ - --allocation-pool {{ allocation_pool }} \ - --subnet-range {{ subnet_cidr }} --gateway {{ gateway_ip }} \ - --no-dhcp {{ subnet_name }} diff --git a/xci/playbooks/roles/run-functest/defaults/main.yml b/xci/playbooks/roles/run-functest/defaults/main.yml new file mode 100644 index 00000000..a3638302 --- /dev/null +++ b/xci/playbooks/roles/run-functest/defaults/main.yml @@ -0,0 +1,14 @@ +--- +# Gateway parameters +gateway_ip: "10.10.10.1" +gateway_ip_mask: "10.10.10.1/24" +broadcast_ip: "10.10.10.255" +gateway_interface: "br-vlan" + +# Network parameters +external_network: "ext-net" + +# Subnet parameters +subnet_name: "ext-subnet" +allocation_pool: "start=10.10.10.5,end=10.10.10.254" +subnet_cidr: "10.10.10.0/24" diff --git a/xci/playbooks/roles/run-functest/tasks/main.yml b/xci/playbooks/roles/run-functest/tasks/main.yml new file mode 100644 index 00000000..8ca2b7ba --- /dev/null +++ b/xci/playbooks/roles/run-functest/tasks/main.yml @@ -0,0 +1,32 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2017 SUSE Linux GmbH +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +- name: check if the gateway was already set + shell: "ip a | grep {{ gateway_ip }}" + register: gateway_ip_result + ignore_errors: True + +- name: add public network gateway + command: "ip addr add {{ gateway_ip_mask }} brd {{ broadcast_ip }} dev {{ gateway_interface }}" + when: gateway_ip_result|failed + +- name: prepare environment file for functest + template: + src: env.j2 + dest: /root/env + mode: 0755 + +- name: prepare the script to create networks and run functest + template: + src: run-functest.sh.j2 + dest: /root/run-functest.sh + mode: 0755 + +- name: execute the script + shell: "/root/run-functest.sh" diff --git a/xci/playbooks/roles/run-functest/templates/env.j2 b/xci/playbooks/roles/run-functest/templates/env.j2 new file mode 100644 index 00000000..87093325 --- /dev/null +++ b/xci/playbooks/roles/run-functest/templates/env.j2 @@ -0,0 +1,4 @@ +INSTALLER_TYPE=osa +INSTALLER_IP=192.168.122.2 +EXTERNAL_NETWORK={{ external_network }} +DEPLOY_SCENARIO="os-nosdn-nofeature-noha" diff --git a/xci/playbooks/roles/run-functest/templates/run-functest.sh.j2 b/xci/playbooks/roles/run-functest/templates/run-functest.sh.j2 new file mode 100644 index 00000000..071dbca4 --- /dev/null +++ b/xci/playbooks/roles/run-functest/templates/run-functest.sh.j2 @@ -0,0 +1,19 @@ +#!/bin/bash + +source /root/openrc + +openstack --insecure network create --external \ + --provider-physical-network flat \ + --provider-network-type flat {{ external_network }} + +openstack --insecure subnet create --network {{ external_network }} \ + --allocation-pool {{ allocation_pool }} \ + --subnet-range {{ subnet_cidr }} --gateway {{ gateway_ip }} \ + --no-dhcp {{ subnet_name }} + +mkdir ~/images && cd ~/images && wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img && cd ~ + +sudo docker run --env-file env \ + -v $(pwd)/openrc:/home/opnfv/functest/conf/openstack.creds \ + -v $(pwd)/images:/home/opnfv/functest/images \ + opnfv/functest-healthcheck diff --git a/xci/playbooks/run-functest.yml b/xci/playbooks/run-functest.yml new file mode 100644 index 00000000..8b3b29a1 --- /dev/null +++ b/xci/playbooks/run-functest.yml @@ -0,0 +1,20 @@ +--- +# Copyright 2017, SUSE LINUX GmbH. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Prepare the environment for functest and run tests + hosts: opnfv + user: root + roles: + - role: "run-functest" -- cgit 1.2.3-korg