Added security test cases
Test cases added:
1. Test patch operation without auth token.
2. Flood patch operation without auth token and check BMC stability.
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
Change-Id: I50137cf1c85b877fc167f25b996222e6883c684c
diff --git a/security/test_bmc_connections.robot b/security/test_bmc_connections.robot
new file mode 100644
index 0000000..f8efe65
--- /dev/null
+++ b/security/test_bmc_connections.robot
@@ -0,0 +1,59 @@
+*** Settings ***
+Documentation Connections and authentication module stability tests.
+
+Resource ../lib/bmc_redfish_resource.robot
+Resource ../lib/bmc_network_utils.robot
+Resource ../lib/openbmc_ffdc.robot
+Library ../lib/bmc_network_utils.py
+
+Library OperatingSystem
+Library Collections
+
+*** Variables ***
+
+${iterations} 10000
+${hostname} test_hostname
+
+*** Test Cases ***
+
+Test Patch Without Auth Token Fails
+ [Documentation] Send patch method without auth token and verify it throws an error.
+ [Tags] Test Patch Without Auth Token Fails
+
+ Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body={'HostName': '${hostname}'}
+ ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}]
+
+
+Flood Patch Without Auth Token And Check Stability Of BMC
+ [Documentation] Flood patch method without auth token and check BMC stability.
+ [Tags] Flood_Patch_Without_Auth_Token_And_Check_Stability_Of_BMC
+ @{status_list}= Create List
+
+ FOR ${i} IN RANGE ${1} ${iterations}
+ Log To Console ${i}th iteration
+ Run Keyword And Ignore Error
+ ... Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body={'HostName': '${hostname}'}
+
+ # Every 100th iteration, check BMC allows patch with auth token.
+ ${status}= Run Keyword If ${i} % 100 == 0 Run Keyword And Return Status
+ ... Login And Configure Hostname
+ Run Keyword If ${status} == False Append To List ${status_list} ${status}
+ END
+ ${verify_count}= Evaluate ${iterations}/100
+ ${fail_count}= Get Length ${status_list}
+
+ Should Be Equal ${fail_count} 0 msg=Patch operation failed ${fail_count} times in ${verify_count} attempts
+
+
+*** Keywords ***
+
+Login And Configure Hostname
+ [Documentation] Login and configure hostname
+
+ [Teardown] Redfish.Logout
+
+ Redfish.Login
+
+ Redfish.patch ${REDFISH_NW_PROTOCOL_URI} body={'HostName': '${hostname}'}
+ ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
+