Add teardown to default IPMI restriction mode
Changes:
- Added new keyword to set IPMI restriction mode.
- Added to default back to
xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None
during test teardown.
Change-Id: Ifda4032a5930f6079545b6aa10dbd9e590e80a0b
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/ipmi/test_general_ipmi.robot b/tests/ipmi/test_general_ipmi.robot
index 7cdd81b..2c1b4ed 100755
--- a/tests/ipmi/test_general_ipmi.robot
+++ b/tests/ipmi/test_general_ipmi.robot
@@ -686,6 +686,8 @@
[Tags] Test_IPMI_Restriction_Mode
# Forego normal test setup:
[Setup] No Operation
+ [Teardown] Run Keywords FFDC On Test Case Fail AND
+ ... Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None
# By default no IPMI operations are restricted.
# /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode
@@ -704,10 +706,7 @@
# "status": "ok"
# }
- ${valueDict}= Create Dictionary
- ... data=xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist
- Write Attribute ${CONTROL_HOST_URI}restriction_mode/
- ... RestrictionMode data=${valueDict}
+ Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist
# Attempt white-listed operation expecting success.
IPMI Power On
@@ -943,3 +942,16 @@
${rc} ${output}= Run And Return RC and Output ${ipmi_cmd}
[Return] ${rc}
+
+
+Set IPMI Restriction Mode
+ [Documentation] Set the IPMI restriction mode.
+ [Arguments] ${restriction_mode}
+
+ # Description of argument(s):
+ # restriction_mode IPMI valid restriction modes.
+
+ ${valueDict}= Create Dictionary data=${restriction_mode}
+
+ Write Attribute ${CONTROL_HOST_URI}restriction_mode/
+ ... RestrictionMode data=${valueDict}