52d8069024a43fc9e97266c43f2e066a156a6074
[osm/tests.git] / robot-systest / testsuite / basic_16-advanced_onboarding_and_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-16] Advanced onboarding with override and complex scaling (3 initial instances, scaled by two).
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_16   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}   hackfest_basic_metrics_vnf
33 ${vnfd_name}   hackfest_basic_metrics-vnf
34 ${nsd_pkg}   hackfest_basic_metrics_ns
35 ${nsd_name}   hackfest_basic-ns-metrics
36
37 # NS instance name and configuration
38 ${ns_name}   basic_16
39 ${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
40
41 # SSH public keys file
42 ${publickey}   %{HOME}/.ssh/id_rsa.pub
43
44 # Initial, delta, min and max number of VDU instances
45 ${init_instances}   3
46 ${min_instances}   3
47 ${max_instances}   5
48 ${delta_instances}   2
49 ${scaling_group}   vdu_autoscale
50 ${vnf_member_index}  1
51
52
53 *** Test Cases ***
54 Create Scaling VNF Descriptor
55
56     Create VNFD Overriding Fields  '%{PACKAGES_FOLDER}/${vnfd_pkg}'   df.0.instantiation-level.0.vdu-level.0.number-of-instances=${init_instances};df.0.vdu-profile.0.min-number-of-instances=${min_instances};df.0.vdu-profile.0.max-number-of-instances=${max_instances};df.0.scaling-aspect.0.aspect-delta-details.deltas.0.vdu-delta.0.number-of-instances=${delta_instances}
57
58
59 Create Scaling NS Descriptor
60
61     Create NSD  '%{PACKAGES_FOLDER}/${nsd_pkg}'
62
63
64 Instantiate Scaling Network Service
65
66     ${id}=  Create Network Service  ${nsd_name}  %{VIM_TARGET}  ${ns_name}  ${ns_config}  ${publickey}
67     Set Suite Variable  ${ns_id}  ${id}
68
69
70 Get Vnf Id
71
72     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
73     @{vnfr_list}=  Get Ns Vnfr Ids  ${ns_id}
74     Log List  ${vnfr_list}
75     Set Suite Variable  ${vnf_id}  ${vnfr_list}[0]
76
77
78 Check Vdus Before Scale Out
79     [Documentation]     Check the number of VDUs instances before the manual scaling.
80
81     @{vdur_list}=  Get Vnf Vdur Names  ${vnf_id}
82     Log List  ${vdur_list}
83     ${vdurs}=  Get Length  ${vdur_list}
84     Set Suite Variable  ${initial_vdur_count}  ${vdurs}
85     Run Keyword Unless  ${init_instances} == ${initial_vdur_count}   Fail  msg=Instantiated VDUs (${initial_vdur_count}) don't match specified number in descriptor (${init_instances})
86
87
88 Perform Manual Vdu Scale Out
89
90     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
91     ${ns_op_id}=  Execute Manual VNF Scale  ${ns_name}  ${vnf_member_index}  ${scaling_group}  SCALE_OUT
92
93
94 Check Vdus After Scale Out
95     [Documentation]     Check whether there is one more VDU after scaling or not.
96
97     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
98     @{vdur_list}=  Get Vnf Vdur Names  ${vnf_id}
99     Log List  ${vdur_list}
100     ${vdurs}=  Get Length  ${vdur_list}
101     Run Keyword Unless  ${vdurs} == ${initial_vdur_count} + ${delta_instances}  Fail  msg=VDU instances in the VNF (${vdurs}) don't match after Scale Out (${initial_vdur_count} + ${delta_instances})
102
103
104 Perform Manual Vdu Scale In
105
106     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
107     ${ns_op_id}=  Execute Manual VNF Scale  ${ns_name}  ${vnf_member_index}  ${scaling_group}  SCALE_IN
108
109
110 Check Vdus After Scaling In
111     [Documentation]     Check whether there is one less VDU after scaling or not.
112
113     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
114     @{vdur_list}=  Get Vnf Vdur Names  ${vnf_id}
115     Log List  ${vdur_list}
116     ${vdurs}=  Get Length  ${vdur_list}
117     Run Keyword Unless  ${vdurs} == ${initial_vdur_count}  Fail  msg=There is the same number of VDU records in the VNF after Scale In
118
119
120 Delete NS Instance
121     [Tags]   cleanup
122
123     Delete NS  ${ns_name}
124
125
126 Delete NS Descriptor
127     [Tags]   cleanup
128
129     Delete NSD  ${nsd_name}
130
131
132 Delete VNF Descriptor
133     [Tags]   cleanup
134
135     Delete VNFD  ${vnfd_name}
136
137
138 *** Keywords ***
139 Suite Cleanup
140     [Documentation]  Test Suite Cleanup: Deleting descriptors and NS instance
141
142     Run Keyword If Any Tests Failed  Delete NS  ${ns_name}
143     Run Keyword If Any Tests Failed  Delete NSD  ${nsd_name}
144     Run Keyword If Any Tests Failed  Delete VNFD  ${vnfd_name}
145