diff --git a/doc/Doxyfile b/doc/Doxyfile
index 85cfc63..322d859 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -621,7 +621,7 @@
 # to standard output.  If FILTER_PATTERNS is specified, this tag will be 
 # ignored.
 
-INPUT_FILTER           = "python /usr/bin/doxypy.py"
+INPUT_FILTER           = "python /usr/local/bin/doxypy.py"
 
 # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
 # basis.  Doxygen will compare the file name with each pattern and apply the 
diff --git a/src/python/oftest/parse.py b/src/python/oftest/parse.py
index 13dac43..ed05aa1 100644
--- a/src/python/oftest/parse.py
+++ b/src/python/oftest/parse.py
@@ -240,8 +240,13 @@
     except:
         udp = None
 
-    # @todo arp and icmp are not yet supported
-    icmp = arp = None
+    try:
+        icmp = ether[scapy.ICMP]
+    except:
+        icmp = None
+
+    # @todo arp is not yet supported
+    arp = None
     return (dot1q, ip, tcp, udp, icmp, arp)
 
 def packet_to_flow_match(packet, pkt_format="L2"):
@@ -289,9 +294,12 @@
 
     if dot1q:
         match.dl_vlan = dot1q.vlan
-        match.wildcards &= ~OFPFW_DL_VLAN
         match.dl_vlan_pcp = dot1q.prio
-        match.wildcards &= ~OFPFW_DL_VLAN_PCP
+    else:
+        match.dl_vlan = OFP_VLAN_NONE
+        match.dl_vlan_pcp = 0
+    match.wildcards &= ~OFPFW_DL_VLAN
+    match.wildcards &= ~OFPFW_DL_VLAN_PCP
 
     if ip:
         match.nw_src = parse_ip(ip.src)
@@ -315,6 +323,11 @@
         match.tp_dst = tcp.dport
         match.wildcards &= ~OFPFW_TP_DST
 
-    #@todo Implement ICMP and ARP fields
+    if icmp:
+        match.nw_proto = 1
+        match.tp_src = icmp.type
+        match.tp_dst = icmp.code
+
+    #@todo Implement ARP fields
 
     return match
diff --git a/tests/pktact.py b/tests/pktact.py
index 535eea1..8d886b9 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -66,12 +66,19 @@
     Verify the packet is received at the egress port only
     """
     def runTest(self):
+        self.handleFlow()
+
+    def handleFlow(self, pkttype='TCP'):
+
         global pa_port_map
         of_ports = pa_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
-        pkt = simple_tcp_packet()
+        if (pkttype == 'ICMP'):
+            pkt = simple_icmp_packet()
+        else:
+            pkt = simple_tcp_packet()
         match = parse.packet_to_flow_match(pkt)
         match.wildcards &= ~ofp.OFPFW_IN_PORT
         self.assertTrue(match is not None, 
@@ -110,8 +117,20 @@
             self.assertEqual(rcv_port, egress_port, "Unexpected receive port")
             self.assertEqual(str(pkt), str(rcv_pkt),
                              'Response packet does not match send packet')
-            
-        
+
+class DirectPacketICMP(DirectPacket):
+    """
+    Send ICMP packet to single egress port
+
+    Generate a ICMP packet
+    Generate and install a matching flow
+    Add action to direct the packet to an egress port
+    Send the packet to ingress dataplane port
+    Verify the packet is received at the egress port only
+    Difference from DirectPacket test is that sent packet is ICMP
+    """
+    def runTest(self):
+        self.handleFlow(pkttype='ICMP')
 
 class DirectTwoPorts(basic.SimpleDataPlane):
     """
@@ -331,7 +350,6 @@
             receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
                               self, pa_logger)
 
-
 class FloodPlusIngress(basic.SimpleDataPlane):
     """
     Flood to all ports plus send to ingress port
@@ -485,7 +503,6 @@
             receive_pkt_check(self.dataplane, pkt, of_ports, [], self,
                               pa_logger)
             
-
 class FloodMinusPort(basic.SimpleDataPlane):
     """
     Config port with No_Flood and test Flood action
@@ -553,5 +570,416 @@
 
             #@todo Should check no other packets received
 
