Allow generation of map types in events

Resolves openbmc/openbmc#940

Change-Id: I238cd4a6ef69c1d54a775ad90ee87e6e327b82bd
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py
index eb33956..adef86a 100755
--- a/control/gen-fan-zone-defs.py
+++ b/control/gen-fan-zone-defs.py
@@ -115,6 +115,16 @@
 '''
 
 
+def convertToMap(listOfDict):
+    """
+    Converts a list of dictionary entries to a std::map initialization list.
+    """
+    listOfDict = listOfDict.replace('[', '{')
+    listOfDict = listOfDict.replace(']', '}')
+    listOfDict = listOfDict.replace(':', ',')
+    return listOfDict
+
+
 def getEventsInZone(zone_num, zone_conditions, events_data):
     """
     Constructs the event entries defined for each zone using the events yaml
@@ -172,8 +182,12 @@
                         param['type'] = 'size_t'
                     params.append(param)
                 else:
-                    param['value'] = str(e['action'][p]['value']).lower()
                     param['type'] = str(e['action'][p]['type']).lower()
+                    if p != 'map':
+                        param['value'] = str(e['action'][p]['value']).lower()
+                    else:
+                        emap = convertToMap(str(e['action'][p]['value']))
+                        param['value'] = param['type'] + emap
                     params.append(param)
             action['parameters'] = params
             event['action'] = action