blob: 5a91ea54b140b3f27ec242066e954e786d4e1155 [file] [log] [blame]
Jonathan Hartf2511ca2015-07-07 14:18:19 -07001'''
2OFTests for functionality needed from the OLT.
3'''
4import logging
5from oftest import config
6import oftest.base_tests as base_tests
7import oftest.packet as scapy
8
9import ofp
Admin7e9c91d2015-08-25 15:53:49 -070010import time
Jonathan Hartf2511ca2015-07-07 14:18:19 -070011
12from oftest.testutils import *
13
Admindcb1bc72015-11-12 18:24:56 -080014onu_port = test_param_get("onu_port", 130)
15onu_port2 = test_param_get("onu_port2", 131)
16olt_port = test_param_get("olt_port", 258)
Jonathan Hartf2511ca2015-07-07 14:18:19 -070017
Adminb17b1662015-10-19 15:50:53 -070018def double_vlan_udp_packet(pktlen=100,
19 eth_dst='00:01:02:03:04:05',
20 eth_src='00:06:07:08:09:0a',
21 dl_vlan_enable=False,
22 c_vlan_vid=0,
23 c_vlan_pcp=0,
24 s_vlan_vid=0,
25 s_vlan_pcp=0,
26 ip_src='192.168.0.1',
27 ip_dst='192.168.0.2',
28 ip_tos=0,
29 ip_ttl=64,
30 udp_sport=1234,
31 udp_dport=80,
32 ip_ihl=None,
Admindcb1bc72015-11-12 18:24:56 -080033 ip_options=False,
34 eth_type=0x8100
Adminb17b1662015-10-19 15:50:53 -070035 ):
36 """
37 Return a double vlan tagged dataplane UDP packet
38 Supports a few parameters:
39 @param len Length of packet in bytes w/o CRC
40 @param eth_dst Destination MAC
41 @param eth_src Source MAC
42 @param dl_vlan_enable True if the packet is with vlan, False otherwise
43 @param c_vlan_vid CVLAN ID
44 @param c_vlan_pcp CVLAN priority
45 @param s_vlan_vid SVLAN ID
46 @param s_vlan_pcp SVLAN priority
47 @param ip_src IP source
48 @param ip_dst IP destination
49 @param ip_tos IP ToS
50 @param ip_ttl IP TTL
51 @param udp_dport UDP destination port
52 @param udp_sport UDP source port
53
54 Generates a simple UDP packet. Users shouldn't assume anything about
55 this packet other than that it is a valid ethernet/IP/UDP frame.
56 """
57
58 if MINSIZE > pktlen:
59 pktlen = MINSIZE
60
61 # Note Dot1Q.id is really CFI
62 if (dl_vlan_enable):
Admindcb1bc72015-11-12 18:24:56 -080063 pkt = scapy.Ether(dst=eth_dst, src=eth_src, type=eth_type)/ \
Adminb17b1662015-10-19 15:50:53 -070064 scapy.Dot1Q(prio=s_vlan_pcp, vlan=s_vlan_vid)/ \
65 scapy.Dot1Q(prio=c_vlan_pcp, vlan=c_vlan_vid)/ \
66 scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
67 scapy.UDP(sport=udp_sport, dport=udp_dport)
68 else:
69 if not ip_options:
70 pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
71 scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
72 scapy.UDP(sport=udp_sport, dport=udp_dport)
73
74 else:
75 pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
76 scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl, options=ip_options)/ \
77 scapy.UDP(sport=udp_sport, dport=udp_dport)
78
79 pkt = pkt/("D" * (pktlen - len(pkt)))
80
81 return pkt
82
83
Jonathan Hartf2511ca2015-07-07 14:18:19 -070084def testPacketIn(self, match, parsed_pkt):
Admin7e9c91d2015-08-25 15:53:49 -070085
Jonathan Hartf2511ca2015-07-07 14:18:19 -070086 delete_all_flows(self.controller)
87
88 pkt = str(parsed_pkt)
89
90 request = ofp.message.flow_add(
91 table_id=test_param_get("table", 0),
92 cookie=42,
93 match=match,
94 instructions=[
95 ofp.instruction.apply_actions(
96 actions=[
97 ofp.action.output(
98 port=ofp.OFPP_CONTROLLER,
99 max_len=ofp.OFPCML_NO_BUFFER)])],
100 buffer_id=ofp.OFP_NO_BUFFER,
101 priority=1000)
102
103 logging.info("Inserting flow sending matching packets to controller")
104 self.controller.message_send(request)
105 do_barrier(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700106
Admin7e9c91d2015-08-25 15:53:49 -0700107 for of_port in config["port_map"]:
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700108 logging.info("PacketInExact test, port %d", of_port)
109 self.dataplane.send(of_port, pkt)
110 verify_packet_in(self, pkt, of_port, ofp.OFPR_ACTION)
111 verify_packets(self, pkt, [])
112
113class EapolPacketIn(base_tests.SimpleDataPlane):
114
115 """Verify packet-ins are sent for EAPOL packets """
116
117 def runTest(self):
118 logging.info("Running EAPOL Packet In test")
119
120 match = ofp.match()
121 match.oxm_list.append(ofp.oxm.eth_type(0x888e))
122 # Use ethertype 0x888e and multicast destination MAC address
123 pkt = simple_eth_packet(pktlen=60, eth_dst='01:00:5E:7F:FF:FF', eth_type=0x888e)
124
125 testPacketIn(self, match, pkt)
126
127class ARPPacketIn(base_tests.SimpleDataPlane):
128
129 """Verify packet-ins are sent for ARP packets """
130
131 def runTest(self):
132 logging.info("Running ARP Packet In test")
133
134 match = ofp.match()
135 match.oxm_list.append(ofp.oxm.eth_type(0x0806))
136
137 # Use ethertype 0x0806
138 pkt = simple_eth_packet(eth_type=0x0806)
139
140 testPacketIn(self, match, pkt)
141
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700142class DHCPPacketIn(base_tests.SimpleDataPlane):
143
144 """Verify packet-ins are sent for DHCP packets """
145
146 def runTest(self):
147 logging.info("Running DHCP Packet In test")
148
149 pkt = simple_udp_packet(udp_sport=68, udp_dport=67)
Admin02d052c2015-10-10 19:08:26 -0700150
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700151 match = ofp.match()
152 match.oxm_list.append(ofp.oxm.eth_type(0x0800))
153 match.oxm_list.append(ofp.oxm.ip_proto(17))
154 match.oxm_list.append(ofp.oxm.udp_src(68))
155 match.oxm_list.append(ofp.oxm.udp_dst(67))
156
157 testPacketIn(self, match, pkt)
158
159 # Other UDP packets should not match the rule
160 radiusPkt = simple_udp_packet(udp_sport=1812, udp_dport=1812)
Admin02d052c2015-10-10 19:08:26 -0700161
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700162 self.dataplane.send(1, str(radiusPkt))
163 verify_no_packet_in(self, radiusPkt, 1)
164
165class IGMPPacketIn(base_tests.SimpleDataPlane):
166
167 """Verify packet-ins are sent for IGMP packets """
168
169 def runTest(self):
170 logging.info("Running IGMP Packet In test")
171
172 match = ofp.match()
173 match.oxm_list.append(ofp.oxm.eth_type(0x800))
174 match.oxm_list.append(ofp.oxm.ip_proto(2))
175
176 pkt = scapy.Ether(dst='01:00:5E:7F:FF:FF', src='00:00:00:00:00:01')/ \
177 scapy.IP(src='10.0.0.1', dst='10.0.0.2', ttl=60, tos=0, id=0, proto=2)
178
179 pkt = pkt/("0" * (100 - len(pkt)))
180
181 testPacketIn(self, match, pkt)
Admin7e9c91d2015-08-25 15:53:49 -0700182
183class TestMeter(base_tests.SimpleDataPlane):
184
185 def runTest(self):
186 logging.info("Running Meter tests")
187 dropMeterBand = ofp.meter_band.drop(rate = 500)
188 meter_mod = ofp.message.meter_mod(xid = 1, command = ofp.OFPMC_ADD, meter_id = 1, meters = [ dropMeterBand ])
189 self.controller.message_send(meter_mod)
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700190
Admin7e9c91d2015-08-25 15:53:49 -0700191 time.sleep(1)
192
193 verify_no_errors(self.controller)
194
Jonathan Hartf65e1812015-10-05 15:15:37 -0700195 vlan_id = 201
Admin7e9c91d2015-08-25 15:53:49 -0700196 match = ofp.match()
197 match.oxm_list.append(ofp.oxm.in_port(onu_port))
Admin02d052c2015-10-10 19:08:26 -0700198 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id ))
199
200 request = ofp.message.flow_add(
201 table_id=test_param_get("table", 0),
202 cookie=42,
203 match=match,
204 instructions=[
205 ofp.instruction.apply_actions(
Jonathan Hartf65e1812015-10-05 15:15:37 -0700206 actions=[ofp.action.output(port=olt_port)]
207 ),
Admin02d052c2015-10-10 19:08:26 -0700208 ofp.instruction.meter(meter_id = 1)
209 ],
210 buffer_id=ofp.OFP_NO_BUFFER,
211 priority=1000)
212
213 self.controller.message_send(request)
214 time.sleep(1)
215 verify_no_errors(self.controller)
216
217 match = ofp.match()
218 match.oxm_list.append(ofp.oxm.in_port(olt_port))
219 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
Admin7e9c91d2015-08-25 15:53:49 -0700220
221 request = ofp.message.flow_add(
222 table_id=test_param_get("table", 0),
223 cookie=43,
224 match=match,
225 instructions=[
226 ofp.instruction.apply_actions(
Jonathan Hartf65e1812015-10-05 15:15:37 -0700227 actions=[ofp.action.output(port=onu_port)]
228 ),
229 ofp.instruction.meter(meter_id = 1)
Admin7e9c91d2015-08-25 15:53:49 -0700230 ],
231 buffer_id=ofp.OFP_NO_BUFFER,
232 priority=1000)
233
234 self.controller.message_send(request)
Admin7e9c91d2015-08-25 15:53:49 -0700235 time.sleep(1)
Admin7e9c91d2015-08-25 15:53:49 -0700236 verify_no_errors(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700237 do_barrier(self.controller)
238 time.sleep(5)
Admin7e9c91d2015-08-25 15:53:49 -0700239
Jonathan Hartf65e1812015-10-05 15:15:37 -0700240 inPkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=vlan_id, vlan_pcp=0)
241 # downstream
Admin02d052c2015-10-10 19:08:26 -0700242 self.dataplane.send(olt_port, str(inPkt))
243 verify_packet(self, inPkt, onu_port)
244 # upstream
Admin09b5cc62015-10-11 13:53:59 -0700245 self.dataplane.send(onu_port, str(inPkt))
246 verify_packet(self, inPkt, olt_port)
Admin02d052c2015-10-10 19:08:26 -0700247
Jonathan Hartf65e1812015-10-05 15:15:37 -0700248 # clean up the test
Admin02d052c2015-10-10 19:08:26 -0700249 meter_mod = ofp.message.meter_mod(xid = 2, command = ofp.OFPMC_DELETE, meter_id = 1)
250 self.controller.message_send(meter_mod)
251 time.sleep(1)
252 delete_all_flows(self.controller)
253 verify_no_errors(self.controller)
254
255
Admin7e9c91d2015-08-25 15:53:49 -0700256class TestDuplicateMeter(base_tests.SimpleDataPlane):
257
258 def runTest(self):
259 logging.info("Running Duplicate Meter Test")
260 dropMeterBand = ofp.meter_band.drop(rate = 500)
261 meter_mod = ofp.message.meter_mod(xid = 1, command = ofp.OFPMC_ADD, meter_id = 1, meters = [ dropMeterBand ])
262 self.controller.message_send(meter_mod)
263 self.controller.message_send(meter_mod)
264
265 time.sleep(1)
266
267 try:
268 verify_no_errors(self.controller)
269 except AssertionError as e:
Admin09b5cc62015-10-11 13:53:59 -0700270 if (not e.message == "unexpected error type=12 code=1"):
Admin7e9c91d2015-08-25 15:53:49 -0700271 raise AssertionError("Incorrect error type: %s" % e.message)
272
273
274class VlanTest(base_tests.SimpleDataPlane):
275
276 """Verify the switch can push/pop a VLAN tag and forward out a port """
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700277
278 def runTest(self):
279 logging.info("Running push VLAN test")
280
281 vlan_id = 200
282
283 delete_all_flows(self.controller)
Admin7e9c91d2015-08-25 15:53:49 -0700284
285 #PUSH
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700286 match = ofp.match()
287 match.oxm_list.append(ofp.oxm.in_port(onu_port))
Admin7e9c91d2015-08-25 15:53:49 -0700288 match.oxm_list.append(ofp.oxm.vlan_vid_masked(value=ofp.OFPVID_PRESENT, value_mask=ofp.OFPVID_PRESENT))
289 match.oxm_list.append(ofp.oxm.vlan_pcp(value = 0))
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700290
291 request = ofp.message.flow_add(
292 table_id=test_param_get("table", 0),
293 cookie=42,
294 match=match,
295 instructions=[
296 ofp.instruction.apply_actions(
297 actions=[
298 ofp.action.push_vlan(ethertype=0x8100),
299 ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)),
Admin7e9c91d2015-08-25 15:53:49 -0700300 ofp.action.set_field(ofp.oxm.vlan_pcp(0)),
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700301 ofp.action.output(port=olt_port)])],
302 buffer_id=ofp.OFP_NO_BUFFER,
303 priority=1000)
304
Admin7e9c91d2015-08-25 15:53:49 -0700305 logging.info("Inserting flow tagging upstream")
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700306 self.controller.message_send(request)
Adminb17b1662015-10-19 15:50:53 -0700307
Admin02d052c2015-10-10 19:08:26 -0700308 #POP
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700309 match = ofp.match()
310 match.oxm_list.append(ofp.oxm.in_port(olt_port))
311 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
Admin7e9c91d2015-08-25 15:53:49 -0700312
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700313 request = ofp.message.flow_add(
314 table_id=test_param_get("table", 0),
Admin7e9c91d2015-08-25 15:53:49 -0700315 cookie=43,
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700316 match=match,
317 instructions=[
318 ofp.instruction.apply_actions(
Jonathan Hartf65e1812015-10-05 15:15:37 -0700319 actions=[
320 ofp.action.pop_vlan(),
Admin09b5cc62015-10-11 13:53:59 -0700321 ofp.action.output(port=onu_port)])],
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700322 buffer_id=ofp.OFP_NO_BUFFER,
323 priority=1000)
324
Admin7e9c91d2015-08-25 15:53:49 -0700325 logging.info("Inserting flow tagging downstream")
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700326 self.controller.message_send(request)
327 do_barrier(self.controller)
Admin7e9c91d2015-08-25 15:53:49 -0700328 time.sleep(5)
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700329
Admin7e9c91d2015-08-25 15:53:49 -0700330 inPkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=0, vlan_pcp=0)
331 outPkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True,
332 vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0)
333
334 # Send untagged packet in the ONU port and expect tagged packet out the OLT port
335 self.dataplane.send(onu_port, str(inPkt))
336 verify_packet(self, outPkt, olt_port)
337
338 # Send untagged packet in the OLT port and expect no packets to come out
339 self.dataplane.send(olt_port, str(inPkt))
340 verify_packets(self, outPkt, [])
Adminb17b1662015-10-19 15:50:53 -0700341
Admin7e9c91d2015-08-25 15:53:49 -0700342 inPkt = simple_udp_packet(pktlen=104, dl_vlan_enable=True,
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700343 vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0)
Admin7e9c91d2015-08-25 15:53:49 -0700344 outPkt = simple_udp_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=0, vlan_pcp=0)
345
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700346 # Send tagged packet in the OLT port and expect untagged packet out the OLT port
347 self.dataplane.send(olt_port, str(inPkt))
348 verify_packet(self, outPkt, onu_port)
Admin7e9c91d2015-08-25 15:53:49 -0700349
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700350 # Send tagged packet in the ONU port and expect no packets to come out
351 self.dataplane.send(onu_port, str(inPkt))
Admin7e9c91d2015-08-25 15:53:49 -0700352 verify_packets(self, outPkt, [])
Jonathan Hartf65e1812015-10-05 15:15:37 -0700353
354def createAllGroupAdd(group_id, ports=[]):
355 buckets = []
356
357 for portNum in ports:
358 buckets.append(ofp.common.bucket(watch_port=ofp.OFPP_ANY, watch_group=ofp.OFPG_ANY,
359 actions=[ofp.action.output(port=portNum)]))
360
361 group_add = ofp.message.group_add(group_type = ofp.OFPGT_ALL, group_id=group_id, buckets=buckets)
362
363 return group_add
364
365def createAllGroupMod(group_id, ports=[]):
366 buckets = []
367
368 for portNum in ports:
369 buckets.append(ofp.common.bucket(watch_port=ofp.OFPP_ANY, watch_group=ofp.OFPG_ANY,
370 actions=[ofp.action.output(port=portNum)]))
371
372 group_mod = ofp.message.group_mod(command=ofp.OFPGC_MODIFY, group_type = ofp.OFPGT_ALL, group_id=group_id, buckets=buckets)
373
374 return group_mod
375
376
Admin02d052c2015-10-10 19:08:26 -0700377class TestGroupAdd(base_tests.SimpleDataPlane):
378
379 def runTest(self):
380 logging.info("Running Group tests")
381 delete_all_flows(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700382 delete_all_groups(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700383
Jonathan Hartf65e1812015-10-05 15:15:37 -0700384 test_group_id = 1
385
386 # output to two ONU
387 group_add = createAllGroupAdd(test_group_id, ports=[onu_port, onu_port2])
Admin02d052c2015-10-10 19:08:26 -0700388
389 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700390 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700391 verify_no_errors(self.controller)
392
393 # Remove the group and then readd it.
Jonathan Hartf65e1812015-10-05 15:15:37 -0700394 group_delete = ofp.message.group_delete(group_id = test_group_id)
Admin02d052c2015-10-10 19:08:26 -0700395 self.controller.message_send(group_delete)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700396 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700397 verify_no_errors(self.controller)
398
Jonathan Hartf65e1812015-10-05 15:15:37 -0700399 group_add = createAllGroupAdd(test_group_id, [onu_port, onu_port2])
Admin02d052c2015-10-10 19:08:26 -0700400 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700401 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700402 verify_no_errors(self.controller)
403
404
Jonathan Hartf65e1812015-10-05 15:15:37 -0700405 # clean up the test
406 group_delete = ofp.message.group_delete(group_id = test_group_id)
Admin02d052c2015-10-10 19:08:26 -0700407 self.controller.message_send(group_delete)
408
Jonathan Hartf65e1812015-10-05 15:15:37 -0700409 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700410 verify_no_errors(self.controller)
411
412class TestGroupMod(base_tests.SimpleDataPlane):
413
414 def runTest(self):
415 logging.info("Running Group tests")
416 delete_all_flows(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700417 delete_all_groups(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700418
Jonathan Hartf65e1812015-10-05 15:15:37 -0700419 test_group_id = 1
420
421 group_add = createAllGroupAdd(test_group_id, [onu_port, onu_port2])
Admin02d052c2015-10-10 19:08:26 -0700422
423 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700424 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700425 verify_no_errors(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700426
427 # Modifying the group
428 group_mod = createAllGroupMod(test_group_id, [onu_port2])
429
430 self.controller.message_send(group_mod)
431 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700432 verify_no_errors(self.controller)
433
Jonathan Hartf65e1812015-10-05 15:15:37 -0700434 # Add a bucket into the group
435 group_mod = createAllGroupMod(test_group_id, [onu_port, onu_port2])
436 self.controller.message_send(group_mod)
437 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700438 verify_no_errors(self.controller)
439
440 # Modifying a non-existing group
Jonathan Hartf65e1812015-10-05 15:15:37 -0700441 group_mod = createAllGroupMod(777, [onu_port2])
Admin02d052c2015-10-10 19:08:26 -0700442
Jonathan Hartf65e1812015-10-05 15:15:37 -0700443 self.controller.message_send(group_mod)
444 do_barrier(self.controller)
445 errorExperienced = 0
Admin02d052c2015-10-10 19:08:26 -0700446 try:
447 verify_no_errors(self.controller)
448 except AssertionError as e:
Jonathan Hartf65e1812015-10-05 15:15:37 -0700449 errorExperienced = 1
Admin02d052c2015-10-10 19:08:26 -0700450 if (not (e.message == "unexpected error type=6 code=8")):
Jonathan Hartf65e1812015-10-05 15:15:37 -0700451 raise AssertionError("Incorrect error type: %s" % e.message)
452 if not errorExperienced:
453 raise AssertionError("An error message is expected, but not shown.")
454
Admin02d052c2015-10-10 19:08:26 -0700455
Jonathan Hartf65e1812015-10-05 15:15:37 -0700456 # clean up the test
Admin02d052c2015-10-10 19:08:26 -0700457 group_delete = ofp.message.group_delete(xid = 2, group_id = test_group_id)
458 self.controller.message_send(group_delete)
459
Jonathan Hartf65e1812015-10-05 15:15:37 -0700460 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700461 verify_no_errors(self.controller)
462
463class TestDuplicateGroup(base_tests.SimpleDataPlane):
464
465 def runTest(self):
466 logging.info("Running Group tests")
467 delete_all_flows(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700468 delete_all_groups(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700469
Jonathan Hartf65e1812015-10-05 15:15:37 -0700470 test_group_id = 1
471 group_add = createAllGroupAdd(test_group_id, ports=[onu_port])
Admin02d052c2015-10-10 19:08:26 -0700472
473 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700474 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700475 verify_no_errors(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700476
477 # Add the same group id
Admin02d052c2015-10-10 19:08:26 -0700478 duplicate_group_fail = 0
Jonathan Hartf65e1812015-10-05 15:15:37 -0700479
Admin02d052c2015-10-10 19:08:26 -0700480 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700481 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700482 try:
483 verify_no_errors(self.controller)
484 except AssertionError as e:
485 duplicate_group_fail = 1
Jonathan Hartf65e1812015-10-05 15:15:37 -0700486 if (not e.message == "unexpected error type=6 code=0"):
487 raise AssertionError("Incorrect error type: %s" % e.message)
488 if not duplicate_group_fail:
489 raise AssertionError("Adding duplicate groups didn't raise an error.")
490
491 # clean up the test
Admin02d052c2015-10-10 19:08:26 -0700492 group_delete = ofp.message.group_delete(xid = 2, group_id = test_group_id)
493 self.controller.message_send(group_delete)
494
Jonathan Hartf65e1812015-10-05 15:15:37 -0700495 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700496 verify_no_errors(self.controller)
497
498class TestGroupAndFlow(base_tests.SimpleDataPlane):
499
500 def runTest(self):
501 logging.info("Running Group tests")
502 delete_all_flows(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700503 delete_all_groups(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700504
Jonathan Hartf65e1812015-10-05 15:15:37 -0700505 # Create a group
506 test_group_id = 1
507 group_add = createAllGroupAdd(test_group_id, ports=[onu_port])
Admin02d052c2015-10-10 19:08:26 -0700508
509 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700510 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700511 verify_no_errors(self.controller)
512
513 # Create a flow rule matching olt port and vlan id
514 match = ofp.match()
515 match.oxm_list.append(ofp.oxm.in_port(olt_port))
516 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | 201))
517
Jonathan Hartf65e1812015-10-05 15:15:37 -0700518 flow_pointing_to_group = ofp.message.flow_add(
Admin02d052c2015-10-10 19:08:26 -0700519 table_id=test_param_get("table", 0),
520 cookie=43,
521 match=match,
522 instructions=[
523 ofp.instruction.apply_actions(
524 actions=[ ofp.action.group( group_id = test_group_id ) ] ) ],
525 buffer_id=ofp.OFP_NO_BUFFER, priority=1000)
526
Jonathan Hartf65e1812015-10-05 15:15:37 -0700527 self.controller.message_send(flow_pointing_to_group)
528 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700529 verify_no_errors(self.controller)
530
Jonathan Hartf65e1812015-10-05 15:15:37 -0700531 # After letting a flow rule point to the group, test we can do group_mod
532 group_mod = createAllGroupMod(test_group_id, ports=[onu_port2])
533 self.controller.message_send(group_mod)
534 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700535 verify_no_errors(self.controller)
536
537 # Test we can remove flows and then remove group
Jonathan Hartf65e1812015-10-05 15:15:37 -0700538 flow_delete = ofp.message.flow_delete( table_id=test_param_get("table", 0))
539 self.controller.message_send(flow_delete)
540 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700541 verify_no_errors(self.controller)
542
543 group_delete = ofp.message.group_delete(xid = 3, group_id = test_group_id)
544 self.controller.message_send(group_delete)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700545 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700546 verify_no_errors(self.controller)
Admindcb1bc72015-11-12 18:24:56 -0800547
Jonathan Hartf65e1812015-10-05 15:15:37 -0700548 # Add the group and flow back, test it we can first remove group and then remove the flow.
Admindcb1bc72015-11-12 18:24:56 -0800549 '''group_add = createAllGroupAdd(test_group_id, ports=[onu_port])
Admin02d052c2015-10-10 19:08:26 -0700550 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700551
552 self.controller.message_send(flow_pointing_to_group)
553 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700554 verify_no_errors(self.controller)
555
556 group_delete = ofp.message.group_delete(xid = 4, group_id = test_group_id)
Admindcb1bc72015-11-12 18:24:56 -0800557 self.controller.message_send(group_delete)'''
Jonathan Hartf65e1812015-10-05 15:15:37 -0700558
559 self.controller.message_send(flow_delete)
560 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700561 verify_no_errors(self.controller)
562
563
564class TestGroupForwarding(base_tests.SimpleDataPlane):
565
566 def runTest(self):
567 logging.info("Running Group datapath forwarding tests")
568 delete_all_flows(self.controller)
Admin09b5cc62015-10-11 13:53:59 -0700569 #delete_all_groups(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700570
Admin09b5cc62015-10-11 13:53:59 -0700571 vlan_id = 201
Admin02d052c2015-10-10 19:08:26 -0700572
Jonathan Hartf65e1812015-10-05 15:15:37 -0700573 # Create a group
574 test_group_id = 1
575 group_add = createAllGroupAdd(test_group_id, [onu_port])
Admin02d052c2015-10-10 19:08:26 -0700576
577 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700578 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700579 verify_no_errors(self.controller)
580
581 # Create a flow rule matching olt port and vlan id
582 match = ofp.match()
583 match.oxm_list.append(ofp.oxm.in_port(olt_port))
584 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
585
586 request = ofp.message.flow_add(
587 table_id=test_param_get("table", 0),
588 cookie=43,
589 match=match,
590 instructions=[
591 ofp.instruction.apply_actions(
592 actions=[ ofp.action.group( group_id = test_group_id ) ] ),
Jonathan Hartf65e1812015-10-05 15:15:37 -0700593 ],
Admin02d052c2015-10-10 19:08:26 -0700594 buffer_id=ofp.OFP_NO_BUFFER, priority=1000)
595
596 self.controller.message_send(request)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700597 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700598 verify_no_errors(self.controller)
Admin09b5cc62015-10-11 13:53:59 -0700599
600 # It takes some time for flows to propagate down to the data plane
Admindcb1bc72015-11-12 18:24:56 -0800601 time.sleep(10)
Admin02d052c2015-10-10 19:08:26 -0700602
603 inPkt = simple_udp_packet(pktlen=104,dl_vlan_enable=True,
Admindcb1bc72015-11-12 18:24:56 -0800604 vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0, eth_dst="01:01:11:12:11:12")
Admin02d052c2015-10-10 19:08:26 -0700605 outPkt = inPkt
606 self.dataplane.send(olt_port, str(inPkt))
607 verify_packet(self, outPkt, onu_port)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700608
Admindcb1bc72015-11-12 18:24:56 -0800609
Jonathan Hartf65e1812015-10-05 15:15:37 -0700610 # Now put 2 ONU ports in the group and test that the input packet is
611 # duplicated out both ports
612 group_mod = createAllGroupMod(test_group_id, ports=[onu_port, onu_port2])
613 self.controller.message_send(group_mod)
614 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700615 verify_no_errors(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700616
Admin09b5cc62015-10-11 13:53:59 -0700617 # It takes some time for flows to propagate down to the data plane
Admindcb1bc72015-11-12 18:24:56 -0800618 time.sleep(10)
Admin09b5cc62015-10-11 13:53:59 -0700619
Jonathan Hartf65e1812015-10-05 15:15:37 -0700620 self.dataplane.send(olt_port, str(inPkt))
Jonathan Hartf65e1812015-10-05 15:15:37 -0700621 verify_packet(self, outPkt, onu_port2)
Admindcb1bc72015-11-12 18:24:56 -0800622 verify_packet(self, outPkt, onu_port)
623 #verify_packets(self, outPkt, [onu_port,onu_port2])
Admin02d052c2015-10-10 19:08:26 -0700624
Jonathan Hartf65e1812015-10-05 15:15:37 -0700625 # clean up the test
Admin02d052c2015-10-10 19:08:26 -0700626 request = ofp.message.flow_delete( table_id=test_param_get("table", 0))
627 self.controller.message_send(request)
628 group_delete = ofp.message.group_delete(xid = 2, group_id = test_group_id)
629 self.controller.message_send(group_delete)
630
Jonathan Hartf65e1812015-10-05 15:15:37 -0700631 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700632 verify_no_errors(self.controller)
633
Admindcb1bc72015-11-12 18:24:56 -0800634
635class TestGroupModForwarding(base_tests.SimpleDataPlane):
636
637 def runTest(self):
638 logging.info("Running datapath forwarding tests for group mod" )
639 delete_all_flows(self.controller)
640 delete_all_groups(self.controller)
641
642 vlan_id = 201
643
644 # Create a group
645 test_group_id = 1
646 group_add = createAllGroupAdd(test_group_id, [onu_port, onu_port2])
647
648 self.controller.message_send(group_add)
649 do_barrier(self.controller)
650 verify_no_errors(self.controller)
651
652 # Create a flow rule matching olt port and vlan id
653 match = ofp.match()
654 match.oxm_list.append(ofp.oxm.in_port(olt_port))
655 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
656
657 request = ofp.message.flow_add(
658 table_id=test_param_get("table", 0),
659 cookie=43,
660 match=match,
661 instructions=[
662 ofp.instruction.apply_actions(
663 actions=[ ofp.action.group( group_id = test_group_id ) ] ),
664 ],
665 buffer_id=ofp.OFP_NO_BUFFER, priority=1000)
666
667 self.controller.message_send(request)
668 do_barrier(self.controller)
669 verify_no_errors(self.controller)
670
671 # It takes some time for flows to propagate down to the data plane
672 time.sleep(10)
673
674 inPkt = simple_udp_packet(pktlen=104,dl_vlan_enable=True,
675 vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0, eth_dst="01:01:11:12:11:12")
676 outPkt = inPkt
677 self.dataplane.send(olt_port, str(inPkt))
678 verify_packet(self, outPkt, onu_port)
679 #verify_packet(self, outPkt, onu_port2)
680
681 # Now remove onu port 1 from the group and test that the input packet is no longer forwarded to onu port 1
682 group_mod = createAllGroupMod(test_group_id, ports=[onu_port2])
683 self.controller.message_send(group_mod)
684 do_barrier(self.controller)
685 verify_no_errors(self.controller)
686
687 time.sleep(10)
688 self.dataplane.send(olt_port, str(inPkt))
689 verify_no_packet(self, outPkt, onu_port)
690 verify_packet(self, outPkt, onu_port2)
691
692 # Now remove all ports in the group and test that the input packet is no longer forwarded to any port
693 group_mod = createAllGroupMod(test_group_id, ports=[])
694 self.controller.message_send(group_mod)
695 do_barrier(self.controller)
696 verify_no_errors(self.controller)
697 time.sleep(10)
698 self.dataplane.send(olt_port, str(inPkt))
699 verify_packets(self, outPkt, [])
700
701
Admin02d052c2015-10-10 19:08:26 -0700702class TransparentVlanTest(base_tests.SimpleDataPlane):
703
704 def runTest(self):
705 logging.info("Running transparent vlan tests")
Admin09b5cc62015-10-11 13:53:59 -0700706 delete_all_flows(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700707
Jonathan Hartf65e1812015-10-05 15:15:37 -0700708 vlan_id = 201
Admin02d052c2015-10-10 19:08:26 -0700709 match = ofp.match()
710 match.oxm_list.append(ofp.oxm.in_port(onu_port))
711 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id ))
712
713 request = ofp.message.flow_add(
714 table_id=test_param_get("table", 0),
715 cookie=42,
716 match=match,
717 instructions=[
718 ofp.instruction.apply_actions(
719 actions=[
720 ofp.action.output(port=olt_port)]),
721 ],
722 buffer_id=ofp.OFP_NO_BUFFER,
723 priority=1000)
724
725 self.controller.message_send(request)
Admin02d052c2015-10-10 19:08:26 -0700726
727 match = ofp.match()
728 match.oxm_list.append(ofp.oxm.in_port(olt_port))
729 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
730
731 request = ofp.message.flow_add(
732 table_id=test_param_get("table", 0),
733 cookie=43,
734 match=match,
735 instructions=[
736 ofp.instruction.apply_actions(
737 actions=[
738 ofp.action.output(port=onu_port)]),
739 ],
740 buffer_id=ofp.OFP_NO_BUFFER,
741 priority=1000)
742
743 self.controller.message_send(request)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700744 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700745 verify_no_errors(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700746
Admin09b5cc62015-10-11 13:53:59 -0700747 # It takes some time for flows to propagate down to the data plane
748 time.sleep(2)
Admin02d052c2015-10-10 19:08:26 -0700749
Jonathan Hartf65e1812015-10-05 15:15:37 -0700750 inPkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=vlan_id, vlan_pcp=0)
751 # downstream
Admin02d052c2015-10-10 19:08:26 -0700752 self.dataplane.send(olt_port, str(inPkt))
753 verify_packet(self, inPkt, onu_port)
754 # upstream
755 self.dataplane.send(onu_port, str(inPkt))
756 verify_packet(self, inPkt, olt_port)
757
758
Jonathan Hartf65e1812015-10-05 15:15:37 -0700759 # clean up the test
Admin02d052c2015-10-10 19:08:26 -0700760 delete_all_flows(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700761 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700762 verify_no_errors(self.controller)
763
Adminb17b1662015-10-19 15:50:53 -0700764class DoubleVlanTest(base_tests.SimpleDataPlane):
765
766 def runTest(self):
767 logging.info("Running double vlan tests")
768 delete_all_flows(self.controller)
769
770 c_vlan_id = 100
771 s_vlan_id = 102
772 # upstream flow rule
773 match = ofp.match()
774 match.oxm_list.append(ofp.oxm.in_port(onu_port))
Admindcb1bc72015-11-12 18:24:56 -0800775 match.oxm_list.append(ofp.oxm.vlan_vid(value=ofp.OFPVID_PRESENT))
Adminb17b1662015-10-19 15:50:53 -0700776 match.oxm_list.append(ofp.oxm.vlan_pcp(value = 0))
777
778 # push inner vlan (c-vlan) for upstream
779 request = ofp.message.flow_add(
780 table_id=test_param_get("table", 0),
781 cookie=42,
782 match=match,
783 instructions=[
784 ofp.instruction.apply_actions(
785 actions=[
786 ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id)) ] ),
787 ofp.instruction.goto_table(1) ],
788 buffer_id=ofp.OFP_NO_BUFFER,
789 priority=1000)
790
791 self.controller.message_send(request)
792 do_barrier(self.controller)
793 verify_no_errors(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700794
Adminb17b1662015-10-19 15:50:53 -0700795 # push outer vlan (s-vlan) for upstream
796 match = ofp.match()
797 match.oxm_list.append(ofp.oxm.in_port(onu_port))
798 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id))
799 match.oxm_list.append(ofp.oxm.vlan_pcp( 0 ))
800
801 request = ofp.message.flow_add(
802 table_id=test_param_get("table", 1),
803 cookie=43,
804 match=match,
805 instructions=[
806 ofp.instruction.apply_actions(
807 actions=[
Admindcb1bc72015-11-12 18:24:56 -0800808 ofp.action.push_vlan(ethertype=0x88A8),
Adminb17b1662015-10-19 15:50:53 -0700809 ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | s_vlan_id)),
810 ofp.action.set_field(ofp.oxm.vlan_pcp(0)),
811 ofp.action.output(port=olt_port)]),
812 ],
813 buffer_id=ofp.OFP_NO_BUFFER,
814 priority=1000)
815
816 self.controller.message_send(request)
817 do_barrier(self.controller)
818 verify_no_errors(self.controller)
819
820 # strip outer vlan (s-vlan) for downstream
821 match = ofp.match()
822 match.oxm_list.append(ofp.oxm.in_port(olt_port))
823 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | s_vlan_id))
824 match.oxm_list.append(ofp.oxm.vlan_pcp( 0 ))
825 request = ofp.message.flow_add(
826 table_id=test_param_get("table", 0),
827 cookie=44,
828 match=match,
829 instructions=[
830 ofp.instruction.apply_actions(
831 actions=[ ofp.action.pop_vlan() ] ),
832 ofp.instruction.goto_table(1) ],
833 buffer_id=ofp.OFP_NO_BUFFER,
834 priority=1000)
835
836 self.controller.message_send(request)
837 do_barrier(self.controller)
838 verify_no_errors(self.controller)
839
Admindcb1bc72015-11-12 18:24:56 -0800840 # rewrite inner vlan (c-vlan) to default (0) for downstream
Adminb17b1662015-10-19 15:50:53 -0700841 match = ofp.match()
842 match.oxm_list.append(ofp.oxm.in_port(olt_port))
843 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id))
844 match.oxm_list.append(ofp.oxm.vlan_pcp( 0 ))
845
846 request = ofp.message.flow_add(
847 table_id=test_param_get("table", 1),
848 cookie=45,
849 match=match,
850 instructions=[
851 ofp.instruction.apply_actions(
852 actions=[
Admindcb1bc72015-11-12 18:24:56 -0800853 ofp.action.pop_vlan(),
Adminb17b1662015-10-19 15:50:53 -0700854 ofp.action.output(port=onu_port) ] )
855 ],
856 buffer_id=ofp.OFP_NO_BUFFER,
857 priority=1000)
858
859 self.controller.message_send(request)
860 do_barrier(self.controller)
861 verify_no_errors(self.controller)
862 # It takes some time for flows to propagate down to the data plane
863 time.sleep(10)
Admindcb1bc72015-11-12 18:24:56 -0800864 incorrectTagPkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=100, vlan_pcp=0)
Adminb17b1662015-10-19 15:50:53 -0700865 untaggedPkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=0, vlan_pcp=0)
Admindcb1bc72015-11-12 18:24:56 -0800866
867
868 '''
869 FIXME: hack because OLT does _not_ tag packets correctly
870 it ignores the eth_type in the push_vlan action
871 and always slaps on 0x8100 even though the
872 down stream flow must be 0x88a8.
873 '''
Adminb17b1662015-10-19 15:50:53 -0700874 doubleTaggedPkt = double_vlan_udp_packet(pktlen=104, dl_vlan_enable=True,
875 c_vlan_vid=c_vlan_id,
876 s_vlan_vid=s_vlan_id,
Admindcb1bc72015-11-12 18:24:56 -0800877 c_vlan_pcp=0, s_vlan_pcp=0, eth_type=0x88a8)
878
879 upstreamDoubleTaggedPkt = double_vlan_udp_packet(pktlen=104, dl_vlan_enable=True,
880 c_vlan_vid=c_vlan_id,
881 s_vlan_vid=s_vlan_id,
Adminb17b1662015-10-19 15:50:53 -0700882 c_vlan_pcp=0, s_vlan_pcp=0)
Admindcb1bc72015-11-12 18:24:56 -0800883
Adminb17b1662015-10-19 15:50:53 -0700884 # test upstream untagged packet got double tag at OLT
885 logging.info(str(doubleTaggedPkt))
886 self.dataplane.send(onu_port, str(untaggedPkt))
Admindcb1bc72015-11-12 18:24:56 -0800887 verify_packet(self, upstreamDoubleTaggedPkt, olt_port)
888
889 # test downstream doubletagged packet got untagged at ONU
Adminb17b1662015-10-19 15:50:53 -0700890 self.dataplane.send(olt_port, str(doubleTaggedPkt))
891 verify_packet(self, untaggedPkt, onu_port)
Adminb17b1662015-10-19 15:50:53 -0700892
Admindcb1bc72015-11-12 18:24:56 -0800893 # test upstream doubletagged packet got dropped
894 self.dataplane.send(onu_port, str(doubleTaggedPkt))
895 verify_no_packet(self, upstreamDoubleTaggedPkt, olt_port)
896
897 # test downstream untagged packet got dropped at ONU
898 self.dataplane.send(olt_port, str(untaggedPkt))
899 verify_no_packet(self, untaggedPkt, onu_port)
900
901 # test upstream icorrectly tagged packet; should get dropped
902 self.dataplane.send(onu_port, str(incorrectTagPkt))
903 verify_no_packet(self, upstreamDoubleTaggedPkt, olt_port)
904
905 time.sleep(2)
Adminb17b1662015-10-19 15:50:53 -0700906
907 # clean up the test
908 delete_all_flows(self.controller)
909 do_barrier(self.controller)
910 verify_no_errors(self.controller)