1 # Licensed under the Apache License, Version 2.0 (the "License");
2 # you may not use this file except in compliance with the License.
3 # You may obtain a copy of the License at
5 # http://www.apache.org/licenses/LICENSE-2.0
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 # See the License for the specific language governing permissions and
11 # limitations under the License.
14 Documentation [BASIC-28] NS with one VDU which has 2 persistent volumes with keep flag
16 Library OperatingSystem
22 Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
23 Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot
24 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
25 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
26 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
27 Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot
29 Force Tags basic_28 cluster_main daily
32 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
36 # NS and VNF descriptor package folder and ids
37 ${vnfd_pkg} keep_persistent_volume_vnf
38 ${vnfd_name} keep_persistent-volumes-vnf
39 ${nsd_pkg} keep_persistent_volume_ns
40 ${nsd_name} persistent_volumes-ns
42 # NS instance name and configuration
44 ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
46 # SSH keys and username to be used
47 ${publickey} %{HOME}/.ssh/id_rsa.pub
48 ${privatekey} %{HOME}/.ssh/id_rsa
52 ${vnf_member_index} vnf-persistent-volumes
53 ${vdu_id} keep-persistent-vol-VM
54 ${root_disk} root-volume
55 ${ordinary_disk} persistent-volume
56 ${success_return_code} 0
61 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
65 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
68 Network Service Instance Test
69 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
70 Set Suite Variable ${ns_id} ${id}
73 Check Persistent Volume Counts
74 Variable Should Exist ${ns_id} msg=NS is not available
75 ${volume_match}= Get Persistent Volumes Attached To Vm ${ns_id}
76 Set Suite Variable ${volume_match}
77 ${volume_counts}= Get Length ${volume_match}
78 Set Suite Variable ${volume_counts}
79 Run Keyword If ${volume_counts} != 2 Fail msg=There were not 2 volumes attached to VM
82 Set Persistent Volume Ids
83 Variable Should Exist ${volume_match} msg=NS is not available
84 Set Volume Id ${volume_match} 0
85 Set Volume Id ${volume_match} 1
88 Delete NS Instance Test
93 Check Persistent Root Volume in VIM after NS Deleted
94 Variable Should Exist ${root_vol_id} msg=Root volume is not available
95 ${root_vol_exists}= Check If Volume Exists ${root_vol_id}
96 log ${root_vol_exists}
97 IF ${root_vol_exists}==0
98 Fail msg=Persistent root volume was deleted
99 Set Suite Variable ${root_vol_id} ${EMPTY}
101 log Persistent root volume still exists
105 Check Persistent Ordinary Volume in VIM after NS Deleted
106 Variable Should Exist ${ordinary_vol_id} msg=Ordinary persistent volume is not available
107 ${ordinary_vol_exists}= Check If Volume Exists ${ordinary_vol_id}
108 log ${ordinary_vol_exists}
109 IF ${ordinary_vol_exists}==0
110 Fail msg=Persistent ordinary volume was deleted
111 Set Suite Variable ${ordinary_vol_id} ${EMPTY}
113 log Persistent ordinary volume still exists
117 Prepare Ns Config With Volume Id
118 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}}] } ] } ] }
121 Network Service Instance With Existing Volumes Test
122 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config_with_vim_id} ${publickey}
123 Set Suite Variable ${ns_id} ${id}
126 Verify the Attachment Of Existing Persistent Volumes
127 Set Suite Variable ${prev_root_vol_id} ${root_vol_id}
128 Set Suite Variable ${prev_ordinary_vol_id} ${ordinary_vol_id}
129 ${volume_match}= Get Persistent Volumes Attached To Vm ${ns_id}
130 Set Suite Variable ${volume_match}
131 Set Volume Id ${volume_match} 0
132 Set Volume Id ${volume_match} 1
133 Should Be Equal As Strings ${root_vol_id} ${prev_root_vol_id} msg=Existing root volume is not attached to server
134 Should Be Equal As Strings ${ordinary_vol_id} ${prev_ordinary_vol_id} msg=Existing ordinary volume is not attached to server
137 Delete NS Instance With Existing Volumes Test
142 Check Existence of Persistent Volumes
143 Variable Should Exist ${root_vol_id} msg=Volume is not available
144 Variable Should Exist ${ordinary_vol_id} msg=Volume is not available
145 ${root_vol_exists}= Check If Volume Exists ${root_vol_id}
146 Run Keyword If ${root_vol_exists} == 0 Fail msg=Existing root volume is deleted
147 ${ordinary_vol_exists}= Check If Volume Exists ${ordinary_vol_id}
148 Run Keyword If ${ordinary_vol_exists} == 0 Fail msg=Existing ordinary volume is deleted
151 Delete Persistent Volumes
153 Delete Volume ${root_vol_id}
154 Delete Volume ${ordinary_vol_id}
157 Delete NS Descriptor Test
159 Delete NSD ${nsd_name}
162 Delete VNF Descriptor Test
164 Delete VNFD ${vnfd_name}
169 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
171 Run Keyword If Any Tests Failed Delete NS ${ns_name}
173 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
175 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}
177 Run Keyword If Any Tests Failed Delete Persistent Volumes