| aguilard | b19f27f | 2021-06-30 12:21:18 +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 *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 14 | Documentation [BASIC-19] NS with a single VNF and two VDU linked by a VLD with ip-profile. |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 15 | |
| 16 | Library OperatingSystem |
| 17 | Library String |
| 18 | Library Collections |
| 19 | Library SSHLibrary |
| 20 | |
| 21 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot |
| 22 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot |
| 23 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot |
| 24 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot |
| 25 | |
| 26 | Force Tags basic_19 cluster_main daily regression |
| 27 | |
| 28 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| 29 | |
| 30 | |
| 31 | *** Variables *** |
| 32 | # NS and VNF descriptor package folder and ids |
| 33 | ${vnfd_pkg} ipprofile_2vm_vnf |
| 34 | ${vnfd_name} ipprofile_2vm-vnf |
| 35 | ${nsd_pkg} ipprofile_2vm_ns |
| 36 | ${nsd_name} ipprofile_2vm-ns |
| 37 | |
| 38 | # NS instance name and configuration |
| 39 | ${ns_name} basic_19 |
| 40 | ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| 41 | |
| garciadeblas | 61bbf92 | 2022-06-25 18:12:53 +0200 | [diff] [blame] | 42 | # SSH keys and username to be used |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 43 | ${publickey} %{HOME}/.ssh/id_rsa.pub |
| 44 | ${username} ubuntu |
| 45 | |
| 46 | # VNFs data |
| aguilard | f257829 | 2022-03-29 15:26:43 +0000 | [diff] [blame] | 47 | ${vnf_member_index_1} vnf |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 48 | ${internal_prefix} ^192.168.200.* |
| 49 | |
| 50 | ${success_return_code} 0 |
| 51 | |
| 52 | |
| 53 | *** Test Cases *** |
| 54 | Create VNF Descriptor |
| 55 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 56 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 57 | |
| 58 | |
| 59 | Create NS Descriptor |
| 60 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 61 | Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 62 | |
| 63 | |
| 64 | Instantiate Network Service |
| 65 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 66 | ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} |
| 67 | Set Suite Variable ${ns_id} ${id} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 68 | |
| 69 | |
| 70 | Get Vnf Info |
| 71 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 72 | Variable Should Exist ${ns_id} msg=Network service instance is not available |
| 73 | @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 74 | Log List ${vnfr_list} |
| 75 | Set Suite Variable ${vnf_id} ${vnfr_list}[0] |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 76 | ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} |
| 77 | Set Suite Variable ${vnf_ipmgmt} ${ip} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 78 | Log ${vnf_ipmgmt} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 79 | |
| 80 | |
| 81 | Check Vnf IPs |
| 82 | |
| garciadeblas | 61bbf92 | 2022-06-25 18:12:53 +0200 | [diff] [blame] | 83 | Variable Should Exist ${vnf_id} msg=VNF is not available |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame] | 84 | ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[0].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 85 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False |
| 86 | Should Match Regexp ${stdout} ${internal_prefix} msg=${stdout} doesn't match subnet's regexp ${internal_prefix} |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame] | 87 | ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[1].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 88 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False |
| 89 | Should Match Regexp ${stdout} ${internal_prefix} msg=${stdout} doesn't match subnet's regexp ${internal_prefix} |
| garciadeblas | 61bbf92 | 2022-06-25 18:12:53 +0200 | [diff] [blame] | 90 | |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 91 | |
| 92 | Delete NS Instance |
| 93 | [Tags] cleanup |
| 94 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 95 | Delete NS ${ns_name} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 96 | |
| 97 | |
| 98 | Delete NS Descriptor |
| 99 | [Tags] cleanup |
| 100 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 101 | Delete NSD ${nsd_name} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 102 | |
| 103 | |
| 104 | Delete VNF Descriptor |
| 105 | [Tags] cleanup |
| 106 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 107 | Delete VNFD ${vnfd_name} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 108 | |
| 109 | |
| 110 | *** Keywords *** |
| 111 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 112 | [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 113 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 114 | Run Keyword If Any Tests Failed Delete NS ${ns_name} |
| 115 | Run Keyword If Any Tests Failed Delete NSD ${nsd_name} |
| 116 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} |