Added FloodPlusIngress
Added test case to flood packet and to send out ingress port
diff --git a/tests/pktact.py b/tests/pktact.py
index 26b920a..376e02d 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -384,5 +384,68 @@
self.assertEqual(str(pkt), str(rcv_pkt),
'Response packet does not match send packet ' +
"on port " + str(ofport))
-
-
+
+
+class FloodPlusIngress(basic.SimpleDataPlane):
+ """
+ Flood to all ports plus send to ingress port
+
+ Generate a packet
+ Generate and install a matching flow
+ Add action to flood the packet
+ Add action to send to ingress port
+ Send the packet to ingress dataplane port
+ Verify the packet is received at all other ports
+ """
+ def runTest(self):
+ 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)
+ 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)):
+ rc = delete_all_flows(self.controller, pa_logger)
+ self.assertEqual(rc, 0, "Failed to delete all flows")
+
+ 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
+ act.port = ofp.OFPP_FLOOD
+ self.assertTrue(request.actions.add(act),
+ "Could not flood port action")
+ act.port = ofp.OFPP_IN_PORT
+ self.assertTrue(request.actions.add(act),
+ "Could not add ingress port for output")
+ 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))