blob: f5cdf0f23a4934d8d292778c0f5ce55ba71e4cbd [file] [log] [blame]
Felipe Vicensf96bb452020-06-22 08:12:30 +02001# 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 ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020014Documentation [BASIC-09] Manual VNF/VDU Scaling.
Felipe Vicensf96bb452020-06-22 08:12:30 +020015
16Library OperatingSystem
17Library String
18Library Collections
19
20Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
21Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
22Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
23Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
24
garciadeblas4cf45d72021-04-08 13:52:22 +020025Force Tags basic_09 cluster_main daily regression
26
garciadeblasd225e552020-10-02 16:10:14 +000027Suite Teardown Run Keyword And Ignore Error Suite Cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020028
29
30*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020031# 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_09_manual_scaling_test
Felipe Vicensf96bb452020-06-22 08:12:30 +020039${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
40${scaling_group} vdu_autoscale
garciadeblasf4ebaa82022-06-23 13:33:26 +020041${vnf_member_index} vnf
Felipe Vicensf96bb452020-06-22 08:12:30 +020042
almagiab4697d32021-05-25 08:56:17 +020043# SSH public key file
44${publickey} %{HOME}/.ssh/id_rsa.pub
45
Felipe Vicensf96bb452020-06-22 08:12:30 +020046
47*** Test Cases ***
48Create Scaling VNF Descriptor
rodriguezgarfbedfe02022-02-24 20:05:42 +010049 [Tags] prepare
garciadeblasf4ebaa82022-06-23 13:33:26 +020050 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020051
52
53Create Scaling NS Descriptor
rodriguezgarfbedfe02022-02-24 20:05:42 +010054 [Tags] prepare
garciadeblasf4ebaa82022-06-23 13:33:26 +020055 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020056
57
58Instantiate Scaling Network Service
rodriguezgarfbedfe02022-02-24 20:05:42 +010059 [Tags] prepare
garciadeblasf4ebaa82022-06-23 13:33:26 +020060 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
Felipe Vicensf96bb452020-06-22 08:12:30 +020061
rodriguezgarfbedfe02022-02-24 20:05:42 +010062Get Ns Id
63 [Tags] verify
64 ${id}= Get Ns Id ${ns_name}
65 Set Suite Variable ${ns_id} ${id}
Felipe Vicensf96bb452020-06-22 08:12:30 +020066
67Get Vnf Id
rodriguezgarfbedfe02022-02-24 20:05:42 +010068 [Tags] verify
garciadeblasf4ebaa82022-06-23 13:33:26 +020069 Variable Should Exist ${ns_id} msg=Network service instance is not available
70 @{vnfr_list}= Get Ns Vnfr Ids ${ns_id}
71 Log List ${vnfr_list}
72 Set Suite Variable ${vnf_id} ${vnfr_list}[0]
Felipe Vicensf96bb452020-06-22 08:12:30 +020073
74
75Get Vdus Before Scale Out
rodriguezgarfbedfe02022-02-24 20:05:42 +010076 [Tags] verify
garciadeblasf4ebaa82022-06-23 13:33:26 +020077 [Documentation] Get the number of VDU records before the manual scaling.
Felipe Vicensf96bb452020-06-22 08:12:30 +020078
garciadeblasf4ebaa82022-06-23 13:33:26 +020079 @{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}
Felipe Vicensf96bb452020-06-22 08:12:30 +020083
84
85Perform Manual Vdu Scale Out
rodriguezgarfbedfe02022-02-24 20:05:42 +010086 [Tags] verify
garciadeblasf4ebaa82022-06-23 13:33:26 +020087 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
Felipe Vicensf96bb452020-06-22 08:12:30 +020089
90
91Check Vdus After Scale Out
rodriguezgarfbedfe02022-02-24 20:05:42 +010092 [Tags] verify
garciadeblasf4ebaa82022-06-23 13:33:26 +020093 [Documentation] Check whether there is one more VDU after scaling or not.
Felipe Vicensf96bb452020-06-22 08:12:30 +020094
garciadeblasf4ebaa82022-06-23 13:33:26 +020095 Variable Should Exist ${ns_id} msg=Network service instance is not available
96 @{vdur_list}= Get Vnf Vdur Names ${vnf_id}
97 Log List ${vdur_list}
98 ${vdurs}= Get Length ${vdur_list}
aguilard10320252022-07-01 12:06:41 +000099 Run Keyword If ${vdurs} != ${initial_vdur_count} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out
Felipe Vicensf96bb452020-06-22 08:12:30 +0200100
101
102Perform Manual Vdu Scale In
rodriguezgarfbedfe02022-02-24 20:05:42 +0100103 [Tags] verify
garciadeblasf4ebaa82022-06-23 13:33:26 +0200104 Variable Should Exist ${ns_id} msg=Network service instance is not available
105 ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN
Felipe Vicensf96bb452020-06-22 08:12:30 +0200106
107
108Check Vdus After Scaling In
rodriguezgarfbedfe02022-02-24 20:05:42 +0100109 [Tags] verify
garciadeblasf4ebaa82022-06-23 13:33:26 +0200110 [Documentation] Check whether there is one less VDU after scaling or not.
Felipe Vicensf96bb452020-06-22 08:12:30 +0200111
garciadeblasf4ebaa82022-06-23 13:33:26 +0200112 Variable Should Exist ${ns_id} msg=Network service instance is not available
113 @{vdur_list}= Get Vnf Vdur Names ${vnf_id}
114 Log List ${vdur_list}
115 ${vdurs}= Get Length ${vdur_list}
aguilard10320252022-07-01 12:06:41 +0000116 Run Keyword If ${vdurs} != ${initial_vdur_count} Fail msg=There is the same number of VDU records in the VNF after Scale In
Felipe Vicensf96bb452020-06-22 08:12:30 +0200117
118
119Delete NS Instance
garciadeblas4cf45d72021-04-08 13:52:22 +0200120 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200121
garciadeblasf4ebaa82022-06-23 13:33:26 +0200122 Delete NS ${ns_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200123
124
125Delete NS Descriptor
garciadeblas4cf45d72021-04-08 13:52:22 +0200126 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200127
garciadeblasf4ebaa82022-06-23 13:33:26 +0200128 Delete NSD ${nsd_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200129
130
131Delete VNF Descriptor
garciadeblas4cf45d72021-04-08 13:52:22 +0200132 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200133
garciadeblasf4ebaa82022-06-23 13:33:26 +0200134 Delete VNFD ${vnfd_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200135
136
137*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000138Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200139 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
Felipe Vicensf96bb452020-06-22 08:12:30 +0200140
garciadeblasf4ebaa82022-06-23 13:33:26 +0200141 Run Keyword If Any Tests Failed Delete NS ${ns_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200142
garciadeblasf4ebaa82022-06-23 13:33:26 +0200143 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200144
garciadeblasf4ebaa82022-06-23 13:33:26 +0200145 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200146