From 68d29b6f6e71df6b4f177cd417f98d9e977f8893 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Tue, 17 May 2016 21:36:56 +0200 Subject: Change 'testcases' directory structure JIRA: FUNCTEST-226 - Remove all 'CI' subdirs - Remove VIM dir and have OpenStack dir within /testcases/ - Split rally and tempest in 2 different dirs Change-Id: Icfc76d18a84f7a18d93ae1a5ec7dc7a560bb7ce9 Signed-off-by: jose.lausuch --- .../CI/custom_tests/neutron/010__networks.robot | 56 ------- .../ODL/CI/custom_tests/neutron/020__subnets.robot | 56 ------- .../ODL/CI/custom_tests/neutron/030__ports.robot | 56 ------- .../CI/custom_tests/neutron/040__delete_ports.txt | 37 ----- .../custom_tests/neutron/050__delete_subnets.txt | 37 ----- .../custom_tests/neutron/060__delete_networks.txt | 37 ----- testcases/Controllers/ODL/CI/odlreport2db.py | 165 --------------------- testcases/Controllers/ODL/CI/start_tests.sh | 97 ------------ testcases/Controllers/ODL/CI/test_list.txt | 5 - 9 files changed, 546 deletions(-) delete mode 100644 testcases/Controllers/ODL/CI/custom_tests/neutron/010__networks.robot delete mode 100644 testcases/Controllers/ODL/CI/custom_tests/neutron/020__subnets.robot delete mode 100644 testcases/Controllers/ODL/CI/custom_tests/neutron/030__ports.robot delete mode 100644 testcases/Controllers/ODL/CI/custom_tests/neutron/040__delete_ports.txt delete mode 100644 testcases/Controllers/ODL/CI/custom_tests/neutron/050__delete_subnets.txt delete mode 100644 testcases/Controllers/ODL/CI/custom_tests/neutron/060__delete_networks.txt delete mode 100644 testcases/Controllers/ODL/CI/odlreport2db.py delete mode 100755 testcases/Controllers/ODL/CI/start_tests.sh delete mode 100644 testcases/Controllers/ODL/CI/test_list.txt (limited to 'testcases/Controllers/ODL/CI') diff --git a/testcases/Controllers/ODL/CI/custom_tests/neutron/010__networks.robot b/testcases/Controllers/ODL/CI/custom_tests/neutron/010__networks.robot deleted file mode 100644 index 583a6a153..000000000 --- a/testcases/Controllers/ODL/CI/custom_tests/neutron/010__networks.robot +++ /dev/null @@ -1,56 +0,0 @@ -*** Settings *** -Documentation Checking Network created in OpenStack are pushed to OpenDaylight -Suite Setup Create Session OSSession http://${NEUTRON}:9696 headers=${X-AUTH} -Suite Teardown Delete All Sessions -Library SSHLibrary -Library Collections -Library OperatingSystem -Library RequestsLibrary -Library ../../../libraries/Common.py -Variables ../../../variables/Variables.py - -*** Variables *** -${ODLREST} /controller/nb/v2/neutron/networks -${OSREST} /v2.0/networks -${postNet} {"network":{"name":"odl_network","admin_state_up":true}} - -*** Test Cases *** -Check OpenStack Networks - [Documentation] Checking OpenStack Neutron for known networks - [Tags] Network Neutron OpenStack - Log ${X-AUTH} - ${resp} get OSSession ${OSREST} - Should be Equal As Strings ${resp.status_code} 200 - ${OSResult} To Json ${resp.content} - Set Suite Variable ${OSResult} - Log ${OSResult} - -Check OpenDaylight Networks - [Documentation] Checking OpenDaylight Neutron API for Known Networks - [Tags] Network Neutron OpenDaylight - Create Session ODLSession http://${CONTROLLER}:${PORT} headers=${HEADERS} auth=${AUTH} - ${resp} get ODLSession ${ODLREST} - Should be Equal As Strings ${resp.status_code} 200 - ${ODLResult} To Json ${resp.content} - Set Suite Variable ${ODLResult} - Log ${ODLResult} - -Create Network - [Documentation] Create new network in OpenStack - [Tags] Create Network OpenStack Neutron - Log ${postNet} - ${resp} post OSSession ${OSREST} data=${postNet} - Should be Equal As Strings ${resp.status_code} 201 - ${result} To JSON ${resp.content} - ${result} Get From Dictionary ${result} network - ${NETID} Get From Dictionary ${result} id - Log ${result} - Log ${NETID} - Set Global Variable ${NETID} - sleep 2 - -Check Network - [Documentation] Check Network created in OpenDaylight - [Tags] Check Network OpenDaylight - ${resp} get ODLSession ${ODLREST}/${NetID} - Should be Equal As Strings ${resp.status_code} 200 diff --git a/testcases/Controllers/ODL/CI/custom_tests/neutron/020__subnets.robot b/testcases/Controllers/ODL/CI/custom_tests/neutron/020__subnets.robot deleted file mode 100644 index 5f5b82440..000000000 --- a/testcases/Controllers/ODL/CI/custom_tests/neutron/020__subnets.robot +++ /dev/null @@ -1,56 +0,0 @@ -*** Settings *** -Documentation Checking Subnets created in OpenStack are pushed to OpenDaylight -Suite Setup Create Session OSSession http://${NEUTRON}:9696 headers=${X-AUTH} -Suite Teardown Delete All Sessions -Library SSHLibrary -Library Collections -Library OperatingSystem -Library RequestsLibrary -Library ../../../libraries/Common.py -Variables ../../../variables/Variables.py - -*** Variables *** -${ODLREST} /controller/nb/v2/neutron/subnets -${OSREST} /v2.0/subnets -${data} {"subnet":{"network_id":"${NETID}","ip_version":4,"cidr":"172.16.64.0/24","allocation_pools":[{"start":"172.16.64.20","end":"172.16.64.120"}]}} - -*** Test Cases *** -Check OpenStack Subnets - [Documentation] Checking OpenStack Neutron for known Subnets - [Tags] Subnets Neutron OpenStack - Log ${X-AUTH} - ${resp} get OSSession ${OSREST} - Should be Equal As Strings ${resp.status_code} 200 - ${OSResult} To Json ${resp.content} - Set Suite Variable ${OSResult} - Log ${OSResult} - -Check OpenDaylight subnets - [Documentation] Checking OpenDaylight Neutron API for Known Subnets - [Tags] Subnets Neutron OpenDaylight - Create Session ODLSession http://${CONTROLLER}:${PORT} headers=${HEADERS} auth=${AUTH} - ${resp} get ODLSession ${ODLREST} - Should be Equal As Strings ${resp.status_code} 200 - ${ODLResult} To Json ${resp.content} - Set Suite Variable ${ODLResult} - Log ${ODLResult} - -Create New subnet - [Documentation] Create new subnet in OpenStack - [Tags] Create Subnet OpenStack Neutron - Log ${data} - ${resp} post OSSession ${OSREST} data=${data} - Should be Equal As Strings ${resp.status_code} 201 - ${result} To JSON ${resp.content} - ${result} Get From Dictionary ${result} subnet - ${SUBNETID} Get From Dictionary ${result} id - Log ${result} - Log ${SUBNETID} - Set Global Variable ${SUBNETID} - sleep 2 - -Check New subnet - [Documentation] Check new subnet created in OpenDaylight - [Tags] Check subnet OpenDaylight - ${resp} get ODLSession ${ODLREST}/${SUBNETID} - Should be Equal As Strings ${resp.status_code} 200 diff --git a/testcases/Controllers/ODL/CI/custom_tests/neutron/030__ports.robot b/testcases/Controllers/ODL/CI/custom_tests/neutron/030__ports.robot deleted file mode 100644 index 8b75733b7..000000000 --- a/testcases/Controllers/ODL/CI/custom_tests/neutron/030__ports.robot +++ /dev/null @@ -1,56 +0,0 @@ -*** Settings *** -Documentation Checking Port created in OpenStack are pushed to OpenDaylight -Suite Setup Create Session OSSession http://${NEUTRON}:9696 headers=${X-AUTH} -Suite Teardown Delete All Sessions -Library SSHLibrary -Library Collections -Library OperatingSystem -Library RequestsLibrary -Library ../../../libraries/Common.py -Variables ../../../variables/Variables.py - -*** Variables *** -${ODLREST} /controller/nb/v2/neutron/ports -${OSREST} /v2.0/ports -${data} {"port":{"network_id":"${NETID}","admin_state_up": true}} - -*** Test Cases *** -Check OpenStack ports - [Documentation] Checking OpenStack Neutron for known ports - [Tags] Ports Neutron OpenStack - Log ${X-AUTH} - ${resp} get OSSession ${OSREST} - Should be Equal As Strings ${resp.status_code} 200 - ${OSResult} To Json ${resp.content} - Set Suite Variable ${OSResult} - Log ${OSResult} - -Check OpenDaylight ports - [Documentation] Checking OpenDaylight Neutron API for Known Ports - [Tags] Ports Neutron OpenDaylight - Create Session ODLSession http://${CONTROLLER}:${PORT} headers=${HEADERS} auth=${AUTH} - ${resp} get ODLSession ${ODLREST} - Should be Equal As Strings ${resp.status_code} 200 - ${ODLResult} To Json ${resp.content} - Set Suite Variable ${ODLResult} - Log ${ODLResult} - -Create New Port - [Documentation] Create new port in OpenStack - [Tags] Create port OpenStack Neutron - Log ${data} - ${resp} post OSSession ${OSREST} data=${data} - Should be Equal As Strings ${resp.status_code} 201 - ${result} To JSON ${resp.content} - ${result} Get From Dictionary ${result} port - ${PORTID} Get From Dictionary ${result} id - Log ${result} - Log ${PORTID} - Set Global Variable ${PORTID} - sleep 2 - -Check New Port - [Documentation] Check new subnet created in OpenDaylight - [Tags] Check subnet OpenDaylight - ${resp} get ODLSession ${ODLREST}/${PORTID} - Should be Equal As Strings ${resp.status_code} 200 diff --git a/testcases/Controllers/ODL/CI/custom_tests/neutron/040__delete_ports.txt b/testcases/Controllers/ODL/CI/custom_tests/neutron/040__delete_ports.txt deleted file mode 100644 index f10298839..000000000 --- a/testcases/Controllers/ODL/CI/custom_tests/neutron/040__delete_ports.txt +++ /dev/null @@ -1,37 +0,0 @@ -*** Settings *** -Documentation Checking Port deleted in OpenStack are deleted also in OpenDaylight -Suite Setup Create Session OSSession http://${NEUTRON}:9696 headers=${X-AUTH} -Suite Teardown Delete All Sessions -Library SSHLibrary -Library Collections -Library OperatingSystem -Library ../../../libraries/RequestsLibrary.py -Library ../../../libraries/Common.py -Variables ../../../variables/Variables.py - -*** Variables *** -${ODLREST} /controller/nb/v2/neutron/ports -${OSREST} /v2.0/ports/${PORTID} -${data} {"port":{"network_id":"${NETID}","admin_state_up": true}} - -*** Test Cases *** -Delete New Port - [Documentation] Delete previously created port in OpenStack - [Tags] Delete port OpenStack Neutron - Log ${data} - ${resp} delete OSSession ${OSREST} - Should be Equal As Strings ${resp.status_code} 204 - Log ${resp.content} - sleep 2 - -Check Port Deleted - [Documentation] Check port deleted in OpenDaylight - [Tags] Check port deleted OpenDaylight - Create Session ODLSession http://${CONTROLLER}:${PORT} headers=${HEADERS} auth=${AUTH} - ${resp} get ODLSession ${ODLREST} - Should be Equal As Strings ${resp.status_code} 200 - ${ODLResult} To Json ${resp.content} - Set Suite Variable ${ODLResult} - Log ${ODLResult} - ${resp} get ODLSession ${ODLREST}/${PORTID} - Should be Equal As Strings ${resp.status_code} 404 diff --git a/testcases/Controllers/ODL/CI/custom_tests/neutron/050__delete_subnets.txt b/testcases/Controllers/ODL/CI/custom_tests/neutron/050__delete_subnets.txt deleted file mode 100644 index fb619825b..000000000 --- a/testcases/Controllers/ODL/CI/custom_tests/neutron/050__delete_subnets.txt +++ /dev/null @@ -1,37 +0,0 @@ -*** Settings *** -Documentation Checking Subnets deleted in OpenStack are deleted also in OpenDaylight -Suite Setup Create Session OSSession http://${NEUTRON}:9696 headers=${X-AUTH} -Suite Teardown Delete All Sessions -Library SSHLibrary -Library Collections -Library OperatingSystem -Library ../../../libraries/RequestsLibrary.py -Library ../../../libraries/Common.py -Variables ../../../variables/Variables.py - -*** Variables *** -${ODLREST} /controller/nb/v2/neutron/subnets -${OSREST} /v2.0/subnets/${SUBNETID} -${data} {"subnet":{"network_id":"${NETID}","ip_version":4,"cidr":"172.16.64.0/24","allocation_pools":[{"start":"172.16.64.20","end":"172.16.64.120"}]}} - -*** Test Cases *** -Delete New subnet - [Documentation] Delete previously created subnet in OpenStack - [Tags] Delete Subnet OpenStack Neutron - Log ${data} - ${resp} delete OSSession ${OSREST} - Should be Equal As Strings ${resp.status_code} 204 - Log ${resp.content} - sleep 2 - -Check New subnet deleted - [Documentation] Check subnet deleted in OpenDaylight - [Tags] Check subnet deleted OpenDaylight - Create Session ODLSession http://${CONTROLLER}:${PORT} headers=${HEADERS} auth=${AUTH} - ${resp} get ODLSession ${ODLREST} - Should be Equal As Strings ${resp.status_code} 200 - ${ODLResult} To Json ${resp.content} - Set Suite Variable ${ODLResult} - Log ${ODLResult} - ${resp} get ODLSession ${ODLREST}/${SUBNETID} - Should be Equal As Strings ${resp.status_code} 404 diff --git a/testcases/Controllers/ODL/CI/custom_tests/neutron/060__delete_networks.txt b/testcases/Controllers/ODL/CI/custom_tests/neutron/060__delete_networks.txt deleted file mode 100644 index 528fbfca2..000000000 --- a/testcases/Controllers/ODL/CI/custom_tests/neutron/060__delete_networks.txt +++ /dev/null @@ -1,37 +0,0 @@ -*** Settings *** -Documentation Checking Network deleted in OpenStack are deleted also in OpenDaylight -Suite Setup Create Session OSSession http://${NEUTRON}:9696 headers=${X-AUTH} -Suite Teardown Delete All Sessions -Library SSHLibrary -Library Collections -Library OperatingSystem -Library ../../../libraries/RequestsLibrary.py -Library ../../../libraries/Common.py -Variables ../../../variables/Variables.py - -*** Variables *** -${ODLREST} /controller/nb/v2/neutron/networks -${OSREST} /v2.0/networks/${NETID} -${postNet} {"network":{"name":"odl_network","admin_state_up":true}} - -*** Test Cases *** -Delete Network - [Documentation] Delete network in OpenStack - [Tags] Delete Network OpenStack Neutron - Log ${postNet} - ${resp} delete OSSession ${OSREST} - Should be Equal As Strings ${resp.status_code} 204 - Log ${resp.content} - sleep 2 - -Check Network deleted - [Documentation] Check Network deleted in OpenDaylight - [Tags] Check Network OpenDaylight - Create Session ODLSession http://${CONTROLLER}:${PORT} headers=${HEADERS} auth=${AUTH} - ${resp} get ODLSession ${ODLREST} - Should be Equal As Strings ${resp.status_code} 200 - ${ODLResult} To Json ${resp.content} - Set Suite Variable ${ODLResult} - Log ${ODLResult} - ${resp} get ODLSession ${ODLREST}/${NetID} - Should be Equal As Strings ${resp.status_code} 404 diff --git a/testcases/Controllers/ODL/CI/odlreport2db.py b/testcases/Controllers/ODL/CI/odlreport2db.py deleted file mode 100644 index 50c8b096e..000000000 --- a/testcases/Controllers/ODL/CI/odlreport2db.py +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/python -# -# Authors: -# - peter.bandzi@cisco.com -# - morgan.richomme@orange.com -# -# src: Peter Bandzi -# https://github.com/pbandzi/parse-robot/blob/master/convert_robot_to_json.py -# -# Copyright (c) 2015 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 -# -# 0.1: This script boots the VM1 and allocates IP address from Nova -# Later, the VM2 boots then execute cloud-init to ping VM1. -# After successful ping, both the VMs are deleted. -# 0.2: measure test duration and publish results under json format -# -# - -import getopt -import json -import os -import sys -import xmltodict -import yaml - -import functest.utils.functest_utils as functest_utils - - -def usage(): - print """Usage: - get-json-from-robot.py --xml= --pod= - --installer= --database= - --scenaro=SCENARIO - -x, --xml xml file generated by robot test - -p, --pod POD name where the test come from - -i, --installer - -s, --scenario - -h, --help this message - """ - sys.exit(2) - - -def populate_detail(test): - detail = {} - detail['test_name'] = test['@name'] - detail['test_status'] = test['status'] - detail['test_doc'] = test['doc'] - return detail - - -def parse_test(tests, details): - try: - for test in tests: - details.append(populate_detail(test)) - except TypeError: - # tests is not iterable - details.append(populate_detail(tests)) - return details - - -def parse_suites(suites): - data = {} - details = [] - try: - for suite in suites: - data['details'] = parse_test(suite['test'], details) - except TypeError: - # suites is not iterable - data['details'] = parse_test(suites['test'], details) - return data - - -def main(argv): - try: - opts, args = getopt.getopt(argv, - 'x:p:i:s:h', - ['xml=', 'pod=', - 'installer=', - 'scenario=', - 'help']) - except getopt.GetoptError: - usage() - - for opt, arg in opts: - if opt in ('-h', '--help'): - usage() - elif opt in ('-x', '--xml'): - xml_file = arg - elif opt in ('-p', '--pod'): - pod = arg - elif opt in ('-i', '--installer'): - installer = arg - elif opt in ('-s', '--scenario'): - scenario = arg - else: - usage() - - with open(xml_file, "r") as myfile: - xml_input = myfile.read().replace('\n', '') - - # dictionary populated with data from xml file - all_data = xmltodict.parse(xml_input)['robot'] - - data = parse_suites(all_data['suite']['suite']) - data['description'] = all_data['suite']['@name'] - data['version'] = all_data['@generator'] - data['test_project'] = "functest" - data['case_name'] = "ODL" - data['pod_name'] = pod - data['installer'] = installer - - json.dumps(data, indent=4, separators=(',', ': ')) - - # Only used from container, we can set up absolute path - with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: - functest_yaml = yaml.safe_load(f) - f.close() - - database = functest_yaml.get("results").get("test_db_url") - build_tag = functest_utils.get_build_tag() - - try: - # example: - # python odlreport2db.py -x ~/Pictures/Perso/odl/output3.xml - # -i fuel - # -p opnfv-jump-2 - # -s os-odl_l2-ha - version = functest_utils.get_version() - - # success criteria for ODL = 100% of tests OK - status = "failed" - try: - tests_passed = 0 - tests_failed = 0 - for v in data['details']: - if v['test_status']['@status'] == "PASS": - tests_passed += 1 - else: - tests_failed += 1 - - if (tests_failed < 1): - status = "passed" - except: - print("Unable to set criteria" % sys.exc_info()[0]) - functest_utils.push_results_to_db(database, - "functest", - data['case_name'], - None, - data['pod_name'], - version, - scenario, - status, - build_tag, - data) - except: - print("Error pushing results into Database '%s'" % sys.exc_info()[0]) - - -if __name__ == "__main__": - main(sys.argv[1:]) diff --git a/testcases/Controllers/ODL/CI/start_tests.sh b/testcases/Controllers/ODL/CI/start_tests.sh deleted file mode 100755 index 3800b6307..000000000 --- a/testcases/Controllers/ODL/CI/start_tests.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# it includes python2.7 virtual env with robot packages and git -# -# 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 -# - -BASEDIR=`dirname $0` -RESULTS_DIR='/home/opnfv/functest/results/odl/' -REPO_DIR='/home/opnfv/repos/odl_integration' -#TODO: read this form config_functest.yaml - -# Colors -green='\033[0;32m' -light_green='\033[1;32m' -red='\033[1;31m' -nc='\033[0m' # No Color - -usage="Script for starting ODL tests. Tests to be executed are specified in test_list.txt file. - -usage: -[var=value] bash $(basename "$0") [-h] - -where: - -h show this help text - var one of the following: ODL_IP, ODL_PORT, USR_NAME, PASS, NEUTRON_IP - value new value for var - -example: - ODL_IP=oscontro1 ODL_PORT=8080 bash $(basename "$0")" - -while getopts ':h' option; do - case "$option" in - h) echo "$usage" - exit - ;; - \?) printf "illegal option: -%s\n" "$OPTARG" >&2 - echo "$usage" >&2 - exit 1 - ;; - esac -done - -echo -e "${green}Current environment parameters for ODL suite.${nc}" -# Following vars might be also specified as CLI params -set -x -ODL_IP=${ODL_IP:-'192.168.1.5'} -ODL_PORT=${ODL_PORT:-8081} -USR_NAME=${USR_NAME:-'neutron'} -PASS=${PASS:-'octopus'} -NEUTRON_IP=${NEUTRON_IP:-192.168.0.68} -KEYSTONE_IP=${KEYSTONE_IP:-192.168.0.69} -set +x - -init_file=${REPO_DIR}/test/csit/suites/openstack/neutron/__init__.robot -# Change openstack password for admin tenant in neutron suite -sed -i "s/\"password\": \".*\"/\"password\": \"${PASS}\"/" $init_file - -# Add Start Suite and Teardown Suite -if [[ ! `grep 'Suite Teardown' ${init_file}` ]]; then - sed -i "/^Documentation.*/a Suite Teardown Stop Suite" $init_file - sed -i "/^Documentation.*/a Suite Setup Start Suite" $init_file -fi - -# add custom tests to suite, if there are more custom tests needed this will be reworked -echo -e "${green}Copy custom tests to suite.${nc}" -cp -vf ${BASEDIR}/custom_tests/neutron/* ${REPO_DIR}/test/csit/suites/openstack/neutron/ - -# List of tests are specified in test_list.txt -# those are relative paths to test directories from integartion suite -echo -e "${green}Executing chosen tests.${nc}" -test_num=0 -while read line -do - # skip comments - [[ ${line:0:1} == "#" ]] && continue - # skip empty lines - [[ -z "${line}" ]] && continue - - ((test_num++)) - echo -e "${light_green}Starting test: $line ${nc}" - pybot -v OPENSTACK:${KEYSTONE_IP} -v NEUTRON:${NEUTRON_IP} -v PORT:${ODL_PORT} -v CONTROLLER:${ODL_IP} ${REPO_DIR}/$line - mkdir -p $RESULTS_DIR/logs/${test_num} - mv log.html $RESULTS_DIR/logs/${test_num}/ - mv report.html $RESULTS_DIR/logs/${test_num}/ - mv output.xml $RESULTS_DIR/logs/${test_num}/ -done < ${BASEDIR}/test_list.txt - -# create final report which includes all partial test reports -for i in $(seq $test_num); do - rebot_params="$rebot_params $RESULTS_DIR/logs/$i/output.xml" -done - -echo -e "${green}Final report is located:${nc}" -rebot $rebot_params diff --git a/testcases/Controllers/ODL/CI/test_list.txt b/testcases/Controllers/ODL/CI/test_list.txt deleted file mode 100644 index ad791e553..000000000 --- a/testcases/Controllers/ODL/CI/test_list.txt +++ /dev/null @@ -1,5 +0,0 @@ -# List of tests` which will be executed by script start_test.sh -# You can specify path to specific robot test file or directory (in that case all tests from directory will be executed) - -test/csit/suites/integration/basic/ -test/csit/suites/openstack/neutron/ -- cgit 1.2.3-korg