2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
16 Documentation [BASIC-15] RBAC Configurations.
18 Library OperatingSystem
22 Resource ../lib/user_lib.resource
23 Resource ../lib/project_lib.resource
24 Resource ../lib/role_lib.resource
26 Test Tags basic_15 cluster_main daily regression azure
28 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
32 # User, project and roles to use
33 ${USERNAME} basic_15_test_user
34 ${USER_PASSWORD} Basic_15_user_pass
35 ${USER_NEW_PASSWORD} Basic_15_new_pass
36 ${USER_ROLE} project_user
38 ${PROJECT_NAME} basic_15_test_project
39 ${NEW_PROJECT_NAME} basic_15_project_test
40 ${ROLE_NAME} test_role
41 ${SUCCESS_RETURN_CODE} 0
45 Create And Validate User
46 [Documentation] Create a user in OSM.
47 Create User ${USERNAME} ${USER_PASSWORD}
48 Check If User Exists ${USERNAME}
51 [Documentation] Assign a user to a project with a role
52 Update User Role ${USERNAME} ${USER_PROJECT} ${USER_ROLE}
53 Check If User Is Assigned To Project ${USERNAME} ${USER_PROJECT}
54 Check If User Has Role ${USERNAME} ${USER_ROLE} ${USER_PROJECT}
57 [Documentation] Update the password of the user.
58 Update User Password ${USERNAME} ${USER_PASSWORD} ${USER_NEW_PASSWORD}
59 ${rc} ${stdout}= Run And Return RC And Output OSM_USER=${USERNAME} OSM_PROJECT=${USER_PROJECT} OSM_PASSWORD=${USER_NEW_PASSWORD} osm ns-list
62 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
64 Create And Update Project
65 [Documentation] Create a project and update its name.
66 Create Project ${PROJECT_NAME}
67 Update Project Name ${PROJECT_NAME} ${NEW_PROJECT_NAME}
69 Create And Validate Role
70 [Documentation] Create a role and check that exists in OSM.
71 Create Role ${ROLE_NAME}
72 Check If Role Exists ${ROLE_NAME}
74 Update Role Information
75 [Documentation] Update a role with a capability.
76 Update Role ${ROLE_NAME} add='vims: true'
77 Check If Role Exists ${ROLE_NAME}
79 Delete Allocated Resources
80 [Documentation] Delete user, project and role.
82 Delete User ${USERNAME}
83 Delete Project ${NEW_PROJECT_NAME}
84 Delete Role ${ROLE_NAME}
89 [Documentation] Test Suite Cleanup: Deleting users, roles and projects.
90 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete User ${USERNAME}
91 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Role ${ROLE_NAME}
92 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${PROJECT_NAME}
93 Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${NEW_PROJECT_NAME}