+class SimpleExactMatch(basic.SimpleDataPlane):
+    """
+    Exercise exact matching for all ports
+
+    Generate a packet
+    Generate and install a matching flow without wildcard mask
+    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 when command option is set
+    """
+    IP_ETHTYPE = 0x800
+    TCP_PROTOCOL = 0x6
+    UDP_PROTOCOL = 0x11
+
+    def runTest(self):
+        self.flowMatchTest()
+
+    def flowMatchTest(self, wildcards=0, check_expire=False):
+        global pa_port_map
+        of_ports = pa_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        pkt = simple_tcp_packet()
+        match = parse.packet_to_flow_match(pkt)
+        self.assertTrue(match is not None,
+                        "Could not generate flow match from pkt")
+        match.dl_vlan = ofp.OFP_VLAN_NONE
+        match.nw_proto = self.TCP_PROTOCOL
+        match.wildcards = wildcards
+
+        for idx in range(len(of_ports)):
+            ingress_port = of_ports[idx]
+            pa_logger.info("Ingress " + str(ingress_port) + " to all the other ports")
+            match.in_port = ingress_port
+
+            for egr_idx in range(len(of_ports)):
+                if egr_idx == idx:
+                    continue
+
+                rc = delete_all_flows(self.controller, pa_logger)
+                self.assertEqual(rc, 0, "Failed to delete all flows")
+                do_barrier(self.controller)
+
+                request = message.flow_mod()
+                request.match = match
+                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
+
+                act = action.action_output()
+                act.port = of_ports[egr_idx]
+                self.assertTrue(request.actions.add(act),
+                                "Could not add output action")
+                pa_logger.info(request.show())
+
+                pa_logger.info("Inserting flow")
+                rv = self.controller.message_send(request)
+                self.assertTrue(rv != -1, "Error installing flow mod")
+                do_barrier(self.controller)
+
+                pa_logger.info("Sending packet to dp port " +str(ingress_port))
+                self.dataplane.send(ingress_port, str(pkt))
+
+                ofport = of_ports[egr_idx]
+                self.verifPkt(ofport, pkt)
+
+                #@todo Need UI for enabling response-verification
+                if(check_expire):
+                    self.verifFlowRemoved(request)
+
+    def verifPkt(self, ofport, exp_pkt):
+        (rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(
+                    port_number=ofport, timeout=1)
+        self.assertTrue(rcv_pkt is not None,
+                    "Did not receive packet port " + str(ofport))
+        pa_logger.debug("Packet len " + str(len(rcv_pkt)) + " in on "
+                    + str(rcv_port))
+
+        self.assertEqual(str(exp_pkt), str(rcv_pkt),
+            'Response packet does not match send packet ' +
+            "on port " + str(ofport))
+
+    def verifFlowRemoved(self, request):
+        (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
+        if(req_match != res_match):
+            self.verifMatchField(req_match, res_match)
+
+        self.assertEqual(request.cookie, response.cookie,
+            self.matchErrStr('cookie'))
+        if (req_match.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),
+            self.matchErrStr('wildcards'))
+        self.assertEqual(str(req_match.in_port), str(res_match.in_port),
+            self.matchErrStr('in_port'))
+        self.assertEqual(str(req_match.dl_src), str(res_match.dl_src),
+            self.matchErrStr('dl_src'))
+        self.assertEqual(str(req_match.dl_dst), str(res_match.dl_dst),
+            self.matchErrStr('dl_dst'))
+        self.assertEqual(str(req_match.dl_vlan), str(res_match.dl_vlan),
+            self.matchErrStr('dl_vlan'))
+        self.assertEqual(str(req_match.dl_vlan_pcp), str(res_match.dl_vlan_pcp),
+            self.matchErrStr('dl_vlan_pcp'))
+        self.assertEqual(str(req_match.dl_type), str(res_match.dl_type),
+            self.matchErrStr('dl_type'))
+        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')
+
+class SingleWildcardMatch(SimpleExactMatch):
+    """
+    Exercise wildcard matching for all ports
+
+    Generate a packet
+    Generate and install a matching flow with wildcard mask
+    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 when command option is set
+    """
+    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]
+
+    def runTest(self):
+        for exec_wildcard in range(len(self.wildcards)):
+            self.flowMatchTest(exec_wildcard)
+
+class AllExceptOneWildcardMatch(SingleWildcardMatch):
+    """
+    Create All-execpt-one-field wildcard and exercise for all ports
+
+    Generate a packet
+    Generate and install a matching flow with wildcard all except one filed
+    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 when command option is set
+    """
+    def runTest(self):
+        for exec_wildcard in range(len(self.wildcards)):
+            all_exp_one_wildcard = ofp.OFPFW_ALL ^ self.wildcards[exec_wildcard]
+            self.flowMatchTest(all_exp_one_wildcard)
+
+class AllWildcardMatch(SingleWildcardMatch):
+    """
+    Create Wildcard-all flow and exercise for all ports
+
+    Generate a packet
+    Generate and install a matching flow with wildcard-all
+    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 when command option is set
+    """
+    def runTest(self):
+        self.flowMatchTest(ofp.OFPFW_ALL)
+
+class ExactModifyAction(SimpleExactMatch):
+    """
+    Perform Modify action with exact matching for all ports
+
+    Generate a packet for transmit
+    Generate the expected packet
+    Generate and install a matching flow with a modify action and
+    an output action without wildcard mask
+    Send the packet to the port
+    Verify the expected packet is received at all other ports
+    (one port at a time)
+    Verify flow_expiration message is correct when command option is set
+    """
+    def __init__(self):
+        SimpleExactMatch.__init__(self)
+        self.modify_act = [ofp.OFPAT_SET_VLAN_VID,
+                           ofp.OFPAT_SET_VLAN_PCP,
+                           ofp.OFPAT_STRIP_VLAN,
+                           ofp.OFPAT_SET_DL_SRC,
+                           ofp.OFPAT_SET_DL_DST,
+                           ofp.OFPAT_SET_NW_SRC,
+                           ofp.OFPAT_SET_NW_DST,
+                           ofp.OFPAT_SET_NW_TOS,
+                           ofp.OFPAT_SET_TP_SRC,
+                           ofp.OFPAT_SET_TP_DST]
+
+    def runTest(self):
+        self.flowMatchModTest()
+
+    def flowMatchModTest(self, wildcards=0, check_expire=False):
+        global pa_port_map
+        of_ports = pa_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        mod_dl_dst = '43:21:0F:ED:CB:A9'
+        mod_dl_src = '7F:ED:CB:A9:87:65'
+        mod_dl_vlan = 4094
+        mod_dl_vlan_pcp = 7
+        mod_ip_src = '10.20.30.40'
+        mod_ip_dst = '50.60.70.80'
+        mod_ip_tos = 0xf0
+        mod_tcp_sport = 4321
+        mod_tcp_dport = 8765
+
+        request = message.features_request()
+        (reply, pkt) = self.controller.transact(request, timeout=2)
+        self.assertTrue(reply is not None, "Did not get response to ftr req")
+        supported_act = reply.actions
+
+        for idx in range(len(of_ports)):
+            ingress_port = of_ports[idx]
+            pa_logger.info("Ingress " + str(ingress_port) + " to all the other ports")
+
+            for egr_idx in range(len(of_ports)):
+                if egr_idx == idx:
+                    continue
+
+                for exec_mod in range(len(self.modify_act)):
+                    pkt_len = 100
+                    dl_dst = '0C:DE:F0:12:34:56'
+                    dl_src = '01:23:45:67:89:AB'
+                    dl_vlan_enable = False
+                    dl_vlan = 0
+                    dl_vlan_pcp = 0
+                    ip_src = '192.168.0.1'
+                    ip_dst = '192.168.0.2'
+                    ip_tos = 0
+                    tcp_sport = 1234
+                    tcp_dport = 80
+
+                    rc = delete_all_flows(self.controller, pa_logger)
+                    self.assertEqual(rc, 0, "Failed to delete all flows")
+                    do_barrier(self.controller)
+
+                    pkt = simple_tcp_packet(pktlen=pkt_len,
+                        dl_dst=dl_dst,
+                        dl_src=dl_src,
+                        dl_vlan_enable=dl_vlan_enable,
+                        dl_vlan=dl_vlan,
+                        dl_vlan_pcp=dl_vlan_pcp,
+                        ip_src=ip_src,
+                        ip_dst=ip_dst,
+                        ip_tos=ip_tos,
+                        tcp_sport=tcp_sport,
+                        tcp_dport=tcp_dport)
+
+                    match = parse.packet_to_flow_match(pkt)
+                    self.assertTrue(match is not None,
+                        "Could not generate flow match from pkt")
+                    match.in_port = ingress_port
+                    match.dl_vlan = ofp.OFP_VLAN_NONE
+                    match.nw_proto = self.TCP_PROTOCOL
+                    match.wildcards = wildcards
+
+                    request = message.flow_mod()
+                    request.match = match
+                    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
+
+                    exec_act = self.modify_act[exec_mod]
+                    if exec_act == ofp.OFPAT_SET_VLAN_VID:
+                        if not(supported_act & 1<<ofp.OFPAT_SET_VLAN_VID):
+                            continue
+                        pkt_len = pkt_len + 4
+                        dl_vlan_enable = True
+                        dl_vlan = mod_dl_vlan
+                        mod_act = action.action_set_vlan_vid()
+                        mod_act.vlan_vid = mod_dl_vlan
+                    elif exec_act == ofp.OFPAT_SET_VLAN_PCP:
+                        if not(supported_act & 1<<ofp.OFPAT_SET_VLAN_PCP):
+                            continue
+                        pkt_len = pkt_len + 4
+                        dl_vlan_enable = True
+                        dl_vlan_pcp = mod_dl_vlan_pcp
+                        mod_act = action.action_set_vlan_pcp()
+                        mod_act.vlan_pcp = mod_dl_vlan_pcp
+                    elif exec_act == ofp.OFPAT_STRIP_VLAN:
+                        if not(supported_act & 1<<ofp.OFPAT_STRIP_VLAN):
+                            continue
+                        dl_vlan_enable = False
+                        mod_act = action.action_strip_vlan()
+                    elif exec_act == ofp.OFPAT_SET_DL_SRC:
+                        if not(supported_act & 1<<ofp.OFPAT_SET_DL_SRC):
+                            continue
+                        dl_src = mod_dl_src
+                        mod_act = action.action_set_dl_src()
+                        mod_act.dl_addr = parse.parse_mac(mod_dl_src)
+                    elif exec_act == ofp.OFPAT_SET_DL_DST:
+                        if not(supported_act & 1<<ofp.OFPAT_SET_DL_DST):
+                            continue
+                        dl_dst = mod_dl_dst
+                        mod_act = action.action_set_dl_dst()
+                        mod_act.dl_addr = parse.parse_mac(mod_dl_dst)
+                    elif exec_act == ofp.OFPAT_SET_NW_SRC:
+                        if not(supported_act & 1<<ofp.OFPAT_SET_NW_SRC):
+                            continue
+                        ip_src = mod_ip_src
+                        mod_act = action.action_set_nw_src()
+                        mod_act.nw_addr = parse.parse_ip(mod_ip_src)
+                    elif exec_act == ofp.OFPAT_SET_NW_DST:
+                        if not(supported_act & 1<<ofp.OFPAT_SET_NW_DST):
+                            continue
+                        ip_dst = mod_ip_dst
+                        mod_act = action.action_set_nw_dst()
+                        mod_act.nw_addr = parse.parse_ip(mod_ip_dst)
+                    elif exec_act == ofp.OFPAT_SET_NW_TOS:
+                        if not(supported_act & 1<<ofp.OFPAT_SET_NW_TOS):
+                            continue
+                        ip_tos = mod_ip_tos
+                        mod_act = action.action_set_nw_tos()
+                        mod_act.nw_tos = mod_ip_tos
+                    elif exec_act == ofp.OFPAT_SET_TP_SRC:
+                        if not(supported_act & 1<<ofp.OFPAT_SET_TP_SRC):
+                            continue
+                        tcp_sport = mod_tcp_sport
+                        mod_act = action.action_set_tp_src()
+                        mod_act.tp_port = mod_tcp_sport
+                    elif exec_act == ofp.OFPAT_SET_TP_DST:
+                        if not(supported_act & 1<<ofp.OFPAT_SET_TP_DST):
+                            continue
+                        tcp_dport = mod_tcp_dport
+                        mod_act = action.action_set_tp_dst()
+                        mod_act.tp_port = mod_tcp_dport
+                    else:
+                        continue
+
+                    self.assertTrue(request.actions.add(mod_act),
+                            "Could not add output action")
+                    pa_logger.info(request.show())
+
+                    exp_pkt = simple_tcp_packet(pktlen=pkt_len,
+                        dl_dst=dl_dst,
+                        dl_src=dl_src,
+                        dl_vlan_enable=dl_vlan_enable,
+                        dl_vlan=dl_vlan,
+                        dl_vlan_pcp=dl_vlan_pcp,
+                        ip_src=ip_src,
+                        ip_dst=ip_dst,
+                        ip_tos=ip_tos,
+                        tcp_sport=tcp_sport,
+                        tcp_dport=tcp_dport)
+
+                    act = action.action_output()
+                    act.port = of_ports[egr_idx]
+                    self.assertTrue(request.actions.add(act),
+                                    "Could not add output action")
+                    pa_logger.info(request.show())
+
+                    pa_logger.info("Inserting flow")
+                    rv = self.controller.message_send(request)
+                    self.assertTrue(rv != -1, "Error installing flow mod")
+                    do_barrier(self.controller)
+
+                    pa_logger.info("Sending packet to dp port " +str(ingress_port))
+                    self.dataplane.send(ingress_port, str(pkt))
+
+                    ofport = of_ports[egr_idx]
+                    self.verifPkt(ofport, exp_pkt)
+
+                    #@todo Need UI for enabling response-verification
+                    if(check_expire):
+                        self.verifFlowRemoved(request)
+
 if __name__ == "__main__":
     print "Please run through oft script:  ./oft --test_spec=basic"
