X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Ftests.git;a=blobdiff_plain;f=robot-systest%2Flib%2Fuser_lib.resource;fp=robot-systest%2Flib%2Fuser_lib.resource;h=8dd7601b0ade1159eb2f9af038af3c10029cdf43;hp=0000000000000000000000000000000000000000;hb=5e001f506b744021d5ef25999c9da28cf56d8fbc;hpb=b0db4577db692b0d6c9210099c58c808cbc993c1 diff --git a/robot-systest/lib/user_lib.resource b/robot-systest/lib/user_lib.resource new file mode 100644 index 0000000..8dd7601 --- /dev/null +++ b/robot-systest/lib/user_lib.resource @@ -0,0 +1,68 @@ +*** 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}