| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 1 | *** Comments *** |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 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 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 14 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 15 | *** Settings *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 16 | Documentation [BASIC-07] Secure key management. |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 17 | |
| 18 | Library OperatingSystem |
| 19 | Library SSHLibrary |
| 20 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 21 | Resource ../lib/vnfd_lib.resource |
| 22 | Resource ../lib/nsd_lib.resource |
| 23 | Resource ../lib/ns_lib.resource |
| 24 | Resource ../lib/ns_operation_lib.resource |
| 25 | Resource ../lib/ssh_lib.resource |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 26 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 27 | Test Tags basic_07 cluster_ee_config regression azure |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 28 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 29 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 30 | |
| 31 | |
| 32 | *** Variables *** |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 33 | # NS and VNF descriptor package folder and ids |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 34 | ${VNFD_PKG} charm-packages/nopasswd_proxy_charm_vnf |
| 35 | ${VNFD_NAME} nopasswd_proxy_charm-vnf |
| 36 | ${NSD_PKG} charm-packages/nopasswd_proxy_charm_ns |
| 37 | ${NSD_NAME} nopasswd_proxy_charm-ns |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 38 | |
| 39 | # NS instance name and configuration |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 40 | ${NS_NAME} basic_07_secure_key_management |
| 41 | ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| 42 | ${NS_TIMEOUT} 15min |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 43 | |
| 44 | # SSH username and passwod |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 45 | ${USERNAME} ubuntu |
| 46 | ${PASSWORD} osm4u |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 47 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 48 | ${ACTION_NAME} touch |
| 49 | ${VNF_MEMBER_INDEX} vnf1 |
| 50 | ${DAY_1_FILE_NAME} /home/ubuntu/first-touch |
| 51 | ${DAY_2_FILE_NAME} /home/ubuntu/mytouch1 |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 52 | |
| 53 | |
| 54 | *** Test Cases *** |
| 55 | Create Nopasswd Charm VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 56 | [Documentation] Upload VNF package for the testsuite. |
| rodriguezgar | fbedfe0 | 2022-02-24 20:05:42 +0100 | [diff] [blame] | 57 | [Tags] prepare |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 58 | Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 59 | |
| 60 | Create Nopasswd Charm NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 61 | [Documentation] Upload NS package for the testsuite. |
| rodriguezgar | fbedfe0 | 2022-02-24 20:05:42 +0100 | [diff] [blame] | 62 | [Tags] prepare |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 63 | Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 64 | |
| 65 | Instantiate Nopasswd Charm Network Service |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 66 | [Documentation] Instantiate NS for the testsuite. |
| rodriguezgar | fbedfe0 | 2022-02-24 20:05:42 +0100 | [diff] [blame] | 67 | [Tags] prepare |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 68 | ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${EMPTY} ${NS_TIMEOUT} |
| 69 | Log ${id} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 70 | |
| rodriguezgar | fbedfe0 | 2022-02-24 20:05:42 +0100 | [diff] [blame] | 71 | Get Ns Id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 72 | [Documentation] Get NS instance id. |
| rodriguezgar | fbedfe0 | 2022-02-24 20:05:42 +0100 | [diff] [blame] | 73 | [Tags] verify |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 74 | ${id}= Get Ns Id ${NS_NAME} |
| 75 | Set Suite Variable ${NS_ID} ${id} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 76 | |
| 77 | Get Management Ip Addresses |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 78 | [Documentation] Get the mgmt IP address of the VNF of the NS. |
| rodriguezgar | fbedfe0 | 2022-02-24 20:05:42 +0100 | [diff] [blame] | 79 | [Tags] verify |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 80 | ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 81 | Log ${ip_addr} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 82 | Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 83 | |
| 84 | Test SSH Access |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 85 | [Documentation] Check that the VNF is accessible via SSH in its mgmt IP address. |
| rodriguezgar | fbedfe0 | 2022-02-24 20:05:42 +0100 | [diff] [blame] | 86 | [Tags] verify |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 87 | Variable Should Exist ${VNF_IP_ADDR} msg=IP address of the management VNF is not available |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 88 | Sleep 30s Waiting ssh daemon to be up |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 89 | Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 90 | |
| 91 | Check Remote Files Created Via Day 1 Operations |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 92 | [Documentation] The Nopasswd VNF has a Day 1 operation that creates a file named ${day_1_file_name} and performs it without password. |
| 93 | ... This test checks whether that files have been created or not. |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 94 | [Tags] verify |
| 95 | Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} ${DAY_1_FILE_NAME} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 96 | |
| 97 | Execute Day 2 Operations |
| garciadeblas | 23ff8f9 | 2023-12-11 16:26:40 +0100 | [diff] [blame] | 98 | [Documentation] Performs one Day 2 operation that creates a new file, this action is executed without password too. |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 99 | [Tags] verify |
| 100 | Variable Should Exist ${NS_ID} msg=Network service instance is not available |
| 101 | ${ns_op_id}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX} filename=${DAY_2_FILE_NAME} |
| 102 | Log ${ns_op_id} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 103 | |
| 104 | Check Remote Files Created Via Day 2 Operations |
| garciadeblas | 23ff8f9 | 2023-12-11 16:26:40 +0100 | [diff] [blame] | 105 | [Documentation] Check whether the file created in the previous test via Day 2 operation exists or not. |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 106 | [Tags] verify |
| 107 | Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} ${DAY_2_FILE_NAME} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 108 | |
| 109 | Delete NS Instance |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 110 | [Documentation] Delete NS instance. |
| garciadeblas | 8a4366f | 2021-04-15 15:27:40 +0200 | [diff] [blame] | 111 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 112 | Delete NS ${NS_NAME} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 113 | |
| 114 | Delete NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 115 | [Documentation] Delete NS package from OSM. |
| garciadeblas | 8a4366f | 2021-04-15 15:27:40 +0200 | [diff] [blame] | 116 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 117 | Delete NSD ${NSD_NAME} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 118 | |
| 119 | Delete VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 120 | [Documentation] Delete VNF package from OSM. |
| garciadeblas | 8a4366f | 2021-04-15 15:27:40 +0200 | [diff] [blame] | 121 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 122 | Delete VNFD ${VNFD_NAME} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 123 | |
| 124 | |
| 125 | *** Keywords *** |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 126 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 127 | [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 128 | Run Keyword If Any Tests Failed Delete NS ${NS_NAME} |
| 129 | Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} |
| 130 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} |