From: yadavmr Date: Wed, 18 Sep 2019 10:03:25 +0000 (+0530) Subject: Enhance CLI NS launch with config parameter X-Git-Tag: v7.0.0rc1~49^2 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fdevops.git;a=commitdiff_plain;h=58af6b1f5c118080954f0b00ecd270bebd8491d0 Enhance CLI NS launch with config parameter Fix ns config to check for empty osmclient test using python module included Change-Id: Ied096ed0affbd6ab58228d16916196635359d027 Signed-off-by: yadavmr --- diff --git a/charms/juju-env.sh b/charms/juju-env.sh index 59fa9e71..61ef85e2 100644 --- a/charms/juju-env.sh +++ b/charms/juju-env.sh @@ -1,3 +1,24 @@ +#!/usr/bin/env bash + +## +# Copyright 2019 ETSI +# +# 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. +## + + # Set the Juju env variables for building a layer export JUJU_REPOSITORY=`pwd` export INTERFACE_PATH=$JUJU_REPOSITORY/interfaces diff --git a/descriptor-packages/vnfd/hackfest_cloudinit_vnf/src/hackfest_cloudinit_vnfd.yaml b/descriptor-packages/vnfd/hackfest_cloudinit_vnf/src/hackfest_cloudinit_vnfd.yaml index 818c62aa..24a65482 100644 --- a/descriptor-packages/vnfd/hackfest_cloudinit_vnf/src/hackfest_cloudinit_vnfd.yaml +++ b/descriptor-packages/vnfd/hackfest_cloudinit_vnf/src/hackfest_cloudinit_vnfd.yaml @@ -1,3 +1,28 @@ +# -*- coding: utf-8 -*- + +## +# Copyright 2019 ETSI +# +# 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com +# 19-aug-2019 : changed vdu image from hackfest3-mgmt to ubuntu1604 +## + vnfd:vnfd-catalog: vnfd: - id: hackfest_cloudinit-vnf @@ -28,7 +53,7 @@ vnfd:vnfd-catalog: vdu: - id: mgmtVM name: mgmtVM - image: hackfest3-mgmt + image: ubuntu1604 count: '1' vm-flavor: vcpu-count: '1' @@ -55,7 +80,7 @@ vnfd:vnfd-catalog: cloud-init-file: cloud-config.txt - id: dataVM name: dataVM - image: hackfest3-mgmt + image: ubuntu1604 count: '1' vm-flavor: vcpu-count: '1' diff --git a/descriptor-packages/vnfd/hackfest_epasriov_vnf/src/hackfest_epasriov_vnfd.yaml b/descriptor-packages/vnfd/hackfest_epasriov_vnf/src/hackfest_epasriov_vnfd.yaml index f0393892..476f1263 100644 --- a/descriptor-packages/vnfd/hackfest_epasriov_vnf/src/hackfest_epasriov_vnfd.yaml +++ b/descriptor-packages/vnfd/hackfest_epasriov_vnf/src/hackfest_epasriov_vnfd.yaml @@ -1,3 +1,28 @@ +# -*- coding: utf-8 -*- + +## +# Copyright 2019 ETSI +# +# 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com +# 19-aug-2019 : changed vdu image from hackfest3-mgmt & hackfest-pktgen to ubuntu1604 +## + vnfd:vnfd-catalog: vnfd: - id: hackfest_epasriov-vnf @@ -28,7 +53,7 @@ vnfd:vnfd-catalog: vdu: - id: mgmtVM name: mgmtVM - image: hackfest3-mgmt + image: ubuntu1604 count: '1' vm-flavor: vcpu-count: '1' @@ -64,7 +89,7 @@ vnfd:vnfd-catalog: cloud-init-file: cloud-config.txt - id: dataVM name: dataVM - image: hackfest-pktgen + image: ubuntu1604 count: '1' vm-flavor: vcpu-count: '8' diff --git a/descriptor-packages/vnfd/hackfest_multivdu_vnf/src/hackfest_multivdu_vnfd.yaml b/descriptor-packages/vnfd/hackfest_multivdu_vnf/src/hackfest_multivdu_vnfd.yaml index e8981ff2..ff411e0f 100644 --- a/descriptor-packages/vnfd/hackfest_multivdu_vnf/src/hackfest_multivdu_vnfd.yaml +++ b/descriptor-packages/vnfd/hackfest_multivdu_vnf/src/hackfest_multivdu_vnfd.yaml @@ -1,3 +1,28 @@ +# -*- coding: utf-8 -*- + +## +# Copyright 2019 ETSI +# +# 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com +# 19-aug-2019 : changed vdu image from US1604 to ubuntu1604 +## + vnfd:vnfd-catalog: vnfd: - id: hackfest_multivdu-vnf @@ -28,7 +53,7 @@ vnfd:vnfd-catalog: vdu: - id: mgmtVM name: mgmtVM - image: US1604 + image: ubuntu1604 count: '1' vm-flavor: vcpu-count: '1' @@ -54,7 +79,7 @@ vnfd:vnfd-catalog: - id: dataVM name: dataVM - image: US1604 + image: ubuntu1604 count: '1' vm-flavor: vcpu-count: '1' diff --git a/descriptor-packages/vnfd/hackfest_simplecharm_vnf/src/hackfest_simplecharm_vnfd.yaml b/descriptor-packages/vnfd/hackfest_simplecharm_vnf/src/hackfest_simplecharm_vnfd.yaml index ad9bdd5c..7295c547 100644 --- a/descriptor-packages/vnfd/hackfest_simplecharm_vnf/src/hackfest_simplecharm_vnfd.yaml +++ b/descriptor-packages/vnfd/hackfest_simplecharm_vnf/src/hackfest_simplecharm_vnfd.yaml @@ -1,3 +1,28 @@ +# -*- coding: utf-8 -*- + +## +# Copyright 2019 ETSI +# +# 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com +# 19-aug-2019 : changed vdu image from hackfest3-mgmt to ubuntu1604 +## + vnfd:vnfd-catalog: vnfd: - id: hackfest-simplecharm-vnf @@ -28,7 +53,7 @@ vnfd:vnfd-catalog: vdu: - id: mgmtVM name: mgmtVM - image: hackfest3-mgmt + image: ubuntu1604 count: '1' vm-flavor: vcpu-count: '1' @@ -55,7 +80,7 @@ vnfd:vnfd-catalog: cloud-init-file: cloud-config.txt - id: dataVM name: dataVM - image: hackfest3-mgmt + image: ubuntu1604 count: '1' vm-flavor: vcpu-count: '1' diff --git a/devops-stages/stage-archive.sh b/devops-stages/stage-archive.sh index 160b1a35..8dc677ec 100755 --- a/devops-stages/stage-archive.sh +++ b/devops-stages/stage-archive.sh @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -PKG_DIRECTORIES="jenkins installers systest charms descriptor-packages tools docker" +PKG_DIRECTORIES="jenkins installers systest charms descriptor-packages tools docker robot-systest" MDG_NAME=devops DEB_INSTALL=debian/osm-$MDG_NAME.install export DEBEMAIL="mmarchetti@sandvine.com" diff --git a/docker/osmclient/Dockerfile b/docker/osmclient/Dockerfile index 3bf5fb3d..6afddbba 100644 --- a/docker/osmclient/Dockerfile +++ b/docker/osmclient/Dockerfile @@ -1,6 +1,8 @@ ## # Copyright 2019 ETSI # +# 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 @@ -14,7 +16,6 @@ # under the License. ## -######################################################################## FROM ubuntu:16.04 @@ -25,6 +26,7 @@ RUN apt-get update && apt-get -y install curl software-properties-common RUN apt-get update && apt-get -y install python \ libcurl4-gnutls-dev libgnutls-dev iputils-ping python-pip \ python-openstackclient wget + RUN pip install -U pip && python -m pip install python-magic pyangbind pytest==4.6.3 ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index dd2f22bd..99ba6004 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -19,7 +19,9 @@ * 1. Bug 745 : Jayant Madavi, Mrityunjay Yadav : JM00553988@techmahindra.com : 23-july-2019 : Improvement to the code, typically we have 2 * or more branches whose build gets triggered, ex master & release branch, the previous code was removing any/all docker. * Now removing previous docker of the same branch, so that the other branch failed docker should not be removed. It also * acts as clean-up for previous docker remove failure. + * 2. Feature 7829 : Mrityunjay Yadav, Jayant Madavi: MY00514913@techmahindra.com : 19-Aug-2019 : Added a parameters & function to invoke Robot test. */ + properties([ parameters([ string(defaultValue: env.GERRIT_BRANCH, description: '', name: 'GERRIT_BRANCH'), @@ -47,6 +49,9 @@ properties([ booleanParam(defaultValue: true, description: '', name: 'DO_DOCKERPUSH'), booleanParam(defaultValue: false, description: '', name: 'SAVE_ARTIFACTS_OVERRIDE'), string(defaultValue: '/home/jenkins/hive/openstack-etsi.rc', description: '', name: 'HIVE_VIM_1'), + booleanParam(defaultValue: true, description: '', name: 'DO_ROBOT'), + string(defaultValue: 'sanity', description: 'smoke/vim/sanity/comprehensive are the options', name: 'TEST_NAME'), + string(defaultValue: '/home/jenkins/hive/robot-systest.cfg', description: '', name: 'ROBOT_VIM'), ]) ]) @@ -70,6 +75,30 @@ def run_systest(stackName,tagName,testName,envfile=null) { junit '*.xml' } +def run_robot_systest(stackName,tagName,testName,envfile=null) { + tempdir = sh(returnStdout: true, script: "mktemp -d").trim() + if ( !envfile ) + { + sh(script: "touch ${tempdir}/env") + envfile="${tempdir}/env" + } + sh "docker run --network net${stackName} --env-file ${envfile} -v ${tempdir}:/usr/share/osm-devops/robot-systest/reports opensourcemano/osmclient:${tagName} bash -C /usr/share/osm-devops/robot-systest/run_test.sh --do_install -t ${testName}" + sh "cp ${tempdir}/* ." + outputDirectory = sh(returnStdout: true, script: "pwd").trim() + println ("Present Directory is : ${outputDirectory}") + step([ + $class : 'RobotPublisher', + outputPath : "${outputDirectory}", + outputFileName : "*.xml", + disableArchiveOutput : false, + reportFileName : "report.html", + logFileName : "log.html", + passThreshold : 80, + unstableThreshold: 60.0, + otherFiles : "*.png", + ]) +} + node("${params.NODE}") { sh 'env' @@ -278,8 +307,16 @@ node("${params.NODE}") { if ( params.DO_STAGE_4 ) { // override stage_archive to only archive on stable stage_archive = false - stage("stage_4") { - run_systest(container_name,container_name,"openstack_stage_4",params.HIVE_VIM_1) + stage("System Integration Test") { + if ( params.DO_ROBOT ) { + steps { + run_robot_systest(container_name,container_name,params.TEST_NAME,params.ROBOT_VIM) + } + } else { + steps{ + run_systest(container_name,container_name,"openstack_stage_4",params.HIVE_VIM_1) + } + } if ( ! currentBuild.result.equals('UNSTABLE') ) { stage_archive = keep_artifacts @@ -314,8 +351,6 @@ node("${params.NODE}") { currentBuild.result = 'FAILURE' } finally { - - if ( params.DO_INSTALL ) { if (error) { if ( !params.SAVE_CONTAINER_ON_FAIL ) { diff --git a/robot-systest/README_Robot_Test.md b/robot-systest/README_Robot_Test.md new file mode 100644 index 00000000..7067946c --- /dev/null +++ b/robot-systest/README_Robot_Test.md @@ -0,0 +1,86 @@ + + + +# Step to run robot framework test standalone linux environment + +All installation commands run using root user(`sudo su`) +## Step 1: Install python packages +Install below python packages using pip +>pip install python-magic pyangbind haikunator requests pyvcloud progressbar pathlib robotframework robotframework-seleniumlibrary robotframework-requests + +## Step 2: Install linux packages +Install below linux packages +>curl http://osm-download.etsi.org/repository/osm/debian/ReleaseSIX/OSM%20ETSI%20Release%20Key.gpg | apt-key add - + +>add-apt-repository -y "deb http://osm-download.etsi.org/repository/osm/debian/ReleaseSIX stable devops osmclient IM" && apt update + +>curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - + +>echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list + +> apt-get install -y python-osmclient python-osm-im google-chrome-stable chromium-chromedriver + +>./git-repo/devops/tools/OVF_converter/install.sh + +## Step 3: checkout robot seed code +Checkout devops from gerrit +> git clone "https://osm.etsi.org/gerrit/osm/devops" + +If robot seed code not merged to to master, pull it +> git pull "https://osm.etsi.org/gerrit/osm/devops" refs/changes/52/7852/4 + +## Step 4: Set environmet +for build test need to create env-file and provide below details and for Standalone testing export them +``` +export OSM_HOSTNAME= +``` + +OpenStack Details +``` +export OS_AUTH_URL= +export OS_PASSWORD= +export OS_PROJECT_NAME= +export OS_VIM_CONFIG= +``` + +VCD Details +``` +export VCD_AUTH_URL= +export VCD_USERNAME= +export VCD_PASSWORD= +export VCD_TENANT_NAME= +export VCD_ORGANIZATION= +export VCD_VIM_CONFIG= +``` + +Note:- Optional +``` +export NS_CONFIG= +e.g. export NS_CONFIG="'{vld: [ {name: mgmtnet, vim-network-name: mgmt}]}'" +``` + +## Step 5: Run Test +There are two ways to run the test-case: +* use `devops/robot-systest/run_test.sh` file and provide test-name(vim/smoke/sanity/comprehensive). + > ./devops/robot-systest/run_test.sh -t smoke + +* use `robot` command + > robot -d path/to/report/dir -i test-tag-to-be-included -e test-tag-to-be-excluded path/to/testsuiet + + > robot -d devops/robot-systest/reports -i comprehensive devops/robot-systest/testsuite \ No newline at end of file diff --git a/robot-systest/lib/api/common.robot b/robot-systest/lib/api/common.robot new file mode 100644 index 00000000..4724016e --- /dev/null +++ b/robot-systest/lib/api/common.robot @@ -0,0 +1,64 @@ +# -*- 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 +## + + +*** Variables *** +${token}= ${EMPTY} +${HOST}= ${EMPTY} + + +*** Keywords *** +Get Auth Token + [Tags] auth_token + + ${nbi_host}= Get Environment Variable OSM_HOSTNAME + ${passed}= Run Keyword And Return Status Should Contain ${nbi_host} : + Run Keyword If ${passed} Set Dockerized Host ${nbi_host} + ... ELSE Set Standalone Host ${nbi_host} + + Create Session osmhit ${HOST} verify=${FALSE} debug=1 headers=${HEADERS} + + Log Many ${auth_token_uri} @{data} ${data} + + ${resp}= Post Request osmhit ${auth_token_uri} data=${data} + log ${resp} + + Pass Execution If ${resp.status_code} in ${success_status_code_list} Get Auth Token completed + + ${content}= To Json ${resp.content} + ${t}= Get From Dictionary ${content} _id + + Set Suite Variable ${token} ${t} + + +Set Dockerized Host + [Arguments] ${env_host} + + Set Suite Variable ${HOST} https://${env_host} + + +Set Standalone Host + [Arguments] ${env_host} + + Set Suite Variable ${HOST} https://${env_host}:9999 diff --git a/robot-systest/lib/api/vim_lib.robot b/robot-systest/lib/api/vim_lib.robot new file mode 100644 index 00000000..a52354fc --- /dev/null +++ b/robot-systest/lib/api/vim_lib.robot @@ -0,0 +1,60 @@ +# -*- 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 +## + + +*** Keywords *** +Create Vim + [Arguments] ${vim_name} ${account_type} ${auth_url} ${user} ${password} ${tenant} ${description} + + &{request_data}= Create Dictionary vim_user=${user} vim_password=${password} vim_url=${auth_url} vim_tenant_name=${tenant} vim_type=${account_type} description=${description} name=${vim_name} + + &{headers}= Create Dictionary Authorization=Bearer ${token} Content-Type=application/json Accept=application/json + + Create Session osmvim ${HOST} verify=${FALSE} headers=${headers} + + LOG ${request_data} + ${res}= Post Request osmvim ${create_vim_uri} data=${request_data} + log ${res.content} + Pass Execution If ${res.status_code} in ${success_status_code_list} Create Vim Request completed + Get Vim ID ${res.content} + + +Delete Vim + [Arguments] ${vim_id} + + ${uri} = Catenate SEPARATOR=/ ${create_vim_uri} ${vim_id} + ${resp}= Delete Request osmvim ${uri} + + log ${resp.content} + Pass Execution If ${resp.status_code} in ${success_status_code_list} Delete Vim Request completed + + +Get Vim ID + [Arguments] ${res} + +# log to console ${res} + ${content}= To Json ${res} + ${id}= Get From Dictionary ${content} id + Set Suite Variable ${vim_id} ${id} + log Vim Id is ${vim_id} diff --git a/robot-systest/lib/cli/ns_lib.robot b/robot-systest/lib/cli/ns_lib.robot new file mode 100644 index 00000000..e3e3a021 --- /dev/null +++ b/robot-systest/lib/cli/ns_lib.robot @@ -0,0 +1,129 @@ +# -*- 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-aug-2019 : Improvement to the code, robot framework initial seed code. +## + + +*** 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 NS List + [Documentation] Get ns instance list + + ${rc} ${stdout}= Run and Return RC and Output osm ns-list + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Launch Network Services and Return + [Arguments] ${vim_name} + + Should Not Be Empty ${nsd_ids} There are no NS descriptors to launch the NS + :FOR ${nsd} IN @{nsd_ids} + \ ${ns_name}= GENERATE NAME + \ Append To List ${ns_ids} ${ns_name} + \ Create Network Service ${nsd} ${vim_name} ${ns_name} + \ Delete NS ${ns_name} + + +Create Network Service + [Documentation] Create ns at osm + [Arguments] ${nsd} ${vim_name} ${ns_name} + + ${ns_config}= Get Environment Variable NS_CONFIG ${EMPTY} + Run Keyword If ${ns_config}!='${EMPTY}' Create Network Service With Config ${nsd} ${vim_name} ${ns_name} ${ns_config} + ... ELSE Create Network Service Without Config ${nsd} ${vim_name} ${ns_name} + + 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} + + +Create Network Service Without Config + [Documentation] Create ns at osm + [Arguments] ${nsd} ${vim_name} ${ns_name} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Create Network Service With Config + [Documentation] Create ns at osm + [Arguments] ${nsd} ${vim_name} ${ns_name} ${ns_config} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} --config ${ns_config} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + +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 Delete ${ns} + + +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} configured failed + + +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} failed + + +Check For NS Instance To Be Delete + [Arguments] ${ns} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-list + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Contain ${stdout} ${ns} + + +Force Delete NS + [Documentation] Forcely 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 Delete ${ns} diff --git a/robot-systest/lib/cli/nsd_lib.robot b/robot-systest/lib/cli/nsd_lib.robot new file mode 100644 index 00000000..6a4ccbfe --- /dev/null +++ b/robot-systest/lib/cli/nsd_lib.robot @@ -0,0 +1,84 @@ +# -*- 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 +## + +*** Variables *** +${success_return_code} 0 +${delete_max_wait_time} 1min +${delete_pol_time} 15sec + + +*** Keywords *** +Get NSDs List + [Documentation] 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 + [Documentation] Create nsd at osm + [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} + [Return] ${stdout} + + +Delete NSD + [Documentation] Delete nsd + [Arguments] ${nsd_id} + + ${rc} ${stdout}= Run and Return RC and Output osm nsd-delete ${nsd_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 NSD ${nsd_id} + + +Check For NSD + [Arguments] ${nsd_id} + + ${rc} ${stdout}= Run and Return RC and Output osm nsd-list + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Contain ${stdout} ${nsd_id} + + +Force Delete NSD + [Documentation] Forcely Delete nsd + [Arguments] ${nsd_id} + + ${rc} ${stdout}= Run and Return RC and Output osm nsd-delete ${nsd_id} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Build NS Descriptor + [Documentation] Build NS Descriptor from the descriptor-packages + [Arguments] ${nsd path} + + ${rc} ${stdout}= Run and Return RC and Output make -C '${CURDIR}${/}../../..${nsd path}' + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} diff --git a/robot-systest/lib/cli/vim_account_lib.robot b/robot-systest/lib/cli/vim_account_lib.robot new file mode 100644 index 00000000..699d1991 --- /dev/null +++ b/robot-systest/lib/cli/vim_account_lib.robot @@ -0,0 +1,115 @@ +# -*- 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 +## + + +*** Variables *** +${success_return_code} 0 +${name} "helloworld-os" +${user} "robottest" +${password} "fred" +${authurl} "https://169.254.169.245/" +${type} "openstack" +${desc} "a test vim" +${tenant} "robottest2" + + +*** Keywords *** +Create Vim Account + [Documentation] Create a new vim account + + ${rc} ${stdout}= Run and Return RC and Output osm vim-create --name ${name} --user ${user} --password ${password} --auth_url ${authurl} --tenant ${tenant} --account_type ${type} --description ${desc} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Get Vim List + [Documentation] Get a vim account list + + ${rc} ${stdout}= Run and Return RC and Output osm vim-list + log ${stdout} + Log To Console ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Delete Vim Account + [Documentation] delete vim account details + + ${rc} ${stdout}= Run and Return RC and Output osm vim-delete ${name} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + +VIM Setup To Launch Network Services + [Documentation] Setup a VIM to launch network services + + ${vmware_url}= Get Environment Variable VCD_AUTH_URL ${EMPTY} + ${openstack_url}= Get Environment Variable OS_AUTH_URL ${EMPTY} + ${vmware_vim}= Run Keyword And Return If '${vmware_url}'!='${EMPTY}' Setup Vmware Vim ${vmware_url} 'vmware' 'pytest system test' + ${openstack_vim}= Run Keyword And Return If '${openstack_url}'!='${EMPTY}' Setup Openstack Vim ${openstack_url} 'openstack' 'pytest system test' + + Log Many @{vim} + + +Setup Openstack Vim + [Documentation] Openstack Vim Account Setup + [Arguments] ${authurl} ${type} ${desc} + + ${user}= Get Environment Variable OS_USERNAME '' + ${password}= Get Environment Variable OS_PASSWORD '' + ${tenant}= Get Environment Variable OS_PROJECT_NAME '' + ${vim-config}= Get Environment Variable OS_VIM_CONFIG '' + ${vim_name}= GENERATE NAME + + ${rc} ${stdout}= Run and Return RC and Output osm vim-create --name ${vim_name} --user ${user} --password ${password} --auth_url ${authurl} --tenant ${tenant} --account_type ${type} --description ${desc} --config ${vim-config} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Append To List ${vim} ${stdout} + [Return] ${stdout} + + +Setup Vmware Vim + [Documentation] Vmware Vim Account Setup + [Arguments] ${authurl} ${type} ${desc} + + ${user}= Get Environment Variable VCD_USERNAME '' + ${password}= Get Environment Variable VCD_PASSWORD '' + ${tenant}= Get Environment Variable VCD_TENANT_NAME '' + ${vcd-org}= Get Environment Variable VCD_ORGANIZATION '' + ${vim-config}= Get Environment Variable VCD_VIM_CONFIG '' + ${vim_name}= GENERATE NAME + + ${rc} ${stdout}= Run and Return RC and Output osm vim-create --name ${vim_name} --user ${user} --password ${password} --auth_url ${authurl} --tenant ${tenant} --account_type ${type} --description ${desc} --config ${vim-config} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Append To List ${vim} ${stdout} + [Return] ${stdout} + + +Force Delete Vim Account + [Documentation] delete vim account details + [Arguments] ${vim_name} + + ${rc} ${stdout}= Run and Return RC and Output osm vim-delete ${vim_name} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} diff --git a/robot-systest/lib/cli/vnfd_lib.robot b/robot-systest/lib/cli/vnfd_lib.robot new file mode 100644 index 00000000..1b99f438 --- /dev/null +++ b/robot-systest/lib/cli/vnfd_lib.robot @@ -0,0 +1,85 @@ +# -*- 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 +## + +*** Variables *** +${success_return_code} 0 +${delete_max_wait_time} 1min +${delete_pol_time} 15sec + + +*** Keywords *** +Get VNFDs List + [Documentation] 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 + [Documentation] Create vnfd at osm + [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} + [Return] ${stdout} + + +Delete VNFD + [Documentation] 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 + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Contain ${stdout} ${vnfd_id} + + +Force Delete VNFD + [Documentation] Forcely 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} + + +Build VNF Descriptor + [Documentation] Build VNF Descriptor from the descriptor-packages + [Arguments] ${vnfd path} + + ${rc} ${stdout}= Run and Return RC and Output make -C '${CURDIR}${/}../../..${vnfd path}' + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} diff --git a/robot-systest/lib/client_lib/client_lib.py b/robot-systest/lib/client_lib/client_lib.py new file mode 100644 index 00000000..c9390ae9 --- /dev/null +++ b/robot-systest/lib/client_lib/client_lib.py @@ -0,0 +1,69 @@ +## +# 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. +## + + +from osmclient import client +from robot.api import logger +import json + + +class ClientLib: + def __init__(self, host="127.0.0.1", user=None, password=None, project=None): + + kwargs = {} + if user is not None: + kwargs['user'] = user + if password is not None: + kwargs['password'] = password + if project is not None: + kwargs['project'] = project + self.client = client.Client(host=host, sol005=True, **kwargs) + + def get_vim_list(self): + resp = self.client.vim.list() + logger.info('VIM List: {}'.format(resp)) + return json.dumps(resp) + + def create_vim_account(self, name, vim_type, user, password, auth_url, tenant, desc='', config=None): + vim_access = {} + if config is not None: + vim_access['config'] = config + vim_access['vim-type'] = vim_type + vim_access['vim-username'] = user + vim_access['vim-password'] = password + vim_access['vim-url'] = auth_url + vim_access['vim-tenant-name'] = tenant + vim_access['description'] = desc + + resp = self.client.vim.create(name, vim_access) + logger.info('Create VIM Account: {}'.format(resp)) + return json.dumps(resp) + + def delete_vim_account(self, name): + resp = self.client.vim.delete(name) + return json.dumps(resp) + + def get_vnfd_list(self): + resp = self.client.vnfd.list() + logger.info('VNF Descriptor List: {}'.format(resp)) + return json.dumps(resp) + + def get_nsd_list(self): + resp = self.client.nsd.list() + logger.info('NS Descriptor List: {}'.format(resp)) + return json.dumps(resp) diff --git a/robot-systest/lib/custom_lib.py b/robot-systest/lib/custom_lib.py new file mode 100644 index 00000000..5eb162f3 --- /dev/null +++ b/robot-systest/lib/custom_lib.py @@ -0,0 +1,32 @@ +# -*- 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-aug-2019 : Improvement to the code, robot framework initial seed code. +## + + +from haikunator import Haikunator + + +def generate_name(): + haikunator = Haikunator() + name = haikunator.haikunate(delimiter='_', token_length=2) + return name diff --git a/robot-systest/lib/gui/login_gui.robot b/robot-systest/lib/gui/login_gui.robot new file mode 100644 index 00000000..c125664f --- /dev/null +++ b/robot-systest/lib/gui/login_gui.robot @@ -0,0 +1,87 @@ +# -*- 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-aug-2019 : Improvement to the code, robot framework initial seed code. +## + + +*** Variables *** +${DESIRED_CAPABILITIES} desired_capabilities +${BROWSER} Chrome +${DELAY} 0 +${VALID USER} admin +${VALID PASSWORD} admin +${LOGIN URL} /auth/ +${WELCOME URL} /projects/ +${NS LIST URL} /packages/ns/list +${VNF LIST URL} /packages/vnf/list + + +*** Keywords *** +Set Server URL + ${env_host}= Get Environment Variable OSM_HOSTNAME + ${passed}= Run Keyword And Return Status Should Contain ${env_host} : + Run Keyword If ${passed} Set Dockerized Host + ... ELSE Set Standalone Host ${env_host} + + +Open Browser To Login Page + ${chrome_options} = Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver + Call Method ${chrome_options} add_argument headless + Call Method ${chrome_options} add_argument disable-gpu + Call Method ${chrome_options} add_argument no-sandbox + ${options}= Call Method ${chrome_options} to_capabilities + Open Browser ${SERVER}${LOGIN URL} ${BROWSER} desired_capabilities=${options} + Maximize Browser Window + Set Selenium Speed ${DELAY} + Login Page Should Be Open + + +Login Page Should Be Open + Element Text Should Be //*[@id="main_content"]/div/div[2]/p Sign in to start your session + + +Enter Credentials + [Arguments] ${username} ${password} + Input Text name:username ${username} + Input Password name:password ${password} + + +Submit Credentials + Click Button //*[@id="main_content"]/div/div[2]/form/div[3]/div[2]/button + + +Home Page Should Be Open + Location Should Be ${SERVER}${WELCOME URL} +# Element Should Contain id:title_header 6e3a8415-9014-4100-9727-90e0150263be ignore_case=True + Element Attribute Value Should Be //*[@id="main_content"]/div/div[2]/div[1]/div[1]/div/a href ${SERVER}${NS LIST URL} + Element Attribute Value Should Be //*[@id="main_content"]/div/div[2]/div[1]/div[2]/div/a href ${SERVER}${VNF LIST URL} + + +Set Dockerized Host + + Set Suite Variable ${SERVER} http://light-ui + + +Set Standalone Host + [Arguments] ${env_host} + + Set Suite Variable ${SERVER} http://${env_host} diff --git a/robot-systest/resource/api/common.robot b/robot-systest/resource/api/common.robot new file mode 100644 index 00000000..9342316a --- /dev/null +++ b/robot-systest/resource/api/common.robot @@ -0,0 +1,46 @@ +# -*- 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 +## + + +*** Variables *** +&{HEADERS} Content-Type=application/json Accept=application/json +&{data} username=admin password=admin project-id=admin +@{success_status_code_list} 200 201 202 204 + +${descriptor_content_type_gzip} application/gzip + +${auth_token_uri} /osm/admin/v1/tokens + +${get_all_vnfd_uri} /osm/vnfpkgm/v1/vnf_packages +${create_vnfd_uri} /osm/vnfpkgm/v1/vnf_packages_content +${delete_vnfd_uri} /osm/vnfpkgm/v1/vnf_packages + +${get_all_nsd_uri} /osm/nsd/v1/ns_descriptors +${create_nsd_uri} /osm/nsd/v1/ns_descriptors_content +${delete_nsd_uri} /osm/nsd/v1/ns_descriptors + +${base_ns_uri} /osm/nslcm/v1/ns_instances_content +${create_ns_uri} /osm/nslcm/v1/ns_instances_content + +${create_vim_uri} /osm/admin/v1/vim_accounts diff --git a/robot-systest/resource/api/variables.py b/robot-systest/resource/api/variables.py new file mode 100644 index 00000000..a97763a4 --- /dev/null +++ b/robot-systest/resource/api/variables.py @@ -0,0 +1,33 @@ +# -*- 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 +## + + +# Create/Delete Vim Account +vim_name = 'API-TEST-VIM' +account_type = 'openstack' +auth_url = 'http://127.0.0.1:5000/v3' +user = 'admin' +password = 'admin' +tenant = 'admin' +description = 'Test OpenStack Vim Account' diff --git a/robot-systest/resource/cli/hackfest_basic_ns_data.py b/robot-systest/resource/cli/hackfest_basic_ns_data.py new file mode 100644 index 00000000..8b8054b8 --- /dev/null +++ b/robot-systest/resource/cli/hackfest_basic_ns_data.py @@ -0,0 +1,32 @@ +# -*- 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-aug-2019 : Improvement to the code, robot framework initial seed code. +## + + +# VNFD Details +vnfdPckgPath = "/descriptor-packages/vnfd/hackfest_basic_vnf" +vnfdPckg = '/build/hackfest_basic_vnf.tar.gz' + +# NSD Details +nsdPckgPath = "/descriptor-packages/nsd/hackfest_basic_ns" +nsdPckg = '/build/hackfest_basic_ns.tar.gz' diff --git a/robot-systest/resource/cli/hackfest_cloudinit_ns_data.py b/robot-systest/resource/cli/hackfest_cloudinit_ns_data.py new file mode 100644 index 00000000..d725a36a --- /dev/null +++ b/robot-systest/resource/cli/hackfest_cloudinit_ns_data.py @@ -0,0 +1,32 @@ +# -*- 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-aug-2019 : Improvement to the code, robot framework initial seed code. +## + + +# VNFD Details +vnfdPckgPath = "/descriptor-packages/vnfd/hackfest_cloudinit_vnf" +vnfdPckg = '/build/hackfest_cloudinit_vnf.tar.gz' + +# NSD Details +nsdPckgPath = "/descriptor-packages/nsd/hackfest_cloudinit_ns" +nsdPckg = '/build/hackfest_cloudinit_ns.tar.gz' diff --git a/robot-systest/resource/cli/hackfest_epa_ns_data.py b/robot-systest/resource/cli/hackfest_epa_ns_data.py new file mode 100644 index 00000000..8975e31f --- /dev/null +++ b/robot-systest/resource/cli/hackfest_epa_ns_data.py @@ -0,0 +1,32 @@ +# -*- 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-aug-2019 : Improvement to the code, robot framework initial seed code. +## + + +# VNFD Details +vnfdPckgPath = "/descriptor-packages/vnfd/hackfest_epasriov_vnf" +vnfdPckg = '/build/hackfest_epasriov_vnf.tar.gz' + +# NSD Details +nsdPckgPath = "/descriptor-packages/nsd/hackfest_epasriov_ns" +nsdPckg = '/build/hackfest_epasriov_ns.tar.gz' diff --git a/robot-systest/resource/cli/hackfest_multivdu_ns_data.py b/robot-systest/resource/cli/hackfest_multivdu_ns_data.py new file mode 100644 index 00000000..5ecb9e84 --- /dev/null +++ b/robot-systest/resource/cli/hackfest_multivdu_ns_data.py @@ -0,0 +1,32 @@ +# -*- 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-aug-2019 : Improvement to the code, robot framework initial seed code. +## + + +# VNFD Details +vnfdPckgPath = "/descriptor-packages/vnfd/hackfest_multivdu_vnf" +vnfdPckg = '/build/hackfest_multivdu_vnf.tar.gz' + +# NSD Details +nsdPckgPath = "/descriptor-packages/nsd/hackfest_multivdu_ns" +nsdPckg = '/build/hackfest_multivdu_ns.tar.gz' diff --git a/robot-systest/resource/cli/hackfest_simplecharm_ns_data.py b/robot-systest/resource/cli/hackfest_simplecharm_ns_data.py new file mode 100644 index 00000000..5ffcd35b --- /dev/null +++ b/robot-systest/resource/cli/hackfest_simplecharm_ns_data.py @@ -0,0 +1,32 @@ +# -*- 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-aug-2019 : Improvement to the code, robot framework initial seed code. +## + + +# VNFD Details +vnfdPckgPath = "/descriptor-packages/vnfd/hackfest_simplecharm_vnf" +vnfdPckg = '/build/hackfest_simplecharm_vnf.tar.gz' + +# NSD Details +nsdPckgPath = "/descriptor-packages/nsd/hackfest_simplecharm_ns" +nsdPckg = '/build/hackfest_simplecharm_ns.tar.gz' diff --git a/robot-systest/resource/cli/test_vnf_data.py b/robot-systest/resource/cli/test_vnf_data.py new file mode 100644 index 00000000..02ee065a --- /dev/null +++ b/robot-systest/resource/cli/test_vnf_data.py @@ -0,0 +1,32 @@ +# -*- 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 +## + + +# VNFD Details +vnfdPckgPath = "/descriptor-packages/vnfd/cirros_vnf" +vnfdPckg = '/build/cirros_vnf.tar.gz' + +# NSD Details +nsdPckgPath = "/descriptor-packages/nsd/cirros_ns" +nsdPckg = '/build/cirros_ns.tar.gz' diff --git a/robot-systest/run_test.sh b/robot-systest/run_test.sh new file mode 100644 index 00000000..74f8aa1a --- /dev/null +++ b/robot-systest/run_test.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash + +## +# 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com : 06-Sep-2019 +# Entry script to start the vim, smoke, openstack_stage_4 and comprehensive test using Robot Framework as a Automation Test Framework +## + +BASEDIR=$(dirname "$0") +TOPDIR=$(dirname "$BASEDIR") +DESCRIPTOR_DIR=$TOPDIR/descriptor-packages + + +robot_prerequisite(){ + echo -e "\nInstalling robot requirements" + # installing python packages + pip install haikunator requests robotframework robotframework-seleniumlibrary robotframework-requests + + # installing chrome driver and chrome for UI testing + curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - + echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list + apt-get update && apt-get -y install google-chrome-stable chromium-chromedriver +} + +while getopts ":t:-:" o; do + case "${o}" in + t) + TEST=${OPTARG} + ;; + -) + [[ "${OPTARG}" == "do_install" ]] && robot_prerequisite && continue + ;; + \?) + echo -e "Invalid option: '-$OPTARG'\n" >&2 + exit 1 + ;; + esac +done + +if [[ -z $TEST ]]; then + printf "Test not provided. \nRunning default test: smoke\n" + TEST="smoke" +fi + +if [[ "$TEST" == "vim" ]]; then + echo "Robot Framework Vim Test" + robot -d $BASEDIR/reports -i vim $BASEDIR/testsuite/ + exit 0 +elif [[ "$TEST" == "smoke" ]]; then + echo "Robot Framework SMOKE test" + robot -d $BASEDIR/reports -i smoke $BASEDIR/testsuite/ + exit 0 +elif [[ "$TEST" == "sanity" ]]; then + echo "Robot Framework Cirros VNF Test" + mkdir -p $BASEDIR/images/cache + if [[ ! -z $OS_AUTH_URL ]]; then + (openstack image show cirros-0.3.5-x86_64-disk.img) || (wget -r -nc http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img -O $BASEDIR/images/cache/cirros-0.3.5-x86_64-disk.img && make $BASEDIR/images/cache/cirros-0.3.5-x86_64-disk.img && openstack image create --file $BASEDIR/images/cache/cirros-0.3.5-x86_64-disk.img cirros-0.3.5-x86_64-disk.img) + fi + if [[ ! -z $VCD_AUTH_URL ]]; then +# TODO: Check for image over VIM before downloading + if [[ ! -s $BASEDIR/images/cache/cirros-0.3.5-x86_64-disk.img ]]; then + wget -r -nc http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img -O $BASEDIR/images/cache/cirros-0.3.5-x86_64-disk.img + fi + ovf_converter $BASEDIR/images/cache/cirros-0.3.5-x86_64-disk.img -n cirros + python $TOPDIR/tools/vmware_ovf_upload.py $VCD_AUTH_URL $VCD_USERNAME $VCD_PASSWORD $VCD_ORGANIZATION $BASEDIR/images/cache/cirros.ovf + fi + robot -d $BASEDIR/reports -i sanity $BASEDIR/testsuite/ + exit 0 +elif [[ "$TEST" == "comprehensive" ]]; then + echo "Robot Framework Comprehensive Test" + mkdir -p $BASEDIR/images/cache + if [[ ! -z $OS_AUTH_URL ]]; then + (openstack image show ubuntu1604) || (wget -r -nc https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img -O $BASEDIR/images/cache/xenial-server-cloudimg-amd64-disk1.img && make $BASEDIR/images/cache/xenial-server-cloudimg-amd64-disk1.img && openstack image create --file $BASEDIR/images/cache/xenial-server-cloudimg-amd64-disk1.img ubuntu1604) + (openstack image show hackfest3-mgmt) || (wget -r -nc https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img -O $BASEDIR/images/cache/xenial-server-cloudimg-amd64-disk1.img && make $BASEDIR/images/cache/xenial-server-cloudimg-amd64-disk1.img && openstack image create --file $BASEDIR/images/cache/xenial-server-cloudimg-amd64-disk1.img hackfest3-mgmt) + fi + if [[ ! -z $VCD_AUTH_URL ]]; then +# TODO: Check for image over VIM before downloading + if [[ ! -s $BASEDIR/images/cache/xenial-server-cloudimg-amd64-disk1.img ]]; then + wget -r -nc https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img -O $BASEDIR/images/cache/xenial-server-cloudimg-amd64-disk1.img + fi + ovf_converter $BASEDIR/images/cache/xenial-server-cloudimg-amd64-disk1.img -n ubuntu1604 + python $TOPDIR/tools/vmware_ovf_upload.py $VCD_AUTH_URL $VCD_USERNAME $VCD_PASSWORD $VCD_ORGANIZATION $BASEDIR/images/cache/ubuntu1604.ovf + fi + robot -d $BASEDIR/reports -i comprehensive $BASEDIR/testsuite/ + exit 0 +else + echo "wrong test provided" + exit 1 +fi + +exit 1 diff --git a/robot-systest/testsuite/api/TS01__Vim_Account.robot b/robot-systest/testsuite/api/TS01__Vim_Account.robot new file mode 100644 index 00000000..be04c3fd --- /dev/null +++ b/robot-systest/testsuite/api/TS01__Vim_Account.robot @@ -0,0 +1,54 @@ +# -*- 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-aug-2019 : Improvement to the code, robot framework initial seed code. +## + + +*** Settings *** +Documentation Test Suite to create and delete vim account +Library Collections +Library RequestsLibrary +Library OperatingSystem +Resource ../../lib/api/common.robot +Resource ../../lib/api/vim_lib.robot +Resource ../../resource/api/common.robot +Variables ../../resource/api/variables.py + +Suite Setup Get Auth Token +Suite Teardown Delete All Sessions + + +*** Variables *** +${vim_id} ${EMPTY} + + +*** Test Cases *** +Create Vim Account + [Tags] comprehensive api_vim_test + [Template] Create Vim + ${vim name} ${account type} ${auth url} ${user} ${password} ${tenant} ${description} + + +Delete Vim Account + [Tags] comprehensive api_vim_test + [Template] Delete Vim + ${vim_id} diff --git a/robot-systest/testsuite/cli/TS01__Test_VNF.robot b/robot-systest/testsuite/cli/TS01__Test_VNF.robot new file mode 100644 index 00000000..08a4e0ea --- /dev/null +++ b/robot-systest/testsuite/cli/TS01__Test_VNF.robot @@ -0,0 +1,109 @@ +# -*- 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com : 06-aug-2019 +## + + +*** Settings *** +Documentation Test Suite to test basic cirros VNF and NS using osm-client +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/vnfd_lib.robot +Resource ../../lib/cli/nsd_lib.robot +Resource ../../lib/cli/ns_lib.robot +Resource ../../lib/cli/vim_account_lib.robot +Library ../../lib/custom_lib.py +Variables ../../resource/cli/test_vnf_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +@{vnfd_ids} +@{nsd_ids} +@{ns_ids} +@{vim} +#${vim_name} robot_test + + +*** Test Cases *** +Create VNF Descriptor Test + [Tags] sanity smoke + + Build VNF Descriptor ${vnfdPckgPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + + +Create NS Descriptor Test + [Tags] sanity smoke + + Build NS Descriptor ${nsdPckgPath} + ${nsd_id}= Create NSD '${CURDIR}${/}../../..${nsdPckgPath}${nsdPckg}' + Append To List ${nsd_ids} ${nsd_id} + + +Network Service Instance Test + [Documentation] Launch and terminate network services + [Tags] sanity + [Setup] VIM Setup To Launch Network Services + [Teardown] Run Keyword And Ignore Error Network Service Instance Cleanup + + Should Not Be Empty ${vim} VIM details not provided + :FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} + + +Delete NS Descriptor Test + [Tags] sanity smoke + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + +Delete VNF Descriptor Test + [Tags] sanity smoke + + :FOR ${vnfd} IN @{vnfd_ids} + \ Delete VNFD ${vnfd} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Forcefully delete NSD and VNFD + + :FOR ${nsd} IN @{nsd_ids} + \ Force Delete NSD ${nsd} + + :FOR ${vnfd} IN @{vnfd_ids} + \ Force Delete VNFD ${vnfd} + + +Network Service Instance Cleanup + [Documentation] Forcefully delete created network service instances and vim account + + :FOR ${ns} IN @{ns_ids} + \ Force Delete NS ${ns} + + :FOR ${vim_id} IN @{vim} + \ Force Delete Vim Account ${vim_id} diff --git a/robot-systest/testsuite/cli/TS02__Test_Vim.robot b/robot-systest/testsuite/cli/TS02__Test_Vim.robot new file mode 100644 index 00000000..18f2a501 --- /dev/null +++ b/robot-systest/testsuite/cli/TS02__Test_Vim.robot @@ -0,0 +1,49 @@ +# -*- 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-aug-2019 : Improvement to the code, robot framework initial seed code. +## + + +*** Settings *** +Documentation Test suiet to create/delete vim account via osmclient +Library OperatingSystem +Library Collections +Resource ../../lib/cli/vim_account_lib.robot + + +*** Test Cases *** +Create Vim Account Test + [Tags] smoke vim + + Create Vim Account + + +Get Vim Accounts List Test + [Tags] vim + + Get Vim List + + +Delete Vim Account Test + [Tags] smoke vim + + Delete Vim Account diff --git a/robot-systest/testsuite/cli/TS03__Hackfest_Basic_NS.robot b/robot-systest/testsuite/cli/TS03__Hackfest_Basic_NS.robot new file mode 100644 index 00000000..d55540a2 --- /dev/null +++ b/robot-systest/testsuite/cli/TS03__Hackfest_Basic_NS.robot @@ -0,0 +1,109 @@ +# -*- 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com : 06-aug-2019 +## + + +*** Settings *** +Documentation Test Suite to create hackfest basic nestwork service +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/vnfd_lib.robot +Resource ../../lib/cli/nsd_lib.robot +Resource ../../lib/cli/ns_lib.robot +Resource ../../lib/cli/vim_account_lib.robot +Library ../../lib/custom_lib.py +Variables ../../resource/cli/hackfest_basic_ns_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +@{vnfd_ids} +${nsd_id} +@{nsd_ids} +@{ns_ids} +@{vim} + + +*** Test Cases *** +Create Hackfest Basic VNF Descriptor + [Tags] comprehensive hackfest_basic_ns + + Build VNF Descriptor ${vnfdPckgPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + + +Create Hackfest Basic NS Descriptor + [Tags] comprehensive hackfest_basic_ns + + Build NS Descriptor ${nsdPckgPath} + ${nsd_id}= Create NSD '${CURDIR}${/}../../..${nsdPckgPath}${nsdPckg}' + Append To List ${nsd_ids} ${nsd_id} + + +Network Service Instance Test + [Documentation] Launch and terminate network services + [Tags] comprehensive hackfest_basic_ns + [Setup] VIM Setup To Launch Network Services + [Teardown] Run Keyword And Ignore Error Network Service Instance Cleanup + + Should Not Be Empty ${vim} VIM details not provided + :FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} + + +Delete NS Descriptor Test + [Tags] comprehensive hackfest_basic_ns + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + +Delete VNF Descriptor Test + [Tags] comprehensive hackfest_basic_ns + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Delete VNFD ${vnfd_id} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Forcefully delete NSD and VNFD + + :FOR ${nsd} IN @{nsd_ids} + \ Force Delete NSD ${nsd_id} + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Force Delete VNFD ${vnfd_id} + + +Network Service Instance Cleanup + [Documentation] Forcefully delete created network service instances and vim account + + :FOR ${ns_id} IN @{ns_ids} + \ Force Delete NS ${ns_id} + + :FOR ${vim_id} IN @{vim} + \ Force Delete Vim Account ${vim_id} diff --git a/robot-systest/testsuite/cli/TS04__Hackfest_Simplecharm_NS.robot b/robot-systest/testsuite/cli/TS04__Hackfest_Simplecharm_NS.robot new file mode 100644 index 00000000..74392595 --- /dev/null +++ b/robot-systest/testsuite/cli/TS04__Hackfest_Simplecharm_NS.robot @@ -0,0 +1,114 @@ +# -*- 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com : 06-aug-2019 +## + + +*** Settings *** +Documentation Test Suite to create hackfest simplecharm ns +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/vnfd_lib.robot +Resource ../../lib/cli/nsd_lib.robot +Resource ../../lib/cli/ns_lib.robot +Resource ../../lib/cli/vim_account_lib.robot +Library ../../lib/custom_lib.py +Variables ../../resource/cli/hackfest_simplecharm_ns_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +@{vnfd_ids} +${nsd_id} +@{nsd_ids} +@{ns_ids} +@{vim} +${vnfdftpPath} https://osm-download.etsi.org/ftp/osm-6.0-six/7th-hackfest/packages/hackfest_simplecharm_vnf.tar.gz +${nsdftpPath} https://osm-download.etsi.org/ftp/osm-6.0-six/7th-hackfest/packages/hackfest_simplecharm_ns.tar.gz + + +*** Test Cases *** +Create Hackfest Simple Charm VNF Descriptor + [Tags] hackfest_simplecharm comprehensive + + #Build VNF Descriptor ${vnfdPckgPath} + #Workarround for charm build issue + ${rc} ${stdout}= Run and Return RC and Output wget -P '${CURDIR}${/}../../..${vnfdPckgPath}${/}build/' ${vnfdftpPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + + +Create Hackfest Simple Charm NS Descriptor + [Tags] hackfest_simplecharm comprehensive + + #Build NS Descriptor ${nsdPckgPath} + ${rc} ${stdout}= Run and Return RC and Output wget -P '${CURDIR}${/}../../..${nsdPckgPath}${/}build/' ${nsdftpPath} + ${nsd_id}= Create NSD '${CURDIR}${/}../../..${nsdPckgPath}${nsdPckg}' + Append To List ${nsd_ids} ${nsd_id} + + +Network Service Instance Test + [Documentation] Launch and terminate network services + [Tags] hackfest_simplecharm comprehensive + [Setup] VIM Setup To Launch Network Services + [Teardown] Run Keyword And Ignore Error Network Service Instance Cleanup + + Should Not Be Empty ${vim} VIM details not provided + :FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} + + +Delete NS Descriptor Test + [Tags] hackfest_simplecharm comprehensive + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + +Delete VNF Descriptor Test + [Tags] hackfest_simplecharm comprehensive + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Delete VNFD ${vnfd_id} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Forcefully delete NSD and VNFD + + :FOR ${nsd} IN @{nsd_ids} + \ Force Delete NSD ${nsd_id} + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Force Delete VNFD ${vnfd_id} + + +Network Service Instance Cleanup + [Documentation] Forcefully delete created network service instances and vim account + + :FOR ${ns_id} IN @{ns_ids} + \ Force Delete NS ${ns_id} + + :FOR ${vim_id} IN @{vim} + \ Force Delete Vim Account ${vim_id} diff --git a/robot-systest/testsuite/cli/TS05__Hackfest_Multivdu_NS.robot b/robot-systest/testsuite/cli/TS05__Hackfest_Multivdu_NS.robot new file mode 100644 index 00000000..7fa6c24a --- /dev/null +++ b/robot-systest/testsuite/cli/TS05__Hackfest_Multivdu_NS.robot @@ -0,0 +1,109 @@ +# -*- 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com : 06-aug-2019 +## + + +*** Settings *** +Documentation Test Suite to create hackfest multivdu ns +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/vnfd_lib.robot +Resource ../../lib/cli/nsd_lib.robot +Resource ../../lib/cli/ns_lib.robot +Resource ../../lib/cli/vim_account_lib.robot +Library ../../lib/custom_lib.py +Variables ../../resource/cli/hackfest_multivdu_ns_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +@{vnfd_ids} +${nsd_id} +@{nsd_ids} +@{ns_ids} +@{vim} + + +*** Test Cases *** +Create Hackfest Multivdu VNF Descriptor + [Tags] comprehensive hackfest_multivdu + + Build VNF Descriptor ${vnfdPckgPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + + +Create Hackfest Multivdu NS Descriptor + [Tags] comprehensive hackfest_multivdu + + Build NS Descriptor ${nsdPckgPath} + ${nsd_id}= Create NSD '${CURDIR}${/}../../..${nsdPckgPath}${nsdPckg}' + Append To List ${nsd_ids} ${nsd_id} + + +Network Service Instance Test + [Documentation] Launch and terminate network services + [Tags] comprehensive hackfest_multivdu + [Setup] VIM Setup To Launch Network Services + [Teardown] Run Keyword And Ignore Error Network Service Instance Cleanup + + Should Not Be Empty ${vim} VIM details not provided + :FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} + + +Delete NS Descriptor Test + [Tags] comprehensive hackfest_multivdu + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + +Delete VNF Descriptor Test + [Tags] comprehensive hackfest_multivdu + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Delete VNFD ${vnfd_id} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Forcefully delete NSD and VNFD + + :FOR ${nsd} IN @{nsd_ids} + \ Force Delete NSD ${nsd_id} + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Force Delete VNFD ${vnfd_id} + + +Network Service Instance Cleanup + [Documentation] Forcefully delete created network service instances and vim account + + :FOR ${ns_id} IN @{ns_ids} + \ Force Delete NS ${ns_id} + + :FOR ${vim_id} IN @{vim} + \ Force Delete Vim Account ${vim_id} diff --git a/robot-systest/testsuite/cli/TS06__Hackfest_Cloudinit_NS.robot b/robot-systest/testsuite/cli/TS06__Hackfest_Cloudinit_NS.robot new file mode 100644 index 00000000..a43f3a22 --- /dev/null +++ b/robot-systest/testsuite/cli/TS06__Hackfest_Cloudinit_NS.robot @@ -0,0 +1,109 @@ +# -*- 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com : 06-aug-2019 +## + + +*** Settings *** +Documentation Test Suite to create hackfest cloudinit ns +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/vnfd_lib.robot +Resource ../../lib/cli/nsd_lib.robot +Resource ../../lib/cli/ns_lib.robot +Resource ../../lib/cli/vim_account_lib.robot +Library ../../lib/custom_lib.py +Variables ../../resource/cli/hackfest_cloudinit_ns_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +@{vnfd_ids} +${nsd_id} +@{nsd_ids} +@{ns_ids} +@{vim} + + +*** Test Cases *** +Create Hackfest Cloudinit VNF Descriptor + [Tags] comprehensive hackfest_cloudinit + + Build VNF Descriptor ${vnfdPckgPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + + +Create Hackfest Cloudinit NS Descriptor + [Tags] comprehensive hackfest_cloudinit + + Build NS Descriptor ${nsdPckgPath} + ${nsd_id}= Create NSD '${CURDIR}${/}../../..${nsdPckgPath}${nsdPckg}' + Append To List ${nsd_ids} ${nsd_id} + + +Network Service Instance Test + [Documentation] Launch and terminate network services + [Tags] comprehensive hackfest_cloudinit + [Setup] VIM Setup To Launch Network Services + [Teardown] Run Keyword And Ignore Error Network Service Instance Cleanup + + Should Not Be Empty ${vim} VIM details not provided + :FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} + + +Delete NS Descriptor Test + [Tags] comprehensive hackfest_cloudinit + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + +Delete VNF Descriptor Test + [Tags] comprehensive hackfest_cloudinit + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Delete VNFD ${vnfd_id} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Forcefully delete NSD and VNFD + + :FOR ${nsd} IN @{nsd_ids} + \ Force Delete NSD ${nsd_id} + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Force Delete VNFD ${vnfd_id} + + +Network Service Instance Cleanup + [Documentation] Forcefully delete created network service instances and vim account + + :FOR ${ns_id} IN @{ns_ids} + \ Force Delete NS ${ns_id} + + :FOR ${vim_id} IN @{vim} + \ Force Delete Vim Account ${vim_id} diff --git a/robot-systest/testsuite/cli/TS07__Hackfest_EPA_NS.robot b/robot-systest/testsuite/cli/TS07__Hackfest_EPA_NS.robot new file mode 100644 index 00000000..2d8d3be0 --- /dev/null +++ b/robot-systest/testsuite/cli/TS07__Hackfest_EPA_NS.robot @@ -0,0 +1,109 @@ +# -*- 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: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com : 06-aug-2019 +## + + +*** Settings *** +Documentation Test Suite to create hackfest epa ns +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/vnfd_lib.robot +Resource ../../lib/cli/nsd_lib.robot +Resource ../../lib/cli/ns_lib.robot +Resource ../../lib/cli/vim_account_lib.robot +Library ../../lib/custom_lib.py +Variables ../../resource/cli/hackfest_epa_ns_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +@{vnfd_ids} +${nsd_id} +@{nsd_ids} +@{ns_ids} +@{vim} + + +*** Test Cases *** +Create Hackfest EPA VNF Descriptor + [Tags] hackfest_epa + + Build VNF Descriptor ${vnfdPckgPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + + +Create Hackfest EPA NS Descriptor + [Tags] hackfest_epa + + Build NS Descriptor ${nsdPckgPath} + ${nsd_id}= Create NSD '${CURDIR}${/}../../..${nsdPckgPath}${nsdPckg}' + Append To List ${nsd_ids} ${nsd_id} + + +Network Service Instance Test + [Documentation] Launch and terminate network services + [Tags] hackfest_epa + [Setup] VIM Setup To Launch Network Services + [Teardown] Run Keyword And Ignore Error Network Service Instance Cleanup + + Should Not Be Empty ${vim} VIM details not provided + :FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} + + +Delete NS Descriptor Test + [Tags] hackfest_epa + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + +Delete VNF Descriptor Test + [Tags] hackfest_epa + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Delete VNFD ${vnfd_id} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Forcefully delete NSD and VNFD + + :FOR ${nsd} IN @{nsd_ids} + \ Force Delete NSD ${nsd_id} + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Force Delete VNFD ${vnfd_id} + + +Network Service Instance Cleanup + [Documentation] Forcefully delete created network service instances and vim account + + :FOR ${ns_id} IN @{ns_ids} + \ Force Delete NS ${ns_id} + + :FOR ${vim_id} IN @{vim} + \ Force Delete Vim Account ${vim_id} diff --git a/robot-systest/testsuite/client_library/TS01__OSMClient_Library_Test.robot b/robot-systest/testsuite/client_library/TS01__OSMClient_Library_Test.robot new file mode 100644 index 00000000..42b455ac --- /dev/null +++ b/robot-systest/testsuite/client_library/TS01__OSMClient_Library_Test.robot @@ -0,0 +1,82 @@ +## +# 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. +## + + +*** Settings *** +Documentation Test suite to test osmclient python library +Library OperatingSystem + +Suite Setup Setup OSM Client + + +*** Variables *** +${name} helloworld-os +${user} robottest +${password} fred +${authurl} https://169.254.169.245/ +${type} openstack +${desc} a test vim +${tenant} robottest + + +*** Test Cases *** +Get VIM Account List Test + [Tags] comprehensive osmclient_lib + [Documentation] Using python's osmclient library to get vim account list + + ${vim_list}= osmclient.get_vim_list + log to console ${vim_list} + log ${vim_list} + + +Get VNF Descriptor List Test + [Tags] comprehensive osmclient_lib + [Documentation] Using python's osmclient library to get vnfd list + + ${vnfd_list}= osmclient.get_vnfd_list + log to console ${vnfd_list} + log ${vnfd_list} + + +Get NS Descriptor List Test + [Tags] comprehensive osmclient_lib + [Documentation] Using python's osmclient library to get nsd list + + ${nsd_list}= osmclient.get_nsd_list + log to console ${nsd_list} + log ${nsd_list} + + +Create Vim Account Test + [Tags] comprehensive osmclient_lib + [Documentation] Using python's osmclient library to create vim account + [Template] osmclient.create_vim_account + ${name} ${type} ${user} ${password} ${authurl} ${tenant} ${desc} + + +Delete Vim Account Test + [Tags] comprehensive osmclient_lib + [Documentation] Using python's osmclient library to delete vim account + osmclient.delete_vim_account ${name} + + +*** Keywords *** +Setup OSM Client + evaluate sys.path.append('${CURDIR}${/}../../lib/client_lib') modules=sys + ${host}= Get Environment Variable OSM_HOSTNAME 127.0.0.1 + Import Library ClientLib host=${host} WITH NAME osmclient diff --git a/robot-systest/testsuite/gui/TS01__Test_GUI_Login.robot b/robot-systest/testsuite/gui/TS01__Test_GUI_Login.robot new file mode 100644 index 00000000..4f20a180 --- /dev/null +++ b/robot-systest/testsuite/gui/TS01__Test_GUI_Login.robot @@ -0,0 +1,41 @@ +# -*- 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 +## + + +*** Settings *** +Documentation Suite description +Library SeleniumLibrary +Library OperatingSystem +Resource ../../lib/gui/login_gui.robot + + +*** Test Cases *** +Valid Login + [Tags] comprehensive gui_login_test + [Setup] Set Server URL + Open Browser To Login Page + Enter Credentials admin admin + Submit Credentials + Home Page Should Be Open + [Teardown] Close Browser