blob: 574593f8f8f94e2089576edd7179bc7efc005bda [file] [log] [blame]
Rich Lane1568b652013-01-04 16:53:13 -08001"""
2These tests require a switch that drops packet-ins.
3"""
4
5import logging
6
7from oftest import config
8import oftest.controller as controller
Rich Laned7b0ffa2013-03-08 15:53:42 -08009import ofp
Rich Lane1568b652013-01-04 16:53:13 -080010import oftest.dataplane as dataplane
Rich Lane1568b652013-01-04 16:53:13 -080011import oftest.base_tests as base_tests
12
13from oftest.testutils import *
14
15@nonstandard
16class 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))