BIOS: Fix readOnly BIOS attributes

Previously, the readOnly property is true when without a D-Bus section in BIOS
JSON. Now, the readOnly property should be determined by a new readOnly field,
which should be introduced in the JSON. The checks are updated to ensure that
if there is D-Bus mapping then only D-Bus lookups are done.

Tested: test with json
https://gist.github.com/lxwinspur/2afffff2e445fddf90dfed6eceef4014

busctl get-property xyz.openbmc_project.BIOSConfigManager
/xyz/openbmc_project/bios_config/manager xyz.openbmc_project.BIOSConfig.Manager
BaseBIOSTable

a{s(sbsssvva(sv))} 5
"CodeUpdatePolicy"
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Enumeration"
true "" "" "" s "Concurrent" s "Concurrent" 2
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf" s "Concurrent"
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf" s "Disruptive"

"Led"
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Enumeration"
false "" "" "" s "Off" s "Off" 2
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf" s "On"
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf" s "Off"

"Model"
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String"
false "" "" "" s "powersupply0" s "FP5280G2" 2
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.MinStringLength" x 1
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.MaxStringLength" x 100

"OUTLET"
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Integer"
false "" "" "" x 9149282306036291456 x 0 3
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.LowerBound" x 0
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.UpperBound" x 68002
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.ScalarIncrement" x 1

"str_example3"
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String"
true "" "" "" s "ef" s "ef" 2
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.MinStringLength" x 1
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.MaxStringLength" x 100

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I73d2dcb9fc65a1aa8bbd060cfb9d44e708b47aae
diff --git a/test/libpldmresponder_bios_integer_attribute_test.cpp b/test/libpldmresponder_bios_integer_attribute_test.cpp
index 48c228b..4004ae9 100644
--- a/test/libpldmresponder_bios_integer_attribute_test.cpp
+++ b/test/libpldmresponder_bios_integer_attribute_test.cpp
@@ -31,7 +31,8 @@
          "lower_bound" : 1,
          "upper_bound" : 15,
          "scalar_increment" : 1,
-         "default_value" : 2
+         "default_value" : 2,
+         "readOnly" : true
       })"_json;
 
     BIOSIntegerAttribute integerReadOnly{jsonIntegerReadOnly, nullptr};
@@ -48,7 +49,8 @@
          "lower_bound" : 1,
          "upper_bound" : 15,
          "scalar_increment" : 1,
-         "default_valu" : 2
+         "default_valu" : 2,
+         "readOnly" : true
       })"_json; // default_valu -> default_value
     EXPECT_THROW((BIOSIntegerAttribute{jsonIntegerReadOnlyError, nullptr}),
                  Json::exception);
@@ -59,6 +61,7 @@
          "upper_bound" : 15,
          "scalar_increment" : 1,
          "default_value" : 0,
+         "readOnly" : false,
          "dbus":{
             "object_path" : "/xyz/openbmc_project/avsbus",
             "interface" : "xyz.openbmc.AvsBus.Manager",
@@ -82,7 +85,8 @@
          "lower_bound" : 1,
          "upper_bound" : 15,
          "scalar_increment" : 1,
-         "default_value" : 2
+         "default_value" : 2,
+         "readOnly" : true
       })"_json;
 
     std::vector<uint8_t> expectedAttrEntry{
@@ -114,6 +118,7 @@
          "upper_bound" : 15,
          "scalar_increment" : 1,
          "default_value" : 2,
+         "readOnly" : false,
          "dbus":{
             "object_path" : "/xyz/openbmc_project/avsbus",
             "interface" : "xyz.openbmc.AvsBus.Manager",
@@ -163,6 +168,7 @@
          "upper_bound" : 15,
          "scalar_increment" : 1,
          "default_value" : 2,
+         "readOnly" : false,
          "dbus":{
             "object_path" : "/xyz/openbmc_project/avsbus",
             "interface" : "xyz.openbmc.AvsBus.Manager",