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 Library providing keywords for CRUD operations over Network Slice Templates with OSM client.
17 Library OperatingSystem
21 ${SUCCESS_RETURN_CODE} 0
26 [Documentation] Create a user in OSM with the name and password passed as arguments, and return the user id.
27 [Arguments] ${user_name} ${user_password}
28 Should Not Be Empty ${user_name}
29 Should Not Be Empty ${user_password}
30 ${rc} ${stdout}= Run And Return Rc And Output osm user-create ${user_name} --password ${user_password}
32 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
36 [Documentation] Update the password of a user in OSM.
37 [Arguments] ${user_name} ${user_password} ${user_new_password}
38 Should Not Be Empty ${user_name}
39 Should Not Be Empty ${user_password}
40 Should Not Be Empty ${user_new_password}
41 ${rc} ${stdout}= Run And Return Rc And Output osm user-update ${user_name} --current-password ${user_password} --new-password ${user_new_password}
43 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
46 [Documentation] Update the role of a user in a project in OSM.
47 [Arguments] ${user_name} ${project_name} ${role_name}
48 Should Not Be Empty ${user_name}
49 Should Not Be Empty ${project_name}
50 Should Not Be Empty ${role_name}
51 ${rc} ${stdout}= Run And Return Rc And Output osm user-update --add-project-role '${project_name},${role_name}' ${user_name}
53 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
56 [Documentation] Check if a user exists in OSM.
57 [Arguments] ${user_name}
58 Should Not Be Empty ${user_name}
59 ${rc} ${stdout}= Run And Return RC And Output osm user-list | awk 'NR>3 {print $2}' | grep "${user_name}"
61 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
64 [Documentation] Delete from OSM the user passed as argument.
65 [Arguments] ${user_name}
66 ${rc} ${stdout}= Run And Return Rc And Output osm user-delete ${user_name}
68 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}