blob: 7103f2adfe688e200a7794b5b2ef9a25e8b555b7 [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
9import oftest.cstruct as ofp
10import oftest.message as message
11import oftest.dataplane as dataplane
12import oftest.action as action
13import oftest.base_tests as base_tests
14
15from oftest.testutils import *
16
17@nonstandard
18class PacketInDefaultDrop(base_tests.SimpleDataPlane):
19 """
20 Verify that packet-ins are not received.
21 """
22
23 def runTest(self):
24 delete_all_flows(self.controller)
25 do_barrier(self.controller)
26
27 for of_port in config["port_map"].keys():
28 pkt = simple_tcp_packet()
29 self.dataplane.send(of_port, str(pkt))
30 count = 0
31 while True:
32 (response, raw) = self.controller.poll(ofp.OFPT_PACKET_IN)
33 if not response: # Timeout
34 break
35 if dataplane.match_exp_pkt(pkt, response.data): # Got match
36 break
37 if not config["relax"]: # Only one attempt to match
38 break
39 count += 1
40 if count > 10: # Too many tries
41 break
42
43 self.assertTrue(response is None,
44 'Packet in message received on port ' +
45 str(of_port))