| 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 | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 15 | Documentation [BASIC-12] NS Primitives |
| 16 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 17 | Library OperatingSystem |
| 18 | Library String |
| 19 | Library Collections |
| 20 | Library Process |
| 21 | |
| 22 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot |
| 23 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot |
| 24 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot |
| 25 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/packages_lib.robot |
| 26 | |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 27 | Force Tags basic_12 cluster_ee_config daily regression |
| 28 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 29 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 30 | |
| 31 | |
| 32 | *** Variables *** |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 33 | # NS and VNF descriptor package folder and ids |
| 34 | ${vnfd_pkg1} nscharm_policy_vnf |
| 35 | ${vnfd_pkg2} nscharm_user_vnf |
| 36 | ${vnfd_name1} nscharm-policy-vnf |
| 37 | ${vnfd_name2} nscharm-user-vnf |
| 38 | ${nsd_pkg} nscharm_ns |
| 39 | ${new_nsd_pkg} new_nscharm_ns |
| 40 | ${nsd_name} nscharm-ns |
| 41 | ${nsd_file} nscharm_nsd.yaml |
| 42 | |
| 43 | # NS instance name and configuration |
| 44 | ${ns_name} test_nscharm |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 45 | ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| aguilard | 9092855 | 2021-08-20 11:50:34 +0200 | [diff] [blame] | 46 | ${ns_timeout} 15min |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 47 | |
| 48 | ${old_juju_password} a5611fc6452349cc6e45705d34c501d4 |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 49 | ${publickey} ${EMPTY} |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 50 | ${success_return_code} 0 |
| 51 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 52 | |
| 53 | *** Test Cases *** |
| 54 | Change Juju Password |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 55 | [Documentation] NS package needs to be updated with the Juju credentials for your OSM installation |
| 56 | |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 57 | ${rc} ${stdout}= Run and Return RC and Output cp -r '%{PACKAGES_FOLDER}/${nsd_pkg}' '%{PACKAGES_FOLDER}/${new_nsd_pkg}' |
| 58 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 59 | ${nsd_yaml}= Get File %{PACKAGES_FOLDER}/${new_nsd_pkg}/${nsd_file} |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 60 | ${changed_nsd_yaml}= Replace String ${nsd_yaml} ${old_juju_password} %{JUJU_PASSWORD} |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 61 | Create File %{PACKAGES_FOLDER}/${new_nsd_pkg}/${nsd_file} ${changed_nsd_yaml} |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 62 | |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 63 | Upload Vnfds |
| 64 | |
| garciadeblas | 55a5ec2 | 2020-10-07 15:33:05 +0000 | [diff] [blame] | 65 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg1}' |
| 66 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg2}' |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 67 | |
| 68 | Upload Nsd |
| 69 | |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 70 | Create NSD %{PACKAGES_FOLDER}/${new_nsd_pkg}/ |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 71 | |
| 72 | Instantiate NS |
| 73 | |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 74 | ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ns_launch_max_wait_time=${ns_timeout} |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 75 | Set Suite Variable ${ns_id} ${id} |
| 76 | |
| 77 | # TODO: Check Initial Config Primitives Status |
| 78 | |
| 79 | Delete NS |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 80 | [Tags] cleanup |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 81 | |
| 82 | Delete NS ${ns_name} |
| 83 | |
| 84 | Delete NS Descriptor |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 85 | [Tags] cleanup |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 86 | |
| 87 | Delete NSD ${nsd_name} |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 88 | Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${new_nsd_pkg}' |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 89 | |
| 90 | Delete VNF Descriptors |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 91 | [Tags] cleanup |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 92 | |
| 93 | Delete VNFD ${vnfd_name1} |
| 94 | Delete VNFD ${vnfd_name2} |
| 95 | |
| 96 | |
| 97 | *** Keywords *** |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 98 | Suite Cleanup |
| calvinosanc1 | a352a93 | 2020-07-21 16:03:46 +0200 | [diff] [blame] | 99 | [Documentation] Test Suit Cleanup: Deleting Descriptor and instance |
| 100 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 101 | Run Keyword If Any Tests Failed Delete NS ${ns_name} |
| 102 | Run Keyword If Any Tests Failed Delete NSD ${nsd_name} |
| 103 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name1} |
| 104 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name2} |
| aguilarherna | 4de9096 | 2021-04-27 09:44:27 +0000 | [diff] [blame] | 105 | Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${new_nsd_pkg}' |
| 106 | |
| 107 | |
| 108 | Delete Temporary Descriptor Folder |
| 109 | [Documentation] Removes the temporary package folder created for the test |
| 110 | [Arguments] ${folder_name} |
| 111 | |
| 112 | ${rc} ${stdout}= Run and Return RC and Output rm -rf '${folder_name}' |
| 113 | log ${stdout} |
| 114 | |
| 115 | |