From 9e5450fcb5eda9f9792eb502a2efd741d5f7a1aa Mon Sep 17 00:00:00 2001 From: sritharan Date: Tue, 26 Dec 2023 07:04:44 +0000 Subject: [PATCH] Bug 2327 fix to verify ipaddress in sol003_02 testsuite Change-Id: I9896f70aa0bc4f62ba1b21106bcf9b8b9ed464ac Signed-off-by: sritharan --- robot-systest/lib/ns_lib.resource | 10 +- robot-systest/lib/nsd_lib.resource | 7 ++ .../sol003_02-dualstack_ip_vnfm.robot | 92 ++++++------------- 3 files changed, 43 insertions(+), 66 deletions(-) diff --git a/robot-systest/lib/ns_lib.resource b/robot-systest/lib/ns_lib.resource index 8e47f1f..ab763e1 100644 --- a/robot-systest/lib/ns_lib.resource +++ b/robot-systest/lib/ns_lib.resource @@ -216,6 +216,14 @@ 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} diff --git a/robot-systest/lib/nsd_lib.resource b/robot-systest/lib/nsd_lib.resource index 175322b..0821b1f 100644 --- a/robot-systest/lib/nsd_lib.resource +++ b/robot-systest/lib/nsd_lib.resource @@ -61,3 +61,10 @@ Check For NSD ${rc} ${stdout}= Run And Return Rc And Output osm nspkg-list | awk '{print $2}' | grep ${nsd_id} Log ${rc},${stdout} Should Not Be Equal As Strings ${stdout} ${nsd_id} + +Get NSD Ip + [Documentation] To get the Ip from the Nsd + [Arguments] ${nsd_id} + ${stdout}= Run osm nsd-show ${nsd_id} --literal | grep -A2 ip-address | grep -v "ip-address:" | awk '{print $2}' | tr -d ',-' + Log ${stdout} + RETURN ${stdout} diff --git a/robot-systest/testsuite/sol003_02-dualstack_ip_vnfm.robot b/robot-systest/testsuite/sol003_02-dualstack_ip_vnfm.robot index 5b948bc..542b7ab 100644 --- a/robot-systest/testsuite/sol003_02-dualstack_ip_vnfm.robot +++ b/robot-systest/testsuite/sol003_02-dualstack_ip_vnfm.robot @@ -28,6 +28,7 @@ Resource ../lib/vnfd_lib.resource Resource ../lib/ns_lib.resource Resource ../lib/vnf_lib.resource Resource ../lib/vim_lib.resource +Resource ../lib/nsd_lib.resource Test Tags sol003_02 cluster_osm_rest daily @@ -57,8 +58,6 @@ Create VNFD Descriptor ${json_obj}= Get Variable Value ${json_obj['data'][0]} ${NS_NAME}= Get Variable Value ${json_obj['vnfInstanceName']} Set Suite Variable ${NS_NAME} - ${VALUE1}= Get Variable Value ${json_obj['additionalParams']['ip-address']} - Set Suite Variable ${VALUE1} ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${CREATED_VIM_ACCOUNT_ID} Log ${UPDATED_JSON_OBJ} ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} @@ -88,78 +87,41 @@ Instantiate VNF ${id}= Get Value From Json ${request_response.json()} $..id Set Suite Variable ${VNF_INSTANCE_ID} ${id[0]} Sleep 12s + Check For NS Instance For Failure ${ns_name} Get Ns List Get Vnf List Get Ns Id - [Documentation] Get the NS identifier + [Documentation] Get the NS instance id ${id}= Get Ns Id ${ns_name} Set Suite Variable ${NS_ID} ${id} -Get Dual Ip Addresses +Get Ip From The NSD + [Documentation] Get the IP address from the NSD + ${id}= Get NSD ID From The NS ${NS_ID} + Set Suite Variable ${NSD_ID} ${id} + ${Nsd_IP}= Get NSD Ip ${NSD_ID} + Log ${Nsd_IP} + ${Nsd_IP}= Split String ${Nsd_IP} + Set Suite Variable ${IPV6NSD} ${Nsd_IP}[0] + Set Suite Variable ${IPV4NSD} ${Nsd_IP}[1] + Log ${IPV4NSD} + Log ${IPV6NSD} + +Get Dual Ip [Documentation] Get the IP address from the NS - ${id}= Get Dual Ip ${NS_ID} - Set Suite Variable ${DUAL_IP} ${id} - -Query VNF Instances - [Documentation] Test case to query VNF Instance - Get Auth Token - Get Api Request ${VNF_INSTANCE_URI} - ${value}= Get ID nsState - Should Be Equal ${value} INSTANTIATED - Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed - ${id}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${QUERY_ID} ${id[0]} - -Query VNF Instance ID - [Documentation] Test case to query Vnf instance ID - Get Auth Token - Get Api Request ${VNF_INSTANCE_URI}/${QUERY_ID} - ${value}= Get ID nsState - Should Be Equal ${value} INSTANTIATED - Should Be Equal As Strings ${RequestResponse.status_code} 200 - ${id}= Get Value From Json ${request_response.json()} $.._id - Log ${id[0]} - -Query VNF LCM Ops - [Documentation] Test case to Query VNF LCM operation - Get Auth Token - Get Api Request ${VNF_INSTANCE_LCM_OPS} - ${id1}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${LCM_OP_ID} ${id1[0]} - FOR ${index} IN RANGE 0 15 - Log ${index} - Get Api Request ${VNF_INSTANCE_LCM_OPS} - ${value}= Get ID operationState - ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED - IF ${status} - BREAK - ELSE - Sleep 10s - END - END - -Query VNF LCM Ops ID - [Documentation] Test case to Query VNF LCM operation id - Get Auth Token - Get Api Request ${VNF_INSTANCE_LCM_OPS}/${LCM_OP_ID} - ${id1}= Get Value From Json ${request_response.json()} $.._id - Log ${id1[0]} - FOR ${index} IN RANGE 0 15 - Log ${index} - Get Api Request ${VNF_INSTANCE_LCM_OPS}/${LCM_OP_ID} - ${value}= Get ID operationState - ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED - IF ${status} - BREAK - ELSE - Sleep 10s - END - END + ${Ns_IP}= Get Dual Ip ${NS_ID} + Log ${Ns_IP} + ${Ns_IP}= Split String ${Ns_IP} + Set Suite Variable ${IPV6NS} ${Ns_IP}[0] + Set Suite Variable ${IPV4NS} ${Ns_IP}[1] + Log ${IPV4NS} + Log ${IPV6NS} Verify Dual Ip - [Documentation] Test case to terminate the VNF - Should Be Equal ${DUAL_IP} ${VALUE1} + [Documentation] Test case to validate the IP address. + Should Be Equal ${IPV4NS} ${IPV4NSD} + Should Be Equal ${IPV6NS} ${IPV6NSD} Terminate VNF [Documentation] Test case to terminate the VNF @@ -196,7 +158,7 @@ Delete VNF Pass Execution If ${resp.status_code} in ${success_status_code_list} Delete VNF Instance completed Delete VNF Descriptor Test - [Documentation] Test case to delete the VNF descriptor test + [Documentation] Test case to delete the VNF descriptor. [Tags] cleanup Delete VNFD ${VNFD_NAME} -- 2.17.1