| 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 *** |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 16 | Documentation [K8s-01] Create K8s cluster. |
| 17 | |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 18 | Library OperatingSystem |
| 19 | Library String |
| 20 | Library Collections |
| 21 | Library Process |
| 22 | Library SSHLibrary |
| 23 | Library %{ROBOT_DEVOPS_FOLDER}/lib/renderTemplate.py |
| 24 | |
| 25 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot |
| 26 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot |
| 27 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot |
| 28 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot |
| 29 | |
| 30 | Variables %{ROBOT_DEVOPS_FOLDER}/resources/k8s_01-create_k8s_cluster_data.py |
| 31 | |
| garciadeblas | 8a4366f | 2021-04-15 15:27:40 +0200 | [diff] [blame^] | 32 | Force Tags k8s_01 cluster_k8s regression |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 33 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 34 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 35 | |
| 36 | |
| 37 | *** Variables *** |
| 38 | ${username} ubuntu |
| 39 | ${password} ${EMPTY} |
| 40 | |
| 41 | |
| 42 | *** Test Cases *** |
| 43 | Render a template |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 44 | |
| 45 | ${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} |
| 46 | Log To Console \n${stdout} |
| 47 | |
| 48 | Create Controller VNF Descriptor |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 49 | |
| 50 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg1}' |
| 51 | |
| 52 | Create Machines VNF Descriptor |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 53 | |
| 54 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg2}' |
| 55 | |
| 56 | Create K8s Cluster NS Descriptor |
| 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 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 61 | |
| 62 | ${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} |
| 63 | Set Suite Variable ${ns_id} ${id} |
| 64 | |
| 65 | Get Management Ip Addresses |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 66 | |
| 67 | ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} |
| 68 | log ${ip_addr_1} |
| 69 | Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1} |
| 70 | ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} |
| 71 | log ${ip_addr_2} |
| 72 | Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2} |
| 73 | ${ip_addr_3} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_3} |
| 74 | log ${ip_addr_3} |
| 75 | Set Suite Variable ${vnf_3_ip_addr} ${ip_addr_3} |
| 76 | ${ip_addr_4} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_4} |
| 77 | log ${ip_addr_4} |
| 78 | Set Suite Variable ${vnf_4_ip_addr} ${ip_addr_4} |
| 79 | ${ip_addr_5} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_5} |
| 80 | log ${ip_addr_5} |
| 81 | Set Suite Variable ${vnf_5_ip_addr} ${ip_addr_5} |
| 82 | |
| 83 | Test SSH Access |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 84 | |
| 85 | Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available |
| 86 | Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available |
| 87 | Variable Should Exist ${vnf_3_ip_addr} msg=IP address of the management VNF '${vnf_member_index_3}' is not available |
| 88 | Variable Should Exist ${vnf_4_ip_addr} msg=IP address of the management VNF '${vnf_member_index_4}' is not available |
| 89 | Variable Should Exist ${vnf_5_ip_addr} msg=IP address of the management VNF '${vnf_member_index_5}' is not available |
| 90 | Sleep 30s Waiting ssh daemon to be up |
| 91 | Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey} |
| 92 | Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey} |
| 93 | Test SSH Connection ${vnf_3_ip_addr} ${username} ${password} ${privatekey} |
| 94 | Test SSH Connection ${vnf_4_ip_addr} ${username} ${password} ${privatekey} |
| 95 | Test SSH Connection ${vnf_5_ip_addr} ${username} ${password} ${privatekey} |
| 96 | |
| 97 | Check kubeconfig file |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 98 | |
| 99 | Check If remote File Exists ${vnf_5_ip_addr} ${username} ${password} ${privatekey} ${kubeconfig_file} |
| 100 | |
| 101 | Delete NS Instance |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 102 | [Tags] cleanup |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 103 | |
| 104 | Delete NS ${ns_name} |
| 105 | |
| 106 | |
| 107 | Delete NS Descriptor |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 108 | [Tags] cleanup |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 109 | |
| 110 | Delete NSD ${nsd_name} |
| 111 | |
| 112 | |
| 113 | Delete Controller VNF Descriptor |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 114 | [Tags] cleanup |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 115 | |
| 116 | Delete VNFD ${vnfd_name1} |
| 117 | |
| 118 | Delete Machines VNF Descriptor |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 119 | [Tags] cleanup |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 120 | |
| 121 | Delete VNFD ${vnfd_name2} |
| 122 | |
| 123 | |
| 124 | *** Keywords *** |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 125 | Suite Cleanup |
| calvinosanc1 | 9b272c5 | 2020-07-03 17:28:12 +0200 | [diff] [blame] | 126 | [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance |
| 127 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [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} |