diff --git a/tests/testutils.py b/tests/testutils.py
index a66e575..ea82ecc 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -36,8 +36,12 @@
 def simple_tcp_packet(pktlen=100, 
                       dl_dst='00:01:02:03:04:05',
                       dl_src='00:06:07:08:09:0a',
+                      dl_vlan_enable=False,
+                      dl_vlan=0,
+                      dl_vlan_pcp=0,
                       ip_src='192.168.0.1',
                       ip_dst='192.168.0.2',
+                      ip_tos=0,
                       tcp_sport=1234,
                       tcp_dport=80
                       ):
@@ -48,8 +52,12 @@
     @param len Length of packet in bytes w/o CRC
     @param dl_dst Destinatino MAC
     @param dl_src Source MAC
+    @param dl_vlan_enable True if the packet is with vlan, False otherwise
+    @param dl_vlan VLAN ID
+    @param dl_vlan_pcp VLAN priority
     @param ip_src IP source
     @param ip_dst IP destination
+    @param ip_tos IP ToS
     @param tcp_dport TCP destination port
     @param ip_sport TCP source port
 
@@ -57,13 +65,66 @@
     shouldn't assume anything about this packet other than that
     it is a valid ethernet/IP/TCP frame.
     """
-    pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
-        scapy.IP(src=ip_src, dst=ip_dst)/ \
-        scapy.TCP(sport=tcp_sport, dport=tcp_dport)
+    if (dl_vlan_enable):
+        pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+            scapy.Dot1Q(prio=dl_vlan_pcp, id=0, vlan=dl_vlan)/ \
+            scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos)/ \
+            scapy.TCP(sport=tcp_sport, dport=tcp_dport)
+    else:
+        pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+            scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos)/ \
+            scapy.TCP(sport=tcp_sport, dport=tcp_dport)
+
     pkt = pkt/("D" * (pktlen - len(pkt)))
 
     return pkt
 
+def simple_icmp_packet(pktlen=60, 
+                      dl_dst='00:01:02:03:04:05',
+                      dl_src='00:06:07:08:09:0a',
+                      dl_vlan_enable=False,
+                      dl_vlan=0,
+                      dl_vlan_pcp=0,
+                      ip_src='192.168.0.1',
+                      ip_dst='192.168.0.2',
+                      ip_tos=0,
+                      icmp_type=8,
+                      icmp_code=0
+                      ):
+    """
+    Return a simple ICMP packet
+
+    Supports a few parameters:
+    @param len Length of packet in bytes w/o CRC
+    @param dl_dst Destinatino MAC
+    @param dl_src Source MAC
+    @param dl_vlan_enable True if the packet is with vlan, False otherwise
+    @param dl_vlan VLAN ID
+    @param dl_vlan_pcp VLAN priority
+    @param ip_src IP source
+    @param ip_dst IP destination
+    @param ip_tos IP ToS
+    @param icmp_type ICMP type
+    @param icmp_code ICMP code
+
+    Generates a simple ICMP ECHO REQUEST.  Users
+    shouldn't assume anything about this packet other than that
+    it is a valid ethernet/ICMP frame.
+    """
+    if (dl_vlan_enable):
+        pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+            scapy.Dot1Q(prio=dl_vlan_pcp, id=0, vlan=dl_vlan)/ \
+            scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos)/ \
+            scapy.ICMP(type=icmp_type, code=icmp_code)
+    else:
+        pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+            scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos)/ \
+            scapy.ICMP(type=icmp_type, code=icmp_code)
+
+    pkt = pkt/("0" * (pktlen - len(pkt)))
+
+    return pkt
+
 def do_barrier(ctrl):
     b = message.barrier_request()
     ctrl.transact(b)
