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
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 Documentation [BASIC-26] Secure connection to helm execution environments.
18 Library OperatingSystem
21 Resource ../lib/vnfd_lib.resource
22 Resource ../lib/nsd_lib.resource
23 Resource ../lib/ns_lib.resource
24 Resource ../lib/ssh_lib.resource
26 Test Tags basic_26 cluster_ee_config regression
28 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
32 # NS and VNF descriptor package folder and ids
33 ${VNFD_PKG} simple_ee_vnf
34 ${VNFD_NAME} simple_ee-vnf
35 ${NSD_PKG} simple_ee_ns
36 ${NSD_NAME} simple_ee-ns
38 # NS instance name and configuration
39 ${NS_NAME} basic_26_secure_helm_ee_test
40 ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
43 # SSH keys and username to be used to connect to the VNF
46 ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
47 ${PRIVATEKEY} %{HOME}/.ssh/id_rsa
49 # SSH keys and username to be used to connect to OSM VM
50 ${OSM_HOST} %{OSM_HOSTNAME}
51 ${OSM_USERNAME} ubuntu
52 ${OSM_PASSWORD} ${EMPTY}
53 ${OSM_PRIVATEKEY} %{OSM_RSA_FILE}
55 # Variables related to day1 and day2
57 ${NEW_ACTION_NAME} mkdir
58 ${VNF_MEMBER_INDEX} simple
59 ${DAY_1_FILE_NAME} /home/ubuntu/first-touch
64 [Documentation] Upload VNF package for the testsuite.
65 ${id}= Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
66 Set Suite Variable ${VNFD_ID} ${id}
69 [Documentation] Upload NS package for the testsuite.
70 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
72 Instantiate Network Service
73 [Documentation] Instantiate NS for the testsuite.
74 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT}
75 Set Suite Variable ${NS_ID} ${id}
77 Get Management Ip Address
78 [Documentation] Get the mgmt IP address of the VNF of the NS.
79 ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX}
81 Set Suite Variable ${VNF_IP_ADDR} ${ip_addr}
84 [Documentation] Check that the VNF is accessible via SSH in its mgmt IP address.
85 Variable Should Exist ${VNF_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX}' is not available
86 Sleep 30s Waiting ssh daemon to be up
87 Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY}
89 Check Remote File Created Via Day 1 Operation
90 [Documentation] Check whether the file created in the previous test via Day 1 operations exist or not.
91 Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME}
94 [Documentation] Retrieve pod name and service IP address of the helm-based EE running in OSM cluster and store as suite variables to be used later on.
95 Open Connection ${OSM_HOST}
96 Login With Public Key ${OSM_USERNAME} keyfile=${OSM_PRIVATEKEY}
97 ${pod}= Execute Remote Command Check Rc Return Output ${OSM_HOST} ${OSM_USERNAME} ${OSM_PASSWORD} ${OSM_PRIVATEKEY} kubectl get pod -n ${NS_ID} --no-headers -o custom-columns=":metadata.name"
98 ${svc}= Execute Remote Command Check Rc Return Output ${OSM_HOST} ${OSM_USERNAME} ${OSM_PASSWORD} ${OSM_PRIVATEKEY} kubectl get svc -n ${NS_ID} -l app.kubernetes.io/name=eechart -o jsonpath='{.items[0].spec.clusterIP}'
99 Set Suite Variable ${POD_NAME} ${pod}
100 Set Suite Variable ${SVC_IP} ${svc}
102 Fail when trying to access gRPC server without TLS
103 [Documentation] Assert failure when accessing the EE without TLS.
104 ${command}= Catenate python3 osm_ee/frontend_client.py ${SVC_IP} 50050 sleep
105 ${result}= Execute Remote Command Check Rc Return Output ${OSM_HOST} ${OSM_USERNAME} ${OSM_PASSWORD} ${OSM_PRIVATEKEY} kubectl exec -it -n ${NS_ID} ${POD_NAME} -- ${command}
106 Should Contain ${result} Connection lost
109 [Documentation] Delete NS instance.
114 [Documentation] Delete NS package from OSM.
116 Delete NSD ${NSD_NAME}
118 Delete VNF Descriptor
119 [Documentation] Delete VNF package from OSM.
121 Delete VNFD ${VNFD_NAME}
126 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
127 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
128 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
129 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}