| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 1 | *** Comments *** |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 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 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 14 | |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 15 | *** Settings *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 16 | Documentation [BASIC-15] RBAC Configurations. |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 17 | |
| 18 | Library OperatingSystem |
| 19 | Library String |
| 20 | Library Collections |
| 21 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 22 | Resource ../lib/user_lib.resource |
| 23 | Resource ../lib/project_lib.resource |
| 24 | Resource ../lib/role_lib.resource |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 25 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 26 | Test Tags basic_15 cluster_main daily regression azure |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 27 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 28 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 29 | |
| 30 | |
| 31 | *** Variables *** |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 32 | # User, project and roles to use |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 33 | ${USERNAME} basic_15_test_user |
| 34 | ${USER_PASSWORD} Basic_15_user_pass |
| 35 | ${USER_NEW_PASSWORD} Basic_15_new_pass |
| 36 | ${USER_ROLE} project_user |
| 37 | ${USER_PROJECT} admin |
| 38 | ${PROJECT_NAME} basic_15_test_project |
| 39 | ${NEW_PROJECT_NAME} basic_15_project_test |
| 40 | ${ROLE_NAME} test_role |
| 41 | ${SUCCESS_RETURN_CODE} 0 |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 42 | |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 43 | |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 44 | *** Test Cases *** |
| 45 | Create And Validate User |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 46 | [Documentation] Create a user in OSM. |
| 47 | Create User ${USERNAME} ${USER_PASSWORD} |
| 48 | Check If User Exists ${USERNAME} |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 49 | |
| 50 | Assign Role To User |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 51 | [Documentation] Assign a user to a project with a role |
| 52 | Update User Role ${USERNAME} ${USER_PROJECT} ${USER_ROLE} |
| 53 | Check If User Is Assigned To Project ${USERNAME} ${USER_PROJECT} |
| 54 | Check If User Has Role ${USERNAME} ${USER_ROLE} ${USER_PROJECT} |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 55 | |
| 56 | Run Action As User |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 57 | [Documentation] Update the password of the user. |
| 58 | Update User Password ${USERNAME} ${USER_PASSWORD} ${USER_NEW_PASSWORD} |
| 59 | ${rc} ${stdout}= Run And Return RC And Output OSM_USER=${USERNAME} OSM_PROJECT=${USER_PROJECT} OSM_PASSWORD=${USER_NEW_PASSWORD} osm ns-list |
| 60 | Log ${rc} |
| 61 | Log ${stdout} |
| 62 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 63 | |
| 64 | Create And Update Project |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 65 | [Documentation] Create a project and update its name. |
| 66 | Create Project ${PROJECT_NAME} |
| 67 | Update Project Name ${PROJECT_NAME} ${NEW_PROJECT_NAME} |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 68 | |
| 69 | Create And Validate Role |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 70 | [Documentation] Create a role and check that exists in OSM. |
| 71 | Create Role ${ROLE_NAME} |
| 72 | Check If Role Exists ${ROLE_NAME} |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 73 | |
| 74 | Update Role Information |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 75 | [Documentation] Update a role with a capability. |
| 76 | Update Role ${ROLE_NAME} add='vims: true' |
| 77 | Check If Role Exists ${ROLE_NAME} |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 78 | |
| 79 | Delete Allocated Resources |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 80 | [Documentation] Delete user, project and role. |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 81 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 82 | Delete User ${USERNAME} |
| 83 | Delete Project ${NEW_PROJECT_NAME} |
| 84 | Delete Role ${ROLE_NAME} |
| garciaale | dce1fa8 | 2020-07-22 22:14:08 +0000 | [diff] [blame] | 85 | |
| 86 | |
| 87 | *** Keywords *** |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 88 | Suite Cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 89 | [Documentation] Test Suite Cleanup: Deleting users, roles and projects. |
| 90 | Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete User ${USERNAME} |
| 91 | Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Role ${ROLE_NAME} |
| 92 | Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${PROJECT_NAME} |
| 93 | Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${NEW_PROJECT_NAME} |