diff options
author | Ravi Teja <raviteja28031990@gmail.com> | 2019-04-16 10:43:13 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-04-30 20:00:58 +0300 |
commit | 9a6fc6fe4ad7ad2e3b028419bdb081a42e88ff0a (patch) | |
tree | 076c566748801947b13c33d5c83303748ac9cc72 /redfish-core/lib/ethernet.hpp | |
parent | fa5053a6b1f1cc821e97a84b49a4f82adf580594 (diff) | |
download | bmcweb-9a6fc6fe4ad7ad2e3b028419bdb081a42e88ff0a.tar.xz |
Redfish(Network): Implement IPv6DefaultGateway support
Added GET support for IPv6DefaultGateway.its read only property
On Patch operation display "PropertyNotWritable" message.
Tested by:
GET
PATCH -D patch.txt -d '{"IPv6DefaultGateway": "fe80::226:88ff:feac:8401"}'
Tested with validator and no errors.
Change-Id: Ib67234496b70ec53508a9be36cd86c1859b5d895
Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
Diffstat (limited to 'redfish-core/lib/ethernet.hpp')
-rw-r--r-- | redfish-core/lib/ethernet.hpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index 71ad624f90..0356b0c99f 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -81,6 +81,7 @@ struct EthernetInterfaceData bool DHCPEnabled; std::string hostname; std::string default_gateway; + std::string ipv6_default_gateway; std::string mac_address; std::vector<std::uint32_t> vlan_id; std::vector<std::string> nameservers; @@ -270,6 +271,16 @@ inline void extractEthernetInterfaceData(const std::string ðiface_id, ethData.default_gateway = *defaultGateway; } } + else if (propertyPair.first == "DefaultGateway6") + { + const std::string *defaultGateway6 = + sdbusplus::message::variant_ns::get_if<std::string>( + &propertyPair.second); + if (defaultGateway6 != nullptr) + { + ethData.ipv6_default_gateway = *defaultGateway6; + } + } } } } @@ -1245,6 +1256,7 @@ class EthernetInterface : public Node {"Gateway", gatewayStr}}); } } + json_response["IPv6DefaultGateway"] = ethData.ipv6_default_gateway; } /** @@ -1301,6 +1313,7 @@ class EthernetInterface : public Node std::optional<std::string> hostname; std::optional<std::string> macAddress; + std::optional<std::string> ipv6DefaultGateway; std::optional<nlohmann::json> ipv4Addresses; std::optional<nlohmann::json> ipv6Addresses; std::optional<std::vector<std::string>> staticNameServers; @@ -1308,7 +1321,8 @@ class EthernetInterface : public Node if (!json_util::readJson( req, res, "HostName", hostname, "IPv4Addresses", ipv4Addresses, "IPv6Addresses", ipv6Addresses, "MACAddress", macAddress, - "StaticNameServers", staticNameServers)) + "StaticNameServers", staticNameServers, "IPv6DefaultGateway", + ipv6DefaultGateway)) { return; } @@ -1321,6 +1335,7 @@ class EthernetInterface : public Node macAddress = std::move(macAddress), ipv4Addresses = std::move(ipv4Addresses), ipv6Addresses = std::move(ipv6Addresses), + ipv6DefaultGateway = std::move(ipv6DefaultGateway), staticNameServers = std::move(staticNameServers)]( const bool &success, const EthernetInterfaceData ðData, const boost::container::flat_set<IPv4AddressData> &ipv4Data) { @@ -1371,6 +1386,12 @@ class EthernetInterface : public Node handleStaticNameServersPatch(iface_id, *staticNameServers, asyncResp); } + + if (ipv6DefaultGateway) + { + messages::propertyNotWritable(asyncResp->res, + "IPv6DefaultGateway"); + } }); } }; |