-
- ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
- Set Suite Variable ${ns_id} ${id}
-
-
-Get Vnf Ip Address
-
- Variable Should Exist ${ns_id} msg=NS is not available
- ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index}
- log ${ip_addr}
- Set Suite Variable ${vnf_ip_addr} ${ip_addr}
-
-
-Check Vdu disks
-
- Variable Should Exist ${vnf_ip_addr} msg=VNF is not available
+ [Documentation] Instantiate NS for the testsuite.
+ [Tags] prepare
+ ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY}
+ Set Suite Variable ${NS_ID} ${id}
+
+Get NS Id
+ [Documentation] Get NS identifier and stores as suite variable to be used later on.
+ [Tags] verify cleanup
+ ${variables}= Get Variables
+ IF not "\${ns_id}" in "${variables}"
+ ${id}= Get Ns Id ${NS_NAME}
+ Set Suite Variable ${NS_ID} ${id}
+ END
+
+Get Volumes From VNFD
+ [Documentation] Get from VNF descriptor the expected number of volumes in the VNF.
+ [Tags] verify
+ ${rc} ${stdout}= Run And Return RC And Output osm vnfpkg-show ${VNFD_NAME} --literal | yq '.vdu[0]."virtual-storage-desc" | length'
+ Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
+ ${num_virtual_storage}= Convert To Integer ${stdout}
+ Set Suite Variable ${VNF_NUM_VOLUMES} ${num_virtual_storage}
+ Log ${VNF_NUM_VOLUMES}
+
+Get VNF IP Address
+ [Documentation] Get the mgmt IP address of the VNF.
+ [Tags] verify
+ Variable Should Exist ${NS_ID} msg=NS is not available
+ ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX}
+ Log ${ip_addr}
+ Set Suite Variable ${VNF_IP_ADDR} ${ip_addr}
+
+# Get Persistent Volume Id
+# [Documentation] Get VIM volume identifier of the persistent volume of the VNF.
+# [Tags] cleanup
+# Variable Should Exist ${ns_id} msg=NS is not available
+# ${vnfs_list}= Get Ns Vnf List ${ns_id}
+# ${vim_id}= Get VNF VIM ID ${vnfs_list}[0]
+# ${volumes_attached}= Get Server Property ${vim_id} volumes_attached
+# ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1
+# Set Suite Variable ${PERSISTENT_VOLUME_ID} ${match}[0]
+
+Check VDU disks
+ [Documentation] Check that the number of volumes is the expected one.
+ [Tags] verify
+ Variable Should Exist ${VNF_IP_ADDR} msg=VNF is not available