interfaces: use old dbus encoding

Due to backwards compatibility with old configurations, this is an easy
fix to bring back the old object paths.

Tests are provided to capture this behavior.

Change-Id: Ic89f2eb02bb908cf23b833b08fdca941bef2a07a
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/interfaces/internal_interface.cpp b/interfaces/internal_interface.cpp
index 917b8ec..c990632 100644
--- a/interfaces/internal_interface.cpp
+++ b/interfaces/internal_interface.cpp
@@ -18,6 +18,8 @@
 
 #include <sdbusplus/message.hpp>
 
+#include <algorithm>
+
 namespace phosphor
 {
 namespace led
@@ -50,9 +52,11 @@
 
     std::string s = boost::join(words, "_");
 
-    sdbusplus::message::object_path path(s);
+    // we assume the string to be a correct dbus name besides
+    // this detail
+    std::replace(s.begin(), s.end(), '-', '_');
 
-    return path.str;
+    return s;
 }
 
 void InternalInterface::createLEDPath(const std::string& ledName)
@@ -77,8 +81,7 @@
                "DBUSNAME", name);
 
     // Unique path name representing a single LED.
-    sdbusplus::message::object_path objPath = std::string(physParent);
-    objPath /= name;
+    std::string objPath = std::string(physParent) + "/" + name;
 
     if (leds.contains(objPath))
     {