| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 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 | |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 25 | Force Tags basic_09 cluster_main daily regression |
| 26 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 27 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 28 | |
| 29 | |
| 30 | *** Variables *** |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 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_09_manual_scaling_test |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 39 | ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| 40 | ${scaling_group} vdu_autoscale |
| 41 | ${vnf_member_index} 1 |
| 42 | |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 43 | # SSH public key file |
| 44 | ${publickey} %{HOME}/.ssh/id_rsa.pub |
| 45 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 46 | |
| 47 | *** Test Cases *** |
| 48 | Create Scaling VNF Descriptor |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 49 | |
| 50 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' |
| 51 | |
| 52 | |
| 53 | Create Scaling NS Descriptor |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 54 | |
| 55 | Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' |
| 56 | |
| 57 | |
| 58 | Instantiate Scaling Network Service |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 59 | |
| 60 | ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} |
| 61 | Set Suite Variable ${ns_id} ${id} |
| 62 | |
| 63 | |
| 64 | Get Vnf Id |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 65 | |
| 66 | Variable Should Exist ${ns_id} msg=Network service instance is not available |
| 67 | @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} |
| 68 | Log List ${vnfr_list} |
| 69 | Set Suite Variable ${vnf_id} ${vnfr_list}[0] |
| 70 | |
| 71 | |
| 72 | Get Vdus Before Scale Out |
| 73 | [Documentation] Get the number of VDU records before the manual scaling. |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 74 | |
| 75 | @{vdur_list}= Get Vnf Vdur Names ${vnf_id} |
| 76 | Log List ${vdur_list} |
| 77 | ${vdurs}= Get Length ${vdur_list} |
| 78 | Set Suite Variable ${initial_vdur_count} ${vdurs} |
| 79 | |
| 80 | |
| 81 | Perform Manual Vdu Scale Out |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 82 | |
| 83 | Variable Should Exist ${ns_id} msg=Network service instance is not available |
| 84 | ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT |
| 85 | |
| 86 | |
| 87 | Check Vdus After Scale Out |
| 88 | [Documentation] Check whether there is one more VDU after scaling or not. |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 89 | |
| 90 | Variable Should Exist ${ns_id} msg=Network service instance is not available |
| 91 | @{vdur_list}= Get Vnf Vdur Names ${vnf_id} |
| 92 | Log List ${vdur_list} |
| 93 | ${vdurs}= Get Length ${vdur_list} |
| 94 | Run Keyword Unless ${vdurs} == ${initial_vdur_count} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out |
| 95 | |
| 96 | |
| 97 | Perform Manual Vdu Scale In |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 98 | |
| 99 | Variable Should Exist ${ns_id} msg=Network service instance is not available |
| 100 | ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN |
| 101 | |
| 102 | |
| 103 | Check Vdus After Scaling In |
| 104 | [Documentation] Check whether there is one less VDU after scaling or not. |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 105 | |
| 106 | Variable Should Exist ${ns_id} msg=Network service instance is not available |
| 107 | @{vdur_list}= Get Vnf Vdur Names ${vnf_id} |
| 108 | Log List ${vdur_list} |
| 109 | ${vdurs}= Get Length ${vdur_list} |
| 110 | Run Keyword Unless ${vdurs} == ${initial_vdur_count} Fail msg=There is the same number of VDU records in the VNF after Scale In |
| 111 | |
| 112 | |
| 113 | Delete NS Instance |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 114 | [Tags] cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 115 | |
| 116 | Delete NS ${ns_name} |
| 117 | |
| 118 | |
| 119 | Delete NS Descriptor |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 120 | [Tags] cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 121 | |
| 122 | Delete NSD ${nsd_name} |
| 123 | |
| 124 | |
| 125 | Delete VNF Descriptor |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 126 | [Tags] cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 127 | |
| 128 | Delete VNFD ${vnfd_name} |
| 129 | |
| 130 | |
| 131 | *** Keywords *** |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 132 | Suite Cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 133 | [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance |
| 134 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 135 | Run Keyword If Any Tests Failed Delete NS ${ns_name} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 136 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 137 | Run Keyword If Any Tests Failed Delete NSD ${nsd_name} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 138 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 139 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 140 | |