| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [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 | *** Settings *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 14 | Documentation [BASIC-15] RBAC Configurations. |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 15 | |
| 16 | Library OperatingSystem |
| 17 | Library String |
| 18 | Library Collections |
| 19 | |
| 20 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/user_lib.robot |
| 21 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/project_lib.robot |
| 22 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/role_lib.robot |
| 23 | |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 24 | Force Tags basic_15 cluster_main daily regression |
| 25 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 26 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 27 | |
| 28 | |
| 29 | *** Variables *** |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 30 | # User, project and roles to use |
| 31 | ${user_name} basic_15_test_user |
| garciadeblas | 7656da9 | 2023-06-20 10:54:33 +0200 | [diff] [blame^] | 32 | ${user_password} Basic_15_user_pass |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 33 | ${user_role} project_user |
| 34 | ${user_project} admin |
| 35 | ${project_name} basic_15_test_project |
| 36 | ${new_project_name} basic_15_project_test |
| 37 | ${role_name} test_role |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 38 | ${success_return_code} 0 |
| 39 | |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 40 | |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 41 | *** Test Cases *** |
| 42 | Create And Validate User |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 43 | |
| 44 | Create User ${user_name} ${user_password} |
| 45 | Check If User Exists ${user_name} |
| 46 | |
| 47 | |
| 48 | Assign Role To User |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 49 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 50 | Update User Role ${user_name} ${user_project} ${user_role} |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 51 | Check If User Is Assigned To Project ${user_name} ${user_project} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 52 | Check If User Has Role ${user_name} ${user_role} ${user_project} |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 53 | |
| 54 | |
| 55 | Run Action As User |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 56 | |
| 57 | ${rc} ${stdout}= Run And Return RC And Output OSM_USER=${user_name} OSM_PROJECT=${user_project} OSM_PASSWORD=${user_password} osm ns-list |
| 58 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 59 | |
| 60 | |
| 61 | Create And Update Project |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 62 | |
| 63 | Create Project ${project_name} |
| 64 | Update Project Name ${project_name} ${new_project_name} |
| 65 | |
| 66 | |
| 67 | Create And Validate Role |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 68 | |
| 69 | Create Role ${role_name} |
| 70 | Check If Role Exists ${role_name} |
| 71 | |
| 72 | |
| 73 | Update Role Information |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 74 | |
| 75 | Update Role ${role_name} add='vims: true' |
| 76 | Check If Role Exists ${role_name} |
| 77 | |
| 78 | |
| 79 | Delete Allocated Resources |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 80 | [Tags] cleanup |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 81 | |
| 82 | Delete User ${user_name} |
| 83 | Delete Project ${new_project_name} |
| 84 | Delete Role ${role_name} |
| 85 | |
| 86 | |
| 87 | *** Keywords *** |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 88 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 89 | Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete User ${user_name} |
| 90 | Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Role ${role_name} |
| 91 | Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${project_name} |
| 92 | Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${new_project_name} |