| Felipe Vicens | 5c54d27 | 2020-06-23 15:55:08 +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 | *** Variables *** |
| 16 | ${success_return_code} 0 |
| garciadeblas | 2f132f6 | 2020-09-22 16:37:39 +0200 | [diff] [blame] | 17 | ${k8scluster_launch_max_wait_time} 6min |
| Felipe Vicens | 5c54d27 | 2020-06-23 15:55:08 +0200 | [diff] [blame] | 18 | ${k8scluster_launch_pol_time} 30sec |
| 19 | ${k8scluster_delete_max_wait_time} 2min |
| 20 | ${k8scluster_delete_pol_time} 15sec |
| 21 | |
| 22 | *** Keywords *** |
| 23 | Create K8s Cluster |
| 24 | [Arguments] ${k8scluster_creds} ${k8scluster_version} ${k8scluster_vim} ${k8scluster_net} ${k8scluster_name} |
| 25 | ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-add --creds ${k8scluster_creds} --version ${k8scluster_version} --vim ${k8scluster_vim} --k8s-nets '{"net1": "${k8scluster_net}"}' ${k8scluster_name} --description "Robot cluster" |
| 26 | log ${stdout} |
| 27 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 28 | WAIT UNTIL KEYWORD SUCCEEDS ${k8scluster_launch_max_wait_time} ${k8scluster_launch_pol_time} Check For K8s Cluster To Be Ready ${k8scluster_name} |
| garciadeblas | 2f132f6 | 2020-09-22 16:37:39 +0200 | [diff] [blame] | 29 | Check For K8s Cluster To Be Enabled ${k8scluster_name} |
| Felipe Vicens | 5c54d27 | 2020-06-23 15:55:08 +0200 | [diff] [blame] | 30 | [Return] ${stdout} |
| 31 | |
| 32 | Delete K8s Cluster |
| 33 | [Arguments] ${k8scluster_name} |
| 34 | ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-delete ${k8scluster_name} |
| 35 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 36 | WAIT UNTIL KEYWORD SUCCEEDS ${k8scluster_delete_max_wait_time} ${k8scluster_delete_pol_time} Check For K8s Cluster To Be Deleted ${k8scluster_name} |
| 37 | |
| 38 | Get K8s Cluster |
| 39 | ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list |
| 40 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 41 | log ${stdout} |
| 42 | [Return] ${stdout} |
| 43 | |
| 44 | Check for K8s Cluster |
| 45 | [Arguments] ${k8scluster_name} |
| 46 | ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" |
| 47 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 48 | [Return] ${stdout} |
| 49 | |
| 50 | Check For K8s Cluster To Be Deleted |
| 51 | [Arguments] ${k8scluster_name} |
| 52 | ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" | awk '{print $2}' | grep ${k8scluster_name} |
| 53 | Should Be Empty ${stdout} |
| 54 | |
| 55 | Check For K8s Cluster To Be Ready |
| 56 | [Arguments] ${k8scluster_name} |
| garciadeblas | c8b46fa | 2020-10-01 16:26:20 +0000 | [diff] [blame] | 57 | ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" --filter _admin.operationalState="ENABLED,DEGRADED" |
| 58 | log ${stdout} |
| 59 | ${rc} ${stdout}= Run and Return RC and Output echo "${stdout}" | awk '{print $2}' | grep ${k8scluster_name} |
| garciadeblas | 2f132f6 | 2020-09-22 16:37:39 +0200 | [diff] [blame] | 60 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 61 | Should Be Equal As Strings ${stdout} ${k8scluster_name} |
| 62 | |
| 63 | Check For K8s Cluster To Be Enabled |
| 64 | [Arguments] ${k8scluster_name} |
| garciadeblas | 661ba4f | 2020-11-19 15:19:48 +0000 | [diff] [blame] | 65 | ${rc2} ${stdout2}= Run and Return RC and Output osm k8scluster-show ${k8scluster_name} |
| 66 | log ${stdout2} |
| garciadeblas | c8b46fa | 2020-10-01 16:26:20 +0000 | [diff] [blame] | 67 | ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" --filter _admin.operationalState="ENABLED" |
| 68 | log ${stdout} |
| 69 | ${rc} ${stdout}= Run and Return RC and Output echo "${stdout}" | awk '{print $2}' | grep ${k8scluster_name} |
| Felipe Vicens | 5c54d27 | 2020-06-23 15:55:08 +0200 | [diff] [blame] | 70 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 71 | Should Be Equal As Strings ${stdout} ${k8scluster_name} |