| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 1 | # Copyright 2020 Canonical Ltd. |
| 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 | *** Settings *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 15 | Documentation [BASIC-12] NS Primitives |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 16 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 17 | Library OperatingSystem |
| 18 | Library String |
| 19 | Library Collections |
| 20 | Library Process |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 21 | Library SSHLibrary |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 22 | |
| 23 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot |
| 24 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot |
| 25 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot |
| garciadeblas | fad2246 | 2022-06-25 18:19:04 +0200 | [diff] [blame] | 26 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/package_lib.robot |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 27 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/juju_lib.robot |
| 28 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 29 | |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 30 | Force Tags basic_12 cluster_ee_config daily regression |
| 31 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 32 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 33 | |
| 34 | |
| 35 | *** Variables *** |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 36 | # NS and VNF descriptor package folder and ids |
| 37 | ${vnfd_pkg1} nscharm_policy_vnf |
| 38 | ${vnfd_pkg2} nscharm_user_vnf |
| 39 | ${vnfd_name1} nscharm-policy-vnf |
| 40 | ${vnfd_name2} nscharm-user-vnf |
| 41 | ${nsd_pkg} nscharm_ns |
| 42 | ${new_nsd_pkg} new_nscharm_ns |
| 43 | ${nsd_name} nscharm-ns |
| 44 | ${nsd_file} nscharm_nsd.yaml |
| 45 | |
| 46 | # NS instance name and configuration |
| 47 | ${ns_name} test_nscharm |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 48 | ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| aguilard | 9092855 | 2021-08-20 11:50:34 +0200 | [diff] [blame] | 49 | ${ns_timeout} 15min |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 50 | |
| 51 | ${old_juju_password} a5611fc6452349cc6e45705d34c501d4 |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 52 | ${publickey} ${EMPTY} |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 53 | ${success_return_code} 0 |
| 54 | |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 55 | # VDU profile id, execution environment name to check vdu level charm naming structure |
| 56 | ${vdu_profile_id} PolicyVM |
| 57 | ${ee_name} vnf-policy |
| 58 | |
| 59 | # # Username and SSH private key for accessing OSM host |
| 60 | ${privatekey} %{OSM_RSA_FILE} |
| 61 | ${username} ubuntu |
| 62 | ${password} ${EMPTY} |
| 63 | |
| 64 | # Charm name to check ns level charm naming structure |
| 65 | ${charm_name} ns |
| 66 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 67 | |
| 68 | *** Test Cases *** |
| 69 | Change Juju Password |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 70 | [Documentation] NS package needs to be updated with the Juju credentials for your OSM installation |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 71 | |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 72 | ${rc} ${stdout}= Run and Return RC and Output cp -r '%{PACKAGES_FOLDER}/${nsd_pkg}' '%{PACKAGES_FOLDER}/${new_nsd_pkg}' |
| 73 | Should Be Equal As Integers ${rc} ${success_return_code} |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 74 | ${nsd_yaml}= OperatingSystem.Get File %{PACKAGES_FOLDER}/${new_nsd_pkg}/${nsd_file} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 75 | ${changed_nsd_yaml}= Replace String ${nsd_yaml} ${old_juju_password} %{JUJU_PASSWORD} |
| 76 | Create File %{PACKAGES_FOLDER}/${new_nsd_pkg}/${nsd_file} ${changed_nsd_yaml} |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 77 | |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 78 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 79 | Upload Vnfds |
| 80 | |
| garciadeblas | 55a5ec2 | 2020-10-07 15:33:05 +0000 | [diff] [blame] | 81 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg1}' |
| 82 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg2}' |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 83 | |
| 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 |
| 86 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 87 | Create NSD %{PACKAGES_FOLDER}/${new_nsd_pkg}/ |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 88 | |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 89 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 90 | Instantiate NS |
| 91 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 92 | ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ns_launch_max_wait_time=${ns_timeout} |
| 93 | Set Suite Variable ${ns_id} ${id} |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 94 | Set Suite Variable ${model_name} ${id} |
| 95 | |
| 96 | |
| 97 | Check NS Charm Application Name |
| 98 | |
| 99 | ${ns_charm_app_name}= Get Application Name NS Level Charm %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${model_name} ${charm_name} |
| 100 | ${length}= Get Length ${ns_charm_app_name} |
| 101 | Should Be True ${length} <50 |
| 102 | |
| 103 | |
| 104 | Check VDU Charm Application Name |
| 105 | |
| 106 | ${vdu_charm_app_name}= Get Application Name VDU Level Charm %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${model_name} ${vdu_profile_id} ${ee_name} |
| 107 | ${length}= Get Length ${vdu_charm_app_name} |
| 108 | Should Be True ${length} <50 |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 109 | |
| 110 | # TODO: Check Initial Config Primitives Status |
| 111 | |
| garciadeblas | 61bbf92 | 2022-06-25 18:12:53 +0200 | [diff] [blame] | 112 | Delete NS |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 113 | [Tags] cleanup |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 114 | |
| 115 | Delete NS ${ns_name} |
| 116 | |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 117 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 118 | Delete NS Descriptor |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 119 | [Tags] cleanup |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 120 | |
| 121 | Delete NSD ${nsd_name} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 122 | Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${new_nsd_pkg}' |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 123 | |
| aticig | a131bf0 | 2022-08-25 13:10:14 +0300 | [diff] [blame] | 124 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 125 | Delete VNF Descriptors |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 126 | [Tags] cleanup |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 127 | |
| 128 | Delete VNFD ${vnfd_name1} |
| 129 | Delete VNFD ${vnfd_name2} |
| 130 | |
| 131 | |
| 132 | *** Keywords *** |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 133 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 134 | [Documentation] Test Suit Cleanup: Deleting Descriptor and instance |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 135 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 136 | Run Keyword If Any Tests Failed Delete NS ${ns_name} |
| 137 | Run Keyword If Any Tests Failed Delete NSD ${nsd_name} |
| 138 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name1} |
| 139 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name2} |
| 140 | Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${new_nsd_pkg}' |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 141 | |
| 142 | |
| 143 | Delete Temporary Descriptor Folder |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 144 | [Documentation] Removes the temporary package folder created for the test |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 145 | [Arguments] ${folder_name} |
| 146 | |
| 147 | ${rc} ${stdout}= Run and Return RC and Output rm -rf '${folder_name}' |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 148 | Log ${stdout} |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 149 | |
| 150 | |