Fix merge conflict
Got a couple patches that collided in air, and now builds are broken.
This resolves the collision by moving the new patches forward to the
latest #defines
Change-Id: I1fe35d17a68c61ad90752ae73000e2579131bf5d
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce0006b..33d3ec5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -139,7 +139,7 @@
endif (CMAKE_BUILD_TYPE MATCHES Debug)
if (NOT "${BMCWEB_INSECURE_DISABLE_SSL}")
- add_definitions (-DCROW_ENABLE_SSL)
+ add_definitions (-DBMCWEB_ENABLE_SSL)
endif (NOT "${BMCWEB_INSECURE_DISABLE_SSL}")
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/crow/include)
diff --git a/crow/include/crow/http_response.h b/crow/include/crow/http_response.h
index a738687..560eef4 100644
--- a/crow/include/crow/http_response.h
+++ b/crow/include/crow/http_response.h
@@ -97,12 +97,10 @@
}
completed = true;
BMCWEB_LOG_DEBUG << "calling completion handler";
- if (!completeRequestHandler) {
- BMCWEB_LOG_ERROR << "completion handler was invalid";
- return;
+ if (completeRequestHandler) {
+ BMCWEB_LOG_DEBUG << "completion handler was valid";
+ completeRequestHandler();
}
- completeRequestHandler();
-
}
void end(boost::string_view body_part) {
diff --git a/include/persistent_data_middleware.hpp b/include/persistent_data_middleware.hpp
index d43b4f2..706f6f4 100644
--- a/include/persistent_data_middleware.hpp
+++ b/include/persistent_data_middleware.hpp
@@ -77,8 +77,8 @@
}
BMCWEB_LOG_DEBUG << "Restored session: " << newSession->csrfToken
- << " " << newSession->uniqueId << " "
- << newSession->sessionToken;
+ << " " << newSession->uniqueId << " "
+ << newSession->sessionToken;
SessionStore::getInstance().authTokens.emplace(
newSession->sessionToken, newSession);
}
@@ -108,10 +108,9 @@
void writeData() {
std::ofstream persistentFile(filename);
- nlohmann::json data{
- {"sessions", SessionStore::getInstance().authTokens},
- {"system_uuid", systemUuid},
- {"revision", jsonRevision}};
+ nlohmann::json data{{"sessions", SessionStore::getInstance().authTokens},
+ {"system_uuid", systemUuid},
+ {"revision", jsonRevision}};
persistentFile << data;
}
diff --git a/include/sessions.hpp b/include/sessions.hpp
index f7f937d..f549fde 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -36,7 +36,8 @@
*
* @param[in] j JSON object from which data should be loaded
*
- * @return a shared pointer if data has been loaded properly, nullptr otherwise
+ * @return a shared pointer if data has been loaded properly, nullptr
+ * otherwise
*/
static std::shared_ptr<UserSession> fromJson(const nlohmann::json& j) {
std::shared_ptr<UserSession> userSession = std::make_shared<UserSession>();
@@ -45,7 +46,7 @@
element.value().get_ptr<const std::string*>();
if (thisValue == nullptr) {
BMCWEB_LOG_ERROR << "Error reading persistent store. Property "
- << element.key() << " was not of type string";
+ << element.key() << " was not of type string";
return nullptr;
}
if (element.key() == "unique_id") {
@@ -58,7 +59,7 @@
userSession->username = *thisValue;
} else {
BMCWEB_LOG_ERROR << "Got unexpected property reading persistent file: "
- << element.key();
+ << element.key();
return nullptr;
}
}
diff --git a/include/webserver_common.hpp b/include/webserver_common.hpp
index 30b567c..f0cfe11 100644
--- a/include/webserver_common.hpp
+++ b/include/webserver_common.hpp
@@ -17,7 +17,6 @@
#include "security_headers_middleware.hpp"
#include "token_authorization_middleware.hpp"
-#include "security_headers_middleware.hpp"
#include "webserver_common.hpp"
using CrowApp = crow::App<crow::persistent_data::Middleware,
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index 1fd5df7..ab60abb 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -53,6 +53,7 @@
nodes.emplace_back(std::make_unique<EthernetInterface>(app));
nodes.emplace_back(std::make_unique<Thermal>(app));
nodes.emplace_back(std::make_unique<ManagerCollection>(app));
+ nodes.emplace_back(std::make_unique<Manager>(app));
nodes.emplace_back(std::make_unique<ChassisCollection>(app));
nodes.emplace_back(std::make_unique<Chassis>(app));
nodes.emplace_back(std::make_unique<UpdateService>(app));
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 731ea7b..b1c20a5 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -85,7 +85,7 @@
chassisList.emplace_back(objpath.substr(lastPos + 1));
}
}
- // Finally make a callback with usefull data
+ // Finally make a callback with useful data
callback(true, chassisList);
},
"xyz.openbmc_project.ObjectMapper",
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 293e802..4c44527 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -196,9 +196,8 @@
// single ethernet interface, loop over all of them
for (auto &objpath : dbus_data) {
// Check if proper patter for object path appears
- if (boost::starts_with(
- static_cast<const std::string &>(objpath.first),
- "/xyz/openbmc_project/network/" + ethifaceId + "/ipv4/")) {
+ if (boost::starts_with(static_cast<const std::string &>(objpath.first),
+ pathStart)) {
// and get approrpiate interface
const auto &interface =
objpath.second.find("xyz.openbmc_project.Network.IP");
@@ -236,7 +235,7 @@
// Attach IPv4 only if address is present
if (ipv4Address.address != nullptr) {
- // Check if given addres is local, or global
+ // Check if given address is local, or global
if (boost::starts_with(*ipv4Address.address, "169.254")) {
ipv4Address.global = false;
} else {
@@ -391,18 +390,17 @@
const std::string &name,
const std::string &newValue,
const std::shared_ptr<AsyncResp> &asyncResp) {
- auto callback = [
- asyncResp, ipIdx{std::move(ipIdx)}, name{std::move(name)},
- newValue{std::move(newValue)}
- ](const boost::system::error_code ec) {
- if (ec) {
- messages::addMessageToJson(
- asyncResp->res.jsonValue, messages::internalError(),
- "/IPv4Addresses/" + std::to_string(ipIdx) + "/" + name);
- } else {
- asyncResp->res.jsonValue["IPv4Addresses"][ipIdx][name] = newValue;
- }
- };
+ auto callback =
+ [asyncResp, ipIdx{std::move(ipIdx)}, name{std::move(name)},
+ newValue{std::move(newValue)}](const boost::system::error_code ec) {
+ if (ec) {
+ messages::addMessageToJson(
+ asyncResp->res.jsonValue, messages::internalError(),
+ "/IPv4Addresses/" + std::to_string(ipIdx) + "/" + name);
+ } else {
+ asyncResp->res.jsonValue["IPv4Addresses"][ipIdx][name] = newValue;
+ }
+ };
crow::connections::systemBus->async_method_call(
std::move(callback), "xyz.openbmc_project.Network",
@@ -430,17 +428,17 @@
const std::string &newValueDbus,
const std::shared_ptr<AsyncResp> &asyncResp) {
auto callback =
- [ asyncResp, ipIdx{std::move(ipIdx)},
- newValue{std::move(newValue)} ](const boost::system::error_code ec) {
- if (ec) {
- messages::addMessageToJson(
- asyncResp->res.jsonValue, messages::internalError(),
- "/IPv4Addresses/" + std::to_string(ipIdx) + "/AddressOrigin");
- } else {
- asyncResp->res.jsonValue["IPv4Addresses"][ipIdx]["AddressOrigin"] =
- newValue;
- }
- };
+ [asyncResp, ipIdx{std::move(ipIdx)},
+ newValue{std::move(newValue)}](const boost::system::error_code ec) {
+ if (ec) {
+ messages::addMessageToJson(
+ asyncResp->res.jsonValue, messages::internalError(),
+ "/IPv4Addresses/" + std::to_string(ipIdx) + "/AddressOrigin");
+ } else {
+ asyncResp->res.jsonValue["IPv4Addresses"][ipIdx]["AddressOrigin"] =
+ newValue;
+ }
+ };
crow::connections::systemBus->async_method_call(
std::move(callback), "xyz.openbmc_project.Network",
@@ -466,9 +464,9 @@
const std::string &ifaceId, int ipIdx, const std::string &ipHash,
const std::string &newValueStr, uint8_t &newValue,
const std::shared_ptr<AsyncResp> &asyncResp) {
- auto callback = [
- asyncResp, ipIdx{std::move(ipIdx)}, newValueStr{std::move(newValueStr)}
- ](const boost::system::error_code ec) {
+ auto callback = [asyncResp, ipIdx{std::move(ipIdx)},
+ newValueStr{std::move(newValueStr)}](
+ const boost::system::error_code ec) {
if (ec) {
messages::addMessageToJson(
asyncResp->res.jsonValue, messages::internalError(),
@@ -535,8 +533,8 @@
unsigned int ipIdx,
const std::shared_ptr<AsyncResp> &asyncResp) {
crow::connections::systemBus->async_method_call(
- [ ipIdx{std::move(ipIdx)}, asyncResp{std::move(asyncResp)} ](
- const boost::system::error_code ec) {
+ [ipIdx{std::move(ipIdx)},
+ asyncResp{std::move(asyncResp)}](const boost::system::error_code ec) {
if (ec) {
messages::addMessageToJson(
asyncResp->res.jsonValue, messages::internalError(),
@@ -564,15 +562,15 @@
uint8_t subnetMask, const std::string &gateway,
const std::string &address,
const std::shared_ptr<AsyncResp> &asyncResp) {
- auto createIpHandler = [
- ipIdx{std::move(ipIdx)}, asyncResp{std::move(asyncResp)}
- ](const boost::system::error_code ec) {
- if (ec) {
- messages::addMessageToJson(
- asyncResp->res.jsonValue, messages::internalError(),
- "/IPv4Addresses/" + std::to_string(ipIdx) + "/");
- }
- };
+ auto createIpHandler =
+ [ipIdx{std::move(ipIdx)},
+ asyncResp{std::move(asyncResp)}](const boost::system::error_code ec) {
+ if (ec) {
+ messages::addMessageToJson(
+ asyncResp->res.jsonValue, messages::internalError(),
+ "/IPv4Addresses/" + std::to_string(ipIdx) + "/");
+ }
+ };
crow::connections::systemBus->async_method_call(
std::move(createIpHandler), "xyz.openbmc_project.Network",
@@ -642,12 +640,10 @@
void getEthernetIfaceData(const std::string ðifaceId,
CallbackFunc &&callback) {
crow::connections::systemBus->async_method_call(
- [
- this, ethifaceId{std::move(ethifaceId)},
- callback{std::move(callback)}
- ](const boost::system::error_code error_code,
- const GetManagedObjectsType &resp) {
-
+ [this, ethifaceId{std::move(ethifaceId)},
+ callback{std::move(callback)}](
+ const boost::system::error_code error_code,
+ const GetManagedObjectsType &resp) {
EthernetInterfaceData ethData{};
std::vector<IPv4AddressData> ipv4Data;
ipv4Data.reserve(maxIpV4AddressesPerInterface);
@@ -681,7 +677,7 @@
}
}
- // Finally make a callback with usefull data
+ // Finally make a callback with useful data
callback(true, ethData, ipv4Data);
},
"xyz.openbmc_project.Network", "/xyz/openbmc_project/network",
@@ -697,7 +693,7 @@
template <typename CallbackFunc>
void getEthernetIfaceList(CallbackFunc &&callback) {
crow::connections::systemBus->async_method_call(
- [ this, callback{std::move(callback)} ](
+ [this, callback{std::move(callback)}](
const boost::system::error_code error_code,
GetManagedObjectsType &resp) {
// Callback requires vector<string> to retrieve all available ethernet
@@ -721,7 +717,7 @@
// this is what we're looking for.
if (interface.first ==
"xyz.openbmc_project.Network.EthernetInterface") {
- // Cut out everyting until last "/", ...
+ // Cut out everything until last "/", ...
const std::string &ifaceId =
static_cast<const std::string &>(objpath.first);
std::size_t lastPos = ifaceId.rfind("/");
@@ -732,7 +728,7 @@
}
}
}
- // Finally make a callback with usefull data
+ // Finally make a callback with useful data
callback(true, ifaceList);
},
"xyz.openbmc_project.Network", "/xyz/openbmc_project/network",
@@ -780,26 +776,27 @@
std::string managerId = "openbmc";
// get eth interface list, and call the below callback for JSON preparation
- ethernetProvider.getEthernetIfaceList([&, managerId{std::move(managerId)} ](
- const bool &success, const std::vector<std::string> &iface_list) {
- if (success) {
- nlohmann::json ifaceArray = nlohmann::json::array();
- for (const std::string &ifaceItem : iface_list) {
- ifaceArray.push_back(
- {{"@odata.id", "/redfish/v1/Managers/" + managerId +
- "/EthernetInterfaces/" + ifaceItem}});
- }
- Node::json["Members"] = ifaceArray;
- Node::json["Members@odata.count"] = ifaceArray.size();
- Node::json["@odata.id"] =
- "/redfish/v1/Managers/" + managerId + "/EthernetInterfaces";
- res.jsonValue = Node::json;
- } else {
- // No success, best what we can do is return INTERNALL ERROR
- res.result(boost::beast::http::status::internal_server_error);
- }
- res.end();
- });
+ ethernetProvider.getEthernetIfaceList(
+ [&, managerId{std::move(managerId)}](
+ const bool &success, const std::vector<std::string> &iface_list) {
+ if (success) {
+ nlohmann::json ifaceArray = nlohmann::json::array();
+ for (const std::string &ifaceItem : iface_list) {
+ ifaceArray.push_back(
+ {{"@odata.id", "/redfish/v1/Managers/" + managerId +
+ "/EthernetInterfaces/" + ifaceItem}});
+ }
+ Node::json["Members"] = ifaceArray;
+ Node::json["Members@odata.count"] = ifaceArray.size();
+ Node::json["@odata.id"] =
+ "/redfish/v1/Managers/" + managerId + "/EthernetInterfaces";
+ res.jsonValue = Node::json;
+ } else {
+ // No success, best what we can do is return INTERNALL ERROR
+ res.result(boost::beast::http::status::internal_server_error);
+ }
+ res.end();
+ });
}
// Ethernet Provider object
@@ -905,7 +902,7 @@
paramsJson["VLANId"] = inputVlanId;
OnDemandEthernetProvider::changeVlanId(
ifaceId, static_cast<uint32_t>(inputVlanId),
- [&, asyncResp, pathPrefx{std::move(pathPrefix)} ](
+ [&, asyncResp, pathPrefx{std::move(pathPrefix)}](
const boost::system::error_code ec) {
if (ec) {
messages::addMessageToJson(asyncResp->res.jsonValue,
@@ -917,7 +914,7 @@
} else if (inputVlanEnabled == false) {
// Disable VLAN
OnDemandEthernetProvider::disableVlan(
- ifaceId, [&, asyncResp, pathPrefx{std::move(pathPrefix)} ](
+ ifaceId, [&, asyncResp, pathPrefx{std::move(pathPrefix)}](
const boost::system::error_code ec) {
if (ec) {
messages::addMessageToJson(asyncResp->res.jsonValue,
@@ -1289,7 +1286,7 @@
// get single eth interface data, and call the below callback for JSON
// preparation
ethernetProvider.getEthernetIfaceData(
- ifaceId, [&, ifaceId, patchReq = std::move(patchReq) ](
+ ifaceId, [&, ifaceId, patchReq = std::move(patchReq)](
const bool &success, const EthernetInterfaceData ð_data,
const std::vector<IPv4AddressData> &ipv4_data) {
if (!success) {
@@ -1390,12 +1387,6 @@
// Copy JSON object to avoid race condition
nlohmann::json jsonResponse(Node::json);
- if (eth_data.vlanId == nullptr) {
- // Interface not a VLAN - abort
- messages::addMessageToErrorJson(jsonResponse, messages::internalError());
- return jsonResponse;
- }
-
// Fill out obvious data...
jsonResponse["Id"] = ifaceId;
jsonResponse["@odata.id"] =
@@ -1441,16 +1432,19 @@
const std::string &parentIfaceId = params[0];
const std::string &ifaceId = params[1];
+ if (!verifyNames(res, parentIfaceId, ifaceId)) {
+ return;
+ }
+
// Get single eth interface data, and call the below callback for JSON
// preparation
ethernetProvider.getEthernetIfaceData(
- ifaceId,
- [&, parentIfaceId, ifaceId](
- const bool &success, const EthernetInterfaceData ð_data,
- const std::vector<IPv4AddressData> &ipv4_data) {
+ ifaceId, [&, parentIfaceId, ifaceId](
+ const bool &success, const EthernetInterfaceData ð_data,
+ const std::vector<IPv4AddressData> &ipv4_data) {
if (success && eth_data.vlanId != nullptr) {
- res.jsonValue = parseInterfaceData(parentIfaceId, ifaceId,
- eth_data, ipv4_data);
+ res.jsonValue =
+ parseInterfaceData(parentIfaceId, ifaceId, eth_data, ipv4_data);
} else {
// ... otherwise return error
// TODO(Pawel)consider distinguish between non existing object, and
@@ -1488,10 +1482,9 @@
// Get single eth interface data, and call the below callback for JSON
// preparation
ethernetProvider.getEthernetIfaceData(
- ifaceId,
- [&, parent_ifaceId, ifaceId, patchReq = std::move(patchReq) ](
- const bool &success, const EthernetInterfaceData ð_data,
- const std::vector<IPv4AddressData> &ipv4_data) {
+ ifaceId, [&, parent_ifaceId, ifaceId, patchReq = std::move(patchReq)](
+ const bool &success, const EthernetInterfaceData ð_data,
+ const std::vector<IPv4AddressData> &ipv4_data) {
if (!success) {
// ... otherwise return error
// TODO(Pawel)consider distinguish between non existing object,
@@ -1506,8 +1499,8 @@
return;
}
- res.jsonValue = parseInterfaceData(parent_ifaceId, ifaceId,
- eth_data, ipv4_data);
+ res.jsonValue =
+ parseInterfaceData(parent_ifaceId, ifaceId, eth_data, ipv4_data);
std::shared_ptr<AsyncResp> asyncResp =
std::make_shared<AsyncResp>(res);
@@ -1521,8 +1514,7 @@
if (fieldInJsonIt == res.jsonValue.end()) {
// Field not in scope of defined fields
messages::addMessageToJsonRoot(
- res.jsonValue,
- messages::propertyUnknown(propertyIt.key()));
+ res.jsonValue, messages::propertyUnknown(propertyIt.key()));
} else if (*fieldInJsonIt != *propertyIt) {
// User attempted to modify non-writable field
messages::addMessageToJsonRoot(
@@ -1555,13 +1547,12 @@
// Get single eth interface data, and call the below callback for JSON
// preparation
ethernetProvider.getEthernetIfaceData(
- ifaceId,
- [&, parent_ifaceId, ifaceId](
- const bool &success, const EthernetInterfaceData ð_data,
- const std::vector<IPv4AddressData> &ipv4_data) {
+ ifaceId, [&, parent_ifaceId, ifaceId](
+ const bool &success, const EthernetInterfaceData ð_data,
+ const std::vector<IPv4AddressData> &ipv4_data) {
if (success && eth_data.vlanId != nullptr) {
res.jsonValue = parseInterfaceData(parent_ifaceId, ifaceId,
- eth_data, ipv4_data);
+ eth_data, ipv4_data);
// Disable VLAN
OnDemandEthernetProvider::disableVlan(
@@ -1653,45 +1644,47 @@
std::string rootInterfaceName = params[0];
// get eth interface list, and call the below callback for JSON preparation
- ethernetProvider.getEthernetIfaceList([
- &, managerId{std::move(managerId)},
- rootInterfaceName{std::move(rootInterfaceName)}
- ](const bool &success, const std::vector<std::string> &iface_list) {
- if (success) {
- bool rootInterfaceFound = false;
- nlohmann::json ifaceArray = nlohmann::json::array();
+ ethernetProvider.getEthernetIfaceList(
+ [&, managerId{std::move(managerId)},
+ rootInterfaceName{std::move(rootInterfaceName)}](
+ const bool &success, const std::vector<std::string> &iface_list) {
+ if (success) {
+ bool rootInterfaceFound = false;
+ nlohmann::json ifaceArray = nlohmann::json::array();
- for (const std::string &ifaceItem : iface_list) {
- if (ifaceItem == rootInterfaceName) {
- rootInterfaceFound = true;
- } else if (boost::starts_with(ifaceItem, rootInterfaceName + "_")) {
- ifaceArray.push_back(
- {{"@odata.id", "/redfish/v1/Managers/" + managerId +
- "/EthernetInterfaces/" + rootInterfaceName +
- "/VLANs/" + ifaceItem}});
+ for (const std::string &ifaceItem : iface_list) {
+ if (ifaceItem == rootInterfaceName) {
+ rootInterfaceFound = true;
+ } else if (boost::starts_with(ifaceItem,
+ rootInterfaceName + "_")) {
+ ifaceArray.push_back(
+ {{"@odata.id", "/redfish/v1/Managers/" + managerId +
+ "/EthernetInterfaces/" +
+ rootInterfaceName + "/VLANs/" +
+ ifaceItem}});
+ }
+ }
+
+ if (rootInterfaceFound) {
+ Node::json["Members"] = ifaceArray;
+ Node::json["Members@odata.count"] = ifaceArray.size();
+ Node::json["@odata.id"] = "/redfish/v1/Managers/" + managerId +
+ "/EthernetInterfaces/" +
+ rootInterfaceName + "/VLANs";
+ res.jsonValue = Node::json;
+ } else {
+ messages::addMessageToErrorJson(
+ res.jsonValue, messages::resourceNotFound("EthernetInterface",
+ rootInterfaceName));
+ res.result(boost::beast::http::status::not_found);
+ res.end();
+ }
+ } else {
+ // No success, best what we can do is return INTERNALL ERROR
+ res.result(boost::beast::http::status::internal_server_error);
}
- }
-
- if (rootInterfaceFound) {
- Node::json["Members"] = ifaceArray;
- Node::json["Members@odata.count"] = ifaceArray.size();
- Node::json["@odata.id"] = "/redfish/v1/Managers/" + managerId +
- "/EthernetInterfaces/" + rootInterfaceName +
- "/VLANs";
- res.jsonValue = Node::json;
- } else {
- messages::addMessageToErrorJson(
- res.jsonValue, messages::resourceNotFound("EthernetInterface",
- rootInterfaceName));
- res.result(boost::beast::http::status::not_found);
res.end();
- }
- } else {
- // No success, best what we can do is return INTERNALL ERROR
- res.result(boost::beast::http::status::internal_server_error);
- }
- res.end();
- });
+ });
}
void doPost(crow::Response &res, const crow::Request &req,
@@ -1726,49 +1719,49 @@
}
// get eth interface list, and call the below callback for JSON preparation
- ethernetProvider.getEthernetIfaceList([
- &, managerId{std::move(managerId)},
- rootInterfaceName{std::move(rootInterfaceName)}
- ](const bool &success, const std::vector<std::string> &iface_list) {
- if (success) {
- bool rootInterfaceFound = false;
+ ethernetProvider.getEthernetIfaceList(
+ [&, managerId{std::move(managerId)},
+ rootInterfaceName{std::move(rootInterfaceName)}](
+ const bool &success, const std::vector<std::string> &iface_list) {
+ if (success) {
+ bool rootInterfaceFound = false;
- for (const std::string &ifaceItem : iface_list) {
- if (ifaceItem == rootInterfaceName) {
- rootInterfaceFound = true;
- break;
+ for (const std::string &ifaceItem : iface_list) {
+ if (ifaceItem == rootInterfaceName) {
+ rootInterfaceFound = true;
+ break;
+ }
+ }
+
+ if (rootInterfaceFound) {
+ ethernetProvider.createVlan(
+ rootInterfaceName, vlanId,
+ [&, vlanId, rootInterfaceName,
+ req{std::move(req)}](const boost::system::error_code ec) {
+ if (ec) {
+ messages::addMessageToErrorJson(
+ res.jsonValue, messages::internalError());
+ res.end();
+ } else {
+ memberVlan.doGet(
+ res, req,
+ {rootInterfaceName,
+ rootInterfaceName + "_" + std::to_string(vlanId)});
+ }
+ });
+ } else {
+ messages::addMessageToErrorJson(
+ res.jsonValue, messages::resourceNotFound("EthernetInterface",
+ rootInterfaceName));
+ res.result(boost::beast::http::status::not_found);
+ res.end();
+ }
+ } else {
+ // No success, best what we can do is return INTERNALL ERROR
+ res.result(boost::beast::http::status::internal_server_error);
+ res.end();
}
- }
-
- if (rootInterfaceFound) {
- ethernetProvider.createVlan(
- rootInterfaceName, vlanId,
- [&, vlanId, rootInterfaceName,
- req{std::move(req)} ](const boost::system::error_code ec) {
- if (ec) {
- messages::addMessageToErrorJson(res.jsonValue,
- messages::internalError());
- res.end();
- } else {
- memberVlan.doGet(
- res, req,
- {rootInterfaceName,
- rootInterfaceName + "_" + std::to_string(vlanId)});
- }
- });
- } else {
- messages::addMessageToErrorJson(
- res.jsonValue, messages::resourceNotFound("EthernetInterface",
- rootInterfaceName));
- res.result(boost::beast::http::status::not_found);
- res.end();
- }
- } else {
- // No success, best what we can do is return INTERNALL ERROR
- res.result(boost::beast::http::status::internal_server_error);
- res.end();
- }
- });
+ });
}
// Ethernet Provider object
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 3071518..7a861b4 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -43,12 +43,13 @@
// will work
// correctly
- entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}},
- {boost::beast::http::verb::head, {{"Login"}}},
- {boost::beast::http::verb::patch, {{"ConfigureManager"}}},
- {boost::beast::http::verb::put, {{"ConfigureManager"}}},
- {boost::beast::http::verb::delete_, {{"ConfigureManager"}}},
- {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
+ entityPrivileges = {
+ {boost::beast::http::verb::get, {{"Login"}}},
+ {boost::beast::http::verb::head, {{"Login"}}},
+ {boost::beast::http::verb::patch, {{"ConfigureManager"}}},
+ {boost::beast::http::verb::put, {{"ConfigureManager"}}},
+ {boost::beast::http::verb::delete_, {{"ConfigureManager"}}},
+ {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
}
private:
@@ -87,12 +88,13 @@
Node::json["Members@odata.count"] = 1;
Node::json["Members"] = {{{"@odata.id", "/redfish/v1/Managers/openbmc"}}};
- entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}},
- {boost::beast::http::verb::head, {{"Login"}}},
- {boost::beast::http::verb::patch, {{"ConfigureManager"}}},
- {boost::beast::http::verb::put, {{"ConfigureManager"}}},
- {boost::beast::http::verb::delete_, {{"ConfigureManager"}}},
- {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
+ entityPrivileges = {
+ {boost::beast::http::verb::get, {{"Login"}}},
+ {boost::beast::http::verb::head, {{"Login"}}},
+ {boost::beast::http::verb::patch, {{"ConfigureManager"}}},
+ {boost::beast::http::verb::put, {{"ConfigureManager"}}},
+ {boost::beast::http::verb::delete_, {{"ConfigureManager"}}},
+ {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
}
private:
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 668e6a9..836249a 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -116,7 +116,7 @@
};
BMCWEB_LOG_DEBUG << "Get available system components.";
crow::connections::systemBus->async_method_call(
- [ name, aResp{std::move(aResp)} ](
+ [name, aResp{std::move(aResp)}](
const boost::system::error_code ec,
const std::vector<std::pair<
std::string,
@@ -146,7 +146,7 @@
BMCWEB_LOG_DEBUG << "Found name: " << name;
const std::string connectionName = connectionNames[0].first;
crow::connections::systemBus->async_method_call(
- [ aResp, name(std::string(name)) ](
+ [aResp, name(std::string(name))](
const boost::system::error_code ec,
const std::vector<std::pair<std::string, VariantType>>
&propertiesList) {
@@ -156,7 +156,7 @@
return;
}
BMCWEB_LOG_DEBUG << "Got " << propertiesList.size()
- << "properties for system";
+ << "properties for system";
for (const std::pair<std::string, VariantType> &property :
propertiesList) {
const std::string *value =
@@ -187,7 +187,7 @@
return;
}
BMCWEB_LOG_DEBUG << "Got " << properties.size()
- << "Dimm properties.";
+ << "Dimm properties.";
for (const auto &p : properties) {
if (p.first == "MemorySize") {
const std::string *value =
@@ -200,7 +200,8 @@
} else if (boost::ends_with(*value, "KB")) {
unitCoeff = 1000000;
} else {
- BMCWEB_LOG_ERROR << "Unsupported memory units";
+ BMCWEB_LOG_ERROR
+ << "Unsupported memory units";
aResp->setErrorStatus();
return;
}
@@ -210,7 +211,7 @@
aResp->res.jsonValue["TotalSystemMemoryGiB"] +=
memSize * unitCoeff;
aResp->res.jsonValue["MemorySummary"]["Status"]
- ["State"] = "Enabled";
+ ["State"] = "Enabled";
}
}
}
@@ -229,7 +230,7 @@
return;
}
BMCWEB_LOG_DEBUG << "Got " << properties.size()
- << "Cpu properties.";
+ << "Cpu properties.";
for (const auto &p : properties) {
if (p.first == "ProcessorFamily") {
const std::string *value =
@@ -242,7 +243,7 @@
.get<int>() +
1;
aResp->res.jsonValue["ProcessorSummary"]
- ["Status"]["State"] =
+ ["Status"]["State"] =
"Enabled";
aResp->res
.jsonValue["ProcessorSummary"]["Model"] =
@@ -265,7 +266,7 @@
return;
}
BMCWEB_LOG_DEBUG << "Got " << properties.size()
- << "UUID properties.";
+ << "UUID properties.";
for (const std::pair<std::string, VariantType> &p :
properties) {
if (p.first == "BIOSVer") {
@@ -279,7 +280,7 @@
const std::string *value =
mapbox::getPtr<const std::string>(p.second);
BMCWEB_LOG_DEBUG << "UUID = " << *value
- << " length " << value->length();
+ << " length " << value->length();
if (value != nullptr) {
// Workaround for to short return str in smbios
// demo app, 32 bytes are described by spec
@@ -331,9 +332,9 @@
CallbackFunc &&callback) {
BMCWEB_LOG_DEBUG << "Get led groups";
crow::connections::systemBus->async_method_call(
- [
- aResp{std::move(aResp)}, &callback
- ](const boost::system::error_code &ec, const ManagedObjectsType &resp) {
+ [aResp{std::move(aResp)}, &callback](
+ const boost::system::error_code &ec,
+ const ManagedObjectsType &resp) {
if (ec) {
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
aResp->setErrorStatus();
@@ -371,9 +372,8 @@
CallbackFunc &&callback) {
BMCWEB_LOG_DEBUG << "Get identify led properties";
crow::connections::systemBus->async_method_call(
- [ aResp{std::move(aResp)}, &callback ](
- const boost::system::error_code ec,
- const PropertiesType &properties) {
+ [aResp{std::move(aResp)}, &callback](const boost::system::error_code ec,
+ const PropertiesType &properties) {
if (ec) {
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
aResp->setErrorStatus();
@@ -645,7 +645,7 @@
// Update led group
BMCWEB_LOG_DEBUG << "Update led group.";
crow::connections::systemBus->async_method_call(
- [&, asyncResp{std::move(asyncResp)} ](
+ [&, asyncResp{std::move(asyncResp)}](
const boost::system::error_code ec) {
if (ec) {
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -663,7 +663,7 @@
// Update identify led status
BMCWEB_LOG_DEBUG << "Update led SoftwareInventoryCollection.";
crow::connections::systemBus->async_method_call(
- [&, asyncResp{std::move(asyncResp)} ](
+ [&, asyncResp{std::move(asyncResp)}](
const boost::system::error_code ec) {
if (ec) {
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;