blob: a0341ebe28aab2a110c065f3a9ad9f8c491de1d9 [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
almagiab4697d32021-05-25 08:56:17 +020033${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
garciaaledce1fa82020-07-22 22:14:08 +000038${success_return_code} 0
39
almagiab4697d32021-05-25 08:56:17 +020040
garciaaledce1fa82020-07-22 22:14:08 +000041*** Test Cases ***
42Create And Validate User
garciaaledce1fa82020-07-22 22:14:08 +000043
44 Create User ${user_name} ${user_password}
45 Check If User Exists ${user_name}
46
47
48Assign Role To User
garciaaledce1fa82020-07-22 22:14:08 +000049
garciadeblasf4ebaa82022-06-23 13:33:26 +020050 Update User Role ${user_name} ${user_project} ${user_role}
garciaaledce1fa82020-07-22 22:14:08 +000051 Check If User Is Assigned To Project ${user_name} ${user_project}
garciadeblasf4ebaa82022-06-23 13:33:26 +020052 Check If User Has Role ${user_name} ${user_role} ${user_project}
garciaaledce1fa82020-07-22 22:14:08 +000053
54
55Run Action As User
garciaaledce1fa82020-07-22 22:14:08 +000056
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
61Create And Update Project
garciaaledce1fa82020-07-22 22:14:08 +000062
63 Create Project ${project_name}
64 Update Project Name ${project_name} ${new_project_name}
65
66
67Create And Validate Role
garciaaledce1fa82020-07-22 22:14:08 +000068
69 Create Role ${role_name}
70 Check If Role Exists ${role_name}
71
72
73Update Role Information
garciaaledce1fa82020-07-22 22:14:08 +000074
75 Update Role ${role_name} add='vims: true'
76 Check If Role Exists ${role_name}
77
78
79Delete Allocated Resources
garciadeblas4cf45d72021-04-08 13:52:22 +020080 [Tags] cleanup
garciaaledce1fa82020-07-22 22:14:08 +000081
82 Delete User ${user_name}
83 Delete Project ${new_project_name}
84 Delete Role ${role_name}
85
86
87*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +000088Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +020089 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}