Factory data reset automation.

This change addresses:
    1. Factory reset the system.
    2. Restore old network settings.

Resolves openbmc/openbmc-test-automation/issues/282

Change-Id: I29e7e876eab9650c20792ba27ce7632ab063b949
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index 74c8d99..a04bc58 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -792,3 +792,18 @@
 
     Open Connection  ${os_host}
     Login  ${os_username}  ${os_password}
+
+Configure Initial Settings
+    [Documentation]  Restore old IP and route.
+    ...  This keyword requires initial settings viz IP address,
+    ...  Network Mask, default gatway and serial console IP and port
+    ...  information which should be provided in command line.
+
+    [Arguments]  ${host}=${OPENBMC_HOST}  ${mask}=${NET_MASK}  ${gw_ip}=${GW_IP}
+
+    # Open telnet connection and ignore the error, in case telnet session is already
+    # opened by the program calling this keyword.
+
+    Run Keyword And Ignore Error  Open Telnet Connection to BMC Serial Console
+    Telnet.write  ifconfig eth0 ${host} netmask ${mask}
+    Telnet.write  route add default gw ${gw_ip}