OEM Inband IPMI factory reset
Changes:
- Minor existing IPMI client fixes.
- Added test to factory reset BMC via Host.
Resolves openbmc/openbmc-test-automation#1444
Change-Id: Icde753a16df59e5da062ae78bbb449b7c004534f
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/ipmi_client.robot b/lib/ipmi_client.robot
index 9d8a93c..4f6e0f2 100755
--- a/lib/ipmi_client.robot
+++ b/lib/ipmi_client.robot
@@ -27,9 +27,9 @@
[Documentation] Run the given IPMI command.
[Arguments] ${args}
${resp}= Run Keyword If '${IPMI_COMMAND}' == 'External'
- ... Run External IPMI RAW Command ${args}
+ ... Run External IPMI Raw Command ${args}
... ELSE IF '${IPMI_COMMAND}' == 'Inband'
- ... Run Inband IPMI RAW Command ${args}
+ ... Run Inband IPMI Raw Command ${args}
... ELSE IF '${IPMI_COMMAND}' == 'Dbus'
... Run Dbus IPMI RAW Command ${args}
... ELSE Fail msg=Invalid IPMI Command type provided : ${IPMI_COMMAND}
@@ -106,7 +106,7 @@
Should Be Empty ${stderr} msg=${stdout}
[Return] ${stdout}
-Run External IPMI RAW Command
+Run External IPMI Raw Command
[Documentation] Run the raw IPMI command externally.
[Arguments] ${args}
${ipmi_raw_cmd}= Catenate SEPARATOR=
@@ -291,3 +291,20 @@
${output}= Fetch From Right ${output} ${SPACE}
[Return] ${output}
+
+
+Set BMC Network From Host
+ [Documentation] Set BMC network from host.
+ [Arguments] ${nw_info}
+
+ # Description of argument(s):
+ # nw_info A dictionary containing the network information to apply.
+
+ Run Inband IPMI Standard Command
+ ... lan set 1 ipaddr ${nw_info['IP Address']}
+
+ Run Inband IPMI Standard Command
+ ... lan set 1 netmask ${nw_info['Subnet Mask']}
+
+ Run Inband IPMI Standard Command
+ ... lan set 1 defgw ipaddr ${nw_info['Default Gateway IP']}
diff --git a/openpower/test_inband_factory_reset.robot b/openpower/test_inband_factory_reset.robot
new file mode 100644
index 0000000..fd3344a
--- /dev/null
+++ b/openpower/test_inband_factory_reset.robot
@@ -0,0 +1,37 @@
+*** Settings ***
+Documentation OEM IPMI in-band factory reset.
+
+Resource ../lib/resource.txt
+Resource ../lib/ipmi_client.robot
+Resource ../lib/boot_utils.robot
+Library ../lib/ipmi_utils.py
+
+
+Test Teardown FFDC On Test Case Fail
+Test Setup Delete All Error Logs
+
+*** Test Cases ***
+
+Test Inband IPMI Factory Reset
+ [Documentation] Trigger inband factory reset and verify.
+ [Tags] Test_Inband_IPMI_Factory_Reset
+
+ REST Power On stack_mode=skip
+
+ ${network_info}= Get Lan Print Dict
+ Should Not Be Empty ${network_info}
+
+ # Call reset method.
+ Run Inband IPMI Raw Command 0x32 0x20
+
+ # Reboot BMC.
+ Run Inband IPMI Raw Command 0x06 0x03
+
+ # Allow BMC to shutdown.
+ Sleep 1 min
+
+ # Check if BMC comes back online and IPMI host services are responding.
+ Wait Until Keyword Succeeds 10 min 30 sec
+ ... Run Inband IPMI Raw Command lan print
+
+ Set BMC Network From Host ${network_info}