X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Flib%2Fns_lib.robot;h=aa0830ff414d9ddc067db7a99cbebef5b3d4308f;hb=6eef5a62c976891bd580d52e0ead6cb9a959afc1;hp=d65f93c7003662b52167755632bfa1e1dbbdf13d;hpb=f4ebaa88025189ede4f073ab8a1f27c95efff867;p=osm%2Ftests.git diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot index d65f93c..aa0830f 100644 --- a/robot-systest/lib/ns_lib.robot +++ b/robot-systest/lib/ns_lib.robot @@ -39,7 +39,7 @@ Create Network Service ${config_file_attr} Set Variable If '${config_file}'!='${EMPTY}' --config_file '${config_file}' \ ${ns_id}= Instantiate Network Service ${ns_name} ${nsd} ${vim_name} ${config_attr} ${sshkeys_attr} ${config_file_attr} - log ${ns_id} + Log ${ns_id} WAIT UNTIL KEYWORD SUCCEEDS ${ns_launch_max_wait_time} ${ns_launch_pol_time} Check For NS Instance To Configured ${ns_name} Check For NS Instance For Failure ${ns_name} @@ -50,7 +50,7 @@ Instantiate Network Service [Arguments] ${ns_name} ${nsd} ${vim_name} ${ns_extra_args} ${rc} ${stdout}= Run and Return RC and Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} ${ns_extra_args} - log ${stdout} + Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} [Return] ${stdout} @@ -59,7 +59,7 @@ 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} + Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} [Return] ${stdout} @@ -70,7 +70,7 @@ Get Vnf Management Ip Address Should Not Be Empty ${ns_id} Should Not Be Empty ${vnf_member_index} ${rc} ${stdout}= Run and Return RC and Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $14}' 2>&1 - log ${stdout} + Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} [Return] ${stdout} @@ -81,7 +81,7 @@ Get Vnf Id Should Not Be Empty ${ns_id} Should Not Be Empty ${vnf_member_index} ${rc} ${stdout}= Run and Return RC and Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $2}' 2>&1 - log ${stdout} + Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} [Return] ${stdout} @@ -91,17 +91,24 @@ Get Ns Id 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} + Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} Should Not Be Empty ${stdout} [Return] ${stdout} +Get Ns List + ${rc} ${stdout}= Run and Return RC and Output osm ns-list 2>&1 + Log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + Get Ns Vnf List [Arguments] ${ns_id} Should Not Be Empty ${ns_id} - @{vnf_list_string}= Run and Return RC and Output osm vnf-list | grep ${ns_id} | awk '{print $2}' 2>&1 + @{vnf_list_string}= Run and Return RC and Output osm vnf-list --ns ${ns_id} | grep ${ns_id} | awk '{print $2}' 2>&1 # Returns a String of vnf_id and needs to be converted into a list @{vnf_list} = Split String ${vnf_list_string}[1] Log List ${vnf_list} @@ -114,7 +121,7 @@ Get Ns Ip List should not be empty @{vnf_list} @{temp_list}= Create List FOR ${vnf_id} IN @{vnf_list} - log ${vnf_id} + Log ${vnf_id} @{vnf_ip_list} Get Vnf Ip List ${vnf_id} @{temp_list}= Combine Lists ${temp_list} ${vnf_ip_list} END @@ -130,7 +137,7 @@ Get Vnf Ip List # returns a string of ip addresses and needs to be converted into a list should not be empty ${vnf_ip_list_string}[1] @{vnf_ip_list} = split string ${vnf_ip_list_string}[1] - log list ${vnf_ip_list} + Log Many ${vnf_ip_list} should not be empty ${vnf_ip_list} [return] @{vnf_ip_list} @@ -139,9 +146,9 @@ Check For Ns Instance To Configured [arguments] ${ns_name} ${rc} ${stdout}= Run and Return RC and Output openstack server list - log ${stdout} + Log ${stdout} ${rc} ${stdout}= run and return rc and output osm ns-list --filter name="${ns_name}" - log ${stdout} + Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} Should Contain Any ${stdout} READY BROKEN @@ -149,9 +156,9 @@ Check For NS Instance For Failure [Arguments] ${ns_name} ${rc} ${stdout}= Run and Return RC and Output openstack server list - log ${stdout} + Log ${stdout} ${rc} ${stdout}= Run and Return RC and Output osm ns-list --filter name="${ns_name}" - log ${stdout} + Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} Should Not Contain ${stdout} BROKEN @@ -159,7 +166,7 @@ Check For NS Instance To Be Deleted [Arguments] ${ns} ${rc} ${stdout}= Run and Return RC and Output openstack server list - log ${stdout} + 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} @@ -271,8 +278,8 @@ Get Operations List Should Not Be Empty ${ns_name} ${rc} ${stdout}= Run and Return RC and Output osm ns-op-list ${ns_name} - log ${stdout} - log ${rc} + Log ${stdout} + Log ${rc} Should Be Equal As Integers ${rc} ${success_return_code} @@ -282,8 +289,8 @@ 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} + ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState + Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} Should Contain ${stdout} COMPLETED msg=The ns-action with id ${ns_operation_id} was not completed values=False @@ -294,8 +301,8 @@ Check For NS Operation Failed [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} + ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState + 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 @@ -306,8 +313,8 @@ Check For NS Operation Ended [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} + ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState + 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 @@ -318,7 +325,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 + ${rc} ${stdout}= Run and Return RC and Output osm vnf-list --ns ${ns_id} | 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} [Return] @{vdur} @@ -330,7 +337,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 \\" + ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r .vdur[].name Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False @{vdur} = Split String ${stdout} [Return] @{vdur} @@ -343,7 +350,7 @@ Get Vnf Kdu Replica Count 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 \\" + ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --kdu ${kdu_name} | yq -r .config.replicaCount Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False ${return} = Set Variable If '${stdout}' == 'null' ${EMPTY} ${stdout} [Return] ${return} @@ -355,7 +362,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 \\" + ${rc} ${stdout}= Run and Return RC and Output osm ns-show ${ns_name} --literal | yq -r ._admin.deployed.VCA[].application Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False @{app_names} = Split String ${stdout} [Return] ${app_names} @@ -366,11 +373,11 @@ Get VDU Affinity Group Name [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} + ${rc} ${affinity_group_id}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq -r '."affinity-or-anti-affinity-group-id"[0]' 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} + ${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 -r '.name' 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} @@ -382,7 +389,7 @@ Get Operations By 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} + Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} Should Not Be Empty ${stdout} [Return] ${stdout}