sdbusplus: remove deprecated variant_ns

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I86e11299512704fa1df1e5f6517ea25cc6eced8f
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 702136a..ae050ac 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -290,8 +290,7 @@
                         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 @@
                         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 @@
                         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 @@
                     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 @@
                     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 @@
                     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 6287f3c..910d33b 100644
--- a/redfish-core/lib/hypervisor_ethernet.hpp
+++ b/redfish-core/lib/hypervisor_ethernet.hpp
@@ -235,8 +235,7 @@
                         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 @@
                         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 767a7fc..77155e3 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -459,8 +459,7 @@
         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 @@
         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 @@
         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 @@
                         {
                             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 d3d9580..a2ae1ea 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -76,8 +76,7 @@
                         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 @@
                         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 b963a53..33b8828 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -163,17 +163,15 @@
                     {"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 @@
                     // 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 @@
         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}}}}}};
+            // 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 +
-                                               "DeviceId"]);
-                    property)
-                {
-                    asyncResp->res.jsonValue["DeviceId"] = *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 =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["Function" + function +
-                                               "VendorId"]);
-                    property)
-                {
-                    asyncResp->res.jsonValue["VendorId"] = *property;
-                }
+            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 c1f41b8..f11d7e8 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -97,9 +97,7 @@
                         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 @@
                         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 @@
                         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 @@
                         }
                         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 1fc4b4f..a4c4f5b 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -227,9 +227,8 @@
                                                 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 @@
                                                 "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 @@
                                         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)
                                             {