Fix for VPD write testcase

Changes:
Need to reboot BMC at power off state after
performing VPD write operation for the new VPD
values to be updated

Tested:
Executed test_vpd_tool.robot successfully

Change-Id: Ie0ff670de759cab15076ca9afee364fe11de7ef2
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/openpower/vpd/test_vpd_tool.robot b/openpower/vpd/test_vpd_tool.robot
index 50d8934..496574c 100644
--- a/openpower/vpd/test_vpd_tool.robot
+++ b/openpower/vpd/test_vpd_tool.robot
@@ -4,6 +4,7 @@
 Library         ../../lib/vpd_utils.py
 Variables       ../../data/vpd_variables.py
 Resource        ../../lib/openbmc_ffdc.robot
+Resource        ../../lib/boot_utils.robot
 
 Test Teardown   FFDC On Test Case Fail
 
@@ -63,6 +64,9 @@
     [Documentation]  Verify writing VPD field value via vpdtool.
     [Tags]  Verify_VPD_Field_Write
 
+    # Put system to power off state before VPD write operation.
+    Redfish Power Off  stack_mode=skip
+
     ${components}=  Get Dictionary Keys  ${VPD_DETAILS}
     FOR  ${component}  IN  @{components}
         # VPD fields "DR", "CC" and "FN" will be added later.
@@ -159,12 +163,13 @@
     [Documentation]  Verify writing VPD fields for given component via vpdtool.
     [Arguments]  ${component}  ${field}
     [Teardown]  Restore VPD Value  ${component}  ${field}  ${old_field_value}
+
     # Description of arguments:
     # component       VPD component (e.g. /system/chassis/motherboard/vdd_vrm1).
     # field           VPD component field (e.g. PN, SN)
 
     ${vpd_records}=  Vpdtool  -r -O ${component} -R VINI -K ${field}
-    ${old_field_value}=  Set Variable  ${vpd_records['${component}']['${field}']}
+    Set Test Variable  ${old_field_value}  ${vpd_records['${component}']['${field}']}
 
     ${write_value}=  Set Variable If
     ...  '${field}' == 'DR'  ${DR_WRITE_VALUE}
@@ -194,6 +199,7 @@
     # component       VDP component (e.g. /system/chassis/motherboard/vdd_vrm1).
     # field           VPD field (e.g. DR, SN, PN)
 
+    Redfish OBMC Reboot (off)  stack_mode=normal
     ${vpd_records}=  Vpdtool  -r -O ${component} -R VINI -K ${field}
 
     ${busctl_field}=  Set Variable If