X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Ftests.git;a=blobdiff_plain;f=robot-systest%2Ftestsuite%2Fbasic_28-keep_persistent_volumes.robot;fp=robot-systest%2Ftestsuite%2Fbasic_28-keep_persistent_volumes.robot;h=dd92a49fbd73c9d3a9dc6581e3cd281b3d7bcf5a;hp=0391ac7e25d92d39c43a2c7a28ffaf78a7c1a17c;hb=7a9e031926d2fa7ed5041485b3d41b0c1e85d2a9;hpb=23ff8f980f66ef57fb4d254336a018e3a697a187 diff --git a/robot-systest/testsuite/basic_28-keep_persistent_volumes.robot b/robot-systest/testsuite/basic_28-keep_persistent_volumes.robot index 0391ac7..dd92a49 100644 --- a/robot-systest/testsuite/basic_28-keep_persistent_volumes.robot +++ b/robot-systest/testsuite/basic_28-keep_persistent_volumes.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-28] NS with one VDU which has 2 persistent volumes with keep flag @@ -19,159 +21,160 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot - -Force Tags basic_28 cluster_main daily +Resource ../lib/vnfd_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource +Test Tags basic_28 cluster_main daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} keep_persistent_volume_vnf -${vnfd_name} keep_persistent-volumes-vnf -${nsd_pkg} keep_persistent_volume_ns -${nsd_name} persistent_volumes-ns +${VNFD_PKG} keep_persistent_volume_vnf +${VNFD_NAME} keep_persistent-volumes-vnf +${NSD_PKG} keep_persistent_volume_ns +${NSD_NAME} persistent_volumes-ns # NS instance name and configuration -${ns_name} basic_28 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_28 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${vnf_member_index} vnf-persistent-volumes -${vdu_id} keep-persistent-vol-VM -${root_disk} root-volume -${ordinary_disk} persistent-volume -${success_return_code} 0 +${VNF_MEMBER_INDEX} vnf-persistent-volumes +${VDU_ID} keep-persistent-vol-VM +${ROOT_DISK} root-volume +${ORDINARY_DISK} persistent-volume +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Check Persistent Volume Counts - Variable Should Exist ${ns_id} msg=NS is not available - ${volume_match}= Get Persistent Volumes Attached To Vm ${ns_id} - Set Suite Variable ${volume_match} - ${volume_counts}= Get Length ${volume_match} - Set Suite Variable ${volume_counts} - Run Keyword If ${volume_counts} != 2 Fail msg=There were not 2 volumes attached to VM - + [Documentation] Check that the number of persistent volumes attached to VM in the NS meet the expected number (2). + Variable Should Exist ${NS_ID} msg=NS is not available + ${VOLUME_MATCH}= Get Persistent Volumes Attached To Vm ${NS_ID} + Set Suite Variable ${VOLUME_MATCH} + ${VOLUME_COUNTS}= Get Length ${VOLUME_MATCH} + Set Suite Variable ${VOLUME_COUNTS} + IF ${VOLUME_COUNTS} != 2 Fail msg=There were not 2 volumes attached to VM Set Persistent Volume Ids - Variable Should Exist ${volume_match} msg=NS is not available - Set Volume Id ${volume_match} 0 - Set Volume Id ${volume_match} 1 - + [Documentation] Get the identifiers of the persistent volumes attached to VM in the NS and store in suite variables ROOT_VOL_ID and ORDINARY_VOL_ID. + Variable Should Exist ${VOLUME_MATCH} msg=NS is not available + Set Volume Id ${VOLUME_MATCH} 0 + Set Volume Id ${VOLUME_MATCH} 1 Delete NS Instance Test - [Tags] cleanup - Delete NS ${ns_name} - + [Documentation] Delete NS instance. + Delete NS ${NS_NAME} Check Persistent Root Volume in VIM after NS Deleted - Variable Should Exist ${root_vol_id} msg=Root volume is not available - ${root_vol_exists}= Check If Volume Exists ${root_vol_id} - log ${root_vol_exists} - IF ${root_vol_exists}==0 - Fail msg=Persistent root volume was deleted - Set Suite Variable ${root_vol_id} ${EMPTY} + [Documentation] Check that the persistent root volume requested to be kept is present after deleting NS instance. + Variable Should Exist ${ROOT_VOL_ID} msg=Root volume is not available + ${root_vol_exists}= Check If Volume Exists ${ROOT_VOL_ID} + Log ${root_vol_exists} + IF ${root_vol_exists} + Log Persistent root volume still exists ELSE - log Persistent root volume still exists + Fail msg=Persistent root volume was deleted + Set Suite Variable ${ROOT_VOL_ID} ${EMPTY} END - Check Persistent Ordinary Volume in VIM after NS Deleted - Variable Should Exist ${ordinary_vol_id} msg=Ordinary persistent volume is not available - ${ordinary_vol_exists}= Check If Volume Exists ${ordinary_vol_id} - log ${ordinary_vol_exists} - IF ${ordinary_vol_exists}==0 - Fail msg=Persistent ordinary volume was deleted - Set Suite Variable ${ordinary_vol_id} ${EMPTY} + [Documentation] Check that the persistent ordinary volume requested to be kept is present after deleting NS instance. + Variable Should Exist ${ORDINARY_VOL_ID} msg=Ordinary persistent volume is not available + ${ordinary_vol_exists}= Check If Volume Exists ${ORDINARY_VOL_ID} + Log ${ordinary_vol_exists} + IF ${ordinary_vol_exists} + Log Persistent ordinary volume still exists ELSE - log Persistent ordinary volume still exists + Fail msg=Persistent ordinary volume was deleted + Set Suite Variable ${ORDINARY_VOL_ID} ${EMPTY} END - Prepare Ns Config With Volume Id - Set Suite Variable ${ns_config_with_vim_id} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], vnf: [ {member-vnf-index: ${vnf_member_index}, vdu: [ {id: ${vdu_id}, volume: [{"name": ${root_disk}, vim-volume-id: ${root_vol_id}}, {"name": ${ordinary_disk}, vim-volume-id: ${ordinary_vol_id}}] } ] } ] } - + [Documentation] Generate NS instantiation parameters to be used in next NS instance, + ... using the persistent volumes that were kept previously. + Set Suite Variable ${NS_CONFIG_WITH_VIM_ID} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], vnf: [ {member-vnf-index: ${VNF_MEMBER_INDEX}, vdu: [ {id: ${VDU_ID}, volume: [{"name": ${ROOT_DISK}, vim-volume-id: ${ROOT_VOL_ID}}, {"name": ${ORDINARY_DISK}, vim-volume-id: ${ORDINARY_VOL_ID}}] } ] } ] } Network Service Instance With Existing Volumes Test - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config_with_vim_id} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite again. The persistent volumes passed as instantiation parameters should be used. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG_WITH_VIM_ID} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Verify the Attachment Of Existing Persistent Volumes - Set Suite Variable ${prev_root_vol_id} ${root_vol_id} - Set Suite Variable ${prev_ordinary_vol_id} ${ordinary_vol_id} - ${volume_match}= Get Persistent Volumes Attached To Vm ${ns_id} - Set Suite Variable ${volume_match} - Set Volume Id ${volume_match} 0 - Set Volume Id ${volume_match} 1 - Should Be Equal As Strings ${root_vol_id} ${prev_root_vol_id} msg=Existing root volume is not attached to server - Should Be Equal As Strings ${ordinary_vol_id} ${prev_ordinary_vol_id} msg=Existing ordinary volume is not attached to server - + [Documentation] Get the identifiers of the persistent volumes attached to VM in the second NS instance and verify that they are the same + ... of the first NS instance. + Set Suite Variable ${PREV_ROOT_VOL_ID} ${ROOT_VOL_ID} + Set Suite Variable ${PREV_ORDINARY_VOL_ID} ${ORDINARY_VOL_ID} + ${volume_match}= Get Persistent Volumes Attached To Vm ${NS_ID} + Set Suite Variable ${VOLUME_MATCH} + Set Volume Id ${VOLUME_MATCH} 0 + Set Volume Id ${VOLUME_MATCH} 1 + Should Be Equal As Strings ${ROOT_VOL_ID} ${PREV_ROOT_VOL_ID} msg=Existing root volume is not attached to server + Should Be Equal As Strings ${ORDINARY_VOL_ID} ${PREV_ORDINARY_VOL_ID} msg=Existing ordinary volume is not attached to server Delete NS Instance With Existing Volumes Test + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Check Existence of Persistent Volumes - Variable Should Exist ${root_vol_id} msg=Volume is not available - Variable Should Exist ${ordinary_vol_id} msg=Volume is not available - ${root_vol_exists}= Check If Volume Exists ${root_vol_id} - Run Keyword If ${root_vol_exists} == 0 Fail msg=Existing root volume is deleted - ${ordinary_vol_exists}= Check If Volume Exists ${ordinary_vol_id} - Run Keyword If ${ordinary_vol_exists} == 0 Fail msg=Existing ordinary volume is deleted - + [Documentation] Check that the persistent volumes exist after deleting the NS. + Variable Should Exist ${ROOT_VOL_ID} msg=Volume is not available + Variable Should Exist ${ORDINARY_VOL_ID} msg=Volume is not available + ${root_vol_exists}= Check If Volume Exists ${ROOT_VOL_ID} + IF not ${root_vol_exists} Fail msg=Existing root volume is deleted + ${ordinary_vol_exists}= Check If Volume Exists ${ORDINARY_VOL_ID} + IF not ${ordinary_vol_exists} Fail msg=Existing ordinary volume is deleted Delete Persistent Volumes - [Tags] cleanup - Delete Volume ${root_vol_id} - Delete Volume ${ordinary_vol_id} - + [Documentation] Delete persistent volumes. + Clean Persistent Volumes Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete VNF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} + Run Keyword If Any Tests Failed Clean Persistent Volumes - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - - Run Keyword If Any Tests Failed Delete Persistent Volumes +Clean Persistent Volumes + [Documentation] Delete root and ordinary volumes. + [Tags] cleanup + Delete Volume ${ROOT_VOL_ID} + Delete Volume ${ORDINARY_VOL_ID}