Added new testcases to protocol settings sub menu
- Enable SSH and IPMI protocol and verify SSH and IPMI commands work
- Disable SSH and IPMI protocol and verify SSH and IPMI commands stop working
- Enable SSH and Disable IPMI and verify SSH command works & IPMI command stop working
Change-Id: I19d41694a24708fccfffd90aa7ce275a6d9ca69e
Signed-off-by: meghagn <Megha.GN@ibm.com>
diff --git a/redfish/managers/test_bmc_protocol_settings.robot b/redfish/managers/test_bmc_protocol_settings.robot
index 2ddbae2..9059dc7 100644
--- a/redfish/managers/test_bmc_protocol_settings.robot
+++ b/redfish/managers/test_bmc_protocol_settings.robot
@@ -12,7 +12,7 @@
*** Variables ***
-${cmd_prefix} ipmitool -I lanplus -C 17 -p 623 -U ${OPENBMC_USERNAME} -P ${OPENBMC_PASSWORD}
+${cmd_prefix} ipmitool -I lanplus -C 17 -p 623 -U ${IPMI_USERNAME} -P ${IPMI_PASSWORD}
*** Test Cases ***
@@ -196,6 +196,62 @@
... msg=IPMI commands are working after disabling IPMI.
+Enable SSH And IPMI Protocol And Verify
+ [Documentation] Set the SSH and IPMI protocol attributes to True, and verify
+ ... that the setting attribute value is boolean True.
+ [Tags] Enable_SSH_And_IPMI_Protocol_And_Verify
+
+ Set SSH And IPMI Protocol ${True} ${True}
+
+ # Check if SSH and IPMI enabled is set.
+ Verify SSH Protocol State ${True}
+ Verify IPMI Protocol State ${True}
+
+ # Check if SSH login and IPMI commands work.
+ Verify SSH Login And Commands Work
+ Verify IPMI Works lan print
+
+
+Disable SSH And IPMI Protocol And Verify
+ [Documentation] Set the SSH and IPMI protocol attributes to False, and verify
+ ... that both SSH login and IPMI commands does not work.
+ [Tags] Disable_SSH_And_IPMI_Protocol_And_Verify
+ [Teardown] Enable SSH Protocol ${True}
+
+ Set SSH And IPMI Protocol ${False} ${False}
+
+ # Check if SSH login and commands fail.
+ ${status}= Run Keyword And Return Status
+ ... Verify SSH Login And Commands Work
+
+ Should Be Equal As Strings ${status} False
+ ... msg=SSH Login and commands are working after disabling SSH.
+
+ # Check if IPMI commands fail.
+ ${status}= Run Keyword And Return Status
+ ... Verify IPMI Works lan print
+
+ Should Be Equal As Strings ${status} False
+ ... msg=IPMI commands are working after disabling IPMI.
+
+
+Enable SSH And Disable IPMI And Verify
+ [Documentation] Set the SSH protocol attribute to True and IPMI protocol attribute to False, and verify
+ ... that SSH login works and IPMI command does not work.
+ [Tags] Enable_SSH_And_Disable_IPMI_And_Verify
+
+ Set SSH And IPMI Protocol ${True} ${False}
+
+ Verify SSH Login And Commands Work
+
+ # Check if IPMI commands fail.
+ ${status}= Run Keyword And Return Status
+ ... Verify IPMI Works lan print
+
+ Should Be Equal As Strings ${status} False
+ ... msg=IPMI commands are working after disabling IPMI.
+
+
*** Keywords ***
Suite Setup Execution
@@ -227,3 +283,21 @@
# Wait for BMC real reboot and Redfish API ready
Wait Until Keyword Succeeds 3 min 10 sec Is BMC LastResetTime Changed ${last_reset_time}
+
+Set SSH And IPMI Protocol
+ [Documentation] Set SSH and IPMI protocol state.
+ [Arguments] ${ssh_state} ${ipmi_state}
+
+ # Description of argument(s):
+ # ssh_state state of SSH to be set(e.g. True, False).
+ # ipmi_state state of IPMI to be set(e.g. True, False).
+
+ ${ssh_protocol_state}= Create Dictionary ProtocolEnabled=${ssh_state}
+ ${ipmi_protocol_state}= Create Dictionary ProtocolEnabled=${ipmi_state}
+ ${data}= Create Dictionary SSH=${ssh_protocol_state} IPMI=${ipmi_protocol_state}
+
+ Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body=&{data}
+ ... valid_status_codes=[${HTTP_NO_CONTENT}]
+
+ # Wait for timeout for new values to take effect.
+ Sleep ${NETWORK_TIMEOUT}s