2 # Copyright 2019 Tech Mahindra Limited
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
20 # 1. Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 21-nov-2019
24 Documentation Test RBAC for platform using CRUD operations over users, projects and roles
25 Library OperatingSystem
28 Resource ../../lib/cli/rbac_lib.robot
30 #Suite Setup Configure NBI For RBAC
31 Suite Teardown Run Keyword And Ignore Error Test Cleanup
35 ${success_return_code} 0
36 # Test data for Users Operations test
38 &{update_field1} --set-project=admin,system_admin,project_admin #project,role1,role2...
39 &{update_field2} --add-project-role=admin,project_user #project,role1,role2...
40 &{update_field3} --add-project-role=service,account_manager #project,role1,role2...
41 @{update_user} ${update_field1} ${update_field2} ${update_field3}
42 # Test data for Project Operations test
43 ${project_id} ${EMPTY}
44 # Test data for Role Operations test
46 ${role_to_add} "vims: true"
51 [Documentation] Test RBAC using CRUD operation over users
52 [Tags] rabc rabc_users comprehensive
54 ${user-name}= Generate Random String 8 [NUMBERS]
55 ${user-name}= Catenate SEPARATOR= user_ ${user-name}
56 set global variable ${user-name}
57 ${user-password}= Generate Random String 8 [NUMBERS]
58 set global variable ${user-password}
59 ${user_id}= Create User ${user-name} ${user-password}
60 List User And Check For The Created User ${user-name}
61 Get User Info By Name ${user-name}
62 Get User Info By ID ${user_id}
63 Update User And Verify Info ${user-name} @{update_user}
64 Login With User And Perform Operation ${user-name} ${user-password} admin
65 Delete User And Check ${user-name}
68 Test Project Operatios
69 [Documentation] Test RBAC using CRUD operation over projects
70 [Tags] rabc rabc_projects comprehensive
72 ${project-name}= Generate Random String 8 [NUMBERS]
73 ${project-name}= Catenate SEPARATOR= project_ ${project-name}
74 set global variable ${project-name}
75 ${project_id}= Create Project ${project-name}
76 List Project And Verify ${project-name}
77 Get Project Info By Name ${project-name}
78 Get Project Info By ID ${project_id}
79 ${new-project-name}= Generate Random String 8 [NUMBERS]
80 ${new-project-name}= Catenate SEPARATOR= project_ ${new-project-name}
81 set global variable ${new-project-name}
82 Update Project Name And Verify ${project-name} ${new-project-name}
83 Delete Project And Verify ${new-project-name}
87 [Documentation] Test RBAC using CRUD operation over roles
88 [Tags] rabc rabc_roles comprehensive
90 ${role-name}= Generate Random String 8 [NUMBERS]
91 ${role-name}= Catenate SEPARATOR= project_ ${role-name}
92 set global variable ${role-name}
93 ${role_id}= Create Role ${role-name}
94 List Roles And Verify ${role-name}
95 Get Role Info By Name ${role-name}
96 Get Role Info By ID ${role_id}
97 Add Role And Verify ${role-name} ${role_to_add}
98 Delete Role And Verify ${role-name}
103 Delete User ${user-name}
104 Delete Project ${project-name}
105 Delete Project ${new-project-name}
106 Delete Role ${role-name}