Add regression tag to tests used in v14
[osm/tests.git] / robot-systest / testsuite / k8s_12-openldap_helm_day-2.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-12] 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_12   cluster_k8s   daily   regression   azure
32
33 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
34
35
36 *** Variables ***
37 # K8s cluster name and version
38 ${K8SCLUSTER_NAME}   k8s12
39 ${K8SCLUSTER_VERSION}   v1
40
41 # NS and VNF descriptor package folder and ids
42 ${VNFD_PKG}   openldap_primitives_knf
43 ${VNFD_NAME}   openldap_knf
44 ${NSD_PKG}   openldap_primitives_ns
45 ${NSD_NAME}   openldap_ns
46
47 # NS instance name and configuration
48 ${NS_NAME}   ldap
49 ${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}} ] } ] }
50
51 ${NS_ID}   ${EMPTY}
52 ${PUBLICKEY}   ${EMPTY}
53 ${VNF_MEMBER_INDEX}   openldap
54 ${KDU_NAME}   ldap
55 ${UPGRADE_ACTION}   upgrade
56 ${ROLLBACK_ACTION}   rollback
57 ${REPLICA_COUNT}   3
58 ${ACTION_NAME}   get-user-info
59 ${ACTION_PARAM_CN}   admin
60 ${ACTION_PARAM_DC}   example.org
61
62
63 *** Test Cases ***
64 Create Package For OpenLDAP CNF
65     [Documentation]   Upload VNF package for the testsuite.
66     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
67
68 Create Package For OpenLDAP NS
69     [Documentation]   Upload NS package for the testsuite.
70     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
71
72 Add K8s Cluster To OSM
73     [Documentation]   Register K8s cluster in OSM.
74     Create K8s Cluster   %{K8S_CREDENTIALS}   ${K8SCLUSTER_VERSION}   %{VIM_TARGET}   %{VIM_MGMT_NET}   ${K8SCLUSTER_NAME}
75
76 Create Network Service Instance
77     [Documentation]   Instantiate NS for the testsuite.
78     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}
79     Log   ${id}
80
81 Get Ns Id
82     [Documentation]   Get NS instance id from OSM.
83     ${id}=   Get Ns Id   ${NS_NAME}
84     Set Suite Variable   ${NS_ID}   ${id}
85
86 Get Vnf Id
87     [Documentation]   Get VNF instance id from OSM.
88     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
89     @{vnfr_list}=   Get Ns Vnfr Ids   ${NS_ID}
90     Log List   ${vnfr_list}
91     Set Suite Variable   ${VNF_ID}   ${vnfr_list}[0]
92
93 Execute Day 2 Operations
94     [Documentation]   Performs one Day 2 operation.
95     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
96     ${ns_op_id}=   Execute NS K8s Action   ${NS_NAME}   ${ACTION_NAME}   ${VNF_MEMBER_INDEX}   ${KDU_NAME}   cn=${ACTION_PARAM_CN}   dc=${ACTION_PARAM_DC}
97     Log   ${ns_op_id}
98
99 Execute Upgrade Operation
100     [Documentation]   Perform OSM action to upgrade the number of replicas of a deployment in the CNF.
101     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
102     ${ns_op_id}=   Execute NS K8s Action   ${NS_NAME}   ${UPGRADE_ACTION}   ${VNF_MEMBER_INDEX}   ${KDU_NAME}   replicaCount=${REPLICA_COUNT}
103     Log   ${ns_op_id}
104
105 Check Replicas After Upgrade Operation
106     [Documentation]   Check that the number of replicas after the upgrade is the expected one.
107     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
108     ${count}=   Get Vnf Kdu Replica Count   ${VNF_ID}   ${KDU_NAME}
109     Log   ${count}
110     Should Be Equal As Integers   ${count}   ${REPLICA_COUNT}
111
112 Execute Rollback Operation
113     [Documentation]   Perform OSM action to rollback the previous upgrade of the CNF.
114     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
115     ${ns_op_id}=   Execute NS K8s Action   ${NS_NAME}   ${ROLLBACK_ACTION}   ${VNF_MEMBER_INDEX}   ${KDU_NAME}
116     Log   ${ns_op_id}
117
118 Check Replicas After Rollback Operation
119     [Documentation]   Check that the number of replcias after the rollback is the expected one.
120     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
121     ${count}=   Get Vnf Kdu Replica Count   ${VNF_ID}   ${KDU_NAME}
122     Log   ${count}
123     Should Be Empty   ${count}
124
125 Delete Network Service Instance
126     [Documentation]   Delete NS instance.
127     [Tags]   cleanup
128     Delete NS   ${NS_NAME}
129
130 Remove K8s Cluster from OSM
131     [Documentation]   Delete K8s cluster from OSM.
132     [Tags]   cleanup
133     Delete K8s Cluster   ${K8SCLUSTER_NAME}
134
135 Delete NS Descriptor Test
136     [Documentation]   Delete NS package from OSM.
137     [Tags]   cleanup
138     Delete NSD   ${NSD_NAME}
139
140 Delete VNF Descriptor Test
141     [Documentation]   Delete NF package from OSM.
142     [Tags]   cleanup
143     Delete VNFD   ${VNFD_NAME}
144
145
146 *** Keywords ***
147 Suite Cleanup
148     [Documentation]   Test Suit Cleanup: Deleting Descriptor, instance and vim
149     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
150     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
151     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}
152     Run Keyword If Any Tests Failed   Delete K8s Cluster   ${K8SCLUSTER_NAME}