X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Flib%2Fns_lib.robot;h=a7c6cb9b5cbd42e7a6beae3b42c4c15942f39d7b;hb=6cd74807debed3f4414da8b4d3fc4c17b1b56c14;hp=0747bc15c1933cd08af86eb82aa555dea555bfa7;hpb=eb5556e1fb8ce40d7fc48872d1420e57b1cffc65;p=osm%2Ftests.git diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot index 0747bc1..a7c6cb9 100644 --- a/robot-systest/lib/ns_lib.robot +++ b/robot-systest/lib/ns_lib.robot @@ -22,7 +22,6 @@ ${ns_launch_pol_time} 30sec ${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} @@ -55,6 +54,15 @@ Instantiate Network Service [Return] ${stdout} +Update Network Service + [Arguments] ${ns_id} ${update_type} ${ns_update_config} ${ns_update_timeout} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-update ${ns_id} --updatetype ${update_type} --config ${ns_update_config} --timeout ${ns_update_timeout} --wait + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + Get Vnf Management Ip Address [Arguments] ${ns_id} ${vnf_member_index} @@ -77,6 +85,17 @@ Get Vnf Id [Return] ${stdout} +Get Ns Id + [Arguments] ${ns_name} + + Should Not Be Empty ${ns_name} + ${rc} ${stdout}= Run and Return RC and Output osm ns-list | grep ${ns_name} | awk '{print $4}' 2>&1 + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Be Empty ${stdout} + [Return] ${stdout} + + Get Ns Vnf List [Arguments] ${ns_id} @@ -211,8 +230,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 @@ -276,3 +297,39 @@ Get Vnf Kdu Replica Count ${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} + + +Get VDU Affinity Group Name + [Documentation] Return the affinity group name for a NF + + [Arguments] ${ns_name} ${vnf_id} ${vdur_id} + + ${rc} ${affinity_group_id}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq '."affinity-or-anti-affinity-group-id"[0]' | tr -d \\" 2>&1 + log ${affinity_group_id} + Should Be Equal As Integers ${rc} ${success_return_code} msg=${affinity_group_id} values=False + ${rc} ${affinity_group_name}= Run and Return RC and Output osm ns-show ${ns_name} --literal | yq '."affinity-or-anti-affinity-group"[] | select(.id == "'${affinity_group_id}'")' | yq '.name' | tr -d \\" 2>&1 + log ${affinity_group_name} + Should Be Equal As Integers ${rc} ${success_return_code} msg=${affinity_group_name} values=False + [Return] ${affinity_group_name} + + +Get Vnf Namespace + [Documentation] Return the KDU's namespace + + [Arguments] ${vnf_id} + + ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.kdur[]."k8s-namespace"' | tr -d \\" + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + Should Not Be Empty ${stdout} + log namespace: ${stdout} + [Return] ${stdout}