blob: 366e55241bf8cfbed7d352bd7eb68b309646082e [file] [log] [blame]
calvinosanc179fcc852020-07-29 12:11:41 +02001# Copyright 2020 Canonical Ltd.
2#
Felipe Vicensf96bb452020-06-22 08:12:30 +02003# 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 ***
garciadeblas4cf45d72021-04-08 13:52:22 +020016Documentation [K8s-03] Simple K8s.
17
Felipe Vicensf96bb452020-06-22 08:12:30 +020018Library OperatingSystem
19Library String
20Library Collections
21Library Process
22
23Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
24Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
25Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +020026Resource %{ROBOT_DEVOPS_FOLDER}/lib/package_lib.robot
Felipe Vicensf96bb452020-06-22 08:12:30 +020027Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
28Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
29Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot
30
garciadeblas4cf45d72021-04-08 13:52:22 +020031Force Tags k8s_03 cluster_k8s daily regression sanity
32
garciadeblasd225e552020-10-02 16:10:14 +000033Suite Teardown Run Keyword And Ignore Error Suite Cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020034
35
36*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020037# K8s cluster name and version
aguilardd6a44ef2021-09-14 17:46:17 +020038${k8scluster_name} k8s03
almagiab4697d32021-05-25 08:56:17 +020039${k8scluster_version} v1
40
41# NS and VNF descriptor package folder and ids
42${vnfd_pkg} charm-packages/native_k8s_charm_vnf
43${vnfd_name} native_k8s_charm-vnf
44${nsd_pkg} charm-packages/native_k8s_charm_ns
45${nsd_name} native_k8s_charm-ns
46
47# NS instance name and configuration
48${ns_name} native-k8s
aguilarhernac0b3a8e2021-05-12 08:56:23 +000049${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
almagiab4697d32021-05-25 08:56:17 +020050
51${ns_id} ${EMPTY}
Felipe Vicensf96bb452020-06-22 08:12:30 +020052${publickey} ${EMPTY}
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +020053${vnf_member_index} native_k8s_charm-vnf
54${action_name} changecontent
55${kdu_name} native-kdu
56${application_name} nginx
57${customtitle} Day 2 Action
Felipe Vicensf96bb452020-06-22 08:12:30 +020058
59*** Test Cases ***
60Create Simple K8s VNF Descriptor
garciadeblas58d8de12021-03-23 10:39:44 +010061 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020062
63Create Simple K8s Descriptor
garciadeblas58d8de12021-03-23 10:39:44 +010064 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020065
66Add K8s Cluster To OSM
Felipe Vicensf96bb452020-06-22 08:12:30 +020067 Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name}
68
69Network Service K8s Instance Test
Felipe Vicensf96bb452020-06-22 08:12:30 +020070 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
71 Set Suite Variable ${ns_id} ${id}
72
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +020073Execute Day 2 Operations
74 [Documentation] Performs one Day 2 operation per VNF that creates a new file.
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +020075
76 Variable Should Exist ${ns_id} msg=Network service instance is not available
77 ${ns_op_id}= Execute NS K8s Action ${ns_name} ${action_name} ${vnf_member_index} ${kdu_name} application-name=${application_name} customtitle=${customtitle}
78
Felipe Vicensf96bb452020-06-22 08:12:30 +020079Delete NS K8s Instance Test
garciadeblas4cf45d72021-04-08 13:52:22 +020080 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020081 Delete NS ${ns_name}
82
83Remove K8s Cluster from OSM
garciadeblas4cf45d72021-04-08 13:52:22 +020084 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020085 Delete K8s Cluster ${k8scluster_name}
86
87Delete NS Descriptor Test
garciadeblas4cf45d72021-04-08 13:52:22 +020088 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020089 Delete NSD ${nsd_name}
90
91Delete VNF Descriptor Test
garciadeblas4cf45d72021-04-08 13:52:22 +020092 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020093 Delete VNFD ${vnfd_name}
94
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +020095Delete VNF NS Packages
garciadeblas4cf45d72021-04-08 13:52:22 +020096 [Tags] cleanup
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +020097 Delete Package '%{PACKAGES_FOLDER}/${vnfd_pkg}'
98 Delete Package '%{PACKAGES_FOLDER}/${nsd_pkg}'
99
Felipe Vicensf96bb452020-06-22 08:12:30 +0200100
101*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000102Suite Cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200103 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
garciadeblasd225e552020-10-02 16:10:14 +0000104 Run Keyword If Any Tests Failed Delete NS ${ns_name}
105 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
106 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}
107 Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name}