| uniyalna | 55a8874 | 2024-07-11 10:04:59 +0000 | [diff] [blame] | 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-14] Helm upgrade using --reset-values, --reuse-values flags. |
| 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_14 cluster_k8s daily 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: {adminPassword: admin}} ] } ] } |
| 46 | |
| 47 | ${NS_ID} ${EMPTY} |
| 48 | ${PUBLICKEY} ${EMPTY} |
| 49 | ${VNF_MEMBER_INDEX} openldap |
| 50 | ${KDU_NAME} ldap |
| 51 | ${UPGRADE_ACTION} upgrade |
| 52 | |
| 53 | ${INITIAL_PARAM_1_VALUE} "admin" |
| 54 | ${PARAM_1} adminPassword |
| 55 | ${PARAM_2} appUser |
| 56 | ${PARAM_1_REUSE_VALUE} reusePasswd |
| 57 | ${PARAM_2_REUSE_VALUE} Reuser |
| 58 | ${PARAM_1_RESET_VALUE} resetPasswd |
| 59 | ${PARAM_2_RESET_VALUE} Resetter |
| 60 | ${PARAM_1_VALUE_AFTER_RESET_1} ${EMPTY} |
| 61 | ${PARAM_2_VALUE_AFTER_RESET_1} ${EMPTY} |
| 62 | ${PARAM_1_VALUE_AFTER_REUSE_2} "reusePasswd" |
| 63 | ${PARAM_2_VALUE_AFTER_REUSE_2} "Reuser" |
| 64 | ${PARAM_1_VALUE_AFTER_RESET_2} "resetPasswd" |
| 65 | ${PARAM_2_VALUE_AFTER_RESET_2} "Resetter" |
| 66 | |
| 67 | |
| 68 | *** Test Cases *** |
| 69 | Create Package For OpenLDAP CNF |
| 70 | [Documentation] Upload NF package for the testsuite. |
| 71 | [Tags] prepare |
| 72 | Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' |
| 73 | |
| 74 | Create Package For OpenLDAP NS |
| 75 | [Documentation] Upload NS package for the testsuite. |
| 76 | [Tags] prepare |
| 77 | Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' |
| 78 | |
| 79 | Create Network Service Instance |
| 80 | [Documentation] Instantiate NS for the testsuite. |
| 81 | [Tags] prepare |
| 82 | ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} |
| 83 | Log ${id} |
| 84 | |
| 85 | Get Ns Id |
| 86 | [Documentation] Retrieve NS instance id to be used later on. |
| 87 | [Tags] verify |
| 88 | ${id}= Get Ns Id ${NS_NAME} |
| 89 | Set Suite Variable ${NS_ID} ${id} |
| 90 | |
| 91 | Get Vnf Id |
| 92 | [Documentation] Retrieve NF instance id to be used later on. |
| 93 | [Tags] verify |
| 94 | Variable Should Exist ${NS_ID} msg=Network service instance is not available |
| 95 | @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} |
| 96 | Log List ${vnfr_list} |
| 97 | Set Suite Variable ${VNF_ID} ${vnfr_list}[0] |
| 98 | |
| 99 | Execute First NS Upgrade Using KDU_REUSE Flag Set To True |
| 100 | [Documentation] Upgrade the NS using values files with reuse-values flag true |
| 101 | [Tags] verify |
| 102 | ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${UPGRADE_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME} kdu_reuse_values=True |
| 103 | Log ${ns_op_id} |
| 104 | |
| 105 | Get Additional Params And Values From Kdu After First Upgrade with Reuse True |
| 106 | [Documentation] Get values from the NS by after upgrading with reuse-values |
| 107 | [Tags] verify |
| 108 | ${param_value}= Get Additional Params And Values From Kdu ${NS_NAME} ${PARAM_1} |
| 109 | Should Be Equal ${param_value} ${INITIAL_PARAM_1_VALUE} |
| 110 | |
| 111 | Execute Second NS Upgrade Using KDU_REUSE Flag Set To True |
| 112 | [Documentation] Upgrade the NS using values files with reuse-values flag true changing existing value and adding a new parameter |
| 113 | [Tags] verify |
| 114 | ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${UPGRADE_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME} ${PARAM_1}=${PARAM_1_REUSE_VALUE} ${PARAM_2}=${PARAM_2_REUSE_VALUE} |
| 115 | Log ${ns_op_id} |
| 116 | |
| 117 | Get Additional Params And Values From Kdu After Second Upgrade with Reuse True |
| 118 | [Documentation] Get values from the NS by after upgrading with reuse-values |
| 119 | [Tags] verify |
| 120 | ${param_value}= Get Additional Params And Values From Kdu ${NS_NAME} ${PARAM_1} |
| 121 | Should Be Equal ${param_value} ${PARAM_1_VALUE_AFTER_REUSE_2} |
| 122 | ${param_value}= Get Additional Params And Values From Kdu ${NS_NAME} ${PARAM_2} |
| 123 | Should Be Equal ${param_value} ${PARAM_2_VALUE_AFTER_REUSE_2} |
| 124 | |
| 125 | Execute First NS Upgrade Using KDU_RESET Flag Set To True |
| 126 | [Documentation] Upgrade the NS using values files with reset-values flag true |
| 127 | [Tags] verify |
| 128 | ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${UPGRADE_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME} kdu_reset_values=True |
| 129 | Log ${ns_op_id} |
| 130 | |
| 131 | Get Additional Params And Values From Kdu After Reset |
| 132 | [Documentation] Get values from the NS by after upgrading with reset-values |
| 133 | [Tags] verify |
| 134 | ${param_value}= Get Additional Params And Values From Kdu ${NS_NAME} ${PARAM_1} |
| 135 | Should Be Equal ${param_value} ${PARAM_1_VALUE_AFTER_RESET_1} |
| 136 | ${param_value}= Get Additional Params And Values From Kdu ${NS_NAME} ${PARAM_2} |
| 137 | Should Be Equal ${param_value} ${PARAM_2_VALUE_AFTER_RESET_1} |
| 138 | |
| 139 | Execute Second NS Upgrade Using KDU_RESET Flag Set To True and additional params |
| 140 | [Documentation] Upgrade the NS using values files with reset-values flag true and also passing additional params |
| 141 | [Tags] verify |
| 142 | ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${UPGRADE_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME} ${PARAM_1}=${PARAM_1_RESET_VALUE} ${PARAM_2}=${PARAM_2_RESET_VALUE} |
| 143 | Log ${ns_op_id} |
| 144 | |
| 145 | Get Additional Params And Values From Kdu After Second Reset |
| 146 | [Documentation] Get values from the NS by after upgrading with additional values and reset-values flag set to True |
| 147 | [Tags] verify |
| 148 | ${param_value}= Get Additional Params And Values From Kdu ${NS_NAME} ${PARAM_1} |
| 149 | Should Be Equal ${param_value} ${PARAM_1_VALUE_AFTER_RESET_2} |
| 150 | ${param_value}= Get Additional Params And Values From Kdu ${NS_NAME} ${PARAM_2} |
| 151 | Should Be Equal ${param_value} ${PARAM_2_VALUE_AFTER_RESET_2} |
| 152 | |
| 153 | Delete Network Service Instance |
| 154 | [Documentation] Delete NS instance. |
| 155 | [Tags] cleanup |
| 156 | Delete NS ${NS_NAME} |
| 157 | |
| 158 | Delete NS Descriptor Test |
| 159 | [Documentation] Delete NS package from OSM. |
| 160 | [Tags] cleanup |
| 161 | Delete NSD ${NSD_NAME} |
| 162 | |
| 163 | Delete VNF Descriptor Test |
| 164 | [Documentation] Delete NF package from OSM. |
| 165 | [Tags] cleanup |
| 166 | Delete VNFD ${VNFD_NAME} |
| 167 | |
| 168 | |
| 169 | *** Keywords *** |
| 170 | Suite Cleanup |
| 171 | [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim |
| 172 | Run Keyword If Any Tests Failed Delete NS ${NS_NAME} |
| 173 | Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} |
| 174 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} |