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-20] Manual VDU Scaling to test juju applications are scaling for native charms (testing Bug-1609).
16 Library OperatingSystem
20 Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
21 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
22 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
23 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
25 Force Tags basic_20 cluster_main daily regression
27 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
31 # NS and VNF descriptor package folder and ids
32 ${vnfd_pkg} charm-packages/native_manual_scale_charm_vnf
33 ${vnfd_name} native_manual_scale_charm-vnf
34 ${nsd_pkg} charm-packages/native_manual_scale_charm_ns
35 ${nsd_name} native_manual_scale_charm-ns
37 # NS instance name and configuration
38 ${ns_name} basic_20_manual_vdu_scaling_test
39 ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
43 ${publickey} %{HOME}/.ssh/id_rsa.pub
45 # Scaling group name of VDU instances
46 ${scaling_group} manual-scaling_mgmtVM
48 ${scale_wait_time} 4min
53 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
57 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
60 Instantiate Network Service
62 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
63 Set Suite Variable ${ns_id} ${id}
68 Variable Should Exist ${ns_id} msg=Network service instance is not available
69 @{vnfr_list}= Get Ns Vnfr Ids ${ns_id}
71 Set Suite Variable ${vnf_id} ${vnfr_list}[0]
74 Get Vdus Before Scale Out
75 [Documentation] Get the number of VDU records before the manual scaling.
77 @{vdur_list}= Get Vnf Vdur Names ${vnf_id}
79 ${vdurs}= Get Length ${vdur_list}
80 Set Suite Variable ${initial_vdur_count} ${vdurs}
83 Get Application Name Before Scale Out
84 [Documentation] Get the application names.
86 @{name_list}= Get Application Names ${ns_name}
88 Set Suite Variable ${application_list} ${name_list}
91 Check Number of Duplicated Application Name Before Scale Out
92 [Documentation] Check the application names if there are 2 application name in the application list.
94 ${count_duplicated}= Get Length ${application_list}
95 Run Keyword Unless ${count_duplicated} == 2 Fail msg=There are not 2 application name in the application list before Scale Out
98 Check Number of not Duplicated Application Name Before Scale Out
99 [Documentation] Check the application if there is only one application in the Juju model.
101 ${app_list}= Remove Duplicates ${application_list}
103 ${count}= Get Length ${app_list}
104 Run Keyword Unless 1 == ${count} Fail msg=There is not only 1 application in the Juju model before Scale Out
107 Perform Manual Vdu Scale Out
109 Variable Should Exist ${ns_id} msg=Network service instance is not available
110 ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT ${scale_wait_time}
113 Check Vdus After Scale Out
114 [Documentation] Check whether there is one more VDU after scaling or not.
116 Variable Should Exist ${ns_id} msg=Network service instance is not available
117 @{vdur_list}= Get Vnf Vdur Names ${vnf_id}
118 Log List ${vdur_list}
119 ${vdurs}= Get Length ${vdur_list}
120 Run Keyword Unless ${vdurs} == ${initial_vdur_count} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out
123 Get Application Name After Scale Out
124 [Documentation] Get the application names.
126 @{name_list}= Get Application Names ${ns_name}
127 Log List ${name_list}
128 Set Suite Variable ${application_list} ${name_list}
131 Check Number of Duplicated Application Name After Scale Out
132 [Documentation] Check the application names if there are 3 application name in the application list.
134 ${count_duplicated}= Get Length ${application_list}
135 Run Keyword Unless ${count_duplicated} == 3 Fail msg=There are not 2 application name in the application list after Scale Out
138 Check Number of not Duplicated Application Name After Scale Out
139 [Documentation] Check the application if there is only one application in the Juju model.
141 ${app_list}= Remove Duplicates ${application_list}
143 ${count}= Get Length ${app_list}
144 Run Keyword Unless 1 == ${count} Fail msg=There is not only 1 application in the Juju model after Scale Out
147 Perform Manual Vdu Scale In
149 Variable Should Exist ${ns_id} msg=Network service instance is not available
150 ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN
153 Check Vdus After Scaling In
154 [Documentation] Check whether there is one less VDU after scaling or not.
156 Variable Should Exist ${ns_id} msg=Network service instance is not available
157 @{vdur_list}= Get Vnf Vdur Names ${vnf_id}
158 Log List ${vdur_list}
159 ${vdurs}= Get Length ${vdur_list}
160 Run Keyword Unless ${vdurs} == ${initial_vdur_count} Fail msg=There is the same number of VDU records in the VNF after Scale In
163 Get Application Name After Scale In
164 [Documentation] Get the application names.
166 @{name_list}= Get Application Names ${ns_name}
167 Log List ${name_list}
168 Set Suite Variable ${application_list} ${name_list}
171 Check Number of Duplicated Application Name After Scale In
172 [Documentation] Check the application names if there are 2 application name in the application list.
174 ${count_duplicated}= Get Length ${application_list}
175 Run Keyword Unless ${count_duplicated} == 2 Fail msg=There are not 2 application name in the application list after Scale In
178 Check Number of not Duplicated Application Name After Scale In
179 [Documentation] Check the application if there is only one application in the Juju model.
181 ${app_list}= Remove Duplicates ${application_list}
183 ${count}= Get Length ${app_list}
184 Run Keyword Unless 1 == ${count} Fail msg=There is not only 1 application in the Juju model after Scale In
196 Delete NSD ${nsd_name}
199 Delete VNF Descriptor
202 Delete VNFD ${vnfd_name}
207 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
209 Run Keyword If Any Tests Failed Delete NS ${ns_name}
211 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
213 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}