aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/Controllers/ODL
diff options
context:
space:
mode:
Diffstat (limited to 'testcases/Controllers/ODL')
-rw-r--r--testcases/Controllers/ODL/CI/create_venv.sh35
-rw-r--r--testcases/Controllers/ODL/CI/custom_tests/neutron/040__delete_ports.txt37
-rw-r--r--testcases/Controllers/ODL/CI/custom_tests/neutron/050__delete_subnets.txt37
-rw-r--r--testcases/Controllers/ODL/CI/custom_tests/neutron/060__delete_networks.txt37
-rw-r--r--testcases/Controllers/ODL/CI/requirements.pip4
-rwxr-xr-x[-rw-r--r--]testcases/Controllers/ODL/CI/start_tests.sh67
-rw-r--r--testcases/Controllers/ODL/CI/test_list.txt4
7 files changed, 146 insertions, 75 deletions
diff --git a/testcases/Controllers/ODL/CI/create_venv.sh b/testcases/Controllers/ODL/CI/create_venv.sh
deleted file mode 100644
index 5d0733a5..00000000
--- a/testcases/Controllers/ODL/CI/create_venv.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash -e
-
-# Script checks that venv exists. If it doesn't it will be created
-# It requires python2.7 and virtualenv packages installed
-
-BASEDIR=`dirname $0`
-
-function venv_install() {
- if command -v virtualenv-2.7; then
- virtualenv-2.7 $1
- elif command -v virtualenv2; then
- virtualenv2 $1
- elif command -v virtualenv; then
- virtualenv $1
- else
- echo Please make sure virtualenv package is installed.
- return 1
- fi
-}
-
-# exit when something goes wrong during venv install
-set -e
-if [ ! -d "$BASEDIR/venv" ]; then
- venv_install $BASEDIR/venv
- echo "Virtualenv created."
-fi
-
-if [ ! -f "$BASEDIR/venv/updated" -o $BASEDIR/requirements.pip -nt $BASEDIR/venv/updated ]; then
- source $BASEDIR/venv/bin/activate
- pip install -r $BASEDIR/requirements.pip
- touch $BASEDIR/venv/updated
- echo "Requirements installed."
- deactivate
-fi
-set +e
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
new file mode 100644
index 00000000..02c90c37
--- /dev/null
+++ b/testcases/Controllers/ODL/CI/custom_tests/neutron/040__delete_ports.txt
@@ -0,0 +1,37 @@
+*** Settings ***
+Documentation Checking Port deleted in OpenStack are deleted also in OpenDaylight
+Suite Setup Create Session OSSession http://${OPENSTACK}: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
new file mode 100644
index 00000000..4121c98f
--- /dev/null
+++ b/testcases/Controllers/ODL/CI/custom_tests/neutron/050__delete_subnets.txt
@@ -0,0 +1,37 @@
+*** Settings ***
+Documentation Checking Subnets deleted in OpenStack are deleted also in OpenDaylight
+Suite Setup Create Session OSSession http://${OPENSTACK}: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
new file mode 100644
index 00000000..fc823fa4
--- /dev/null
+++ b/testcases/Controllers/ODL/CI/custom_tests/neutron/060__delete_networks.txt
@@ -0,0 +1,37 @@
+*** Settings ***
+Documentation Checking Network deleted in OpenStack are deleted also in OpenDaylight
+Suite Setup Create Session OSSession http://${OPENSTACK}: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/requirements.pip b/testcases/Controllers/ODL/CI/requirements.pip
deleted file mode 100644
index 43845e25..00000000
--- a/testcases/Controllers/ODL/CI/requirements.pip
+++ /dev/null
@@ -1,4 +0,0 @@
-requests
-robotframework
-robotframework-requests
-robotframework-sshlibrary
diff --git a/testcases/Controllers/ODL/CI/start_tests.sh b/testcases/Controllers/ODL/CI/start_tests.sh
index 367a075f..5e87726b 100644..100755
--- a/testcases/Controllers/ODL/CI/start_tests.sh
+++ b/testcases/Controllers/ODL/CI/start_tests.sh
@@ -1,9 +1,11 @@
#!/bin/bash
-# Script requires that test environment is created already
# it includes python2.7 virtual env with robot packages and git
-# use create_env.sh script for creating python virtualenv
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'
@@ -17,11 +19,11 @@ usage:
where:
-h show this help text
- var one of the following: OSTACK_IP, ODL_PORT, USR_NAME, USR_PASSWORD
+ var one of the following: ODL_IP, ODL_PORT, USR_NAME, PASS, NEUTRON_IP
value new value for var
example:
- OSTACK_IP=oscontro1 ODL_PORT=8080 bash $(basename "$0")"
+ ODL_IP=oscontro1 ODL_PORT=8080 bash $(basename "$0")"
while getopts ':h' option; do
case "$option" in
@@ -38,36 +40,30 @@ done
echo -e "${green}Current environment parameters for ODL suite.${nc}"
# Following vars might be also specified as CLI params
set -x
-OSTACK_IP=${OSTACK_IP:-'oscontrol'}
+ODL_IP=${ODL_IP:-'192.168.1.5'}
ODL_PORT=${ODL_PORT:-8081}
-USR_NAME=${USR_NAME:-'admin'}
-USR_PASSWORD=${USR_PASSWORD:-'octopus'}
+USR_NAME=${USR_NAME:-'neutron'}
+PASS=${PASS:-'octopus'}
+NEUTRON_IP=${NEUTRON_IP:-192.168.0.68}
set +x
-echo -e "${green}Cloning ODL integration git repo.${nc}"
-if [ -d integration ]; then
- cd integration
- git checkout -- .
- git pull
- cd -
-else
- git clone https://github.com/opendaylight/integration.git
-fi
# Change openstack password for admin tenant in neutron suite
-sed -i "s/\"password\": \"admin\"/\"password\": \"${USR_PASSWORD}\"/" integration/test/csit/suites/openstack/neutron/__init__.robot
+sed -i "s/\"password\": \".*\"/\"password\": \"${PASS}\"/" ${REPO_DIR}/test/csit/suites/openstack/neutron/__init__.robot
+
+# Add Start Suite and Teardown Suite
+sed -i "/^Documentation.*/a Suite Teardown Stop Suite" ${REPO_DIR}/test/csit/suites/openstack/neutron/__init__.robot
+sed -i "/^Documentation.*/a Suite Setup Start Suite" ${REPO_DIR}/test/csit/suites/openstack/neutron/__init__.robot
+
-if source $BASEDIR/venv/bin/activate; then
- echo -e "${green}Python virtualenv activated.${nc}"
-else
- echo -e "${red}ERROR${nc}"
- exit 1
-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=1
+test_num=0
while read line
do
# skip comments
@@ -75,16 +71,19 @@ do
# skip empty lines
[[ -z "${line}" ]] && continue
- echo -e "${light_green}Starting test: $line ${nc}"
- pybot -v OPENSTACK:${OSTACK_IP} -v PORT:${ODL_PORT} -v CONTROLLER:${OSTACK_IP} $line
- mkdir -p $BASEDIR/logs/${test_num}
- mv log.html $BASEDIR/logs/${test_num}/
- mv report.html $BASEDIR/logs/${test_num}/
- mv output.xml $BASEDIR/logs/${test_num}/
((test_num++))
-done < test_list.txt
+ echo -e "${light_green}Starting test: $line ${nc}"
+ pybot -v OPENSTACK:${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
-echo -e "${green}Deactivate venv.${nc}"
-deactivate
+# 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
-# Now we can copy output.xml, log.html and report.xml files generated by robot.
+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
index e5e52129..ad791e55 100644
--- a/testcases/Controllers/ODL/CI/test_list.txt
+++ b/testcases/Controllers/ODL/CI/test_list.txt
@@ -1,5 +1,5 @@
# 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)
-integration/test/csit/suites/integration/basic/
-integration/test/csit/suites/openstack/neutron/
+test/csit/suites/integration/basic/
+test/csit/suites/openstack/neutron/