Initial tests contributions
[osm/tests.git] / robot-systest / testsuite / basic_09-manual_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-09] Manual VNF/VDU Scaling.
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 Variables   %{ROBOT_DEVOPS_FOLDER}/resources/basic_09-manual_vdu_scaling_data.py
26
27 Suite Teardown   Run Keyword And Ignore Error   Test Cleanup
28
29
30 *** Variables ***
31 ${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
32 ${scaling_group}   vdu_autoscale
33 ${vnf_member_index}  1
34
35
36 *** Test Cases ***
37 Create Scaling VNF Descriptor
38     [Tags]   manual_scaling   sanity   regression
39
40     Create VNFD  '%{PACKAGES_FOLDER}/${vnfd_pkg}'
41
42
43 Create Scaling NS Descriptor
44     [Tags]   manual_scaling   sanity   regression
45
46     Create NSD  '%{PACKAGES_FOLDER}/${nsd_pkg}'
47
48
49 Instantiate Scaling Network Service
50     [Tags]   manual_scaling   sanity   regression
51
52     ${id}=  Create Network Service  ${nsd_name}  %{VIM_TARGET}  ${ns_name}  ${ns_config}  ${publickey}
53     Set Suite Variable  ${ns_id}  ${id}
54
55
56 Get Vnf Id
57     [Tags]   manual_scaling   sanity   regression
58
59     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
60     @{vnfr_list}=  Get Ns Vnfr Ids  ${ns_id}
61     Log List  ${vnfr_list}
62     Set Suite Variable  ${vnf_id}  ${vnfr_list}[0]
63
64
65 Get Vdus Before Scale Out
66     [Documentation]     Get the number of VDU records before the manual scaling.
67     [Tags]   manual_scaling   sanity   regression
68
69     @{vdur_list}=  Get Vnf Vdur Names  ${vnf_id}
70     Log List  ${vdur_list}
71     ${vdurs}=  Get Length  ${vdur_list}
72     Set Suite Variable  ${initial_vdur_count}  ${vdurs}
73
74
75 Perform Manual Vdu Scale Out
76     [Tags]   manual_scaling   sanity   regression
77
78     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
79     ${ns_op_id}=  Execute Manual VNF Scale  ${ns_name}  ${vnf_member_index}  ${scaling_group}  SCALE_OUT
80
81
82 Check Vdus After Scale Out
83     [Documentation]     Check whether there is one more VDU after scaling or not.
84     [Tags]   manual_scaling   sanity   regression
85
86     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
87     @{vdur_list}=  Get Vnf Vdur Names  ${vnf_id}
88     Log List  ${vdur_list}
89     ${vdurs}=  Get Length  ${vdur_list}
90     Run Keyword Unless  ${vdurs} == ${initial_vdur_count} + 1  Fail  msg=There is no new VDU records in the VNF after Scale Out
91
92
93 Perform Manual Vdu Scale In
94     [Tags]   manual_scaling   sanity   regression
95
96     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
97     ${ns_op_id}=  Execute Manual VNF Scale  ${ns_name}  ${vnf_member_index}  ${scaling_group}  SCALE_IN
98
99
100 Check Vdus After Scaling In
101     [Documentation]     Check whether there is one less VDU after scaling or not.
102     [Tags]   manual_scaling   sanity   regression
103
104     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
105     @{vdur_list}=  Get Vnf Vdur Names  ${vnf_id}
106     Log List  ${vdur_list}
107     ${vdurs}=  Get Length  ${vdur_list}
108     Run Keyword Unless  ${vdurs} == ${initial_vdur_count}  Fail  msg=There is the same number of VDU records in the VNF after Scale In
109
110
111 Delete NS Instance
112     [Tags]   manual_scaling   sanity   regression  cleanup
113
114     Delete NS  ${ns_name}
115
116
117 Delete NS Descriptor
118     [Tags]   manual_scaling   sanity   regression  cleanup
119
120     Delete NSD  ${nsd_name}
121
122
123 Delete VNF Descriptor
124     [Tags]   manual_scaling   sanity   regression  cleanup
125
126     Delete VNFD  ${vnfd_name}
127
128
129 *** Keywords ***
130 Test Cleanup
131     [Documentation]  Test Suite Cleanup: Deleting descriptors and NS instance
132
133     Run Keyword If Test Failed  Delete NS  ${ns_name}
134
135     Run Keyword If Test Failed  Delete NSD  ${nsd_name}
136
137     Run Keyword If Test Failed  Delete VNFD  ${vnfd_name}
138