Feature 11001: Robot framework linting for E2E tests
[osm/tests.git] / robot-systest / testsuite / k8s_04-openldap_helm.robot
1 *** Comments ***
2 #   Licensed under the Apache License, Version 2.0 (the "License");
3 #   you may not use this file except in compliance with the License.
4 #   You may obtain a copy of the License at
5 #
6 #       http://www.apache.org/licenses/LICENSE-2.0
7 #
8 #   Unless required by applicable law or agreed to in writing, software
9 #   distributed under the License is distributed on an "AS IS" BASIS,
10 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 #   See the License for the specific language governing permissions and
12 #   limitations under the License.
13
14
15 *** Settings ***
16 Documentation   [K8s-04] Openldap Helm chart.
17
18 Library   OperatingSystem
19 Library   String
20 Library   Collections
21 Library   Process
22
23 Resource   ../lib/vnfd_lib.resource
24 Resource   ../lib/nsd_lib.resource
25 Resource   ../lib/ns_lib.resource
26 Resource   ../lib/ns_operation_lib.resource
27 Resource   ../lib/connectivity_lib.resource
28 Resource   ../lib/ssh_lib.resource
29 Resource   ../lib/k8scluster_lib.resource
30
31 Test Tags   k8s_04   cluster_k8s   daily   regression   sanity   azure
32
33 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
34
35
36 *** Variables ***
37 # NS and VNF descriptor package folder and ids
38 ${VNFD_PKG}   openldap_knf
39 ${VNFD_NAME}   openldap_knf
40 ${NSD_PKG}   openldap_ns
41 ${NSD_NAME}   openldap_ns
42
43 # NS instance name and configuration
44 ${NS_NAME}   ldap
45 ${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}} ] } ] }
46
47 ${NS_ID}   ${EMPTY}
48 ${PUBLICKEY}   ${EMPTY}
49 ${VNF_MEMBER_INDEX}   openldap
50 ${KDU_NAME}   ldap
51 ${UPGRADE_ACTION}   upgrade
52 ${ROLLBACK_ACTION}   rollback
53 ${REPLICA_COUNT}   3
54
55
56 *** Test Cases ***
57 Create Package For OpenLDAP CNF
58     [Documentation]   Upload NF package for the testsuite.
59     [Tags]   prepare
60     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
61
62 Create Package For OpenLDAP NS
63     [Documentation]   Upload NS package for the testsuite.
64     [Tags]   prepare
65     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
66
67 Create Network Service Instance
68     [Documentation]   Instantiate NS for the testsuite.
69     [Tags]   prepare
70     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}
71     Log   ${id}
72
73 Get Ns Id
74     [Documentation]   Retrieve NS instance id to be used later on.
75     [Tags]   verify
76     ${id}=   Get Ns Id   ${NS_NAME}
77     Set Suite Variable   ${NS_ID}   ${id}
78
79 Get Vnf Id
80     [Documentation]   Retrieve NF instance id to be used later on.
81     [Tags]   verify
82     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
83     @{vnfr_list}=   Get Ns Vnfr Ids   ${NS_ID}
84     Log List   ${vnfr_list}
85     Set Suite Variable   ${VNF_ID}   ${vnfr_list}[0]
86
87 Execute Upgrade Operation
88     [Documentation]   Perform OSM action to upgrade the number of replicas of a deployment in the CNF.
89     [Tags]   verify
90     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
91     ${ns_op_id}=   Execute NS K8s Action   ${NS_NAME}   ${UPGRADE_ACTION}   ${VNF_MEMBER_INDEX}   ${KDU_NAME}   replicaCount=${REPLICA_COUNT}
92     Log   ${ns_op_id}
93
94 Check Replicas After Upgrade Operation
95     [Documentation]   Check that the number of replicas after the upgrade is the expected one.
96     [Tags]   verify
97     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
98     ${count}=   Get Vnf Kdu Replica Count   ${VNF_ID}   ${KDU_NAME}
99     Log   ${count}
100     Should Be Equal As Integers   ${count}   ${REPLICA_COUNT}
101
102 Execute Rollback Operation
103     [Documentation]   Perform OSM action to rollback the previous upgrade of the CNF.
104     [Tags]   verify
105     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
106     ${ns_op_id}=   Execute NS K8s Action   ${NS_NAME}   ${ROLLBACK_ACTION}   ${VNF_MEMBER_INDEX}   ${KDU_NAME}
107     Log   ${ns_op_id}
108
109 Check Replicas After Rollback Operation
110     [Documentation]   Check that the number of replcias after the rollback is the expected one.
111     [Tags]   verify
112     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
113     ${count}=   Get Vnf Kdu Replica Count   ${VNF_ID}   ${KDU_NAME}
114     Log   ${count}
115     Should Be Empty   ${count}
116
117 Delete Network Service Instance
118     [Documentation]   Delete NS instance.
119     [Tags]   cleanup
120     Delete NS   ${NS_NAME}
121
122 Delete NS Descriptor Test
123     [Documentation]   Delete NS package from OSM.
124     [Tags]   cleanup
125     Delete NSD   ${NSD_NAME}
126
127 Delete VNF Descriptor Test
128     [Documentation]   Delete NF package from OSM.
129     [Tags]   cleanup
130     Delete VNFD   ${VNFD_NAME}
131
132
133 *** Keywords ***
134 Suite Cleanup
135     [Documentation]   Test Suit Cleanup: Deleting Descriptor, instance and vim
136     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
137     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
138     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}