Exact/Wildcard tests: disable flow_removed msg checking by default
diff --git a/tests/pktact.py b/tests/pktact.py
index 447bdde..3b189f1 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -585,12 +585,16 @@
     Add action to forward to a port
     Send the packet to the port
     Verify the packet is received at all other ports (one port at a time)
-    Verify flow_expiration message is correct
+    Verify flow_expiration message is correct when command option is set
     """
+    IP_ETHTYPE = 0x800
+    TCP_PROTOCOL = 0x6
+    UDP_PROTOCOL = 0x11
+
     def runTest(self):
         self.flowMatchTest()
 
-    def flowMatchTest(self, wildcards=0):
+    def flowMatchTest(self, wildcards=0, check_expire=False):
         global pa_port_map
         of_ports = pa_port_map.keys()
         of_ports.sort()
@@ -600,8 +604,8 @@
         match = parse.packet_to_flow_match(pkt)
         self.assertTrue(match is not None,
                         "Could not generate flow match from pkt")
-        match.dl_vlan = 0xffff
-        match.nw_proto = 6
+        match.dl_vlan = ofp.OFP_VLAN_NONE
+        match.nw_proto = self.TCP_PROTOCOL
         match.wildcards = wildcards
 
         act = action.action_output()
@@ -617,9 +621,11 @@
 
             request = message.flow_mod()
             request.match = match
-            request.flags |= ofp.OFPFF_SEND_FLOW_REM
-            request.hard_timeout = 1
             request.buffer_id = 0xffffffff
+            #@todo Need UI to setup FLAGS parameter for flow_mod
+            if(check_expire):
+                request.flags |= ofp.OFPFF_SEND_FLOW_REM
+                request.hard_timeout = 1
 
             for egr_idx in range(len(of_ports)):
                 if egr_idx == idx:
@@ -649,28 +655,29 @@
                     'Response packet does not match send packet ' +
                     "on port " + str(ofport))
 
-                #@todo Check for unexpected messages?
-                (response, raw) = self.controller.poll(ofp.OFPT_FLOW_REMOVED, 2)
+                #@todo Need UI for enabling response-verification
+                if(check_expire):
+                    (response, raw) \
+                        = self.controller.poll(ofp.OFPT_FLOW_REMOVED, 2)
+                    self.assertTrue(response is not None,
+                                    'Flow removed message not received')
 
-                req_match = request.match
-                res_match = response.match
+                    req_match = request.match
+                    res_match = response.match
+                    if(req_match != res_match):
+                        self.verifMatchField(req_match, res_match)
 
-                self.assertTrue(response is not None,
-                                'Flow removed message not received')
-
-                self.verifMatchField(req_match, res_match)
-
-                self.assertEqual(request.cookie, response.cookie,
-                    self.matchErrStr('cookie'))
-                if (wildcards != 0):
-                    self.assertEqual(request.priority, response.priority,
-                        self.matchErrStr('priority'))
-                self.assertEqual(response.reason, ofp.OFPRR_HARD_TIMEOUT,
-                    'Reason is not HARD TIMEOUT')
-                self.assertEqual(response.packet_count, 1,
-                    'Packet count is not correct')
-                self.assertEqual(response.byte_count, len(pkt),
-                    'Packet length is not correct')
+                    self.assertEqual(request.cookie, response.cookie,
+                        self.matchErrStr('cookie'))
+                    if (wildcards != 0):
+                        self.assertEqual(request.priority, response.priority,
+                            self.matchErrStr('priority'))
+                    self.assertEqual(response.reason, ofp.OFPRR_HARD_TIMEOUT,
+                        'Reason is not HARD TIMEOUT')
+                    self.assertEqual(response.packet_count, 1,
+                        'Packet count is not correct')
+                    self.assertEqual(response.byte_count, len(pkt),
+                        'Packet length is not correct')
 
     def verifMatchField(self, req_match, res_match):
         self.assertEqual(str(req_match.wildcards), str(res_match.wildcards),
@@ -687,18 +694,23 @@
             self.matchErrStr('dl_vlan_pcp'))
         self.assertEqual(str(req_match.dl_type), str(res_match.dl_type),
             self.matchErrStr('dl_type'))
-        self.assertEqual(str(req_match.nw_tos), str(res_match.nw_tos),
-            self.matchErrStr('nw_tos'))
-        self.assertEqual(str(req_match.nw_proto), str(res_match.nw_proto),
-            self.matchErrStr('nw_proto'))
-        self.assertEqual(str(req_match.nw_src), str(res_match.nw_src),
-            self.matchErrStr('nw_src'))
-        self.assertEqual(str(req_match.nw_dst), str(res_match.nw_dst),
-            self.matchErrStr('nw_dst'))
-        self.assertEqual(str(req_match.tp_src), str(res_match.tp_src),
-            self.matchErrStr('tp_src'))
-        self.assertEqual(str(req_match.tp_dst), str(res_match.tp_dst),
-            self.matchErrStr('tp_dst'))
+        if(not(req_match.wildcards & ofp.OFPFW_DL_TYPE)
+           and (req_match.dl_type == self.IP_ETHERTYPE)):
+            self.assertEqual(str(req_match.nw_tos), str(res_match.nw_tos),
+                self.matchErrStr('nw_tos'))
+            self.assertEqual(str(req_match.nw_proto), str(res_match.nw_proto),
+                self.matchErrStr('nw_proto'))
+            self.assertEqual(str(req_match.nw_src), str(res_match.nw_src),
+                self.matchErrStr('nw_src'))
+            self.assertEqual(str(req_match.nw_dst), str(res_match.nw_dst),
+                self.matchErrStr('nw_dst'))
+            if(not(req_match.wildcards & ofp.OFPFW_NW_PROTO)
+               and ((req_match.nw_proto == self.TCP_PROTOCOL)
+                    or (req_match.nw_proto == self.UDP_PROTOCOL))):
+                self.assertEqual(str(req_match.tp_src), str(res_match.tp_src),
+                    self.matchErrStr('tp_src'))
+                self.assertEqual(str(req_match.tp_dst), str(res_match.tp_dst),
+                    self.matchErrStr('tp_dst'))
 
     def matchErrStr(self, field):
         return ('Response Match_' + field + ' does not match send message')
@@ -712,21 +724,23 @@
     Add action to forward to a port
     Send the packet to the port
     Verify the packet is received at all other ports (one port at a time)
-    Verify flow_expiration message is correct
+    Verify flow_expiration message is correct when command option is set
     """
