blob: 8dd7601b0ade1159eb2f9af038af3c10029cdf43 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
garciaaledce1fa82020-07-22 22:14:08 +00002# 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
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
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.
13
garciadeblas7a9e0312023-12-11 22:24:46 +010014
15*** Settings ***
16Documentation Library providing keywords for CRUD operations over Network Slice Templates with OSM client.
17Library OperatingSystem
18
19
garciaaledce1fa82020-07-22 22:14:08 +000020*** Variables ***
garciadeblas7a9e0312023-12-11 22:24:46 +010021${SUCCESS_RETURN_CODE} 0
garciaaledce1fa82020-07-22 22:14:08 +000022
23
24*** Keywords ***
25Create User
garciadeblas7a9e0312023-12-11 22:24:46 +010026 [Documentation] Create a user in OSM with the name and password passed as arguments, and return the user id.
garciaaledce1fa82020-07-22 22:14:08 +000027 [Arguments] ${user_name} ${user_password}
garciaaledce1fa82020-07-22 22:14:08 +000028 Should Not Be Empty ${user_name}
29 Should Not Be Empty ${user_password}
garciadeblas7a9e0312023-12-11 22:24:46 +010030 ${rc} ${stdout}= Run And Return Rc And Output osm user-create ${user_name} --password ${user_password}
garciaaledce1fa82020-07-22 22:14:08 +000031 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +010032 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
33 RETURN ${stdout}
garciaaledce1fa82020-07-22 22:14:08 +000034
selvi.j89d03cf2023-06-22 07:32:46 +000035Update User Password
garciadeblas7a9e0312023-12-11 22:24:46 +010036 [Documentation] Update the password of a user in OSM.
selvi.j89d03cf2023-06-22 07:32:46 +000037 [Arguments] ${user_name} ${user_password} ${user_new_password}
selvi.j89d03cf2023-06-22 07:32:46 +000038 Should Not Be Empty ${user_name}
39 Should Not Be Empty ${user_password}
40 Should Not Be Empty ${user_new_password}
garciadeblas7a9e0312023-12-11 22:24:46 +010041 ${rc} ${stdout}= Run And Return Rc And Output osm user-update ${user_name} --current-password ${user_password} --new-password ${user_new_password}
selvi.j89d03cf2023-06-22 07:32:46 +000042 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +010043 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
selvi.j89d03cf2023-06-22 07:32:46 +000044
garciaaledce1fa82020-07-22 22:14:08 +000045Update User Role
garciadeblas7a9e0312023-12-11 22:24:46 +010046 [Documentation] Update the role of a user in a project in OSM.
garciaaledce1fa82020-07-22 22:14:08 +000047 [Arguments] ${user_name} ${project_name} ${role_name}
garciaaledce1fa82020-07-22 22:14:08 +000048 Should Not Be Empty ${user_name}
49 Should Not Be Empty ${project_name}
50 Should Not Be Empty ${role_name}
garciadeblas7a9e0312023-12-11 22:24:46 +010051 ${rc} ${stdout}= Run And Return Rc And Output osm user-update --add-project-role '${project_name},${role_name}' ${user_name}
garciaaledce1fa82020-07-22 22:14:08 +000052 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +010053 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
garciaaledce1fa82020-07-22 22:14:08 +000054
55Check If User Exists
garciadeblas7a9e0312023-12-11 22:24:46 +010056 [Documentation] Check if a user exists in OSM.
garciadeblasf4ebaa82022-06-23 13:33:26 +020057 [Arguments] ${user_name}
garciaaledce1fa82020-07-22 22:14:08 +000058 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}"
60 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +010061 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
garciaaledce1fa82020-07-22 22:14:08 +000062
63Delete User
garciadeblas7a9e0312023-12-11 22:24:46 +010064 [Documentation] Delete from OSM the user passed as argument.
garciadeblasf4ebaa82022-06-23 13:33:26 +020065 [Arguments] ${user_name}
garciadeblas7a9e0312023-12-11 22:24:46 +010066 ${rc} ${stdout}= Run And Return Rc And Output osm user-delete ${user_name}
garciaaledce1fa82020-07-22 22:14:08 +000067 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +010068 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}