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
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 Documentation [BASIC-20] Manual VDU Scaling to test juju applications are scaling for native charms (testing Bug-1609).
18 Library OperatingSystem
22 Resource ../lib/vnfd_lib.resource
23 Resource ../lib/nsd_lib.resource
24 Resource ../lib/ns_lib.resource
25 Resource ../lib/ns_operation_lib.resource
26 Resource ../lib/ssh_lib.resource
28 Test Tags basic_20 cluster_main regression azure
30 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
34 # NS and VNF descriptor package folder and ids
35 ${VNFD_PKG} charm-packages/native_manual_scale_charm_vnf
36 ${VNFD_NAME} native_manual_scale_charm-vnf
37 ${NSD_PKG} charm-packages/native_manual_scale_charm_ns
38 ${NSD_NAME} native_manual_scale_charm-ns
40 # NS instance name and configuration
41 ${NS_NAME} basic_20_manual_vdu_scaling_test
42 ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
43 ${VNF_MEMBER_INDEX} vnf
46 ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
48 # Scaling group name of VDU instances
49 ${SCALING_GROUP} manual-scaling_mgmtVM
51 ${SCALE_WAIT_TIME} 4min
56 [Documentation] Upload VNF package for the testsuite.
57 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
60 [Documentation] Upload NS package for the testsuite.
61 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
63 Instantiate Network Service
64 [Documentation] Instantiate NS for the testsuite.
65 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY}
66 Set Suite Variable ${NS_ID} ${id}
69 [Documentation] Retrieve VNF instance id to be used later on
70 Variable Should Exist ${NS_ID} msg=Network service instance is not available
71 @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID}
73 Set Suite Variable ${VNF_ID} ${vnfr_list}[0]
75 Get Vdus Before Scale Out
76 [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}
82 Get Application Name Before Scale Out
83 [Documentation] Get the application names.
84 @{name_list}= Get Application Names ${NS_NAME}
86 Set Suite Variable ${APPLICATION_LIST} ${name_list}
88 Check Number of Duplicated Application Name Before Scale Out
89 [Documentation] Check the application names if there are 2 application name in the application list.
90 ${count_duplicated}= Get Length ${APPLICATION_LIST}
91 IF ${count_duplicated} != 2 Fail msg=There are not 2 application name in the application list before Scale Out
93 Perform Manual Vdu Scale Out
94 [Documentation] Perform a manual scale-out operation of the VNF.
95 Variable Should Exist ${NS_ID} msg=Network service instance is not available
96 ${ns_op_id}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_OUT ${SCALE_WAIT_TIME}
99 Check Vdus After Scale Out
100 [Documentation] Check whether there is one more VDU after scaling out.
101 Variable Should Exist ${NS_ID} msg=Network service instance is not available
102 @{vdur_list}= Get Vnf Vdur Names ${VNF_ID}
103 Log List ${vdur_list}
104 ${vdurs}= Get Length ${vdur_list}
105 IF ${vdurs} != ${INITIAL_VDUR_COUNT} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out
107 Get Application Name After Scale Out
108 [Documentation] Get the application names.
109 @{name_list}= Get Application Names ${NS_NAME}
110 Log List ${name_list}
111 Set Suite Variable ${APPLICATION_LIST} ${name_list}
113 Check Number of Duplicated Application Name After Scale Out
114 [Documentation] Check the application names if there are 3 application name in the application list.
115 ${count_duplicated}= Get Length ${APPLICATION_LIST}
116 IF ${count_duplicated} != 3 Fail msg=There are not 2 application name in the application list after Scale Out
118 Perform Manual Vdu Scale In
119 [Documentation] Perform a manual scale-in operation of the VNF.
120 Variable Should Exist ${NS_ID} msg=Network service instance is not available
121 ${ns_op_id}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_IN
124 Check Vdus After Scaling In
125 [Documentation] Check whether there is one less VDU after scaling in.
126 Variable Should Exist ${NS_ID} msg=Network service instance is not available
127 @{vdur_list}= Get Vnf Vdur Names ${VNF_ID}
128 Log List ${vdur_list}
129 ${vdurs}= Get Length ${vdur_list}
130 IF ${vdurs} != ${INITIAL_VDUR_COUNT} Fail msg=There is the same number of VDU records in the VNF after Scale In
132 Get Application Name After Scale In
133 [Documentation] Get the application names.
134 @{name_list}= Get Application Names ${NS_NAME}
135 Log List ${name_list}
136 Set Suite Variable ${APPLICATION_LIST} ${name_list}
138 Check Number of Duplicated Application Name After Scale In
139 [Documentation] Check the application names if there are 2 application name in the application list.
140 ${count_duplicated}= Get Length ${APPLICATION_LIST}
141 IF ${count_duplicated} != 2 Fail msg=There are not 2 application name in the application list after Scale In
144 [Documentation] Delete NS instance.
149 [Documentation] Delete NS package from OSM.
151 Delete NSD ${NSD_NAME}
153 Delete VNF Descriptor
154 [Documentation] Delete VNF package from OSM.
156 Delete VNFD ${VNFD_NAME}
161 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
162 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
163 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
164 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}