diff options
author | Ed Tanous <ed.tanous@intel.com> | 2018-11-30 11:35:41 -0800 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2018-12-10 12:54:40 -0800 |
commit | 1b6b96c570fdf7ca5c643f3d0776581656e78070 (patch) | |
tree | d96338cf9f95ea763e4fb6570d83e4d1808d3f41 /redfish-core/lib/ethernet.hpp | |
parent | 789a6a317b51abba38cf064dd5ee2abd051d02bf (diff) | |
download | bmcweb-1b6b96c570fdf7ca5c643f3d0776581656e78070.tar.gz bmcweb-1b6b96c570fdf7ca5c643f3d0776581656e78070.zip |
Remove custom version of getPtr
Now that sdbusplus variant supports std::get_if, we can remove our
custom, mapbox namespaced implementation that does the same thing.
Change-Id: I854c473003e28e41dd45dba08ca683433f1c1774
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'redfish-core/lib/ethernet.hpp')
-rw-r--r-- | redfish-core/lib/ethernet.hpp | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index 8712710..58896d8 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -171,8 +171,8 @@ inline void extractEthernetInterfaceData(const std::string ðiface_id, if (propertyPair.first == "MACAddress") { const std::string *mac = - mapbox::getPtr<const std::string>( - propertyPair.second); + sdbusplus::message::variant_ns::get_if< + std::string>(&propertyPair.second); if (mac != nullptr) { ethData.mac_address = *mac; @@ -186,8 +186,9 @@ inline void extractEthernetInterfaceData(const std::string ðiface_id, { if (propertyPair.first == "Id") { - const uint32_t *id = mapbox::getPtr<const uint32_t>( - propertyPair.second); + const uint32_t *id = + sdbusplus::message::variant_ns::get_if< + uint32_t>(&propertyPair.second); if (id != nullptr) { ethData.vlan_id = *id; @@ -203,7 +204,8 @@ inline void extractEthernetInterfaceData(const std::string ðiface_id, if (propertyPair.first == "AutoNeg") { const bool *auto_neg = - mapbox::getPtr<const bool>(propertyPair.second); + sdbusplus::message::variant_ns::get_if<bool>( + &propertyPair.second); if (auto_neg != nullptr) { ethData.auto_neg = *auto_neg; @@ -212,8 +214,8 @@ inline void extractEthernetInterfaceData(const std::string ðiface_id, else if (propertyPair.first == "Speed") { const uint32_t *speed = - mapbox::getPtr<const uint32_t>( - propertyPair.second); + sdbusplus::message::variant_ns::get_if< + uint32_t>(&propertyPair.second); if (speed != nullptr) { ethData.speed = *speed; @@ -229,8 +231,8 @@ inline void extractEthernetInterfaceData(const std::string ðiface_id, if (propertyPair.first == "HostName") { const std::string *hostname = - mapbox::getPtr<const std::string>( - propertyPair.second); + sdbusplus::message::variant_ns::get_if< + std::string>(&propertyPair.second); if (hostname != nullptr) { ethData.hostname = *hostname; @@ -239,8 +241,8 @@ inline void extractEthernetInterfaceData(const std::string ðiface_id, else if (propertyPair.first == "DefaultGateway") { const std::string *defaultGateway = - mapbox::getPtr<const std::string>( - propertyPair.second); + sdbusplus::message::variant_ns::get_if< + std::string>(&propertyPair.second); if (defaultGateway != nullptr) { ethData.default_gateway = *defaultGateway; @@ -286,8 +288,8 @@ inline void if (property.first == "Address") { const std::string *address = - mapbox::getPtr<const std::string>( - property.second); + sdbusplus::message::variant_ns::get_if< + std::string>(&property.second); if (address != nullptr) { ipv4_address.address = *address; @@ -296,8 +298,8 @@ inline void else if (property.first == "Gateway") { const std::string *gateway = - mapbox::getPtr<const std::string>( - property.second); + sdbusplus::message::variant_ns::get_if< + std::string>(&property.second); if (gateway != nullptr) { ipv4_address.gateway = *gateway; @@ -306,8 +308,8 @@ inline void else if (property.first == "Origin") { const std::string *origin = - mapbox::getPtr<const std::string>( - property.second); + sdbusplus::message::variant_ns::get_if< + std::string>(&property.second); if (origin != nullptr) { ipv4_address.origin = @@ -318,7 +320,8 @@ inline void else if (property.first == "PrefixLength") { const uint8_t *mask = - mapbox::getPtr<uint8_t>(property.second); + sdbusplus::message::variant_ns::get_if<uint8_t>( + &property.second); if (mask != nullptr) { // convert it to the string @@ -1739,7 +1742,6 @@ class VlanNetworkInterfaceCollection : public Node messages::internalError(asyncResp->res); return; } - nlohmann::json postReq; if (!json_util::processJsonFromRequest(res, req, postReq)) { @@ -1747,6 +1749,7 @@ class VlanNetworkInterfaceCollection : public Node } auto vlanIdJson = postReq.find("VLANId"); + if (vlanIdJson == postReq.end()) { messages::propertyMissing(asyncResp->res, "VLANId"); |