[Redfish] Add FQDN and IPv6Address in NetworkProtocol and EthernetInterface
FQDN and IPv6Address are mandatory properties in OCP profile.
Tested:
GET /redfish/v1/Managers/bmc/NetworkProtocol HTTP/1.1
Response:
{
"@odata.context": "/redfish/v1/$metadata#ManagerNetworkProtocol.ManagerNetworkProtocol",
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol",
"@odata.type": "#ManagerNetworkProtocol.v1_4_0.ManagerNetworkProtocol",
"Description": "Manager Network Service",
"FQDN": <host name>.<domain name>,
"HTTPS": {
"Port": 443,
"ProtocolEnabled": true
},
"HostName": <host name>,
...
}
GET /redfish/v1/Managers/bmc/EthernetInterfaces/eth0 HTTP/1.1
Response:
{
"@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface",
"@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0",
"@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
...
"FQDN": <host name>.<domain name>,
"HostName": <host name>,
...
"IPv6Addresses": [],
...
}
Signed-off-by: Jennifer Lee <jennifer1.lee@intel.com>
Change-Id: I0ca8f98523cbcfc935e0ac3bbf93f87762ff183b
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index c4f60a9..2375d68 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -100,6 +100,7 @@
std::string mac_address;
std::vector<std::uint32_t> vlan_id;
std::vector<std::string> nameservers;
+ std::vector<std::string> domainnames;
};
// Helper function that changes bits netmask notation (i.e. /24)
@@ -236,6 +237,17 @@
ethData.DHCPEnabled = *DHCPEnabled;
}
}
+ else if (propertyPair.first == "DomainName")
+ {
+ const std::vector<std::string> *domainNames =
+ sdbusplus::message::variant_ns::get_if<
+ std::vector<std::string>>(
+ &propertyPair.second);
+ if (domainNames != nullptr)
+ {
+ ethData.domainnames = std::move(*domainNames);
+ }
+ }
}
}
}
@@ -1498,6 +1510,11 @@
if (!ethData.hostname.empty())
{
json_response["HostName"] = ethData.hostname;
+ if (!ethData.domainnames.empty())
+ {
+ json_response["FQDN"] =
+ ethData.hostname + "." + ethData.domainnames[0];
+ }
}
json_response["VLANs"] = {