summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2020-05-13 19:24:20 +0300
committerPatrick Williams <patrick@stwcx.xyz>2020-05-14 06:15:18 +0300
commit8d78b7a9f5fbca338a5867d5dd4fa83890d79bc7 (patch)
tree77e2703f7fbb6a5f5db4001fc0d02d9802557bde /redfish-core
parent156d6b00a9dc06ac9f618ecd8d5fc6b1b49d5be4 (diff)
downloadbmcweb-8d78b7a9f5fbca338a5867d5dd4fa83890d79bc7.tar.xz
sdbusplus: remove deprecated variant_ns
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I86e11299512704fa1df1e5f6517ea25cc6eced8f
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/lib/ethernet.hpp18
-rw-r--r--redfish-core/lib/hypervisor_ethernet.hpp6
-rw-r--r--redfish-core/lib/log_services.hpp12
-rw-r--r--redfish-core/lib/network_protocol.hpp6
-rw-r--r--redfish-core/lib/pcie.hpp217
-rw-r--r--redfish-core/lib/power.hpp20
-rw-r--r--redfish-core/lib/systems.hpp16
7 files changed, 125 insertions, 170 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 702136a09a..ae050acb14 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -290,8 +290,7 @@ inline bool extractEthernetInterfaceData(const std::string &ethiface_id,
else if (propertyPair.first == "Nameservers")
{
const std::vector<std::string> *nameservers =
- sdbusplus::message::variant_ns::get_if<
- std::vector<std::string>>(
+ std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (nameservers != nullptr)
{
@@ -301,8 +300,7 @@ inline bool extractEthernetInterfaceData(const std::string &ethiface_id,
else if (propertyPair.first == "StaticNameServers")
{
const std::vector<std::string> *staticNameServers =
- sdbusplus::message::variant_ns::get_if<
- std::vector<std::string>>(
+ std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (staticNameServers != nullptr)
{
@@ -322,8 +320,7 @@ inline bool extractEthernetInterfaceData(const std::string &ethiface_id,
else if (propertyPair.first == "DomainName")
{
const std::vector<std::string> *domainNames =
- sdbusplus::message::variant_ns::get_if<
- std::vector<std::string>>(
+ std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (domainNames != nullptr)
{
@@ -391,8 +388,7 @@ inline bool extractEthernetInterfaceData(const std::string &ethiface_id,
if (propertyPair.first == "HostName")
{
const std::string *hostname =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &propertyPair.second);
+ std::get_if<std::string>(&propertyPair.second);
if (hostname != nullptr)
{
ethData.hostname = *hostname;
@@ -401,8 +397,7 @@ inline bool extractEthernetInterfaceData(const std::string &ethiface_id,
else if (propertyPair.first == "DefaultGateway")
{
const std::string *defaultGateway =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &propertyPair.second);
+ std::get_if<std::string>(&propertyPair.second);
if (defaultGateway != nullptr)
{
ethData.default_gateway = *defaultGateway;
@@ -411,8 +406,7 @@ inline bool extractEthernetInterfaceData(const std::string &ethiface_id,
else if (propertyPair.first == "DefaultGateway6")
{
const std::string *defaultGateway6 =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &propertyPair.second);
+ std::get_if<std::string>(&propertyPair.second);
if (defaultGateway6 != nullptr)
{
ethData.ipv6_default_gateway = *defaultGateway6;
diff --git a/redfish-core/lib/hypervisor_ethernet.hpp b/redfish-core/lib/hypervisor_ethernet.hpp
index 6287f3c6c7..910d33b0b7 100644
--- a/redfish-core/lib/hypervisor_ethernet.hpp
+++ b/redfish-core/lib/hypervisor_ethernet.hpp
@@ -235,8 +235,7 @@ inline bool extractHypervisorInterfaceData(
if (propertyPair.first == "HostName")
{
const std::string *hostName =
- sdbusplus::message::variant_ns::get_if<
- std::string>(&propertyPair.second);
+ std::get_if<std::string>(&propertyPair.second);
if (hostName != nullptr)
{
ethData.hostname = *hostName;
@@ -245,8 +244,7 @@ inline bool extractHypervisorInterfaceData(
else if (propertyPair.first == "DefaultGateway")
{
const std::string *defaultGateway =
- sdbusplus::message::variant_ns::get_if<
- std::string>(&propertyPair.second);
+ std::get_if<std::string>(&propertyPair.second);
if (defaultGateway != nullptr)
{
ethData.default_gateway = *defaultGateway;
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 767a7fcf14..77155e3ccc 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -459,8 +459,7 @@ static void ParseCrashdumpParameters(
if (property.first == "Timestamp")
{
const std::string *value =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &property.second);
+ std::get_if<std::string>(&property.second);
if (value != nullptr)
{
timestamp = *value;
@@ -469,8 +468,7 @@ static void ParseCrashdumpParameters(
else if (property.first == "Filename")
{
const std::string *value =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &property.second);
+ std::get_if<std::string>(&property.second);
if (value != nullptr)
{
filename = *value;
@@ -479,8 +477,7 @@ static void ParseCrashdumpParameters(
else if (property.first == "Log")
{
const std::string *value =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &property.second);
+ std::get_if<std::string>(&property.second);
if (value != nullptr)
{
logfile = *value;
@@ -1008,8 +1005,7 @@ class DBusEventLogEntryCollection : public Node
{
if (propertyMap.first == "Id")
{
- id = sdbusplus::message::variant_ns::get_if<
- uint32_t>(&propertyMap.second);
+ id = std::get_if<uint32_t>(&propertyMap.second);
if (id == nullptr)
{
messages::propertyMissing(asyncResp->res,
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index d3d9580f7e..a2ae1ea0f5 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -76,8 +76,7 @@ inline void
if (propertyPair.first == "NTPServers")
{
const std::vector<std::string>* ntpServers =
- sdbusplus::message::variant_ns::get_if<
- std::vector<std::string>>(
+ std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (ntpServers != nullptr)
{
@@ -87,8 +86,7 @@ inline void
else if (propertyPair.first == "DomainName")
{
const std::vector<std::string>* domainNames =
- sdbusplus::message::variant_ns::get_if<
- std::vector<std::string>>(
+ std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (domainNames != nullptr)
{
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index b963a534e2..33b8828671 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -163,17 +163,15 @@ class SystemPCIeDevice : public Node
{"Name", "PCIe Device"},
{"Id", device}};
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties["Manufacturer"]);
+ if (std::string *property = std::get_if<std::string>(
+ &pcieDevProperties["Manufacturer"]);
property)
{
asyncResp->res.jsonValue["Manufacturer"] = *property;
}
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties["DeviceType"]);
+ if (std::string *property = std::get_if<std::string>(
+ &pcieDevProperties["DeviceType"]);
property)
{
asyncResp->res.jsonValue["DeviceType"] = *property;
@@ -264,9 +262,8 @@ class SystemPCIeFunctionCollection : public Node
// Check if this function exists by looking for a device ID
std::string devIDProperty =
"Function" + std::to_string(functionNum) + "DeviceId";
- std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties[devIDProperty]);
+ std::string *property = std::get_if<std::string>(
+ &pcieDevProperties[devIDProperty]);
if (property && !property->empty())
{
pcieFunctionList.push_back(
@@ -318,127 +315,111 @@ class SystemPCIeFunction : public Node
const std::string &device = params[0];
const std::string &function = params[1];
- auto getPCIeDeviceCallback =
- [asyncResp, device, function](
- const boost::system::error_code ec,
- boost::container::flat_map<
- std::string, sdbusplus::message::variant<std::string>>
- &pcieDevProperties) {
- if (ec)
+ auto getPCIeDeviceCallback = [asyncResp, device, function](
+ const boost::system::error_code ec,
+ boost::container::flat_map<
+ std::string,
+ sdbusplus::message::variant<
+ std::string>>
+ &pcieDevProperties) {
+ if (ec)
+ {
+ BMCWEB_LOG_DEBUG
+ << "failed to get PCIe Device properties ec: " << ec.value()
+ << ": " << ec.message();
+ if (ec.value() ==
+ boost::system::linux_error::bad_request_descriptor)
{
- BMCWEB_LOG_DEBUG
- << "failed to get PCIe Device properties ec: "
- << ec.value() << ": " << ec.message();
- if (ec.value() ==
- boost::system::linux_error::bad_request_descriptor)
- {
- messages::resourceNotFound(asyncResp->res, "PCIeDevice",
- device);
- }
- else
- {
- messages::internalError(asyncResp->res);
- }
- return;
+ messages::resourceNotFound(asyncResp->res, "PCIeDevice",
+ device);
}
-
- // Check if this function exists by looking for a device ID
- std::string devIDProperty = "Function" + function + "DeviceId";
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties[devIDProperty]);
- property && property->empty())
+ else
{
- messages::resourceNotFound(asyncResp->res, "PCIeFunction",
- function);
- return;
+ messages::internalError(asyncResp->res);
}
+ return;
+ }
- asyncResp->res.jsonValue = {
- {"@odata.type", "#PCIeFunction.v1_2_0.PCIeFunction"},
- {"@odata.id", "/redfish/v1/Systems/system/PCIeDevices/" +
- device + "/PCIeFunctions/" + function},
- {"Name", "PCIe Function"},
- {"Id", function},
- {"FunctionId", std::stoi(function)},
- {"Links",
- {{"PCIeDevice",
- {{"@odata.id",
- "/redfish/v1/Systems/system/PCIeDevices/" +
- device}}}}}};
-
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "DeviceId"]);
- property)
- {
- asyncResp->res.jsonValue["DeviceId"] = *property;
- }
+ // Check if this function exists by looking for a device ID
+ std::string devIDProperty = "Function" + function + "DeviceId";
+ if (std::string *property =
+ std::get_if<std::string>(&pcieDevProperties[devIDProperty]);
+ property && property->empty())
+ {
+ messages::resourceNotFound(asyncResp->res, "PCIeFunction",
+ function);
+ return;
+ }
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "VendorId"]);
- property)
- {
- asyncResp->res.jsonValue["VendorId"] = *property;
- }
+ asyncResp->res.jsonValue = {
+ {"@odata.type", "#PCIeFunction.v1_2_0.PCIeFunction"},
+ {"@odata.id", "/redfish/v1/Systems/system/PCIeDevices/" +
+ device + "/PCIeFunctions/" + function},
+ {"Name", "PCIe Function"},
+ {"Id", function},
+ {"FunctionId", std::stoi(function)},
+ {"Links",
+ {{"PCIeDevice",
+ {{"@odata.id",
+ "/redfish/v1/Systems/system/PCIeDevices/" + device}}}}}};
+
+ if (std::string *property = std::get_if<std::string>(
+ &pcieDevProperties["Function" + function + "DeviceId"]);
+ property)
+ {
+ asyncResp->res.jsonValue["DeviceId"] = *property;
+ }
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "FunctionType"]);
- property)
- {
- asyncResp->res.jsonValue["FunctionType"] = *property;
- }
+ if (std::string *property = std::get_if<std::string>(
+ &pcieDevProperties["Function" + function + "VendorId"]);
+ property)
+ {
+ asyncResp->res.jsonValue["VendorId"] = *property;
+ }
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "DeviceClass"]);
- property)
- {
- asyncResp->res.jsonValue["DeviceClass"] = *property;
- }
+ if (std::string *property = std::get_if<std::string>(
+ &pcieDevProperties["Function" + function + "FunctionType"]);
+ property)
+ {
+ asyncResp->res.jsonValue["FunctionType"] = *property;
+ }
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "ClassCode"]);
- property)
- {
- asyncResp->res.jsonValue["ClassCode"] = *property;
- }
+ if (std::string *property = std::get_if<std::string>(
+ &pcieDevProperties["Function" + function + "DeviceClass"]);
+ property)
+ {
+ asyncResp->res.jsonValue["DeviceClass"] = *property;
+ }
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "RevisionId"]);
- property)
- {
- asyncResp->res.jsonValue["RevisionId"] = *property;
- }
+ if (std::string *property = std::get_if<std::string>(
+ &pcieDevProperties["Function" + function + "ClassCode"]);
+ property)
+ {
+ asyncResp->res.jsonValue["ClassCode"] = *property;
+ }
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "SubsystemId"]);
- property)
- {
- asyncResp->res.jsonValue["SubsystemId"] = *property;
- }
+ if (std::string *property = std::get_if<std::string>(
+ &pcieDevProperties["Function" + function + "RevisionId"]);
+ property)
+ {
+ asyncResp->res.jsonValue["RevisionId"] = *property;
+ }
- if (std::string *property =
- sdbusplus::message::variant_ns::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "SubsystemVendorId"]);
- property)
- {
- asyncResp->res.jsonValue["SubsystemVendorId"] = *property;
- }
- };
+ if (std::string *property = std::get_if<std::string>(
+ &pcieDevProperties["Function" + function + "SubsystemId"]);
+ property)
+ {
+ asyncResp->res.jsonValue["SubsystemId"] = *property;
+ }
+
+ if (std::string *property = std::get_if<std::string>(
+ &pcieDevProperties["Function" + function +
+ "SubsystemVendorId"]);
+ property)
+ {
+ asyncResp->res.jsonValue["SubsystemVendorId"] = *property;
+ }
+ };
std::string escapedPath = std::string(pciePath) + "/" + device;
dbus::utility::escapePathForDbus(escapedPath);
crow::connections::systemBus->async_method_call(
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index c1f41b8030..f11d7e8d8d 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -97,9 +97,7 @@ class Power : public Node
return;
}
// Check PowerCapEnable
- const bool* b =
- sdbusplus::message::variant_ns::get_if<bool>(
- &powerCapEnable);
+ const bool* b = std::get_if<bool>(&powerCapEnable);
if (b == nullptr)
{
messages::internalError(asyncResp->res);
@@ -255,8 +253,7 @@ class Power : public Node
if (!property.first.compare("Scale"))
{
const int64_t* i =
- sdbusplus::message::variant_ns::get_if<int64_t>(
- &property.second);
+ std::get_if<int64_t>(&property.second);
if (i)
{
@@ -266,14 +263,11 @@ class Power : public Node
else if (!property.first.compare("PowerCap"))
{
const double* d =
- sdbusplus::message::variant_ns::get_if<double>(
- &property.second);
+ std::get_if<double>(&property.second);
const int64_t* i =
- sdbusplus::message::variant_ns::get_if<int64_t>(
- &property.second);
+ std::get_if<int64_t>(&property.second);
const uint32_t* u =
- sdbusplus::message::variant_ns::get_if<
- uint32_t>(&property.second);
+ std::get_if<uint32_t>(&property.second);
if (d)
{
@@ -290,9 +284,7 @@ class Power : public Node
}
else if (!property.first.compare("PowerCapEnable"))
{
- const bool* b =
- sdbusplus::message::variant_ns::get_if<bool>(
- &property.second);
+ const bool* b = std::get_if<bool>(&property.second);
if (b)
{
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 1fc4b4fe13..a4c4f5bd61 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -227,9 +227,8 @@ void getComputerSystem(std::shared_ptr<AsyncResp> aResp,
continue;
}
const uint32_t *value =
- sdbusplus::message::variant_ns::
- get_if<uint32_t>(
- &property.second);
+ std::get_if<uint32_t>(
+ &property.second);
if (value == nullptr)
{
BMCWEB_LOG_DEBUG
@@ -331,10 +330,8 @@ void getComputerSystem(std::shared_ptr<AsyncResp> aResp,
"ProcessorFamily")
{
const std::string *value =
- sdbusplus::message::
- variant_ns::get_if<
- std::string>(
- &property.second);
+ std::get_if<std::string>(
+ &property.second);
if (value != nullptr)
{
nlohmann::json
@@ -467,9 +464,8 @@ void getComputerSystem(std::shared_ptr<AsyncResp> aResp,
if (property.first == "UUID")
{
const std::string *value =
- sdbusplus::message::variant_ns::
- get_if<std::string>(
- &property.second);
+ std::get_if<std::string>(
+ &property.second);
if (value != nullptr)
{