summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Redfish.md5
-rw-r--r--redfish-core/lib/ethernet.hpp41
2 files changed, 36 insertions, 10 deletions
diff --git a/Redfish.md b/Redfish.md
index 4c2dcfb17f..c416a5476b 100644
--- a/Redfish.md
+++ b/Redfish.md
@@ -489,6 +489,7 @@ Fields common to all schemas
- DHCPv4
- DHCPv6
- Description
+- EthernetInterfaceType
- FQDN
- HostName
- IPv4Addresses
@@ -498,12 +499,16 @@ Fields common to all schemas
- IPv6DefaultGateway
- IPv6StaticAddresses
- InterfaceEnabled
+- Links/RelatedInterfaces
- LinkStatus
- MACAddress
- NameServers
- SpeedMbps
- StaticNameServers
- Status
+- VLAN/VLANEnable
+- VLAN/VLANId
+- VLAN/Tagged
### /redfish/v1/Managers/bmc/LogServices/
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 0d3ba7a357..a5e397f1e8 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1554,6 +1554,12 @@ inline void handleIPv6StaticAddressesPatch(
}
}
+inline std::string extractParentInterfaceName(const std::string& ifaceId)
+{
+ std::size_t pos = ifaceId.find('_');
+ return ifaceId.substr(0, pos);
+}
+
inline void
parseInterfaceData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& ifaceId,
@@ -1629,6 +1635,26 @@ inline void
jsonResponse["FQDN"] = fqdn;
}
+ if (ethData.vlanId)
+ {
+ jsonResponse["EthernetInterfaceType"] = "Virtual";
+ jsonResponse["VLAN"]["VLANEnable"] = true;
+ jsonResponse["VLAN"]["VLANId"] = *ethData.vlanId;
+ jsonResponse["VLAN"]["Tagged"] = true;
+
+ nlohmann::json::array_t relatedInterfaces;
+ nlohmann::json& parentInterface = relatedInterfaces.emplace_back();
+ parentInterface["@odata.id"] =
+ boost::urls::format("/redfish/v1/Managers/bmc/EthernetInterfaces",
+ extractParentInterfaceName(ifaceId));
+ jsonResponse["Links"]["RelatedInterfaces"] =
+ std::move(relatedInterfaces);
+ }
+ else
+ {
+ jsonResponse["EthernetInterfaceType"] = "Physical";
+ }
+
jsonResponse["NameServers"] = ethData.nameServers;
jsonResponse["StaticNameServers"] = ethData.staticNameServers;
@@ -1724,18 +1750,13 @@ inline void requestEthernetInterfacesRoutes(App& app)
nlohmann::json& ifaceArray = asyncResp->res.jsonValue["Members"];
ifaceArray = nlohmann::json::array();
- std::string tag = "_";
for (const std::string& ifaceItem : ifaceList)
{
- std::size_t found = ifaceItem.find(tag);
- if (found == std::string::npos)
- {
- nlohmann::json::object_t iface;
- iface["@odata.id"] = boost::urls::format(
- "/redfish/v1/Managers/bmc/EthernetInterfaces/{}",
- ifaceItem);
- ifaceArray.emplace_back(std::move(iface));
- }
+ nlohmann::json::object_t iface;
+ iface["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/bmc/EthernetInterfaces/{}",
+ ifaceItem);
+ ifaceArray.push_back(std::move(iface));
}
asyncResp->res.jsonValue["Members@odata.count"] = ifaceArray.size();