Factory reset & zero config through IPMI

This change addresses the following
  - factory data reset
  - Verifies Zero Config IP
  - Reconfigure old IP

Resolves openbmc/openbmc-test-automation#196

Change-Id: Iadbfafa7431e47dc79e4b08ba60f6035fa801f19
Signed-off-by: prkatti1 <prkatti1@in.ibm.com>
diff --git a/mnfg/test_factory_reset_zero_config.robot b/mnfg/test_factory_reset_zero_config.robot
new file mode 100644
index 0000000..68efb4e
--- /dev/null
+++ b/mnfg/test_factory_reset_zero_config.robot
@@ -0,0 +1,49 @@
+*** Settings ***
+Documentation           Verifiy the Network Configuration, Factory Reset and Zero config
+...                      Address
+Resource                ../lib/ipmi_client.robot
+Resource                ../lib/utils.robot
+Resource                ../lib/connection_client.robot
+Resource                ../lib/oem/ibm/serial_console_client.robot
+Resource                ../lib/resource.txt
+Library                 OperatingSystem
+
+Suite Setup         Open Connection And Log In
+Suite Teardown      Close All Connections
+
+*** Test Cases ***
+
+Zero Config
+    [Documentation]   Validate Zero Config IP.
+    ...               Factory-reset system and verify system comes up with Zero Config IP.
+    [Tag]             Zero_Config
+    Factory Reset
+    Validate Zero Config IP   ${OPENBMC_HOST}
+    Revert to Initial Setup   ${OPENBMC_HOST}
+    Ping Host                 ${OPENBMC_HOST}
+
+*** Keywords ***
+
+Factory Reset
+    [Documentation]     Factory-reset the system.
+    Run Dbus IPMI Raw Command   0x32 0xBA 00 00
+    Run Dbus IPMI Raw Command   0x32 0x66
+    Check Host Connection    ${OPENBMC_HOST}
+
+Validate Zero Config IP
+    [Documentation]   Validate zero config IP.
+    [Arguments]       ${ip}
+    Check Host Connection   ${ip}
+
+Check Host Connection
+    [Arguments]     ${host}
+    ${RC}  ${output}=  Run and return RC and Output  ping -c 4 ${host}
+    Log     RC: ${RC}\nOutput:\n${output}
+    Should Not be equal     ${RC}   ${0}
+
+Revert to Initial Setup
+    [Documentation]  Erase zero config IP and restore old IP and route.
+    [Arguments]      ${ip}
+    Open Telnet Connection to BMC Serial Console
+    Telnet.write     ifconfig eth0 ${ip} netmask ${NMASK}
+    Telnet.write     route add default gw ${GW_IP}