blob: 8dd7601b0ade1159eb2f9af038af3c10029cdf43 [file] [log] [blame]
*** Comments ***
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*** Settings ***
Documentation Library providing keywords for CRUD operations over Network Slice Templates with OSM client.
Library OperatingSystem
*** Variables ***
${SUCCESS_RETURN_CODE} 0
*** Keywords ***
Create User
[Documentation] Create a user in OSM with the name and password passed as arguments, and return the user id.
[Arguments] ${user_name} ${user_password}
Should Not Be Empty ${user_name}
Should Not Be Empty ${user_password}
${rc} ${stdout}= Run And Return Rc And Output osm user-create ${user_name} --password ${user_password}
Log ${stdout}
Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
RETURN ${stdout}
Update User Password
[Documentation] Update the password of a user in OSM.
[Arguments] ${user_name} ${user_password} ${user_new_password}
Should Not Be Empty ${user_name}
Should Not Be Empty ${user_password}
Should Not Be Empty ${user_new_password}
${rc} ${stdout}= Run And Return Rc And Output osm user-update ${user_name} --current-password ${user_password} --new-password ${user_new_password}
Log ${stdout}
Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
Update User Role
[Documentation] Update the role of a user in a project in OSM.
[Arguments] ${user_name} ${project_name} ${role_name}
Should Not Be Empty ${user_name}
Should Not Be Empty ${project_name}
Should Not Be Empty ${role_name}
${rc} ${stdout}= Run And Return Rc And Output osm user-update --add-project-role '${project_name},${role_name}' ${user_name}
Log ${stdout}
Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
Check If User Exists
[Documentation] Check if a user exists in OSM.
[Arguments] ${user_name}
Should Not Be Empty ${user_name}
${rc} ${stdout}= Run And Return RC And Output osm user-list | awk 'NR>3 {print $2}' | grep "${user_name}"
Log ${stdout}
Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
Delete User
[Documentation] Delete from OSM the user passed as argument.
[Arguments] ${user_name}
${rc} ${stdout}= Run And Return Rc And Output osm user-delete ${user_name}
Log ${stdout}
Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}