X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Flib%2Fns_lib.robot;h=a38a69eb9573dc649dd782a7881da122e0bb08e5;hb=e621de67c631e6a103c9dd4515749976973a59fa;hp=148e3813aba27b3e348e930c704373d4c3138cf1;hpb=045bd33b65fb7f6fe07ebafd8795b6a05797b2b1;p=osm%2Ftests.git diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot index 148e381..a38a69e 100644 --- a/robot-systest/lib/ns_lib.robot +++ b/robot-systest/lib/ns_lib.robot @@ -10,21 +10,29 @@ # See the License for the specific language governing permissions and # limitations under the License. +*** Settings *** +Documentation Library to deploy and delete NS, and run operations on them. + +Library DateTime + + *** Variables *** ${success_return_code} 0 ${ns_launch_pol_time} 30sec -${ns_delete_max_wait_time} 4min ${ns_delete_pol_time} 15sec ${ns_action_max_wait_time} 1min ${ns_action_pol_time} 15sec -${vnf_scale_max_wait_time} 2min ${vnf_scale_pol_time} 15sec +${vim_timeout_multiplier} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0} *** Keywords *** Create Network Service - [Arguments] ${nsd} ${vim_name} ${ns_name} ${ns_config} ${publickey} ${ns_launch_max_wait_time}=5min ${config_file}=${EMPTY} + [Arguments] ${nsd} ${vim_name} ${ns_name} ${ns_config} ${publickey} ${ns_launch_max_wait_time}=5min ${config_file}=${EMPTY} + ${ns_launch_max_wait_time}= Convert Time ${ns_launch_max_wait_time} result_format=number + ${ns_launch_max_wait_time}= Evaluate ${ns_launch_max_wait_time} * ${vim_timeout_multiplier} + Log ${ns_launch_max_wait_time} ${config_attr} Set Variable If '${ns_config}'!='${EMPTY}' --config '${ns_config}' \ ${sshkeys_attr} Set Variable If '${publickey}'!='${EMPTY}' --ssh_keys ${publickey} \ ${config_file_attr} Set Variable If '${config_file}'!='${EMPTY}' --config_file '${config_file}' \ @@ -109,6 +117,8 @@ Get Vnf Ip List Check For Ns Instance To Configured [arguments] ${ns_name} + ${rc} ${stdout}= Run and Return RC and Output openstack server list + log ${stdout} ${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} @@ -117,6 +127,8 @@ Check For Ns Instance To Configured Check For NS Instance For Failure [Arguments] ${ns_name} + ${rc} ${stdout}= Run and Return RC and Output openstack server list + log ${stdout} ${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} @@ -125,15 +137,20 @@ Check For NS Instance For Failure Check For NS Instance To Be Deleted [Arguments] ${ns} + ${rc} ${stdout}= Run and Return RC and Output openstack server list + log ${stdout} ${rc} ${stdout}= Run and Return RC and Output osm ns-list | awk '{print $2}' | grep ${ns} Should Not Be Equal As Strings ${stdout} ${ns} Delete NS - [Documentation] Delete ns - [Arguments] ${ns} + [Documentation] Delete ns + [Arguments] ${ns} ${ns_delete_max_wait_time}=4min + ${ns_delete_max_wait_time}= Convert Time ${ns_delete_max_wait_time} result_format=number + ${ns_delete_max_wait_time}= Evaluate ${ns_delete_max_wait_time} * ${vim_timeout_multiplier} + Log ${ns_delete_max_wait_time} ${rc} ${stdout}= Run and Return RC and Output osm ns-delete ${ns} - log ${stdout} + Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} WAIT UNTIL KEYWORD SUCCEEDS ${ns_delete_max_wait_time} ${ns_delete_pol_time} Check For NS Instance To Be Deleted ${ns} @@ -193,8 +210,10 @@ Execute Manual VNF Scale ... The parameter 'scale_type' must be SCALE_IN or SCALE_OUT. ... Return the ID of the operation associated to the executed scale action. - [Arguments] ${ns_name} ${vnf_member_index} ${scaling_group} ${scale_type} + [Arguments] ${ns_name} ${vnf_member_index} ${scaling_group} ${scale_type} ${vnf_scale_max_wait_time}=2min + ${vnf_scale_max_wait_time}= Convert Time ${vnf_scale_max_wait_time} result_format=number + ${vnf_scale_max_wait_time}= Evaluate ${vnf_scale_max_wait_time} * ${vim_timeout_multiplier} Should Contain Any ${scale_type} SCALE_IN SCALE_OUT msg=Unknown scale type: ${scale_type} values=False ${osm_vnf_scale_command}= Set Variable osm vnf-scale --scaling-group ${scaling_group} ${osm_vnf_scale_command}= Run Keyword If '${scale_type}'=='SCALE_IN' Catenate ${osm_vnf_scale_command} --scale-in @@ -220,7 +239,7 @@ Check For NS Operation Completed [Arguments] ${ns_operation_id} - ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq r - operationState + ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq .operationState | tr -d \\" log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} Should Contain ${stdout} COMPLETED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False @@ -242,7 +261,7 @@ Get Vnf Vdur Names [Arguments] ${vnf_id} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq r - vdur.*.name + ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq .vdur[].name | tr -d \\" Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False @{vdur} = Split String ${stdout} [Return] @{vdur} @@ -253,7 +272,18 @@ Get Vnf Kdu Replica Count [Arguments] ${vnf_id} ${kdu_name} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --kdu ${kdu_name} | yq r - config.replicaCount + ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --kdu ${kdu_name} | yq .config.replicaCount | tr -d \\" Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - [Return] ${stdout} + ${return} = Set Variable If '${stdout}' == 'null' ${EMPTY} ${stdout} + [Return] ${return} + +Get Application Names + [Documentation] Return the list of the application of a VNF instance. + + [Arguments] ${ns_name} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-show ${ns_name} --literal | yq ._admin.deployed.VCA[].application | tr -d \\" + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + @{app_names} = Split String ${stdout} + [Return] ${app_names} \ No newline at end of file