43700742286027b2873438ff48a2b689eca8ae6e
[osm/tests.git] / robot-systest / testsuite / k8s_04-openldap_helm.robot
1 #   Licensed under the Apache License, Version 2.0 (the "License");
2 #   you may not use this file except in compliance with the License.
3 #   You may obtain a copy of the License at
4 #
5 #       http://www.apache.org/licenses/LICENSE-2.0
6 #
7 #   Unless required by applicable law or agreed to in writing, software
8 #   distributed under the License is distributed on an "AS IS" BASIS,
9 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 #   See the License for the specific language governing permissions and
11 #   limitations under the License.
12
13 *** Settings ***
14 Documentation   [K8s-04] Openldap Helm chart.
15
16 Library   OperatingSystem
17 Library   String
18 Library   Collections
19 Library   Process
20
21 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
22 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
23 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
24 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
25 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
26 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot
27
28 Force Tags   k8s_04   cluster_k8s   daily   regression   sanity
29
30 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
31
32
33 *** Variables ***
34 # NS and VNF descriptor package folder and ids
35 ${vnfd_pkg}   openldap_knf
36 ${vnfd_name}   openldap_knf
37 ${nsd_pkg}   openldap_ns
38 ${nsd_name}   openldap_ns
39
40 # NS instance name and configuration
41 ${ns_name}   ldap
42 ${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}], additionalParamsForVnf: [ {member-vnf-index: openldap, additionalParamsForKdu: [ {kdu_name: ldap, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}} ] } ] }
43
44 ${ns_id}   ${EMPTY}
45 ${publickey}   ${EMPTY}
46 ${vnf_member_index}   openldap
47 ${kdu_name}   ldap
48 ${upgrade_action}   upgrade
49 ${rollback_action}   rollback
50 ${replica_count}   3
51
52 *** Test Cases ***
53 Create Package For OpenLDAP CNF
54     [Tags]   prepare
55     Create VNFD   '%{PACKAGES_FOLDER}/${vnfd_pkg}'
56
57 Create Package For OpenLDAP NS
58     [Tags]   prepare
59     Create NSD   '%{PACKAGES_FOLDER}/${nsd_pkg}'
60
61 Create Network Service Instance
62     [Tags]   prepare
63     ${id}=   Create Network Service   ${nsd_name}   %{VIM_TARGET}   ${ns_name}   ${ns_config}   ${publickey}
64
65 Get Ns Id
66     [Tags]   verify
67     ${id}=   Get Ns Id   ${ns_name}
68     Set Suite Variable   ${ns_id}   ${id}
69
70 Get Vnf Id
71     [Tags]   verify
72     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
73     @{vnfr_list}=   Get Ns Vnfr Ids   ${ns_id}
74     Log List   ${vnfr_list}
75     Set Suite Variable   ${vnf_id}   ${vnfr_list}[0]
76
77 Execute Upgrade Operation
78     [Tags]   verify
79     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
80     ${ns_op_id}=   Execute NS K8s Action   ${ns_name}   ${upgrade_action}   ${vnf_member_index}   ${kdu_name}   replicaCount=${replica_count}
81
82 Check Replicas After Upgrade Operation
83     [Tags]   verify
84     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
85     ${count}=   Get Vnf Kdu Replica Count   ${vnf_id}   ${kdu_name}
86     log   ${count}
87     Should Be Equal As Integers   ${count}   ${replica_count}
88
89 Execute Rollback Operation
90     [Tags]   verify
91     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
92     ${ns_op_id}=   Execute NS K8s Action   ${ns_name}   ${rollback_action}   ${vnf_member_index}   ${kdu_name}
93
94 Check Replicas After Rollback Operation
95     [Tags]   verify
96     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
97     ${count}=   Get Vnf Kdu Replica Count   ${vnf_id}   ${kdu_name}
98     log   ${count}
99     Should Be Empty   ${count}
100
101 Delete Network Service Instance
102     [Tags]   cleanup
103     Delete NS   ${ns_name}
104
105 Delete NS Descriptor Test
106     [Tags]   cleanup
107     Delete NSD   ${nsd_name}
108
109 Delete VNF Descriptor Test
110     [Tags]   cleanup
111     Delete VNFD   ${vnfd_name}
112
113
114 *** Keywords ***
115 Suite Cleanup
116     [Documentation]   Test Suit Cleanup: Deleting Descriptor, instance and vim
117     Run Keyword If Any Tests Failed   Delete NS   ${ns_name}
118     Run Keyword If Any Tests Failed   Delete NSD   ${nsd_name}
119     Run Keyword If Any Tests Failed   Delete VNFD   ${vnfd_name}