blob: 55e011364f80a0498cf6e3ecff8f213656db9b76 [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 ***
14Documentation [BASIC-15] RBAC Configurations.
15
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
aguilarhernac0b3a8e2021-05-12 08:56:23 +000024Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_15-rbac_configurations_data.py
25
garciadeblas4cf45d72021-04-08 13:52:22 +020026Force Tags basic_15 cluster_main daily regression
27
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 ***
32${success_return_code} 0
33
34*** Test Cases ***
35Create And Validate User
garciaaledce1fa82020-07-22 22:14:08 +000036
37 Create User ${user_name} ${user_password}
38 Check If User Exists ${user_name}
39
40
41Assign Role To User
garciaaledce1fa82020-07-22 22:14:08 +000042
43 Update User Role ${user_name} ${user_project} ${user_role}
44 Check If User Is Assigned To Project ${user_name} ${user_project}
45 Check If User Has Role ${user_name} ${user_role} ${user_project}
46
47
48Run Action As User
garciaaledce1fa82020-07-22 22:14:08 +000049
50 ${rc} ${stdout}= Run And Return RC And Output OSM_USER=${user_name} OSM_PROJECT=${user_project} OSM_PASSWORD=${user_password} osm ns-list
51 Should Be Equal As Integers ${rc} ${success_return_code}
52
53
54Create And Update Project
garciaaledce1fa82020-07-22 22:14:08 +000055
56 Create Project ${project_name}
57 Update Project Name ${project_name} ${new_project_name}
58
59
60Create And Validate Role
garciaaledce1fa82020-07-22 22:14:08 +000061
62 Create Role ${role_name}
63 Check If Role Exists ${role_name}
64
65
66Update Role Information
garciaaledce1fa82020-07-22 22:14:08 +000067
68 Update Role ${role_name} add='vims: true'
69 Check If Role Exists ${role_name}
70
71
72Delete Allocated Resources
garciadeblas4cf45d72021-04-08 13:52:22 +020073 [Tags] cleanup
garciaaledce1fa82020-07-22 22:14:08 +000074
75 Delete User ${user_name}
76 Delete Project ${new_project_name}
77 Delete Role ${role_name}
78
79
80*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +000081Suite Cleanup
82 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete User ${user_name}
83 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Role ${role_name}
84 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${project_name}
85 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${new_project_name}