ethernet: Remove parseInterfaceData() for VLAN
The parseInterfaceData() for VLAN simply writes some properties to the
response. Move the code to the GET handler for better readability and
remove an extra check for vlanID.
Tested:
Verified VLAN properties are shown normally at /redfish/v1/Managers/bmc
/EthernetInterfaces/eth0/VLANs/eth0_1
Change-Id: I93ed6e230b5b74eead18775725fd8ae8295b17d5
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 3530d79..00f9930 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1725,23 +1725,6 @@
}
}
-inline void parseInterfaceData(nlohmann::json& jsonResponse,
- const std::string& parentIfaceId,
- const std::string& ifaceId,
- const EthernetInterfaceData& ethData)
-{
- // Fill out obvious data...
- jsonResponse["Id"] = ifaceId;
- jsonResponse["@odata.id"] = "/redfish/v1/Managers/bmc/EthernetInterfaces/" +
- parentIfaceId + "/VLANs/" + ifaceId;
-
- jsonResponse["VLANEnable"] = true;
- if (ethData.vlanId)
- {
- jsonResponse["VLANId"] = *ethData.vlanId;
- }
-}
-
inline bool verifyNames(const std::string& parent, const std::string& iface)
{
return iface.starts_with(parent + "_");
@@ -2021,8 +2004,13 @@
const boost::container::flat_set<IPv6AddressData>&) {
if (success && ethData.vlanId)
{
- parseInterfaceData(asyncResp->res.jsonValue, parentIfaceId,
- ifaceId, ethData);
+ asyncResp->res.jsonValue["Id"] = ifaceId;
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Managers/bmc/EthernetInterfaces/" +
+ parentIfaceId + "/VLANs/" + ifaceId;
+
+ asyncResp->res.jsonValue["VLANEnable"] = true;
+ asyncResp->res.jsonValue["VLANId"] = *ethData.vlanId;
}
else
{