X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Flib%2Fns_lib.resource;h=ab763e1391f30230f4bba26cdf486de225e3cefb;hb=refs%2Fheads%2Fmaster;hp=9d7276f77145e305ee36832e5049ed4f90fdb3e9;hpb=5e001f506b744021d5ef25999c9da28cf56d8fbc;p=osm%2Ftests.git diff --git a/robot-systest/lib/ns_lib.resource b/robot-systest/lib/ns_lib.resource index 9d7276f..cce11c7 100644 --- a/robot-systest/lib/ns_lib.resource +++ b/robot-systest/lib/ns_lib.resource @@ -35,9 +35,9 @@ Create Network Service ${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}' ${EMPTY} - ${sshkeys_attr}= Set Variable If "${publickey}" != "${EMPTY}" --ssh_keys ${publickey} ${EMPTY} - ${config_file_attr}= Set Variable If "${config_file}" != "${EMPTY}" --config_file '${config_file}' ${EMPTY} + ${config_attr}= Set Variable If '${ns_config}'!='${EMPTY}' --config '${ns_config}' ${EMPTY} + ${sshkeys_attr}= Set Variable If '${publickey}'!='${EMPTY}' --ssh_keys ${publickey} ${EMPTY} + ${config_file_attr}= Set Variable If '${config_file}'!='${EMPTY}' --config_file '${config_file}' ${EMPTY} ${ns_id}= Instantiate Network Service ${ns_name} ${nsd} ${vim_name} ${config_attr} ${sshkeys_attr} ${config_file_attr} Log ${ns_id} Wait Until Keyword Succeeds ${ns_launch_max_wait_time} ${NS_LAUNCH_POL_TIME} Check For NS Instance To Configured ${ns_name} @@ -170,8 +170,8 @@ Get Ns Vnfr Ids Should Not Be Empty ${ns_id} ${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} + @{vnfr}= Split String ${stdout} + RETURN @{vnfr} Get Vnf Vdur Names [Documentation] Return a list with the names of the VDU records of a VNF instance. @@ -182,6 +182,22 @@ Get Vnf Vdur Names @{vdur}= Split String ${stdout} RETURN @{vdur} +Check Kdu Labels + [Documentation] Return the labels of the deployed Kubernetes objects associated with a NS instance. + [Arguments] ${ns_id} ${vnf_id} ${kdu_name} + Should Not Be Empty ${ns_id} + Should Not Be Empty ${vnf_id} + Should Not Be Empty ${kdu_name} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-show ${ns_id} --literal | yq -r '._admin.deployed.K8s[0]."detailed-status"' | yq -r '.manifest[0].metadata.labels' + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + ${labels}= Evaluate json.loads('''${stdout}''') json + Should Be Equal As Strings ${labels["managed-by"]} osm.etsi.org msg=${labels} + Should Be Equal As Strings ${labels["osm.etsi.org/ns-id"]} ${ns_id} msg=${labels} + Should Be Equal As Strings ${labels["osm.etsi.org/vnf-id"]} ${vnf_id} msg=${labels} + Should Be Equal As Strings ${labels["osm.etsi.org/kdu-name"]} ${kdu_name} msg=${labels} + RETURN ${labels} + Get Vnf Kdu Replica Count [Documentation] Return the number of KDU replicas (empty if none) of a VNF instance. [Arguments] ${vnf_id} ${kdu_name} @@ -212,10 +228,30 @@ Get VDU Affinity Group Name Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${affinity_group_name} values=False RETURN ${affinity_group_name} -GET Dual Ip +Get Dual Ip [Documentation] Get dual ip from the ns list [Arguments] ${ns_id} Should Not Be Empty ${ns_id} - ${rc} ${stdout}= Run And Return RC And Output osm ns-show ${ns_id} --literal | grep -A2 ip-address | awk '{print $2}' | paste -sd ',' | sed 's/^,//; s/,/, /g' | sed 's/^/[/; s/$/]/' + ${rc} ${stdout}= Run And Return RC And Output osm ns-show ${ns_id} --literal | grep -A2 ip-address | grep -v "ip-address:" | awk '{print $2}' | tr -d ',-' Log ${rc},${stdout} RETURN ${stdout} + +Get NSD Id From The NS + [Documentation] Get the nsd id from the ns + [Arguments] ${ns_id} + Should Not Be Empty ${ns_id} + ${stdout}= Run osm ns-show ${ns_id} --literal | grep nsd-id | awk '{print $2}' + Log ${stdout} + RETURN ${stdout} + +Get Additional Params And Values From Kdu + [Documentation] Return the value of additional params (empty if none) of a KNF instance. + [Arguments] ${ns_name} ${param_name} + Should Not Be Empty ${ns_name} + Should Not Be Empty ${param_name} + ${rc0} ${stdout0}= Run And Return Rc And Output osm ns-show ${ns_name} --literal | yq -e '._admin.deployed' | yq '.K8s[]."detailed-status"' + Should Be Equal As Integers ${rc0} ${SUCCESS_RETURN_CODE} msg=${stdout0} values=False + ${rc} ${stdout}= Run And Return Rc And Output echo ${stdout0} | yq '.config.${param_name}' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + ${return}= Set Variable If '${stdout}' == 'null' ${EMPTY} ${stdout} + RETURN ${return}