blob: 4d45c776c76a29d48592787a9cb57b16a035255a [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
garciaaledce1fa82020-07-22 22:14:08 +00002# 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
garciadeblas7a9e0312023-12-11 22:24:46 +010014
garciaaledce1fa82020-07-22 22:14:08 +000015*** Settings ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020016Documentation [BASIC-15] RBAC Configurations.
garciaaledce1fa82020-07-22 22:14:08 +000017
18Library OperatingSystem
19Library String
20Library Collections
21
garciadeblas7a9e0312023-12-11 22:24:46 +010022Resource ../lib/user_lib.resource
23Resource ../lib/project_lib.resource
24Resource ../lib/role_lib.resource
garciaaledce1fa82020-07-22 22:14:08 +000025
garciadeblas7a9e0312023-12-11 22:24:46 +010026Test Tags basic_15 cluster_main daily regression azure
garciadeblas4cf45d72021-04-08 13:52:22 +020027
garciadeblasd225e552020-10-02 16:10:14 +000028Suite Teardown Run Keyword And Ignore Error Suite Cleanup
garciaaledce1fa82020-07-22 22:14:08 +000029
30
31*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020032# User, project and roles to use
garciadeblas7a9e0312023-12-11 22:24:46 +010033${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
garciaaledce1fa82020-07-22 22:14:08 +000042
almagiab4697d32021-05-25 08:56:17 +020043
garciaaledce1fa82020-07-22 22:14:08 +000044*** Test Cases ***
45Create And Validate User
garciadeblas7a9e0312023-12-11 22:24:46 +010046 [Documentation] Create a user in OSM.
47 Create User ${USERNAME} ${USER_PASSWORD}
48 Check If User Exists ${USERNAME}
garciaaledce1fa82020-07-22 22:14:08 +000049
50Assign Role To User
garciadeblas7a9e0312023-12-11 22:24:46 +010051 [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}
garciaaledce1fa82020-07-22 22:14:08 +000055
56Run Action As User
garciadeblas7a9e0312023-12-11 22:24:46 +010057 [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}
garciaaledce1fa82020-07-22 22:14:08 +000063
64Create And Update Project
garciadeblas7a9e0312023-12-11 22:24:46 +010065 [Documentation] Create a project and update its name.
66 Create Project ${PROJECT_NAME}
67 Update Project Name ${PROJECT_NAME} ${NEW_PROJECT_NAME}
garciaaledce1fa82020-07-22 22:14:08 +000068
69Create And Validate Role
garciadeblas7a9e0312023-12-11 22:24:46 +010070 [Documentation] Create a role and check that exists in OSM.
71 Create Role ${ROLE_NAME}
72 Check If Role Exists ${ROLE_NAME}
garciaaledce1fa82020-07-22 22:14:08 +000073
74Update Role Information
garciadeblas7a9e0312023-12-11 22:24:46 +010075 [Documentation] Update a role with a capability.
76 Update Role ${ROLE_NAME} add='vims: true'
77 Check If Role Exists ${ROLE_NAME}
garciaaledce1fa82020-07-22 22:14:08 +000078
79Delete Allocated Resources
garciadeblas7a9e0312023-12-11 22:24:46 +010080 [Documentation] Delete user, project and role.
garciadeblas4cf45d72021-04-08 13:52:22 +020081 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +010082 Delete User ${USERNAME}
83 Delete Project ${NEW_PROJECT_NAME}
84 Delete Role ${ROLE_NAME}
garciaaledce1fa82020-07-22 22:14:08 +000085
86
87*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +000088Suite Cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +010089 [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}