blob: a37d653400e7519561961efcdb71e2ba8064ec53 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
ramonsalguer13b10742020-07-19 19:27:59 +00002# 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
ramonsalguer13b10742020-07-19 19:27:59 +000015*** Settings ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020016Documentation [K8s-04] Openldap Helm chart.
garciadeblas4cf45d72021-04-08 13:52:22 +020017
ramonsalguer13b10742020-07-19 19:27:59 +000018Library 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
ramonsalguer13b10742020-07-19 19:27:59 +000030
garciadeblas7a9e0312023-12-11 22:24:46 +010031Test Tags k8s_04 cluster_k8s daily regression sanity azure
garciadeblas4cf45d72021-04-08 13:52:22 +020032
garciadeblasd225e552020-10-02 16:10:14 +000033Suite Teardown Run Keyword And Ignore Error Suite Cleanup
ramonsalguer13b10742020-07-19 19:27:59 +000034
35
36*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020037# NS and VNF descriptor package folder and ids
garciadeblas7a9e0312023-12-11 22:24:46 +010038${VNFD_PKG} openldap_knf
39${VNFD_NAME} openldap_knf
40${NSD_PKG} openldap_ns
41${NSD_NAME} openldap_ns
almagiab4697d32021-05-25 08:56:17 +020042
43# NS instance name and configuration
garciadeblas7a9e0312023-12-11 22:24:46 +010044${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}} ] } ] }
almagiab4697d32021-05-25 08:56:17 +020046
garciadeblas7a9e0312023-12-11 22:24:46 +010047${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
ramonsalguer13b10742020-07-19 19:27:59 +000055
56*** Test Cases ***
57Create Package For OpenLDAP CNF
garciadeblas7a9e0312023-12-11 22:24:46 +010058 [Documentation] Upload NF package for the testsuite.
garciadeblasf4ebaa82022-06-23 13:33:26 +020059 [Tags] prepare
garciadeblas7a9e0312023-12-11 22:24:46 +010060 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
ramonsalguer13b10742020-07-19 19:27:59 +000061
62Create Package For OpenLDAP NS
garciadeblas7a9e0312023-12-11 22:24:46 +010063 [Documentation] Upload NS package for the testsuite.
garciadeblasf4ebaa82022-06-23 13:33:26 +020064 [Tags] prepare
garciadeblas7a9e0312023-12-11 22:24:46 +010065 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
ramonsalguer13b10742020-07-19 19:27:59 +000066
ramonsalguer13b10742020-07-19 19:27:59 +000067Create Network Service Instance
garciadeblas7a9e0312023-12-11 22:24:46 +010068 [Documentation] Instantiate NS for the testsuite.
garciadeblasf4ebaa82022-06-23 13:33:26 +020069 [Tags] prepare
garciadeblas7a9e0312023-12-11 22:24:46 +010070 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY}
71 Log ${id}
rodriguezgarfbedfe02022-02-24 20:05:42 +010072
73Get Ns Id
garciadeblas7a9e0312023-12-11 22:24:46 +010074 [Documentation] Retrieve NS instance id to be used later on.
rodriguezgarfbedfe02022-02-24 20:05:42 +010075 [Tags] verify
garciadeblas7a9e0312023-12-11 22:24:46 +010076 ${id}= Get Ns Id ${NS_NAME}
77 Set Suite Variable ${NS_ID} ${id}
ramonsalguer13b10742020-07-19 19:27:59 +000078
aguilarherna045bd332021-03-25 10:25:59 +010079Get Vnf Id
garciadeblas7a9e0312023-12-11 22:24:46 +010080 [Documentation] Retrieve NF instance id to be used later on.
rodriguezgarfbedfe02022-02-24 20:05:42 +010081 [Tags] verify
garciadeblas7a9e0312023-12-11 22:24:46 +010082 Variable Should Exist ${NS_ID} msg=Network service instance is not available
83 @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID}
garciadeblasf4ebaa82022-06-23 13:33:26 +020084 Log List ${vnfr_list}
garciadeblas7a9e0312023-12-11 22:24:46 +010085 Set Suite Variable ${VNF_ID} ${vnfr_list}[0]
aguilarherna045bd332021-03-25 10:25:59 +010086
Pedro Pereira46b097a2024-06-22 12:23:51 +010087Check Labels Injected Into Kubernetes Objects
88 [Documentation] Check that labels were correctly injected into the deployed Kubernetes objects.
89 [Tags] verify
90 Variable Should Exist ${NS_ID} msg=Network service instance is not available
91 ${stdout}= Check Kdu Labels ${NS_ID} ${VNF_ID} ${KDU_NAME}
92 Log ${stdout}
93
aguilarherna045bd332021-03-25 10:25:59 +010094Execute Upgrade Operation
garciadeblas7a9e0312023-12-11 22:24:46 +010095 [Documentation] Perform OSM action to upgrade the number of replicas of a deployment in the CNF.
rodriguezgarfbedfe02022-02-24 20:05:42 +010096 [Tags] verify
garciadeblas7a9e0312023-12-11 22:24:46 +010097 Variable Should Exist ${NS_ID} msg=Network service instance is not available
98 ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${UPGRADE_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME} replicaCount=${REPLICA_COUNT}
99 Log ${ns_op_id}
aguilarherna045bd332021-03-25 10:25:59 +0100100
101Check Replicas After Upgrade Operation
garciadeblas7a9e0312023-12-11 22:24:46 +0100102 [Documentation] Check that the number of replicas after the upgrade is the expected one.
rodriguezgarfbedfe02022-02-24 20:05:42 +0100103 [Tags] verify
garciadeblas7a9e0312023-12-11 22:24:46 +0100104 Variable Should Exist ${NS_ID} msg=Network service instance is not available
105 ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME}
garciadeblas321726f2022-12-21 11:43:06 +0100106 Log ${count}
garciadeblas7a9e0312023-12-11 22:24:46 +0100107 Should Be Equal As Integers ${count} ${REPLICA_COUNT}
aguilarherna045bd332021-03-25 10:25:59 +0100108
109Execute Rollback Operation
garciadeblas7a9e0312023-12-11 22:24:46 +0100110 [Documentation] Perform OSM action to rollback the previous upgrade of the CNF.
rodriguezgarfbedfe02022-02-24 20:05:42 +0100111 [Tags] verify
garciadeblas7a9e0312023-12-11 22:24:46 +0100112 Variable Should Exist ${NS_ID} msg=Network service instance is not available
113 ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${ROLLBACK_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME}
114 Log ${ns_op_id}
aguilarherna045bd332021-03-25 10:25:59 +0100115
116Check Replicas After Rollback Operation
garciadeblas7a9e0312023-12-11 22:24:46 +0100117 [Documentation] Check that the number of replcias after the rollback is the expected one.
rodriguezgarfbedfe02022-02-24 20:05:42 +0100118 [Tags] verify
garciadeblas7a9e0312023-12-11 22:24:46 +0100119 Variable Should Exist ${NS_ID} msg=Network service instance is not available
120 ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME}
garciadeblas321726f2022-12-21 11:43:06 +0100121 Log ${count}
aguilarherna045bd332021-03-25 10:25:59 +0100122 Should Be Empty ${count}
123
ramonsalguer13b10742020-07-19 19:27:59 +0000124Delete Network Service Instance
garciadeblas7a9e0312023-12-11 22:24:46 +0100125 [Documentation] Delete NS instance.
garciadeblas4cf45d72021-04-08 13:52:22 +0200126 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100127 Delete NS ${NS_NAME}
ramonsalguer13b10742020-07-19 19:27:59 +0000128
ramonsalguer13b10742020-07-19 19:27:59 +0000129Delete NS Descriptor Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100130 [Documentation] Delete NS package from OSM.
garciadeblas4cf45d72021-04-08 13:52:22 +0200131 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100132 Delete NSD ${NSD_NAME}
ramonsalguer13b10742020-07-19 19:27:59 +0000133
134Delete VNF Descriptor Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100135 [Documentation] Delete NF package from OSM.
garciadeblas4cf45d72021-04-08 13:52:22 +0200136 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100137 Delete VNFD ${VNFD_NAME}
ramonsalguer13b10742020-07-19 19:27:59 +0000138
139
140*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000141Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200142 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
garciadeblas7a9e0312023-12-11 22:24:46 +0100143 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
144 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
145 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}