blob: 429abda6438d4d580168d21559e9c0356d6e0e22 [file] [log] [blame]
Felipe Vicens5c54d272020-06-23 15:55:08 +02001# 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
garciadeblas2f132f62020-09-22 16:37:39 +020017${k8scluster_launch_max_wait_time} 6min
Felipe Vicens5c54d272020-06-23 15:55:08 +020018${k8scluster_launch_pol_time} 30sec
19${k8scluster_delete_max_wait_time} 2min
20${k8scluster_delete_pol_time} 15sec
21
22*** Keywords ***
23Create 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}
garciadeblas2f132f62020-09-22 16:37:39 +020029 Check For K8s Cluster To Be Enabled ${k8scluster_name}
Felipe Vicens5c54d272020-06-23 15:55:08 +020030 [Return] ${stdout}
31
32Delete 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
38Get 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
44Check 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
50Check 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
55Check For K8s Cluster To Be Ready
56 [Arguments] ${k8scluster_name}
garciadeblasc8b46fa2020-10-01 16:26:20 +000057 ${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}
garciadeblas2f132f62020-09-22 16:37:39 +020060 Should Be Equal As Integers ${rc} ${success_return_code}
61 Should Be Equal As Strings ${stdout} ${k8scluster_name}
62
63Check For K8s Cluster To Be Enabled
64 [Arguments] ${k8scluster_name}
garciadeblas661ba4f2020-11-19 15:19:48 +000065 ${rc2} ${stdout2}= Run and Return RC and Output osm k8scluster-show ${k8scluster_name}
66 log ${stdout2}
garciadeblasc8b46fa2020-10-01 16:26:20 +000067 ${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 Vicens5c54d272020-06-23 15:55:08 +020070 Should Be Equal As Integers ${rc} ${success_return_code}
71 Should Be Equal As Strings ${stdout} ${k8scluster_name}