2 # Copyright 2020 Canonical Ltd.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 Documentation [K8s-02] K8s cluster addition.
20 Library OperatingSystem
25 Resource ../lib/k8scluster_lib.resource
26 Resource ../lib/vim_lib.resource
28 Variables ../resources/basic_01-crud_operations_on_vim_targets_data.py
30 Test Tags k8s_02 cluster_k8s daily regression azure
32 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
36 # K8s cluster name and version
37 ${K8SCLUSTER_NAME} k8s02
38 ${K8SCLUSTER_VERSION} v1
42 Create VIM Target Basic
43 [Documentation] Creates a VIM for the K8s cluster to be anchored against
44 ${rand}= Generate Random String 6 [NUMBERS]
45 ${VIM_NAME}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand}
46 Set Suite Variable ${VIM_NAME}
47 ${CREATED_VIM_ACCOUNT_ID}= Create VIM Target ${VIM_NAME} ${VIM_USER} ${VIM_PASSWORD} ${VIM_AUTH_URL} ${VIM_TENANT} ${VIM_ACCOUNT_TYPE}
48 Set Suite Variable ${CREATED_VIM_ACCOUNT_ID}
50 Add K8s Cluster To OSM
51 [Documentation] Creates a VIM for the K8s cluster to be anchored against
52 Create K8s Cluster %{K8S_CREDENTIALS} ${K8SCLUSTER_VERSION} ${VIM_NAME} %{VIM_MGMT_NET} ${K8SCLUSTER_NAME}
53 Check For K8s Cluster To Be Ready ${K8SCLUSTER_NAME}
55 Remove K8s Cluster from OSM
56 [Documentation] Delete K8s cluster.
58 Delete K8s Cluster ${K8SCLUSTER_NAME}
60 Delete VIM Target By ID
61 [Documentation] Delete the VIM Target created in previous test-case by its ID.
62 ... Checks whether the VIM Target was created or not before perform the deletion.
65 ${vim_account_id}= Get VIM Target ID ${VIM_NAME}
66 Should Be Equal As Strings ${vim_account_id} ${CREATED_VIM_ACCOUNT_ID}
67 Delete VIM Target ${vim_account_id}
72 [Documentation] Test Suit Cleanup: Deleting K8s Cluster
74 Run Keyword If Any Tests Failed Delete K8s Cluster ${K8SCLUSTER_NAME}