diff --git a/tests/pktact.py b/tests/pktact.py
index 5048510..f1e67cb 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -306,7 +306,142 @@
                                  )
                     
 
+class DirectPacketControllerQueue(basic.SimpleDataPlane):
+    """
+    Send a packet from each of the openflow ports
+    to each of the queues configured on the controller port.
+    If no queues have been configured, no packets are sent.
 
+    Generate a packet
+    Generate and install a matching flow
+    Add action to direct the packet to one of the controller port queues
+    Send the packet to ingress dataplane port
+    Verify the packet is received on the controller port queue
+    """
+    def runTest(self):
+        self.handleFlow()
+
+    def portQueuesGet(self, queue_stats, port_num):
+        result = []
+        for qs in queue_stats.stats:
+            if qs.port_no != port_num:
+                continue
+            result.append(qs.queue_id)
+        return result
+
+    def handleFlow(self, pkttype='TCP'):
+        of_ports = pa_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        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, 
+                        "Could not generate flow match from pkt")
+
+        # Get queue stats from switch
+        
+        request = message.queue_stats_request()
+        request.port_no  = ofp.OFPP_CONTROLLER
+        request.queue_id = ofp.OFPQ_ALL
+        (queue_stats, p) = self.controller.transact(request, timeout=2)
+        self.assertNotEqual(queue_stats, None, "Queue stats request failed")
+
+        act = action.action_enqueue()
+
+        for idx in range(len(of_ports)):
+            ingress_port = of_ports[idx]
+            egress_port = ofp.OFPP_CONTROLLER
+
+            pa_logger.info("Ingress port " + str(ingress_port)
+                           + ", controller port queues " 
+                           + str(self.portQueuesGet(queue_stats, egress_port)))
+
+            for egress_queue_id in self.portQueuesGet(queue_stats, egress_port):
+                pa_logger.info("Ingress " + str(ingress_port)
+                               + " to egress " + str(egress_port)
+                               + " queue " + str(egress_queue_id)
+                               )
+
+                rv = delete_all_flows(self.controller, pa_logger)
+                self.assertEqual(rv, 0, "Failed to delete all flows")
+
+                match.in_port = ingress_port
+                
+                request = message.flow_mod()
+                request.match = match
+
+                request.buffer_id = 0xffffffff
+                act.port     = egress_port
+                act.queue_id = egress_queue_id
+                self.assertTrue(request.actions.add(act), "Could not add action")
+
+                pa_logger.info("Inserting flow")
+                rv = self.controller.message_send(request)
+                self.assertTrue(rv != -1, "Error installing flow mod")
+                self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
+
+                # Get current stats for selected egress queue
+
+                request = message.queue_stats_request()
+                request.port_no  = egress_port
+                request.queue_id = egress_queue_id
+                (qs_before, p) = self.controller.transact(request, timeout=2)
+                self.assertNotEqual(qs_before, None, "Queue stats request failed")
+
+                pa_logger.info("Sending packet to dp port " + 
+                               str(ingress_port))
+                self.dataplane.send(ingress_port, str(pkt))
+                
+                exp_pkt_arg = None
+                exp_port = None
+
+                while True:
+                    (response, raw) = self.controller.poll(ofp.OFPT_PACKET_IN, 2)
+                    if not response:  # Timeout
+                        break
+                    if dataplane.match_exp_pkt(pkt, response.data): # Got match
+                        break
+                    if not basic_config["relax"]:  # Only one attempt to match
+                        break
+                    count += 1
+                    if count > 10:   # Too many tries
+                        break
+
+                self.assertTrue(response is not None, 
+                               'Packet in message not received by controller')
+                if not dataplane.match_exp_pkt(pkt, response.data):
+                    basic_logger.debug("Sent %s" % format_packet(pkt))
+                    basic_logger.debug("Resp %s" % format_packet(response.data))
+                    self.assertTrue(False,
+                                    'Response packet does not match send packet' +
+                                    ' for controller port')
+
+                # FIXME: instead of sleeping, keep requesting queue stats until
+                # the expected queue counter increases or some large timeout is
+                # reached
+                time.sleep(2)
+
+                # Get current stats for selected egress queue again
+
+                request = message.queue_stats_request()
+                request.port_no  = egress_port
+                request.queue_id = egress_queue_id
+                (qs_after, p) = self.controller.transact(request, timeout=2)
+                self.assertNotEqual(qs_after, None, "Queue stats request failed")
+
+                # Make sure that tx packet counter for selected egress queue was
+                # incremented
+
+                self.assertEqual(qs_after.stats[0].tx_packets, \
+                                 qs_before.stats[0].tx_packets + 1, \
+                                 "Verification of egress queue tx packet count failed"
+                                 )
+                    
 
 class DirectPacketICMP(DirectPacket):
     """
