Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / testsuite / basic_16-advanced_onboarding_and_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-16] Advanced onboarding with override and complex scaling (3 initial instances, scaled by two).
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_16   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_16
42 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
43
44 # SSH public keys file
45 ${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
46
47 # Initial, delta, min and max number of VDU instances
48 ${INIT_INSTANCES}   3
49 ${MIN_INSTANCES}   3
50 ${MAX_INSTANCES}   5
51 ${DELTA_INSTANCES}   2
52 ${SCALING_GROUP}   vdu_autoscale
53 ${VNF_MEMBER_INDEX}   vnf
54
55
56 *** Test Cases ***
57 Create Scaling VNF Descriptor
58     [Documentation]   Upload VNF package for the testsuite.
59     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}
60
61 Create Scaling NS Descriptor
62     [Documentation]   Upload NS package for the testsuite.
63     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
64
65 Instantiate Scaling Network Service
66     [Documentation]   Instantiate NS for the testsuite.
67     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}
68     Set Suite Variable   ${NS_ID}   ${id}
69
70 Get Vnf Id
71     [Documentation]   Retrieve VNF instance id to be used later on.
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 Check Vdus Before Scale Out
78     [Documentation]   Check the number of VDUs instances before the manual scaling.
79     @{vdur_list}=   Get Vnf Vdur Names   ${VNF_ID}
80     Log List   ${vdur_list}
81     ${vdurs}=   Get Length   ${vdur_list}
82     Set Suite Variable   ${INITIAL_VDUR_COUNT}   ${vdurs}
83     IF   ${INIT_INSTANCES} != ${INITIAL_VDUR_COUNT}   Fail   msg=Instantiated VDUs (${INITIAL_VDUR_COUNT}) don't match specified number in descriptor (${INIT_INSTANCES})
84
85 Perform Manual Vdu Scale Out
86     [Documentation]   Perform a manual scale-out operation of the VNF.
87     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
88     ${ns_op_id}=   Execute Manual VNF Scale   ${NS_NAME}   ${VNF_MEMBER_INDEX}   ${SCALING_GROUP}   SCALE_OUT
89     Log   ${ns_op_id}
90
91 Check Vdus After Scale Out
92     [Documentation]   Check whether there is one extra VDU after scaling out.
93     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
94     @{vdur_list}=   Get Vnf Vdur Names   ${VNF_ID}
95     Log List   ${vdur_list}
96     ${vdurs}=   Get Length   ${vdur_list}
97     IF   ${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})
98
99 Perform Manual Vdu Scale In
100     [Documentation]   Perform a manual scale-in operation of the VNF.
101     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
102     ${ns_op_id}=   Execute Manual VNF Scale   ${NS_NAME}   ${VNF_MEMBER_INDEX}   ${SCALING_GROUP}   SCALE_IN
103     Log   ${ns_op_id}
104
105 Check Vdus After Scaling In
106     [Documentation]   Check whether there is one less VDU after scaling in.
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     IF   ${vdurs} != ${INITIAL_VDUR_COUNT}   Fail   msg=There is the same number of VDU records in the VNF after Scale In
112
113 Delete NS Instance
114     [Documentation]   Delete NS intance.
115     [Tags]   cleanup
116     Delete NS   ${NS_NAME}
117
118 Delete NS Descriptor
119     [Documentation]   Delete NS package from OSM.
120     [Tags]   cleanup
121     Delete NSD   ${NSD_NAME}
122
123 Delete VNF Descriptor
124     [Documentation]   Delete VNF package from OSM.
125     [Tags]   cleanup
126     Delete VNFD   ${VNFD_NAME}
127
128
129 *** Keywords ***
130 Suite Cleanup
131     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
132     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
133     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
134     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}