blob: 56cddc0acab0ac22bae5f8cd83d1d685f99e6f8a [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
24Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_15-rbac_configurations_data.py
25
26Suite Teardown Run Keyword And Ignore Error Test Cleanup
27
28
29*** Variables ***
30${success_return_code} 0
31
32*** Test Cases ***
33Create And Validate User
34 [Tags] rbac_configurations sanity regression
35
36 Create User ${user_name} ${user_password}
37 Check If User Exists ${user_name}
38
39
40Assign Role To User
41 [Tags] rbac_configurations sanity regression
42
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
49 [Tags] rbac_configurations sanity regression
50
51 ${rc} ${stdout}= Run And Return RC And Output OSM_USER=${user_name} OSM_PROJECT=${user_project} OSM_PASSWORD=${user_password} osm ns-list
52 Should Be Equal As Integers ${rc} ${success_return_code}
53
54
55Create And Update Project
56 [Tags] rbac_configurations sanity regression
57
58 Create Project ${project_name}
59 Update Project Name ${project_name} ${new_project_name}
60
61
62Create And Validate Role
63 [Tags] rbac_configurations sanity regression
64
65 Create Role ${role_name}
66 Check If Role Exists ${role_name}
67
68
69Update Role Information
70 [Tags] rbac_configurations sanity regression
71
72 Update Role ${role_name} add='vims: true'
73 Check If Role Exists ${role_name}
74
75
76Delete Allocated Resources
77 [Tags] rbac_configurations sanity regression cleanup
78
79 Delete User ${user_name}
80 Delete Project ${new_project_name}
81 Delete Role ${role_name}
82
83
84*** Keywords ***
85Test Cleanup
86 Run Keyword If Test Failed Run Keyword And Ignore Error Delete User ${user_name}
87 Run Keyword If Test Failed Run Keyword And Ignore Error Delete Role ${role_name}
88 Run Keyword If Test Failed Run Keyword And Ignore Error Delete Project ${project_name}
89 Run Keyword If Test Failed Run Keyword And Ignore Error Delete Project ${new_project_name}