| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 1 | *** Comments *** |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at |
| 5 | # |
| 6 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | # |
| 8 | # Unless required by applicable law or agreed to in writing, software |
| 9 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. |
| 13 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 14 | |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 15 | *** Settings *** |
| 16 | Documentation [BASIC-28] NS with one VDU which has 2 persistent volumes with keep flag |
| 17 | |
| 18 | Library OperatingSystem |
| 19 | Library String |
| 20 | Library Collections |
| 21 | Library Process |
| 22 | Library SSHLibrary |
| 23 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 24 | Resource ../lib/vnfd_lib.resource |
| 25 | Resource ../lib/vnf_lib.resource |
| 26 | Resource ../lib/nsd_lib.resource |
| 27 | Resource ../lib/ns_lib.resource |
| 28 | Resource ../lib/ssh_lib.resource |
| 29 | Resource ../lib/openstack_lib.resource |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 30 | |
| garciadeblas | 166c891 | 2023-12-16 10:51:48 +0100 | [diff] [blame] | 31 | Test Tags basic_28 cluster_main daily regression |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 32 | |
| 33 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| 34 | |
| 35 | |
| 36 | *** Variables *** |
| 37 | # NS and VNF descriptor package folder and ids |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 38 | ${VNFD_PKG} keep_persistent_volume_vnf |
| 39 | ${VNFD_NAME} keep_persistent-volumes-vnf |
| 40 | ${NSD_PKG} keep_persistent_volume_ns |
| 41 | ${NSD_NAME} persistent_volumes-ns |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 42 | |
| 43 | # NS instance name and configuration |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 44 | ${NS_NAME} basic_28 |
| 45 | ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 46 | |
| 47 | # SSH keys and username to be used |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 48 | ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub |
| 49 | ${PRIVATEKEY} %{HOME}/.ssh/id_rsa |
| 50 | ${USERNAME} ubuntu |
| 51 | ${PASSWORD} ${EMPTY} |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 52 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 53 | ${VNF_MEMBER_INDEX} vnf-persistent-volumes |
| 54 | ${VDU_ID} keep-persistent-vol-VM |
| 55 | ${ROOT_DISK} root-volume |
| 56 | ${ORDINARY_DISK} persistent-volume |
| 57 | ${SUCCESS_RETURN_CODE} 0 |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 58 | |
| 59 | |
| 60 | *** Test Cases *** |
| 61 | Create VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 62 | [Documentation] Upload VNF package for the testsuite. |
| 63 | Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 64 | |
| 65 | Create NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 66 | [Documentation] Upload NS package for the testsuite. |
| 67 | Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 68 | |
| 69 | Network Service Instance Test |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 70 | [Documentation] Instantiate NS for the testsuite. |
| 71 | ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} |
| 72 | Set Suite Variable ${NS_ID} ${id} |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 73 | |
| 74 | Check Persistent Volume Counts |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 75 | [Documentation] Check that the number of persistent volumes attached to VM in the NS meet the expected number (2). |
| 76 | Variable Should Exist ${NS_ID} msg=NS is not available |
| 77 | ${VOLUME_MATCH}= Get Persistent Volumes Attached To Vm ${NS_ID} |
| 78 | Set Suite Variable ${VOLUME_MATCH} |
| 79 | ${VOLUME_COUNTS}= Get Length ${VOLUME_MATCH} |
| 80 | Set Suite Variable ${VOLUME_COUNTS} |
| 81 | IF ${VOLUME_COUNTS} != 2 Fail msg=There were not 2 volumes attached to VM |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 82 | |
| 83 | Set Persistent Volume Ids |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 84 | [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. |
| 85 | Variable Should Exist ${VOLUME_MATCH} msg=NS is not available |
| 86 | Set Volume Id ${VOLUME_MATCH} 0 |
| 87 | Set Volume Id ${VOLUME_MATCH} 1 |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 88 | |
| 89 | Delete NS Instance Test |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 90 | [Documentation] Delete NS instance. |
| 91 | Delete NS ${NS_NAME} |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 92 | |
| 93 | Check Persistent Root Volume in VIM after NS Deleted |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 94 | [Documentation] Check that the persistent root volume requested to be kept is present after deleting NS instance. |
| 95 | Variable Should Exist ${ROOT_VOL_ID} msg=Root volume is not available |
| 96 | ${root_vol_exists}= Check If Volume Exists ${ROOT_VOL_ID} |
| 97 | Log ${root_vol_exists} |
| 98 | IF ${root_vol_exists} |
| 99 | Log Persistent root volume still exists |
| garciadeblas | 23ff8f9 | 2023-12-11 16:26:40 +0100 | [diff] [blame] | 100 | ELSE |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 101 | Fail msg=Persistent root volume was deleted |
| 102 | Set Suite Variable ${ROOT_VOL_ID} ${EMPTY} |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 103 | END |
| 104 | |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 105 | Check Persistent Ordinary Volume in VIM after NS Deleted |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 106 | [Documentation] Check that the persistent ordinary volume requested to be kept is present after deleting NS instance. |
| 107 | Variable Should Exist ${ORDINARY_VOL_ID} msg=Ordinary persistent volume is not available |
| 108 | ${ordinary_vol_exists}= Check If Volume Exists ${ORDINARY_VOL_ID} |
| 109 | Log ${ordinary_vol_exists} |
| 110 | IF ${ordinary_vol_exists} |
| 111 | Log Persistent ordinary volume still exists |
| garciadeblas | 23ff8f9 | 2023-12-11 16:26:40 +0100 | [diff] [blame] | 112 | ELSE |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 113 | Fail msg=Persistent ordinary volume was deleted |
| 114 | Set Suite Variable ${ORDINARY_VOL_ID} ${EMPTY} |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 115 | END |
| 116 | |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 117 | Prepare Ns Config With Volume Id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 118 | [Documentation] Generate NS instantiation parameters to be used in next NS instance, |
| 119 | ... using the persistent volumes that were kept previously. |
| 120 | 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}}] } ] } ] } |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 121 | |
| 122 | Network Service Instance With Existing Volumes Test |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 123 | [Documentation] Instantiate NS for the testsuite again. The persistent volumes passed as instantiation parameters should be used. |
| 124 | ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG_WITH_VIM_ID} ${PUBLICKEY} |
| 125 | Set Suite Variable ${NS_ID} ${id} |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 126 | |
| 127 | Verify the Attachment Of Existing Persistent Volumes |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 128 | [Documentation] Get the identifiers of the persistent volumes attached to VM in the second NS instance and verify that they are the same |
| 129 | ... of the first NS instance. |
| 130 | Set Suite Variable ${PREV_ROOT_VOL_ID} ${ROOT_VOL_ID} |
| 131 | Set Suite Variable ${PREV_ORDINARY_VOL_ID} ${ORDINARY_VOL_ID} |
| 132 | ${volume_match}= Get Persistent Volumes Attached To Vm ${NS_ID} |
| 133 | Set Suite Variable ${VOLUME_MATCH} |
| 134 | Set Volume Id ${VOLUME_MATCH} 0 |
| 135 | Set Volume Id ${VOLUME_MATCH} 1 |
| 136 | Should Be Equal As Strings ${ROOT_VOL_ID} ${PREV_ROOT_VOL_ID} msg=Existing root volume is not attached to server |
| 137 | Should Be Equal As Strings ${ORDINARY_VOL_ID} ${PREV_ORDINARY_VOL_ID} msg=Existing ordinary volume is not attached to server |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 138 | |
| 139 | Delete NS Instance With Existing Volumes Test |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 140 | [Documentation] Delete NS instance. |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 141 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 142 | Delete NS ${NS_NAME} |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 143 | |
| 144 | Check Existence of Persistent Volumes |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 145 | [Documentation] Check that the persistent volumes exist after deleting the NS. |
| 146 | Variable Should Exist ${ROOT_VOL_ID} msg=Volume is not available |
| 147 | Variable Should Exist ${ORDINARY_VOL_ID} msg=Volume is not available |
| 148 | ${root_vol_exists}= Check If Volume Exists ${ROOT_VOL_ID} |
| 149 | IF not ${root_vol_exists} Fail msg=Existing root volume is deleted |
| 150 | ${ordinary_vol_exists}= Check If Volume Exists ${ORDINARY_VOL_ID} |
| 151 | IF not ${ordinary_vol_exists} Fail msg=Existing ordinary volume is deleted |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 152 | |
| 153 | Delete Persistent Volumes |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 154 | [Documentation] Delete persistent volumes. |
| 155 | Clean Persistent Volumes |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 156 | |
| 157 | Delete NS Descriptor Test |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 158 | [Documentation] Delete NS package from OSM. |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 159 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 160 | Delete NSD ${NSD_NAME} |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 161 | |
| 162 | Delete VNF Descriptor Test |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 163 | [Documentation] Delete VNF package from OSM. |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 164 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 165 | Delete VNFD ${VNFD_NAME} |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 166 | |
| 167 | |
| 168 | *** Keywords *** |
| 169 | Suite Cleanup |
| 170 | [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 171 | Run Keyword If Any Tests Failed Delete NS ${NS_NAME} |
| 172 | Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} |
| 173 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} |
| 174 | Run Keyword If Any Tests Failed Clean Persistent Volumes |
| Gulsum Atici | 8ceaee0 | 2022-12-09 16:38:22 +0300 | [diff] [blame] | 175 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 176 | Clean Persistent Volumes |
| 177 | [Documentation] Delete root and ordinary volumes. |
| 178 | [Tags] cleanup |
| 179 | Delete Volume ${ROOT_VOL_ID} |
| 180 | Delete Volume ${ORDINARY_VOL_ID} |