Fix for VPD write test case failure

Changes include:
    - Modified Vpdtool function to only return output
      if its a VPD read command.
    - Restore old VPD data after VPD write test.

Change-Id: I9499fc9f4dae2e47b6286c9178e02e736fe58308
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/lib/vpd_utils.py b/lib/vpd_utils.py
index 4d15173..8a7f583 100644
--- a/lib/vpd_utils.py
+++ b/lib/vpd_utils.py
@@ -44,5 +44,8 @@
 
     bsu_options = fa.args_to_objects(bsu_options)
     out_buf, stderr, rc = bsu.bmc_execute_command('vpd-tool ' + option_string, **bsu_options)
-    out_buf = json.loads(out_buf)
-    return out_buf
+
+    # Only return output if its a VPD read command.
+    if '-r' in option_string:
+        out_buf = json.loads(out_buf)
+        return out_buf