Enhance logs for networkd, hypervisor networkd app
Everytime a user does a GET on the ethernet interface redfish endpoint
the journal logs gets filled with errors like the following:
curl command:
GET https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/eth1
GET https://${bmc}/redfish/v1/Systems/hypervisor/EthernetInterfaces/eth1
[ERROR "hyperv \
isor_system.hpp":211] Got extra property: Type on the /xyz/openbmc_pr \
oject/network/hypervisor/eth0/ipv4/addr0 object
[ERROR "ethernet.hpp":499] Got extra property: Type on the \
/xyz/openbmc_project/network/hypervisor/eth0/ipv4/addr0 object
While extracting the ip object, the properties Type & Gateway in the
implementation are logged as errors, but they are not. The reason is,
these two properties are not used but only the origin, prefix length,
and address are fetched from the dbus to fill the ipv<4/6>config object.
This commit avoids logging the above properties as errors. If there are
properties other than these, then error will logged.
Tested By:
Before the changes:
Nov 26 06:10:46 bmc bmcweb[264]: (2021-11-26 06:10:46) [ERROR "hyperv \
isor_system.hpp":211] Got extra property: Type on the /xyz/openbmc_pr \
oject/network/hypervisor/eth0/ipv4/addr0 object
Nov 26 06:10:46 bmc bmcweb[264]: (2021-11-26 06:10:46) [ERROR "hyperv \
isor_system.hpp":211] Got extra property: Origin on the /xyz/openbmc_ \
project/network/hypervisor/eth1/ipv4/addr0 object
Nov 26 06:10:46 bmc bmcweb[264]: (2021-11-26 06:10:46) [ERROR "hyperv \
isor_system.hpp":211] Got extra property: Type on the /xyz/openbmc_pr \
oject/network/hypervisor/eth1/ipv4/addr0 object
After changes:
These traces wont be logged as errors.
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
Change-Id: I7160d3f71121a9758124a7c29517176e396c333e
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 6723d5b..f7fbb95 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -494,6 +494,11 @@
ipv6Address.prefixLength = *prefix;
}
}
+ else if (property.first == "Type" ||
+ property.first == "Gateway")
+ {
+ // Type & Gateway is not used
+ }
else
{
BMCWEB_LOG_ERROR
@@ -568,6 +573,11 @@
ipv4Address.netmask = getNetmask(*mask);
}
}
+ else if (property.first == "Type" ||
+ property.first == "Gateway")
+ {
+ // Type & Gateway is not used
+ }
else
{
BMCWEB_LOG_ERROR
diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp
index 54166a7..01d7528 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -261,6 +261,12 @@
ipv4Address.netmask = getNetmask(*mask);
}
}
+ else if (property.first == "Type" ||
+ property.first == "Gateway")
+ {
+ // Type & Gateway is not used
+ continue;
+ }
else
{
BMCWEB_LOG_ERROR