| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 1 | *** Comments *** |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 2 | # Copyright 2020 Canonical Ltd. |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 15 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 16 | *** Settings *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 17 | Documentation [BASIC-12] NS Primitives |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 18 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 19 | Library OperatingSystem |
| 20 | Library String |
| 21 | Library Collections |
| 22 | Library Process |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 23 | Library SSHLibrary |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 24 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 25 | Resource ../lib/vnfd_lib.resource |
| 26 | Resource ../lib/nsd_lib.resource |
| 27 | Resource ../lib/ns_lib.resource |
| 28 | Resource ../lib/package_lib.resource |
| 29 | Resource ../lib/juju_lib.resource |
| 30 | Resource ../lib/ssh_lib.resource |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 31 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 32 | Test Tags basic_12 cluster_ee_config regression azure |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 33 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 34 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 35 | |
| 36 | |
| 37 | *** Variables *** |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 38 | # NS and VNF descriptor package folder and ids |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 39 | ${VNFD_PKG1} nscharm_policy_vnf |
| 40 | ${VNFD_PKG2} nscharm_user_vnf |
| 41 | ${VNFD_NAME1} nscharm-policy-vnf |
| 42 | ${VNFD_NAME2} nscharm-user-vnf |
| 43 | ${NSD_PKG} nscharm_ns |
| 44 | ${NEW_NSD_PKG} new_nscharm_ns |
| 45 | ${NSD_NAME} nscharm-ns |
| 46 | ${NSD_FILE} nscharm_nsd.yaml |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 47 | |
| 48 | # NS instance name and configuration |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 49 | ${NS_NAME} test_nscharm |
| 50 | ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| 51 | ${NS_TIMEOUT} 15min |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 52 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 53 | ${OLD_JUJU_PASSWORD} a5611fc6452349cc6e45705d34c501d4 |
| 54 | ${PUBLICKEY} ${EMPTY} |
| 55 | ${SUCCESS_RETURN_CODE} 0 |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 56 | |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 57 | # VDU profile id, execution environment name to check vdu level charm naming structure |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 58 | ${VDU_PROFILE_ID} PolicyVM |
| 59 | ${EE_NAME} vnf-policy |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 60 | |
| 61 | # # Username and SSH private key for accessing OSM host |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 62 | ${PRIVATEKEY} %{OSM_RSA_FILE} |
| 63 | ${USERNAME} ubuntu |
| 64 | ${PASSWORD} ${EMPTY} |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 65 | |
| 66 | # Charm name to check ns level charm naming structure |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 67 | ${CHARM_NAME} ns |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 68 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 69 | |
| 70 | *** Test Cases *** |
| 71 | Change Juju Password |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 72 | [Documentation] NS package needs to be updated with the Juju credentials for your OSM installation |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 73 | ${rc} ${stdout}= Run And Return RC And Output cp -r '%{PACKAGES_FOLDER}/${NSD_PKG}' '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}' |
| 74 | Log ${rc},${stdout} |
| 75 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} |
| 76 | ${nsd_yaml}= OperatingSystem.Get File %{PACKAGES_FOLDER}/${NEW_NSD_PKG}/${NSD_FILE} |
| 77 | ${changed_nsd_yaml}= Replace String ${nsd_yaml} ${OLD_JUJU_PASSWORD} %{JUJU_PASSWORD} |
| 78 | Create File %{PACKAGES_FOLDER}/${NEW_NSD_PKG}/${NSD_FILE} ${changed_nsd_yaml} |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 79 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 80 | Upload Vnfds |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 81 | [Documentation] Upload VNF packages for the testsuite. |
| 82 | Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG1}' |
| 83 | Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG2}' |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 84 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 85 | Upload Nsd |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 86 | [Documentation] Upload NS package for the testsuite. |
| 87 | Create NSD %{PACKAGES_FOLDER}/${NEW_NSD_PKG} |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 88 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 89 | Instantiate NS |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 90 | [Documentation] Instantiate NS for the testsuite. |
| 91 | ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ns_launch_max_wait_time=${NS_TIMEOUT} |
| 92 | Set Suite Variable ${NS_ID} ${id} |
| 93 | Set Suite Variable ${MODEL_NAME} ${id} |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 94 | |
| 95 | Check NS Charm Application Name |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 96 | [Documentation] Check that the NS charm has the right length. |
| 97 | ${ns_charm_app_name}= Get Application Name NS Level Charm %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${MODEL_NAME} ${CHARM_NAME} |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 98 | ${length}= Get Length ${ns_charm_app_name} |
| 99 | Should Be True ${length} <50 |
| 100 | |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 101 | Check VDU Charm Application Name |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 102 | [Documentation] Check that the VDU charm has the right length. |
| 103 | ${vdu_charm_app_name}= Get Application Name VDU Level Charm %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${MODEL_NAME} ${VDU_PROFILE_ID} ${EE_NAME} |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 104 | ${length}= Get Length ${vdu_charm_app_name} |
| 105 | Should Be True ${length} <50 |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 106 | |
| 107 | # TODO: Check Initial Config Primitives Status |
| 108 | |
| garciadeblas | 61bbf92 | 2022-06-25 18:12:53 +0200 | [diff] [blame] | 109 | Delete NS |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 110 | [Documentation] Delete NS instance. |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 111 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 112 | Delete NS ${NS_NAME} |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 113 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 114 | Delete NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 115 | [Documentation] Delete NS package from OSM. |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 116 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 117 | Delete NSD ${NSD_NAME} |
| 118 | Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}' |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 119 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 120 | Delete VNF Descriptors |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 121 | [Documentation] Delete VNF package from OSM. |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 122 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 123 | Delete VNFD ${VNFD_NAME1} |
| 124 | Delete VNFD ${VNFD_NAME2} |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 125 | |
| 126 | |
| 127 | *** Keywords *** |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 128 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 129 | [Documentation] Test Suit Cleanup: Deleting Descriptor and instance |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 130 | Run Keyword If Any Tests Failed Delete NS ${NS_NAME} |
| 131 | Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} |
| 132 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME1} |
| 133 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME2} |
| 134 | Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}' |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 135 | |
| 136 | Delete Temporary Descriptor Folder |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 137 | [Documentation] Removes the temporary package folder created for the test |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 138 | [Arguments] ${folder_name} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 139 | ${rc} ${stdout}= Run And Return RC And Output rm -rf '${folder_name}' |
| 140 | Log ${rc},${stdout} |