1*** Settings ***
2Documentation  Connections and authentication module stability tests.
3
4Resource  ../lib/bmc_redfish_resource.robot
5Resource  ../lib/bmc_network_utils.robot
6Resource  ../lib/openbmc_ffdc.robot
7Library   ../lib/bmc_network_utils.py
8
9Library   OperatingSystem
10Library   Collections
11
12*** Variables ***
13
14${iterations}  10000
15${hostname}    test_hostname
16
17*** Test Cases ***
18
19Test Patch Without Auth Token Fails
20    [Documentation]  Send patch method without auth token and verify it throws an error.
21    [Tags]   Test Patch Without Auth Token Fails
22
23    Redfish.Patch  ${REDFISH_NW_PROTOCOL_URI}  body={'HostName': '${hostname}'}
24    ...  valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}]
25
26
27Flood Patch Without Auth Token And Check Stability Of BMC
28    [Documentation]  Flood patch method without auth token and check BMC stability.
29    [Tags]  Flood_Patch_Without_Auth_Token_And_Check_Stability_Of_BMC
30    @{status_list}=  Create List
31
32    FOR  ${i}  IN RANGE  ${1}  ${iterations}
33        Log To Console  ${i}th iteration
34        Run Keyword And Ignore Error
35        ...  Redfish.Patch  ${REDFISH_NW_PROTOCOL_URI}  body={'HostName': '${hostname}'}
36
37        # Every 100th iteration, check BMC allows patch with auth token.
38        ${status}=  Run Keyword If  ${i} % 100 == 0  Run Keyword And Return Status
39        ...  Login And Configure Hostname
40        Run Keyword If  ${status} == False  Append To List  ${status_list}  ${status}
41    END
42    ${verify_count}=  Evaluate  ${iterations}/100
43    ${fail_count}=  Get Length  ${status_list}
44
45    Should Be Equal  ${fail_count}  0  msg=Patch operation failed ${fail_count} times in ${verify_count} attempts
46
47
48*** Keywords ***
49
50Login And Configure Hostname
51    [Documentation]  Login and configure hostname
52
53    [Teardown]  Redfish.Logout
54
55    Redfish.Login
56
57    Redfish.patch  ${REDFISH_NW_PROTOCOL_URI}  body={'HostName': '${hostname}'}
58    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
59
60