Add IPv6 StatelessAddressAutoConfiguration

This commit has following changes
1.Adds "StatelessAddressAutoConfig"
support as per latest EthernetInterface schema.
2.Remove support for deprecated Stateful and Stateless enums of DHCPv6
  "OperatingMode"

Tested by:
```
GET PATCH -d '{"StatelessAddressAutoConfig": {"IPv6AutoConfigEnabled": true}}'
PATCH -d '{"StatelessAddressAutoConfig": { "IPv6AutoConfigEnabled": false}}'
PATCH -d '{"DHCPv6" : {"OperatingMode":"Enabled"}}' PATCH -d '{"DHCPv6"
: {"OperatingMode":"Disabled"}}'
```
Redfish Validator passed

Change-Id: I29d471750ef513074bc5e49c31a16fa15d3d760c
Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 218affe..7783e7c 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -86,6 +86,7 @@
     bool hostNameEnabled;
     bool linkUp;
     bool nicEnabled;
+    bool ipv6AcceptRa;
     std::string dhcpEnabled;
     std::string operatingMode;
     std::string hostName;
@@ -277,6 +278,15 @@
                                 ethData.nicEnabled = *nicEnabled;
                             }
                         }
+                        else if (propertyPair.first == "IPv6AcceptRA")
+                        {
+                            const bool* ipv6AcceptRa =
+                                std::get_if<bool>(&propertyPair.second);
+                            if (ipv6AcceptRa != nullptr)
+                            {
+                                ethData.ipv6AcceptRa = *ipv6AcceptRa;
+                            }
+                        }
                         else if (propertyPair.first == "Nameservers")
                         {
                             const std::vector<std::string>* nameservers =
@@ -1091,6 +1101,27 @@
         });
 }
 
+inline void handleSLAACAutoConfigPatch(
+    const std::string& ifaceId, bool ipv6AutoConfigEnabled,
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+{
+    sdbusplus::message::object_path path("/xyz/openbmc_project/network");
+    path /= ifaceId;
+    sdbusplus::asio::setProperty(
+        *crow::connections::systemBus, "xyz.openbmc_project.Network", path,
+        "xyz.openbmc_project.Network.EthernetInterface", "IPv6AcceptRA",
+        ipv6AutoConfigEnabled,
+        [asyncResp](const boost::system::error_code& ec) {
+        if (ec)
+        {
+            BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
+            messages::internalError(asyncResp->res);
+            return;
+        }
+        messages::success(asyncResp->res);
+        });
+}
+
 inline void handleDHCPPatch(const std::string& ifaceId,
                             const EthernetInterfaceData& ethData,
                             const DHCPParameters& v4dhcpParms,
@@ -1106,8 +1137,7 @@
     bool nextv6DHCPState{};
     if (v6dhcpParms.dhcpv6OperatingMode)
     {
-        if ((*v6dhcpParms.dhcpv6OperatingMode != "Stateful") &&
-            (*v6dhcpParms.dhcpv6OperatingMode != "Stateless") &&
+        if ((*v6dhcpParms.dhcpv6OperatingMode != "Enabled") &&
             (*v6dhcpParms.dhcpv6OperatingMode != "Disabled"))
         {
             messages::propertyValueFormatError(asyncResp->res,
@@ -1115,7 +1145,7 @@
                                                "OperatingMode");
             return;
         }
-        nextv6DHCPState = (*v6dhcpParms.dhcpv6OperatingMode == "Stateful");
+        nextv6DHCPState = (*v6dhcpParms.dhcpv6OperatingMode == "Enabled");
     }
     else
     {
@@ -1590,11 +1620,13 @@
     jsonResponse["DHCPv4"]["UseDomainName"] = ethData.hostNameEnabled;
 
     jsonResponse["DHCPv6"]["OperatingMode"] =
-        translateDhcpEnabledToBool(ethData.dhcpEnabled, false) ? "Stateful"
+        translateDhcpEnabledToBool(ethData.dhcpEnabled, false) ? "Enabled"
                                                                : "Disabled";
     jsonResponse["DHCPv6"]["UseNTPServers"] = ethData.ntpEnabled;
     jsonResponse["DHCPv6"]["UseDNSServers"] = ethData.dnsEnabled;
     jsonResponse["DHCPv6"]["UseDomainName"] = ethData.hostNameEnabled;
+    jsonResponse["StatelessAddressAutoConfig"]["IPv6AutoConfigEnabled"] =
+        ethData.ipv6AcceptRa;
 
     if (!ethData.hostName.empty())
     {
@@ -1956,21 +1988,32 @@
         std::optional<std::vector<std::string>> staticNameServers;
         std::optional<nlohmann::json> dhcpv4;
         std::optional<nlohmann::json> dhcpv6;
+        std::optional<bool> ipv6AutoConfigEnabled;
         std::optional<bool> interfaceEnabled;
         std::optional<size_t> mtuSize;
         DHCPParameters v4dhcpParms;
         DHCPParameters v6dhcpParms;
-
+        // clang-format off
         if (!json_util::readJsonPatch(
-                req, asyncResp->res, "HostName", hostname, "FQDN", fqdn,
-                "IPv4StaticAddresses", ipv4StaticAddresses, "MACAddress",
-                macAddress, "StaticNameServers", staticNameServers,
-                "IPv6DefaultGateway", ipv6DefaultGateway, "IPv6StaticAddresses",
-                ipv6StaticAddresses, "DHCPv4", dhcpv4, "DHCPv6", dhcpv6,
-                "MTUSize", mtuSize, "InterfaceEnabled", interfaceEnabled))
+                req, asyncResp->res,
+                "DHCPv4", dhcpv4,
+                "DHCPv6", dhcpv6,
+                "FQDN", fqdn,
+                "HostName", hostname,
+                "IPv4StaticAddresses", ipv4StaticAddresses,
+                "IPv6DefaultGateway", ipv6DefaultGateway,
+                "IPv6StaticAddresses", ipv6StaticAddresses,
+                "InterfaceEnabled", interfaceEnabled,
+                "MACAddress", macAddress,
+                "MTUSize", mtuSize,
+                "StatelessAddressAutoConfig/IPv6AutoConfigEnabled", ipv6AutoConfigEnabled,
+                "StaticNameServers", staticNameServers
+                )
+            )
         {
             return;
         }
+        //clang-format on
         if (dhcpv4)
         {
             if (!json_util::readJson(*dhcpv4, asyncResp->res, "DHCPEnabled",
@@ -2007,7 +2050,7 @@
              ipv6StaticAddresses = std::move(ipv6StaticAddresses),
              staticNameServers = std::move(staticNameServers),
              dhcpv4 = std::move(dhcpv4), dhcpv6 = std::move(dhcpv6), mtuSize,
-             v4dhcpParms = std::move(v4dhcpParms),
+             ipv6AutoConfigEnabled, v4dhcpParms = std::move(v4dhcpParms),
              v6dhcpParms = std::move(v6dhcpParms), interfaceEnabled](
                 const bool& success, const EthernetInterfaceData& ethData,
                 const std::vector<IPv4AddressData>& ipv4Data,
@@ -2033,6 +2076,12 @@
                 handleHostnamePatch(*hostname, asyncResp);
             }
 
+            if (ipv6AutoConfigEnabled)
+            {
+                handleSLAACAutoConfigPatch(ifaceId, *ipv6AutoConfigEnabled,
+                                           asyncResp);
+            }
+
             if (fqdn)
             {
                 handleFqdnPatch(ifaceId, *fqdn, asyncResp);