| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 1 | # Copyright 2020 Canonical Ltd. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | *** Settings *** |
| 16 | Library OperatingSystem |
| 17 | Library String |
| 18 | Library Collections |
| 19 | Library Process |
| 20 | Library SSHLibrary |
| 21 | Library %{ROBOT_DEVOPS_FOLDER}/lib/renderTemplate.py |
| 22 | |
| 23 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot |
| 24 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot |
| 25 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot |
| 26 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot |
| 27 | |
| 28 | Variables %{ROBOT_DEVOPS_FOLDER}/resources/k8s_01-create_k8s_cluster_data.py |
| 29 | |
| 30 | Suite Teardown Run Keyword And Ignore Error Test Cleanup |
| 31 | |
| 32 | |
| 33 | *** Variables *** |
| 34 | ${username} ubuntu |
| 35 | ${password} ${EMPTY} |
| 36 | |
| 37 | |
| 38 | *** Test Cases *** |
| 39 | Render a template |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 40 | [Tags] newK8sCluster regression |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 41 | |
| 42 | ${stdout}= Render template %{ROBOT_DEVOPS_FOLDER}/resources/${template} %{ROBOT_DEVOPS_FOLDER}/resources/${config_file} IP_VM1=%{IP_VM1} IP_VM2=%{IP_VM2} IP_VM3=%{IP_VM3} IP_VM4=%{IP_VM4} IP_JUJU=%{IP_JUJU} NETWORK=%{VIM_MGMT_NET} |
| 43 | Log To Console \n${stdout} |
| 44 | |
| 45 | Create Controller VNF Descriptor |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 46 | [Tags] newK8sCluster regression |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 47 | |
| 48 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg1}' |
| 49 | |
| 50 | Create Machines VNF Descriptor |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 51 | [Tags] newK8sCluster regression |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 52 | |
| 53 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg2}' |
| 54 | |
| 55 | Create K8s Cluster NS Descriptor |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 56 | [Tags] newK8sCluster regression |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 57 | |
| 58 | Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' |
| 59 | |
| 60 | Instantiate K8s Cluster Network Service |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 61 | [Tags] newK8sCluster regression |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 62 | |
| 63 | ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ns_config=${EMPTY} publickey=${publickey} ns_launch_max_wait_time=70min config_file=%{ROBOT_DEVOPS_FOLDER}/resources/${config_file} |
| 64 | Set Suite Variable ${ns_id} ${id} |
| 65 | |
| 66 | Get Management Ip Addresses |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 67 | [Tags] newK8sCluster regression |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 68 | |
| 69 | ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} |
| 70 | log ${ip_addr_1} |
| 71 | Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1} |
| 72 | ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} |
| 73 | log ${ip_addr_2} |
| 74 | Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2} |
| 75 | ${ip_addr_3} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_3} |
| 76 | log ${ip_addr_3} |
| 77 | Set Suite Variable ${vnf_3_ip_addr} ${ip_addr_3} |
| 78 | ${ip_addr_4} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_4} |
| 79 | log ${ip_addr_4} |
| 80 | Set Suite Variable ${vnf_4_ip_addr} ${ip_addr_4} |
| 81 | ${ip_addr_5} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_5} |
| 82 | log ${ip_addr_5} |
| 83 | Set Suite Variable ${vnf_5_ip_addr} ${ip_addr_5} |
| 84 | |
| 85 | Test SSH Access |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 86 | [Tags] newK8sCluster regression |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 87 | |
| 88 | Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available |
| 89 | Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available |
| 90 | Variable Should Exist ${vnf_3_ip_addr} msg=IP address of the management VNF '${vnf_member_index_3}' is not available |
| 91 | Variable Should Exist ${vnf_4_ip_addr} msg=IP address of the management VNF '${vnf_member_index_4}' is not available |
| 92 | Variable Should Exist ${vnf_5_ip_addr} msg=IP address of the management VNF '${vnf_member_index_5}' is not available |
| 93 | Sleep 30s Waiting ssh daemon to be up |
| 94 | Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey} |
| 95 | Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey} |
| 96 | Test SSH Connection ${vnf_3_ip_addr} ${username} ${password} ${privatekey} |
| 97 | Test SSH Connection ${vnf_4_ip_addr} ${username} ${password} ${privatekey} |
| 98 | Test SSH Connection ${vnf_5_ip_addr} ${username} ${password} ${privatekey} |
| 99 | |
| 100 | Check kubeconfig file |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 101 | [Tags] newK8sCluster regression |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 102 | |
| 103 | Check If remote File Exists ${vnf_5_ip_addr} ${username} ${password} ${privatekey} ${kubeconfig_file} |
| 104 | |
| 105 | Delete NS Instance |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 106 | [Tags] newK8sCluster regression cleanup |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 107 | |
| 108 | Delete NS ${ns_name} |
| 109 | |
| 110 | |
| 111 | Delete NS Descriptor |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 112 | [Tags] newK8sCluster regression cleanup |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 113 | |
| 114 | Delete NSD ${nsd_name} |
| 115 | |
| 116 | |
| 117 | Delete Controller VNF Descriptor |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 118 | [Tags] newK8sCluster regression cleanup |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 119 | |
| 120 | Delete VNFD ${vnfd_name1} |
| 121 | |
| 122 | Delete Machines VNF Descriptor |
| calvinosanc1 | 06147e9 | 2020-07-17 18:36:35 +0200 | [diff] [blame] | 123 | [Tags] newK8sCluster regression cleanup |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 124 | |
| 125 | Delete VNFD ${vnfd_name2} |
| 126 | |
| 127 | |
| 128 | *** Keywords *** |
| 129 | Test Cleanup |
| 130 | [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance |
| 131 | |
| 132 | Run Keyword If Test Failed Delete NS ${ns_name} |
| 133 | |
| 134 | Run Keyword If Test Failed Delete NSD ${nsd_name} |
| 135 | |
| 136 | Run Keyword If Test Failed Delete VNFD ${vnfd_name} |