Update README.md with instructions to run tests using testing-daily images
[osm/tests.git] / robot-systest / testsuite / basic_26-secure_helm_execution_environment.robot
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-26] Secure connection to helm execution environments.
15
16 Library   OperatingSystem
17 Library   SSHLibrary
18
19 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
20 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
21 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
22 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
23
24 Force Tags   basic_26   cluster_ee_config   daily   regression
25
26 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
27
28
29 *** Variables ***
30 # NS and VNF descriptor package folder and ids
31 ${vnfd_pkg}   simple_ee_vnf
32 ${vnfd_name}   simple_ee-vnf
33 ${nsd_pkg}   simple_ee_ns
34 ${nsd_name}   simple_ee-ns
35
36 # NS instance name and configuration
37 ${ns_name}   basic_26_secure_helm_ee_test
38 ${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
39
40 # SSH keys and username to be used
41 ${publickey}   %{HOME}/.ssh/id_rsa.pub
42 ${privatekey}   %{OSM_RSA_FILE}
43 ${username}   ubuntu
44 ${password}   ${EMPTY}
45
46 ${action_name}   touch
47 ${new_action_name}   mkdir
48 ${vnf_member_index}   simple
49 ${day_1_file_name}   /home/ubuntu/first-touch
50 ${ns_timeout}   15min
51
52 ${host}   %{OSM_HOSTNAME}
53 ${username}   ubuntu
54
55 *** Test Cases ***
56 Create VNF Descriptor
57
58     ${id}=   Create VNFD   '%{PACKAGES_FOLDER}/${vnfd_pkg}'
59     Set Suite Variable   ${vnfd_id}   ${id}
60
61
62 Create NS Descriptor
63
64     Create NSD   '%{PACKAGES_FOLDER}/${nsd_pkg}'
65
66
67 Instantiate Network Service
68
69     ${id}=   Create Network Service   ${nsd_name}   %{VIM_TARGET}   ${ns_name}   ${ns_config}   ${publickey}   ${ns_timeout}
70     Set Suite Variable   ${ns_id}   ${id}
71
72
73 Get Management Ip Address
74
75     ${ip_addr}   Get Vnf Management Ip Address   ${ns_id}   ${vnf_member_index}
76     Log   ${ip_addr}
77     Set Suite Variable   ${vnf_ip_addr}   ${ip_addr}
78
79
80 Test SSH Access
81
82     Variable Should Exist   ${vnf_ip_addr}   msg=IP address of the management VNF '${vnf_member_index}' is not available
83     Sleep   30s   Waiting ssh daemon to be up
84     Test SSH Connection   ${vnf_ip_addr}   ${username}   ${password}   ${privatekey}
85
86
87 Check Remote File Created Via Day 1 Operation
88     [Documentation]   Check whether the file created in the previous test via Day 1 operations exist or not.
89
90     Check If remote File Exists   ${vnf_ip_addr}   ${username}   ${password}   ${privatekey}   ${day_1_file_name}
91
92
93 Get data from EE pod
94
95     Open Connection   ${host}
96     Login With Public Key   ${username}   keyfile=${privatekey}
97     ${pod}=   Execute Remote Command Check Rc Return Output   ${host}   ${username}   ${password}   ${privatekey}   kubectl get pod -n ${ns_id} --no-headers -o custom-columns=":metadata.name"
98     ${svc}=   Execute Remote Command Check Rc Return Output   ${host}   ${username}   ${password}   ${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}
101
102
103 Fail when trying to access gRPC server without TLS
104
105     ${command} =   Catenate   python3 osm_ee/frontend_client.py ${svc_ip} 50050 sleep
106     ${result}=   Execute Remote Command Check Rc Return Output   ${host}   ${username}   ${password}   ${privatekey}   kubectl exec -it -n ${ns_id} ${pod_name} -- ${command}
107     Should Contain   ${result}   Connection lost
108
109
110 Delete NS Instance
111     [Tags]   cleanup
112
113     Delete NS   ${ns_name}
114
115
116 Delete NS Descriptor
117     [Tags]   cleanup
118
119     Delete NSD   ${nsd_name}
120
121
122 Delete VNF Descriptor
123     [Tags]   cleanup
124
125     Delete VNFD   ${vnfd_name}
126
127
128 *** Keywords ***
129 Suite Cleanup
130     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
131
132     Run Keyword If Any Tests Failed   Delete NS   ${ns_name}
133
134     Run Keyword If Any Tests Failed   Delete NSD   ${nsd_name}
135
136     Run Keyword If Any Tests Failed   Delete VNFD   ${vnfd_name}
137