summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2020-12-17 19:54:55 +0300
committerEd Tanous <ed@tanous.net>2020-12-18 23:21:35 +0300
commit81ce609e30274435b4f8c3fc65340c6b6b153b0c (patch)
treef07c0bb8f950f81adc853845e009d9d40e254468 /redfish-core
parentf16f62633a64f386fd0382703ff0949ea177f457 (diff)
downloadbmcweb-81ce609e30274435b4f8c3fc65340c6b6b153b0c.tar.xz
Fix .clang-tidy
camelLower is not a type, camelBack is. Changes were made automatically with clang-tidy --fix-errors To be able to apply changes automatically, the only way I've found that works was to build the version of clang/clang-tidy that yocto has, and run the fix script within bitbake -c devshell bmcweb. Unfortunately, yocto has clang-tidy 11, which can apparently find a couple extra errors in tests we already had enabled. As such, a couple of those are also included. Tested: Ran clang-tidy-11 and got a clean result. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I9d1080b67f0342229c2f267160849445c065ca51
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/include/utils/fw_utils.hpp4
-rw-r--r--redfish-core/lib/account_service.hpp12
-rw-r--r--redfish-core/lib/ethernet.hpp82
-rw-r--r--redfish-core/lib/log_services.hpp4
-rw-r--r--redfish-core/lib/network_protocol.hpp20
-rw-r--r--redfish-core/lib/sensors.hpp150
-rw-r--r--redfish-core/lib/update_service.hpp20
-rw-r--r--redfish-core/lib/virtual_media.hpp44
8 files changed, 167 insertions, 169 deletions
diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp
index 43eded6822..0e46f17ddb 100644
--- a/redfish-core/include/utils/fw_utils.hpp
+++ b/redfish-core/include/utils/fw_utils.hpp
@@ -344,11 +344,11 @@ inline void getFwStatus(const std::shared_ptr<AsyncResp>& asyncResp,
crow::connections::systemBus->async_method_call(
[asyncResp,
- swId](const boost::system::error_code error_code,
+ swId](const boost::system::error_code errorCode,
const boost::container::flat_map<
std::string, std::variant<bool, std::string, uint64_t,
uint32_t>>& propertiesList) {
- if (error_code)
+ if (errorCode)
{
// not all fwtypes are updateable, this is ok
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 71f9430701..0cf24ea35d 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -164,7 +164,7 @@ inline void userErrorMessageHandler(const sd_bus_error* e,
return;
}
-inline void parseLDAPConfigData(nlohmann::json& json_response,
+inline void parseLDAPConfigData(nlohmann::json& jsonResponse,
const LDAPConfigData& confData,
const std::string& ldapType)
{
@@ -185,9 +185,9 @@ inline void parseLDAPConfigData(nlohmann::json& json_response,
{"GroupsAttribute", confData.groupAttribute}}}}},
};
- json_response[ldapType].update(ldap);
+ jsonResponse[ldapType].update(ldap);
- nlohmann::json& roleMapArray = json_response[ldapType]["RemoteRoleMapping"];
+ nlohmann::json& roleMapArray = jsonResponse[ldapType]["RemoteRoleMapping"];
roleMapArray = nlohmann::json::array();
for (auto& obj : confData.groupRoleList)
{
@@ -402,14 +402,14 @@ inline void getLDAPConfigData(const std::string& ldapType,
}
std::string service = resp.begin()->first;
crow::connections::systemBus->async_method_call(
- [callback, ldapType](const boost::system::error_code error_code,
+ [callback, ldapType](const boost::system::error_code errorCode,
const ManagedObjectType& ldapObjects) {
LDAPConfigData confData{};
- if (error_code)
+ if (errorCode)
{
callback(false, confData, ldapType);
BMCWEB_LOG_ERROR << "D-Bus responses error: "
- << error_code;
+ << errorCode;
return;
}
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 48b69a22fe..e73d338ac3 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -200,16 +200,16 @@ inline std::string
return "";
}
-inline bool extractEthernetInterfaceData(const std::string& ethiface_id,
- GetManagedObjects& dbus_data,
+inline bool extractEthernetInterfaceData(const std::string& ethifaceId,
+ GetManagedObjects& dbusData,
EthernetInterfaceData& ethData)
{
bool idFound = false;
- for (auto& objpath : dbus_data)
+ for (auto& objpath : dbusData)
{
for (auto& ifacePair : objpath.second)
{
- if (objpath.first == "/xyz/openbmc_project/network/" + ethiface_id)
+ if (objpath.first == "/xyz/openbmc_project/network/" + ethifaceId)
{
idFound = true;
if (ifacePair.first == "xyz.openbmc_project.Network.MACAddress")
@@ -416,16 +416,16 @@ inline bool extractEthernetInterfaceData(const std::string& ethiface_id,
// Helper function that extracts data for single ethernet ipv6 address
inline void
- extractIPV6Data(const std::string& ethiface_id,
- const GetManagedObjects& dbus_data,
- boost::container::flat_set<IPv6AddressData>& ipv6_config)
+ extractIPV6Data(const std::string& ethifaceId,
+ const GetManagedObjects& dbusData,
+ boost::container::flat_set<IPv6AddressData>& ipv6Config)
{
const std::string ipv6PathStart =
- "/xyz/openbmc_project/network/" + ethiface_id + "/ipv6/";
+ "/xyz/openbmc_project/network/" + ethifaceId + "/ipv6/";
// Since there might be several IPv6 configurations aligned with
// single ethernet interface, loop over all of them
- for (const auto& objpath : dbus_data)
+ for (const auto& objpath : dbusData)
{
// Check if proper pattern for object path appears
if (boost::starts_with(objpath.first.str, ipv6PathStart))
@@ -439,7 +439,7 @@ inline void
std::pair<
boost::container::flat_set<IPv6AddressData>::iterator,
bool>
- it = ipv6_config.insert(IPv6AddressData{});
+ it = ipv6Config.insert(IPv6AddressData{});
IPv6AddressData& ipv6Address = *it.first;
ipv6Address.id =
objpath.first.str.substr(ipv6PathStart.size());
@@ -489,16 +489,16 @@ inline void
// Helper function that extracts data for single ethernet ipv4 address
inline void
- extractIPData(const std::string& ethiface_id,
- const GetManagedObjects& dbus_data,
- boost::container::flat_set<IPv4AddressData>& ipv4_config)
+ extractIPData(const std::string& ethifaceId,
+ const GetManagedObjects& dbusData,
+ boost::container::flat_set<IPv4AddressData>& ipv4Config)
{
const std::string ipv4PathStart =
- "/xyz/openbmc_project/network/" + ethiface_id + "/ipv4/";
+ "/xyz/openbmc_project/network/" + ethifaceId + "/ipv4/";
// Since there might be several IPv4 configurations aligned with
// single ethernet interface, loop over all of them
- for (const auto& objpath : dbus_data)
+ for (const auto& objpath : dbusData)
{
// Check if proper pattern for object path appears
if (boost::starts_with(objpath.first.str, ipv4PathStart))
@@ -512,7 +512,7 @@ inline void
std::pair<
boost::container::flat_set<IPv4AddressData>::iterator,
bool>
- it = ipv4_config.insert(IPv4AddressData{});
+ it = ipv4Config.insert(IPv4AddressData{});
IPv4AddressData& ipv4Address = *it.first;
ipv4Address.id =
objpath.first.str.substr(ipv4PathStart.size());
@@ -888,18 +888,18 @@ inline void createIPv6(const std::string& ifaceId, uint8_t prefixLength,
* into JSON
*/
template <typename CallbackFunc>
-void getEthernetIfaceData(const std::string& ethiface_id,
+void getEthernetIfaceData(const std::string& ethifaceId,
CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
- [ethifaceId{std::string{ethiface_id}}, callback{std::move(callback)}](
- const boost::system::error_code error_code,
+ [ethifaceId{std::string{ethifaceId}}, callback{std::move(callback)}](
+ const boost::system::error_code errorCode,
GetManagedObjects& resp) {
EthernetInterfaceData ethData{};
boost::container::flat_set<IPv4AddressData> ipv4Data;
boost::container::flat_set<IPv6AddressData> ipv6Data;
- if (error_code)
+ if (errorCode)
{
callback(false, ethData, ipv4Data, ipv6Data);
return;
@@ -944,13 +944,13 @@ void getEthernetIfaceList(CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
[callback{std::move(callback)}](
- const boost::system::error_code error_code,
+ const boost::system::error_code errorCode,
GetManagedObjects& resp) {
// Callback requires vector<string> to retrieve all available
// ethernet interfaces
boost::container::flat_set<std::string> ifaceList;
ifaceList.reserve(resp.size());
- if (error_code)
+ if (errorCode)
{
callback(false, ifaceList);
return;
@@ -1024,7 +1024,7 @@ class EthernetCollection : public Node
getEthernetIfaceList(
[asyncResp](
const bool& success,
- const boost::container::flat_set<std::string>& iface_list) {
+ const boost::container::flat_set<std::string>& ifaceList) {
if (!success)
{
messages::internalError(asyncResp->res);
@@ -1035,7 +1035,7 @@ class EthernetCollection : public Node
asyncResp->res.jsonValue["Members"];
ifaceArray = nlohmann::json::array();
std::string tag = "_";
- for (const std::string& ifaceItem : iface_list)
+ for (const std::string& ifaceItem : ifaceList)
{
std::size_t found = ifaceItem.find(tag);
if (found == std::string::npos)
@@ -1707,8 +1707,8 @@ class EthernetInterface : public Node
}
void parseInterfaceData(
- const std::shared_ptr<AsyncResp>& asyncResp,
- const std::string& iface_id, const EthernetInterfaceData& ethData,
+ const std::shared_ptr<AsyncResp>& asyncResp, const std::string& ifaceId,
+ const EthernetInterfaceData& ethData,
const boost::container::flat_set<IPv4AddressData>& ipv4Data,
const boost::container::flat_set<IPv6AddressData>& ipv6Data)
{
@@ -1716,9 +1716,9 @@ class EthernetInterface : public Node
"xyz.openbmc_project.Inventory.Item.Ethernet"};
nlohmann::json& jsonResponse = asyncResp->res.jsonValue;
- jsonResponse["Id"] = iface_id;
+ jsonResponse["Id"] = ifaceId;
jsonResponse["@odata.id"] =
- "/redfish/v1/Managers/bmc/EthernetInterfaces/" + iface_id;
+ "/redfish/v1/Managers/bmc/EthernetInterfaces/" + ifaceId;
jsonResponse["InterfaceEnabled"] = ethData.nicEnabled;
auto health = std::make_shared<HealthPopulate>(asyncResp);
@@ -1784,7 +1784,7 @@ class EthernetInterface : public Node
jsonResponse["VLANs"] = {
{"@odata.id", "/redfish/v1/Managers/bmc/EthernetInterfaces/" +
- iface_id + "/VLANs"}};
+ ifaceId + "/VLANs"}};
jsonResponse["NameServers"] = ethData.nameServers;
jsonResponse["StaticNameServers"] = ethData.staticNameServers;
@@ -2054,21 +2054,21 @@ class VlanNetworkInterface : public Node
}
private:
- void parseInterfaceData(nlohmann::json& json_response,
- const std::string& parent_iface_id,
- const std::string& iface_id,
+ void parseInterfaceData(nlohmann::json& jsonResponse,
+ const std::string& parentIfaceId,
+ const std::string& ifaceId,
const EthernetInterfaceData& ethData)
{
// Fill out obvious data...
- json_response["Id"] = iface_id;
- json_response["@odata.id"] =
- "/redfish/v1/Managers/bmc/EthernetInterfaces/" + parent_iface_id +
- "/VLANs/" + iface_id;
+ jsonResponse["Id"] = ifaceId;
+ jsonResponse["@odata.id"] =
+ "/redfish/v1/Managers/bmc/EthernetInterfaces/" + parentIfaceId +
+ "/VLANs/" + ifaceId;
- json_response["VLANEnable"] = true;
+ jsonResponse["VLANEnable"] = true;
if (!ethData.vlan_id.empty())
{
- json_response["VLANId"] = ethData.vlan_id.back();
+ jsonResponse["VLANId"] = ethData.vlan_id.back();
}
}
@@ -2311,14 +2311,14 @@ class VlanNetworkInterfaceCollection : public Node
getEthernetIfaceList(
[asyncResp, rootInterfaceName{std::string(rootInterfaceName)}](
const bool& success,
- const boost::container::flat_set<std::string>& iface_list) {
+ const boost::container::flat_set<std::string>& ifaceList) {
if (!success)
{
messages::internalError(asyncResp->res);
return;
}
- if (iface_list.find(rootInterfaceName) == iface_list.end())
+ if (ifaceList.find(rootInterfaceName) == ifaceList.end())
{
messages::resourceNotFound(asyncResp->res,
"VLanNetworkInterfaceCollection",
@@ -2334,7 +2334,7 @@ class VlanNetworkInterfaceCollection : public Node
nlohmann::json ifaceArray = nlohmann::json::array();
- for (const std::string& ifaceItem : iface_list)
+ for (const std::string& ifaceItem : ifaceList)
{
if (boost::starts_with(ifaceItem, rootInterfaceName + "_"))
{
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index adc1c808cc..f22744b792 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -143,7 +143,7 @@ static int getJournalMetadata(sd_journal* journal,
}
contents = std::string_view(data, length);
// Only use the content after the "=" character.
- contents.remove_prefix(std::min(contents.find("=") + 1, contents.size()));
+ contents.remove_prefix(std::min(contents.find('=') + 1, contents.size()));
return ret;
}
@@ -319,7 +319,7 @@ static bool getTimestampFromID(crow::Response& res, const std::string& entryID,
// Convert the unique ID back to a timestamp to find the entry
std::string_view tsStr(entryID);
- auto underscorePos = tsStr.find("_");
+ auto underscorePos = tsStr.find('_');
if (underscorePos != tsStr.npos)
{
// Timestamp has an index
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 31efc7552e..b82e697b78 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -60,11 +60,11 @@ const static boost::container::flat_map<const char*, std::string>
{"IPMI", "phosphor-ipmi-net"}};
inline void
- extractNTPServersAndDomainNamesData(const GetManagedObjects& dbus_data,
+ extractNTPServersAndDomainNamesData(const GetManagedObjects& dbusData,
std::vector<std::string>& ntpData,
std::vector<std::string>& dnData)
{
- for (const auto& obj : dbus_data)
+ for (const auto& obj : dbusData)
{
for (const auto& ifacePair : obj.second)
{
@@ -107,18 +107,18 @@ void getEthernetIfaceData(CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
[callback{std::move(callback)}](
- const boost::system::error_code error_code,
- const GetManagedObjects& dbus_data) {
+ const boost::system::error_code errorCode,
+ const GetManagedObjects& dbusData) {
std::vector<std::string> ntpServers;
std::vector<std::string> domainNames;
- if (error_code)
+ if (errorCode)
{
callback(false, ntpServers, domainNames);
return;
}
- extractNTPServersAndDomainNamesData(dbus_data, ntpServers,
+ extractNTPServersAndDomainNamesData(dbusData, ntpServers,
domainNames);
callback(true, ntpServers, domainNames);
@@ -166,9 +166,9 @@ class NetworkProtocol : public Node
void getNTPProtocolEnabled(const std::shared_ptr<AsyncResp>& asyncResp)
{
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code error_code,
+ [asyncResp](const boost::system::error_code errorCode,
const std::variant<std::string>& timeSyncMethod) {
- if (error_code)
+ if (errorCode)
{
return;
}
@@ -390,8 +390,8 @@ class NetworkProtocol : public Node
}
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code error_code) {
- if (error_code)
+ [asyncResp](const boost::system::error_code errorCode) {
+ if (errorCode)
{
messages::internalError(asyncResp->res);
}
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 567cb0ca2d..14c95937f5 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -223,7 +223,7 @@ class InventoryItem
*/
template <typename Callback>
void getObjectsWithConnection(
- const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
+ const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
const std::shared_ptr<boost::container::flat_set<std::string>>& sensorNames,
Callback&& callback)
{
@@ -233,13 +233,13 @@ void getObjectsWithConnection(
"xyz.openbmc_project.Sensor.Value"};
// Response handler for parsing objects subtree
- auto respHandler = [callback{std::move(callback)}, SensorsAsyncResp,
+ auto respHandler = [callback{std::move(callback)}, sensorsAsyncResp,
sensorNames](const boost::system::error_code ec,
const GetSubTreeType& subtree) {
BMCWEB_LOG_DEBUG << "getObjectsWithConnection resp_handler enter";
if (ec)
{
- messages::internalError(SensorsAsyncResp->res);
+ messages::internalError(sensorsAsyncResp->res);
BMCWEB_LOG_ERROR
<< "getObjectsWithConnection resp_handler: Dbus error " << ec;
return;
@@ -298,7 +298,7 @@ void getObjectsWithConnection(
*/
template <typename Callback>
void getConnections(
- std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp,
+ std::shared_ptr<SensorsAsyncResp> sensorsAsyncResp,
const std::shared_ptr<boost::container::flat_set<std::string>> sensorNames,
Callback&& callback)
{
@@ -306,7 +306,7 @@ void getConnections(
[callback](const boost::container::flat_set<std::string>& connections,
const std::set<std::pair<std::string, std::string>>&
/*objectsWithConnection*/) { callback(connections); };
- getObjectsWithConnection(SensorsAsyncResp, sensorNames,
+ getObjectsWithConnection(sensorsAsyncResp, sensorNames,
std::move(objectsWithConnectionCb));
}
@@ -320,20 +320,20 @@ void getConnections(
* made, and eliminate Power sensors when a Thermal request is made.
*/
inline void reduceSensorList(
- const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
+ const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
const std::vector<std::string>* allSensors,
const std::shared_ptr<boost::container::flat_set<std::string>>&
activeSensors)
{
- if (SensorsAsyncResp == nullptr)
+ if (sensorsAsyncResp == nullptr)
{
return;
}
if ((allSensors == nullptr) || (activeSensors == nullptr))
{
messages::resourceNotFound(
- SensorsAsyncResp->res, SensorsAsyncResp->chassisSubNode,
- SensorsAsyncResp->chassisSubNode == sensors::node::thermal
+ sensorsAsyncResp->res, sensorsAsyncResp->chassisSubNode,
+ sensorsAsyncResp->chassisSubNode == sensors::node::thermal
? "Temperatures"
: "Voltages");
@@ -345,7 +345,7 @@ inline void reduceSensorList(
return;
}
- for (const char* type : SensorsAsyncResp->types)
+ for (const char* type : sensorsAsyncResp->types)
{
for (const std::string& sensor : *allSensors)
{
@@ -566,7 +566,7 @@ void getChassis(const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
*/
template <typename Callback>
void getObjectManagerPaths(
- const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
+ const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
Callback&& callback)
{
BMCWEB_LOG_DEBUG << "getObjectManagerPaths enter";
@@ -575,12 +575,12 @@ void getObjectManagerPaths(
// Response handler for GetSubTree DBus method
auto respHandler = [callback{std::move(callback)},
- SensorsAsyncResp](const boost::system::error_code ec,
+ sensorsAsyncResp](const boost::system::error_code ec,
const GetSubTreeType& subtree) {
BMCWEB_LOG_DEBUG << "getObjectManagerPaths respHandler enter";
if (ec)
{
- messages::internalError(SensorsAsyncResp->res);
+ messages::internalError(sensorsAsyncResp->res);
BMCWEB_LOG_ERROR << "getObjectManagerPaths respHandler: DBus error "
<< ec;
return;
@@ -800,7 +800,7 @@ inline void objectInterfacesToJson(
const boost::container::flat_map<
std::string, boost::container::flat_map<std::string, SensorVariant>>&
interfacesDict,
- nlohmann::json& sensor_json, InventoryItem* inventoryItem)
+ nlohmann::json& sensorJson, InventoryItem* inventoryItem)
{
// We need a value interface before we can do anything with it
auto valueIt = interfacesDict.find("xyz.openbmc_project.Sensor.Value");
@@ -828,21 +828,21 @@ inline void objectInterfacesToJson(
{
// For sensors in SensorCollection we set Id instead of MemberId,
// including power sensors.
- sensor_json["Id"] = sensorName;
- sensor_json["Name"] = boost::replace_all_copy(sensorName, "_", " ");
+ sensorJson["Id"] = sensorName;
+ sensorJson["Name"] = boost::replace_all_copy(sensorName, "_", " ");
}
else if (sensorType != "power")
{
// Set MemberId and Name for non-power sensors. For PowerSupplies and
// PowerControl, those properties have more general values because
// multiple sensors can be stored in the same JSON object.
- sensor_json["MemberId"] = sensorName;
- sensor_json["Name"] = boost::replace_all_copy(sensorName, "_", " ");
+ sensorJson["MemberId"] = sensorName;
+ sensorJson["Name"] = boost::replace_all_copy(sensorName, "_", " ");
}
- sensor_json["Status"]["State"] = getState(inventoryItem);
- sensor_json["Status"]["Health"] =
- getHealth(sensor_json, interfacesDict, inventoryItem);
+ sensorJson["Status"]["State"] = getState(inventoryItem);
+ sensorJson["Status"]["Health"] =
+ getHealth(sensorJson, interfacesDict, inventoryItem);
// Parameter to set to override the type we get from dbus, and force it to
// int, regardless of what is available. This is used for schemas like fan,
@@ -852,47 +852,47 @@ inline void objectInterfacesToJson(
nlohmann::json::json_pointer unit("/Reading");
if (sensorsAsyncResp->chassisSubNode == sensors::node::sensors)
{
- sensor_json["@odata.type"] = "#Sensor.v1_0_0.Sensor";
+ sensorJson["@odata.type"] = "#Sensor.v1_0_0.Sensor";
if (sensorType == "power")
{
- sensor_json["ReadingUnits"] = "Watts";
+ sensorJson["ReadingUnits"] = "Watts";
}
else if (sensorType == "current")
{
- sensor_json["ReadingUnits"] = "Amperes";
+ sensorJson["ReadingUnits"] = "Amperes";
}
else if (sensorType == "utilization")
{
- sensor_json["ReadingUnits"] = "Percent";
+ sensorJson["ReadingUnits"] = "Percent";
}
}
else if (sensorType == "temperature")
{
unit = "/ReadingCelsius"_json_pointer;
- sensor_json["@odata.type"] = "#Thermal.v1_3_0.Temperature";
+ sensorJson["@odata.type"] = "#Thermal.v1_3_0.Temperature";
// TODO(ed) Documentation says that path should be type fan_tach,
// implementation seems to implement fan
}
else if (sensorType == "fan" || sensorType == "fan_tach")
{
unit = "/Reading"_json_pointer;
- sensor_json["ReadingUnits"] = "RPM";
- sensor_json["@odata.type"] = "#Thermal.v1_3_0.Fan";
- setLedState(sensor_json, inventoryItem);
+ sensorJson["ReadingUnits"] = "RPM";
+ sensorJson["@odata.type"] = "#Thermal.v1_3_0.Fan";
+ setLedState(sensorJson, inventoryItem);
forceToInt = true;
}
else if (sensorType == "fan_pwm")
{
unit = "/Reading"_json_pointer;
- sensor_json["ReadingUnits"] = "Percent";
- sensor_json["@odata.type"] = "#Thermal.v1_3_0.Fan";
- setLedState(sensor_json, inventoryItem);
+ sensorJson["ReadingUnits"] = "Percent";
+ sensorJson["@odata.type"] = "#Thermal.v1_3_0.Fan";
+ setLedState(sensorJson, inventoryItem);
forceToInt = true;
}
else if (sensorType == "voltage")
{
unit = "/ReadingVolts"_json_pointer;
- sensor_json["@odata.type"] = "#Power.v1_0_0.Voltage";
+ sensorJson["@odata.type"] = "#Power.v1_0_0.Voltage";
}
else if (sensorType == "power")
{
@@ -901,11 +901,11 @@ inline void objectInterfacesToJson(
if (!sensorName.compare("total_power"))
{
- sensor_json["@odata.type"] = "#Power.v1_0_0.PowerControl";
+ sensorJson["@odata.type"] = "#Power.v1_0_0.PowerControl";
// Put multiple "sensors" into a single PowerControl, so have
// generic names for MemberId and Name. Follows Redfish mockup.
- sensor_json["MemberId"] = "0";
- sensor_json["Name"] = "Chassis Power Control";
+ sensorJson["MemberId"] = "0";
+ sensorJson["Name"] = "Chassis Power Control";
unit = "/PowerConsumedWatts"_json_pointer;
}
else if (sensorNameLower.find("input") != std::string::npos)
@@ -1027,17 +1027,17 @@ inline void objectInterfacesToJson(
temp = temp * std::pow(10, scaleMultiplier);
if (forceToInt)
{
- sensor_json[key] = static_cast<int64_t>(temp);
+ sensorJson[key] = static_cast<int64_t>(temp);
}
else
{
- sensor_json[key] = temp;
+ sensorJson[key] = temp;
}
}
}
}
- sensorsAsyncResp->addMetadata(sensor_json, unit.to_string(),
+ sensorsAsyncResp->addMetadata(sensorJson, unit.to_string(),
"/xyz/openbmc_project/sensors/" + sensorType +
"/" + sensorName);
@@ -1252,11 +1252,11 @@ inline void populateFanRedundancy(
}
inline void
- sortJSONResponse(const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp)
+ sortJSONResponse(const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp)
{
- nlohmann::json& response = SensorsAsyncResp->res.jsonValue;
+ nlohmann::json& response = sensorsAsyncResp->res.jsonValue;
std::array<std::string, 2> sensorHeaders{"Temperatures", "Fans"};
- if (SensorsAsyncResp->chassisSubNode == sensors::node::power)
+ if (sensorsAsyncResp->chassisSubNode == sensors::node::power)
{
sensorHeaders = {"Voltages", "PowerSupplies"};
}
@@ -1284,7 +1284,7 @@ inline void
{
*value += std::to_string(count);
count++;
- SensorsAsyncResp->updateUri(sensorJson["Name"], *value);
+ sensorsAsyncResp->updateUri(sensorJson["Name"], *value);
}
}
}
@@ -2418,7 +2418,7 @@ inline nlohmann::json& getPowerSupply(nlohmann::json& powerSupplyArray,
* @param inventoryItems Inventory items associated with the sensors.
*/
inline void getSensorData(
- const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
+ const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
const std::shared_ptr<boost::container::flat_set<std::string>>& sensorNames,
const boost::container::flat_set<std::string>& connections,
const std::shared_ptr<boost::container::flat_map<std::string, std::string>>&
@@ -2430,7 +2430,7 @@ inline void getSensorData(
for (const std::string& connection : connections)
{
// Response handler to process managed objects
- auto getManagedObjectsCb = [SensorsAsyncResp, sensorNames,
+ auto getManagedObjectsCb = [sensorsAsyncResp, sensorNames,
inventoryItems](
const boost::system::error_code ec,
ManagedObjectsVectorType& resp) {
@@ -2438,7 +2438,7 @@ inline void getSensorData(
if (ec)
{
BMCWEB_LOG_ERROR << "getManagedObjectsCb DBUS error: " << ec;
- messages::internalError(SensorsAsyncResp->res);
+ messages::internalError(sensorsAsyncResp->res);
return;
}
// Go through all objects and update response with sensor data
@@ -2477,17 +2477,17 @@ inline void getSensorData(
findInventoryItemForSensor(inventoryItems, objPath);
const std::string& sensorSchema =
- SensorsAsyncResp->chassisSubNode;
+ sensorsAsyncResp->chassisSubNode;
nlohmann::json* sensorJson = nullptr;
if (sensorSchema == sensors::node::sensors)
{
- SensorsAsyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Chassis/" + SensorsAsyncResp->chassisId +
- "/" + SensorsAsyncResp->chassisSubNode + "/" +
+ sensorsAsyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Chassis/" + sensorsAsyncResp->chassisId +
+ "/" + sensorsAsyncResp->chassisSubNode + "/" +
sensorName;
- sensorJson = &(SensorsAsyncResp->res.jsonValue);
+ sensorJson = &(sensorsAsyncResp->res.jsonValue);
}
else
{
@@ -2530,7 +2530,7 @@ inline void getSensorData(
}
nlohmann::json& tempArray =
- SensorsAsyncResp->res.jsonValue[fieldName];
+ sensorsAsyncResp->res.jsonValue[fieldName];
if (fieldName == "PowerControl")
{
if (tempArray.empty())
@@ -2541,8 +2541,8 @@ inline void getSensorData(
tempArray.push_back(
{{"@odata.id",
"/redfish/v1/Chassis/" +
- SensorsAsyncResp->chassisId + "/" +
- SensorsAsyncResp->chassisSubNode + "#/" +
+ sensorsAsyncResp->chassisId + "/" +
+ sensorsAsyncResp->chassisSubNode + "#/" +
fieldName + "/0"}});
}
sensorJson = &(tempArray.back());
@@ -2553,7 +2553,7 @@ inline void getSensorData(
{
sensorJson =
&(getPowerSupply(tempArray, *inventoryItem,
- SensorsAsyncResp->chassisId));
+ sensorsAsyncResp->chassisId));
}
}
else
@@ -2561,8 +2561,8 @@ inline void getSensorData(
tempArray.push_back(
{{"@odata.id",
"/redfish/v1/Chassis/" +
- SensorsAsyncResp->chassisId + "/" +
- SensorsAsyncResp->chassisSubNode + "#/" +
+ sensorsAsyncResp->chassisId + "/" +
+ sensorsAsyncResp->chassisSubNode + "#/" +
fieldName + "/"}});
sensorJson = &(tempArray.back());
}
@@ -2571,16 +2571,16 @@ inline void getSensorData(
if (sensorJson != nullptr)
{
objectInterfacesToJson(
- sensorName, sensorType, SensorsAsyncResp,
+ sensorName, sensorType, sensorsAsyncResp,
objDictEntry.second, *sensorJson, inventoryItem);
}
}
- if (SensorsAsyncResp.use_count() == 1)
+ if (sensorsAsyncResp.use_count() == 1)
{
- sortJSONResponse(SensorsAsyncResp);
- if (SensorsAsyncResp->chassisSubNode == sensors::node::thermal)
+ sortJSONResponse(sensorsAsyncResp);
+ if (sensorsAsyncResp->chassisSubNode == sensors::node::thermal)
{
- populateFanRedundancy(SensorsAsyncResp);
+ populateFanRedundancy(sensorsAsyncResp);
}
}
BMCWEB_LOG_DEBUG << "getManagedObjectsCb exit";
@@ -2602,33 +2602,33 @@ inline void getSensorData(
}
inline void processSensorList(
- const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp,
+ const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
const std::shared_ptr<boost::container::flat_set<std::string>>& sensorNames)
{
auto getConnectionCb =
- [SensorsAsyncResp, sensorNames](
+ [sensorsAsyncResp, sensorNames](
const boost::container::flat_set<std::string>& connections) {
BMCWEB_LOG_DEBUG << "getConnectionCb enter";
auto getObjectManagerPathsCb =
- [SensorsAsyncResp, sensorNames,
+ [sensorsAsyncResp, sensorNames,
connections](const std::shared_ptr<boost::container::flat_map<
std::string, std::string>>& objectMgrPaths) {
BMCWEB_LOG_DEBUG << "getObjectManagerPathsCb enter";
auto getInventoryItemsCb =
- [SensorsAsyncResp, sensorNames, connections,
+ [sensorsAsyncResp, sensorNames, connections,
objectMgrPaths](
const std::shared_ptr<std::vector<InventoryItem>>&
inventoryItems) {
BMCWEB_LOG_DEBUG << "getInventoryItemsCb enter";
// Get sensor data and store results in JSON
- getSensorData(SensorsAsyncResp, sensorNames,
+ getSensorData(sensorsAsyncResp, sensorNames,
connections, objectMgrPaths,
inventoryItems);
BMCWEB_LOG_DEBUG << "getInventoryItemsCb exit";
};
// Get inventory items associated with sensors
- getInventoryItems(SensorsAsyncResp, sensorNames,
+ getInventoryItems(sensorsAsyncResp, sensorNames,
objectMgrPaths,
std::move(getInventoryItemsCb));
@@ -2637,13 +2637,13 @@ inline void processSensorList(
// Get mapping from connection names to the DBus object
// paths that implement the ObjectManager interface
- getObjectManagerPaths(SensorsAsyncResp,
+ getObjectManagerPaths(sensorsAsyncResp,
std::move(getObjectManagerPathsCb));
BMCWEB_LOG_DEBUG << "getConnectionCb exit";
};
// Get set of connections that provide sensor values
- getConnections(SensorsAsyncResp, sensorNames, std::move(getConnectionCb));
+ getConnections(sensorsAsyncResp, sensorNames, std::move(getConnectionCb));
}
/**
@@ -2652,21 +2652,21 @@ inline void processSensorList(
* @param SensorsAsyncResp Pointer to object holding response data
*/
inline void
- getChassisData(const std::shared_ptr<SensorsAsyncResp>& SensorsAsyncResp)
+ getChassisData(const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp)
{
BMCWEB_LOG_DEBUG << "getChassisData enter";
auto getChassisCb =
- [SensorsAsyncResp](
+ [sensorsAsyncResp](
const std::shared_ptr<boost::container::flat_set<std::string>>&
sensorNames) {
BMCWEB_LOG_DEBUG << "getChassisCb enter";
- processSensorList(SensorsAsyncResp, sensorNames);
+ processSensorList(sensorsAsyncResp, sensorNames);
BMCWEB_LOG_DEBUG << "getChassisCb exit";
};
- SensorsAsyncResp->res.jsonValue["Redundancy"] = nlohmann::json::array();
+ sensorsAsyncResp->res.jsonValue["Redundancy"] = nlohmann::json::array();
// Get set of sensors in chassis
- getChassis(SensorsAsyncResp, std::move(getChassisCb));
+ getChassis(sensorsAsyncResp, std::move(getChassisCb));
BMCWEB_LOG_DEBUG << "getChassisData exit";
}
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index ddb8b30a6c..0eb9d103b9 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -44,11 +44,11 @@ static void activateImage(const std::string& objPath,
{
BMCWEB_LOG_DEBUG << "Activate image for " << objPath << " " << service;
crow::connections::systemBus->async_method_call(
- [](const boost::system::error_code error_code) {
- if (error_code)
+ [](const boost::system::error_code errorCode) {
+ if (errorCode)
{
- BMCWEB_LOG_DEBUG << "error_code = " << error_code;
- BMCWEB_LOG_DEBUG << "error msg = " << error_code.message();
+ BMCWEB_LOG_DEBUG << "error_code = " << errorCode;
+ BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message();
}
},
service, objPath, "org.freedesktop.DBus.Properties", "Set",
@@ -83,14 +83,14 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp,
// Retrieve service and activate
crow::connections::systemBus->async_method_call(
[objPath, asyncResp,
- req](const boost::system::error_code error_code,
+ req](const boost::system::error_code errorCode,
const std::vector<std::pair<
std::string, std::vector<std::string>>>& objInfo) {
- if (error_code)
+ if (errorCode)
{
- BMCWEB_LOG_DEBUG << "error_code = " << error_code;
+ BMCWEB_LOG_DEBUG << "error_code = " << errorCode;
BMCWEB_LOG_DEBUG << "error msg = "
- << error_code.message();
+ << errorCode.message();
if (asyncResp)
{
messages::internalError(asyncResp->res);
@@ -848,10 +848,10 @@ class SoftwareInventory : public Node
crow::connections::systemBus->async_method_call(
[asyncResp,
- swId](const boost::system::error_code error_code,
+ swId](const boost::system::error_code errorCode,
const boost::container::flat_map<
std::string, VariantType>& propertiesList) {
- if (error_code)
+ if (errorCode)
{
messages::internalError(asyncResp->res);
return;
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 6d1672c66b..95a8881ab2 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -55,7 +55,7 @@ static std::string getTransferProtocolTypeFromUri(const std::string& imageUri)
* @brief Read all known properties from VM object interfaces
*/
static void vmParseInterfaceObject(const DbusInterfaceType& interface,
- std::shared_ptr<AsyncResp> aResp)
+ const std::shared_ptr<AsyncResp>& aResp)
{
const auto mountPointIface =
interface.find("xyz.openbmc_project.VirtualMedia.MountPoint");
@@ -227,7 +227,7 @@ static void getVmResourceList(std::shared_ptr<AsyncResp> aResp,
/**
* @brief Fills data for specific resource
*/
-static void getVmData(std::shared_ptr<AsyncResp> aResp,
+static void getVmData(const std::shared_ptr<AsyncResp>& aResp,
const std::string& service, const std::string& name,
const std::string& resName)
{
@@ -334,7 +334,7 @@ class VirtualMediaActionInsertMedia : public Node
{
return TransferProtocol::smb;
}
- else if (scheme == "https")
+ if (scheme == "https")
{
return TransferProtocol::https;
}
@@ -380,7 +380,7 @@ class VirtualMediaActionInsertMedia : public Node
* @brief Function extends URI with transfer protocol type.
*
*/
- const std::string
+ std::string
getUriWithTransferProtocol(const std::string& imageUri,
const TransferProtocol& transferProtocol)
{
@@ -557,9 +557,9 @@ class VirtualMediaActionInsertMedia : public Node
BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
crow::connections::systemBus->async_method_call(
- [this, service, resName, req, aResp{std::move(aResp)}](
- const boost::system::error_code ec,
- ManagedObjectType& subtree) {
+ [this, service, resName, req,
+ aResp{aResp}](const boost::system::error_code ec,
+ ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -635,10 +635,10 @@ class VirtualMediaActionInsertMedia : public Node
// manager is irrelevant for VirtualMedia dbus
// calls
- doMountVmLegacy(
- std::move(aResp), service, resName,
- imageUrl, !(*writeProtected),
- std::move(*userName), std::move(*password));
+ doMountVmLegacy(aResp, service, resName,
+ imageUrl, !(*writeProtected),
+ std::move(*userName),
+ std::move(*password));
return;
}
@@ -732,7 +732,7 @@ class VirtualMediaActionInsertMedia : public Node
return credentials.password();
}
- SecureBuffer pack(const FormatterFunc formatter)
+ SecureBuffer pack(FormatterFunc formatter)
{
SecureBuffer packed{new Buffer{}};
if (formatter)
@@ -770,7 +770,7 @@ class VirtualMediaActionInsertMedia : public Node
}
template <typename WriteHandler>
- void async_write(WriteHandler&& handler)
+ void asyncWrite(WriteHandler&& handler)
{
impl.async_write_some(data(), std::forward<WriteHandler>(handler));
}
@@ -803,7 +803,7 @@ class VirtualMediaActionInsertMedia : public Node
*
* All BMC state properties will be retrieved before sending reset request.
*/
- void doMountVmLegacy(std::shared_ptr<AsyncResp> asyncResp,
+ void doMountVmLegacy(const std::shared_ptr<AsyncResp>& asyncResp,
const std::string& service, const std::string& name,
const std::string& imageUrl, const bool rw,
std::string&& userName, std::string&& password)
@@ -845,7 +845,7 @@ class VirtualMediaActionInsertMedia : public Node
unixFd = secretPipe->fd();
// Pass secret over pipe
- secretPipe->async_write(
+ secretPipe->asyncWrite(
[asyncResp](const boost::system::error_code& ec, std::size_t) {
if (ec)
{
@@ -939,9 +939,9 @@ class VirtualMediaActionEjectMedia : public Node
BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
crow::connections::systemBus->async_method_call(
- [this, resName, service, req, aResp{std::move(aResp)}](
- const boost::system::error_code ec,
- ManagedObjectType& subtree) {
+ [this, resName, service, req,
+ aResp{aResp}](const boost::system::error_code ec,
+ ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -968,16 +968,14 @@ class VirtualMediaActionEjectMedia : public Node
if (lastIndex != std::string::npos)
{
// Proxy mode
- doVmAction(std::move(aResp), service,
- resName, false);
+ doVmAction(aResp, service, resName, false);
}
lastIndex = path.rfind("Legacy");
if (lastIndex != std::string::npos)
{
// Legacy mode
- doVmAction(std::move(aResp), service,
- resName, true);
+ doVmAction(aResp, service, resName, true);
}
return;
@@ -1001,7 +999,7 @@ class VirtualMediaActionEjectMedia : public Node
*
* All BMC state properties will be retrieved before sending reset request.
*/
- void doVmAction(std::shared_ptr<AsyncResp> asyncResp,
+ void doVmAction(const std::shared_ptr<AsyncResp>& asyncResp,
const std::string& service, const std::string& name,
bool legacy)
{