From: aguilard Date: Wed, 30 Jun 2021 10:28:46 +0000 (+0200) Subject: New testsuite fail01 to test failed deployments because of lack of resources X-Git-Tag: release-v11.0-start~11 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Ftests.git;a=commitdiff_plain;h=3422ec3dae4cb95c855f8809e70a126ae6d23558 New testsuite fail01 to test failed deployments because of lack of resources Updated openstack_lib.robot for adding new keyword 'Check NS Servers In VIM' needed by fail01 test. Change-Id: Ib602d27d8643e9c4b7c1029533258b79df5e86a8 Signed-off-by: aguilard --- diff --git a/robot-systest/lib/openstack_lib.robot b/robot-systest/lib/openstack_lib.robot index 5564e44..cd03eb8 100644 --- a/robot-systest/lib/openstack_lib.robot +++ b/robot-systest/lib/openstack_lib.robot @@ -33,3 +33,16 @@ Get Flavor Properties log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} [Return] ${stdout} + + +Check NS Servers In VIM + [Documentation] Check if the number of servers in Openstack by filtering by NS name is as expected. + [Arguments] ${ns_name} ${number} + + Should Not Be Empty ${ns_name} + ${rc} ${stdout}= Run and Return RC and Output openstack server list | grep ${ns_name} | awk '{print $4}' + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + @{servers} = Split String ${stdout} + ${n_servers}= Get Length ${servers} + Should Be Equal As Integers ${number} ${n_servers} diff --git a/robot-systest/testsuite/fail_01-insufficient_resources.robot b/robot-systest/testsuite/fail_01-insufficient_resources.robot new file mode 100644 index 0000000..b89f861 --- /dev/null +++ b/robot-systest/testsuite/fail_01-insufficient_resources.robot @@ -0,0 +1,112 @@ +# 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 [FAIL-01] A single VNF with 2 VDUs, one of them unallocatable because of resources. + +Library OperatingSystem +Library String +Library Collections +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/openstack_lib.robot + +Force Tags fail_01 cluster_main daily regression + +Suite Teardown Run Keyword And Ignore Error Suite Cleanup + + +*** Variables *** +# NS and VNF descriptor package folder and ids +${vnfd_pkg} simple_2vm_vnf +${vnfd_name} simple_2vm-vnf +${nsd_pkg} simple_2vm_ns +${nsd_name} simple_2vm-ns + +# NS instance name and configuration +${ns_name_prefix} fail_01 +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } + +# SSH keys to be used +${publickey} %{HOME}/.ssh/id_rsa.pub + +# Default memory for dataVM VDU (can be overwritten by VM_MEMORY_OVERRIDE environment variable) +${default_memory} 100 + +# NS launch timeout and polling time +${ns_launch_max_wait_time} 5min +${ns_launch_pol_time} 15 + +# Openstack delete operation timeout and polling time +${os_delete_max_wait_time} 6min +${os_delete_pol_time} 20 + + +*** Test Cases *** +Create VNF Descriptor + + ${memory}= Get Environment Variable VM_MEMORY_OVERRIDE default=${default_memory} + Create VNFD Overriding Fields '%{PACKAGES_FOLDER}/${vnfd_pkg}' virtual-compute-desc.1.virtual-memory.size=${memory} + + +Create NS Descriptor + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + + +Cannot Instantiate Network Service + + ${rand}= Generate Random String 4 [NUMBERS] + ${ns_name}= Catenate SEPARATOR=_ ${ns_name_prefix} ${rand} + Set Suite Variable ${ns_name} + log ${ns_name} + ${id}= Instantiate Network Service ${ns_name} ${nsd_name} %{VIM_TARGET} --config '${ns_config}' --ssh_keys ${publickey} + log ${id} + Set Suite Variable ${ns_id} ${id} + WAIT UNTIL KEYWORD SUCCEEDS ${ns_launch_max_wait_time} ${ns_launch_pol_time} Check For Ns Instance To Configured ${ns_name} + ${rc} ${stdout}= run and return rc and output osm ns-list --filter id="${ns_id}" | grep ${ns_id} | awk '{print $8}' + log ${stdout} + Should Contain ${stdout} BROKEN + ${rc} ${stdout}= run and return rc and output osm ns-show ${ns_id} --literal | yq .errorDetail + log ${stdout} + Should Contain ${stdout} Deploying at VIM: Error at create vdu + + +Delete NS Instance And Check VIM + [Tags] cleanup + + Delete NS ${ns_name} + WAIT UNTIL KEYWORD SUCCEEDS ${os_delete_max_wait_time} ${os_delete_pol_time} Check NS Servers In VIM ${ns_name} 0 + + +Delete NS Descriptor + [Tags] cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor + [Tags] cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Suite Cleanup + [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance + + Run Keyword If Any Tests Failed Delete NS ${ns_name} + Run Keyword If Any Tests Failed Delete NSD ${nsd_name} + Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}