blob: 4ca6a6b89e97d04426aa9caba832d97f161eeca8 [file] [log] [blame]
ShreyaPandita9306c772012-09-28 12:21:40 -04001"""These tests fall under Conformance Test-Suite (OF-SWITCH-1.0.0 TestCases).
2 Refer Documentation -- Detailed testing methodology
3 <Some of test-cases are directly taken from oftest> """
4
5"Test Suite 3 --> Detailed Controller to switch messages"
6
7import logging
8
9import unittest
10import random
11
Rich Lane477f4812012-10-04 22:49:00 -070012from oftest import config
ShreyaPandita9306c772012-09-28 12:21:40 -040013import oftest.controller as controller
14import oftest.cstruct as ofp
15import oftest.message as message
16import oftest.dataplane as dataplane
17import oftest.action as action
18import oftest.parse as parse
Rich Laneb90a1c42012-10-05 09:16:05 -070019import oftest.base_tests as base_tests
ShreyaPandita9306c772012-09-28 12:21:40 -040020
Rich Laneda3b5ad2012-10-03 09:05:32 -070021from oftest.testutils import *
ShreyaPandita9306c772012-09-28 12:21:40 -040022from time import sleep
23from FuncUtils import *
24
Rich Laneb90a1c42012-10-05 09:16:05 -070025class OverlapChecking(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -040026
27 """Verify that if overlap check flag is set in the flow entry and an overlapping flow is inserted then an error
28 is generated and switch refuses flow entry"""
29
30 def runTest(self):
31
Rich Lane9a003812012-10-04 17:17:59 -070032 logging.info("Running Overlap_Checking test")
ShreyaPandita9306c772012-09-28 12:21:40 -040033
Rich Lane477f4812012-10-04 22:49:00 -070034 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -040035 of_ports.sort()
36 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
37
38 #Clear Switch State
Rich Lane32bf9482013-01-03 17:26:30 -080039 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -040040
Rich Lane9a003812012-10-04 17:17:59 -070041 logging.info("Inserting two overlapping flows")
42 logging.info("Expecting switch to return an error")
ShreyaPandita9306c772012-09-28 12:21:40 -040043
44 #Insert a flow F with wildcarded all fields
ShreyaPandita8dab4662012-11-02 13:40:14 -040045 (pkt,match) = wildcard_all(self,of_ports)
ShreyaPandita9306c772012-09-28 12:21:40 -040046
47 #Verify flow is active
ShreyaPandita8dab4662012-11-02 13:40:14 -040048 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -040049
50 # Build a overlapping flow F'-- Wildcard All except ingress with check overlap bit set
ShreyaPandita8dab4662012-11-02 13:40:14 -040051 pkt_matchingress = simple_tcp_packet()
52 match3 = parse.packet_to_flow_match(pkt_matchingress)
ShreyaPandita9306c772012-09-28 12:21:40 -040053 self.assertTrue(match3 is not None, "Could not generate flow match from pkt")
54 match3.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT
55 match3.in_port = of_ports[0]
56
57 msg3 = message.flow_mod()
58 msg3.command = ofp.OFPFC_ADD
59 msg3.match = match3
60 msg3.flags |= ofp.OFPFF_CHECK_OVERLAP
61 msg3.cookie = random.randint(0,9007199254740992)
62 msg3.buffer_id = 0xffffffff
63
64 act3 = action.action_output()
65 act3.port = of_ports[1]
Rich Lanee30455b2013-01-03 16:24:44 -080066 msg3.actions.add(act3)
Rich Lane5c3151c2013-01-03 17:15:41 -080067 self.controller.message_send(msg3)
Rich Lane3a261d52013-01-03 17:45:08 -080068 do_barrier(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -040069
70 # Verify Flow does not get inserted
ShreyaPandita8dab4662012-11-02 13:40:14 -040071 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -040072
73 #Verify OFPET_FLOW_MOD_FAILED/OFPFMFC_OVERLAP error is recieved on the control plane
74 (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_ERROR,
75 timeout=5)
76 self.assertTrue(response is not None,
77 'Switch did not reply with error message')
78 self.assertTrue(response.type==ofp.OFPET_FLOW_MOD_FAILED,
79 'Error message type is not flow mod failed ')
80 self.assertTrue(response.code==ofp.OFPFMFC_OVERLAP,
81 'Error Message code is not overlap')
82
83
Rich Laneb90a1c42012-10-05 09:16:05 -070084class NoOverlapChecking(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -040085
86 """Verify that without overlap check flag set, overlapping flows can be created."""
87
88 def runTest(self):
89
Rich Lane9a003812012-10-04 17:17:59 -070090 logging.info("Running No_Overlap_Checking test")
ShreyaPandita9306c772012-09-28 12:21:40 -040091
Rich Lane477f4812012-10-04 22:49:00 -070092 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -040093 of_ports.sort()
94 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
95
96 #Clear Switch State
Rich Lane32bf9482013-01-03 17:26:30 -080097 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -040098
Rich Lane9a003812012-10-04 17:17:59 -070099 logging.info("Inserting two overlapping flows")
100 logging.info("Expecting switch to insert the flows without generating errors")
ShreyaPandita9306c772012-09-28 12:21:40 -0400101
102 #Build a flow F with wildcarded all fields.
ShreyaPandita8dab4662012-11-02 13:40:14 -0400103 (pkt,match) = wildcard_all(self,of_ports)
ShreyaPandita9306c772012-09-28 12:21:40 -0400104
105 #Verify flow is active
ShreyaPandita8dab4662012-11-02 13:40:14 -0400106 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400107
108 # Build a overlapping flow F' without check overlap bit set.
ShreyaPandita8dab4662012-11-02 13:40:14 -0400109 wildcard_all_except_ingress(self,of_ports)
ShreyaPandita9306c772012-09-28 12:21:40 -0400110
111 # Verify Flow gets inserted
ShreyaPandita8dab4662012-11-02 13:40:14 -0400112 verify_tablestats(self,expect_active=2)
ShreyaPandita9306c772012-09-28 12:21:40 -0400113
114
Rich Laneb90a1c42012-10-05 09:16:05 -0700115class IdenticalFlows(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400116
117 """Verify that adding two identical flows overwrites the existing one and clears counters"""
118
119 def runTest(self):
120
Rich Lane9a003812012-10-04 17:17:59 -0700121 logging.info("Running Identical_Flows test ")
ShreyaPandita9306c772012-09-28 12:21:40 -0400122
Rich Lane477f4812012-10-04 22:49:00 -0700123 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400124 of_ports.sort()
125 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
126
127 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800128 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400129
Rich Lane9a003812012-10-04 17:17:59 -0700130 logging.info("Inserting two identical flows one by one")
131 logging.info("Expecting switch to overwrite the first flow and clear the counters associated with it ")
ShreyaPandita9306c772012-09-28 12:21:40 -0400132
133 # Create and add flow-1, check on dataplane it is active.
ShreyaPandita8dab4662012-11-02 13:40:14 -0400134 (pkt,match) = wildcard_all(self,of_ports)
ShreyaPandita9306c772012-09-28 12:21:40 -0400135
136 # Verify active_entries in table_stats_request =1
ShreyaPandita8dab4662012-11-02 13:40:14 -0400137 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400138
139 # Send Packet (to increment counters like byte_count and packet_count)
ShreyaPandita8dab4662012-11-02 13:40:14 -0400140 send_packet(self,pkt,of_ports[0],of_ports[1])
ShreyaPandita9306c772012-09-28 12:21:40 -0400141
142 # Verify Flow counters have incremented
Rich Laneae3428c2013-03-07 14:37:42 -0800143 verify_flow_stats(self, match, pkts=1, bytes=len(str(pkt)))
ShreyaPandita9306c772012-09-28 12:21:40 -0400144
145 #Send Identical flow
ShreyaPandita8dab4662012-11-02 13:40:14 -0400146 (pkt1,match1) = wildcard_all(self,of_ports)
ShreyaPandita9306c772012-09-28 12:21:40 -0400147
148 # Verify active_entries in table_stats_request =1
ShreyaPandita8dab4662012-11-02 13:40:14 -0400149 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400150
151 # Verify Flow counters reset
Rich Laneae3428c2013-03-07 14:37:42 -0800152 verify_flow_stats(self, match, pkts=0, bytes=0)
ShreyaPandita9306c772012-09-28 12:21:40 -0400153
154
Rich Laneb90a1c42012-10-05 09:16:05 -0700155class EmerFlowTimeout(base_tests.SimpleProtocol):
ShreyaPandita9306c772012-09-28 12:21:40 -0400156
157 """Timeout values are not allowed for emergency flows"""
158
159 def runTest(self):
160
Rich Lane9a003812012-10-04 17:17:59 -0700161 logging.info("Running Emergency_Flow_Timeout test")
ShreyaPandita9306c772012-09-28 12:21:40 -0400162
Rich Lane477f4812012-10-04 22:49:00 -0700163 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400164 of_ports.sort()
165 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
166
167 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800168 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400169
Rich Lane9a003812012-10-04 17:17:59 -0700170 logging.info("Inserting an emergency flow with timeout values")
171 logging.info("Expecting switch to generate error ")
ShreyaPandita9306c772012-09-28 12:21:40 -0400172
173 #Insert an emergency flow
174 pkt = simple_tcp_packet()
175 match = parse.packet_to_flow_match(pkt)
176 match.in_port = of_ports[0]
177
178 request = message.flow_mod()
179 request.match = match
180 request.command = ofp.OFPFC_ADD
181 request.flags = request.flags|ofp.OFPFF_EMERG
182 request.hard_timeout =9
183 request.idle_timeout =9
184
185 act = action.action_output()
186 act.port = of_ports[1]
187
188 request.actions.add(act)
Rich Lane9a003812012-10-04 17:17:59 -0700189 logging.info("Inserting flow")
Rich Lane5c3151c2013-01-03 17:15:41 -0800190 self.controller.message_send(request)
ShreyaPandita9306c772012-09-28 12:21:40 -0400191
Rich Lane3a261d52013-01-03 17:45:08 -0800192 do_barrier(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400193
194 #Verify OFPET_FLOW_MOD_FAILED/OFPFMFC_OVERLAP error is recieved on the control plane
195 (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_ERROR,
196 timeout=5)
197 self.assertTrue(response is not None,
198 'Switch did not reply with error message')
199 self.assertTrue(response.type==ofp.OFPET_FLOW_MOD_FAILED,
200 'Error message type is not flow mod failed ')
201 self.assertTrue(response.code==ofp.OFPFMFC_BAD_EMERG_TIMEOUT,
202 'Error Message code is not bad emergency timeout')
203
204
Rich Laneb90a1c42012-10-05 09:16:05 -0700205class MissingModifyAdd(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400206
207 """If a modify does not match an existing flow, the flow gets added """
208
209 def runTest(self):
210
Rich Lane9a003812012-10-04 17:17:59 -0700211 logging.info("Running Missing_Modify_Add test")
ShreyaPandita9306c772012-09-28 12:21:40 -0400212
Rich Lane477f4812012-10-04 22:49:00 -0700213 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400214 of_ports.sort()
215 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
216
Rich Lane9a003812012-10-04 17:17:59 -0700217 logging.info("Inserting a flow-modify that does not match an existing flow")
218 logging.info("Expecting flow to get added i.e OFPFC_MODIFY command should be taken as OFPFC_ADD ")
ShreyaPandita9306c772012-09-28 12:21:40 -0400219
220 #Clear Switch State
Rich Lane32bf9482013-01-03 17:26:30 -0800221 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400222
223 #Generate a flow-mod,command OFPC_MODIFY
224
225 request = message.flow_mod()
226 request.command = ofp.OFPFC_MODIFY
227 request.match.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT
228 request.match.in_port = of_ports[0]
229 request.cookie = random.randint(0,9007199254740992)
230 request.buffer_id = 0xffffffff
231 act3 = action.action_output()
232 act3.port = of_ports[1]
Rich Lanee30455b2013-01-03 16:24:44 -0800233 request.actions.add(act3)
ShreyaPandita9306c772012-09-28 12:21:40 -0400234
Rich Lane9a003812012-10-04 17:17:59 -0700235 logging.info("Inserting flow")
Rich Lane5c3151c2013-01-03 17:15:41 -0800236 self.controller.message_send(request)
Rich Lane3a261d52013-01-03 17:45:08 -0800237 do_barrier(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400238
239 #Verify the flow gets added i.e. active_count= 1
ShreyaPandita8dab4662012-11-02 13:40:14 -0400240 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400241
242
Rich Laneb90a1c42012-10-05 09:16:05 -0700243class ModifyAction(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400244
245 """A modified flow preserves counters"""
246
247 def runTest(self):
248
Rich Lane9a003812012-10-04 17:17:59 -0700249 logging.info("Running Modify_Action test ")
ShreyaPandita9306c772012-09-28 12:21:40 -0400250
Rich Lane477f4812012-10-04 22:49:00 -0700251 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400252 of_ports.sort()
253 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
254
255 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800256 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400257
Rich Lane9a003812012-10-04 17:17:59 -0700258 logging.info("Inserting a Flow and incrementing flow counters. Modifying the flow action")
259 logging.info("Expecting the flow action to be modified , but the flow-counters should be preserved")
ShreyaPandita9306c772012-09-28 12:21:40 -0400260
261 #Create and add flow-1 Match on all, except one wildcarded (src adddress).Action A , output to of_port[1]
ShreyaPandita8dab4662012-11-02 13:40:14 -0400262 (pkt,match) = match_all_except_source_address(self,of_ports)
ShreyaPandita9306c772012-09-28 12:21:40 -0400263
264 #Send Packet matching the flow thus incrementing counters like packet_count,byte_count
ShreyaPandita8dab4662012-11-02 13:40:14 -0400265 send_packet(self,pkt,of_ports[0],of_ports[1])
ShreyaPandita9306c772012-09-28 12:21:40 -0400266
267 #Verify flow counters
Rich Laneae3428c2013-03-07 14:37:42 -0800268 verify_flow_stats(self, match, pkts=1, bytes=len(str(pkt)))
ShreyaPandita9306c772012-09-28 12:21:40 -0400269
270 #Modify flow- 1
ShreyaPandita8dab4662012-11-02 13:40:14 -0400271 modify_flow_action(self,of_ports,match)
ShreyaPandita9306c772012-09-28 12:21:40 -0400272
273 # Send Packet matching the flow-1 i.e ingress_port=port[0] and verify it is recieved on corret dataplane port i.e port[2]
ShreyaPandita8dab4662012-11-02 13:40:14 -0400274 send_packet(self,pkt,of_ports[0],of_ports[2])
ShreyaPandita9306c772012-09-28 12:21:40 -0400275
276 #Verify flow counters are preserved
Rich Laneae3428c2013-03-07 14:37:42 -0800277 verify_flow_stats(self, match, pkts=2, bytes=len(str(pkt))*2)
ShreyaPandita9306c772012-09-28 12:21:40 -0400278
279
Rich Laneb90a1c42012-10-05 09:16:05 -0700280class StrictModifyAction(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400281
282 """Strict Modify Flow also changes action preserves counters"""
283
284 def runTest(self):
285
Rich Lane9a003812012-10-04 17:17:59 -0700286 logging.info("Running Strict_Modify_Action test")
ShreyaPandita9306c772012-09-28 12:21:40 -0400287
Rich Lane477f4812012-10-04 22:49:00 -0700288 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400289 of_ports.sort()
290 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
291
292 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800293 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400294
Rich Lane9a003812012-10-04 17:17:59 -0700295 logging.info("Inserting Flows and incrementing flow counters. Strict Modify the flow action ")
296 logging.info("Expecting the flow action to be modified , but the flow-counters should be preserved")
ShreyaPandita9306c772012-09-28 12:21:40 -0400297
298 #Create and add flow-1 Match on all, except one wildcarded (src adddress).Action A
ShreyaPandita8dab4662012-11-02 13:40:14 -0400299 (pkt,match) = match_all_except_source_address(self,of_ports,priority=100)
ShreyaPandita9306c772012-09-28 12:21:40 -0400300
301 #Create and add flow-2 , Match on ingress_port only, Action A
ShreyaPandita8dab4662012-11-02 13:40:14 -0400302 (pkt1,match1) = wildcard_all_except_ingress(self,of_ports,priority=10)
ShreyaPandita9306c772012-09-28 12:21:40 -0400303
304 # Verify both the flows are active
ShreyaPandita8dab4662012-11-02 13:40:14 -0400305 verify_tablestats(self,expect_active=2)
ShreyaPandita9306c772012-09-28 12:21:40 -0400306
307 #Send a packet matching the flows, thus incrementing flow-counters (packet matches the flow F-1 with higher priority)
ShreyaPandita8dab4662012-11-02 13:40:14 -0400308 send_packet(self,pkt,of_ports[0],of_ports[1])
ShreyaPandita9306c772012-09-28 12:21:40 -0400309
310 # Verify flow counters of the flow-1
Rich Laneae3428c2013-03-07 14:37:42 -0800311 verify_flow_stats(self, match, pkts=1, bytes=len(str(pkt)))
ShreyaPandita9306c772012-09-28 12:21:40 -0400312
313 # Strict-Modify flow- 1
ShreyaPandita8dab4662012-11-02 13:40:14 -0400314 strict_modify_flow_action(self,of_ports[2],match,priority=100)
ShreyaPandita9306c772012-09-28 12:21:40 -0400315
316 # Send Packet matching the flow-1 i.e ingress_port=port[0] and verify it is recieved on corret dataplane port i.e port[2]
ShreyaPandita8dab4662012-11-02 13:40:14 -0400317 send_packet(self,pkt,of_ports[0],of_ports[2])
ShreyaPandita9306c772012-09-28 12:21:40 -0400318
319 # Verify flow counters are preserved
Rich Laneae3428c2013-03-07 14:37:42 -0800320 verify_flow_stats(self, match, pkts=2, bytes=2*len(str(pkt)))
ShreyaPandita9306c772012-09-28 12:21:40 -0400321
322
Rich Laneb90a1c42012-10-05 09:16:05 -0700323class DeleteNonexistingFlow(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400324
325 """Request deletion of non-existing flow"""
326
327 def runTest(self):
328
Rich Lane9a003812012-10-04 17:17:59 -0700329 logging.info("Delete_NonExisting_Flow test begins")
ShreyaPandita9306c772012-09-28 12:21:40 -0400330
Rich Lane477f4812012-10-04 22:49:00 -0700331 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400332 of_ports.sort()
333 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
334
335 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800336 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400337
Rich Lane9a003812012-10-04 17:17:59 -0700338 logging.info("Deleting a non-existing flow")
339 logging.info("Expecting switch to ignore the command , without generating errors")
ShreyaPandita9306c772012-09-28 12:21:40 -0400340
341 # Issue a delete command
342 msg = message.flow_mod()
343 msg.match.wildcards = ofp.OFPFW_ALL
344 msg.out_port = ofp.OFPP_NONE
345 msg.command = ofp.OFPFC_DELETE
346 msg.buffer_id = 0xffffffff
347
348 # Verify no message or error is generated by polling the the control plane
349 (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_ERROR,
350 timeout=2)
351 self.assertTrue(response is None,
352 'Recieved Error for deleting non-exiting flow ')
353
354
355
Rich Laneb90a1c42012-10-05 09:16:05 -0700356class SendFlowRem(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400357
358 """Check deletion of flows happens and generates messages as configured.
359 If Send Flow removed message Flag is set in the flow entry, the flow deletion of that respective flow should generate the flow removed message,
360 vice versa also exists """
361
362 def runTest(self):
363
Rich Lane9a003812012-10-04 17:17:59 -0700364 logging.info("Running Send_Flow_Rem test ")
ShreyaPandita9306c772012-09-28 12:21:40 -0400365
Rich Lane477f4812012-10-04 22:49:00 -0700366 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400367 of_ports.sort()
368 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
369
370 #Clear swicth state
Rich Lane32bf9482013-01-03 17:26:30 -0800371 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400372
Rich Lane9a003812012-10-04 17:17:59 -0700373 logging.info("Inserting flows F1 and F2 without and with send_flow_removed_message flag set ")
374 logging.info("Deleting the flows")
375 logging.info("Expecting flow removed message only for F2")
ShreyaPandita9306c772012-09-28 12:21:40 -0400376
377 # Insert flow-1 with F without OFPFF_SEND_FLOW_REM flag set.
ShreyaPandita8dab4662012-11-02 13:40:14 -0400378 (pkt,match) = wildcard_all_except_ingress(self,of_ports)
ShreyaPandita9306c772012-09-28 12:21:40 -0400379
380 # Verify flow is inserted
ShreyaPandita8dab4662012-11-02 13:40:14 -0400381 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400382
383 #Delete the flow-1
ShreyaPandita8dab4662012-11-02 13:40:14 -0400384 nonstrict_delete(self,match,priority=0)
ShreyaPandita9306c772012-09-28 12:21:40 -0400385
386 # Verify no flow removed message is generated for the FLOW-1
387
388 (response1, pkt1) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
389 timeout=2)
390 self.assertTrue(response1 is None,
391 'Received flow removed message for the flow with flow_rem flag not set')
392
393 # Insert another flow F' with OFPFF_SEND_FLOW_REM flag set.
394 msg9 = message.flow_mod()
395 msg9.match.wildcards = ofp.OFPFW_ALL
396 msg9.cookie = random.randint(0,9007199254740992)
397 msg9.buffer_id = 0xffffffff
398 msg9.idle_timeout = 1
399 msg9.flags |= ofp.OFPFF_SEND_FLOW_REM
400 rv1 = self.controller.message_send(msg9)
401 self.assertTrue(rv1 != -1, "Error installing flow mod")
Rich Lane3a261d52013-01-03 17:45:08 -0800402 do_barrier(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400403
404 # Delete the flow-2
Rich Lane32bf9482013-01-03 17:26:30 -0800405 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400406
407 # Verify flow removed message is generated for the FLOW-2
408
409 (response2, pkt2) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
410 timeout=2)
411 self.assertTrue(response2 is not None,
412 'Did not receive flow removed message for this flow')
413
414
Rich Laneb90a1c42012-10-05 09:16:05 -0700415class DeleteEmerFlow(base_tests.SimpleProtocol):
ShreyaPandita9306c772012-09-28 12:21:40 -0400416
417 """Delete emergency flow and verify no message is generated.An emergency flow deletion will not generate flow-removed messages even if
418 Send Flow removed message flag was set during the emergency flow entry"""
419
420 def runTest(self):
421
Rich Lane9a003812012-10-04 17:17:59 -0700422 logging.info("Running Delete_Emer_Flow")
ShreyaPandita9306c772012-09-28 12:21:40 -0400423
Rich Lane477f4812012-10-04 22:49:00 -0700424 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400425 of_ports.sort()
426
427 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800428 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400429
Rich Lane9a003812012-10-04 17:17:59 -0700430 logging.info("Inserting a emergency flow with send_flow_removed flag set")
431 logging.info("Expecting no flow_removed_message on the deletion of the emergency flow")
ShreyaPandita9306c772012-09-28 12:21:40 -0400432
433 # Insert a flow with emergency bit set.
434 pkt = simple_tcp_packet()
435 match = parse.packet_to_flow_match(pkt)
436 match.in_port = of_ports[0]
437 request = message.flow_mod()
438 request.match = match
439 request.command = ofp.OFPFC_ADD
440 request.flags = request.flags|ofp.OFPFF_EMERG|ofp.OFPFF_SEND_FLOW_REM
441 act = action.action_output()
442 act.port = of_ports[1]
443 request.actions.add(act)
444
Rich Lane5c3151c2013-01-03 17:15:41 -0800445 self.controller.message_send(request)
ShreyaPandita9306c772012-09-28 12:21:40 -0400446
447 # Delete the emergency flow
448
ShreyaPandita8dab4662012-11-02 13:40:14 -0400449 nonstrict_delete(self,match)
ShreyaPandita9306c772012-09-28 12:21:40 -0400450 (response, pkt) = self.controller.poll(exp_msg=ofp.OFPFF_SEND_FLOW_REM ,
451 timeout=2)
452 self.assertTrue(response is None,
453 'Test Failed ')
454
455
Rich Laneb90a1c42012-10-05 09:16:05 -0700456class StrictVsNonstrict(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400457
458 """Delete and verify strict and non-strict behaviors
459 This test compares the behavior of delete strict and non-strict"""
460
461 def runTest(self):
462
Rich Lane9a003812012-10-04 17:17:59 -0700463 logging.info("Strict_Vs_Nonstrict test begins")
ShreyaPandita9306c772012-09-28 12:21:40 -0400464
Rich Lane477f4812012-10-04 22:49:00 -0700465 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400466 of_ports.sort()
467 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
468
469 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800470 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400471
Rich Lane9a003812012-10-04 17:17:59 -0700472 logging.info("Inserting a flow with exact match")
473 logging.info("Issue Strict Delete command , verify it gets deleted")
ShreyaPandita9306c772012-09-28 12:21:40 -0400474
475 #Insert F with an exact Match
ShreyaPandita8dab4662012-11-02 13:40:14 -0400476 (pkt,match) = exact_match(self,of_ports)
477 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400478
479 #Issue Strict Delete Command , verify F gets deleted.
ShreyaPandita8dab4662012-11-02 13:40:14 -0400480 strict_delete(self,match)
481 verify_tablestats(self,expect_active=0)
ShreyaPandita9306c772012-09-28 12:21:40 -0400482
Rich Lane9a003812012-10-04 17:17:59 -0700483 logging.info("Inserting two overlapping flows")
484 logging.info("Issue Strict Delete command ")
485 logging.info("Expecting only one flow gets deleted , because Strict Delete matches on wildcards as well")
ShreyaPandita9306c772012-09-28 12:21:40 -0400486
487 #Insert Flow T with match on all , except one wildcarded ( say src adddress ).
ShreyaPandita8dab4662012-11-02 13:40:14 -0400488 (pkt,match) = match_all_except_source_address(self,of_ports)
ShreyaPandita9306c772012-09-28 12:21:40 -0400489
490 #Insert another flow T' with match on ingress_port , wildcarded rest.
ShreyaPandita8dab4662012-11-02 13:40:14 -0400491 (pkt1,match1) = wildcard_all_except_ingress(self,of_ports)
492 verify_tablestats(self,expect_active=2)
ShreyaPandita9306c772012-09-28 12:21:40 -0400493
494 #Issue Strict Delete matching on ingress_port. Verify only T' gets deleted
ShreyaPandita8dab4662012-11-02 13:40:14 -0400495 strict_delete(self,match1)
496 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400497
Rich Lane9a003812012-10-04 17:17:59 -0700498 logging.info("Inserting two overlapping flows")
499 logging.info("Issue Non-Strict Delete command ")
500 logging.info("Expecting both the flow gets deleted , because wildcards are active")
ShreyaPandita9306c772012-09-28 12:21:40 -0400501
502 #Insert T and T' again .
ShreyaPandita8dab4662012-11-02 13:40:14 -0400503 (pkt,match) = match_all_except_source_address(self,of_ports)
504 (pkt1,match1) = wildcard_all_except_ingress(self,of_ports)
505 verify_tablestats(self,expect_active=2)
ShreyaPandita9306c772012-09-28 12:21:40 -0400506
507 #Issue Non-strict Delete with match on ingress_port.Verify T+T' gets deleted .
ShreyaPandita8dab4662012-11-02 13:40:14 -0400508 nonstrict_delete(self,match1)
509 verify_tablestats(self,expect_active=0)
ShreyaPandita9306c772012-09-28 12:21:40 -0400510
Rich Lane9a003812012-10-04 17:17:59 -0700511 logging.info("Inserting three overlapping flows with different priorities")
512 logging.info("Issue Non-Strict Delete command ")
513 logging.info("Expecting all the flows to get deleted")
ShreyaPandita9306c772012-09-28 12:21:40 -0400514
515 #Insert T , add Priority P (say 100 )
ShreyaPandita8dab4662012-11-02 13:40:14 -0400516 (pkt,match) = match_all_except_source_address(self,of_ports,priority=100)
ShreyaPandita9306c772012-09-28 12:21:40 -0400517
518 #Insert T' add priority (200).
ShreyaPandita8dab4662012-11-02 13:40:14 -0400519 (pkt1,match1) = wildcard_all_except_ingress(self,of_ports,priority=200)
ShreyaPandita9306c772012-09-28 12:21:40 -0400520
521 #Insert T' again add priority 300 --> T" .
ShreyaPandita8dab4662012-11-02 13:40:14 -0400522 (pkt2,match2) = wildcard_all_except_ingress(self,of_ports,priority=300)
523 verify_tablestats(self,expect_active=3)
ShreyaPandita9306c772012-09-28 12:21:40 -0400524
525 #Issue Non-Strict Delete and verify all getting deleted
ShreyaPandita8dab4662012-11-02 13:40:14 -0400526 nonstrict_delete(self,match1,priority=200)
527 verify_tablestats(self,expect_active=0)
ShreyaPandita9306c772012-09-28 12:21:40 -0400528
Rich Lane9a003812012-10-04 17:17:59 -0700529 logging.info("Inserting three overlapping flows with different priorities")
530 logging.info("Issue Strict Delete command ")
531 logging.info("Expecting only one to get deleted because here priorities & wildcards are being matched")
ShreyaPandita9306c772012-09-28 12:21:40 -0400532
533 #Issue Strict-Delete and verify only T'' gets deleted.
ShreyaPandita8dab4662012-11-02 13:40:14 -0400534 (pkt,match) = match_all_except_source_address(self,of_ports,priority=100)
535 (pkt1,match1) = wildcard_all_except_ingress(self,of_ports,priority=200)
536 (pkt2,match2) = wildcard_all_except_ingress(self,of_ports,priority=300)
537 strict_delete(self,match1,priority=200)
538 verify_tablestats(self,expect_active=2)
ShreyaPandita9306c772012-09-28 12:21:40 -0400539
540
541
Rich Laneb90a1c42012-10-05 09:16:05 -0700542class Outport1(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400543
544 """Delete flows filtered by action outport.If the out_port field in the delete command contains a value other than OFPP_NONE,
545 it introduces a constraint when matching. This constraint is that the rule must contain an output action directed at that port."""
546
547 def runTest(self):
548
Rich Lane9a003812012-10-04 17:17:59 -0700549 logging.info("Outport1 test begins")
ShreyaPandita9306c772012-09-28 12:21:40 -0400550
Rich Lane477f4812012-10-04 22:49:00 -0700551 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400552 of_ports.sort()
553 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
554
555 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800556 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400557
Rich Lane9a003812012-10-04 17:17:59 -0700558 logging.info("Inserting a flow with output action --> of_port[1]")
559 logging.info("Deleting the flow but with out_port set to of_port[2]")
560 logging.info("Expecting switch to filter the delete command")
ShreyaPandita9306c772012-09-28 12:21:40 -0400561
562 #Build and send Flow-1 with action output to of_port[1]
ShreyaPandita8dab4662012-11-02 13:40:14 -0400563 (pkt,match) = wildcard_all_except_ingress(self,of_ports)
ShreyaPandita9306c772012-09-28 12:21:40 -0400564
565 # Verify active_entries in table_stats_request = 1
ShreyaPandita8dab4662012-11-02 13:40:14 -0400566 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400567
568 #Send delete command matching the flow-1 but with contraint out_port = of_port[2]
569 msg7 = message.flow_mod()
570 msg7.out_port = of_ports[2]
571 msg7.command = ofp.OFPFC_DELETE
572 msg7.buffer_id = 0xffffffff
573 msg7.match = match
574
Rich Lane5c3151c2013-01-03 17:15:41 -0800575 self.controller.message_send(msg7)
Rich Lane3a261d52013-01-03 17:45:08 -0800576 do_barrier(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400577
578 # Verify flow will not get deleted, active_entries in table_stats_request = 1
ShreyaPandita8dab4662012-11-02 13:40:14 -0400579 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400580
Rich Lane9a003812012-10-04 17:17:59 -0700581 logging.info("Deleting the flow with out_port set to of_port[1]")
582 logging.info("Expecting switch to delete the flow")
ShreyaPandita9306c772012-09-28 12:21:40 -0400583
584 #Send Delete command with contraint out_port = of_ports[1]
585 msg7 = message.flow_mod()
586 msg7.out_port = of_ports[1]
587 msg7.command = ofp.OFPFC_DELETE
588 msg7.buffer_id = 0xffffffff
589 msg7.match = match
590
Rich Lane5c3151c2013-01-03 17:15:41 -0800591 self.controller.message_send(msg7)
Rich Lane3a261d52013-01-03 17:45:08 -0800592 do_barrier(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400593
594 #Verify flow gets deleted.
ShreyaPandita8dab4662012-11-02 13:40:14 -0400595 verify_tablestats(self,expect_active=0)
ShreyaPandita9306c772012-09-28 12:21:40 -0400596
597
Rich Laneb90a1c42012-10-05 09:16:05 -0700598class IdleTimeout(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400599
600 """ Verify that idle timeout is implemented"""
601
602 def runTest(self):
603
Rich Lane9a003812012-10-04 17:17:59 -0700604 logging.info("Running Idle_Timeout test ")
ShreyaPandita9306c772012-09-28 12:21:40 -0400605
Rich Lane477f4812012-10-04 22:49:00 -0700606 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400607 of_ports.sort()
608 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
609
610 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800611 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400612
Rich Lane9a003812012-10-04 17:17:59 -0700613 logging.info("Inserting flow entry with idle_timeout set. Also send_flow_removed_message flag set")
614 logging.info("Expecting the flow entry to delete with given idle_timeout")
ShreyaPandita9306c772012-09-28 12:21:40 -0400615
616 #Insert a flow entry with idle_timeout=1.Send_Flow_Rem flag set
617 msg9 = message.flow_mod()
618 msg9.match.wildcards = ofp.OFPFW_ALL
619 msg9.cookie = random.randint(0,9007199254740992)
620 msg9.buffer_id = 0xffffffff
621 msg9.idle_timeout = 1
622 msg9.flags |= ofp.OFPFF_SEND_FLOW_REM
623 rv1 = self.controller.message_send(msg9)
624 self.assertTrue(rv1 != -1, "Error installing flow mod")
Rich Lane3a261d52013-01-03 17:45:08 -0800625 do_barrier(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400626
627 #Verify flow gets inserted
ShreyaPandita8dab4662012-11-02 13:40:14 -0400628 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400629
630 # Verify flow removed message is recieved.
631 (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
632 timeout=5)
633 self.assertTrue(response is not None,
634 'Did not receive flow removed message ')
635 self.assertEqual(ofp.OFPRR_IDLE_TIMEOUT, response.reason,
636 'Flow table entry removal reason is not idle_timeout')
637 self.assertEqual(1, response.duration_sec,
638 'Flow was not alive for 1 sec')
639
640
Rich Laneb90a1c42012-10-05 09:16:05 -0700641class Outport2(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400642
643 """Add, modify flows with outport set. This field is ignored by ADD, MODIFY, and MODIFY STRICT messages."""
644
645 def runTest(self):
646
Rich Lane9a003812012-10-04 17:17:59 -0700647 logging.info("Running Outport2 test ")
ShreyaPandita9306c772012-09-28 12:21:40 -0400648
Rich Lane477f4812012-10-04 22:49:00 -0700649 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400650 of_ports.sort()
651 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
652
653 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800654 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400655
Rich Lane9a003812012-10-04 17:17:59 -0700656 logging.info("Adding and modifying flow with out_port fields set")
657 logging.info("Expecting switch to ignore out_port")
ShreyaPandita9306c772012-09-28 12:21:40 -0400658
659 # Create and add flow-1,Action A ,output to port of_port[1], out_port set to of_ports[2]
ShreyaPandita8dab4662012-11-02 13:40:14 -0400660 (pkt,match) = wildcard_all_except_ingress(self,of_ports)
ShreyaPandita9306c772012-09-28 12:21:40 -0400661
662 # Verify flow is active
ShreyaPandita8dab4662012-11-02 13:40:14 -0400663 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400664
665 # Send Packet matching the flow
ShreyaPandita8dab4662012-11-02 13:40:14 -0400666 send_packet(self,pkt,of_ports[0],of_ports[1])
ShreyaPandita9306c772012-09-28 12:21:40 -0400667
668 # Insert Flow-Modify matching flow F-1 ,action A', output to port[2], out_port set to port[3]
ShreyaPandita8dab4662012-11-02 13:40:14 -0400669 modify_flow_action(self,of_ports,match)
ShreyaPandita9306c772012-09-28 12:21:40 -0400670
671 # Again verify active_entries in table_stats_request =1
ShreyaPandita8dab4662012-11-02 13:40:14 -0400672 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400673
674 #Verify action is modified
ShreyaPandita8dab4662012-11-02 13:40:14 -0400675 send_packet(self,pkt,of_ports[0],of_ports[2])
ShreyaPandita9306c772012-09-28 12:21:40 -0400676
677
678
679
Rich Laneb90a1c42012-10-05 09:16:05 -0700680class HardTimeout(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400681
682 """ Verify that hard timeout is implemented """
683
684 def runTest(self):
685
Rich Lane9a003812012-10-04 17:17:59 -0700686 logging.info("Running Hard_Timeout test ")
ShreyaPandita9306c772012-09-28 12:21:40 -0400687
Rich Lane477f4812012-10-04 22:49:00 -0700688 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400689 of_ports.sort()
690 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
691
692 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800693 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400694
Rich Lane9a003812012-10-04 17:17:59 -0700695 logging.info("Inserting flow entry with hard_timeout set. Also send_flow_removed_message flag set")
696 logging.info("Expecting the flow entry to delete with given hard_timeout")
ShreyaPandita9306c772012-09-28 12:21:40 -0400697
698 # Insert a flow entry with hardtimeout=1 and send_flow_removed flag set
699 msg9 = message.flow_mod()
700 msg9.match.wildcards = ofp.OFPFW_ALL
701 msg9.cookie = random.randint(0,9007199254740992)
702 msg9.buffer_id = 0xffffffff
703 msg9.hard_timeout = 1
704 msg9.flags |= ofp.OFPFF_SEND_FLOW_REM
705 rv1 = self.controller.message_send(msg9)
706 self.assertTrue(rv1 != -1, "Error installing flow mod")
Rich Lane3a261d52013-01-03 17:45:08 -0800707 do_barrier(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400708
709 #Verify flow gets inserted
ShreyaPandita8dab4662012-11-02 13:40:14 -0400710 verify_tablestats(self,expect_active=1)
ShreyaPandita9306c772012-09-28 12:21:40 -0400711
712 # Verify flow removed message is recieved.
713 (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
714 timeout=5)
715 self.assertTrue(response is not None,
716 'Did not receive flow removed message ')
717 self.assertEqual(ofp.OFPRR_HARD_TIMEOUT, response.reason,
718 'Flow table entry removal reason is not hard_timeout')
719 self.assertEqual(1, response.duration_sec,
720 'Flow was not alive for 1 sec')
721
722
Rich Laneb90a1c42012-10-05 09:16:05 -0700723class FlowTimeout(base_tests.SimpleDataPlane):
ShreyaPandita9306c772012-09-28 12:21:40 -0400724
725 """Verify that Flow removed messages are generated as expected
726 Flow removed messages being generated when flag is set, is already tested in the above tests
727 So here, we test the vice-versa condition"""
728
729
730 def runTest(self):
731
Rich Lane9a003812012-10-04 17:17:59 -0700732 logging.info("Running Flow_Timeout test ")
ShreyaPandita9306c772012-09-28 12:21:40 -0400733
Rich Lane477f4812012-10-04 22:49:00 -0700734 of_ports = config["port_map"].keys()
ShreyaPandita9306c772012-09-28 12:21:40 -0400735 of_ports.sort()
736 self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
737
738 #Clear switch state
Rich Lane32bf9482013-01-03 17:26:30 -0800739 delete_all_flows(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400740
Rich Lane9a003812012-10-04 17:17:59 -0700741 logging.info("Inserting flow entry with hard_timeout set and send_flow_removed_message flag not set")
742 logging.info("Expecting the flow entry to delete, but no flow removed message")
ShreyaPandita9306c772012-09-28 12:21:40 -0400743
744 # Insert a flow with hard_timeout = 1 but no Send_Flow_Rem flag set
745 pkt = simple_tcp_packet()
746 match3 = parse.packet_to_flow_match(pkt)
747 self.assertTrue(match3 is not None, "Could not generate flow match from pkt")
748 match3.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT
749 match3.in_port = of_ports[0]
750 msg3 = message.flow_mod()
751 msg3.out_port = of_ports[2] # ignored by flow add,flow modify
752 msg3.command = ofp.OFPFC_ADD
753 msg3.cookie = random.randint(0,9007199254740992)
754 msg3.buffer_id = 0xffffffff
755 msg3.hard_timeout = 1
756 msg3.buffer_id = 0xffffffff
757 msg3.match = match3
758 act3 = action.action_output()
759 act3.port = of_ports[1]
Rich Lanee30455b2013-01-03 16:24:44 -0800760 msg3.actions.add(act3)
ShreyaPandita9306c772012-09-28 12:21:40 -0400761
Rich Lane5c3151c2013-01-03 17:15:41 -0800762 self.controller.message_send(msg3)
Rich Lane3a261d52013-01-03 17:45:08 -0800763 do_barrier(self.controller)
ShreyaPandita9306c772012-09-28 12:21:40 -0400764
765 #Verify no flow removed message is generated
766 (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
767 timeout=3)
768 self.assertTrue(response is None,
769 'Recieved flow removed message ')
770
771 # Verify no entries in the table
ShreyaPandita8dab4662012-11-02 13:40:14 -0400772 verify_tablestats(self,expect_active=0)
ShreyaPandita9306c772012-09-28 12:21:40 -0400773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795