inventory: write sensor yaml parser

Write python-based parser for sensor.yaml. The parser generates
sensor-gen.cpp,which is having a map of sensorid(key) and
sensorinfo(value).

Change-Id: I5aa2d2bc871ced06e5e4c164a67eeb5974031d5d
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp
new file mode 100644
index 0000000..0b8d5f1
--- /dev/null
+++ b/scripts/writesensor.mako.cpp
@@ -0,0 +1,54 @@
+## This file is a template.  The comment below is emitted
+## into the rendered file; feel free to edit this file.
+
+// !!! WARNING: This is a GENERATED Code..Please do NOT Edit !!!
+
+#include "types.hpp"
+using namespace ipmi::sensor;
+
+extern const IdInfoMap sensors = {
+% for key in sensorDict.iterkeys():
+   % if key:
+{${key},{
+<%
+       sensor = sensorDict[key]
+       interfaces = sensor["interfaces"]
+       path = sensor["path"]
+       sensorType = sensor["sensorType"]
+       readingType = sensor["sensorReadingType"]
+%>
+        ${sensorType},"${path}",${readingType},{
+    % for interface,properties in interfaces.iteritems():
+            {"${interface}",{
+            % for dbus_property,property_value in properties.iteritems():
+                {"${dbus_property}",{
+                % for offset,values in property_value.iteritems():
+                    { ${offset},{
+<%
+                        valueType = values["type"]
+%>
+                     % for name,value in values.iteritems():
+                        % if name == "type":
+<%
+                              continue
+%>
+                        % endif
+                        % if valueType == "string":
+                           std::string("${value}"),
+                        % else:
+                           ${value},
+                        % endif
+                     % endfor
+                        }
+                    },
+                % endfor
+                }},
+            % endfor
+            }},
+    % endfor
+     }
+}},
+   % endif
+% endfor
+};
+