blob: 506e2a3016f3e7adab42ff3986ad811c8055b410 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
Felipe Vicensf96bb452020-06-22 08:12:30 +02002# 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
garciadeblas7a9e0312023-12-11 22:24:46 +010014
Felipe Vicensf96bb452020-06-22 08:12:30 +020015*** Settings ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020016Documentation [BASIC-07] Secure key management.
Felipe Vicensf96bb452020-06-22 08:12:30 +020017
18Library OperatingSystem
19Library SSHLibrary
20
garciadeblas7a9e0312023-12-11 22:24:46 +010021Resource ../lib/vnfd_lib.resource
22Resource ../lib/nsd_lib.resource
23Resource ../lib/ns_lib.resource
24Resource ../lib/ns_operation_lib.resource
25Resource ../lib/ssh_lib.resource
Felipe Vicensf96bb452020-06-22 08:12:30 +020026
garciadeblas7a9e0312023-12-11 22:24:46 +010027Test Tags basic_07 cluster_ee_config regression azure
garciadeblas4cf45d72021-04-08 13:52:22 +020028
garciadeblasd225e552020-10-02 16:10:14 +000029Suite Teardown Run Keyword And Ignore Error Suite Cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020030
31
32*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020033# NS and VNF descriptor package folder and ids
garciadeblas7a9e0312023-12-11 22:24:46 +010034${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
almagiab4697d32021-05-25 08:56:17 +020038
39# NS instance name and configuration
garciadeblas7a9e0312023-12-11 22:24:46 +010040${NS_NAME} basic_07_secure_key_management
41${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
42${NS_TIMEOUT} 15min
almagiab4697d32021-05-25 08:56:17 +020043
44# SSH username and passwod
garciadeblas7a9e0312023-12-11 22:24:46 +010045${USERNAME} ubuntu
46${PASSWORD} osm4u
almagiab4697d32021-05-25 08:56:17 +020047
garciadeblas7a9e0312023-12-11 22:24:46 +010048${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 Vicensf96bb452020-06-22 08:12:30 +020052
53
54*** Test Cases ***
55Create Nopasswd Charm VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010056 [Documentation] Upload VNF package for the testsuite.
rodriguezgarfbedfe02022-02-24 20:05:42 +010057 [Tags] prepare
garciadeblas7a9e0312023-12-11 22:24:46 +010058 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020059
60Create Nopasswd Charm NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010061 [Documentation] Upload NS package for the testsuite.
rodriguezgarfbedfe02022-02-24 20:05:42 +010062 [Tags] prepare
garciadeblas7a9e0312023-12-11 22:24:46 +010063 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020064
65Instantiate Nopasswd Charm Network Service
garciadeblas7a9e0312023-12-11 22:24:46 +010066 [Documentation] Instantiate NS for the testsuite.
rodriguezgarfbedfe02022-02-24 20:05:42 +010067 [Tags] prepare
garciadeblas7a9e0312023-12-11 22:24:46 +010068 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${EMPTY} ${NS_TIMEOUT}
69 Log ${id}
Felipe Vicensf96bb452020-06-22 08:12:30 +020070
rodriguezgarfbedfe02022-02-24 20:05:42 +010071Get Ns Id
garciadeblas7a9e0312023-12-11 22:24:46 +010072 [Documentation] Get NS instance id.
rodriguezgarfbedfe02022-02-24 20:05:42 +010073 [Tags] verify
garciadeblas7a9e0312023-12-11 22:24:46 +010074 ${id}= Get Ns Id ${NS_NAME}
75 Set Suite Variable ${NS_ID} ${id}
Felipe Vicensf96bb452020-06-22 08:12:30 +020076
77Get Management Ip Addresses
garciadeblas7a9e0312023-12-11 22:24:46 +010078 [Documentation] Get the mgmt IP address of the VNF of the NS.
rodriguezgarfbedfe02022-02-24 20:05:42 +010079 [Tags] verify
garciadeblas7a9e0312023-12-11 22:24:46 +010080 ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX}
garciadeblas321726f2022-12-21 11:43:06 +010081 Log ${ip_addr}
garciadeblas7a9e0312023-12-11 22:24:46 +010082 Set Suite Variable ${VNF_IP_ADDR} ${ip_addr}
Felipe Vicensf96bb452020-06-22 08:12:30 +020083
84Test SSH Access
garciadeblas7a9e0312023-12-11 22:24:46 +010085 [Documentation] Check that the VNF is accessible via SSH in its mgmt IP address.
rodriguezgarfbedfe02022-02-24 20:05:42 +010086 [Tags] verify
garciadeblas7a9e0312023-12-11 22:24:46 +010087 Variable Should Exist ${VNF_IP_ADDR} msg=IP address of the management VNF is not available
garciadeblasf4ebaa82022-06-23 13:33:26 +020088 Sleep 30s Waiting ssh daemon to be up
garciadeblas7a9e0312023-12-11 22:24:46 +010089 Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY}
Felipe Vicensf96bb452020-06-22 08:12:30 +020090
91Check Remote Files Created Via Day 1 Operations
garciadeblasf4ebaa82022-06-23 13:33:26 +020092 [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.
garciadeblas7a9e0312023-12-11 22:24:46 +010094 [Tags] verify
95 Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} ${DAY_1_FILE_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +020096
97Execute Day 2 Operations
garciadeblas23ff8f92023-12-11 16:26:40 +010098 [Documentation] Performs one Day 2 operation that creates a new file, this action is executed without password too.
garciadeblas7a9e0312023-12-11 22:24:46 +010099 [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 Vicensf96bb452020-06-22 08:12:30 +0200103
104Check Remote Files Created Via Day 2 Operations
garciadeblas23ff8f92023-12-11 16:26:40 +0100105 [Documentation] Check whether the file created in the previous test via Day 2 operation exists or not.
garciadeblas7a9e0312023-12-11 22:24:46 +0100106 [Tags] verify
107 Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} ${DAY_2_FILE_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200108
109Delete NS Instance
garciadeblas7a9e0312023-12-11 22:24:46 +0100110 [Documentation] Delete NS instance.
garciadeblas8a4366f2021-04-15 15:27:40 +0200111 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100112 Delete NS ${NS_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200113
114Delete NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +0100115 [Documentation] Delete NS package from OSM.
garciadeblas8a4366f2021-04-15 15:27:40 +0200116 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100117 Delete NSD ${NSD_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200118
119Delete VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +0100120 [Documentation] Delete VNF package from OSM.
garciadeblas8a4366f2021-04-15 15:27:40 +0200121 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100122 Delete VNFD ${VNFD_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200123
124
125*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000126Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200127 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
garciadeblas7a9e0312023-12-11 22:24:46 +0100128 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}