Throw error when invalid MAC Address is set

sdbusplus supports errors on properties, so we can now throw
exceptions on such cases as invalid parameters.

Also changed the journal log levels to ERR.

Tested: Built an image and see invalid parameter errors on values
        like garbage MAC addresses and non-admin MAC Addresses.
Change-Id: I69687bbf34fe51f0c812f40dfc99bb88ce141a2f
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
index 35e61a7..d887bf5 100644
--- a/ethernet_interface.cpp
+++ b/ethernet_interface.cpp
@@ -664,9 +664,10 @@
 {
     if (!mac_address::validate(value))
     {
-        log<level::DEBUG>("MACAddress is not valid.",
+        log<level::ERR>("MACAddress is not valid.",
                           entry("MAC=%s", value.c_str()));
-        return MacAddressIntf::mACAddress();
+        elog<InvalidArgument>(Argument::ARGUMENT_NAME("MACAddress"),
+                              Argument::ARGUMENT_VALUE(value.c_str()));
     }
 
     // check whether MAC is broadcast mac.
@@ -674,9 +675,10 @@
 
     if (!(intMac ^ mac_address::broadcastMac))
     {
-        log<level::DEBUG>("MACAddress is a broadcast mac.",
+        log<level::ERR>("MACAddress is a broadcast mac.",
                           entry("MAC=%s", value.c_str()));
-        return MacAddressIntf::mACAddress();
+        elog<InvalidArgument>(Argument::ARGUMENT_NAME("MACAddress"),
+                              Argument::ARGUMENT_VALUE(value.c_str()));
     }
 
     // Check if the MAC changed.
@@ -700,9 +702,10 @@
 
             if (intInventoryMac != intMac)
             {
-                log<level::DEBUG>("Given MAC address is neither a local Admin "
+                log<level::ERR>("Given MAC address is neither a local Admin "
                                   "type nor is same as in inventory");
-                return MacAddressIntf::mACAddress();
+                elog<InvalidArgument>(Argument::ARGUMENT_NAME("MACAddress"),
+                                      Argument::ARGUMENT_VALUE(value.c_str()));
             }
         }
         catch(InternalFailure& e)
diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp
index 5109e42..caa042e 100644
--- a/ethernet_interface.hpp
+++ b/ethernet_interface.hpp
@@ -121,7 +121,7 @@
 
         /** @brief sets the MAC address.
          *  @param[in] value - MAC address which needs to be set on the system.
-         *  @returns macAddress of the interface.
+         *  @returns macAddress of the interface or throws an error.
          */
         std::string mACAddress(std::string value) override;