From: Felipe Vicens Date: Mon, 22 Jun 2020 06:12:30 +0000 (+0200) Subject: Initial tests contributions X-Git-Tag: v0.0.1~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=f96bb45c0a03f2188688d90d67ea718851cec2de;p=osm%2Ftests.git Initial tests contributions Dockerfile for robot tests automation Robot-systests from devops repository Testing tags for CI/CD Adding charm build script Change-Id: Ib50d8e3c66be44e946e19071b2ca229d48609ea3 Signed-off-by: Felipe Vicens --- diff --git a/.gitignore b/.gitignore index 302f4e1..3384736 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ dist *.local local +reports diff --git a/Dockerfile b/Dockerfile index 54f0fd5..05598fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,5 +15,30 @@ FROM ubuntu:18.04 -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install git \ - make python3 debhelper python3-setuptools apt-utils +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install git software-properties-common \ + make python3 debhelper python3-setuptools python3-pip apt-utils ssh iputils-ping libcurl4-openssl-dev libssl-dev \ + python3-openstackclient +RUN add-apt-repository -y ppa:rmescandon/yq && apt update && apt install yq -y +RUN python3 -m pip install haikunator requests robotframework robotframework-seleniumlibrary robotframework-requests robotframework-jsonlibrary \ + robotframework-sshlibrary charm-tools git+https://osm.etsi.org/gerrit/osm/IM.git git+https://osm.etsi.org/gerrit/osm/osmclient.git +WORKDIR /robot-systest +RUN git clone https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git --recurse-submodules /robot-systest/osm-packages +COPY robot-systest /robot-systest +COPY charm.sh /usr/sbin/charm + +# Folder where Robot tests are stored +ENV ROBOT_DEVOPS_FOLDER=/robot-systest + +# Folder to save alternative DUT environments (optional) +ENV ENVIRONMENTS_FOLDER=environments + +# Folder where all required packages are stored +ENV PACKAGES_FOLDER=/robot-systest/osm-packages + +# Folder where test results should be exported +ENV ROBOT_REPORT_FOLDER=/robot-systest/results + +ENV LC_ALL=C.UTF-8 +ENV LANG=C.UTF-8 + +ENTRYPOINT [ "/robot-systest/run_test.sh"] diff --git a/Jenkinsfile b/Jenkinsfile index 4f9b9aa..7f996ba 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ properties([ parameters([ string(defaultValue: env.BRANCH_NAME, description: '', name: 'GERRIT_BRANCH'), - string(defaultValue: 'osm/TEMPLATE', description: '', name: 'GERRIT_PROJECT'), + string(defaultValue: 'osm/tests', description: '', name: 'GERRIT_PROJECT'), string(defaultValue: env.GERRIT_REFSPEC, description: '', name: 'GERRIT_REFSPEC'), string(defaultValue: env.GERRIT_PATCHSET_REVISION, description: '', name: 'GERRIT_PATCHSET_REVISION'), string(defaultValue: 'https://osm.etsi.org/gerrit', description: '', name: 'PROJECT_URL_PREFIX'), @@ -21,7 +21,7 @@ node('docker') { devops_checkout() ci_stage_2 = load "devops/jenkins/ci-pipelines/ci_stage_2.groovy" - ci_stage_2.ci_pipeline( 'TEMPLATE', + ci_stage_2.ci_pipeline( 'tests', params.PROJECT_URL_PREFIX, params.GERRIT_PROJECT, params.GERRIT_BRANCH, diff --git a/README.md b/README.md index 8601322..eb13bf0 100644 --- a/README.md +++ b/README.md @@ -14,55 +14,103 @@ implied. See the License for the specific language governing permissions and limitations under the License --> -# Project Title -One Paragraph of project description goes here +# OSM test automation project - osm/tests -## Getting Started +This repository contains tools and configuration files for testing and automation needs of OSM projet -These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. +## Prerequisites -### Prerequisites +* **Robot Framework** +* **Packages**: ssh ping yq git +* **Python3 packages**: haikunator requests robotframework robotframework-seleniumlibrary robotframework-requests robotframework-jsonlibrary robotframework-sshlibrary +* Clone **osm-packages** from gitlab +* Environment config file for your infrastructure [envfile.rc] -What things you need to install the software and how to install them +## Installing -``` -Give examples +This bash script can be used to setup your environment to execute the tests. + +```bash + PACKAGES_FOLDER=osm-packages + add-apt-repository -y ppa:rmescandon/yq && apt update && apt install yq git iputils-ping ssh -y + pip install haikunator requests robotframework robotframework-seleniumlibrary robotframework-requests robotframework-jsonlibrary \ + robotframework-sshlibrary + # Download community packages + git clone https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git ${PACKAGES_FOLDER} ``` -### Installing +envfile.rc -A step by step series of examples that tell you how to get a development env running +```bash + # VIM setup + OS_USERNAME= + OS_PASSWORD= + OS_TENANT_NAME= + OS_AUTH_URL= + OS_TENANT_ID= + OSM_HOSTNAME= + VIM_TARGET= + VIM_MGMT_NET= -Say what the step will be + # The following set of environment variables will be used in host + # of the robot framework. Not needed for docker execution -``` -Give the example -``` + # Folder where Robot tests are stored + ROBOT_DEVOPS_FOLDER=robot-systest -And repeat + # Folder to save alternative DUT environments (optional) + ENVIRONMENTS_FOLDER=environments -``` -until finished + # Folder where all required packages are stored + PACKAGES_FOLDER=osm-packages + + # Folder where test results should be exported + ROBOT_REPORT_FOLDER=results ``` -End with an example of getting some data out of the system or using it for a little demo +## Deployment -## Running the tests +It is possible to run the tests directly from the repository or using a docker container with the tests -Explain how to run the automated tests for this system +1. Docker container creation: +```bash +docker build -t osmtests . ``` -Give an example + +Options: + +* --env-file: It is the environmental file where is described the OSM target and VIM +* -o [OPTIONAL]: It is used to specify a particular osmclient version. Default: latest +* -p [OPTIONAL]: OSM packages repository branch. Default: master +* -t [OPTIONAL]: Robot tests tags. [sanity, regression, particular_test]. Default: sanity + +Volumes: + +* [OPTIONAL]: It is the absolute path to reports location in the host +* [OPTIONAL]: It is the absolute path to the clouds.yaml file in the host + +```bash + docker run --rm=true -t osmtests --env-file \ + -v :/reports osmtests -v :/robot-systest/clouds.yaml \ + -v :/robot-systest/kubeconfig.yaml + -o -p -t ``` -## Deployment +1. Running the tests manually: -Add additional notes about how to deploy this on a live system +The way of executing the tests is via the following command: + +```bash + source envfile.rc + robot -d reports -i testsuite/ +``` ## Built With * [Python](www.python.org/) - The language used +* [Robot Framework](robotframework.org) - The testing framework ## Contributing @@ -70,13 +118,10 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc ## Versioning -We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://osm.etsi.org/gitweb/?p=osm/TEMPLATE.git;a=tags). +We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://osm.etsi.org/gitweb/?p=osm/tests.git;a=tags). ## License This project is licensed under the Apache2 License - see the [LICENSE.md](LICENSE) file for details ## Acknowledgments - -* **Billie Thompson** - *Initial work* - [PurpleBooth](https://github.com/PurpleBooth) - diff --git a/charm.sh b/charm.sh new file mode 100755 index 0000000..73c1f4d --- /dev/null +++ b/charm.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Workaround for charm build + + +function build() { + echo "$@" + charm-build "$@" +} + +params="$@" +delete=build + +params=("${params[@]/$delete}") + +build $params + diff --git a/clouds.yaml b/clouds.yaml new file mode 100644 index 0000000..b627183 --- /dev/null +++ b/clouds.yaml @@ -0,0 +1,9 @@ +clouds: + openstack: + auth: + auth_url: http://172.21.247.1:5000/v3 + project_name: fvicens + username: fvicens + password: fvicens19 + user_domain_name: Default + project_domain_name: Default diff --git a/envconfig.rc b/envconfig.rc new file mode 100644 index 0000000..7d2bb6f --- /dev/null +++ b/envconfig.rc @@ -0,0 +1,15 @@ +# VIM setup +OS_USERNAME=fvicens +OS_PASSWORD=fvicens19 +OS_TENANT_NAME=admin +OS_AUTH_URL=https://172.21.247.1:5000/v3 +OS_TENANT_ID=fvicens +OSM_HOSTNAME=172.21.248.28 +VIM_TARGET=osm +VIM_MGMT_NET=osm-ext +ENVIRONMENTS_FOLDER=environments +PACKAGES_FOLDER=/robot-systest/osm-packages +OS_CLOUD=openstack + +LC_ALL=C.UTF-8 +LANG=C.UTF-8 diff --git a/robot-systest/README.md b/robot-systest/README.md new file mode 100644 index 0000000..fd27468 --- /dev/null +++ b/robot-systest/README.md @@ -0,0 +1,50 @@ + + +# Robot Framework: Test usage + +## Requirements + +- OSM client installed () +- devops repository cloned in home () +- The descriptor packages used on each test are expected to be in `${PACKAGES_FOLDER}`. +- A set of environment variables (there is an example file located at devops/robot-systest/environment.rc): + - `OSM_HOSTNAME`: IP address of target OSM. + - `OS_CLOUD`: Cloud credentialss. + - `VIM_TARGET`: VIM where tests will be run. + - `VIM_MGMT_NET`: VIM management network, reachable from robot. + - `PACKAGES_FOLDER`: Path where descriptor packages repository are cloned: https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages/ + - `ROBOT_DEVOPS_FOLDER`: Where the devops repository is located. + - `ROBOT_REPORT_FOLDER`: Where robot outpul will be placed. + +## Installation + +```bash +sudo -H python3 -m pip install --ignore-installed haikunator requests pyvcloud progressbar pathlib robotframework robotframework-seleniumlibrary robotframework-requests robotframework-SSHLibrary +sudo snap install yq +sudo apt-get install -y python3-openstackclient # Installs Queens by default +``` + +## Usage + +Example using hackfest basic test. + +```bash + +# Set your environment variables in environment.rc as specified in requirements +source environment.rc + +cd ~/devops/robot-systest +robot -d ${ROBOT_REPORT_FOLDER} testsuite/hackfest_basic.robot +``` diff --git a/robot-systest/envfile.rc b/robot-systest/envfile.rc new file mode 100644 index 0000000..a459e47 --- /dev/null +++ b/robot-systest/envfile.rc @@ -0,0 +1,20 @@ +# 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. + +echo "Please set your environment variables." +# export OSM_HOSTNAME= +# export OS_CLOUD= +# export VIM_TARGET= +# export VIM_MGMT_NET= +# export PACKAGES_FOLDER= +# export ROBOT_DEVOPS_FOLDER= +# export ROBOT_REPORT_FOLDER= diff --git a/robot-systest/lib/connectivity_lib.robot b/robot-systest/lib/connectivity_lib.robot new file mode 100644 index 0000000..7b86593 --- /dev/null +++ b/robot-systest/lib/connectivity_lib.robot @@ -0,0 +1,19 @@ +# 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. + +*** Keywords *** +Test Connectivity + [Arguments] ${host} + + ${result} Run Process ping -c 5 -W 1 ${host} > /dev/null && echo OK shell=True + Log all output: ${result.stdout} + Should Contain ${result.stdout} OK diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot new file mode 100644 index 0000000..6a8c84b --- /dev/null +++ b/robot-systest/lib/ns_lib.robot @@ -0,0 +1,212 @@ +# 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. + +*** Variables *** +${success_return_code} 0 +${ns_launch_pol_time} 30sec +${ns_delete_max_wait_time} 1min +${ns_delete_pol_time} 15sec +${ns_action_max_wait_time} 1min +${ns_action_pol_time} 15sec +${vnf_scale_max_wait_time} 5min +${vnf_scale_pol_time} 30sec + + +*** Keywords *** +Create Network Service + [Arguments] ${nsd} ${vim_name} ${ns_name} ${ns_config} ${publickey} ${ns_launch_max_wait_time}=5min + + ${config_attr} Set Variable If '${ns_config}'!='${EMPTY}' --config '${ns_config}' \ + ${sshkeys_attr} Set Variable If '${publickey}'!='${EMPTY}' --ssh_keys ${publickey} \ + + ${ns_id}= Instantiate Network Service ${ns_name} ${nsd} ${vim_name} ${config_attr} ${sshkeys_attr} + log ${ns_id} + + WAIT UNTIL KEYWORD SUCCEEDS ${ns_launch_max_wait_time} ${ns_launch_pol_time} Check For NS Instance To Configured ${ns_name} + Check For NS Instance For Failure ${ns_name} + [Return] ${ns_id} + + +Instantiate Network Service + [Arguments] ${ns_name} ${nsd} ${vim_name} ${ns_extra_args} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} ${ns_extra_args} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + +Get Vnf Management Ip Address + [Arguments] ${ns_id} ${vnf_member_index} + + Should Not Be Empty ${ns_id} + Should Not Be Empty ${vnf_member_index} + ${rc} ${stdout}= Run and Return RC and Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $14}' 2>&1 + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + +Get Ns Vnf List + [Arguments] ${ns_id} + + Should Not Be Empty ${ns_id} + @{vnf_list_string}= Run and Return RC and Output osm vnf-list | grep ${ns_id} | awk '{print $2}' 2>&1 + # Returns a String of vnf_id and needs to be converted into a list + @{vnf_list} = Split String ${vnf_list_string}[1] + Log List ${vnf_list} + [Return] @{vnf_list} + + +Get Ns Ip List + [Arguments] @{vnf_list} + + should not be empty @{vnf_list} + @{temp_list}= Create List + FOR ${vnf_id} IN @{vnf_list} + log ${vnf_id} + @{vnf_ip_list} Get Vnf Ip List ${vnf_id} + @{temp_list}= Combine Lists ${temp_list} ${vnf_ip_list} + END + should not be empty ${temp_list} + [return] @{temp_list} + + +Get Vnf Ip List + [arguments] ${vnf_id} + + should not be empty ${vnf_id} + @{vnf_ip_list_string}= run and return rc and output osm vnf-show ${vnf_id} --filter vdur --literal | grep -o '[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}' | sort -t: -u -k1,1 2>&1 + # returns a string of ip addresses and needs to be converted into a list + should not be empty ${vnf_ip_list_string}[1] + @{vnf_ip_list} = split string ${vnf_ip_list_string}[1] + log list ${vnf_ip_list} + should not be empty ${vnf_ip_list} + [return] @{vnf_ip_list} + + +Check For Ns Instance To Configured + [arguments] ${ns_name} + + ${rc} ${stdout}= run and return rc and output osm ns-list --filter name="${ns_name}" + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Contain Any ${stdout} READY BROKEN + +Check For NS Instance For Failure + [Arguments] ${ns_name} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-list --filter name="${ns_name}" + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Contain ${stdout} BROKEN + +Check For NS Instance To Be Deleted + [Arguments] ${ns} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-list | awk '{print $2}' | grep ${ns} + Should Not Be Equal As Strings ${stdout} ${ns} + +Delete NS + [Documentation] Delete ns + [Arguments] ${ns} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-delete ${ns} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + WAIT UNTIL KEYWORD SUCCEEDS ${ns_delete_max_wait_time} ${ns_delete_pol_time} Check For NS Instance To Be Deleted ${ns} + +Execute NS Action + [Documentation] Execute an action over the desired NS. + ... Parameters are given to this function in key=value format (one argument per key/value pair). + ... Return the ID of the operation associated to the executed action. + ... Examples of execution: + ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} + ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} \${param1}=\${value1} \${param2}=\${value2} + + [Arguments] ${ns_name} ${ns_action} ${vnf_member_index} @{action_params} + + ${params}= Set Variable ${EMPTY} + FOR ${param} IN @{action_params} + ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in parameters + ${params}= Catenate SEPARATOR= ${params} "${param_name}":"${param_value}", + END + ${osm_ns_action_command}= Set Variable osm ns-action --action_name ${ns_action} --vnf_name ${vnf_member_index} + ${osm_ns_action_command}= Run Keyword If '${params}'!='${EMPTY}' Catenate ${osm_ns_action_command} --params '{${params}}' + ... ELSE Set Variable ${osm_ns_action_command} + ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name} + ${rc} ${stdout}= Run and Return RC and Output ${osm_ns_action_command} + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + Wait Until Keyword Succeeds ${ns_action_max_wait_time} ${ns_action_pol_time} Check For NS Operation Completed ${stdout} + [Return] ${stdout} + + +Execute Manual VNF Scale + [Documentation] Execute a manual VNF Scale action. + ... The parameter 'scale_type' must be SCALE_IN or SCALE_OUT. + ... Return the ID of the operation associated to the executed scale action. + + [Arguments] ${ns_name} ${vnf_member_index} ${scaling_group} ${scale_type} + + Should Contain Any ${scale_type} SCALE_IN SCALE_OUT msg=Unknown scale type: ${scale_type} values=False + ${osm_vnf_scale_command}= Set Variable osm vnf-scale --scaling-group ${scaling_group} + ${osm_vnf_scale_command}= Run Keyword If '${scale_type}'=='SCALE_IN' Catenate ${osm_vnf_scale_command} --scale-in + ... ELSE Catenate ${osm_vnf_scale_command} --scale-out + ${osm_vnf_scale_command}= Catenate ${osm_vnf_scale_command} ${ns_name} ${vnf_member_index} + ${rc} ${stdout}= Run and Return RC and Output ${osm_vnf_scale_command} + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + Wait Until Keyword Succeeds ${ns_action_max_wait_time} ${ns_action_pol_time} Check For NS Operation Completed ${stdout} + [Return] ${stdout} + + +Get Operations List + [Arguments] ${ns_name} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-op-list ${ns_name} + log ${stdout} + log ${rc} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Check For NS Operation Completed + [Documentation] Check wheter the status of the desired operation is "COMPLETED" or not. + + [Arguments] ${ns_operation_id} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq r - operationState + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Contain ${stdout} COMPLETED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False + + +Get Ns Vnfr Ids + [Documentation] Return a list with the IDs of the VNF records of a NS instance. + + [Arguments] ${ns_id} + + ${rc} ${stdout}= Run and Return RC and Output osm vnf-list | grep ${ns_id} | awk '{print $2}' 2>&1 + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + @{vdur} = Split String ${stdout} + [Return] @{vdur} + + +Get Vnf Vdur Names + [Documentation] Return a list with the names of the VDU records of a VNF instance. + + [Arguments] ${vnf_id} + + ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq r - vdur.*.name + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + @{vdur} = Split String ${stdout} + [Return] @{vdur} + diff --git a/robot-systest/lib/nsd_lib.robot b/robot-systest/lib/nsd_lib.robot new file mode 100644 index 0000000..c7ebbe7 --- /dev/null +++ b/robot-systest/lib/nsd_lib.robot @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- + +## +# Copyright 2019 Tech Mahindra Limited +# +# All Rights Reserved. +# +# 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. +## + +## Change log: +# 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-sep-2019 +## + +*** Settings *** +Library String + + +*** Variables *** +${success_return_code} 0 +${delete_max_wait_time} 1min +${delete_pol_time} 15sec + + +*** Keywords *** +Get NSDs List + ${rc} ${stdout}= Run and Return RC and Output osm nsd-list + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Create NSD + [Arguments] ${nsd_pkg} + + ${rc} ${stdout}= Run and Return RC and Output osm nsd-create ${nsd_pkg} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + ${lines}= Get Line Count ${stdout} + ${last}= Evaluate ${lines} - 1 + ${id}= Get Line ${stdout} ${last} + [Return] ${id} + + +Delete NSD + [Arguments] ${nsd_id} + + ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm nsd-delete ${nsd_id} + Should Be Equal As Integers ${rc} ${success_return_code} + log ${stdout} + WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For NSD ${nsd_id} + + +Check For NSD + [Arguments] ${nsd_id} + + ${rc} ${stdout}= Run and Return RC and Output osm nsd-list | awk '{print $2}' | grep ${nsd_id} + Should Not Be Equal As Strings ${stdout} ${nsd_id} diff --git a/robot-systest/lib/nsi_lib.robot b/robot-systest/lib/nsi_lib.robot new file mode 100644 index 0000000..5152833 --- /dev/null +++ b/robot-systest/lib/nsi_lib.robot @@ -0,0 +1,206 @@ +# Copyright 2020 Atos +# +# 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. + +*** Settings *** +Library Collections + + +*** Variables *** +${success_return_code} 0 +${slice_launch_max_wait_time} 5min +${slice_launch_pol_time} 30sec +${slice_delete_max_wait_time} 1min +${slice_delete_pol_time} 15sec + +*** Keywords *** + +Create Network Slice + [Documentation] Instantiates a NST and returns an instantiation id (nsi), verifying the slice is successfully instantiated + ... Parameters: + ... nst: Name of the slice template + ... vim_name: Name of the VIM entry already in OSM + ... slice_name: Name of the slice instance + ... slice_config: Extra parameters that might require the slice instantiation i.e. configuration attributes + ... publickey: SSH public key of the local machine + ... Execution example: + ... \${nsi}= Create Network Slice \${nst} \${vim_name} \${slice_name} \${slice_config} \${publickey} + + [Arguments] ${nst} ${vim_name} ${slice_name} ${slice_config} ${publickey} + + ${config_attr} Set Variable If '${slice_config}'!='${EMPTY}' --config '${slice_config}' \ + ${sshkeys_attr} Set Variable If '${publickey}'!='${EMPTY}' --ssh_keys ${publickey} \ + + ${nsi_id}= Instantiate Network Slice ${slice_name} ${nst} ${vim_name} ${config_attr} ${sshkeys_attr} + log ${nsi_id} + + WAIT UNTIL KEYWORD SUCCEEDS ${slice_launch_max_wait_time} ${slice_launch_pol_time} Check For Network Slice Instance To Configured ${slice_name} + Check For Network Slice Instance For Failure ${slice_name} + [Return] ${nsi_id} + + +Instantiate Network Slice + [Documentation] Instantiates a NST and returns an instantiation id (nsi) + ... Parameters: + ... slice_name: Name of the slice instance + ... nst: Name of the slice template + ... vim_name: Name of the VIM entry already in OSM + ... slice_extra_args: Extra parameters that might require the slice instantiation i.e. configuration attributes + ... Execution example: + ... \${nsi}= Instantiate Network Slice \${slice_name} \${nst} \${vim_name} \${config_attr} + + [Arguments] ${slice_name} ${nst} ${vim_name} ${slice_extra_args} ${sshkeys_attr} + + ${rc} ${stdout}= Run and Return RC and Output osm nsi-create --nsi_name ${slice_name} --nst_name ${nst} --vim_account ${vim_name} ${sshkeys_attr} ${slice_extra_args} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + +Get Slice Ns List + [Documentation] Retrieves the list of NS in a slice + ... Parameters: + ... slice_name: Name of the slice instance + ... Execution example: + ... \@{slice_ns_list}= Get Slice Ns List \${slice_name} + + [Arguments] ${slice_name} + + Should Not Be Empty ${slice_name} + @{ns_list_string}= Run and Return RC and Output osm ns-list | grep ${slice_name} | awk '{print $4}' 2>&1 + # Returns a String of ns_id and needs to be converted into a list + @{ns_list} = Split String ${ns_list_string}[1] + Log List ${ns_list} + [Return] @{ns_list} + + +Get Slice Ns List Except One + [Documentation] Retrieves the list of NS in a slice removing one from the list. This is done to save time in the tests, avoiding one VNF to ping itself. + ... Parameters: + ... slice_name: Name of the slice instance + ... exception_ns: Name of the ns that will not appear in the final list + ... Execution example: + ... \@{slice_ns_list}= Get Slice Ns List Except One \${slice_name} \${exception_ns} + + [Arguments] ${slice_name} ${exception_ns} + + Should Not Be Empty ${slice_name} + Should Not Be Empty ${exception_ns} + + @{ns_list_string}= Run and Return RC and Output osm ns-list | grep ${slice_name} | awk '!/${exception_ns}/' | awk '{print $4}' 2>&1 + # Returns a String of ns_id and needs to be converted into a list + @{ns_list} = Split String ${ns_list_string}[1] + Log List ${ns_list} + [Return] @{ns_list} + + +Get Slice Ns Count + [Documentation] Returns the count of all the NS in a slice + ... Parameters: + ... slice_name: Name of the slice instance + ... Execution example: + ... \${slice_ns_count}= Get Slice Ns Count \${slice_name} + + [Arguments] ${slice_name} + + Should Not Be Empty ${slice_name} + ${rc} ${stdout}= Run and Return RC and Output osm ns-list | grep ${slice_name} | wc -l 2>&1 + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + +Get Slice Vnf Ip Addresses + [Documentation] Retrieves the list of IP addresses that belong to each of the VNFs in the slice + ... Parameters: + ... slice_name: Name of the slice instance + ... Execution example: + ... \@{slice_ip_address_list}= Get Slice Vnf Ip Addresses \${slice_name} + + [Arguments] ${slice_name} + + # Get all the ns_id in the slice + @{slice_ns_list} Get Slice Ns List ${slice_name} + log many @{slice_ns_list} + @{temp_list}= Create List + # For each ns_id in the list, get all the vnf_id and their IP addresses + FOR ${ns_id} IN @{slice_ns_list} + log ${ns_id} + @{vnf_id_list} Get Ns Vnf List ${ns_id} + # For each vnf_id in the list, get all its IP addresses + @{ns_ip_list} Get Ns Ip List @{vnf_id_list} + @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list} + END + Log List ${temp_list} + [Return] @{temp_list} + + +Check For Network Slice Instance To Configured + [Documentation] Verify the slice has been instantiated + ... Parameters: + ... slice_name: Name of the slice instance + ... Execution example: + ... Check For Network Slice Instance To Configured \${slice_name} + + [Arguments] ${slice_name} + + ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${slice_name}" + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Contain Any ${stdout} READY BROKEN configured + + +Check For Network Slice Instance For Failure + [Documentation] Verify the slice instance is not in failure + ... Parameters: + ... slice_name: Name of the slice instance + ... Execution example: + ... Check For Network Slice Instance For Failure \${slice_name} + + [Arguments] ${slice_name} + + ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${slice_name}" + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Contain ${stdout} BROKEN + + +Delete NSI + [Documentation] Delete Network Slice Instance (NSI) + ... Parameters: + ... slice_name: Name of the slice instance + ... Execution example: + ... Delete NST \${slice_name} + + [Arguments] ${slice_name} + + ${rc} ${stdout}= Run and Return RC and Output osm nsi-delete ${slice_name} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + WAIT UNTIL KEYWORD SUCCEEDS ${slice_delete_max_wait_time} ${slice_delete_pol_time} Check For Network Slice Instance To Be Deleted ${slice_name} + + +Check For Network Slice Instance To Be Deleted + [Documentation] Verify the slice instance is not present + ... Parameters: + ... slice_name: Name of the slice instance + ... Execution example: + ... Check For Network Slice Instance \${slice_name} + + [Arguments] ${slice_name} + + ${rc} ${stdout}= Run and Return RC and Output osm nsi-list | awk '{print $2}' | grep ${slice_name} + Should Not Be Equal As Strings ${stdout} ${slice_name} + + diff --git a/robot-systest/lib/nst_lib.robot b/robot-systest/lib/nst_lib.robot new file mode 100644 index 0000000..60d874a --- /dev/null +++ b/robot-systest/lib/nst_lib.robot @@ -0,0 +1,53 @@ +# Copyright 2020 Atos +# +# 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. + +*** Variables *** +${success_return_code} 0 +${ns_launch_max_wait_time} 5min +${ns_launch_pol_time} 30sec +${ns_delete_max_wait_time} 1min +${ns_delete_pol_time} 15sec + +*** Keywords *** +Get NST List + ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-list + log ${stdout} + log ${rc} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Create NST + [Arguments] ${nst} + + ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-create ${nst} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + +Delete NST + [Arguments] ${nst_id} + + ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-delete ${nst_id} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For NST ${nst_id} + + +Check For NST + [Arguments] ${nst_id} + + ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-list | awk '{print $2}' | grep ${nst_id} + Should Not Be Equal As Strings ${stdout} ${nst_id} + diff --git a/robot-systest/lib/prometheus_lib.robot b/robot-systest/lib/prometheus_lib.robot new file mode 100644 index 0000000..d4c6b14 --- /dev/null +++ b/robot-systest/lib/prometheus_lib.robot @@ -0,0 +1,60 @@ +# 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. + +*** Settings *** +Documentation Library to obtain metrics from Prometheus. + +Library String +Library Collections +Library RequestsLibrary + + +*** Variables *** +${timeout} 1000 +${max_retries} 1 + + +*** Keywords *** +Get Metric + [Documentation] Get the instant value of a metric from Prometheus using multiple filter parameters. + ... The filter parameters are given to this function in key=value format (one argument per key/value pair). + ... Fails if the metric is not found or has multiple values. + ... Examples of execution: + ... \${metric}= Get Metric \${prometheus_ip} \${prometheus_port} \${metric} + ... \${metric}= Get Metric \${prometheus_ip} \${prometheus_port} \${metric} \${param1}=\${value1} \${param2}=\${value2} + + [Arguments] ${prometheus_ip} ${prometheus_port} ${metric} @{filter_parameters} + + ${filter}= Set Variable ${EMPTY} + FOR ${param} IN @{filter_parameters} + ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in filter parameters + ${filter}= Catenate SEPARATOR= ${filter} ${param_name}="${param_value}", + END + ${resp}= Execute Prometheus Instant Query ${prometheus_host} ${prometheus_port} query=${metric}{${filter}} + ${result_list}= Convert To List ${resp["data"]["result"]} + ${results}= Get Length ${result_list} + Should Not Be Equal As Numbers 0 ${results} msg=Metric ${metric} not found values=false + Should Be Equal As Integers 1 ${results} msg=Metric ${metric} with multiple values values=false + [Return] ${result_list[0]["value"][1]} + + +Execute Prometheus Instant Query + [Documentation] Execute a Prometheus Instant Query using HTTP API. + ... Return an inline json with the result of the query. + ... The requested URL is the next: http://\${prometheus_ip}:\${prometheus_port}/api/v1/query?\${querystring} + + [Arguments] ${prometheus_ip} ${prometheus_port} ${querystring} + + Create Session prometheus http://${prometheus_ip}:${prometheus_port} timeout=${timeout} max_retries=${max_retries} + ${resp}= Get Request prometheus /api/v1/query?${querystring} timeout=${timeout} + Status Should Be 200 ${resp} + [Return] ${resp.json()} diff --git a/robot-systest/lib/ssh_lib.robot b/robot-systest/lib/ssh_lib.robot new file mode 100644 index 0000000..23e5ae4 --- /dev/null +++ b/robot-systest/lib/ssh_lib.robot @@ -0,0 +1,69 @@ +# 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. + +*** Keywords *** +Test SSH Connection + [Arguments] ${host} ${username} ${password} ${privatekey} + + Open Connection ${host} + Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} + ... ELSE Login With Public Key ${username} ${privatekey} + Execute Command hostname + Close All Connections + +Check If remote File Exists + [Arguments] ${host} ${username} ${password} ${privatekey} ${file} + + Open Connection ${host} + Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} + ... ELSE Login With Public Key ${username} ${privatekey} + ${rc}= Execute Command ls ${file} >& /dev/null return_stdout=False return_rc=True + Close All Connections + Should Be Equal As Integers ${rc} 0 + +Get Remote File Content + [Arguments] ${host} ${username} ${password} ${privatekey} ${file} + + Open Connection ${host} + Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} + ... ELSE Login With Public Key ${username} ${privatekey} + ${output}= Execute Command cat ${file} + Close All Connections + [Return] ${output} + +Ping Many + [Arguments] ${host} ${username} ${password} ${privatekey} @{ip_list} + + Open Connection ${host} + Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} + ... ELSE Login With Public Key ${username} ${privatekey} + FOR ${ip} IN @{ip_list} + ${result}= Execute Command ping -c 5 -W 1 ${ip} > /dev/null && echo OK shell=True + Log ${result} + Should Contain ${result} OK + END + Close All Connections + + +Execute Remote Command Check Rc Return Output + [Arguments] ${host} ${username} ${password} ${privatekey} ${command} + + Open Connection ${host} + Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} + ... ELSE Login With Public Key ${username} ${privatekey} + ${stdout} ${rc}= Execute Command ${command} return_rc=True return_stdout=True + log ${rc} + log ${stdout} + Close All Connections + Should Be Equal As Integers ${rc} 0 + [Return] ${stdout} + diff --git a/robot-systest/lib/vim_lib.robot b/robot-systest/lib/vim_lib.robot new file mode 100644 index 0000000..b6c452f --- /dev/null +++ b/robot-systest/lib/vim_lib.robot @@ -0,0 +1,93 @@ +# 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. + +*** Settings *** +Documentation Library to manage VIM Targets. + +Library String +Library Collections +Library OperatingSystem + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot + + +*** Variables *** +${success_return_code} 0 +${delete_max_wait_time} 1min +${delete_pol_time} 15sec +${vim_status_max_wait_time} 1min +${vim_status_pol_time} 15sec + + +*** Keywords *** +Create VIM Target + [Documentation] Create a VIM Target in OSM. + ... The optional parameters (such as 'config' or 'sdn_controller') are given to this function in name=value format. These parameters will be appended to the 'osm vim-create' command with the next syntax: --param_name=param_value + ... Return the ID of the created VIM Target. + ... Example of execution: + ... \${vim_account_id}= Create VIM Target \${vim_name} \${vim_user} \${vim_password} \${vim_auth_url} \${vim_tenant} \${vim_account_type} config='{...}' + + [Arguments] ${vim_name} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type} @{optional_parameters} + + ${osm_vim_create_command}= Set Variable osm vim-create --name ${vim_name} --user ${vim_user} --password ${vim_password} --auth_url ${vim_auth_url} --tenant ${vim_tenant} --account_type ${vim_account_type} + FOR ${param} IN @{optional_parameters} + ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters + ${osm_vim_create_command}= Catenate ${osm_vim_create_command} --${param_name}=${param_value} + END + ${rc} ${stdout}= Run and Return RC and Output ${osm_vim_create_command} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + +Delete VIM Target + [Arguments] ${vim_name} + + ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm vim-delete ${vim_name} + log ${stdout} + Wait Until Keyword Succeeds ${delete_max_wait_time} ${delete_pol_time} Check for VIM Target ${vim_name} + + +Get VIM Targets + ${rc} ${stdout}= Run and Return RC and Output osm vim-list + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Check for VIM Target + [Arguments] ${vim_name} + + ${rc} ${stdout}= Run and Return RC and Output osm vim-list | awk '{print $2}' | grep ${vim_name} + Should Not Be Equal As Strings ${stdout} ${vim_name} + + +Check for VIM Target Status + [Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} + + ${vim_account_id}= Get VIM Target ID ${vim_name} + Wait Until Keyword Succeeds ${vim_status_max_wait_time} ${vim_status_pol_time} Check If VIM Target Is Available ${vim_account_id} ${prometheus_host} ${prometheus_port} + + +Get VIM Target ID + [Arguments] ${vim_name} + + ${rc} ${stdout}= Run and Return RC and Output osm vim-list | grep " ${vim_name} " | awk '{print $4}' + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Be Equal As Strings ${stdout} ${EMPTY} msg=VIM Target '${vim_name}' not found values=false + [Return] ${stdout} + + +Check If VIM Target Is Available + [Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} + + ${metric}= Get Metric ${prometheus_host} ${prometheus_port} osm_vim_status vim_account_id=${vim_account_id} + Should Be Equal As Integers ${metric} 1 msg=VIM Target '${vim_account_id}' is not active values=false diff --git a/robot-systest/lib/vnfd_lib.robot b/robot-systest/lib/vnfd_lib.robot new file mode 100644 index 0000000..fdef1ac --- /dev/null +++ b/robot-systest/lib/vnfd_lib.robot @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- + +## +# Copyright 2019 Tech Mahindra Limited +# +# All Rights Reserved. +# +# 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. +## + +## Change log: +# 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-sep-2019 +## + +*** Settings *** +Library String + + +*** Variables *** +${success_return_code} 0 +${delete_max_wait_time} 1min +${delete_pol_time} 15sec + + +*** Keywords *** +Get VNFDs List + ${rc} ${stdout}= Run and Return RC and Output osm vnfd-list + log ${stdout} + log ${rc} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Create VNFD + [Arguments] ${vnfd_pkg} + + ${rc} ${stdout}= Run and Return RC and Output osm vnfd-create ${vnfd_pkg} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + ${lines}= Get Line Count ${stdout} + ${last}= Evaluate ${lines} - 1 + ${id}= Get Line ${stdout} ${last} + [Return] ${id} + + +Delete VNFD + [Arguments] ${vnfd_id} + + ${rc} ${stdout}= Run and Return RC and Output osm vnfd-delete ${vnfd_id} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id} + + +Check For VNFD + [Arguments] ${vnfd_id} + + ${rc} ${stdout}= Run and Return RC and Output osm vnfd-list | awk '{print $2}' | grep ${vnfd_id} + Should Not Be Equal As Strings ${stdout} ${vnfd_id} diff --git a/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py b/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py new file mode 100644 index 0000000..c30314e --- /dev/null +++ b/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py @@ -0,0 +1,46 @@ +# 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. + +import os +import yaml +from pathlib import Path + +# Prometheus host and port +prometheus_host = os.environ.get("OSM_HOSTNAME") +prometheus_port = "9091" + +# VIM Configuration +vim_account_type = "openstack" +vim_name_prefix = "basic_01_vim_test" +# Get credentias from Openstack Clouds file +os_cloud = os.environ.get("OS_CLOUD") +clouds_file_paths = ["./clouds.yaml", str(Path.home()) + "/.config/openstack/clouds.yaml", "/etc/openstack/clouds.yaml"] +for path in clouds_file_paths: + clouds_file_path = Path(path) + if clouds_file_path.exists(): break +if not clouds_file_path.exists(): raise Exception("Openstack clouds file not found") +with clouds_file_path.open() as clouds_file: + clouds = yaml.safe_load(clouds_file) + if not os_cloud in clouds["clouds"]: raise Exception("Openstack cloud '" + os_cloud + "' not found") + cloud = clouds["clouds"][os_cloud] + if not "username" in cloud["auth"]: raise Exception("Username not found in Openstack cloud '" + os_cloud + "'") + vim_user = cloud["auth"]["username"] + if not "password" in cloud["auth"]: raise Exception("Password not found in Openstack cloud '" + os_cloud + "'") + vim_password = cloud["auth"]["password"] + if not "auth_url" in cloud["auth"]: raise Exception("Auth url not found in Openstack cloud '" + os_cloud + "'") + vim_auth_url = cloud["auth"]["auth_url"] + if not "project_name" in cloud["auth"]: raise Exception("Project name not found in Openstack cloud '" + os_cloud + "'") + vim_tenant = cloud["auth"]["project_name"] + vim_user_domain_name = cloud["auth"]["user_domain_name"] if "user_domain_name" in cloud["auth"] else "Default" + vim_project_domain_name = cloud["auth"]["project_domain_name"] if "project_domain_name" in cloud["auth"] else "Default" +# Extra config +vim_config = "'{project_domain_name: " + vim_project_domain_name + ", user_domain_name: " + vim_user_domain_name + ", vim_network_name: " + os.environ.get("VIM_MGMT_NET") + "}'" diff --git a/robot-systest/resources/basic_05-instantiation_parameters_in_cloud_init_data.py b/robot-systest/resources/basic_05-instantiation_parameters_in_cloud_init_data.py new file mode 100644 index 0000000..d4e5312 --- /dev/null +++ b/robot-systest/resources/basic_05-instantiation_parameters_in_cloud_init_data.py @@ -0,0 +1,24 @@ +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# NS and VNF descriptor package folder +vnfd_pkg = 'ubuntu_cloudinit_vnf' +nsd_pkg = 'ubuntu_cloudinit_ns' +# NS and VNF descriptor id +vnfd_name = 'ubuntu_cloudinit-vnf' +nsd_name = 'ubuntu_cloudinit-ns' +# NS instance name +ns_name = 'basic_05_instantiation_params_cloud_init' diff --git a/robot-systest/resources/basic_06-vnf_with_charm_data.py b/robot-systest/resources/basic_06-vnf_with_charm_data.py new file mode 100644 index 0000000..c1a154c --- /dev/null +++ b/robot-systest/resources/basic_06-vnf_with_charm_data.py @@ -0,0 +1,27 @@ +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# NS and VNF descriptor package folder +vnfd_pkg = 'hackfest_proxycharm_vnf' +nsd_pkg = 'hackfest_proxycharm_ns' +# NS and VNF descriptor id +vnfd_name = 'hackfest_proxycharm-vnf' +nsd_name = 'hackfest_proxycharm-ns' +# NS instance name +ns_name = 'basic_06_charm_test' +# SSH keys to be used +publickey = home + '/.ssh/id_rsa.pub' +privatekey = home + '/.ssh/id_rsa' diff --git a/robot-systest/resources/basic_07-secure_key_management_data.py b/robot-systest/resources/basic_07-secure_key_management_data.py new file mode 100644 index 0000000..8bd8b38 --- /dev/null +++ b/robot-systest/resources/basic_07-secure_key_management_data.py @@ -0,0 +1,24 @@ +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# NS and VNF descriptor package folder +vnfd_pkg = 'simple_nopasswd_vnf' +nsd_pkg = 'simple_nopasswd_ns' +# NS and VNF descriptor id +vnfd_name = 'simple_nopasswd-vnf' +nsd_name = 'simple_nopasswd-ns' +# NS instance name +ns_name = 'basic_07_secure_key_management' diff --git a/robot-systest/resources/basic_09-manual_vdu_scaling_data.py b/robot-systest/resources/basic_09-manual_vdu_scaling_data.py new file mode 100644 index 0000000..31b45a2 --- /dev/null +++ b/robot-systest/resources/basic_09-manual_vdu_scaling_data.py @@ -0,0 +1,27 @@ +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# NS and VNF descriptor package folder +vnfd_pkg = 'hackfest_basic_metrics_vnf' +nsd_pkg = 'hackfest_basic_metrics_ns' +# NS and VNF descriptor id +vnfd_name = 'hackfest_basic_metrics-vnf' +nsd_name = 'hackfest_basic-ns-metrics' +# NS instance name +ns_name = 'basic_09_manual_scaling_test' +# SSH keys to be used +publickey = home + '/.ssh/id_rsa.pub' +privatekey = home + '/.ssh/id_rsa' diff --git a/robot-systest/resources/hackfest_basic_ns_data.py b/robot-systest/resources/hackfest_basic_ns_data.py new file mode 100644 index 0000000..0f927ed --- /dev/null +++ b/robot-systest/resources/hackfest_basic_ns_data.py @@ -0,0 +1,27 @@ +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# NS and VNF descriptor package folder +vnfd_pkg = 'hackfest_basic_vnf' +nsd_pkg = 'hackfest_basic_ns' +# NS and VNF descriptor package id +vnfd_name = 'hackfest_basic-vnf' +nsd_name = 'hackfest_basic-ns' +# NS instance name +ns_name = 'hfbasic' +# SSH keys to be used +publickey = home + '/.ssh/id_rsa.pub' +privatekey = home + '/.ssh/id_rsa' diff --git a/robot-systest/resources/hackfest_cloudinit_ns_data.py b/robot-systest/resources/hackfest_cloudinit_ns_data.py new file mode 100644 index 0000000..d914c49 --- /dev/null +++ b/robot-systest/resources/hackfest_cloudinit_ns_data.py @@ -0,0 +1,27 @@ +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# NS and VNF descriptor package folder +vnfd_pkg = 'hackfest_cloudinit_vnf' +nsd_pkg = 'hackfest_cloudinit_ns' +# NS and VNF descriptor package id +vnfd_name = 'hackfest_cloudinit-vnf' +nsd_name = 'hackfest_cloudinit-ns' +# NS instance name +ns_name = 'hfcloudinit' +# SSH keys to be used +publickey = home + '/.ssh/id_rsa.pub' +privatekey = home + '/.ssh/id_rsa' diff --git a/robot-systest/resources/hackfest_multivdu_ns_data.py b/robot-systest/resources/hackfest_multivdu_ns_data.py new file mode 100644 index 0000000..7c75b67 --- /dev/null +++ b/robot-systest/resources/hackfest_multivdu_ns_data.py @@ -0,0 +1,27 @@ +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# NS and VNF descriptor package folder +vnfd_pkg = 'hackfest_multivdu_vnf' +nsd_pkg = 'hackfest_multivdu_ns' +# NS and VNF descriptor package id +vnfd_name = 'hackfest_multivdu-vnf' +nsd_name = 'hackfest_multivdu-ns' +# NS instance name +ns_name = 'hfmultivdu' +# SSH keys to be used +publickey = home + '/.ssh/id_rsa.pub' +privatekey = home + '/.ssh/id_rsa' diff --git a/robot-systest/resources/k8s_03-simple_k8s_data.py b/robot-systest/resources/k8s_03-simple_k8s_data.py new file mode 100644 index 0000000..4ecfe59 --- /dev/null +++ b/robot-systest/resources/k8s_03-simple_k8s_data.py @@ -0,0 +1,30 @@ +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# K8s cluster name +k8scluster_name = 'k8s-test' +k8scluster_version = 'v1' +# NS and VNF descriptor package files +vnfd_pkg = 'hackfest_simple_k8s_vnfd.tar.gz' +nsd_pkg = 'hackfest_simple_k8s_nsd.tar.gz' +# NS and VNF descriptor package files +vnfd_name = 'hackfest-simple-k8s-vnfd' +nsd_name = 'hackfest-simple-k8s-nsd' +# NS instance name +ns_name = 'simple-k8s' +# SSH keys to be used +publickey = home + '/.ssh/id_rsa.pub' +privatekey = home + '/.ssh/id_rsa' diff --git a/robot-systest/resources/slice_01-network_slicing_data.py b/robot-systest/resources/slice_01-network_slicing_data.py new file mode 100644 index 0000000..cc64eed --- /dev/null +++ b/robot-systest/resources/slice_01-network_slicing_data.py @@ -0,0 +1,37 @@ +# Copyright 2020 Atos +# +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# NS and VNF descriptor package files +vnfd1_pkg = 'slice_basic_vnf' +vnfd2_pkg = 'slice_basic_middle_vnf' +nsd1_pkg = 'slice_basic_ns' +nsd2_pkg = 'slice_basic_middle_ns' +nst = 'slice_basic_nst/slice_basic_nst.yaml' +# Instance names +slice_name = 'slicebasic' +middle_ns_name = 'slicebasic.slice_basic_nsd_2' +# Descriptor names +nst_name = 'slice_basic_nst' +vnfd1_name = 'slice_basic_vnf' +vnfd2_name = 'slice_basic_middle_vnf' +nsd1_name = 'slice_basic_ns' +nsd2_name = 'slice_basic_middle_ns' +# SSH keys to be used +publickey = home + '/.ssh/id_rsa.pub' +privatekey = home + '/.ssh/id_rsa' + diff --git a/robot-systest/resources/slice_02-shared_network_slicing_data.py b/robot-systest/resources/slice_02-shared_network_slicing_data.py new file mode 100644 index 0000000..d6358a2 --- /dev/null +++ b/robot-systest/resources/slice_02-shared_network_slicing_data.py @@ -0,0 +1,40 @@ +# Copyright 2020 Atos +# +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# NS and VNF descriptor package files +vnfd1_pkg = 'slice_basic_vnf' +vnfd2_pkg = 'slice_basic_middle_vnf' +nsd1_pkg = 'slice_basic_ns' +nsd2_pkg = 'slice_basic_middle_ns' +nst = 'slice_basic_nst/slice_basic_nst.yaml' +nst2 = 'slice_basic_nst/slice_basic_2nd_nst.yaml' +# Instance names +slice_name = 'slicebasic' +slice2_name = 'sliceshared' +middle_ns_name = 'slicebasic.slice_basic_nsd_2' +# Descriptor names +nst_name = 'slice_basic_nst' +nst2_name = 'slice_basic_nst2' +vnfd1_name = 'slice_basic_vnf' +vnfd2_name = 'slice_basic_middle_vnf' +nsd1_name = 'slice_basic_ns' +nsd2_name = 'slice_basic_middle_ns' +# SSH keys to be used +publickey = home + '/.ssh/id_rsa.pub' +privatekey = home + '/.ssh/id_rsa' + diff --git a/robot-systest/resources/slice_02-shared_ns_data.py b/robot-systest/resources/slice_02-shared_ns_data.py new file mode 100644 index 0000000..2170b57 --- /dev/null +++ b/robot-systest/resources/slice_02-shared_ns_data.py @@ -0,0 +1,39 @@ +# Copyright 2020 Atos +# +# 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. + +from pathlib import Path + +# Get ${HOME} from local machine +home = str(Path.home()) +# NS and VNF descriptor package files +vnfd1_pkg = 'slice_hackfest_vnf.tar.gz' +vnfd2_pkg = 'slice_hackfest_middle_vnfd.tar.gz' +nsd1_pkg = 'slice_hackfest_ns.tar.gz' +nsd2_pkg = 'slice_hackfest_middle_nsd.tar.gz' +nst = 'slice_hackfest_nst.yaml' +nst2 = 'slice_hackfest2_nst.yaml' +# Instance names +slice_name = 'slicehfbasic' +slice2_name = 'sliceshared' +middle_ns_name = 'slicehfbasic.slice_hackfest_nsd_2' +# Descriptor names +nst_name = 'slice_hackfest_nst' +nst2_name = 'slice_hackfest2_nst' +vnfd1_name = 'slice_hackfest_vnf' +vnfd2_name = 'slice_hackfest_middle_vnf' +nsd1_name = 'slice_hackfest_ns' +nsd2_name = 'slice_hackfest_middle_ns' +# SSH keys to be used +publickey = home + '/.ssh/id_rsa.pub' +privatekey = home + '/.ssh/id_rsa' diff --git a/robot-systest/run_test.sh b/robot-systest/run_test.sh new file mode 100755 index 0000000..7a05681 --- /dev/null +++ b/robot-systest/run_test.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash + +## +# Copyright 2020 ATOS +# +# All Rights Reserved. +# +# 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. +## + +cat /dev/zero | ssh-keygen -q -N "" > /dev/null + +install_osmclient(){ + echo -e "\nInstalling osmclient ${OSMCLIENT}" + python3 -m pip install git+https://osm.etsi.org/gerrit/osm/osmclient@${OSMCLIENT} +} + +download_packages(){ + echo -e "\nDownloading packages ${PACKAGES}" + rm -rf ${PACKAGES_FOLDER} + git clone https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git ${PACKAGES_FOLDER} && (cd ${PACKAGES_FOLDER} && \ + git checkout ${PACKAGES}) +} + +PARAMS="" + +while (( "$#" )); do + case "$1" in + -t|--testingtags) + TEST=$2 + shift 2 + ;; + -p|--packagesbranch) + PACKAGES=$2 && download_packages + shift 2 + ;; + -o|--osmclientversion) + OSMCLIENT=$2 install_osmclient + shift 2 + ;; + -h|--help) + echo "OSM TESTS TOOL + +Usage: + docker run --rm=true -t osmtests --env-file \\ + -v :/reports osmtests -v :/robot-systest/clouds.yaml \\ + -v :/robot-systest/kubeconfig.yaml \\ + -o -p -t + +Options: + --env-file: It is the environmental file where is described the OSM target and VIM + -o [OPTIONAL]: It is used to specify a particular osmclient version. Default: latest + -p [OPTIONAL]: OSM packages repository branch. Default: master + -t [OPTIONAL]: Robot tests tags. [sanity, regression, particular_test]. Default: sanity + +Volumes: + [OPTIONAL]: It is the absolute path to reports location in the host + [OPTIONAL]: It is the absolute path to the clouds.yaml file in the host" + + exit 0 + ;; + -*|--*=) + echo "Error: Unsupported flag $1" >&2 + exit 1 + ;; + *) + PARAMS="$PARAMS $1" + shift + ;; + esac +done + +eval set -- "$PARAMS" + +if [[ -z $TEST ]]; then + printf "Test not provided. \nRunning default test: sanity\n" + TEST="sanity" +fi + + +if [[ -n "$TEST" ]]; then + robot -d ${ROBOT_DEVOPS_FOLDER}/reports -i ${TEST} ${ROBOT_DEVOPS_FOLDER}/testsuite/ + exit 0 +else + echo "Wrong test provided" + exit 1 +fi + +exit 1 diff --git a/robot-systest/testsuite/basic_01-crud_operations_on_vim_targets.robot b/robot-systest/testsuite/basic_01-crud_operations_on_vim_targets.robot new file mode 100644 index 0000000..d848bd8 --- /dev/null +++ b/robot-systest/testsuite/basic_01-crud_operations_on_vim_targets.robot @@ -0,0 +1,67 @@ +# 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. + +*** Settings *** +Documentation [BASIC-01] CRUD operations on VIM targets. +... All tests will be performed over an Openstack VIM, and the credentials will be loaded from clouds.yaml file. + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_01-crud_operations_on_vim_targets_data.py + + +*** Test Cases *** +Create VIM Target Basic + [Documentation] Create a VIM Target only with the mandatory parameters. + ... Checks the status of the VIM in Prometheus after it creation. + [Tags] vim sanity regression + + ${rand}= Generate Random String 8 [NUMBERS] + ${vim_name}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand} + Set Suite Variable ${vim_name} + ${created_vim_account_id}= Create VIM Target ${vim_name} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type} + Set Suite Variable ${created_vim_account_id} + Check for VIM Target Status ${vim_name} ${prometheus_host} ${prometheus_port} + + +Delete VIM Target By Name + [Documentation] Delete the VIM Target created in previous test-case by its name. + ... Checks whether the VIM Target was created or not before perform the deletion. + [Tags] vim sanity regression cleanup + + ${vim_account_id}= Get VIM Target ID ${vim_name} + Should Be Equal As Strings ${vim_account_id} ${created_vim_account_id} + Delete VIM Target ${vim_name} + + +Create VIM Target With Extra Config + [Documentation] Create a VIM Target using the extra parameter 'config'. + ... Checks the status of the VIM in Prometheus after it creation. + [Tags] vim sanity regression + + ${rand}= Generate Random String 8 [NUMBERS] + ${vim_name}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand} + Set Suite Variable ${vim_name} + ${created_vim_account_id}= Create VIM Target ${vim_name} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type} config=${vim_config} + Set Suite Variable ${created_vim_account_id} + Check for VIM Target Status ${vim_name} ${prometheus_host} ${prometheus_port} + + +Delete VIM Target By ID + [Documentation] Delete the VIM Target created in previous test-case by its ID. + ... Checks whether the VIM Target was created or not before perform the deletion. + [Tags] vim sanity regression cleanup + + ${vim_account_id}= Get VIM Target ID ${vim_name} + Should Be Equal As Strings ${vim_account_id} ${created_vim_account_id} + Delete VIM Target ${vim_account_id} + diff --git a/robot-systest/testsuite/basic_05-instantiation_parameters_in_cloud_init.robot b/robot-systest/testsuite/basic_05-instantiation_parameters_in_cloud_init.robot new file mode 100644 index 0000000..22cee7c --- /dev/null +++ b/robot-systest/testsuite/basic_05-instantiation_parameters_in_cloud_init.robot @@ -0,0 +1,101 @@ +# 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. + +*** Settings *** +Documentation [BASIC-05] Instantiation parameters in cloud-init. + +Library OperatingSystem +Library SSHLibrary + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_05-instantiation_parameters_in_cloud_init_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +${username} ubuntu +${new_password} newpassword +${vnf_member_index} 1 +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], additionalParamsForVnf: [ { member-vnf-index: "${vnf_member_index}", additionalParams: { password: "${new_password}" } } ] } + + +*** Test Cases *** +Create Cloudinit VNF Descriptor + [Tags] instantiation_params sanity regression + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + + +Create Cloudinit NS Descriptor + [Tags] instantiation_params sanity regression + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + + +Instantiate Cloudinit Network Service Using Instantiation Parameters + [Documentation] Instantiates the NS using the instantiation parameter 'additionalParamsForVnf' to change the password of the default user. + [Tags] instantiation_params sanity regression + + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${EMPTY} + Set Suite Variable ${ns_id} ${id} + + +Get Management Ip Addresses + [Tags] instantiation_params sanity regression + + ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + log ${ip_addr} + Set Suite Variable ${vnf_ip_addr} ${ip_addr} + + +Test SSH Access With The New Password + [Documentation] Test SSH access with the new password configured via cloud-init. + [Tags] instantiation_params sanity regression + + Variable Should Exist ${vnf_ip_addr} msg=IP address of the management VNF is not available + Sleep 30s Waiting ssh daemon to be up + Test SSH Connection ${vnf_ip_addr} ${username} ${new_password} ${EMPTY} + + +Delete NS Instance + [Tags] instantiation_params sanity regression cleanup + + Delete NS ${ns_name} + + +Delete NS Descriptor + [Tags] instantiation_params sanity regression cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor + [Tags] instantiation_params sanity regression cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance + + Run Keyword If Test Failed Delete NS ${ns_name} + + Run Keyword If Test Failed Delete NSD ${nsd_name} + + Run Keyword If Test Failed Delete VNFD ${vnfd_name} + diff --git a/robot-systest/testsuite/basic_06-vnf_with_charm.robot b/robot-systest/testsuite/basic_06-vnf_with_charm.robot new file mode 100644 index 0000000..25e32c8 --- /dev/null +++ b/robot-systest/testsuite/basic_06-vnf_with_charm.robot @@ -0,0 +1,136 @@ +# 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. + +*** Settings *** +Documentation [BASIC-06] VNF with Charm. + +Library OperatingSystem +Library SSHLibrary + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_06-vnf_with_charm_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +${username} ubuntu +${password} ${EMPTY} +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${action_name} touch +${vnf_member_index_1} 1 +${vnf_member_index_2} 2 +${day_1_file_name} /home/ubuntu/first-touch +${day_2_file_name_1} /home/ubuntu/mytouch1 +${day_2_file_name_2} /home/ubuntu/mytouch2 +${ns_timeout} 15min + + +*** Test Cases *** +Create Charm VNF Descriptor + [Tags] charm sanity regression + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + + +Create Charm NS Descriptor + [Tags] charm sanity regression + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + + +Instantiate Charm Network Service + [Tags] charm sanity regression + + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} + Set Suite Variable ${ns_id} ${id} + + +Get Management Ip Addresses + [Tags] charm sanity regression + + ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} + log ${ip_addr_1} + Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1} + ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} + log ${ip_addr_2} + Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2} + + +Test SSH Access + [Tags] charm sanity regression + + Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available + Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available + Sleep 30s Waiting ssh daemon to be up + Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey} + Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey} + + +Check Remote Files Created Via Day 1 Operations + [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}. + ... This test checks whether that files have been created or not. + [Tags] charm sanity regression + + Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} + Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} + + +Execute Day 2 Operations + [Documentation] Performs one Day 2 operation per VNF that creates a new file. + [Tags] charm sanity regression + + Variable Should Exist ${ns_id} msg=Network service instance is not available + ${ns_op_id_1}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_1} filename=${day_2_file_name_1} + ${ns_op_id_2}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_2} filename=${day_2_file_name_2} + + +Check Remote Files Created Via Day 2 Operations + [Documentation] Check whether the files created in the previous test via Day 2 operations exist or not. + [Tags] charm sanity regression + + Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_1} + Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_2} + + +Delete NS Instance + [Tags] charm sanity regression cleanup + + Delete NS ${ns_name} + + +Delete NS Descriptor + [Tags] charm sanity regression cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor + [Tags] charm sanity regression cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance + + Run Keyword If Test Failed Delete NS ${ns_name} + + Run Keyword If Test Failed Delete NSD ${nsd_name} + + Run Keyword If Test Failed Delete VNFD ${vnfd_name} + diff --git a/robot-systest/testsuite/basic_07-secure_key_management.robot b/robot-systest/testsuite/basic_07-secure_key_management.robot new file mode 100644 index 0000000..1cf5bb0 --- /dev/null +++ b/robot-systest/testsuite/basic_07-secure_key_management.robot @@ -0,0 +1,126 @@ +# 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. + +*** Settings *** +Documentation [BASIC-07] Secure key management. + +Library OperatingSystem +Library SSHLibrary + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_07-secure_key_management_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +${username} ubuntu +${password} osm4u +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${action_name} touch +${vnf_member_index} 1 +${day_1_file_name} /home/ubuntu/first-touch +${day_2_file_name} /home/ubuntu/mytouch1 +${ns_timeout} 15min + + +*** Test Cases *** +Create Nopasswd Charm VNF Descriptor + [Tags] nopasswd sanity regression + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + + +Create Nopasswd Charm NS Descriptor + [Tags] nopasswd sanity regression + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + + +Instantiate Nopasswd Charm Network Service + [Tags] nopasswd sanity regression + + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${EMPTY} ${ns_timeout} + Set Suite Variable ${ns_id} ${id} + + +Get Management Ip Addresses + [Tags] nopasswd sanity regression + + ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + log ${ip_addr} + Set Suite Variable ${vnf_ip_addr} ${ip_addr} + + +Test SSH Access + [Tags] nopasswd sanity regression + + Variable Should Exist ${vnf_ip_addr} msg=IP address of the management VNF is not available + Sleep 30s Waiting ssh daemon to be up + Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${EMPTY} + + +Check Remote Files Created Via Day 1 Operations + [Documentation] The Nopasswd VNF has a Day 1 operation that creates a file named ${day_1_file_name} and performs it without password. + ... This test checks whether that files have been created or not. + [Tags] nopasswd sanity regression + + Check If remote File Exists ${vnf_ip_addr} ${username} ${password} ${EMPTY} ${day_1_file_name} + + +Execute Day 2 Operations + [Documentation] Performs one Day 2 operation that creates a new file, this action is executed without password too. + [Tags] nopasswd sanity regression + + Variable Should Exist ${ns_id} msg=Network service instance is not available + ${ns_op_id}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index} filename=${day_2_file_name} + + +Check Remote Files Created Via Day 2 Operations + [Documentation] Check whether the file created in the previous test via Day 2 operation exists or not. + [Tags] nopasswd sanity regression + + Check If remote File Exists ${vnf_ip_addr} ${username} ${password} ${EMPTY} ${day_2_file_name} + + +Delete NS Instance + [Tags] nopasswd sanity regression cleanup + + Delete NS ${ns_name} + + +Delete NS Descriptor + [Tags] nopasswd sanity regression cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor + [Tags] nopasswd sanity regression cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance + + Run Keyword If Test Failed Delete NS ${ns_name} + + Run Keyword If Test Failed Delete NSD ${nsd_name} + + Run Keyword If Test Failed Delete VNFD ${vnfd_name} + diff --git a/robot-systest/testsuite/basic_09-manual_vdu_scaling.robot b/robot-systest/testsuite/basic_09-manual_vdu_scaling.robot new file mode 100644 index 0000000..b81e70f --- /dev/null +++ b/robot-systest/testsuite/basic_09-manual_vdu_scaling.robot @@ -0,0 +1,138 @@ +# 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. + +*** Settings *** +Documentation [BASIC-09] Manual VNF/VDU Scaling. + +Library OperatingSystem +Library String +Library Collections + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_09-manual_vdu_scaling_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${scaling_group} vdu_autoscale +${vnf_member_index} 1 + + +*** Test Cases *** +Create Scaling VNF Descriptor + [Tags] manual_scaling sanity regression + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + + +Create Scaling NS Descriptor + [Tags] manual_scaling sanity regression + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + + +Instantiate Scaling Network Service + [Tags] manual_scaling sanity regression + + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + Set Suite Variable ${ns_id} ${id} + + +Get Vnf Id + [Tags] manual_scaling sanity regression + + Variable Should Exist ${ns_id} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + Log List ${vnfr_list} + Set Suite Variable ${vnf_id} ${vnfr_list}[0] + + +Get Vdus Before Scale Out + [Documentation] Get the number of VDU records before the manual scaling. + [Tags] manual_scaling sanity regression + + @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + Log List ${vdur_list} + ${vdurs}= Get Length ${vdur_list} + Set Suite Variable ${initial_vdur_count} ${vdurs} + + +Perform Manual Vdu Scale Out + [Tags] manual_scaling sanity regression + + Variable Should Exist ${ns_id} msg=Network service instance is not available + ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT + + +Check Vdus After Scale Out + [Documentation] Check whether there is one more VDU after scaling or not. + [Tags] manual_scaling sanity regression + + Variable Should Exist ${ns_id} msg=Network service instance is not available + @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + Log List ${vdur_list} + ${vdurs}= Get Length ${vdur_list} + Run Keyword Unless ${vdurs} == ${initial_vdur_count} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out + + +Perform Manual Vdu Scale In + [Tags] manual_scaling sanity regression + + Variable Should Exist ${ns_id} msg=Network service instance is not available + ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN + + +Check Vdus After Scaling In + [Documentation] Check whether there is one less VDU after scaling or not. + [Tags] manual_scaling sanity regression + + Variable Should Exist ${ns_id} msg=Network service instance is not available + @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + Log List ${vdur_list} + ${vdurs}= Get Length ${vdur_list} + Run Keyword Unless ${vdurs} == ${initial_vdur_count} Fail msg=There is the same number of VDU records in the VNF after Scale In + + +Delete NS Instance + [Tags] manual_scaling sanity regression cleanup + + Delete NS ${ns_name} + + +Delete NS Descriptor + [Tags] manual_scaling sanity regression cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor + [Tags] manual_scaling sanity regression cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance + + Run Keyword If Test Failed Delete NS ${ns_name} + + Run Keyword If Test Failed Delete NSD ${nsd_name} + + Run Keyword If Test Failed Delete VNFD ${vnfd_name} + diff --git a/robot-systest/testsuite/hackfest_basic.robot b/robot-systest/testsuite/hackfest_basic.robot new file mode 100644 index 0000000..c3f9068 --- /dev/null +++ b/robot-systest/testsuite/hackfest_basic.robot @@ -0,0 +1,103 @@ +# 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. + +*** Settings *** +Library OperatingSystem +Library String +Library Collections +Library Process +Library SSHLibrary + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/hackfest_basic_ns_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +${ns_id} ${EMPTY} +${username} ubuntu +${password} ${EMPTY} +${vnf_member_index} 1 +${vnf_ip_addr} ${EMPTY} +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +# ${ns_config} ${EMPTY} + +*** Test Cases *** +Create Hackfest Basic VNF Descriptor + [Tags] hackfest_basic sanity regression + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + + +Create Hackfest Basic NS Descriptor + [Tags] hackfest_basic sanity regression + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + +Network Service Instance Test + [Tags] hackfest_basic sanity regression + + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + Set Suite Variable ${ns_id} ${id} + + +Get Vnf Ip Address + [Tags] hackfest_basic sanity regression + + ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + log ${ip_addr} + Set Suite Variable ${vnf_ip_addr} ${ip_addr} + +Test Ping + [Tags] hackfest_basic sanity regression + Test Connectivity ${vnf_ip_addr} + +Test SSH Access + [Tags] hackfest_basic sanity regression + Sleep 30s Waiting ssh daemon to be up + Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${privatekey} + +Delete NS Instance Test + [Tags] hackfest_basic sanity regression cleanup + + Delete NS ${ns_name} + + +Delete NS Descriptor Test + [Tags] hackfest_basic sanity regression cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor Test + [Tags] hackfest_basic sanity regression cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim + + Run Keyword If Test Failed Delete NS ${ns_name} + + Run Keyword If Test Failed Delete NSD ${nsd_name} + + Run Keyword If Test Failed Delete VNFD ${vnfd_name} + + diff --git a/robot-systest/testsuite/hackfest_cloudinit.robot b/robot-systest/testsuite/hackfest_cloudinit.robot new file mode 100644 index 0000000..693348e --- /dev/null +++ b/robot-systest/testsuite/hackfest_cloudinit.robot @@ -0,0 +1,110 @@ +# 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. + +*** Settings *** +Library OperatingSystem +Library String +Library Collections +Library Process +Library SSHLibrary + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/hackfest_cloudinit_ns_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +${ns_id} ${EMPTY} +${username} ubuntu +${password} ${EMPTY} +${vnf_member_index} 1 +${vnf_ip_addr} ${EMPTY} +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +# ${ns_config} ${EMPTY} + +*** Test Cases *** +Create Hackfest Cloudinit VNF Descriptor + [Tags] hackfest_cloudinit sanity regression + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + + +Create Hackfest Cloudinit NS Descriptor + [Tags] hackfest_cloudinit sanity regression + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + + +Network Service Instance Test + [Tags] hackfest_cloudinit sanity regression + + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + Set Suite Variable ${ns_id} ${id} + + +Get Vnf Ip Address + [Tags] hackfest_cloudinit sanity regression + + ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + log ${ip_addr} + Set Suite Variable ${vnf_ip_addr} ${ip_addr} + + +Test SSH Access + [Tags] hackfest_cloudinit sanity regression + + Sleep 30s Waiting ssh daemon to be up + Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${privatekey} + + +Check Remote File Injected Via Cloud-init + [Tags] hackfest_cloudinit sanity regression + + ${stdout}= Execute Remote Command Check Rc Return Output ${vnf_ip_addr} ${username} ${password} ${privatekey} sudo cat /root/helloworld.txt + log ${stdout} + + +Delete NS Instance Test + [Tags] hackfest_cloudinit sanity regression cleanup + + Delete NS ${ns_name} + + +Delete NS Descriptor Test + [Tags] hackfest_cloudinit sanity regression cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor Test + [Tags] hackfest_cloudinit sanity regression cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim + + Run Keyword If Test Failed Delete NS ${ns_name} + + Run Keyword If Test Failed Delete NSD ${nsd_name} + + Run Keyword If Test Failed Delete VNFD ${vnfd_name} + + diff --git a/robot-systest/testsuite/hackfest_multivdu.robot b/robot-systest/testsuite/hackfest_multivdu.robot new file mode 100644 index 0000000..5bbdd10 --- /dev/null +++ b/robot-systest/testsuite/hackfest_multivdu.robot @@ -0,0 +1,105 @@ +# 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. + +*** Settings *** +Library OperatingSystem +Library String +Library Collections +Library Process +Library SSHLibrary + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/hackfest_multivdu_ns_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +${ns_id} ${EMPTY} +${username} osm +${password} osm4u +${vnf_member_index} 1 +${vnf_ip_addr} ${EMPTY} +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${wait_guard_for_vm_boot} 50s +# ${ns_config} ${EMPTY} + +*** Test Cases *** +Create Hackfest multivdu VNF Descriptor + [Tags] hackfest_multivdu sanity regression + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + + +Create Hackfest Multivdu NS Descriptor + [Tags] hackfest_multivdu sanity regression + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + +Network Service Instance Test + [Tags] hackfest_multivdu sanity regression + + ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${publickey} + Run Keyword If "${status}" == "FAIL" Set Global Variable ${publickey} ${EMPTY} + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + Set Suite Variable ${ns_id} ${id} + Sleep ${wait_guard_for_vm_boot} Waiting for VM's daemons to be up and running + +Get Vnf Ip Address + [Tags] hackfest_multivdu sanity regression + + ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + log ${ip_addr} + Set Suite Variable ${vnf_ip_addr} ${ip_addr} + +Test Ping + [Tags] hackfest_multivdu sanity regression + Test Connectivity ${vnf_ip_addr} + +Test SSH Access + [Tags] hackfest_multivdu sanity regression + ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${privatekey} + Run Keyword If "${status}" == "FAIL" Set Global Variable ${privatekey} ${EMPTY} + Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${privatekey} + +Delete NS Instance Test + [Tags] hackfest_multivdu sanity regression cleanup + + Delete NS ${ns_name} + + +Delete NS Descriptor Test + [Tags] hackfest_multivdu sanity regression cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor Test + [Tags] hackfest_multivdu sanity regression cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim + + Run Keyword If Test Failed Delete NS ${ns_name} + + Run Keyword If Test Failed Delete NSD ${nsd_name} + + Run Keyword If Test Failed Delete VNFD ${vnfd_name} diff --git a/robot-systest/testsuite/k8s_03-simple_k8s.robot b/robot-systest/testsuite/k8s_03-simple_k8s.robot new file mode 100644 index 0000000..6fd6551 --- /dev/null +++ b/robot-systest/testsuite/k8s_03-simple_k8s.robot @@ -0,0 +1,78 @@ +# 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. + +*** Settings *** +Library OperatingSystem +Library String +Library Collections +Library Process + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/k8s_03-simple_k8s_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +${ns_id} ${EMPTY} +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${publickey} ${EMPTY} + +*** Test Cases *** +Create Simple K8s VNF Descriptor + [Tags] simple_k8s + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + +Create Simple K8s Descriptor + [Tags] simple_k8s + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + +Add K8s Cluster To OSM + [Tags] k8scluster + Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name} + +Network Service K8s Instance Test + [Tags] simple_k8s + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + Set Suite Variable ${ns_id} ${id} + +Delete NS K8s Instance Test + [Tags] simple_k8s cleanup + Delete NS ${ns_name} + +Remove K8s Cluster from OSM + [Tags] k8scluster + Delete K8s Cluster ${k8scluster_name} + +Delete NS Descriptor Test + [Tags] simple_k8s cleanup + Delete NSD ${nsd_name} + +Delete VNF Descriptor Test + [Tags] simple_k8s cleanup + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim + Run Keyword If Test Failed Delete NS ${ns_name} + Run Keyword If Test Failed Delete NSD ${nsd_name} + Run Keyword If Test Failed Delete VNFD ${vnfd_name} + + diff --git a/robot-systest/testsuite/slice_01-network_slicing.robot b/robot-systest/testsuite/slice_01-network_slicing.robot new file mode 100644 index 0000000..2f531cb --- /dev/null +++ b/robot-systest/testsuite/slice_01-network_slicing.robot @@ -0,0 +1,187 @@ +# Copyright 2020 Atos +# +# 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. + +*** Settings *** +Library OperatingSystem +Library String +Library Collections +Library Process +Library SSHLibrary +Library yaml + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/slice_01-network_slicing_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** + +${ns_id} ${EMPTY} +${username} ubuntu +${password} ${EMPTY} +${vnf_member_index} middle +${vnf_ip_addr} ${EMPTY} +${mgmt_vnf_ip} ${EMPTY} +${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] } + +*** Test Cases *** + +Create Slice VNF Descriptors + [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file) + + [Tags] basic_network_slicing SLICING-01 sanity regression + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}' + Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}' + + +Create Slice NS Descriptors + [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file) + + [Tags] basic_network_slicing SLICING-01 sanity regression + + Create NSD '%{PACKAGES_FOLDER}/${nsd1_pkg}' + Create NSD '%{PACKAGES_FOLDER}/${nsd2_pkg}' + +Create Slice Template + [Documentation] Onboards the Network Slice Template: nst (in the variables file) + + [Tags] basic_network_slicing SLICING-01 sanity regression + + Create NST '%{PACKAGES_FOLDER}/${nst}' + +Network Slice Instance Test + [Documentation] Instantiates the NST recently onboarded and sets the instantiation id as a suite variable (nsi_id) + + [Tags] basic_network_slicing SLICING-01 sanity regression + + ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey} + Set Suite Variable ${nsi_id} ${id} + + +Get Middle Vnf Management Ip + [Documentation] Obtains the management IP of the slice middle VNF (name in the reources file) and sets the ip as a suite variable (mgmt_vnf_ip) + + [Tags] basic_network_slicing SLICING-01 sanity regression + + ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1 + ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index} + Run Keyword If '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty + Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip} + + +Get Slice Vnf Ip Addresses + [Documentation] Obtains the list of IPs addresses in the slice and sets the list as a suite variable (slice_vnfs_ips) + + [Tags] basic_network_slicing SLICING-01 sanity regression + + # Get all the ns_id in the slice except the middle one to avoid self ping + @{slice_ns_list} Get Slice Ns List Except One ${slice_name} ${middle_ns_name} + log many @{slice_ns_list} + @{temp_list}= Create List + # For each ns_id in the list, get all the vnf_id and their IP addresses + FOR ${ns_id} IN @{slice_ns_list} + log ${ns_id} + @{vnf_id_list} Get Ns Vnf List ${ns_id} + # For each vnf_id in the list, get all its IP addresses + @{ns_ip_list} Get Ns Ip List @{vnf_id_list} + @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list} + END + Log List ${temp_list} + Set Suite Variable ${slice_vnfs_ips} ${temp_list} + + +Test Middle Ns Ping + [Documentation] Pings the slice middle vnf (mgmt_vnf_ip) + + [Tags] basic_network_slicing SLICING-01 sanity regression + Sleep 60s Waiting for the network to be up + # Ping to the middle VNF + log ${mgmt_vnf_ip} + Test Connectivity ${mgmt_vnf_ip} + + +Test Middle Vnf SSH Access + [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file + + [Tags] basic_network_slicing SLICING-01 sanity regression + Sleep 30s Waiting ssh daemon to be up + Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey} + + +Test Slice Connectivity + [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file + ... and pings all the IP addresses in the list (slice_vnfs_ips) + + [Tags] basic_network_slicing SLICING-01 sanity regression + + Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice_vnfs_ips} + + +Stop Slice Instance + [Documentation] Stops the slice instance (slice_name) + + [Tags] basic_network_slicing SLICING-01 sanity regression cleanup + + Delete NSI ${slice_name} + + +Delete Slice Template + [Documentation] Deletes the NST (nst_name) from OSM + + [Tags] basic_network_slicing SLICING-01 sanity regression cleanup + + Delete NST ${nst_name} + + +Delete NS Descriptors + [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name + + [Tags] basic_network_slicing SLICING-01 sanity regression cleanup + + Delete NSD ${nsd1_name} + Delete NSD ${nsd2_name} + + +Delete VNF Descriptors + [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name + + [Tags] basic_network_slicing SLICING-01 sanity regression cleanup + + Delete VNFD ${vnfd1_name} + Delete VNFD ${vnfd2_name} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and template + + Run Keyword If Test Failed Delete NST ${nst_name} + + Run Keyword If Test Failed Delete NSD ${nsd1_name} + Run Keyword If Test Failed Delete NSD ${nsd2_name} + + Run Keyword If Test Failed Delete VNFD ${vnfd1_name} + Run Keyword If Test Failed Delete VNFD ${vnfd2_name} + + + diff --git a/robot-systest/testsuite/slice_02-shared_network_slicing.robot b/robot-systest/testsuite/slice_02-shared_network_slicing.robot new file mode 100644 index 0000000..14572c7 --- /dev/null +++ b/robot-systest/testsuite/slice_02-shared_network_slicing.robot @@ -0,0 +1,247 @@ +# Copyright 2020 Atos +# +# 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. + +*** Settings *** +Library OperatingSystem +Library String +Library Collections +Library Process +Library SSHLibrary + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot + +Variables %{ROBOT_DEVOPS_FOLDER}/resources/slice_02-shared_network_slicing_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** + +${ns_id} ${EMPTY} +${username} ubuntu +${password} ${EMPTY} +${vnf_member_index} middle +${vnf_ip_addr} ${EMPTY} +${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] } + + +*** Test Cases *** + +Create Slice VNF Descriptors + [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}' + Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}' + + +Create Slice NS Descriptors + [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + Create NSD '%{PACKAGES_FOLDER}/${nsd1_pkg}' + Create NSD '%{PACKAGES_FOLDER}/${nsd2_pkg}' + +Create Slice Templates + [Documentation] Onboards the Network Slice Templates: nst, nst2 (in the variables file) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + Create NST '%{PACKAGES_FOLDER}/${nst}' + Create NST '%{PACKAGES_FOLDER}/${nst2}' + +Network Slice First Instance + [Documentation] Instantiates the First NST recently onboarded (nst_name) and sets the instantiation id as a suite variable (nsi_id) + ... The slice contains 3 NS (1 shared) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey} + Set Suite Variable ${nsi_id} ${id} + + +Network Slice Second Instance + [Documentation] Instantiates the Second NST recently onboarded (nst2_name) and sets the instantiation id as a suite variable (nsi2_id) + ... The slice contains 2 NS (1 shared) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + ${id}= Create Network Slice ${nst2_name} %{VIM_TARGET} ${slice2_name} ${nst_config} ${publickey} + Set Suite Variable ${nsi2_id} ${id} + + +First Network Slice Ns Count + [Documentation] Counts the NS in both slice instances and shoul be equal to 4 + + [Tags] shared_network_slicing SLICING-02 sanity regression + + ${slice1_count}= Get Slice Ns Count ${slice_name} + ${slice2_count}= Get Slice Ns Count ${slice2_name} + ${together}= Evaluate ${slice1_count} + ${slice2_count} + Should Be Equal As Integers ${together} 4 + + +Get Middle Vnf Management Ip + [Documentation] Obtains the management IP of the shared NS main (only) VNF and sets it as a suite variable (mgmt_vnf_ip) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1 + ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index} + Run Keyword If '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty + Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip} + + +Get First Slice Vnf IPs + [Documentation] Obtains the list of IPs addresses in the first slice and sets the list as a suite variable (slice1_vnfs_ips) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + # Get all the ns_id in the slice except the middle one + @{ip_list} Get Slice Vnf Ip Addresses ${slice_name} + Should Be True ${ip_list} is not None + Set Suite Variable ${slice1_vnfs_ips} ${ip_list} + + +Test Middle Ns Ping + [Documentation] Pings the slice middle vnf (mgmt_vnf_ip) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + Sleep 60s Waiting for the network to be up + # Ping to the middle VNF + Test Connectivity ${mgmt_vnf_ip} + + +Test Middle Vnf SSH Access + [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file + + [Tags] shared_network_slicing SLICING-02 sanity regression + + Sleep 30s Waiting ssh daemon to be up + Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey} + + +Test First Slice Connectivity + [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file + ... and pings all the IP addresses in the list (slice1_vnfs_ips) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice1_vnfs_ips} + + +Stop Slice One Instance + [Documentation] Stops the slice instance (slice_name) + + [Tags] shared_network_slicing SLICING-02 sanity regression cleanup + + Delete NSI ${slice_name} + + +Second Network Slice Ns Count + [Documentation] Counts the NS in both slice instances and should be equal to 2 + + [Tags] shared_network_slicing SLICING-02 sanity regression + + ${slice1_count}= Get Slice Ns Count ${slice_name} + ${slice2_count}= Get Slice Ns Count ${slice2_name} + ${together}= Evaluate ${slice1_count} + ${slice2_count} + Should Be Equal As Integers ${together} 2 + +Get Second Slice Vnf IPs + [Documentation] Obtains the list of IPs addresses in the second slice and sets the list as a suite variable (slice2_vnfs_ips) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + # Get all the ns_id in the slice + @{ip_list} Get Slice Vnf Ip Addresses ${slice2_name} + Should Be True ${ip_list} is not None + Set Suite Variable ${slice2_vnfs_ips} ${ip_list} + + +Test Second Slice Connectivity + [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file + ... and pings all the IP addresses in the list (slice2_vnfs_ips) + + [Tags] shared_network_slicing SLICING-02 sanity regression + + Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice2_vnfs_ips} + + +Stop Slice Two Instance + [Documentation] Stops the slice instance (slice2_name) + + [Tags] shared_network_slicing SLICING-02 sanity regression cleanup + + Delete NSI ${slice2_name} + + +Delete Slice One Template + [Documentation] Deletes the NST (nst_name) from OSM + + [Tags] shared_network_slicing SLICING-02 sanity regression cleanup + + Delete NST ${nst_name} + + +Delete Slice Two Template + [Documentation] Deletes the NST (nst2_name) from OSM + + [Tags] shared_network_slicing SLICING-02 sanity regression cleanup + + Delete NST ${nst2_name} + + +Delete NS Descriptors + [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name + + [Tags] shared_network_slicing SLICING-02 sanity regression cleanup + + Delete NSD ${nsd1_name} + Delete NSD ${nsd2_name} + + +Delete VNF Descriptors + [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name + + [Tags] shared_network_slicing SLICING-02 sanity regression cleanup + + Delete VNFD ${vnfd1_name} + Delete VNFD ${vnfd2_name} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and templates + + Run Keyword If Test Failed Delete NST ${nst_name} + Run Keyword If Test Failed Delete NST ${nst2_name} + + Run Keyword If Test Failed Delete NSD ${nsd1_name} + Run Keyword If Test Failed Delete NSD ${nsd2_name} + + Run Keyword If Test Failed Delete VNFD ${vnfd1_name} + Run Keyword If Test Failed Delete VNFD ${vnfd2_name} + + +