loxi-prep: use plain lists to hold OF actions

Some callsites needed to be changed because they depended on action_list.append
taking a shallow copy.
diff --git a/tools/munger/scripts/message_gen.py b/tools/munger/scripts/message_gen.py
index 6761935..5d771e3 100644
--- a/tools/munger/scripts/message_gen.py
+++ b/tools/munger/scripts/message_gen.py
@@ -310,9 +310,6 @@
     _p4('setattr(self, k, v)')
     _p3('else:')
     _p4('raise NameError("field %s does not exist in %s" % (k, self.__class__))')
-    if has_list and list_type != None:
-        _p2('# Coerce keyword arg into list type')
-        _p2('self.%(list_var)s = %(list_type)s(self.%(list_var)s)' % dict(list_type=list_type, list_var=list_var))
 
     print """
 
@@ -329,7 +326,9 @@
 
     # Have to special case the action length calculation for pkt out
     if msg == 'packet_out':
-        _p2('self.actions_len = len(self.actions)')
+        _p2('self.actions_len = 0')
+        _p2('for obj in self.actions:')
+        _p3('self.actions_len += len(obj)')
     if has_core_members:
         _p2("packed += " + parent + ".pack(self)")
     if has_list:
@@ -337,7 +336,7 @@
             _p2('for obj in self.' + list_var + ':')
             _p3('packed += obj.pack()')
         else:
-            _p2('packed += self.' + list_var + '.pack()')
+            _p2('packed += ' + list_type + '(self.' + list_var + ').pack()')
     if has_string:
         _p2('packed += self.data')
     _p2("return packed")
@@ -367,15 +366,21 @@
             _p2("for obj in self." + list_var + ":")
             _p3("binary_string = obj.unpack(binary_string)")
         elif msg == "packet_out":  # Special case this
-            _p2('binary_string = self.actions.unpack(' + 
+            _p2("obj = action_list()")
+            _p2('binary_string = obj.unpack(' + 
                 'binary_string, bytes=self.actions_len)')
+            _p2("self.actions = list(obj)")
         elif msg == "flow_mod":  # Special case this
             _p2("ai_len = self.header.length - (OFP_FLOW_MOD_BYTES + " + 
                 "OFP_HEADER_BYTES)")
-            _p2("binary_string = self.actions.unpack(binary_string, " +
+            _p2("obj = action_list()")
+            _p2("binary_string = obj.unpack(binary_string, " +
                 "bytes=ai_len)")
+            _p2("self.actions = list(obj)")
         else:
-            _p2("binary_string = self." + list_var + ".unpack(binary_string)")
+            _p2("obj = " + list_type + "()")
+            _p2("binary_string = obj.unpack(binary_string)")
+            _p2("self." + list_var + " = list(obj)")
     if has_string:
         _p2("self.data = binary_string")
         _p2("binary_string = ''")
@@ -397,11 +402,8 @@
     if has_core_members:
         _p2("length += " + parent + ".__len__(self)")
     if has_list:
-        if list_type == None:
-            _p2("for obj in self." + list_var + ":")
-            _p3("length += len(obj)")
-        else:
-            _p2("length += len(self." + list_var + ")")
+        _p2("for obj in self." + list_var + ":")
+        _p3("length += len(obj)")
     if has_string:
         _p2("length += len(self.data)")
     _p2("return length")
@@ -680,12 +682,12 @@
     \"""
     def __init__(self):
         ofp_flow_stats.__init__(self)
-        self.actions = action_list()
+        self.actions = []
 
     def pack(self, assertstruct=True):
         self.length = len(self)
         packed = ofp_flow_stats.pack(self, assertstruct)
-        packed += self.actions.pack()
+        packed += action_list(self.actions).pack()
         if len(packed) != self.length:
             print("ERROR: flow_stats_entry pack length not equal",
                   self.length, len(packed))
@@ -697,7 +699,9 @@
         if ai_len < 0:
             print("ERROR: flow_stats_entry unpack length too small",
                   self.length)
-        binary_string = self.actions.unpack(binary_string, bytes=ai_len)
+        obj = action_list()
+        binary_string = obj.unpack(binary_string, bytes=ai_len)
+        self.actions = list(obj)
         return binary_string
 
     def __len__(self):