X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=robot-systest%2Flib%2Fns_lib.robot;h=c8642187713ff1f9d310ad18db5cdfe55f0f86a7;hb=631d1616bfd6f500ab4c454967678cbb042dcd8c;hp=0976241986706edb353e158fc630d68b316a1b69;hpb=6b82eaf4e1e4ed757eeb40d2ae423f7137214717;p=osm%2Ftests.git diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot index 0976241..c864218 100644 --- a/robot-systest/lib/ns_lib.robot +++ b/robot-systest/lib/ns_lib.robot @@ -23,6 +23,7 @@ ${ns_delete_pol_time} 15sec ${ns_action_max_wait_time} 1min ${ns_action_pol_time} 15sec ${vnf_scale_pol_time} 15sec +${healing_pol_time} 15sec ${vim_timeout_multiplier} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0} @@ -54,6 +55,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} @@ -187,7 +197,8 @@ Execute NS Action ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name} ${rc} ${stdout}= Run and Return RC and Output ${osm_ns_action_command} Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Wait Until Keyword Succeeds ${ns_action_max_wait_time} ${ns_action_pol_time} Check For NS Operation Completed ${stdout} + Wait Until Keyword Succeeds ${ns_action_max_wait_time} ${ns_action_pol_time} Check For NS Operation Ended ${stdout} + Check For NS Operation Completed ${stdout} [Return] ${stdout} @@ -212,7 +223,8 @@ Execute NS K8s Action ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name} ${rc} ${stdout}= Run and Return RC and Output ${osm_ns_action_command} Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Wait Until Keyword Succeeds ${ns_action_max_wait_time} ${ns_action_pol_time} Check For NS Operation Completed ${stdout} + Wait Until Keyword Succeeds ${ns_action_max_wait_time} ${ns_action_pol_time} Check For NS Operation Ended ${stdout} + Check For NS Operation Completed ${stdout} [Return] ${stdout} @@ -232,13 +244,32 @@ Execute Manual VNF Scale ${osm_vnf_scale_command}= Catenate ${osm_vnf_scale_command} ${ns_name} ${vnf_member_index} ${rc} ${stdout}= Run and Return RC and Output ${osm_vnf_scale_command} Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Wait Until Keyword Succeeds ${vnf_scale_max_wait_time} ${vnf_scale_pol_time} Check For NS Operation Completed ${stdout} + Wait Until Keyword Succeeds ${vnf_scale_max_wait_time} ${vnf_scale_pol_time} Check For NS Operation Ended ${stdout} + Check For NS Operation Completed ${stdout} + [Return] ${stdout} + + +Heal Network Service + [Documentation] Execute healing operation over one NS. + ... Return the ID of the operation associated to the executed healing action. + + [Arguments] ${ns_name} ${params} ${healing_max_wait_time}=10m + + Should Not Be Empty ${ns_name} + Should Not Be Empty ${params} + ${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} + ${rc} ${stdout}= Run and Return RC and Output osm ns-heal ${ns_name} ${params} + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + Wait Until Keyword Succeeds ${healing_max_wait_time} ${healing_pol_time} Check For NS Operation Ended ${stdout} + Check For NS Operation Completed ${stdout} [Return] ${stdout} Get Operations List [Arguments] ${ns_name} + Should Not Be Empty ${ns_name} ${rc} ${stdout}= Run and Return RC and Output osm ns-op-list ${ns_name} log ${stdout} log ${rc} @@ -250,10 +281,35 @@ Check For NS Operation Completed [Arguments] ${ns_operation_id} + Should Not Be Empty ${ns_operation_id} ${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 + Should Contain ${stdout} COMPLETED msg=The ns-action with id ${ns_operation_id} was not completed values=False + + +Check For NS Operation Failed + [Documentation] Check wheter the status of the desired operation is "FAILED" or not. + + [Arguments] ${ns_operation_id} + + Should Not Be Empty ${ns_operation_id} + ${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} FAILED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False + + +Check For NS Operation Ended + [Documentation] Check wheter the status of the desired operation is "FAILED" or "COMPLETED". + + [Arguments] ${ns_operation_id} + + Should Not Be Empty ${ns_operation_id} + ${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 Any ${stdout} FAILED COMPLETED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False Get Ns Vnfr Ids @@ -261,6 +317,7 @@ Get Ns Vnfr Ids [Arguments] ${ns_id} + Should Not Be Empty ${ns_id} ${rc} ${stdout}= Run and Return RC and Output osm vnf-list | grep ${ns_id} | awk '{print $2}' 2>&1 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False @{vdur} = Split String ${stdout} @@ -272,6 +329,7 @@ Get Vnf Vdur Names [Arguments] ${vnf_id} + Should Not Be Empty ${vnf_id} ${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} @@ -283,6 +341,8 @@ Get Vnf Kdu Replica Count [Arguments] ${vnf_id} ${kdu_name} + Should Not Be Empty ${vnf_id} + Should Not Be Empty ${kdu_name} ${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} = Set Variable If '${stdout}' == 'null' ${EMPTY} ${stdout} @@ -294,6 +354,7 @@ Get Application Names [Arguments] ${ns_name} + Should Not Be Empty ${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} @@ -312,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}