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 Configure NBI For RBAC
25 ${rc} ${stdout}= Run and Return RC and Output docker service update osm_nbi --force --env-add OSMNBI_AUTHENTICATION_BACKEND=keystone --env-add OSMNBI_AUTHENTICATION_AUTH_URL=keystone --env-add OSMNBI_AUTHENTICATION_AUTH_PORT=5000 --env-add OSMNBI_AUTHENTICATION_USER_DOMAIN_NAME=default --env-add OSMNBI_AUTHENTICATION_PROJECT_DOMAIN_NAME=default --env-add OSMNBI_AUTHENTICATION_SERVICE_USERNAME=nbi --env-add OSMNBI_AUTHENTICATION_SERVICE_PROJECT=service
26 Should Be Equal As Integers ${rc} ${success_return_code}
27 Sleep 30s Wait for NBI service to be update
31 [Arguments] ${user} ${password}
33 ${rc} ${stdout}= Run and Return RC and Output osm user-create ${user} --password ${password}
34 Should Be Equal As Integers ${rc} ${success_return_code}
40 ${rc} ${stdout}= Run and Return RC and Output osm user-list
41 Should Be Equal As Integers ${rc} ${success_return_code}
46 List User And Check For The Created User
48 ${user list}= List User
49 Should Contain ${user list} ${user}
53 [Arguments] ${user_name}
54 ${rc} ${stdout}= Run and Return RC and Output osm user-show ${user_name}
55 Should Be Equal As Integers ${rc} ${success_return_code}
60 [Arguments] ${user_id}
61 ${rc} ${stdout}= Run and Return RC and Output osm user-show ${user_id}
62 Should Be Equal As Integers ${rc} ${success_return_code}
67 [Arguments] ${user} ${field} ${value}
68 ${rc} ${stdout}= Run and Return RC and Output osm user-update ${field} ${value} ${user}
69 Should Be Equal As Integers ${rc} ${success_return_code}
73 Update User And Verify Info
74 [Arguments] ${user} @{args}
76 ${fields}= Get Dictionary Items ${arg}
77 Update User ${user} ${fields[0]} ${fields[1]}
79 ${rc} ${stdout}= Run and Return RC and Output osm user-show ${user}
80 Should Be Equal As Integers ${rc} ${success_return_code}
84 Login With User And Perform Operation
85 [Arguments] ${user} ${password} ${project}
86 ${rc} ${stdout}= Run and Return RC and Output export OSM_USER=${user}
87 Should Be Equal As Integers ${rc} ${success_return_code}
88 ${rc} ${stdout}= Run and Return RC and Output export OSM_PROJECT=${project}
89 Should Be Equal As Integers ${rc} ${success_return_code}
90 ${rc} ${stdout}= Run and Return RC and Output export OSM_PASSWORD=${password}
91 Should Be Equal As Integers ${rc} ${success_return_code}
92 ${rc} ${stdout}= Run and Return RC and Output osm ns-list
93 Should Be Equal As Integers ${rc} ${success_return_code}
95 Logout and Login With Admin
98 Logout and Login With Admin
99 ${rc} ${stdout}= Run and Return RC and Output export OSM_USER=admin
100 Should Be Equal As Integers ${rc} ${success_return_code}
101 ${rc} ${stdout}= Run and Return RC and Output export OSM_PASSWORD=admin
102 Should Be Equal As Integers ${rc} ${success_return_code}
103 ${rc} ${stdout}= Run and Return RC and Output osm ns-list
104 Should Be Equal As Integers ${rc} ${success_return_code}
109 ${rc} ${stdout}= Run and Return RC and Output osm user-delete ${user}
110 Should Be Equal As Integers ${rc} ${success_return_code}
113 Delete User And Check
116 ${rc} ${stdout}= Run and Return RC and Output osm user-list
117 Should Be Equal As Integers ${rc} ${success_return_code}
118 Should Not Contain ${stdout} ${user}
122 [Arguments] ${project}
123 ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project}
124 Should Be Equal As Integers ${rc} ${success_return_code}
130 ${rc} ${stdout}= Run and Return RC and Output osm project-list
131 Should Be Equal As Integers ${rc} ${success_return_code}
136 List Project And Verify
137 [Arguments] ${project}
138 ${project list}= List Project
139 Should Contain ${project list} ${project}
142 Get Project Info By Name
143 [Arguments] ${project_name}
144 ${rc} ${stdout}= Run and Return RC and Output osm project-show ${project_name}
145 Should Be Equal As Integers ${rc} ${success_return_code}
150 Get Project Info By ID
151 [Arguments] ${project_id}
152 ${rc} ${stdout}= Run and Return RC and Output osm project-show ${project_id}
153 Should Be Equal As Integers ${rc} ${success_return_code}
159 [Arguments] ${project} ${feild} ${value}
160 ${rc} ${stdout}= Run and Return RC and Output osm project-update ${feild} ${value} ${project}
161 Should Be Equal As Integers ${rc} ${success_return_code}
165 Update Project Name And Verify
166 [Arguments] ${old_name} ${new_name}
167 Update Project ${old_name} --name ${new_name}
168 List Project And Verify ${new_name}
172 [Arguments] ${project}
173 ${rc} ${stdout}= Run and Return RC and Output osm project-delete ${project}
174 Should Be Equal As Integers ${rc} ${success_return_code}
177 Delete Project And Verify
178 [Arguments] ${project}
179 Delete Project ${project}
180 ${project_list}= List Project
181 Should Not Contain ${project_list} ${project}
186 ${rc} ${stdout}= Run and Return RC and Output osm role-create ${role}
187 Should Be Equal As Integers ${rc} ${success_return_code}
193 ${rc} ${stdout}= Run and Return RC and Output osm role-list
194 Should Be Equal As Integers ${rc} ${success_return_code}
199 List Roles And Verify
201 ${role_list}= List Roles
202 Should Contain ${role_list} ${role}
205 Get Role Info By Name
207 ${rc} ${stdout}= Run and Return RC and Output osm role-show ${role}
208 Should Be Equal As Integers ${rc} ${success_return_code}
214 [Arguments] ${role_id}
215 ${rc} ${stdout}= Run and Return RC and Output osm role-show ${role_id}
216 Should Be Equal As Integers ${rc} ${success_return_code}
222 [Arguments] ${role} ${feild} ${value}
223 ${rc} ${stdout}= Run and Return RC and Output osm role-update ${feild} ${value} ${role}
224 Should Be Equal As Integers ${rc} ${success_return_code}
229 [Arguments] ${role} ${role_to_add}
230 Update Role ${role} --add ${role_to_add}
231 ${role_info}= Get Role Info By Name ${role}
232 # Should Contain ${role_info} ${role_to_add}
237 ${rc} ${stdout}= Run and Return RC and Output osm role-delete ${role}
238 Should Be Equal As Integers ${rc} ${success_return_code}
241 Delete Role And Verify
244 ${role_list}= List Roles
245 Should Not Contain ${role_list} ${role}