Add K8s-09 Pebble charm robot test
[osm/tests.git] / robot-systest / testsuite / k8s_09-pebble_charm_k8s.robot
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 ***
16 Documentation     [K8s-09] Pebble Charm.
17
18 Library   OperatingSystem
19 Library   String
20 Library   Collections
21 Library   Process
22
23 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
24 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
25 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
26 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/package_lib.robot
27 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
28 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
29 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot
30
31 Force Tags   k8s_09   cluster_k8s   daily   regression
32
33 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
34
35
36 *** Variables ***
37 # K8s cluster name and version
38 ${k8scluster_name}   k8s-test
39 ${k8scluster_version}   v1
40
41 # NS and VNF descriptor package folder and ids
42 ${vnfd_pkg}   charm-packages/pebble_charm_vnf
43 ${vnfd_name}   pebble_charm-vnf
44 ${nsd_pkg}   charm-packages/pebble_charm_ns
45 ${nsd_name}   pebble_charm-ns
46
47 # NS instance name and configuration
48 ${ns_name}   pebble-charm-k8s
49 ${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
50
51 ${ns_id}   ${EMPTY}
52 ${publickey}   ${EMPTY}
53 ${vnf_member_index}   pebble_charm-vnf
54 ${action_name}   list-available-apps
55 ${kdu_name}   onos-kdu
56 ${application_name}   onos
57 ${customtitle}   Day 2 Action
58
59 *** Test Cases ***
60 Create Simple K8s VNF Descriptor
61     Create VNFD   '%{PACKAGES_FOLDER}/${vnfd_pkg}'
62
63 Create Simple K8s Descriptor
64     Create NSD   '%{PACKAGES_FOLDER}/${nsd_pkg}'
65
66 Add K8s Cluster To OSM
67     Create K8s Cluster  %{K8S_CREDENTIALS}  ${k8scluster_version}  %{VIM_TARGET}  %{VIM_MGMT_NET}  ${k8scluster_name}
68
69 Network Service K8s Instance Test
70     ${id}=   Create Network Service   ${nsd_name}   %{VIM_TARGET}   ${ns_name}   ${ns_config}  ${publickey}
71     Set Suite Variable   ${ns_id}   ${id}
72
73 Execute Day 2 Operations
74     [Documentation]     Performs one Day 2 operation per VNF that creates a new file.
75
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}
78
79 Delete NS K8s Instance Test
80     [Tags]   cleanup
81     Delete NS   ${ns_name}
82
83 Remove K8s Cluster from OSM
84     [Tags]   cleanup
85     Delete K8s Cluster  ${k8scluster_name}
86
87 Delete NS Descriptor Test
88     [Tags]   cleanup
89     Delete NSD   ${nsd_name}
90
91 Delete VNF Descriptor Test
92     [Tags]   cleanup
93     Delete VNFD   ${vnfd_name}
94
95 Delete VNF NS Packages
96     [Tags]   cleanup
97     Delete Package   '%{PACKAGES_FOLDER}/${vnfd_pkg}'
98     Delete Package   '%{PACKAGES_FOLDER}/${nsd_pkg}'
99
100
101 *** Keywords ***
102 Suite Cleanup
103     [Documentation]  Test Suit Cleanup: Deleting Descriptor, instance and vim
104     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}