Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / testsuite / basic_20-manual_native_charm_vdu_scaling.robot
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
4 #
5 #       http://www.apache.org/licenses/LICENSE-2.0
6 #
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.
12
13 *** Settings ***
14 Documentation   [BASIC-20] Manual VDU Scaling to test juju applications are scaling for native charms (testing Bug-1609).
15
16 Library   OperatingSystem
17 Library   String
18 Library   Collections
19
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
24
25 Force Tags   basic_20   cluster_main   daily   regression
26
27 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
28
29
30 *** Variables ***
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
36
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}} ] }
40 ${vnf_member_index}   vnf
41
42 # SSH public key file
43 ${publickey}   %{HOME}/.ssh/id_rsa.pub
44
45 # Scaling group name of VDU instances
46 ${scaling_group}   manual-scaling_mgmtVM
47
48 ${scale_wait_time}   4min
49
50 *** Test Cases ***
51 Create VNF Descriptor
52
53     Create VNFD   '%{PACKAGES_FOLDER}/${vnfd_pkg}'
54
55 Create NS Descriptor
56
57     Create NSD   '%{PACKAGES_FOLDER}/${nsd_pkg}'
58
59
60 Instantiate Network Service
61
62     ${id}=   Create Network Service   ${nsd_name}   %{VIM_TARGET}   ${ns_name}   ${ns_config}   ${publickey}
63     Set Suite Variable   ${ns_id}   ${id}
64
65
66 Get Vnf Id
67
68     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
69     @{vnfr_list}=   Get Ns Vnfr Ids   ${ns_id}
70     Log List   ${vnfr_list}
71     Set Suite Variable   ${vnf_id}   ${vnfr_list}[0]
72
73
74 Get Vdus Before Scale Out
75     [Documentation]   Get the number of VDU records before the manual scaling.
76
77     @{vdur_list}=   Get Vnf Vdur Names   ${vnf_id}
78     Log List   ${vdur_list}
79     ${vdurs}=   Get Length   ${vdur_list}
80     Set Suite Variable   ${initial_vdur_count}   ${vdurs}
81
82
83 Get Application Name Before Scale Out
84     [Documentation]   Get the application names.
85
86     @{name_list}=   Get Application Names   ${ns_name}
87     Log List   ${name_list}
88     Set Suite Variable   ${application_list}   ${name_list}
89
90
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.
93
94     ${count_duplicated}=   Get Length   ${application_list}
95     Run Keyword If   ${count_duplicated} != 2   Fail   msg=There are not 2 application name in the application list before Scale Out
96
97
98 Perform Manual Vdu Scale Out
99
100     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
101     ${ns_op_id}=   Execute Manual VNF Scale   ${ns_name}   ${vnf_member_index}   ${scaling_group}   SCALE_OUT   ${scale_wait_time}
102
103
104 Check Vdus After Scale Out
105     [Documentation]   Check whether there is one more VDU after scaling or not.
106
107     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
108     @{vdur_list}=   Get Vnf Vdur Names   ${vnf_id}
109     Log List   ${vdur_list}
110     ${vdurs}=   Get Length   ${vdur_list}
111     Run Keyword If   ${vdurs} != ${initial_vdur_count} + 1   Fail   msg=There is no new VDU records in the VNF after Scale Out
112
113
114 Get Application Name After Scale Out
115     [Documentation]   Get the application names.
116
117     @{name_list}=   Get Application Names   ${ns_name}
118     Log List   ${name_list}
119     Set Suite Variable   ${application_list}   ${name_list}
120
121
122 Check Number of Duplicated Application Name After Scale Out
123     [Documentation]   Check the application names if there are 3 application name in the application list.
124
125     ${count_duplicated}=   Get Length   ${application_list}
126     Run Keyword If   ${count_duplicated} != 3   Fail   msg=There are not 2 application name in the application list after Scale Out
127
128
129 Perform Manual Vdu Scale In
130
131     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
132     ${ns_op_id}=   Execute Manual VNF Scale   ${ns_name}   ${vnf_member_index}   ${scaling_group}   SCALE_IN
133
134
135 Check Vdus After Scaling In
136     [Documentation]   Check whether there is one less VDU after scaling or not.
137
138     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
139     @{vdur_list}=   Get Vnf Vdur Names   ${vnf_id}
140     Log List   ${vdur_list}
141     ${vdurs}=   Get Length   ${vdur_list}
142     Run Keyword If   ${vdurs} != ${initial_vdur_count}   Fail   msg=There is the same number of VDU records in the VNF after Scale In
143
144
145 Get Application Name After Scale In
146     [Documentation]   Get the application names.
147
148     @{name_list}=   Get Application Names   ${ns_name}
149     Log List   ${name_list}
150     Set Suite Variable   ${application_list}   ${name_list}
151
152
153 Check Number of Duplicated Application Name After Scale In
154     [Documentation]   Check the application names if there are 2 application name in the application list.
155
156     ${count_duplicated}=   Get Length   ${application_list}
157     Run Keyword If   ${count_duplicated} != 2   Fail   msg=There are not 2 application name in the application list after Scale In
158
159
160 Delete NS Instance
161     [Tags]   cleanup
162
163     Delete NS   ${ns_name}
164
165
166 Delete NS Descriptor
167     [Tags]   cleanup
168
169     Delete NSD   ${nsd_name}
170
171
172 Delete VNF Descriptor
173     [Tags]   cleanup
174
175     Delete VNFD   ${vnfd_name}
176
177
178 *** Keywords ***
179 Suite Cleanup
180     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
181
182     Run Keyword If Any Tests Failed   Delete NS   ${ns_name}
183
184     Run Keyword If Any Tests Failed   Delete NSD   ${nsd_name}
185
186     Run Keyword If Any Tests Failed   Delete VNFD   ${vnfd_name}
187