From d1d030c9a30bd1b274c3d17af2da2d79c5668e10 Mon Sep 17 00:00:00 2001 From: dhanasekaran Date: Thu, 16 Jun 2022 14:10:06 +0000 Subject: [PATCH] Robot fix for Autohealing tests Change-Id: I40164ad92a59690fdfe295506800a18c1b30f49a Signed-off-by: dhanasekaran --- robot-systest/lib/ns_lib.robot | 14 ++++++++++ .../testsuite/heal_04-autohealing.robot | 27 +++++++++++-------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot index 3cd863e..c864218 100644 --- a/robot-systest/lib/ns_lib.robot +++ b/robot-systest/lib/ns_lib.robot @@ -373,3 +373,17 @@ Get VDU Affinity Group Name log ${affinity_group_name} Should Be Equal As Integers ${rc} ${success_return_code} msg=${affinity_group_name} values=False [Return] ${affinity_group_name} + + +Get Operations By Type + [Documentation] Keyword to get the operation by type + + [Arguments] ${ns_id} ${type} + + Should Not Be Empty ${ns_id} + Should Not Be Empty ${type} + ${rc} ${stdout}= Run and Return RC and Output osm ns-op-list ${ns_id} | grep ${type} | awk '{print $2}' 2>&1 + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Be Empty ${stdout} + [Return] ${stdout} diff --git a/robot-systest/testsuite/heal_04-autohealing.robot b/robot-systest/testsuite/heal_04-autohealing.robot index 990b44a..024cd3d 100644 --- a/robot-systest/testsuite/heal_04-autohealing.robot +++ b/robot-systest/testsuite/heal_04-autohealing.robot @@ -31,7 +31,7 @@ Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot ${vnfd_pkg} autoheal_vnf ${vnfd_name} autoheal_vnfd ${vdu_name} autoheal_vnfd-VM -${vnf_index} 1 +${vnf_index} autoheal-basic-1 ${nsd_pkg} autoheal_ns ${nsd_name} autoheal_nsd # NS instance name and configuration @@ -46,25 +46,26 @@ ${password} ${EMPTY} ${success_return_code} 0 +#Healing wait time +${healing_pol_time} 15sec +${healing_max_wait_time} 10m + *** Test Cases *** Create VNF Descriptors - [Tags] prepare Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' Create NS Descriptor - [Tags] prepare Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' Network Service Instance Test - [Tags] prepare ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} Set Suite Variable ${ns_id} ${id} Get NS Id - [Tags] verify cleanup + [Tags] cleanup ${variables} Get Variables IF not "\${ns_id}" in "${variables}" ${id}= Get Ns Id ${ns_name} @@ -73,7 +74,6 @@ Get NS Id Get VNF Info - [Tags] verify Variable Should Exist ${ns_id} msg=NS is not available ${ip_addr}= Get Vnf Management Ip Address ${ns_id} ${vnf_index} log ${ip_addr} @@ -91,20 +91,25 @@ Get VNF Info Stop Autoheal VDU - [Tags] verify Variable Should Exist ${vdu_autoheal_id} msg=VDU is not available Halt Server ${vdu_autoheal_id} Sleep 20 -Check VNF After Healing - [Tags] verify +Wait For Autohealing To Be Completed FOR ${Index} IN RANGE 0 15 - ${server_status}= Get Server Property ${vdu_autoheal_id} status - ${status}= Run Keyword And Return Status Should Be Equal ${server_status} ACTIVE + ${status}= Run Keyword And Return Status Get Operations By Type ${ns_id} heal Run Keyword If ${status} Exit For Loop ... ELSE Sleep 10 END + ${stdout}= Get Operations By Type ${ns_id} heal + ${healing_max_wait_time}= Convert Time ${healing_max_wait_time} result_format=number + ${healing_max_wait_time}= Evaluate ${healing_max_wait_time} * ${vim_timeout_multiplier} + Wait Until Keyword Succeeds ${healing_max_wait_time} ${healing_pol_time} Check For NS Operation Ended ${stdout} + Check For NS Operation Completed ${stdout} + + +Check VNF After Healing Variable Should Exist ${vnf_autoheal_id} msg=VNF is not available @{ip_list}= Get Vnf Vdur IPs ${vnf_autoheal_id} -- 2.17.1