Added DirectMC test case
Send to all ports including ingress port
diff --git a/tests/pktact.py b/tests/pktact.py
index 93760a6..0c31a07 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -259,3 +259,72 @@
"on port " + str(ofport))
+
+class DirectMC(basic.SimpleDataPlane):
+ """
+ Multicast to all ports including ingress
+
+ Generate a packet
+ Generate and install a matching flow
+ Add action to direct the packet to all non-ingress ports
+ Send the packet to ingress dataplane port
+ Verify the packet is received at all ports
+
+ Does not use the flood action
+ """
+ def runTest(self):
+ global pa_port_map
+ of_ports = pa_port_map.keys()
+ of_ports.sort()
+ self.assertTrue(len(of_ports) > 2, "Not enough ports for test")
+
+ rc = delete_all_flows(self.controller, pa_logger)
+ self.assertEqual(rc, 0, "Failed to delete all flows")
+
+ 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")
+ act = action.action_output()
+
+ for idx in range(len(of_ports)):
+ ingress_port = of_ports[idx]
+ pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+
+ match.in_port = ingress_port
+
+ request = message.flow_mod()
+ request.match = match
+ request.buffer_id = 0xffffffff
+ for egr_idx in range(len(of_ports)):
+ egress_port = of_ports[egr_idx]
+ if egr_idx == idx:
+ act.port = ofp.OFPP_IN_PORT
+ else:
+ act.port = egress_port
+ self.assertTrue(request.actions.add(act),
+ "Could not add output to " + str(egress_port))
+ 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))
+ for egr_idx in range(len(of_ports)):
+ ofport = of_ports[egr_idx]
+ (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(pkt), str(rcv_pkt),
+ 'Response packet does not match send packet ' +
+ "on port " + str(ofport))
+
+