util: Add a function for converting MAC addresses

We need to be able to convert a mac addresses from byte form into our
typical human readable string form.

Tested:
    Unit tests pass.

Change-Id: I6e68cfefd4d5962e1125c1b5229e61fce475729a
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/util.cpp b/util.cpp
index 35a6ed7..7aa4e2a 100644
--- a/util.cpp
+++ b/util.cpp
@@ -547,6 +547,21 @@
     return sdbusplus::message::variant_ns::get<std::string>(value);
 }
 
+std::string toString(const MacAddr& mac)
+{
+    std::string str;
+    str.reserve(mac.size() * 3);
+    for (size_t i = 0; i < mac.size(); ++i)
+    {
+        str.push_back(internal::toHex(mac[i] >> 4));
+        str.push_back(internal::toHex(mac[i]));
+        str.push_back(':');
+    }
+    // Remove trailing semicolon
+    str.pop_back();
+    return str;
+}
+
 } // namespace mac_address
 } // namespace network
 } // namespace phosphor