blob: 7bdb39ca2cefa262e0e2ff63aeba7d5c25ccc8c1 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
Mark Beierl58710332022-08-03 14:14:14 -04002# 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
garciadeblas7a9e0312023-12-11 22:24:46 +010014
Mark Beierl58710332022-08-03 14:14:14 -040015*** Settings ***
16Documentation [K8s-12] Openldap Helm chart.
17
18Library OperatingSystem
19Library String
20Library Collections
21Library Process
22
garciadeblas7a9e0312023-12-11 22:24:46 +010023Resource ../lib/vnfd_lib.resource
24Resource ../lib/nsd_lib.resource
25Resource ../lib/ns_lib.resource
26Resource ../lib/ns_operation_lib.resource
27Resource ../lib/connectivity_lib.resource
28Resource ../lib/ssh_lib.resource
29Resource ../lib/k8scluster_lib.resource
Mark Beierl58710332022-08-03 14:14:14 -040030
garciadeblas4487e9a2023-12-17 01:37:47 +010031Test Tags k8s_12 cluster_k8s regression azure
Mark Beierl58710332022-08-03 14:14:14 -040032
33Suite Teardown Run Keyword And Ignore Error Suite Cleanup
34
35
36*** Variables ***
37# K8s cluster name and version
garciadeblas7a9e0312023-12-11 22:24:46 +010038${K8SCLUSTER_NAME} k8s12
39${K8SCLUSTER_VERSION} v1
Mark Beierl58710332022-08-03 14:14:14 -040040
41# NS and VNF descriptor package folder and ids
garciadeblas7a9e0312023-12-11 22:24:46 +010042${VNFD_PKG} openldap_primitives_knf
43${VNFD_NAME} openldap_knf
44${NSD_PKG} openldap_primitives_ns
45${NSD_NAME} openldap_ns
Mark Beierl58710332022-08-03 14:14:14 -040046
47# NS instance name and configuration
garciadeblas7a9e0312023-12-11 22:24:46 +010048${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}} ] } ] }
Mark Beierl58710332022-08-03 14:14:14 -040050
garciadeblas7a9e0312023-12-11 22:24:46 +010051${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
Mark Beierl58710332022-08-03 14:14:14 -040062
63*** Test Cases ***
64Create Package For OpenLDAP CNF
garciadeblas7a9e0312023-12-11 22:24:46 +010065 [Documentation] Upload VNF package for the testsuite.
66 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
Mark Beierl58710332022-08-03 14:14:14 -040067
68Create Package For OpenLDAP NS
garciadeblas7a9e0312023-12-11 22:24:46 +010069 [Documentation] Upload NS package for the testsuite.
70 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
Mark Beierl58710332022-08-03 14:14:14 -040071
72Add K8s Cluster To OSM
garciadeblas7a9e0312023-12-11 22:24:46 +010073 [Documentation] Register K8s cluster in OSM.
74 Create K8s Cluster %{K8S_CREDENTIALS} ${K8SCLUSTER_VERSION} %{VIM_TARGET} %{VIM_MGMT_NET} ${K8SCLUSTER_NAME}
garciadeblas93e5cc22023-12-17 01:40:23 +010075 Check For K8s Cluster To Be Enabled ${K8SCLUSTER_NAME}
Mark Beierl58710332022-08-03 14:14:14 -040076
77Create Network Service Instance
garciadeblas7a9e0312023-12-11 22:24:46 +010078 [Documentation] Instantiate NS for the testsuite.
79 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY}
80 Log ${id}
Mark Beierl58710332022-08-03 14:14:14 -040081
82Get Ns Id
garciadeblas7a9e0312023-12-11 22:24:46 +010083 [Documentation] Get NS instance id from OSM.
84 ${id}= Get Ns Id ${NS_NAME}
85 Set Suite Variable ${NS_ID} ${id}
Mark Beierl58710332022-08-03 14:14:14 -040086
87Get Vnf Id
garciadeblas7a9e0312023-12-11 22:24:46 +010088 [Documentation] Get VNF instance id from OSM.
89 Variable Should Exist ${NS_ID} msg=Network service instance is not available
90 @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID}
Mark Beierl58710332022-08-03 14:14:14 -040091 Log List ${vnfr_list}
garciadeblas7a9e0312023-12-11 22:24:46 +010092 Set Suite Variable ${VNF_ID} ${vnfr_list}[0]
Mark Beierl58710332022-08-03 14:14:14 -040093
94Execute Day 2 Operations
95 [Documentation] Performs one Day 2 operation.
garciadeblas7a9e0312023-12-11 22:24:46 +010096 Variable Should Exist ${NS_ID} msg=Network service instance is not available
97 ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX} ${KDU_NAME} cn=${ACTION_PARAM_CN} dc=${ACTION_PARAM_DC}
98 Log ${ns_op_id}
Mark Beierl58710332022-08-03 14:14:14 -040099
100Execute Upgrade Operation
garciadeblas7a9e0312023-12-11 22:24:46 +0100101 [Documentation] Perform OSM action to upgrade the number of replicas of a deployment in the CNF.
102 Variable Should Exist ${NS_ID} msg=Network service instance is not available
103 ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${UPGRADE_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME} replicaCount=${REPLICA_COUNT}
104 Log ${ns_op_id}
Mark Beierl58710332022-08-03 14:14:14 -0400105
106Check Replicas After Upgrade Operation
garciadeblas7a9e0312023-12-11 22:24:46 +0100107 [Documentation] Check that the number of replicas after the upgrade is the expected one.
108 Variable Should Exist ${NS_ID} msg=Network service instance is not available
109 ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME}
garciadeblas321726f2022-12-21 11:43:06 +0100110 Log ${count}
garciadeblas7a9e0312023-12-11 22:24:46 +0100111 Should Be Equal As Integers ${count} ${REPLICA_COUNT}
Mark Beierl58710332022-08-03 14:14:14 -0400112
113Execute Rollback Operation
garciadeblas7a9e0312023-12-11 22:24:46 +0100114 [Documentation] Perform OSM action to rollback the previous upgrade of the CNF.
115 Variable Should Exist ${NS_ID} msg=Network service instance is not available
116 ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${ROLLBACK_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME}
117 Log ${ns_op_id}
Mark Beierl58710332022-08-03 14:14:14 -0400118
119Check Replicas After Rollback Operation
garciadeblas7a9e0312023-12-11 22:24:46 +0100120 [Documentation] Check that the number of replcias after the rollback is the expected one.
121 Variable Should Exist ${NS_ID} msg=Network service instance is not available
122 ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME}
garciadeblas321726f2022-12-21 11:43:06 +0100123 Log ${count}
Mark Beierl58710332022-08-03 14:14:14 -0400124 Should Be Empty ${count}
125
126Delete Network Service Instance
garciadeblas7a9e0312023-12-11 22:24:46 +0100127 [Documentation] Delete NS instance.
Mark Beierl58710332022-08-03 14:14:14 -0400128 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100129 Delete NS ${NS_NAME}
Mark Beierl58710332022-08-03 14:14:14 -0400130
131Remove K8s Cluster from OSM
garciadeblas7a9e0312023-12-11 22:24:46 +0100132 [Documentation] Delete K8s cluster from OSM.
Mark Beierl58710332022-08-03 14:14:14 -0400133 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100134 Delete K8s Cluster ${K8SCLUSTER_NAME}
Mark Beierl58710332022-08-03 14:14:14 -0400135
136Delete NS Descriptor Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100137 [Documentation] Delete NS package from OSM.
Mark Beierl58710332022-08-03 14:14:14 -0400138 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100139 Delete NSD ${NSD_NAME}
Mark Beierl58710332022-08-03 14:14:14 -0400140
141Delete VNF Descriptor Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100142 [Documentation] Delete NF package from OSM.
Mark Beierl58710332022-08-03 14:14:14 -0400143 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100144 Delete VNFD ${VNFD_NAME}
Mark Beierl58710332022-08-03 14:14:14 -0400145
146
147*** Keywords ***
148Suite Cleanup
149 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
garciadeblas7a9e0312023-12-11 22:24:46 +0100150 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
151 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
152 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}
153 Run Keyword If Any Tests Failed Delete K8s Cluster ${K8SCLUSTER_NAME}