summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DEVELOPING.md34
-rw-r--r--http/http_connection.h8
-rw-r--r--http/routing.h6
-rw-r--r--http/utility.h6
-rw-r--r--http/websocket.h4
-rw-r--r--include/dbus_monitor.hpp25
-rw-r--r--include/ibm/management_console_rest.hpp8
-rw-r--r--include/json_html_serializer.hpp32
-rw-r--r--include/kvm_websocket.hpp2
-rw-r--r--include/nbd_proxy.hpp2
-rw-r--r--include/obmc_console.hpp16
-rw-r--r--include/openbmc_dbus_rest.hpp8
-rw-r--r--include/vm_websocket.hpp2
-rw-r--r--redfish-core/include/node.hpp6
-rw-r--r--redfish-core/include/resource_messages.hpp6
-rw-r--r--redfish-core/include/utils/json_utils.hpp35
-rw-r--r--redfish-core/lib/account_service.hpp6
-rw-r--r--redfish-core/lib/certificate_service.hpp12
-rw-r--r--redfish-core/lib/ethernet.hpp349
-rw-r--r--redfish-core/lib/hypervisor_ethernet.hpp8
-rw-r--r--redfish-core/lib/log_services.hpp10
-rw-r--r--redfish-core/lib/network_protocol.hpp6
-rw-r--r--redfish-core/lib/power.hpp4
-rw-r--r--redfish-core/lib/systems.hpp10
24 files changed, 302 insertions, 303 deletions
diff --git a/DEVELOPING.md b/DEVELOPING.md
index 6e5e1ed00f..3c33c6474d 100644
--- a/DEVELOPING.md
+++ b/DEVELOPING.md
@@ -225,17 +225,29 @@
## clang-tidy
clang-tidy is a tool that can be used to identify coding style violations, bad
-design patterns, and bug prone constructs. It's not guaranteed that all tests
-pass, but ideally should be run on new code to find issues. To run, make sure
-you have clang++-9 installed, and clang-tidy-9 installed, and run. the -checks
-field can be modified to enable or disable which clang-tidy checks are run.
-The below enables everything in the cert namespace.
+design patterns, and bug prone constructs. The checks are implemented in the
+.clang-tidy file in the root of bmcweb, and are expected to be passing. To
+run, the best way is to run the checks in yocto.
```
-mkdir build
-cd build
-cmake .. -DCMAKE_CXX_COMPILER=clang++-9 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-make -j
-run-clang-tidy-9 -p . -header-filter=".*" -checks="-*,cert-*"
-```
+# check out meta-clang in your openbmc root
+cd openbmc
+git clone https://github.com/kraj/meta-clang
+
+# add the meta-clang layer to BBLAYERS in $BBPATH/conf/bblayers.conf
+<path_to_your_build_dir>/meta-clang
+
+# Add this line to $BBPATH/conf/local.conf to build bmcweb with clang
+TOOLCHAIN_pn-bmcweb = "clang"
+# and build
+bitbake bmcweb
+
+# Open devshell (this will open a shell)
+bitbake -c devshell bmcweb
+
+# cd into the work dir
+cd oe-workdir/bmcweb-1.0+git999
+# run clang tidy
+clang-tidy --header-filter=".*" -p . $BBPATH/workspace/sources/bmcweb/src/webserver_main.cpp
+```
diff --git a/http/http_connection.h b/http/http_connection.h
index b07459df92..3459d551f7 100644
--- a/http/http_connection.h
+++ b/http/http_connection.h
@@ -74,11 +74,11 @@ class Connection :
req.emplace(parser->get());
#ifdef BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
- auto ca_available = !std::filesystem::is_empty(
+ auto caAvailable = !std::filesystem::is_empty(
std::filesystem::path(ensuressl::trustStorePath));
- if (ca_available && persistent_data::SessionStore::getInstance()
- .getAuthMethodsConfig()
- .tls)
+ if (caAvailable && persistent_data::SessionStore::getInstance()
+ .getAuthMethodsConfig()
+ .tls)
{
adaptor.set_verify_mode(boost::asio::ssl::verify_peer);
SSL_set_session_id_context(
diff --git a/http/routing.h b/http/routing.h
index 1af1b2bc47..7b9086a8da 100644
--- a/http/routing.h
+++ b/http/routing.h
@@ -1059,10 +1059,10 @@ class Router
{
return;
}
- for (uint32_t method = 0, method_bit = 1; method < maxHttpVerbCount;
- method++, method_bit <<= 1)
+ for (uint32_t method = 0, methodBit = 1; method < maxHttpVerbCount;
+ method++, methodBit <<= 1)
{
- if (ruleObject->methodsBitfield & method_bit)
+ if (ruleObject->methodsBitfield & methodBit)
{
perMethods[method].rules.emplace_back(ruleObject);
perMethods[method].trie.add(
diff --git a/http/utility.h b/http/utility.h
index ec0a88939d..862f1db145 100644
--- a/http/utility.h
+++ b/http/utility.h
@@ -315,12 +315,12 @@ struct CallHelper<F, S<Args...>>
{
template <typename F1, typename... Args1,
typename = decltype(std::declval<F1>()(std::declval<Args1>()...))>
- static char __test(int);
+ static char test(int);
template <typename...>
- static int __test(...);
+ static int test(...);
- static constexpr bool value = sizeof(__test<F, Args...>(0)) == sizeof(char);
+ static constexpr bool value = sizeof(test<F, Args...>(0)) == sizeof(char);
};
template <uint64_t N>
diff --git a/http/websocket.h b/http/websocket.h
index 61b3463bb7..021fffa07b 100644
--- a/http/websocket.h
+++ b/http/websocket.h
@@ -34,7 +34,7 @@ struct Connection : std::enable_shared_from_this<Connection>
virtual void sendText(const std::string_view msg) = 0;
virtual void sendText(std::string&& msg) = 0;
virtual void close(const std::string_view msg = "quit") = 0;
- virtual boost::asio::io_context& get_io_context() = 0;
+ virtual boost::asio::io_context& getIoContext() = 0;
virtual ~Connection() = default;
void userdata(void* u)
@@ -81,7 +81,7 @@ class ConnectionImpl : public Connection
BMCWEB_LOG_DEBUG << "Creating new connection " << this;
}
- boost::asio::io_context& get_io_context() override
+ boost::asio::io_context& getIoContext() override
{
return static_cast<boost::asio::io_context&>(
ws.get_executor().context());
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp
index 3f0b826a9e..e17738893a 100644
--- a/include/dbus_monitor.hpp
+++ b/include/dbus_monitor.hpp
@@ -168,9 +168,9 @@ inline void requestRoutes(App& app)
paths->size() *
(1U + interfaceCount));
}
- std::string object_manager_match_string;
- std::string properties_match_string;
- std::string object_manager_interfaces_match_string;
+ std::string objectManagerMatchString;
+ std::string propertiesMatchString;
+ std::string objectManagerInterfacesMatchString;
// These regexes derived on the rules here:
// https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names
std::regex validPath("^/([A-Za-z0-9_]+/?)*$");
@@ -193,7 +193,7 @@ inline void requestRoutes(App& app)
conn.close();
return;
}
- properties_match_string =
+ propertiesMatchString =
("type='signal',"
"interface='org.freedesktop.DBus.Properties',"
"path_namespace='" +
@@ -205,12 +205,12 @@ inline void requestRoutes(App& app)
if (thisSession.interfaces.size() == 0)
{
BMCWEB_LOG_DEBUG << "Creating match "
- << properties_match_string;
+ << propertiesMatchString;
thisSession.matches.emplace_back(
std::make_unique<sdbusplus::bus::match::match>(
*crow::connections::systemBus,
- properties_match_string, onPropertyUpdate, &conn));
+ propertiesMatchString, onPropertyUpdate, &conn));
}
else
{
@@ -225,9 +225,8 @@ inline void requestRoutes(App& app)
conn.close();
return;
}
- std::string ifaceMatchString = properties_match_string +
- ",arg0='" + interface +
- "'";
+ std::string ifaceMatchString =
+ propertiesMatchString + ",arg0='" + interface + "'";
BMCWEB_LOG_DEBUG << "Creating match "
<< ifaceMatchString;
thisSession.matches.emplace_back(
@@ -236,7 +235,7 @@ inline void requestRoutes(App& app)
onPropertyUpdate, &conn));
}
}
- object_manager_match_string =
+ objectManagerMatchString =
("type='signal',"
"interface='org.freedesktop.DBus.ObjectManager',"
"path_namespace='" +
@@ -244,11 +243,11 @@ inline void requestRoutes(App& app)
"',"
"member='InterfacesAdded'");
BMCWEB_LOG_DEBUG << "Creating match "
- << object_manager_match_string;
+ << objectManagerMatchString;
thisSession.matches.emplace_back(
std::make_unique<sdbusplus::bus::match::match>(
- *crow::connections::systemBus,
- object_manager_match_string, onPropertyUpdate, &conn));
+ *crow::connections::systemBus, objectManagerMatchString,
+ onPropertyUpdate, &conn));
}
});
}
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index e789bda235..c318cc6618 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -144,7 +144,7 @@ inline void handleFilePut(const crow::Request& req, crow::Response& res,
res.jsonValue["Description"] = "File Updated";
redfish::EventServiceManager::getInstance().sendEvent(
- redfish::messages::ResourceChanged(), origin, "IBMConfigFile");
+ redfish::messages::resourceChanged(), origin, "IBMConfigFile");
}
else
{
@@ -152,7 +152,7 @@ inline void handleFilePut(const crow::Request& req, crow::Response& res,
res.jsonValue["Description"] = "File Created";
redfish::EventServiceManager::getInstance().sendEvent(
- redfish::messages::ResourceCreated(), origin, "IBMConfigFile");
+ redfish::messages::resourceCreated(), origin, "IBMConfigFile");
}
}
}
@@ -255,8 +255,8 @@ inline void handleFileDelete(crow::Response& res, const std::string& fileID)
std::string filePath("/var/lib/obmc/bmc-console-mgmt/save-area/" + fileID);
BMCWEB_LOG_DEBUG << "Removing the file : " << filePath << "\n";
- std::ifstream file_open(filePath.c_str());
- if (static_cast<bool>(file_open))
+ std::ifstream fileOpen(filePath.c_str());
+ if (static_cast<bool>(fileOpen))
if (remove(filePath.c_str()) == 0)
{
BMCWEB_LOG_DEBUG << "File removed!\n";
diff --git a/include/json_html_serializer.hpp b/include/json_html_serializer.hpp
index 174b0869f5..f8248c86c0 100644
--- a/include/json_html_serializer.hpp
+++ b/include/json_html_serializer.hpp
@@ -56,7 +56,7 @@ inline void dumpEscaped(std::string& out, const std::string& str)
std::size_t bytes = 0; // number of bytes written to string_buffer
// number of bytes written at the point of the last valid byte
- std::size_t bytes_after_last_accept = 0;
+ std::size_t bytesAfterLastAccept = 0;
std::size_t undumpedChars = 0;
for (std::size_t i = 0; i < str.size(); ++i)
@@ -198,7 +198,7 @@ inline void dumpEscaped(std::string& out, const std::string& str)
}
// remember the byte position of this accept
- bytes_after_last_accept = bytes;
+ bytesAfterLastAccept = bytes;
undumpedChars = 0;
break;
}
@@ -216,7 +216,7 @@ inline void dumpEscaped(std::string& out, const std::string& str)
// reset length buffer to the last accepted index;
// thus removing/ignoring the invalid characters
- bytes = bytes_after_last_accept;
+ bytes = bytesAfterLastAccept;
stringBuffer[bytes++] = '\\';
stringBuffer[bytes++] = 'u';
@@ -225,7 +225,7 @@ inline void dumpEscaped(std::string& out, const std::string& str)
stringBuffer[bytes++] = 'f';
stringBuffer[bytes++] = 'd';
- bytes_after_last_accept = bytes;
+ bytesAfterLastAccept = bytes;
undumpedChars = 0;
@@ -256,34 +256,34 @@ inline void dumpEscaped(std::string& out, const std::string& str)
else
{
// write all accepted bytes
- out.append(stringBuffer.data(), bytes_after_last_accept);
+ out.append(stringBuffer.data(), bytesAfterLastAccept);
out += "\\ufffd";
}
}
inline unsigned int countDigits(uint64_t number) noexcept
{
- unsigned int n_digits = 1;
+ unsigned int nDigits = 1;
for (;;)
{
if (number < 10)
{
- return n_digits;
+ return nDigits;
}
if (number < 100)
{
- return n_digits + 1;
+ return nDigits + 1;
}
if (number < 1000)
{
- return n_digits + 2;
+ return nDigits + 2;
}
if (number < 10000)
{
- return n_digits + 3;
+ return nDigits + 3;
}
number = number / 10000u;
- n_digits += 4;
+ nDigits += 4;
}
}
@@ -295,7 +295,7 @@ void dumpInteger(std::string& out, NumberType number)
{
std::array<char, 64> numberbuffer{{}};
- static constexpr std::array<std::array<char, 2>, 100> digits_to_99{{
+ static constexpr std::array<std::array<char, 2>, 100> digitsTo99{{
{'0', '0'}, {'0', '1'}, {'0', '2'}, {'0', '3'}, {'0', '4'}, {'0', '5'},
{'0', '6'}, {'0', '7'}, {'0', '8'}, {'0', '9'}, {'1', '0'}, {'1', '1'},
{'1', '2'}, {'1', '3'}, {'1', '4'}, {'1', '5'}, {'1', '6'}, {'1', '7'},
@@ -361,15 +361,15 @@ void dumpInteger(std::string& out, NumberType number)
{
const auto digitsIndex = static_cast<unsigned>((absValue % 100));
absValue /= 100;
- *(--bufferPtr) = digits_to_99[digitsIndex][1];
- *(--bufferPtr) = digits_to_99[digitsIndex][0];
+ *(--bufferPtr) = digitsTo99[digitsIndex][1];
+ *(--bufferPtr) = digitsTo99[digitsIndex][0];
}
if (absValue >= 10)
{
const auto digitsIndex = static_cast<unsigned>(absValue);
- *(--bufferPtr) = digits_to_99[digitsIndex][1];
- *(--bufferPtr) = digits_to_99[digitsIndex][0];
+ *(--bufferPtr) = digitsTo99[digitsIndex][1];
+ *(--bufferPtr) = digitsTo99[digitsIndex][0];
}
else
{
diff --git a/include/kvm_websocket.hpp b/include/kvm_websocket.hpp
index df50778e43..fea3840dea 100644
--- a/include/kvm_websocket.hpp
+++ b/include/kvm_websocket.hpp
@@ -17,7 +17,7 @@ class KvmSession
{
public:
explicit KvmSession(crow::websocket::Connection& connIn) :
- conn(connIn), hostSocket(conn.get_io_context()), doingWrite(false)
+ conn(connIn), hostSocket(conn.getIoContext()), doingWrite(false)
{
boost::asio::ip::tcp::endpoint endpoint(
boost::asio::ip::make_address("127.0.0.1"), 5900);
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index ee0d9cd557..a7f8c6d887 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -44,7 +44,7 @@ struct NbdProxyServer : std::enable_shared_from_this<NbdProxyServer>
const std::string& endpointIdIn, const std::string& pathIn) :
socketId(socketIdIn),
endpointId(endpointIdIn), path(pathIn),
- acceptor(connIn.get_io_context(), stream_protocol::endpoint(socketId)),
+ acceptor(connIn.getIoContext(), stream_protocol::endpoint(socketId)),
connection(connIn)
{}
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index 29efbef782..06df7fd1b1 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -13,7 +13,7 @@ namespace crow
namespace obmc_console
{
-static std::unique_ptr<boost::asio::local::stream_protocol::socket> host_socket;
+static std::unique_ptr<boost::asio::local::stream_protocol::socket> hostSocket;
static std::array<char, 4096> outputBuffer;
static std::string inputBuffer;
@@ -37,7 +37,7 @@ inline void doWrite()
}
doingWrite = true;
- host_socket->async_write_some(
+ hostSocket->async_write_some(
boost::asio::buffer(inputBuffer.data(), inputBuffer.size()),
[](boost::beast::error_code ec, std::size_t bytes_written) {
doingWrite = false;
@@ -63,7 +63,7 @@ inline void doWrite()
inline void doRead()
{
BMCWEB_LOG_DEBUG << "Reading from socket";
- host_socket->async_read_some(
+ hostSocket->async_read_some(
boost::asio::buffer(outputBuffer.data(), outputBuffer.size()),
[](const boost::system::error_code& ec, std::size_t bytesRead) {
BMCWEB_LOG_DEBUG << "read done. Read " << bytesRead << " bytes";
@@ -112,15 +112,15 @@ inline void requestRoutes(App& app)
BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
sessions.insert(&conn);
- if (host_socket == nullptr)
+ if (hostSocket == nullptr)
{
const std::string consoleName("\0obmc-console", 13);
boost::asio::local::stream_protocol::endpoint ep(consoleName);
- host_socket = std::make_unique<
+ hostSocket = std::make_unique<
boost::asio::local::stream_protocol::socket>(
- conn.get_io_context());
- host_socket->async_connect(ep, connectHandler);
+ conn.getIoContext());
+ hostSocket->async_connect(ep, connectHandler);
}
})
.onclose([](crow::websocket::Connection& conn,
@@ -128,7 +128,7 @@ inline void requestRoutes(App& app)
sessions.erase(&conn);
if (sessions.empty())
{
- host_socket = nullptr;
+ hostSocket = nullptr;
inputBuffer.clear();
inputBuffer.shrink_to_fit();
}
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index d66c5f1728..f8d5d4a125 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -821,17 +821,17 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& arg_type,
{
return -1;
}
- const std::string& key_type = codes[0];
- const std::string& value_type = codes[1];
+ const std::string& keyType = codes[0];
+ const std::string& valueType = codes[1];
for (auto it : j->items())
{
- r = convertJsonToDbus(m, key_type, it.key());
+ r = convertJsonToDbus(m, keyType, it.key());
if (r < 0)
{
return r;
}
- r = convertJsonToDbus(m, value_type, it.value());
+ r = convertJsonToDbus(m, valueType, it.value());
if (r < 0)
{
return r;
diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp
index da9a06f040..85219939fd 100644
--- a/include/vm_websocket.hpp
+++ b/include/vm_websocket.hpp
@@ -180,7 +180,7 @@ inline void requestRoutes(App& app)
// media is the last digit of the endpoint /vm/0/0. A future
// enhancement can include supporting different endpoint values.
const char* media = "0";
- handler = std::make_shared<Handler>(media, conn.get_io_context());
+ handler = std::make_shared<Handler>(media, conn.getIoContext());
handler->connect();
})
.onclose([](crow::websocket::Connection& conn,
diff --git a/redfish-core/include/node.hpp b/redfish-core/include/node.hpp
index 797160db7f..9863794e62 100644
--- a/redfish-core/include/node.hpp
+++ b/redfish-core/include/node.hpp
@@ -91,9 +91,9 @@ class Node
doPut(res, req, paramVec);
});
- crow::DynamicRule& delete_ = app.routeDynamic(entityUrl.c_str());
- deleteRule = &delete_;
- delete_.methods(boost::beast::http::verb::delete_)(
+ crow::DynamicRule& deleteR = app.routeDynamic(entityUrl.c_str());
+ deleteRule = &deleteR;
+ deleteR.methods(boost::beast::http::verb::delete_)(
[this](const crow::Request& req, crow::Response& res,
Params... params) {
std::vector<std::string> paramVec = {params...};
diff --git a/redfish-core/include/resource_messages.hpp b/redfish-core/include/resource_messages.hpp
index 9826566e27..17157fe250 100644
--- a/redfish-core/include/resource_messages.hpp
+++ b/redfish-core/include/resource_messages.hpp
@@ -5,7 +5,7 @@ namespace redfish
namespace messages
{
-inline nlohmann::json ResourceChanged(void)
+inline nlohmann::json resourceChanged(void)
{
return nlohmann::json{
{"EventType", "ResourceChanged"},
@@ -16,7 +16,7 @@ inline nlohmann::json ResourceChanged(void)
{"MessageSeverity", "OK"}};
}
-inline nlohmann::json ResourceCreated(void)
+inline nlohmann::json resourceCreated(void)
{
return nlohmann::json{
{"EventType", "ResourceAdded"},
@@ -27,7 +27,7 @@ inline nlohmann::json ResourceCreated(void)
{"MessageSeverity", "OK"}};
}
-inline nlohmann::json ResourceRemoved(void)
+inline nlohmann::json resourceRemoved(void)
{
return nlohmann::json{
{"EventType", "ResourceRemoved"},
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index c4f54d719c..7bd8bb874c 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -46,38 +46,29 @@ namespace details
{
template <typename Type>
-struct is_optional : std::false_type
+struct IsOptional : std::false_type
{};
template <typename Type>
-struct is_optional<std::optional<Type>> : std::true_type
+struct IsOptional<std::optional<Type>> : std::true_type
{};
template <typename Type>
-constexpr bool is_optional_v = is_optional<Type>::value;
-
-template <typename Type>
-struct is_vector : std::false_type
+struct IsVector : std::false_type
{};
template <typename Type>
-struct is_vector<std::vector<Type>> : std::true_type
+struct IsVector<std::vector<Type>> : std::true_type
{};
template <typename Type>
-constexpr bool is_vector_v = is_vector<Type>::value;
-
-template <typename Type>
-struct is_std_array : std::false_type
+struct IsStdArray : std::false_type
{};
template <typename Type, std::size_t size>
-struct is_std_array<std::array<Type, size>> : std::true_type
+struct IsStdArray<std::array<Type, size>> : std::true_type
{};
-template <typename Type>
-constexpr bool is_std_array_v = is_std_array<Type>::value;
-
enum class UnpackErrorCode
{
success,
@@ -206,14 +197,14 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key,
{
bool ret = true;
- if constexpr (is_optional_v<Type>)
+ if constexpr (IsOptional<Type>::value)
{
value.emplace();
ret = unpackValue<typename Type::value_type>(jsonValue, key, res,
*value) &&
ret;
}
- else if constexpr (is_std_array_v<Type>)
+ else if constexpr (IsStdArray<Type>::value)
{
if (!jsonValue.is_array())
{
@@ -233,7 +224,7 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key,
ret;
}
}
- else if constexpr (is_vector_v<Type>)
+ else if constexpr (IsVector<Type>::value)
{
if (!jsonValue.is_array())
{
@@ -273,13 +264,13 @@ template <typename Type>
bool unpackValue(nlohmann::json& jsonValue, const std::string& key, Type& value)
{
bool ret = true;
- if constexpr (is_optional_v<Type>)
+ if constexpr (IsOptional<Type>::value)
{
value.emplace();
ret = unpackValue<typename Type::value_type>(jsonValue, key, *value) &&
ret;
}
- else if constexpr (is_std_array_v<Type>)
+ else if constexpr (IsStdArray<Type>::value)
{
if (!jsonValue.is_array())
{
@@ -297,7 +288,7 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key, Type& value)
ret;
}
}
- else if constexpr (is_vector_v<Type>)
+ else if constexpr (IsVector<Type>::value)
{
if (!jsonValue.is_array())
{
@@ -366,7 +357,7 @@ bool handleMissing(std::bitset<Count>& handled, crow::Response& res,
const char* key, ValueType&, UnpackTypes&... in)
{
bool ret = true;
- if (!handled.test(Index) && !is_optional_v<ValueType>)
+ if (!handled.test(Index) && !IsOptional<ValueType>::value)
{
ret = false;
messages::propertyMissing(res, key);
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index fae181ce89..dd63913ef2 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -29,7 +29,7 @@ namespace redfish
constexpr const char* ldapConfigObjectName =
"/xyz/openbmc_project/user/ldap/openldap";
-constexpr const char* ADConfigObject =
+constexpr const char* adConfigObject =
"/xyz/openbmc_project/user/ldap/active_directory";
constexpr const char* ldapRootObject = "/xyz/openbmc_project/user/ldap";
@@ -340,7 +340,7 @@ inline void handleRoleMapPatch(
std::string dbusObjectPath;
if (serverType == "ActiveDirectory")
{
- dbusObjectPath = ADConfigObject;
+ dbusObjectPath = adConfigObject;
}
else if (serverType == "LDAP")
{
@@ -970,7 +970,7 @@ class AccountService : public Node
std::string dbusObjectPath;
if (serverType == "ActiveDirectory")
{
- dbusObjectPath = ADConfigObject;
+ dbusObjectPath = adConfigObject;
}
else if (serverType == "LDAP")
{
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 35c60b17fd..514222163c 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -263,7 +263,7 @@ class CertificateActionGenerateCSR : public Node
void doPost(crow::Response& res, const crow::Request& req,
const std::vector<std::string>&) override
{
- static const int RSA_KEY_BIT_LENGTH = 2048;
+ static const int rsaKeyBitLength = 2048;
auto asyncResp = std::make_shared<AsyncResp>(res);
// Required parameters
std::string city;
@@ -282,7 +282,7 @@ class CertificateActionGenerateCSR : public Node
std::optional<std::string> optEmail = "";
std::optional<std::string> optGivenName = "";
std::optional<std::string> optInitials = "";
- std::optional<int64_t> optKeyBitLength = RSA_KEY_BIT_LENGTH;
+ std::optional<int64_t> optKeyBitLength = rsaKeyBitLength;
std::optional<std::string> optKeyCurveId = "secp384r1";
std::optional<std::string> optKeyPairAlgorithm = "EC";
std::optional<std::vector<std::string>> optKeyUsage =
@@ -355,7 +355,7 @@ class CertificateActionGenerateCSR : public Node
// supporting only 2048 key bit length for RSA algorithm due to time
// consumed in generating private key
if (*optKeyPairAlgorithm == "RSA" &&
- *optKeyBitLength != RSA_KEY_BIT_LENGTH)
+ *optKeyBitLength != rsaKeyBitLength)
{
messages::propertyValueNotInList(asyncResp->res,
std::to_string(*optKeyBitLength),
@@ -414,17 +414,17 @@ class CertificateActionGenerateCSR : public Node
// Only allow one CSR matcher at a time so setting retry time-out and
// timer expiry to 10 seconds for now.
- static const int TIME_OUT = 10;
+ static const int timeOut = 10;
if (csrMatcher)
{
messages::serviceTemporarilyUnavailable(asyncResp->res,
- std::to_string(TIME_OUT));
+ std::to_string(timeOut));
return;
}
// Make this static so it survives outside this method
static boost::asio::steady_timer timeout(*req.ioService);
- timeout.expires_after(std::chrono::seconds(TIME_OUT));
+ timeout.expires_after(std::chrono::seconds(timeOut));
timeout.async_wait([asyncResp](const boost::system::error_code& ec) {
csrMatcher = nullptr;
if (ec)
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index babfd4a412..3494ede8c7 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -152,7 +152,7 @@ inline bool translateDHCPEnabledToBool(const std::string& inputDHCP,
"xyz.openbmc_project.Network.EthernetInterface.DHCPConf.both"));
}
-inline std::string GetDHCPEnabledEnumeration(bool isIPv4, bool isIPv6)
+inline std::string getDhcpEnabledEnumeration(bool isIPv4, bool isIPv6)
{
if (isIPv4 && isIPv6)
{
@@ -255,11 +255,11 @@ inline bool extractEthernetInterfaceData(const std::string& ethiface_id,
{
if (propertyPair.first == "AutoNeg")
{
- const bool* auto_neg =
+ const bool* autoNeg =
std::get_if<bool>(&propertyPair.second);
- if (auto_neg != nullptr)
+ if (autoNeg != nullptr)
{
- ethData.auto_neg = *auto_neg;
+ ethData.auto_neg = *autoNeg;
}
}
else if (propertyPair.first == "Speed")
@@ -312,11 +312,11 @@ inline bool extractEthernetInterfaceData(const std::string& ethiface_id,
}
else if (propertyPair.first == "DHCPEnabled")
{
- const std::string* DHCPEnabled =
+ const std::string* dhcpEnabled =
std::get_if<std::string>(&propertyPair.second);
- if (DHCPEnabled != nullptr)
+ if (dhcpEnabled != nullptr)
{
- ethData.DHCPEnabled = *DHCPEnabled;
+ ethData.DHCPEnabled = *dhcpEnabled;
}
}
else if (propertyPair.first == "DomainName")
@@ -342,39 +342,39 @@ inline bool extractEthernetInterfaceData(const std::string& ethiface_id,
{
if (propertyPair.first == "DNSEnabled")
{
- const bool* DNSEnabled =
+ const bool* dnsEnabled =
std::get_if<bool>(&propertyPair.second);
- if (DNSEnabled != nullptr)
+ if (dnsEnabled != nullptr)
{
- ethData.DNSEnabled = *DNSEnabled;
+ ethData.DNSEnabled = *dnsEnabled;
}
}
else if (propertyPair.first == "NTPEnabled")
{
- const bool* NTPEnabled =
+ const bool* ntpEnabled =
std::get_if<bool>(&propertyPair.second);
- if (NTPEnabled != nullptr)
+ if (ntpEnabled != nullptr)
{
- ethData.NTPEnabled = *NTPEnabled;
+ ethData.NTPEnabled = *ntpEnabled;
}
}
else if (propertyPair.first == "HostNameEnabled")
{
- const bool* HostNameEnabled =
+ const bool* hostNameEnabled =
std::get_if<bool>(&propertyPair.second);
- if (HostNameEnabled != nullptr)
+ if (hostNameEnabled != nullptr)
{
- ethData.HostNameEnabled = *HostNameEnabled;
+ ethData.HostNameEnabled = *hostNameEnabled;
}
}
else if (propertyPair.first == "SendHostNameEnabled")
{
- const bool* SendHostNameEnabled =
+ const bool* sendHostNameEnabled =
std::get_if<bool>(&propertyPair.second);
- if (SendHostNameEnabled != nullptr)
+ if (sendHostNameEnabled != nullptr)
{
ethData.SendHostNameEnabled =
- *SendHostNameEnabled;
+ *sendHostNameEnabled;
}
}
}
@@ -447,8 +447,8 @@ inline void
boost::container::flat_set<IPv6AddressData>::iterator,
bool>
it = ipv6_config.insert(IPv6AddressData{});
- IPv6AddressData& ipv6_address = *it.first;
- ipv6_address.id =
+ IPv6AddressData& ipv6Address = *it.first;
+ ipv6Address.id =
objpath.first.str.substr(ipv6PathStart.size());
for (auto& property : interface.second)
{
@@ -458,7 +458,7 @@ inline void
std::get_if<std::string>(&property.second);
if (address != nullptr)
{
- ipv6_address.address = *address;
+ ipv6Address.address = *address;
}
}
else if (property.first == "Origin")
@@ -467,7 +467,7 @@ inline void
std::get_if<std::string>(&property.second);
if (origin != nullptr)
{
- ipv6_address.origin =
+ ipv6Address.origin =
translateAddressOriginDbusToRedfish(*origin,
false);
}
@@ -478,7 +478,7 @@ inline void
std::get_if<uint8_t>(&property.second);
if (prefix != nullptr)
{
- ipv6_address.prefixLength = *prefix;
+ ipv6Address.prefixLength = *prefix;
}
}
else
@@ -520,8 +520,8 @@ inline void
boost::container::flat_set<IPv4AddressData>::iterator,
bool>
it = ipv4_config.insert(IPv4AddressData{});
- IPv4AddressData& ipv4_address = *it.first;
- ipv4_address.id =
+ IPv4AddressData& ipv4Address = *it.first;
+ ipv4Address.id =
objpath.first.str.substr(ipv4PathStart.size());
for (auto& property : interface.second)
{
@@ -531,7 +531,7 @@ inline void
std::get_if<std::string>(&property.second);
if (address != nullptr)
{
- ipv4_address.address = *address;
+ ipv4Address.address = *address;
}
}
else if (property.first == "Gateway")
@@ -540,7 +540,7 @@ inline void
std::get_if<std::string>(&property.second);
if (gateway != nullptr)
{
- ipv4_address.gateway = *gateway;
+ ipv4Address.gateway = *gateway;
}
}
else if (property.first == "Origin")
@@ -549,7 +549,7 @@ inline void
std::get_if<std::string>(&property.second);
if (origin != nullptr)
{
- ipv4_address.origin =
+ ipv4Address.origin =
translateAddressOriginDbusToRedfish(*origin,
true);
}
@@ -561,7 +561,7 @@ inline void
if (mask != nullptr)
{
// convert it to the string
- ipv4_address.netmask = getNetmask(*mask);
+ ipv4Address.netmask = getNetmask(*mask);
}
}
else
@@ -572,8 +572,8 @@ inline void
}
}
// Check if given address is local, or global
- ipv4_address.linktype =
- boost::starts_with(ipv4_address.address, "169.254.")
+ ipv4Address.linktype =
+ boost::starts_with(ipv4Address.address, "169.254.")
? LinkType::Local
: LinkType::Global;
}
@@ -902,7 +902,7 @@ void getEthernetIfaceData(const std::string& ethiface_id,
CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
- [ethiface_id{std::string{ethiface_id}}, callback{std::move(callback)}](
+ [ethifaceId{std::string{ethiface_id}}, callback{std::move(callback)}](
const boost::system::error_code error_code,
const GetManagedObjects& resp) {
EthernetInterfaceData ethData{};
@@ -916,14 +916,14 @@ void getEthernetIfaceData(const std::string& ethiface_id,
}
bool found =
- extractEthernetInterfaceData(ethiface_id, resp, ethData);
+ extractEthernetInterfaceData(ethifaceId, resp, ethData);
if (!found)
{
callback(false, ethData, ipv4Data, ipv6Data);
return;
}
- extractIPData(ethiface_id, resp, ipv4Data);
+ extractIPData(ethifaceId, resp, ipv4Data);
// Fix global GW
for (IPv4AddressData& ipv4 : ipv4Data)
{
@@ -935,7 +935,7 @@ void getEthernetIfaceData(const std::string& ethiface_id,
}
}
- extractIPV6Data(ethiface_id, resp, ipv6Data);
+ extractIPV6Data(ethifaceId, resp, ipv6Data);
// Finally make a callback with useful data
callback(true, ethData, ipv4Data, ipv6Data);
},
@@ -958,11 +958,11 @@ void getEthernetIfaceList(CallbackFunc&& callback)
GetManagedObjects& resp) {
// Callback requires vector<string> to retrieve all available
// ethernet interfaces
- boost::container::flat_set<std::string> iface_list;
- iface_list.reserve(resp.size());
+ boost::container::flat_set<std::string> ifaceList;
+ ifaceList.reserve(resp.size());
if (error_code)
{
- callback(false, iface_list);
+ callback(false, ifaceList);
return;
}
@@ -979,18 +979,18 @@ void getEthernetIfaceList(CallbackFunc&& callback)
"xyz.openbmc_project.Network.EthernetInterface")
{
// Cut out everything until last "/", ...
- const std::string& iface_id = objpath.first.str;
- std::size_t last_pos = iface_id.rfind("/");
- if (last_pos != std::string::npos)
+ const std::string& ifaceId = objpath.first.str;
+ std::size_t lastPos = ifaceId.rfind("/");
+ if (lastPos != std::string::npos)
{
// and put it into output vector.
- iface_list.emplace(iface_id.substr(last_pos + 1));
+ ifaceList.emplace(ifaceId.substr(lastPos + 1));
}
}
}
}
// Finally make a callback with useful data
- callback(true, iface_list);
+ callback(true, ifaceList);
},
"xyz.openbmc_project.Network", "/xyz/openbmc_project/network",
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
@@ -1041,24 +1041,24 @@ class EthernetCollection : public Node
return;
}
- nlohmann::json& iface_array =
+ nlohmann::json& ifaceArray =
asyncResp->res.jsonValue["Members"];
- iface_array = nlohmann::json::array();
+ ifaceArray = nlohmann::json::array();
std::string tag = "_";
- for (const std::string& iface_item : iface_list)
+ for (const std::string& ifaceItem : iface_list)
{
- std::size_t found = iface_item.find(tag);
+ std::size_t found = ifaceItem.find(tag);
if (found == std::string::npos)
{
- iface_array.push_back(
+ ifaceArray.push_back(
{{"@odata.id",
"/redfish/v1/Managers/bmc/EthernetInterfaces/" +
- iface_item}});
+ ifaceItem}});
}
}
asyncResp->res.jsonValue["Members@odata.count"] =
- iface_array.size();
+ ifaceArray.size();
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Managers/bmc/EthernetInterfaces";
});
@@ -1214,7 +1214,7 @@ class EthernetInterface : public Node
const bool v6Value,
const std::shared_ptr<AsyncResp> asyncResp)
{
- const std::string dhcp = GetDHCPEnabledEnumeration(v4Value, v6Value);
+ const std::string dhcp = getDhcpEnabledEnumeration(v4Value, v6Value);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec) {
if (ec)
@@ -1383,7 +1383,7 @@ class EthernetInterface : public Node
}
boost::container::flat_set<IPv4AddressData>::const_iterator
- GetNextStaticIPEntry(
+ getNextStaticIpEntry(
boost::container::flat_set<IPv4AddressData>::const_iterator head,
boost::container::flat_set<IPv4AddressData>::const_iterator end)
{
@@ -1398,7 +1398,7 @@ class EthernetInterface : public Node
}
boost::container::flat_set<IPv6AddressData>::const_iterator
- GetNextStaticIPEntry(
+ getNextStaticIpEntry(
boost::container::flat_set<IPv6AddressData>::const_iterator head,
boost::container::flat_set<IPv6AddressData>::const_iterator end)
{
@@ -1429,8 +1429,8 @@ class EthernetInterface : public Node
// match it to the first JSON element in the IPv4StaticAddresses array.
// Match each subsequent JSON element to the next static IP programmed
// into the NIC.
- boost::container::flat_set<IPv4AddressData>::const_iterator NICIPentry =
- GetNextStaticIPEntry(ipv4Data.cbegin(), ipv4Data.cend());
+ boost::container::flat_set<IPv4AddressData>::const_iterator niciPentry =
+ getNextStaticIpEntry(ipv4Data.cbegin(), ipv4Data.cend());
for (nlohmann::json& thisJson : input)
{
@@ -1473,9 +1473,9 @@ class EthernetInterface : public Node
errorInEntry = true;
}
}
- else if (NICIPentry != ipv4Data.cend())
+ else if (niciPentry != ipv4Data.cend())
{
- addr = &(NICIPentry->address);
+ addr = &(niciPentry->address);
}
else
{
@@ -1494,13 +1494,13 @@ class EthernetInterface : public Node
errorInEntry = true;
}
}
- else if (NICIPentry != ipv4Data.cend())
+ else if (niciPentry != ipv4Data.cend())
{
- if (!ipv4VerifyIpAndGetBitcount(NICIPentry->netmask,
+ if (!ipv4VerifyIpAndGetBitcount(niciPentry->netmask,
&prefixLength))
{
messages::propertyValueFormatError(
- asyncResp->res, NICIPentry->netmask,
+ asyncResp->res, niciPentry->netmask,
pathString + "/SubnetMask");
errorInEntry = true;
}
@@ -1525,9 +1525,9 @@ class EthernetInterface : public Node
errorInEntry = true;
}
}
- else if (NICIPentry != ipv4Data.cend())
+ else if (niciPentry != ipv4Data.cend())
{
- gw = &NICIPentry->gateway;
+ gw = &niciPentry->gateway;
}
else
{
@@ -1541,12 +1541,12 @@ class EthernetInterface : public Node
return;
}
- if (NICIPentry != ipv4Data.cend())
+ if (niciPentry != ipv4Data.cend())
{
- deleteAndCreateIPv4(ifaceId, NICIPentry->id, prefixLength,
+ deleteAndCreateIPv4(ifaceId, niciPentry->id, prefixLength,
*gw, *addr, asyncResp);
- NICIPentry =
- GetNextStaticIPEntry(++NICIPentry, ipv4Data.cend());
+ niciPentry =
+ getNextStaticIpEntry(++niciPentry, ipv4Data.cend());
}
else
{
@@ -1557,7 +1557,7 @@ class EthernetInterface : public Node
}
else
{
- if (NICIPentry == ipv4Data.cend())
+ if (niciPentry == ipv4Data.cend())
{
// Requesting a DELETE/DO NOT MODIFY action for an item
// that isn't present on the eth(n) interface. Input JSON is
@@ -1577,12 +1577,12 @@ class EthernetInterface : public Node
if (thisJson.is_null())
{
- deleteIPv4(ifaceId, NICIPentry->id, asyncResp);
+ deleteIPv4(ifaceId, niciPentry->id, asyncResp);
}
- if (NICIPentry != ipv4Data.cend())
+ if (niciPentry != ipv4Data.cend())
{
- NICIPentry =
- GetNextStaticIPEntry(++NICIPentry, ipv4Data.cend());
+ niciPentry =
+ getNextStaticIpEntry(++niciPentry, ipv4Data.cend());
}
entryIdx++;
}
@@ -1622,8 +1622,8 @@ class EthernetInterface : public Node
return;
}
size_t entryIdx = 1;
- boost::container::flat_set<IPv6AddressData>::const_iterator NICIPentry =
- GetNextStaticIPEntry(ipv6Data.cbegin(), ipv6Data.cend());
+ boost::container::flat_set<IPv6AddressData>::const_iterator niciPentry =
+ getNextStaticIpEntry(ipv6Data.cbegin(), ipv6Data.cend());
for (nlohmann::json& thisJson : input)
{
std::string pathString =
@@ -1653,9 +1653,9 @@ class EthernetInterface : public Node
{
addr = &(*address);
}
- else if (NICIPentry != ipv6Data.end())
+ else if (niciPentry != ipv6Data.end())
{
- addr = &(NICIPentry->address);
+ addr = &(niciPentry->address);
}
else
{
@@ -1668,9 +1668,9 @@ class EthernetInterface : public Node
{
prefix = *prefixLength;
}
- else if (NICIPentry != ipv6Data.end())
+ else if (niciPentry != ipv6Data.end())
{
- prefix = NICIPentry->prefixLength;
+ prefix = niciPentry->prefixLength;
}
else
{
@@ -1679,12 +1679,12 @@ class EthernetInterface : public Node
return;
}
- if (NICIPentry != ipv6Data.end())
+ if (niciPentry != ipv6Data.end())
{
- deleteAndCreateIPv6(ifaceId, NICIPentry->id, prefix, *addr,
+ deleteAndCreateIPv6(ifaceId, niciPentry->id, prefix, *addr,
asyncResp);
- NICIPentry =
- GetNextStaticIPEntry(++NICIPentry, ipv6Data.cend());
+ niciPentry =
+ getNextStaticIpEntry(++niciPentry, ipv6Data.cend());
}
else
{
@@ -1694,7 +1694,7 @@ class EthernetInterface : public Node
}
else
{
- if (NICIPentry == ipv6Data.end())
+ if (niciPentry == ipv6Data.end())
{
// Requesting a DELETE/DO NOT MODIFY action for an item
// that isn't present on the eth(n) interface. Input JSON is
@@ -1714,12 +1714,12 @@ class EthernetInterface : public Node
if (thisJson.is_null())
{
- deleteIPv6(ifaceId, NICIPentry->id, asyncResp);
+ deleteIPv6(ifaceId, niciPentry->id, asyncResp);
}
- if (NICIPentry != ipv6Data.cend())
+ if (niciPentry != ipv6Data.cend())
{
- NICIPentry =
- GetNextStaticIPEntry(++NICIPentry, ipv6Data.cend());
+ niciPentry =
+ getNextStaticIpEntry(++niciPentry, ipv6Data.cend());
}
entryIdx++;
}
@@ -1735,11 +1735,11 @@ class EthernetInterface : public Node
constexpr const std::array<const char*, 1> inventoryForEthernet = {
"xyz.openbmc_project.Inventory.Item.Ethernet"};
- nlohmann::json& json_response = asyncResp->res.jsonValue;
- json_response["Id"] = iface_id;
- json_response["@odata.id"] =
+ nlohmann::json& jsonResponse = asyncResp->res.jsonValue;
+ jsonResponse["Id"] = iface_id;
+ jsonResponse["@odata.id"] =
"/redfish/v1/Managers/bmc/EthernetInterfaces/" + iface_id;
- json_response["InterfaceEnabled"] = ethData.nicEnabled;
+ jsonResponse["InterfaceEnabled"] = ethData.nicEnabled;
auto health = std::make_shared<HealthPopulate>(asyncResp);
@@ -1762,103 +1762,100 @@ class EthernetInterface : public Node
if (ethData.nicEnabled)
{
- json_response["LinkStatus"] = "LinkUp";
- json_response["Status"]["State"] = "Enabled";
+ jsonResponse["LinkStatus"] = "LinkUp";
+ jsonResponse["Status"]["State"] = "Enabled";
}
else
{
- json_response["LinkStatus"] = "NoLink";
- json_response["Status"]["State"] = "Disabled";
+ jsonResponse["LinkStatus"] = "NoLink";
+ jsonResponse["Status"]["State"] = "Disabled";
}
- json_response["LinkStatus"] = ethData.linkUp ? "LinkUp" : "LinkDown";
- json_response["SpeedMbps"] = ethData.speed;
- json_response["MACAddress"] = ethData.mac_address;
- json_response["DHCPv4"]["DHCPEnabled"] =
+ jsonResponse["LinkStatus"] = ethData.linkUp ? "LinkUp" : "LinkDown";
+ jsonResponse["SpeedMbps"] = ethData.speed;
+ jsonResponse["MACAddress"] = ethData.mac_address;
+ jsonResponse["DHCPv4"]["DHCPEnabled"] =
translateDHCPEnabledToBool(ethData.DHCPEnabled, true);
- json_response["DHCPv4"]["UseNTPServers"] = ethData.NTPEnabled;
- json_response["DHCPv4"]["UseDNSServers"] = ethData.DNSEnabled;
- json_response["DHCPv4"]["UseDomainName"] = ethData.HostNameEnabled;
+ jsonResponse["DHCPv4"]["UseNTPServers"] = ethData.NTPEnabled;
+ jsonResponse["DHCPv4"]["UseDNSServers"] = ethData.DNSEnabled;
+ jsonResponse["DHCPv4"]["UseDomainName"] = ethData.HostNameEnabled;
- json_response["DHCPv6"]["OperatingMode"] =
+ jsonResponse["DHCPv6"]["OperatingMode"] =
translateDHCPEnabledToBool(ethData.DHCPEnabled, false) ? "Stateful"
: "Disabled";
- json_response["DHCPv6"]["UseNTPServers"] = ethData.NTPEnabled;
- json_response["DHCPv6"]["UseDNSServers"] = ethData.DNSEnabled;
- json_response["DHCPv6"]["UseDomainName"] = ethData.HostNameEnabled;
+ jsonResponse["DHCPv6"]["UseNTPServers"] = ethData.NTPEnabled;
+ jsonResponse["DHCPv6"]["UseDNSServers"] = ethData.DNSEnabled;
+ jsonResponse["DHCPv6"]["UseDomainName"] = ethData.HostNameEnabled;
if (!ethData.hostname.empty())
{
- json_response["HostName"] = ethData.hostname;
+ jsonResponse["HostName"] = ethData.hostname;
// When domain name is empty then it means, that it is a network
// without domain names, and the host name itself must be treated as
// FQDN
- std::string FQDN = std::move(ethData.hostname);
+ std::string fqdn = std::move(ethData.hostname);
if (!ethData.domainnames.empty())
{
- FQDN += "." + ethData.domainnames[0];
+ fqdn += "." + ethData.domainnames[0];
}
- json_response["FQDN"] = FQDN;
+ jsonResponse["FQDN"] = fqdn;
}
- json_response["VLANs"] = {
+ jsonResponse["VLANs"] = {
{"@odata.id", "/redfish/v1/Managers/bmc/EthernetInterfaces/" +
iface_id + "/VLANs"}};
- json_response["NameServers"] = ethData.nameServers;
- json_response["StaticNameServers"] = ethData.staticNameServers;
+ jsonResponse["NameServers"] = ethData.nameServers;
+ jsonResponse["StaticNameServers"] = ethData.staticNameServers;
- nlohmann::json& ipv4_array = json_response["IPv4Addresses"];
- nlohmann::json& ipv4_static_array =
- json_response["IPv4StaticAddresses"];
- ipv4_array = nlohmann::json::array();
- ipv4_static_array = nlohmann::json::array();
- for (auto& ipv4_config : ipv4Data)
+ nlohmann::json& ipv4Array = jsonResponse["IPv4Addresses"];
+ nlohmann::json& ipv4StaticArray = jsonResponse["IPv4StaticAddresses"];
+ ipv4Array = nlohmann::json::array();
+ ipv4StaticArray = nlohmann::json::array();
+ for (auto& ipv4Config : ipv4Data)
{
- std::string gatewayStr = ipv4_config.gateway;
+ std::string gatewayStr = ipv4Config.gateway;
if (gatewayStr.empty())
{
gatewayStr = "0.0.0.0";
}
- ipv4_array.push_back({{"AddressOrigin", ipv4_config.origin},
- {"SubnetMask", ipv4_config.netmask},
- {"Address", ipv4_config.address},
- {"Gateway", gatewayStr}});
- if (ipv4_config.origin == "Static")
+ ipv4Array.push_back({{"AddressOrigin", ipv4Config.origin},
+ {"SubnetMask", ipv4Config.netmask},
+ {"Address", ipv4Config.address},
+ {"Gateway", gatewayStr}});
+ if (ipv4Config.origin == "Static")
{
- ipv4_static_array.push_back(
- {{"AddressOrigin", ipv4_config.origin},
- {"SubnetMask", ipv4_config.netmask},
- {"Address", ipv4_config.address},
- {"Gateway", gatewayStr}});
+ ipv4StaticArray.push_back({{"AddressOrigin", ipv4Config.origin},
+ {"SubnetMask", ipv4Config.netmask},
+ {"Address", ipv4Config.address},
+ {"Gateway", gatewayStr}});
}
}
- json_response["IPv6DefaultGateway"] = ethData.ipv6_default_gateway;
+ jsonResponse["IPv6DefaultGateway"] = ethData.ipv6_default_gateway;
- nlohmann::json& ipv6_array = json_response["IPv6Addresses"];
- nlohmann::json& ipv6_static_array =
- json_response["IPv6StaticAddresses"];
- ipv6_array = nlohmann::json::array();
- ipv6_static_array = nlohmann::json::array();
+ nlohmann::json& ipv6Array = jsonResponse["IPv6Addresses"];
+ nlohmann::json& ipv6StaticArray = jsonResponse["IPv6StaticAddresses"];
+ ipv6Array = nlohmann::json::array();
+ ipv6StaticArray = nlohmann::json::array();
nlohmann::json& ipv6AddrPolicyTable =
- json_response["IPv6AddressPolicyTable"];
+ jsonResponse["IPv6AddressPolicyTable"];
ipv6AddrPolicyTable = nlohmann::json::array();
- for (auto& ipv6_config : ipv6Data)
+ for (auto& ipv6Config : ipv6Data)
{
- ipv6_array.push_back({{"Address", ipv6_config.address},
- {"PrefixLength", ipv6_config.prefixLength},
- {"AddressOrigin", ipv6_config.origin},
- {"AddressState", nullptr}});
- if (ipv6_config.origin == "Static")
+ ipv6Array.push_back({{"Address", ipv6Config.address},
+ {"PrefixLength", ipv6Config.prefixLength},
+ {"AddressOrigin", ipv6Config.origin},
+ {"AddressState", nullptr}});
+ if (ipv6Config.origin == "Static")
{
- ipv6_static_array.push_back(
- {{"Address", ipv6_config.address},
- {"PrefixLength", ipv6_config.prefixLength},
- {"AddressOrigin", ipv6_config.origin},
+ ipv6StaticArray.push_back(
+ {{"Address", ipv6Config.address},
+ {"PrefixLength", ipv6Config.prefixLength},
+ {"AddressOrigin", ipv6Config.origin},
{"AddressState", nullptr}});
}
}
@@ -1879,7 +1876,7 @@ class EthernetInterface : public Node
getEthernetIfaceData(
params[0],
- [this, asyncResp, iface_id{std::string(params[0])}](
+ [this, asyncResp, ifaceId{std::string(params[0])}](
const bool& success, const EthernetInterfaceData& ethData,
const boost::container::flat_set<IPv4AddressData>& ipv4Data,
const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
@@ -1888,7 +1885,7 @@ class EthernetInterface : public Node
// TODO(Pawel)consider distinguish between non existing
// object, and other errors
messages::resourceNotFound(asyncResp->res,
- "EthernetInterface", iface_id);
+ "EthernetInterface", ifaceId);
return;
}
@@ -1898,7 +1895,7 @@ class EthernetInterface : public Node
asyncResp->res.jsonValue["Description"] =
"Management Network Interface";
- parseInterfaceData(asyncResp, iface_id, ethData, ipv4Data,
+ parseInterfaceData(asyncResp, ifaceId, ethData, ipv4Data,
ipv6Data);
});
}
@@ -1913,7 +1910,7 @@ class EthernetInterface : public Node
return;
}
- const std::string& iface_id = params[0];
+ const std::string& ifaceId = params[0];
std::optional<std::string> hostname;
std::optional<std::string> fqdn;
@@ -1966,8 +1963,8 @@ class EthernetInterface : public Node
// Get single eth interface data, and call the below callback for
// JSON preparation
getEthernetIfaceData(
- iface_id,
- [this, asyncResp, iface_id, hostname = std::move(hostname),
+ ifaceId,
+ [this, asyncResp, ifaceId, hostname = std::move(hostname),
fqdn = std::move(fqdn), macAddress = std::move(macAddress),
ipv4StaticAddresses = std::move(ipv4StaticAddresses),
ipv6DefaultGateway = std::move(ipv6DefaultGateway),
@@ -1986,13 +1983,13 @@ class EthernetInterface : public Node
// TODO(Pawel)consider distinguish between non existing
// object, and other errors
messages::resourceNotFound(asyncResp->res,
- "Ethernet Interface", iface_id);
+ "Ethernet Interface", ifaceId);
return;
}
if (dhcpv4 || dhcpv6)
{
- handleDHCPPatch(iface_id, ethData, std::move(v4dhcpParms),
+ handleDHCPPatch(ifaceId, ethData, std::move(v4dhcpParms),
std::move(v6dhcpParms), asyncResp);
}
@@ -2003,12 +2000,12 @@ class EthernetInterface : public Node
if (fqdn)
{
- handleFqdnPatch(iface_id, *fqdn, asyncResp);
+ handleFqdnPatch(ifaceId, *fqdn, asyncResp);
}
if (macAddress)
{
- handleMACAddressPatch(iface_id, *macAddress, asyncResp);
+ handleMACAddressPatch(ifaceId, *macAddress, asyncResp);
}
if (ipv4StaticAddresses)
@@ -2021,13 +2018,13 @@ class EthernetInterface : public Node
// structure, and operates on that, but could be done
// more efficiently
nlohmann::json ipv4Static = std::move(*ipv4StaticAddresses);
- handleIPv4StaticPatch(iface_id, ipv4Static, ipv4Data,
+ handleIPv4StaticPatch(ifaceId, ipv4Static, ipv4Data,
asyncResp);
}
if (staticNameServers)
{
- handleStaticNameServersPatch(iface_id, *staticNameServers,
+ handleStaticNameServersPatch(ifaceId, *staticNameServers,
asyncResp);
}
@@ -2040,14 +2037,14 @@ class EthernetInterface : public Node
if (ipv6StaticAddresses)
{
nlohmann::json ipv6Static = std::move(*ipv6StaticAddresses);
- handleIPv6StaticAddressesPatch(iface_id, ipv6Static,
+ handleIPv6StaticAddressesPatch(ifaceId, ipv6Static,
ipv6Data, asyncResp);
}
if (interfaceEnabled)
{
setEthernetInterfaceBoolProperty(
- iface_id, "NICEnabled", *interfaceEnabled, asyncResp);
+ ifaceId, "NICEnabled", *interfaceEnabled, asyncResp);
}
});
}
@@ -2126,13 +2123,13 @@ class VlanNetworkInterface : public Node
return;
}
- const std::string& parent_iface_id = params[0];
- const std::string& iface_id = params[1];
+ const std::string& parentIfaceId = params[0];
+ const std::string& ifaceId = params[1];
res.jsonValue["@odata.type"] =
"#VLanNetworkInterface.v1_1_0.VLanNetworkInterface";
res.jsonValue["Name"] = "VLAN Network Interface";
- if (!verifyNames(parent_iface_id, iface_id))
+ if (!verifyNames(parentIfaceId, ifaceId))
{
return;
}
@@ -2141,15 +2138,15 @@ class VlanNetworkInterface : public Node
// JSON preparation
getEthernetIfaceData(
params[1],
- [this, asyncResp, parent_iface_id{std::string(params[0])},
- iface_id{std::string(params[1])}](
+ [this, asyncResp, parentIfaceId{std::string(params[0])},
+ ifaceId{std::string(params[1])}](
const bool& success, const EthernetInterfaceData& ethData,
const boost::container::flat_set<IPv4AddressData>&,
const boost::container::flat_set<IPv6AddressData>&) {
if (success && ethData.vlan_id.size() != 0)
{
- parseInterfaceData(asyncResp->res.jsonValue,
- parent_iface_id, iface_id, ethData);
+ parseInterfaceData(asyncResp->res.jsonValue, parentIfaceId,
+ ifaceId, ethData);
}
else
{
@@ -2157,7 +2154,7 @@ class VlanNetworkInterface : public Node
// TODO(Pawel)consider distinguish between non existing
// object, and other errors
messages::resourceNotFound(
- asyncResp->res, "VLAN Network Interface", iface_id);
+ asyncResp->res, "VLAN Network Interface", ifaceId);
}
});
}
@@ -2359,22 +2356,22 @@ class VlanNetworkInterfaceCollection : public Node
asyncResp->res.jsonValue["Name"] =
"VLAN Network Interface Collection";
- nlohmann::json iface_array = nlohmann::json::array();
+ nlohmann::json ifaceArray = nlohmann::json::array();
- for (const std::string& iface_item : iface_list)
+ for (const std::string& ifaceItem : iface_list)
{
- if (boost::starts_with(iface_item, rootInterfaceName + "_"))
+ if (boost::starts_with(ifaceItem, rootInterfaceName + "_"))
{
- iface_array.push_back(
+ ifaceArray.push_back(
{{"@odata.id",
"/redfish/v1/Managers/bmc/EthernetInterfaces/" +
- rootInterfaceName + "/VLANs/" + iface_item}});
+ rootInterfaceName + "/VLANs/" + ifaceItem}});
}
}
asyncResp->res.jsonValue["Members@odata.count"] =
- iface_array.size();
- asyncResp->res.jsonValue["Members"] = std::move(iface_array);
+ ifaceArray.size();
+ asyncResp->res.jsonValue["Members"] = std::move(ifaceArray);
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Managers/bmc/EthernetInterfaces/" +
rootInterfaceName + "/VLANs";
diff --git a/redfish-core/lib/hypervisor_ethernet.hpp b/redfish-core/lib/hypervisor_ethernet.hpp
index 192b3bd7c5..29ac72584a 100644
--- a/redfish-core/lib/hypervisor_ethernet.hpp
+++ b/redfish-core/lib/hypervisor_ethernet.hpp
@@ -122,13 +122,13 @@ class HypervisorInterfaceCollection : public Node
ifaceArray = nlohmann::json::array();
for (const std::string& iface : ifaceList)
{
- std::size_t last_pos = iface.rfind("/");
- if (last_pos != std::string::npos)
+ std::size_t lastPos = iface.rfind("/");
+ if (lastPos != std::string::npos)
{
ifaceArray.push_back(
{{"@odata.id", "/redfish/v1/Systems/hypervisor/"
"EthernetInterfaces/" +
- iface.substr(last_pos + 1)}});
+ iface.substr(lastPos + 1)}});
}
}
asyncResp->res.jsonValue["Members@odata.count"] =
@@ -691,7 +691,7 @@ class HypervisorInterface : public Node
const std::shared_ptr<AsyncResp> asyncResp)
{
const std::string dhcp =
- GetDHCPEnabledEnumeration(ipv4DHCPEnabled, false);
+ getDhcpEnabledEnumeration(ipv4DHCPEnabled, false);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec) {
if (ec)
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 5c16cadc9e..0e93f5ce34 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -880,7 +880,7 @@ inline void clearDump(crow::Response& res, const std::string& dumpInterface)
std::array<std::string, 1>{dumpInterface});
}
-static void ParseCrashdumpParameters(
+static void parseCrashdumpParameters(
const std::vector<std::pair<std::string, VariantType>>& params,
std::string& filename, std::string& timestamp, std::string& logfile)
{
@@ -2466,7 +2466,7 @@ static void logCrashdumpEntry(std::shared_ptr<AsyncResp> asyncResp,
std::string timestamp{};
std::string filename{};
std::string logfile{};
- ParseCrashdumpParameters(params, filename, timestamp, logfile);
+ parseCrashdumpParameters(params, filename, timestamp, logfile);
if (filename.empty() || timestamp.empty())
{
@@ -2662,7 +2662,7 @@ class CrashdumpFile : public Node
std::string dbusTimestamp{};
std::string dbusFilepath{};
- ParseCrashdumpParameters(resp, dbusFilename, dbusTimestamp,
+ parseCrashdumpParameters(resp, dbusFilename, dbusTimestamp,
dbusFilepath);
if (dbusFilename.empty() || dbusTimestamp.empty() ||
@@ -2965,7 +2965,7 @@ class DBusLogServiceActionsClear : public Node
auto asyncResp = std::make_shared<AsyncResp>(res);
// Process response from Logging service.
- auto resp_handler = [asyncResp](const boost::system::error_code ec) {
+ auto respHandler = [asyncResp](const boost::system::error_code ec) {
BMCWEB_LOG_DEBUG << "doClearLog resp_handler callback: Done";
if (ec)
{
@@ -2981,7 +2981,7 @@ class DBusLogServiceActionsClear : public Node
// Make call to Logging service to request Clear Log
crow::connections::systemBus->async_method_call(
- resp_handler, "xyz.openbmc_project.Logging",
+ respHandler, "xyz.openbmc_project.Logging",
"/xyz/openbmc_project/logging",
"xyz.openbmc_project.Collection.DeleteAll", "DeleteAll");
}
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 02251a896f..8ee617f916 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -240,12 +240,12 @@ class NetworkProtocol : public Node
asyncResp->res.jsonValue["NTP"]["NTPServers"] = ntpServers;
if (hostName.empty() == false)
{
- std::string FQDN = std::move(hostName);
+ std::string fqdn = std::move(hostName);
if (domainNames.empty() == false)
{
- FQDN += "." + domainNames[0];
+ fqdn += "." + domainNames[0];
}
- asyncResp->res.jsonValue["FQDN"] = std::move(FQDN);
+ asyncResp->res.jsonValue["FQDN"] = std::move(fqdn);
}
});
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index ffe0ed5480..5096a2fa75 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -148,12 +148,12 @@ class Power : public Node
res.end();
return;
}
- const std::string& chassis_name = params[0];
+ const std::string& chassisName = params[0];
res.jsonValue["PowerControl"] = nlohmann::json::array();
auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>(
- res, chassis_name, sensors::dbus::types.at(sensors::node::power),
+ res, chassisName, sensors::dbus::types.at(sensors::node::power),
sensors::node::power);
getChassisData(sensorAsyncResp);
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 9220279ac7..df83f2b92e 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -1694,19 +1694,19 @@ class SystemsCollection : public Node
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
const std::variant<std::string>& /*hostName*/) {
- nlohmann::json& iface_array =
+ nlohmann::json& ifaceArray =
asyncResp->res.jsonValue["Members"];
- iface_array = nlohmann::json::array();
+ ifaceArray = nlohmann::json::array();
auto& count = asyncResp->res.jsonValue["Members@odata.count"];
count = 0;
- iface_array.push_back(
+ ifaceArray.push_back(
{{"@odata.id", "/redfish/v1/Systems/system"}});
if (!ec)
{
BMCWEB_LOG_DEBUG << "Hypervisor is available";
- iface_array.push_back(
+ ifaceArray.push_back(
{{"@odata.id", "/redfish/v1/Systems/hypervisor"}});
- count = iface_array.size();
+ count = ifaceArray.size();
return;
}
},