loxi-prep: subtype flow_mod classes
diff --git a/src/python/of10/message.py b/src/python/of10/message.py
index 6acb063..b52d40f 100644
--- a/src/python/of10/message.py
+++ b/src/python/of10/message.py
@@ -3448,3 +3448,32 @@
     vendor
     )
 
+
+_flow_mod = flow_mod
+flow_mod = None
+
+class flow_add(_flow_mod):
+    def __init__(self, **kwargs):
+        _flow_mod.__init__(self, **kwargs)
+        self.command = OFPFC_ADD
+
+class flow_modify(_flow_mod):
+    def __init__(self, **kwargs):
+        _flow_mod.__init__(self, **kwargs)
+        self.command = OFPFC_MODIFY
+
+class flow_modify_strict(_flow_mod):
+    def __init__(self, **kwargs):
+        _flow_mod.__init__(self, **kwargs)
+        self.command = OFPFC_MODIFY_STRICT
+
+class flow_delete(_flow_mod):
+    def __init__(self, **kwargs):
+        _flow_mod.__init__(self, **kwargs)
+        self.command = OFPFC_DELETE
+
+class flow_delete_strict(_flow_mod):
+    def __init__(self, **kwargs):
+        _flow_mod.__init__(self, **kwargs)
+        self.command = OFPFC_DELETE_STRICT
+
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index a14eab1..a1db2e0 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -40,10 +40,9 @@
     """
 
     logging.info("Deleting all flows")
-    msg = of10.message.flow_mod()
+    msg = of10.message.flow_delete()
     msg.match.wildcards = of10.OFPFW_ALL
     msg.out_port = of10.OFPP_NONE
-    msg.command = of10.OFPFC_DELETE
     msg.buffer_id = 0xffffffff
     ctrl.message_send(msg)
     return 0 # for backwards compatibility
@@ -574,7 +573,7 @@
     else:
         egr_port_list = [egr_ports]
 
-    request = of10.message.flow_mod()
+    request = of10.message.flow_add()
     request.match = match
     request.buffer_id = 0xffffffff
     if check_expire:
@@ -969,7 +968,7 @@
 # Generate a simple "drop" flow mod
 # If in_band is true, then only drop from first test port
 def flow_mod_gen(port_map, in_band):
-    request = of10.message.flow_mod()
+    request = of10.message.flow_add()
     request.match.wildcards = of10.OFPFW_ALL
     if in_band:
         request.match.wildcards = of10.OFPFW_ALL - of10.OFPFW_IN_PORT
diff --git a/tests/FuncUtils.py b/tests/FuncUtils.py
index 92b3024..1aefae1 100644
--- a/tests/FuncUtils.py
+++ b/tests/FuncUtils.py
@@ -18,9 +18,8 @@
 #################### Functions for various types of flow_mod  ##########################################################################################
 
 def match_send_flowadd(self, match, priority, port):
-    msg = ofp.message.flow_mod()
+    msg = ofp.message.flow_add()
     msg.out_port = ofp.OFPP_NONE
-    msg.command = ofp.OFPFC_ADD
     # msg.cookie = random.randint(0,9007199254740992)
     msg.buffer_id = 0xffffffff
     msg.match = match
@@ -323,10 +322,9 @@
 # Strict Modify the flow Action 
         
     #Create a flow_mod message , command MODIFY_STRICT
-    msg5 = ofp.message.flow_mod()
+    msg5 = ofp.message.flow_modify_strict()
     msg5.match = match
     msg5.cookie = random.randint(0,9007199254740992)
-    msg5.command = ofp.OFPFC_MODIFY_STRICT
     msg5.buffer_id = 0xffffffff
     act5 = ofp.action.output()
     act5.port = egress_port
@@ -343,10 +341,9 @@
 # Modify the flow action
         
     #Create a flow_mod message , command MODIFY 
-    msg8 = ofp.message.flow_mod()
+    msg8 = ofp.message.flow_modify()
     msg8.match = match
     msg8.cookie = random.randint(0,9007199254740992)
-    msg8.command = ofp.OFPFC_MODIFY
     #out_port will be ignored for flow adds and flow modify (here for test-case Add_Modify_With_Outport)
     msg8.out_port = of_ports[3]
     msg8.buffer_id = 0xffffffff
@@ -371,7 +368,7 @@
             "Could not generate flow match from pkt")
     
     match.in_port = ingress_port
-    request = ofp.message.flow_mod()
+    request = ofp.message.flow_add()
     request.match = match
     request.buffer_id = 0xffffffff
     act = ofp.action.enqueue()
@@ -516,9 +513,8 @@
 # Issue Strict Delete 
         
     #Create flow_mod message, command DELETE_STRICT
-    msg4 = ofp.message.flow_mod()
+    msg4 = ofp.message.flow_delete_strict()
     msg4.out_port = ofp.OFPP_NONE
-    msg4.command = ofp.OFPFC_DELETE_STRICT
     msg4.buffer_id = 0xffffffff
     msg4.match = match
 
@@ -533,9 +529,8 @@
 # Issue Non_Strict Delete 
         
     #Create flow_mod message, command DELETE
-    msg6 = ofp.message.flow_mod()
+    msg6 = ofp.message.flow_delete()
     msg6.out_port = ofp.OFPP_NONE
-    msg6.command = ofp.OFPFC_DELETE
     msg6.buffer_id = 0xffffffff
     msg6.match = match
 
diff --git a/tests/actions.py b/tests/actions.py
index 6bb6a8a..494d941 100644
--- a/tests/actions.py
+++ b/tests/actions.py
@@ -49,9 +49,8 @@
         match.wildcards=ofp.OFPFW_ALL
         match.in_port = of_ports[0]
         
-        msg = ofp.message.flow_mod()
+        msg = ofp.message.flow_add()
         msg.out_port = ofp.OFPP_NONE
-        msg.command = ofp.OFPFC_ADD
         msg.buffer_id = 0xffffffff
         msg.match = match
         self.controller.message_send(msg)
@@ -150,7 +149,7 @@
         match.in_port = ingress_port
 
         #Create a flow mod with action.port = OFPP_ALL
-        request = ofp.message.flow_mod()
+        request = ofp.message.flow_add()
         request.match = match
         request.match.wildcards = ofp.OFPFW_ALL&~ofp.OFPFW_IN_PORT
         act.port = ofp.OFPP_ALL
@@ -202,7 +201,7 @@
             match.in_port = ingress_port
             
             #Create a flow mod message
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             act.port = ofp.OFPP_CONTROLLER
             request.actions.append(act)
@@ -253,7 +252,7 @@
 
             match.in_port = ingress_port
             #Create flow mod message
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             act.port = ofp.OFPP_LOCAL
             request.actions.append(act)
@@ -301,7 +300,7 @@
         match.in_port = ingress_port
 
         #Create a flow mod with action.port = OFPP_ALL
-        request = ofp.message.flow_mod()
+        request = ofp.message.flow_add()
         request.match = match
         request.match.wildcards = ofp.OFPFW_ALL&~ofp.OFPFW_IN_PORT
         act.port = ofp.OFPP_FLOOD
@@ -351,7 +350,7 @@
         match.in_port = ingress_port
 
         # Create a flow mod message
-        request = ofp.message.flow_mod()
+        request = ofp.message.flow_add()
         request.match = match
         act.port = ofp.OFPP_IN_PORT
             
diff --git a/tests/bsn_mirror.py b/tests/bsn_mirror.py
index 79e9b26..87ca463 100644
--- a/tests/bsn_mirror.py
+++ b/tests/bsn_mirror.py
@@ -141,7 +141,7 @@
         act2.copy_stage = 0
         act3 = ofp.action.output()
         act3.port = ports[1]
-        flow_mod = ofp.message.flow_mod()
+        flow_mod = ofp.message.flow_add()
         flow_mod.match = match
         flow_mod.actions.append(act1)
         flow_mod.actions.append(act2)
diff --git a/tests/caps.py b/tests/caps.py
index 7a0b83f..7fceeaf 100644
--- a/tests/caps.py
+++ b/tests/caps.py
@@ -36,7 +36,7 @@
         break;
     match.in_port = port
     match.ipv4_src = 1
-    request = ofp.message.flow_mod()
+    request = ofp.message.flow_add()
     count_check = 101  # fixme:  better way to determine this.
     if is_exact:
         match.wildcards = 0
diff --git a/tests/detailed_contr_sw_messages.py b/tests/detailed_contr_sw_messages.py
index 65e7201..a32251d 100644
--- a/tests/detailed_contr_sw_messages.py
+++ b/tests/detailed_contr_sw_messages.py
@@ -52,8 +52,7 @@
         match3.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT
         match3.in_port = of_ports[0]
 
-        msg3 = ofp.message.flow_mod()
-        msg3.command = ofp.OFPFC_ADD
+        msg3 = ofp.message.flow_add()
         msg3.match = match3
         msg3.flags |= ofp.OFPFF_CHECK_OVERLAP
         msg3.cookie = random.randint(0,9007199254740992)
@@ -173,9 +172,8 @@
         match = parse.packet_to_flow_match(pkt)
         match.in_port = of_ports[0]
         
-        request = ofp.message.flow_mod()
+        request = ofp.message.flow_add()
         request.match = match
-        request.command = ofp.OFPFC_ADD
         request.flags = request.flags|ofp.OFPFF_EMERG
         request.hard_timeout =9
         request.idle_timeout =9
@@ -220,8 +218,7 @@
 
         #Generate a flow-mod,command OFPC_MODIFY 
 
-        request = ofp.message.flow_mod()
-        request.command = ofp.OFPFC_MODIFY
+        request = ofp.message.flow_modify()
         request.match.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT
         request.match.in_port = of_ports[0]
         request.cookie = random.randint(0,9007199254740992)
@@ -337,10 +334,9 @@
         logging.info("Expecting switch to ignore the command , without generating errors")
 
         # Issue a delete command 
-        msg = ofp.message.flow_mod()
+        msg = ofp.message.flow_delete()
         msg.match.wildcards = ofp.OFPFW_ALL
         msg.out_port = ofp.OFPP_NONE
-        msg.command = ofp.OFPFC_DELETE
         msg.buffer_id = 0xffffffff
 
         # Verify no message or error is generated by polling the the control plane
@@ -389,7 +385,7 @@
                         'Received flow removed message for the flow with flow_rem flag not set')
         
         # Insert another flow F' with OFPFF_SEND_FLOW_REM flag set.
-        msg9 = ofp.message.flow_mod()
+        msg9 = ofp.message.flow_add()
         msg9.match.wildcards = ofp.OFPFW_ALL
         msg9.cookie = random.randint(0,9007199254740992)
         msg9.buffer_id = 0xffffffff
@@ -432,9 +428,8 @@
         pkt = simple_tcp_packet()
         match = parse.packet_to_flow_match(pkt)
         match.in_port = of_ports[0]
-        request = ofp.message.flow_mod()
+        request = ofp.message.flow_add()
         request.match = match
-        request.command = ofp.OFPFC_ADD
         request.flags = request.flags|ofp.OFPFF_EMERG|ofp.OFPFF_SEND_FLOW_REM
         act = ofp.action.output()
         act.port = of_ports[1]
@@ -564,9 +559,8 @@
         verify_tablestats(self,expect_active=1)
 
         #Send delete command matching the flow-1 but with contraint out_port = of_port[2]
-        msg7 = ofp.message.flow_mod()
+        msg7 = ofp.message.flow_delete()
         msg7.out_port = of_ports[2]
-        msg7.command = ofp.OFPFC_DELETE
         msg7.buffer_id = 0xffffffff
         msg7.match = match
 
@@ -580,9 +574,8 @@
         logging.info("Expecting switch to delete the flow")
 
         #Send Delete command with contraint out_port = of_ports[1]
-        msg7 = ofp.message.flow_mod()
+        msg7 = ofp.message.flow_delete()
         msg7.out_port = of_ports[1]
-        msg7.command = ofp.OFPFC_DELETE
         msg7.buffer_id = 0xffffffff
         msg7.match = match
 
@@ -612,7 +605,7 @@
         logging.info("Expecting the flow entry to delete with given idle_timeout")
 
         #Insert a flow entry with idle_timeout=1.Send_Flow_Rem flag set
-        msg9 = ofp.message.flow_mod()
+        msg9 = ofp.message.flow_add()
         msg9.match.wildcards = ofp.OFPFW_ALL
         msg9.cookie = random.randint(0,9007199254740992)
         msg9.buffer_id = 0xffffffff
@@ -694,7 +687,7 @@
         logging.info("Expecting the flow entry to delete with given hard_timeout")
 
         # Insert a flow entry with hardtimeout=1 and send_flow_removed flag set
-        msg9 = ofp.message.flow_mod()
+        msg9 = ofp.message.flow_add()
         msg9.match.wildcards = ofp.OFPFW_ALL
         msg9.cookie = random.randint(0,9007199254740992)
         msg9.buffer_id = 0xffffffff
@@ -745,9 +738,8 @@
         self.assertTrue(match3 is not None, "Could not generate flow match from pkt")
         match3.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT
         match3.in_port = of_ports[0]
-        msg3 = ofp.message.flow_mod()
+        msg3 = ofp.message.flow_add()
         msg3.out_port = of_ports[2] # ignored by flow add,flow modify 
-        msg3.command = ofp.OFPFC_ADD
         msg3.cookie = random.randint(0,9007199254740992)
         msg3.buffer_id = 0xffffffff
         msg3.hard_timeout = 1
diff --git a/tests/flow_expire.py b/tests/flow_expire.py
index 70ab10e..0467e4b 100644
--- a/tests/flow_expire.py
+++ b/tests/flow_expire.py
@@ -55,7 +55,7 @@
         
         match.in_port = ingress_port
         
-        request = ofp.message.flow_mod()
+        request = ofp.message.flow_add()
         request.match = match
         request.cookie = random.randint(0,9007199254740992)
         request.buffer_id = 0xffffffff
diff --git a/tests/flow_query.py b/tests/flow_query.py
index 68d4e1f..0e914fc 100644
--- a/tests/flow_query.py
+++ b/tests/flow_query.py
@@ -1348,8 +1348,7 @@
         return (n > 0)
 
     def flow_add(self, flow_cfg, overlapf = False):
-        flow_mod_msg = ofp.message.flow_mod()
-        flow_mod_msg.command     = ofp.OFPFC_ADD
+        flow_mod_msg = ofp.message.flow_add()
         flow_mod_msg.buffer_id   = 0xffffffff
         flow_cfg.to_flow_mod_msg(flow_mod_msg)
         if overlapf:
@@ -1364,9 +1363,10 @@
         return True
 
     def flow_mod(self, flow_cfg, strictf):
-        flow_mod_msg = ofp.message.flow_mod()
-        flow_mod_msg.command     = ofp.OFPFC_MODIFY_STRICT if strictf \
-                                   else ofp.OFPFC_MODIFY
+        if strictf:
+            flow_mod_msg = ofp.message.flow_modify_strict()
+        else:
+            flow_mod_msg = ofp.message.flow_modify()
         flow_mod_msg.buffer_id   = 0xffffffff
         flow_cfg.to_flow_mod_msg(flow_mod_msg)
         flow_mod_msg.xid = random.randrange(1,0xffffffff)
@@ -1377,9 +1377,10 @@
         return True
 
     def flow_del(self, flow_cfg, strictf):
-        flow_mod_msg = ofp.message.flow_mod()
-        flow_mod_msg.command     = ofp.OFPFC_DELETE_STRICT if strictf \
-                                   else ofp.OFPFC_DELETE
+        if strictf:
+            flow_mod_msg = ofp.message.flow_delete_strict()
+        else:
+            flow_mod_msg = ofp.message.flow_delete()
         flow_mod_msg.buffer_id   = 0xffffffff
         # TBD - "out_port" filtering of deletes needs to be tested
         flow_mod_msg.out_port    = ofp.OFPP_NONE
diff --git a/tests/flow_stats.py b/tests/flow_stats.py
index a1cadd5..906ad4e 100644
--- a/tests/flow_stats.py
+++ b/tests/flow_stats.py
@@ -133,7 +133,7 @@
         logging.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
         match.in_port = ingress_port
-        flow_mod_msg = ofp.message.flow_mod()
+        flow_mod_msg = ofp.message.flow_add()
         flow_mod_msg.match = copy.deepcopy(match)
         flow_mod_msg.cookie = random.randint(0,9007199254740992)
         flow_mod_msg.buffer_id = 0xffffffff
@@ -185,7 +185,7 @@
                         "Could not generate flow match from pkt")
         match.in_port = ingress_port
         
-        flow_mod_msg = ofp.message.flow_mod()
+        flow_mod_msg = ofp.message.flow_add()
         flow_mod_msg.match = match
         flow_mod_msg.cookie = random.randint(0,9007199254740992)
         flow_mod_msg.buffer_id = 0xffffffff
@@ -310,7 +310,7 @@
                         "Could not generate flow match from pkt")
         match.in_port = ingress_port
         
-        flow_mod_msg = ofp.message.flow_mod()
+        flow_mod_msg = ofp.message.flow_add()
         flow_mod_msg.match = match
         flow_mod_msg.cookie = random.randint(0,9007199254740992)
         flow_mod_msg.buffer_id = 0xffffffff
@@ -482,7 +482,7 @@
         logging.info("Ingress " + str(ingress_port) +
                        " to egress " + str(egress_port))
         match.in_port = ingress_port
-        flow_mod_msg = ofp.message.flow_mod()
+        flow_mod_msg = ofp.message.flow_add()
         flow_mod_msg.match = copy.deepcopy(match)
         flow_mod_msg.cookie = random.randint(0,9007199254740992)
         flow_mod_msg.buffer_id = 0xffffffff
diff --git a/tests/load.py b/tests/load.py
index 2f0c05f..58471e4 100644
--- a/tests/load.py
+++ b/tests/load.py
@@ -61,7 +61,7 @@
         act = ofp.action.output()
         act.port = lb_port + 1
 
-        request = ofp.message.flow_mod()
+        request = ofp.message.flow_add()
         request.match = match
         request.hard_timeout = 2 * barrier_count
 
@@ -215,8 +215,7 @@
             match.eth_dst = [0, 1, 2, 3, i / 256, i % 256]
             act = ofp.action.output()
             act.port = ofp.OFPP_CONTROLLER
-            request = ofp.message.flow_mod()
-            request.command = ofp.OFPFC_ADD
+            request = ofp.message.flow_add()
             request.buffer_id = 0xffffffff
             request.priority = num_flows - i
             request.out_port = ofp.OFPP_NONE
diff --git a/tests/message_types.py b/tests/message_types.py
index 8e97b64..cac246a 100644
--- a/tests/message_types.py
+++ b/tests/message_types.py
@@ -358,7 +358,7 @@
         for bytes in max_len :
 
             #Insert a flow entry with action --output to controller
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             request.buffer_id = 0xffffffff
             act = ofp.action.output()
@@ -457,7 +457,7 @@
         match.in_port = of_ports[0]
 
         #Insert a flow entry with action output to controller 
-        request = ofp.message.flow_mod()
+        request = ofp.message.flow_add()
         request.match = match
         act = ofp.action.output()
         act.port = ofp.OFPP_CONTROLLER
diff --git a/tests/pktact.py b/tests/pktact.py
index ad98812..09f4d4b 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -116,7 +116,7 @@
 
             match.in_port = ingress_port
 
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
 
             request.buffer_id = 0xffffffff
@@ -180,7 +180,7 @@
         ingress_port = of_ports[0]
         match.in_port = ingress_port
 
-        request = ofp.message.flow_mod()
+        request = ofp.message.flow_add()
         request.match = match
 
         request.buffer_id = 0xffffffff
@@ -267,7 +267,7 @@
 
                 match.in_port = ingress_port
                 
-                request = ofp.message.flow_mod()
+                request = ofp.message.flow_add()
                 request.match = match
 
                 request.buffer_id = 0xffffffff
@@ -396,7 +396,7 @@
 
                 match.in_port = ingress_port
                 
-                request = ofp.message.flow_mod()
+                request = ofp.message.flow_add()
                 request.match = match
 
                 request.buffer_id = 0xffffffff
@@ -514,7 +514,7 @@
 
             match.in_port = ingress_port
 
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             request.buffer_id = 0xffffffff
             request.actions.append(ofp.action.output(port=egress_port1))
@@ -564,7 +564,7 @@
                            " all non-ingress ports")
             match.in_port = ingress_port
 
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             request.buffer_id = 0xffffffff
             for egress_port in of_ports:
@@ -613,7 +613,7 @@
             logging.info("Ingress " + str(ingress_port) + " to all ports")
             match.in_port = ingress_port
 
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             request.buffer_id = 0xffffffff
             for egress_port in of_ports:
@@ -670,7 +670,7 @@
             logging.info("Ingress " + str(ingress_port) + " to all ports")
             match.in_port = ingress_port
 
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             request.buffer_id = 0xffffffff
             act.port = ofp.OFPP_FLOOD
@@ -715,7 +715,7 @@
             logging.info("Ingress " + str(ingress_port) + " to all ports")
             match.in_port = ingress_port
 
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             request.buffer_id = 0xffffffff
             request.actions.append(ofp.action.output(port=ofp.OFPP_FLOOD))
@@ -758,7 +758,7 @@
             logging.info("Ingress " + str(ingress_port) + " to all ports")
             match.in_port = ingress_port
 
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             request.buffer_id = 0xffffffff
             act.port = ofp.OFPP_ALL
@@ -803,7 +803,7 @@
             logging.info("Ingress " + str(ingress_port) + " to all ports")
             match.in_port = ingress_port
 
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             request.buffer_id = 0xffffffff
             request.actions.append(ofp.action.output(port=ofp.OFPP_ALL))
@@ -860,7 +860,7 @@
 
             match.in_port = ingress_port
 
-            request = ofp.message.flow_mod()
+            request = ofp.message.flow_add()
             request.match = match
             request.buffer_id = 0xffffffff
             act.port = ofp.OFPP_FLOOD
@@ -1022,10 +1022,10 @@
         
     def removeFlow(self, prio):
         if self.flowMsgs.has_key(prio):
-            msg = self.flowMsgs[prio]
-            msg.command = ofp.OFPFC_DELETE_STRICT
-            # This *must* be set for DELETE
-            msg.out_port = ofp.OFPP_NONE
+            old_msg = self.flowMsgs[prio]
+            msg = ofp.message.flow_delete_strict(out_port=ofp.OFPP_NONE,
+                                                 match=old_msg.match,
+                                                 priority=old_msg.priority)
             logging.debug("Remove flow with priority " + str(prio))
             self.controller.message_send(msg)
             do_barrier(self.controller)
@@ -1758,13 +1758,12 @@
         for toggle in range(2):
             for f_idx in range(flow_count):
                 pkt = simple_tcp_packet(tcp_sport=f_idx)
-                msg = ofp.message.flow_mod()
+                msg = ofp.message.flow_add()
                 match = packet_to_flow_match(self, pkt)
                 match.in_port = of_ports[2]
                 match.wildcards = wildcards
                 msg.match = match
                 msg.buffer_id = 0xffffffff
-                msg.command = ofp.OFPFC_ADD
                 msg.actions.append(acts[toggle])
                 flows[toggle].append(msg)
 
@@ -1930,7 +1929,7 @@
                     else:
                         new = ~orig & mask
                     setattr(match, field, new)
-                request = ofp.message.flow_mod()
+                request = ofp.message.flow_add()
                 request.match = match
                 request.buffer_id = 0xffffffff
                 request.priority = priority
@@ -2060,7 +2059,7 @@
 
         match.in_port = ingress_port
 
-        request = ofp.message.flow_mod()
+        request = ofp.message.flow_add()
         request.match = match
         request.priority = 1
 
@@ -2074,7 +2073,7 @@
 
         # This flow speeds up negative tests
         logging.info("Inserting catch-all flow")
-        request2 = ofp.message.flow_mod()
+        request2 = ofp.message.flow_add()
         request2.match = self.createMatch()
         request2.match.wildcards &= ~ofp.OFPFW_IN_PORT
         request2.match.in_port = ingress_port
diff --git a/tests/port_stats.py b/tests/port_stats.py
index 1df27f6..7fac164 100644
--- a/tests/port_stats.py
+++ b/tests/port_stats.py
@@ -163,7 +163,7 @@
         logging.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
         match.in_port = ingress_port
-        flow_mod_msg = ofp.message.flow_mod()
+        flow_mod_msg = ofp.message.flow_add()
         flow_mod_msg.match = match
         flow_mod_msg.cookie = random.randint(0,9007199254740992)
         flow_mod_msg.buffer_id = 0xffffffff
@@ -208,7 +208,7 @@
                         "Could not generate flow match from pkt")
         match.in_port = ingress_port
         
-        flow_mod_msg = ofp.message.flow_mod()
+        flow_mod_msg = ofp.message.flow_add()
         flow_mod_msg.match = match
         flow_mod_msg.cookie = random.randint(0,9007199254740992)
         flow_mod_msg.buffer_id = 0xffffffff
@@ -285,7 +285,7 @@
                         "Could not generate flow match from pkt")
         match.in_port = ingress_port
         
-        flow_mod_msg = ofp.message.flow_mod()
+        flow_mod_msg = ofp.message.flow_add()
         flow_mod_msg.match = match
         flow_mod_msg.cookie = random.randint(0,9007199254740992)
         flow_mod_msg.buffer_id = 0xffffffff
diff --git a/tools/munger/scripts/message_gen.py b/tools/munger/scripts/message_gen.py
index 5b6e27b..3e39bdf 100644
--- a/tools/munger/scripts/message_gen.py
+++ b/tools/munger/scripts/message_gen.py
@@ -806,6 +806,36 @@
     )
 """
 
+    print """
+_flow_mod = flow_mod
+flow_mod = None
+
+class flow_add(_flow_mod):
+    def __init__(self, **kwargs):
+        _flow_mod.__init__(self, **kwargs)
+        self.command = OFPFC_ADD
+
+class flow_modify(_flow_mod):
+    def __init__(self, **kwargs):
+        _flow_mod.__init__(self, **kwargs)
+        self.command = OFPFC_MODIFY
+
+class flow_modify_strict(_flow_mod):
+    def __init__(self, **kwargs):
+        _flow_mod.__init__(self, **kwargs)
+        self.command = OFPFC_MODIFY_STRICT
+
+class flow_delete(_flow_mod):
+    def __init__(self, **kwargs):
+        _flow_mod.__init__(self, **kwargs)
+        self.command = OFPFC_DELETE
+
+class flow_delete_strict(_flow_mod):
+    def __init__(self, **kwargs):
+        _flow_mod.__init__(self, **kwargs)
+        self.command = OFPFC_DELETE_STRICT
+"""
+
 #
 # OFP match variants
 #  ICMP 0x801 (?) ==> icmp_type/code replace tp_src/dst