Base monitoring generation script

Monitoring source generation script with mako template to
generate an empty set of events. The events will be parsed and added
under openbmc/openbmc#1493

Resolves openbmc/openbmc#1343

Change-Id: I40225f070212af36f410d99bc7ead95961e70997
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/src/gen-group-defs.py b/src/gen-group-defs.py
new file mode 100755
index 0000000..56ac00f
--- /dev/null
+++ b/src/gen-group-defs.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import yaml
+from argparse import ArgumentParser
+from mako.template import Template
+
+
+def generate(yaml_file, output_file):
+    with open(yaml_file, 'r') as yaml_input:
+        yaml_data = yaml.safe_load(yaml_input) or {}
+
+    with open(output_file, 'w') as gen_out:
+        gen_out.write(Template(filename='generated.mako.cpp').render(
+            events=yaml_data))
+
+
+if __name__ == '__main__':
+    parser = ArgumentParser()
+    # Groups of items and how they should be monitored yaml file
+    parser.add_argument(
+        "-y", "--yaml", dest="input_yaml",
+        default="example/monitoring_defs.yaml",
+        help="Input item monitoring definition yaml to parse")
+    parser.add_argument(
+        "-o", "--outdir", dest="output_dir",
+        default=os.path.abspath('.'),
+        help="Output directory for source files generated")
+    args = parser.parse_args(sys.argv[1:])
+
+    yaml_file = os.path.abspath(args.input_yaml)
+    generate(yaml_file, os.path.join(args.output_dir, "generated.cpp"))