Move network protocol to a constexpr struct
Another clang-tidy warning about global construction of things that
could throw. Considering we don't actually use this as a map anywhere,
move to a constexpr array of values.
Tested: Clang-tidy now passes cert-* check.
curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Managers/bmc/NetworkProtocol
{
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol",
"@odata.type": "#ManagerNetworkProtocol.v1_5_0.ManagerNetworkProtocol",
"Description": "Manager Network Service",
"FQDN": "qemux86",
"HTTP": {
"Port": 0,
"ProtocolEnabled": false
},
"HTTPS": {
"Certificates": {
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"
},
"Port": 443,
"ProtocolEnabled": true
},
"HostName": "qemux86",
"IPMI": {
"Port": null,
"ProtocolEnabled": false
},
"Id": "NetworkProtocol",
"NTP": {
"NTPServers": [],
"ProtocolEnabled": true
},
"Name": "Manager Network Protocol",
"SSH": {
"Port": 22,
"ProtocolEnabled": true
},
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
}
}%
Change-Id: I2bdae321fc1cbb418ed302453ec6109ee2ed32c1
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index b82e697..65b90f7 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -54,10 +54,8 @@
std::string, sdbusplus::message::object_path, uint32_t,
std::string, sdbusplus::message::object_path>;
-const static boost::container::flat_map<const char*, std::string>
- protocolToDBus{{"SSH", "dropbear"},
- {"HTTPS", "bmcweb"},
- {"IPMI", "phosphor-ipmi-net"}};
+const static std::array<std::pair<const char*, const char*>, 3> protocolToDBus{
+ {{"SSH", "dropbear"}, {"HTTPS", "bmcweb"}, {"IPMI", "phosphor-ipmi-net"}}};
inline void
extractNTPServersAndDomainNamesData(const GetManagedObjects& dbusData,