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 *** Comments ***
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
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
14
15 *** Settings ***
16 Documentation   [BASIC-20] Manual VDU Scaling to test juju applications are scaling for native charms (testing Bug-1609).
17
18 Library   OperatingSystem
19 Library   String
20 Library   Collections
21
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
27
28 Test Tags   basic_20   cluster_main   regression   azure
29
30 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
31
32
33 *** Variables ***
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
39
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
44
45 # SSH public key file
46 ${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
47
48 # Scaling group name of VDU instances
49 ${SCALING_GROUP}   manual-scaling_mgmtVM
50
51 ${SCALE_WAIT_TIME}   4min
52
53
54 *** Test Cases ***
55 Create VNF Descriptor
56     [Documentation]   Upload VNF package for the testsuite.
57     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
58
59 Create NS Descriptor
60     [Documentation]   Upload NS package for the testsuite.
61     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
62
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}
67
68 Get Vnf 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}
72     Log List   ${vnfr_list}
73     Set Suite Variable   ${VNF_ID}   ${vnfr_list}[0]
74
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}
78     Log List   ${vdur_list}
79     ${vdurs}=   Get Length   ${vdur_list}
80     Set Suite Variable   ${INITIAL_VDUR_COUNT}   ${vdurs}
81
82 Get Application Name Before Scale Out
83     [Documentation]   Get the application names.
84     @{name_list}=   Get Application Names   ${NS_NAME}
85     Log List   ${name_list}
86     Set Suite Variable   ${APPLICATION_LIST}   ${name_list}
87
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
92
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}
97     Log   ${ns_op_id}
98
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
106
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}
112
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
117
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
122     Log   ${ns_op_id}
123
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
131
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}
137
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
142
143 Delete NS Instance
144     [Documentation]   Delete NS instance.
145     [Tags]   cleanup
146     Delete NS   ${NS_NAME}
147
148 Delete NS Descriptor
149     [Documentation]   Delete NS package from OSM.
150     [Tags]   cleanup
151     Delete NSD   ${NSD_NAME}
152
153 Delete VNF Descriptor
154     [Documentation]   Delete VNF package from OSM.
155     [Tags]   cleanup
156     Delete VNFD   ${VNFD_NAME}
157
158
159 *** Keywords ***
160 Suite Cleanup
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}