Code to revert back initial hostname.

Resolves openbmc/openbmc-test-automation#1771

Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
Change-Id: I0aae7d1c9fb0d28d3cbf04d8c189a7243eea731d
diff --git a/redfish/managers/test_bmc_network_conf.robot b/redfish/managers/test_bmc_network_conf.robot
index 1a6cd01..5f75d40 100644
--- a/redfish/managers/test_bmc_network_conf.robot
+++ b/redfish/managers/test_bmc_network_conf.robot
@@ -83,10 +83,15 @@
     [Documentation]  Configure hostname via Redfish and verify.
     [Tags]  Configure_Hostname_And_Verify
 
-    Configure Hostname  ${test_hostname}
+    ${hostname}=  Redfish_Utils.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  HostName
 
+    Configure Hostname  ${test_hostname}
     Validate Hostname On BMC  ${test_hostname}
 
+    # Revert back to initial hostname.
+    Configure Hostname  ${hostname}
+    Validate Hostname On BMC  ${hostname}
+
 Add Valid IPv4 Address And Verify
     [Documentation]  Add IPv4 Address via Redfish and verify.
     [Tags]  Add_Valid_IPv4_Addres_And_Verify
@@ -479,3 +484,4 @@
     ...  Delete IP Address  ${ip}
 
     Test Teardown Execution
+