| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 | # you may not use this file except in compliance with the License. |
| 3 | # You may obtain a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | # See the License for the specific language governing permissions and |
| 11 | # limitations under the License. |
| 12 | |
| 13 | *** Variables *** |
| 14 | ${success_return_code} 0 |
| 15 | |
| 16 | |
| 17 | *** Keywords *** |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 18 | Create Project |
| 19 | [Arguments] ${project_name} |
| 20 | |
| 21 | Should Not Be Empty ${project_name} |
| 22 | ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project_name} |
| 23 | Log ${stdout} |
| 24 | Should Be Equal As Integers ${rc} ${success_return_code} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 25 | [Return] ${stdout} |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 26 | |
| 27 | |
| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 28 | Create Project With Quotas |
| 29 | [Arguments] ${project_name} ${project_quotas} |
| 30 | |
| 31 | Should Not Be Empty ${project_name} |
| 32 | Should Not Be Empty ${project_quotas} |
| 33 | ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project_name} --quotas ${project_quotas} |
| 34 | Log ${stdout} |
| 35 | Should Be Equal As Integers ${rc} ${success_return_code} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 36 | [Return] ${stdout} |
| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 37 | |
| 38 | |
| 39 | Get Project Quotas |
| 40 | [Arguments] ${project_name} ${quotas_name} |
| 41 | |
| 42 | Should Not Be Empty ${project_name} |
| 43 | Should Not Be Empty ${quotas_name} |
| 44 | ${rc} ${stdout}= Run and Return RC and Output osm project-show ${project_name} | grep '${quotas_name}' | awk -F ',|: ' '{print $2}' | awk '{print $1}' |
| 45 | Log ${stdout} |
| 46 | Should Be Equal As Integers ${rc} ${success_return_code} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 47 | [Return] ${stdout} |
| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 48 | |
| 49 | |
| 50 | Update Project Quotas |
| 51 | [Arguments] ${project_name} ${project_quotas} |
| 52 | |
| 53 | Should Not Be Empty ${project_name} |
| 54 | Should Not Be Empty ${project_quotas} |
| 55 | ${rc} ${stdout}= Run and Return RC and Output osm project-update ${project_name} --quotas ${project_quotas} |
| 56 | Log ${stdout} |
| 57 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 58 | |
| 59 | |
| 60 | Update Project Name |
| 61 | [Arguments] ${project_name} ${new_name} |
| 62 | |
| 63 | Should Not Be Empty ${project_name} |
| 64 | Should Not Be Empty ${new_name} |
| 65 | ${rc} ${stdout}= Run and Return RC and Output osm project-update ${project_name} --name ${new_name} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 66 | Log ${stdout} |
| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 67 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 68 | |
| 69 | |
| 70 | Check If User Is Assigned To Project |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 71 | [Arguments] ${user_name} ${project_name} |
| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 72 | |
| 73 | Should Not Be Empty ${user_name} |
| 74 | Should Not Be Empty ${project_name} |
| 75 | ${rc} ${stdout}= Run And Return RC And Output osm user-show ${user_name} | grep "project_name" | grep "${project_name}" |
| 76 | Log ${stdout} |
| 77 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 78 | |
| 79 | |
| 80 | Create VNFD In Project |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 81 | [Documentation] Onboards a VNFD package into an OSM project. |
| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 82 | ... Extra parameters (such as 'override') are given to this function in name=value format. These parameters will be appended to the 'osm vnfpkg-create' command with the next syntax: --param_name=param_value |
| 83 | |
| 84 | [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password} @{optional_parameters} |
| 85 | |
| 86 | Should Not Be Empty ${project_name} |
| 87 | Should Not Be Empty ${vnfd_pkg} |
| 88 | Should Not Be Empty ${project_user} |
| 89 | Should Not Be Empty ${user_password} |
| 90 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 91 | ${osm_pkg_create_command}= Set Variable osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-create ${vnfd_pkg} |
| 92 | FOR ${param} IN @{optional_parameters} |
| 93 | ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters |
| 94 | ${osm_pkg_create_command}= Catenate ${osm_pkg_create_command} --${param_name}=${param_value} |
| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 95 | END |
| 96 | |
| 97 | ${rc} ${stdout}= Run and Return RC and Output ${osm_pkg_create_command} |
| 98 | Log ${stdout} |
| 99 | Should Be Equal As Integers ${rc} ${success_return_code} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 100 | [Return] ${stdout} |
| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 101 | |
| 102 | |
| 103 | Delete VNFD In Project |
| 104 | [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password} |
| 105 | |
| 106 | Should Not Be Empty ${project_name} |
| 107 | Should Not Be Empty ${vnfd_pkg} |
| 108 | Should Not Be Empty ${project_user} |
| 109 | Should Not Be Empty ${user_password} |
| 110 | ${rc} ${stdout}= Run and Return RC and Output osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-delete ${vnfd_pkg} |
| 111 | Log ${stdout} |
| 112 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 113 | |
| 114 | |
| 115 | Remove User From Project |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 116 | [Arguments] ${user_name} ${project_name} |
| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 117 | |
| 118 | Should Not Be Empty ${user_name} |
| 119 | Should Not Be Empty ${project_name} |
| 120 | ${rc} ${stdout}= Run And Return RC And Output osm user-update ${user_name} --remove-project ${project_name} |
| 121 | Log ${stdout} |
| 122 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 123 | |
| 124 | |
| 125 | Delete Project |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 126 | [Arguments] ${project_name} |
| garciaale | da7fdb4 | 2020-07-17 17:24:54 -0400 | [diff] [blame] | 127 | |
| 128 | ${rc} ${stdout}= Run and Return RC and Output osm project-delete ${project_name} |
| 129 | Log ${stdout} |
| 130 | Should Be Equal As Integers ${rc} ${success_return_code} |