blob: 92cddb22ae03b3309d665ad2174a641dcf12632d [file] [log] [blame]
manashsarma148e36c2021-08-16 07:15:18 -05001*** Settings ***
2Documentation This suite is to test service user login functionality.
3... This test expects SERVICE_FILE_PATH, PRODUCTION_KEY_FILE_PATH and
4... SERVICE_USER_PASSWORD to be provided.
5...
6... Execution Method :
7... python -m robot -v OPENBMC_HOST:<hostname> -v SERVICE_FILE_PATH:<service file path>
8... -v PRODUCTION_KEY_FILE_PATH:<production key file path>
9... -v SERVICE_USER_PASSWORD:<service user password>
10... openpower/service_account/test_service_login.robot
11
12Resource ../../lib/connection_client.robot
13Resource ../../lib/openbmc_ffdc.robot
14Resource ../../lib/bmc_redfish_utils.robot
15
16Library SSHLibrary
17
18Suite Setup Suite Setup Execution
19Test Teardown FFDC On Test Case Fail
20
21
22*** Variables ***
23
24${acf_dir} /etc/acf
25
26*** Test Cases ***
27
28Verify Service User Login With Valid ACF file
29 [Documentation] Verify service user login with valid ACF file.
30 [Tags] Verify_Service_User_Login_With_Valid_ACF_file
31
32 Upload Valid ACF
33 Redfish.Login service ${SERVICE_USER_PASSWORD}
34
35
36Verify Service User Login Without ACF file
37 [Documentation] Verify service user login without ACF file.
38 [Tags] Verify_Service_User_Login_Without_ACF_file
39
40 Remove Existing ACF
41 Run Keyword And Expect Error InvalidCredentialsError*
42 ... Redfish.Login service ${SERVICE_USER_PASSWORD}
43
44
manashsarmae7b973f2021-08-20 06:49:32 -050045Verify Service Login Failure With Expired ACF
46 [Documentation] Verify service user login failure with expired ACF.
47 [Tags] Verify_Service_Login_Failure_With_Expired_ACF
48 [Setup] Valid Value EXPIRED_SERVICE_FILE_PATH
49
50 Remove Existing ACF
51 Open Connection for SCP
52 scp.Put File ${EXPIRED_SERVICE_FILE_PATH} ${acf_dir}
53 Run Keyword And Expect Error InvalidCredentialsError*
manashsarma75b58fe2021-08-20 09:01:32 -050054 ... Redfish.Login service ${SERVICE_USER_PASSWORD}
55
56
57Verify Service Login Failure With Incorrect Password
58 [Documentation] Verify service login failure with incorrect password.
59 [Tags] Verify_Service_Login_Failure_With_Incorrect_Password
60
61 Remove Existing ACF
62 Upload Valid ACF
63 ${incorrect_service_password} = Catenate SEPARATOR= ${SERVICE_USER_PASSWORD} 123
64 Run Keyword And Expect Error InvalidCredentialsError*
65 ... Redfish.Login service ${incorrect_service_password}
manashsarmae7b973f2021-08-20 06:49:32 -050066
67
manashsarma99eb1082021-09-21 09:30:06 -050068Verify SSH Login Access With Service User
69 [Documentation] Verify SSH login access with service user.
70 [Tags] Verify_SSH_Login_Access_With_Service_User
71 [Setup] Remove Existing ACF AND Upload Valid ACF
72
73 # Attempt SSH login with service user.
74 SSHLibrary.Open Connection ${OPENBMC_HOST}
75 ${status}= Run Keyword And Return Status SSHLibrary.Login service ${SERVICE_USER_PASSWORD}
76 Should Be Equal ${status} ${True}
77
78
manashsarma9f0eff42021-09-22 09:12:41 -050079Verify SSH Login Failure With Incorrect Service User Password
80 [Documentation] Verify SSH login failure with incorrect service user password.
81 [Tags] Verify_SSH_Login_Failure_With_Incorrect_Service_User_Password
82 [Setup] Remove Existing ACF AND Upload Valid ACF
83
84 # Attempt SSH login with service user.
85 SSHLibrary.Open Connection ${OPENBMC_HOST}
86 # Attempt login with invalid password
87 ${status}= Run Keyword And Return Status SSHLibrary.Login service ${SERVICE_USER_PASSWORD}123
88 Should Be Equal ${status} ${False}
89
90
manashsarma148e36c2021-08-16 07:15:18 -050091*** Keywords ***
92
93Suite Setup Execution
94 [Documentation] Do suite setup tasks.
95
96 # Upload production key in BMC because it is not part of OpenBMC build yet.
manashsarmae7b973f2021-08-20 06:49:32 -050097 Open Connection for SCP
manashsarma148e36c2021-08-16 07:15:18 -050098 scp.Put File ${PRODUCTION_KEY_FILE_PATH} ${acf_dir}
99
100
101Remove Existing ACF
102 [Documentation] Remove existing ACF.
103
104 BMC Execute Command rm -f ${acf_dir}/*.acf
105
manashsarma148e36c2021-08-16 07:15:18 -0500106Upload Valid ACF
107 [Documentation] Upload valid ACF.
108
109 Run Keywords Open Connection for SCP
110 scp.Put File ${SERVICE_FILE_PATH} ${acf_dir}