summaryrefslogtreecommitdiffstats
path: root/xci/playbooks/roles/run-functest
diff options
context:
space:
mode:
Diffstat (limited to 'xci/playbooks/roles/run-functest')
-rw-r--r--xci/playbooks/roles/run-functest/defaults/main.yml14
-rw-r--r--xci/playbooks/roles/run-functest/tasks/main.yml39
-rw-r--r--xci/playbooks/roles/run-functest/templates/env.j24
-rw-r--r--xci/playbooks/roles/run-functest/templates/run-functest.sh.j219
4 files changed, 76 insertions, 0 deletions
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..3dc8e0bb
--- /dev/null
+++ b/xci/playbooks/roles/run-functest/tasks/main.yml
@@ -0,0 +1,39 @@
+---
+# 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: install required packages
+ package:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - wget
+
+- 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