-    def runTest(self):
-        wildcards = [ofp.OFPFW_IN_PORT,
-                     ofp.OFPFW_DL_VLAN,
-                     ofp.OFPFW_DL_SRC,
-                     ofp.OFPFW_DL_DST,
-                     ofp.OFPFW_DL_TYPE,
-                     ofp.OFPFW_NW_PROTO,
-                     ofp.OFPFW_TP_SRC,
-                     ofp.OFPFW_TP_DST,
-                     ofp.OFPFW_NW_SRC_ALL,
-                     ofp.OFPFW_NW_DST_ALL,
-                     ofp.OFPFW_DL_VLAN_PCP,
-                     ofp.OFPFW_NW_TOS]
+    def __init__(self):
+        SimpleExactMatch.__init__(self)
+        self.wildcards = [ofp.OFPFW_IN_PORT,
+                          ofp.OFPFW_DL_VLAN,
+                          ofp.OFPFW_DL_SRC,
+                          ofp.OFPFW_DL_DST,
+                          ofp.OFPFW_DL_TYPE,
+                          ofp.OFPFW_NW_PROTO,
+                          ofp.OFPFW_TP_SRC,
+                          ofp.OFPFW_TP_DST,
+                          0x3F << ofp.OFPFW_NW_SRC_SHIFT,
+                          0x3F << ofp.OFPFW_NW_DST_SHIFT,
+                          ofp.OFPFW_DL_VLAN_PCP,
+                          ofp.OFPFW_NW_TOS]
 
-        for exec_wildcard in range(len(wildcards)):
+    def runTest(self):
+        for exec_wildcard in range(len(self.wildcards)):
             self.flowMatchTest(exec_wildcard)