blob: cab493d2109f482adbef10d24554e6927fb5b1d9 [file] [log] [blame]
George Keishing4c394012019-02-01 06:03:02 -06001*** Settings ***
George Keishing85609902019-02-18 07:24:24 -06002Resource ../../lib/resource.robot
George Keishing4c394012019-02-01 06:03:02 -06003Resource ../../lib/bmc_redfish_resource.robot
George Keishing3298d5c2019-02-12 06:59:25 -06004Resource ../../lib/openbmc_ffdc.robot
5
6Test Teardown FFDC On Test Case Fail
George Keishing4c394012019-02-01 06:03:02 -06007
George Keishing374e6842019-02-20 08:57:18 -06008*** Variables ***
9
10${LOGIN_SESSION_COUNT} ${50}
11
George Keishing4c394012019-02-01 06:03:02 -060012*** Test Cases ***
13
George Keishing5ee33d92019-02-02 12:33:25 -060014Redfish Login With Invalid Credentials
George Keishing4c394012019-02-01 06:03:02 -060015 [Documentation] Login to BMC web using invalid credential.
George Keishing5ee33d92019-02-02 12:33:25 -060016 [Tags] Redfish_Login_With_Invalid_Credentials
George Keishing4c394012019-02-01 06:03:02 -060017 [Template] Login And Verify Redfish Response
18
19 # Expect status Username Password
20 InvalidCredentialsError* ${OPENBMC_USERNAME} deadpassword
21 InvalidCredentialsError* groot ${OPENBMC_PASSWORD}
22 InvalidCredentialsError* ${EMPTY} ${OPENBMC_PASSWORD}
23 InvalidCredentialsError* ${OPENBMC_USERNAME} ${EMPTY}
24 InvalidCredentialsError* ${EMPTY} ${EMPTY}
25
26
George Keishing5ee33d92019-02-02 12:33:25 -060027Redfish Login Using Unsecured HTTP
George Keishinga8116932019-02-05 11:51:47 -060028 [Documentation] Login to BMC web through http unsecured.
George Keishing5ee33d92019-02-02 12:33:25 -060029 [Tags] Redfish_Login_Using_Unsecured_HTTP
George Keishinga8116932019-02-05 11:51:47 -060030
31 Create Session openbmc http://${OPENBMC_HOST}
32 ${data}= Create Dictionary
33 ... UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD}
34
35 ${headers}= Create Dictionary Content-Type=application/json
36
37 Run Keyword And Expect Error *Connection refused*
38 ... Post Request openbmc /redfish/v1/SessionService/Sessions
39 ... data=${data} headers=${headers}
40
41
George Keishingb2f07342019-02-09 05:21:45 -060042Redfish Login Using HTTPS Wrong Port 80 Protocol
43 [Documentation] Login to BMC web through wrong protocol port 80.
44 [Tags] Redfish_Login_Using_HTTPS_Wrong_Port_80_Protocol
45
46 Create Session openbmc https://${OPENBMC_HOST}:80
47 ${data}= Create Dictionary
48 ... UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD}
49
50 ${headers}= Create Dictionary Content-Type=application/json
51
52 Run Keyword And Expect Error *Connection refused*
53 ... Post Request openbmc /redfish/v1/SessionService/Sessions
54 ... data=${data} headers=${headers}
55
56
George Keishing374e6842019-02-20 08:57:18 -060057Create Multiple Login Sessions And Verify
58 [Documentation] Create 50 login instances and verify.
59 [Tags] Create_Multiple_Login_Sessions_And_Verify
60 [Teardown] Multiple Session Cleanup
61
62 redfish.Login
63 # Example:
64 # {
65 # 'key': 'L0XEsZAXpNdF147jJaOD',
66 # 'location': '/redfish/v1/SessionService/Sessions/qWn2JOJSOs'
67 # }
68 ${saved_session_info}= Get Redfish Session Info
69
70 # Sessions book keeping for cleanup once done.
71 ${session_list}= Create List
72 Set Test Variable ${session_list}
73
74 Repeat Keyword ${LOGIN_SESSION_COUNT} times Create New Login Session
75
76 # Update the redfish session object with the first login key and location
77 # and verify if it is still working.
78 redfish.Set Session Key ${saved_session_info["key"]}
79 redfish.Set Session Location ${saved_session_info["location"]}
80 ${resp}= redfish.Get ${saved_session_info["location"]}
81 Should Be Equal As Strings ${resp.status} ${HTTP_OK}
82
83
George Keishing4c394012019-02-01 06:03:02 -060084*** Keywords ***
85
86Login And Verify Redfish Response
87 [Documentation] Login and verify redfish response.
88 [Arguments] ${expected_response} ${username} ${password}
89
90 # Description of arguments:
91 # expected_response Expected REST status.
92 # username The username to be used to connect to the server.
93 # password The password to be used to connect to the server.
94
95 ${data}= Create Dictionary username=${username} password=${password}
96 Run Keyword And Expect Error ${expected_response} redfish.Login ${data}
George Keishing374e6842019-02-20 08:57:18 -060097
98
99Create New Login Session
100 [Documentation] Multiple login session keys.
101
102 redfish.Login
103 ${session_info}= Get Redfish Session Info
104
105 # Append the session location to the list.
106 # ['/redfish/v1/SessionService/Sessions/uDzihgDecs',
107 # '/redfish/v1/SessionService/Sessions/PaHF5brPPd']
108 Append To List ${session_list} ${session_info["location"]}
109
110
111Multiple Session Cleanup
112 [Documentation] Do the teardown for multiple sessions.
113
114 FFDC On Test Case Fail
115
116 :FOR ${item} IN @{session_list}
117 \ redfish.Delete ${item}
118