From e4cda0cbf4f095337f9c152dda947949f8e5c62f Mon Sep 17 00:00:00 2001 From: aguilard Date: Thu, 24 Feb 2022 10:54:14 +0000 Subject: [PATCH] FAIL01 test: read the RAM quota in Openstack Now the test sets the memory of VDU with the amount of memory obtained from the Openstack quota. Change-Id: Id3efc8caee01092e4aeb3b83588b91a096d03a34 Signed-off-by: aguilard Signed-off-by: garciadeblas --- robot-systest/lib/openstack_lib.robot | 12 ++++++++++++ .../testsuite/fail_01-insufficient_resources.robot | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/robot-systest/lib/openstack_lib.robot b/robot-systest/lib/openstack_lib.robot index cd03eb8..c72892e 100644 --- a/robot-systest/lib/openstack_lib.robot +++ b/robot-systest/lib/openstack_lib.robot @@ -46,3 +46,15 @@ Check NS Servers In VIM @{servers} = Split String ${stdout} ${n_servers}= Get Length ${servers} Should Be Equal As Integers ${number} ${n_servers} + + +Get Project Quota + [Documentation] Get a field (ram, cores, ports, etc.) from quota in current project. + [Arguments] ${field} + + Should Not Be Empty ${field} + ${rc} ${stdout}= Run and Return RC and Output openstack quota show -c ${field} -f value + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + diff --git a/robot-systest/testsuite/fail_01-insufficient_resources.robot b/robot-systest/testsuite/fail_01-insufficient_resources.robot index 3cefe5c..958d45c 100644 --- a/robot-systest/testsuite/fail_01-insufficient_resources.robot +++ b/robot-systest/testsuite/fail_01-insufficient_resources.robot @@ -42,7 +42,8 @@ ${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 in GB for dataVM VDU (can be overwritten by VM_MEMORY_OVERRIDE environment variable) +# Only used if no quota is defined in Openstack's project (VDU tries to allocate the full memory of the quota) ${default_memory} 250 # NS launch timeout and polling time @@ -57,7 +58,13 @@ ${os_delete_pol_time} 20 *** Test Cases *** Create VNF Descriptor - ${memory}= Get Environment Variable VM_MEMORY_OVERRIDE default=${default_memory} + ${ram_quota}= Get Project Quota ram + IF ${ram_quota} == -1 + ${memory}= Get Environment Variable VM_MEMORY_OVERRIDE default=${default_memory} + ELSE + ${memory}= Evaluate ${ram_quota} / 1000 + END + log ${memory} Create VNFD Overriding Fields '%{PACKAGES_FOLDER}/${vnfd_pkg}' virtual-compute-desc.1.virtual-memory.size=${memory} -- 2.25.1