Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / testsuite / basic_09-manual_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-09] Manual VNF/VDU Scaling.
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_09   cluster_main   daily   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}   hackfest_basic_metrics_vnf
36 ${VNFD_NAME}   hackfest_basic_metrics-vnf
37 ${NSD_PKG}   hackfest_basic_metrics_ns
38 ${NSD_NAME}   hackfest_basic-ns-metrics
39
40 # NS instance name and configuration
41 ${NS_NAME}   basic_09_manual_scaling_test
42 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
43 ${SCALING_GROUP}   vdu_autoscale
44 ${VNF_MEMBER_INDEX}   vnf
45
46 # SSH public key file
47 ${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
48
49
50 *** Test Cases ***
51 Create Scaling VNF Descriptor
52     [Documentation]   Upload VNF package for the testsuite.
53     [Tags]   prepare
54     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
55
56 Create Scaling NS Descriptor
57     [Documentation]   Upload NS package for the testsuite.
58     [Tags]   prepare
59     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
60
61 Instantiate Scaling Network Service
62     [Documentation]   Instantiate NS for the testsuite.
63     [Tags]   prepare
64     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}
65     Log   ${id}
66
67 Get Ns Id
68     [Documentation]   Retrieve NS instance id to be used later on.
69     [Tags]   verify
70     ${id}=   Get Ns Id   ${NS_NAME}
71     Set Suite Variable   ${NS_ID}   ${id}
72
73 Get Vnf Id
74     [Documentation]   Retrieve VNF instance id to be used later on.
75     [Tags]   verify
76     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
77     @{vnfr_list}=   Get Ns Vnfr Ids   ${NS_ID}
78     Log List   ${vnfr_list}
79     Set Suite Variable   ${VNF_ID}   ${vnfr_list}[0]
80
81 Get Vdus Before Scale Out
82     [Documentation]   Check the number of VDUs instances before the manual scaling.
83     [Tags]   verify
84     @{vdur_list}=   Get Vnf Vdur Names   ${VNF_ID}
85     Log List   ${vdur_list}
86     ${vdurs}=   Get Length   ${vdur_list}
87     Set Suite Variable   ${INITIAL_VDUR_COUNT}   ${vdurs}
88
89 Perform Manual Vdu Scale Out
90     [Documentation]   Perform a manual scale-out operation of the VNF.
91     [Tags]   verify
92     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
93     ${ns_op_id}=   Execute Manual VNF Scale   ${NS_NAME}   ${VNF_MEMBER_INDEX}   ${SCALING_GROUP}   SCALE_OUT
94     Log   ${ns_op_id}
95
96 Check Vdus After Scale Out
97     [Documentation]   Check whether there is one more VDU after scaling out.
98     [Tags]   verify
99     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
100     @{vdur_list}=   Get Vnf Vdur Names   ${VNF_ID}
101     Log List   ${vdur_list}
102     ${vdurs}=   Get Length   ${vdur_list}
103     IF   ${vdurs} != ${INITIAL_VDUR_COUNT} + 1   Fail   msg=There is no new VDU records in the VNF after Scale Out
104
105 Perform Manual Vdu Scale In
106     [Documentation]   Perform a manual scale-in operation of the VNF.
107     [Tags]   verify
108     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
109     ${ns_op_id}=   Execute Manual VNF Scale   ${NS_NAME}   ${VNF_MEMBER_INDEX}   ${SCALING_GROUP}   SCALE_IN
110     Log   ${ns_op_id}
111
112 Check Vdus After Scaling In
113     [Documentation]   Check whether there is one less VDU after scaling in.
114     [Tags]   verify
115     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
116     @{vdur_list}=   Get Vnf Vdur Names   ${VNF_ID}
117     Log List   ${vdur_list}
118     ${vdurs}=   Get Length   ${vdur_list}
119     IF   ${vdurs} != ${INITIAL_VDUR_COUNT}   Fail   msg=There is the same number of VDU records in the VNF after Scale In
120
121 Delete NS Instance
122     [Documentation]   Delete NS instance.
123     [Tags]   cleanup
124     Delete NS   ${NS_NAME}
125
126 Delete NS Descriptor
127     [Documentation]   Delete NS package from OSM.
128     [Tags]   cleanup
129     Delete NSD   ${NSD_NAME}
130
131 Delete VNF Descriptor
132     [Documentation]   Delete VNF package from OSM.
133     [Tags]   cleanup
134     Delete VNFD   ${VNFD_NAME}
135
136
137 *** Keywords ***
138 Suite Cleanup
139     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
140     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
141     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
142     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}