Rich Lane | 1568b65 | 2013-01-04 16:53:13 -0800 | [diff] [blame] | 1 | """ |
| 2 | These tests require a switch that drops packet-ins. |
| 3 | """ |
| 4 | |
| 5 | import logging |
| 6 | |
| 7 | from oftest import config |
| 8 | import oftest.controller as controller |
Rich Lane | d7b0ffa | 2013-03-08 15:53:42 -0800 | [diff] [blame] | 9 | import ofp |
Rich Lane | 1568b65 | 2013-01-04 16:53:13 -0800 | [diff] [blame] | 10 | import oftest.dataplane as dataplane |
Rich Lane | 1568b65 | 2013-01-04 16:53:13 -0800 | [diff] [blame] | 11 | import oftest.base_tests as base_tests |
| 12 | |
| 13 | from oftest.testutils import * |
| 14 | |
| 15 | @nonstandard |
| 16 | class PacketInDefaultDrop(base_tests.SimpleDataPlane): |
| 17 | """ |
| 18 | Verify that packet-ins are not received. |
| 19 | """ |
| 20 | |
| 21 | def runTest(self): |
| 22 | delete_all_flows(self.controller) |
| 23 | do_barrier(self.controller) |
| 24 | |
| 25 | for of_port in config["port_map"].keys(): |
| 26 | pkt = simple_tcp_packet() |
| 27 | self.dataplane.send(of_port, str(pkt)) |
| 28 | count = 0 |
| 29 | while True: |
| 30 | (response, raw) = self.controller.poll(ofp.OFPT_PACKET_IN) |
| 31 | if not response: # Timeout |
| 32 | break |
| 33 | if dataplane.match_exp_pkt(pkt, response.data): # Got match |
| 34 | break |
| 35 | if not config["relax"]: # Only one attempt to match |
| 36 | break |
| 37 | count += 1 |
| 38 | if count > 10: # Too many tries |
| 39 | break |
| 40 | |
| 41 | self.assertTrue(response is None, |
| 42 | 'Packet in message received on port ' + |
| 43 | str(of_port)) |