blob: 4831fdc50abb50a4324dcfc6bd81fa01686b3a32 [file] [log] [blame]
garciaaledce1fa82020-07-22 22:14:08 +00001# 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 ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020014Documentation [BASIC-15] RBAC Configurations.
garciaaledce1fa82020-07-22 22:14:08 +000015
16Library OperatingSystem
17Library String
18Library Collections
19
20Resource %{ROBOT_DEVOPS_FOLDER}/lib/user_lib.robot
21Resource %{ROBOT_DEVOPS_FOLDER}/lib/project_lib.robot
22Resource %{ROBOT_DEVOPS_FOLDER}/lib/role_lib.robot
23
garciadeblas4cf45d72021-04-08 13:52:22 +020024Force Tags basic_15 cluster_main daily regression
25
garciadeblasd225e552020-10-02 16:10:14 +000026Suite Teardown Run Keyword And Ignore Error Suite Cleanup
garciaaledce1fa82020-07-22 22:14:08 +000027
28
29*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020030# User, project and roles to use
31${user_name} basic_15_test_user
garciadeblas7656da92023-06-20 10:54:33 +020032${user_password} Basic_15_user_pass
selvi.j89d03cf2023-06-22 07:32:46 +000033${user_new_password} Basic_15_new_pass
almagiab4697d32021-05-25 08:56:17 +020034${user_role} project_user
35${user_project} admin
36${project_name} basic_15_test_project
37${new_project_name} basic_15_project_test
38${role_name} test_role
garciaaledce1fa82020-07-22 22:14:08 +000039${success_return_code} 0
40
almagiab4697d32021-05-25 08:56:17 +020041
garciaaledce1fa82020-07-22 22:14:08 +000042*** Test Cases ***
43Create And Validate User
garciaaledce1fa82020-07-22 22:14:08 +000044
45 Create User ${user_name} ${user_password}
46 Check If User Exists ${user_name}
47
48
49Assign Role To User
garciaaledce1fa82020-07-22 22:14:08 +000050
garciadeblasf4ebaa82022-06-23 13:33:26 +020051 Update User Role ${user_name} ${user_project} ${user_role}
garciaaledce1fa82020-07-22 22:14:08 +000052 Check If User Is Assigned To Project ${user_name} ${user_project}
garciadeblasf4ebaa82022-06-23 13:33:26 +020053 Check If User Has Role ${user_name} ${user_role} ${user_project}
garciaaledce1fa82020-07-22 22:14:08 +000054
55
56Run Action As User
garciaaledce1fa82020-07-22 22:14:08 +000057
selvi.j89d03cf2023-06-22 07:32:46 +000058 Update User Password ${user_name} ${user_password} ${user_new_password}
59 ${rc} ${stdout}= Run And Return RC And Output OSM_USER=${user_name} OSM_PROJECT=${user_project} OSM_PASSWORD=${user_new_password} osm ns-list
garciaaledce1fa82020-07-22 22:14:08 +000060 Should Be Equal As Integers ${rc} ${success_return_code}
61
62
63Create And Update Project
garciaaledce1fa82020-07-22 22:14:08 +000064
65 Create Project ${project_name}
66 Update Project Name ${project_name} ${new_project_name}
67
68
69Create And Validate Role
garciaaledce1fa82020-07-22 22:14:08 +000070
71 Create Role ${role_name}
72 Check If Role Exists ${role_name}
73
74
75Update Role Information
garciaaledce1fa82020-07-22 22:14:08 +000076
77 Update Role ${role_name} add='vims: true'
78 Check If Role Exists ${role_name}
79
80
81Delete Allocated Resources
garciadeblas4cf45d72021-04-08 13:52:22 +020082 [Tags] cleanup
garciaaledce1fa82020-07-22 22:14:08 +000083
84 Delete User ${user_name}
85 Delete Project ${new_project_name}
86 Delete Role ${role_name}
87
88
89*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +000090Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +020091 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete User ${user_name}
92 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Role ${role_name}
93 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${project_name}
94 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${new_project_name}