blob: 9e6837dd7a129d3339a65dfda54dced1991e0e45 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
Gulsum Atici8ceaee02022-12-09 16:38:22 +03002# 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
garciadeblas7a9e0312023-12-11 22:24:46 +010014
Gulsum Atici8ceaee02022-12-09 16:38:22 +030015*** Settings ***
16Documentation [BASIC-28] NS with one VDU which has 2 persistent volumes with keep flag
17
18Library OperatingSystem
19Library String
20Library Collections
21Library Process
22Library SSHLibrary
23
garciadeblas7a9e0312023-12-11 22:24:46 +010024Resource ../lib/vnfd_lib.resource
25Resource ../lib/vnf_lib.resource
26Resource ../lib/nsd_lib.resource
27Resource ../lib/ns_lib.resource
28Resource ../lib/ssh_lib.resource
29Resource ../lib/openstack_lib.resource
Gulsum Atici8ceaee02022-12-09 16:38:22 +030030
garciadeblas166c8912023-12-16 10:51:48 +010031Test Tags basic_28 cluster_main daily regression
Gulsum Atici8ceaee02022-12-09 16:38:22 +030032
33Suite Teardown Run Keyword And Ignore Error Suite Cleanup
34
35
36*** Variables ***
37# NS and VNF descriptor package folder and ids
garciadeblas7a9e0312023-12-11 22:24:46 +010038${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 Atici8ceaee02022-12-09 16:38:22 +030042
43# NS instance name and configuration
garciadeblas7a9e0312023-12-11 22:24:46 +010044${NS_NAME} basic_28
45${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
Gulsum Atici8ceaee02022-12-09 16:38:22 +030046
47# SSH keys and username to be used
garciadeblas7a9e0312023-12-11 22:24:46 +010048${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
49${PRIVATEKEY} %{HOME}/.ssh/id_rsa
50${USERNAME} ubuntu
51${PASSWORD} ${EMPTY}
Gulsum Atici8ceaee02022-12-09 16:38:22 +030052
garciadeblas7a9e0312023-12-11 22:24:46 +010053${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 Atici8ceaee02022-12-09 16:38:22 +030058
59
60*** Test Cases ***
61Create VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010062 [Documentation] Upload VNF package for the testsuite.
63 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
Gulsum Atici8ceaee02022-12-09 16:38:22 +030064
65Create NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010066 [Documentation] Upload NS package for the testsuite.
67 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
Gulsum Atici8ceaee02022-12-09 16:38:22 +030068
69Network Service Instance Test
garciadeblas7a9e0312023-12-11 22:24:46 +010070 [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 Atici8ceaee02022-12-09 16:38:22 +030073
74Check Persistent Volume Counts
garciadeblas7a9e0312023-12-11 22:24:46 +010075 [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 Atici8ceaee02022-12-09 16:38:22 +030082
83Set Persistent Volume Ids
garciadeblas7a9e0312023-12-11 22:24:46 +010084 [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 Atici8ceaee02022-12-09 16:38:22 +030088
89Delete NS Instance Test
garciadeblas7a9e0312023-12-11 22:24:46 +010090 [Documentation] Delete NS instance.
91 Delete NS ${NS_NAME}
Gulsum Atici8ceaee02022-12-09 16:38:22 +030092
93Check Persistent Root Volume in VIM after NS Deleted
garciadeblas7a9e0312023-12-11 22:24:46 +010094 [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
garciadeblas23ff8f92023-12-11 16:26:40 +0100100 ELSE
garciadeblas7a9e0312023-12-11 22:24:46 +0100101 Fail msg=Persistent root volume was deleted
102 Set Suite Variable ${ROOT_VOL_ID} ${EMPTY}
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300103 END
104
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300105Check Persistent Ordinary Volume in VIM after NS Deleted
garciadeblas7a9e0312023-12-11 22:24:46 +0100106 [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
garciadeblas23ff8f92023-12-11 16:26:40 +0100112 ELSE
garciadeblas7a9e0312023-12-11 22:24:46 +0100113 Fail msg=Persistent ordinary volume was deleted
114 Set Suite Variable ${ORDINARY_VOL_ID} ${EMPTY}
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300115 END
116
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300117Prepare Ns Config With Volume Id
garciadeblas7a9e0312023-12-11 22:24:46 +0100118 [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 Atici8ceaee02022-12-09 16:38:22 +0300121
122Network Service Instance With Existing Volumes Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100123 [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 Atici8ceaee02022-12-09 16:38:22 +0300126
127Verify the Attachment Of Existing Persistent Volumes
garciadeblas7a9e0312023-12-11 22:24:46 +0100128 [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 Atici8ceaee02022-12-09 16:38:22 +0300138
139Delete NS Instance With Existing Volumes Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100140 [Documentation] Delete NS instance.
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300141 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100142 Delete NS ${NS_NAME}
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300143
144Check Existence of Persistent Volumes
garciadeblas7a9e0312023-12-11 22:24:46 +0100145 [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 Atici8ceaee02022-12-09 16:38:22 +0300152
153Delete Persistent Volumes
garciadeblas7a9e0312023-12-11 22:24:46 +0100154 [Documentation] Delete persistent volumes.
155 Clean Persistent Volumes
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300156
157Delete NS Descriptor Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100158 [Documentation] Delete NS package from OSM.
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300159 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100160 Delete NSD ${NSD_NAME}
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300161
162Delete VNF Descriptor Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100163 [Documentation] Delete VNF package from OSM.
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300164 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100165 Delete VNFD ${VNFD_NAME}
Gulsum Atici8ceaee02022-12-09 16:38:22 +0300166
167
168*** Keywords ***
169Suite Cleanup
170 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
garciadeblas7a9e0312023-12-11 22:24:46 +0100171 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 Atici8ceaee02022-12-09 16:38:22 +0300175
garciadeblas7a9e0312023-12-11 22:24:46 +0100176Clean Persistent Volumes
177 [Documentation] Delete root and ordinary volumes.
178 [Tags] cleanup
179 Delete Volume ${ROOT_VOL_ID}
180 Delete Volume ${ORDINARY_VOL_ID}