Moving robot-systests deprecated to tests
[osm/tests.git] / robot-systest / deprecated / testsuite / cli / TS011__Feature_1415_RBAC_For_Platform_Test.robot
1 ##
2 # Copyright 2019 Tech Mahindra Limited
3 #
4 # All Rights Reserved.
5 #
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
9 #
10 #         http://www.apache.org/licenses/LICENSE-2.0
11 #
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
16 # under the License.
17 ##
18
19 ## Change log:
20 # 1. Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 21-nov-2019
21 ##
22
23 *** Settings ***
24 Documentation    Test RBAC for platform using CRUD operations over users, projects and roles
25 Library     OperatingSystem
26 Library     String
27 Library     Collections
28 Resource    ../../lib/cli/rbac_lib.robot
29
30 #Suite Setup    Configure NBI For RBAC
31 Suite Teardown  Run Keyword And Ignore Error    Test Cleanup
32
33
34 *** Variables ***
35 ${success_return_code}    0
36 # Test data for Users Operations test
37 ${user_id}    ${EMPTY}
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
45 ${role_id}    ${EMPTY}
46 ${role_to_add}    "vims: true"
47
48
49 *** Test Cases ***
50 Test User Operations
51     [Documentation]  Test RBAC using CRUD operation over users
52     [Tags]  rabc    rabc_users    comprehensive
53
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}
66
67
68 Test Project Operatios
69     [Documentation]  Test RBAC using CRUD operation over projects
70     [Tags]  rabc    rabc_projects    comprehensive
71
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}
84
85
86 Test Role Operations
87     [Documentation]  Test RBAC using CRUD operation over roles
88     [Tags]  rabc    rabc_roles    comprehensive
89
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}
99
100
101 *** Keywords ***
102 Test Cleanup
103     Delete User    ${user-name}
104     Delete Project    ${project-name}
105     Delete Project    ${new-project-name}
106     Delete Role    ${role-name}