BMC file mirroring write to hostname logic changes

Change-Id: I99e97fdc2150a8019d258ea5f0cdd0bd96d198c2
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_bmc_file_mirroring.robot b/tests/test_bmc_file_mirroring.robot
index 6bbe8c9..237902b 100755
--- a/tests/test_bmc_file_mirroring.robot
+++ b/tests/test_bmc_file_mirroring.robot
@@ -31,8 +31,16 @@
     ${orig_hostname}  ${stderr}  ${rc}=  BMC Execute Command
     ...  cat /etc/hostname
     Set Suite Variable  ${hostname}  ${orig_hostname}
+    ${mirror_filename}=  Set Variable  mirror-filename
 
-    BMC Execute Command  echo "mirror-file" > /etc/hostname
+    ${host_name_dict}=  Create Dictionary  data=${mirror_filename}
+    Write Attribute  ${NETWORK_MANAGER}config  HostName  data=${host_name_dict}
+    ...  verify=${TRUE}  expected_value=${mirror_filename}
+
+    ${hostname}  ${stderr}  ${rc}=  BMC Execute Command  hostname
+
+    Should Be Equal As Strings  ${hostname}  ${mirror_filename}
+    ...  msg=The hostname interface ${mirror_filename} and command value ${hostname} do not match.
 
     # File "hostname" should have synced to alt media space.
     # Example output from "ls /media/alt/var/persist/etc/":
@@ -41,7 +49,7 @@
     ${curr_hostname}  ${stderr}  ${rc}=  BMC Execute Command
     ...  cat /media/alt/var/persist/etc/hostname
 
-    Should Be Equal As Strings  ${curr_hostname}  mirror-file
+    Should Be Equal As Strings  ${curr_hostname}  ${mirror_filename}
     ...  msg=hostname primary file is not synced to the alt flash chip side.
 
 *** Keywords ***
@@ -50,5 +58,8 @@
     [Documentation]  Do the post test teardown.
 
     FFDC On Test Case Fail
-    BMC Execute Command  echo ${hostname} > /etc/hostname
+
+    ${host_name_dict}=  Create Dictionary  data=${hostname}
+    Write Attribute  ${NETWORK_MANAGER}config  HostName  data=${host_name_dict}
+    ...  verify=${TRUE}  expected_value=${hostname}