blob: 8755857d85c71ece031b493c1297a80c4c3f2cc8 [file] [log] [blame]
macauley1e26c5b2015-07-16 17:27:32 +08001"""
2Flow Test
3
4Test each flow table can set entry, and packet rx correctly.
5"""
6
7import logging
8
9from oftest import config
10import oftest.base_tests as base_tests
11import ofp
12from oftest.testutils import *
13from accton_util import *
14
15class L2McastFlow(base_tests.SimpleDataPlane):
16 """
17 Test output function for an exact-match flow
18
19 Add some multicast flows
20 Then, for all ports, verifies that sending a matching packet
21 to a multicast match results in an output to all ports.
22 """
23 def runTest(self):
24 ports = sorted(config["port_map"].keys())
25
26 delete_all_flows(self.controller)
27 delete_all_groups(self.controller)
28
29 # table 10: vlan
30 # send to table 20
31 add_vlan_table_flow(self.controller, config["port_map"].keys(), 1)
32
33 # group table
34 # set up untag groups for each port
35 add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, False)
36
37 # set up multicast group
38 add_l2_mcast_group(self.controller, config["port_map"].keys(), 1, 1)
39
40 test_macs = [[0x01, 0x00, 0x5e, 0xff, 0xff, 0xff]]
41
42 for test_mac in test_macs:
43 group_id = encode_l2_mcast_group_id(1, 1)
44 add_bridge_flow(self.controller, test_mac, 1, group_id, True)
45
46 for test_mac in test_macs:
47 mactest = ':'.join(['%02X' % x for x in test_mac])
48
49 for in_port in ports:
50 # change dest based on port number
51 parsed_pkt = simple_tcp_packet(eth_dst=mactest)
52 pkt = str(parsed_pkt)
53 logging.info("OutputExact test, from port %d to mac %s", in_port, mactest)
54 self.dataplane.send(in_port, pkt)
55
56 for ofport in ports:
57 if ofport == in_port: #tx port won't rx packet, unless L3 mcast routing
58 continue
59 verify_packet(self, pkt, ofport)
60 verify_no_other_packets(self)
61
62class L2UnicastFlow(base_tests.SimpleDataPlane):
63 """
64 Test output function for an exact-match flow
65
66 For each port A, adds a flow directing matching packets to that port.
67 Then, for all other ports B != A, verifies that sending a matching packet
68 to B results in an output to A.
69 """
70 def runTest(self):
71 ports = sorted(config["port_map"].keys())
72
73 delete_all_flows(self.controller)
74 delete_all_groups(self.controller)
75 # table 10: vlan
76 # send to table 20
77 add_vlan_table_flow(self.controller, config["port_map"].keys(), 1)
78
79 # group table
80 # set up untag groups for each port
81 add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, 1)
82
83 for out_port in ports:
84 group_id = encode_l2_interface_group_id(1, out_port)
85 add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, out_port], 1, group_id, True)
86
87 for in_port in ports:
88 if in_port == out_port:
89 continue
90 # change dest based on port number
91 parsed_pkt = simple_tcp_packet(eth_dst='00:12:34:56:78:%02X' % out_port)
92 pkt = str(parsed_pkt)
93 logging.info("OutputExact test, ports %d to %d", in_port, out_port)
94 self.dataplane.send(in_port, pkt)
95
96 for ofport in ports:
97 if ofport in [out_port]:
98 verify_packet(self, pkt, ofport)
99 else:
100 verify_no_packet(self, pkt, ofport)
101
102 verify_no_other_packets(self)
103
macauley76cc8d22015-07-27 17:40:36 +0800104class L2Flood(base_tests.SimpleDataPlane):
105 """
106 Test L2 unknown unicast flooding and broadcast flood
107 """
108 def runTest(self):
109 ports = sorted(config["port_map"].keys())
110
111 delete_all_flows(self.controller)
112 delete_all_groups(self.controller)
113 # table 10: vlan
114 # send to table 20
115 add_vlan_table_flow(self.controller, ports, 1)
116
117 # group table
118 # set up untag groups for each port
119 add_l2_interface_grouop(self.controller, ports, 1, False, 1)
120
121 input_port = ports.pop()
122 flood_ports= ports
123 print "flood_ports %s"%flood_ports
124 print "input_port %s"%input_port
125 #no fllod group create, veriy all drop
126 parsed_pkt = simple_tcp_packet(eth_dst='00:12:34:56:78:9a')
127 pkt = str(parsed_pkt)
128 self.dataplane.send(input_port, pkt)
129 verify_no_other_packets(self)
130 parsed_pkt = simple_tcp_packet(eth_dst='FF:FF:FF:FF:FF:FF')
131 pkt = str(parsed_pkt)
132 self.dataplane.send(input_port, pkt)
133 verify_no_other_packets(self)
134 #add flood groupo
135 msg=add_l2_flood_group(self.controller, flood_ports, 1, 1)
136 add_bridge_flow(self.controller, None, 1, msg.group_id, True)
137 #verify flood
138 parsed_pkt = simple_tcp_packet(eth_dst='00:12:34:56:78:9a')
139 pkt = str(parsed_pkt)
140 self.dataplane.send(input_port, pkt)
141 for ofport in flood_ports:
142 verify_packet(self, pkt, ofport)
143
144 verify_no_other_packets(self)
145
146 for ofport in flood_ports:
147 self.dataplane.send(ofport, pkt)
148 verify_no_packet(self, pkt, ofport)
149 verify_no_other_packets(self)
150
151 parsed_pkt = simple_tcp_packet(eth_dst='FF:FF:FF:FF:FF:FF')
152 pkt = str(parsed_pkt)
153 self.dataplane.send(input_port, pkt)
154 for ofport in flood_ports:
155 verify_packet(self, pkt, ofport)
156
157
macauley1e26c5b2015-07-16 17:27:32 +0800158class PacketInMiss(base_tests.SimpleDataPlane):
159 """
160 Test packet in function for a table-miss flow
161
162 Send a packet to each dataplane port and verify that a packet
163 in message is received from the controller for each
macauley52950382015-07-17 15:59:01 +0800164
165 NOTE: Verify This case the oft option shall not use --switch-ip
macauley1e26c5b2015-07-16 17:27:32 +0800166 """
167
168 def runTest(self):
169 delete_all_flows(self.controller)
170 delete_all_groups(self.controller)
171
172 parsed_pkt = simple_tcp_packet(pktlen=100)
173 parsed_vlan_pkt = simple_tcp_packet(pktlen=104,
174 vlan_vid=0x1001, dl_vlan_enable=True)
175 pkt = str(parsed_pkt)
176 vlan_pkt = str(parsed_vlan_pkt)
177 # table 10: vlan
178 # send to table 20
179 add_vlan_table_flow(self.controller, config["port_map"].keys(), 1)
180
181 # group table
182 # set up untag groups for each port
183 add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, 1)
184
185 # create match
186 match = ofp.match()
187 match.oxm_list.append(ofp.oxm.vlan_vid(0x1001))
188 request = ofp.message.flow_add(
189 table_id=60,
190 cookie=42,
191 match=match,
192 instructions=[
193 ofp.instruction.apply_actions(
194 actions=[
195 ofp.action.output(
196 port=ofp.OFPP_CONTROLLER,
197 max_len=ofp.OFPCML_NO_BUFFER)]),
198 ],
199 buffer_id=ofp.OFP_NO_BUFFER,
200 priority=1)
201
202 logging.info("Inserting packet in flow to controller")
203 self.controller.message_send(request)
204 do_barrier(self.controller)
205
206 for of_port in config["port_map"].keys():
207 logging.info("PacketInMiss test, port %d", of_port)
208 self.dataplane.send(of_port, pkt)
209
210 #AOS current packet in will not have vlan tag
macauley52950382015-07-17 15:59:01 +0800211 if config["cicada_poject"]:
212 verify_packet_in(self, vlan_pkt, of_port, ofp.OFPR_ACTION)
213 else:
214 verify_packet_in(self, pkt, of_port, ofp.OFPR_ACTION)
215
macauley1e26c5b2015-07-16 17:27:32 +0800216 verify_no_other_packets(self)
217
macauley52950382015-07-17 15:59:01 +0800218class PacketOut(base_tests.SimpleDataPlane):
219 """
220 Verify action Flood, ALL, in port
221 """
222
223 def runTest(self):
224 if config["cicada_poject"]:
225 pass
226
227 delete_all_flows(self.controller)
228 delete_all_groups(self.controller)
229
230 parsed_pkt = simple_tcp_packet(pktlen=100)
231 parsed_vlan_pkt = simple_tcp_packet(pktlen=104,
232 vlan_vid=0x1002, dl_vlan_enable=True)
233
234 pkt = str(parsed_pkt)
235 vlan_pkt = str(parsed_vlan_pkt)
236
237
238 #packet out flood, untag packet
239 self.controller.message_send(ofp.message.packet_out(in_port=ofp.OFPP_CONTROLLER,
240 buffer_id=ofp.OFP_NO_BUFFER,
241 actions=[ofp.action.output(
242 port=ofp.OFPP_FLOOD)],
243 data=pkt))
244
245 for of_port in config["port_map"].keys():
246 verify_packet(self, pkt, of_port)
247
248 verify_no_other_packets(self)
249
250 #packet out flood, tag packet, because it can't identify vlan has which port
251 #so we do as all action.
252 self.controller.message_send(ofp.message.packet_out(in_port=ofp.OFPP_CONTROLLER,
253 buffer_id=ofp.OFP_NO_BUFFER,
254 actions=[ofp.action.output(
255 port=ofp.OFPP_FLOOD)],
256 data=vlan_pkt))
257
258 for of_port in config["port_map"].keys():
259 verify_packet(self, vlan_pkt, of_port)
260
261 verify_no_other_packets(self)
262
263 #packet out all
264 self.controller.message_send(ofp.message.packet_out(in_port=ofp.OFPP_CONTROLLER,
265 buffer_id=ofp.OFP_NO_BUFFER,
266 actions=[ofp.action.output(
267 port=ofp.OFPP_FLOOD)],
268 data=pkt))
269
270 for of_port in config["port_map"].keys():
271 verify_packet(self, pkt, of_port)
272
273 verify_no_other_packets(self)
274
275 #packet out to in port
276 in_port = config["port_map"].keys()[0]
277 self.controller.message_send(ofp.message.packet_out(in_port=in_port,
278 buffer_id=ofp.OFP_NO_BUFFER,
279 actions=[ofp.action.output(
280 port=in_port)],
281 data=pkt))
282
283 verify_packet(self, pkt, in_port)
284 verify_no_other_packets(self)
285
macauleyfa788eb2015-07-23 15:13:54 +0800286class L3UcastRoute(base_tests.SimpleDataPlane):
macauley0c54d3f2015-07-17 18:10:03 +0800287 """
macauley76cc8d22015-07-27 17:40:36 +0800288 Port1(vlan1, 0x00, 0x00, 0x00, 0x22, 0x22, 0x01, 192.168.1.1) ,
289 Port2(vlan2, 0x00, 0x00, 0x00, 0x22, 0x22, 0x02, 19.168.2.1)
macauley0c54d3f2015-07-17 18:10:03 +0800290 """
291 def runTest(self):
292 delete_all_flows(self.controller)
293 delete_all_groups(self.controller)
macauleyfa788eb2015-07-23 15:13:54 +0800294
295 if len(config["port_map"]) <2:
296 logging.info("Port count less than 2, can't run this case")
297 return
298
macauley0c54d3f2015-07-17 18:10:03 +0800299 vlan_id=1
300 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
301 dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
302 dip=0xc0a80001
303 for port in config["port_map"].keys():
304 #add l2 interface group
305 add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
306 dst_mac[5]=vlan_id
307 l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac)
308 #add vlan flow table
309 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
310 #add termination flow
311 add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
312 #add unicast routing flow
313 dst_ip = dip + (vlan_id<<8)
macauleyfa788eb2015-07-23 15:13:54 +0800314 add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, l3_msg.group_id)
macauley0c54d3f2015-07-17 18:10:03 +0800315 vlan_id += 1
316
macauleyfa788eb2015-07-23 15:13:54 +0800317 do_barrier(self.controller)
macauley0c54d3f2015-07-17 18:10:03 +0800318
319 port1=config["port_map"].keys()[0]
320 port2=config["port_map"].keys()[1]
321 #port 1 to port 2
macauleyfa788eb2015-07-23 15:13:54 +0800322 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
macauley0c54d3f2015-07-17 18:10:03 +0800323 dst_mac[5]=1
macauleyfa788eb2015-07-23 15:13:54 +0800324 port1_mac=':'.join(['%02X' % x for x in dst_mac])
macauley0c54d3f2015-07-17 18:10:03 +0800325
326 parsed_pkt = simple_tcp_packet(pktlen=100,
macauleyfa788eb2015-07-23 15:13:54 +0800327 eth_dst=switch_mac,
328 eth_src=port1_mac,
329 ip_ttl=64,
macauley0c54d3f2015-07-17 18:10:03 +0800330 ip_src="192.168.1.1",
331 ip_dst='192.168.2.1')
332 pkt=str(parsed_pkt)
333 self.dataplane.send(port1, pkt)
macauleyfa788eb2015-07-23 15:13:54 +0800334 #build expect packet
335 dst_mac[5]=2
336 port2_mac=':'.join(['%02X' % x for x in dst_mac])
337 exp_pkt = simple_tcp_packet(pktlen=100,
338 eth_dst=port2_mac,
339 eth_src=switch_mac,
340 ip_ttl=63,
341 ip_src="192.168.1.1",
342 ip_dst='192.168.2.1')
343 pkt=str(exp_pkt)
macauley0c54d3f2015-07-17 18:10:03 +0800344 verify_packet(self, pkt, port2)
345 verify_no_other_packets(self)
macauleyfa788eb2015-07-23 15:13:54 +0800346
macauley0c54d3f2015-07-17 18:10:03 +0800347 #port 2 to port 1
macauleyfa788eb2015-07-23 15:13:54 +0800348 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
macauley0c54d3f2015-07-17 18:10:03 +0800349 dst_mac[5]=2
macauleyfa788eb2015-07-23 15:13:54 +0800350 port2_mac=':'.join(['%02X' % x for x in dst_mac])
macauley0c54d3f2015-07-17 18:10:03 +0800351
352 parsed_pkt = simple_tcp_packet(pktlen=100,
macauleyfa788eb2015-07-23 15:13:54 +0800353 eth_dst=switch_mac,
354 eth_src=port2_mac,
355 ip_ttl=64,
macauley0c54d3f2015-07-17 18:10:03 +0800356 ip_src="192.168.2.1",
357 ip_dst='192.168.1.1')
358 pkt=str(parsed_pkt)
359 self.dataplane.send(port2, pkt)
macauleyfa788eb2015-07-23 15:13:54 +0800360 #build expect packet
361 dst_mac[5]=1
362 port1_mac=':'.join(['%02X' % x for x in dst_mac])
363 exp_pkt = simple_tcp_packet(pktlen=100,
364 eth_dst=port1_mac,
365 eth_src=switch_mac,
366 ip_ttl=63,
367 ip_src="192.168.2.1",
368 ip_dst='192.168.1.1')
369 pkt=str(exp_pkt)
370 verify_packet(self, pkt, port1)
371 verify_no_other_packets(self)
macauley76cc8d22015-07-27 17:40:36 +0800372
373
374class L3UcastECMP(base_tests.SimpleDataPlane):
375 """
376 Port1(vlan1, 0x00, 0x00, 0x00, 0x22, 0x22, 0x01, 192.168.1.1) ,
377 Port2(vlan2, 0x00, 0x00, 0x00, 0x22, 0x22, 0x02, 19.168.2.1)
378 """
macauley0c54d3f2015-07-17 18:10:03 +0800379 def runTest(self):
380 delete_all_flows(self.controller)
381 delete_all_groups(self.controller)
macauley76cc8d22015-07-27 17:40:36 +0800382
383 if len(config["port_map"]) <2:
384 logging.info("Port count less than 2, can't run this case")
385 return
macauley0c54d3f2015-07-17 18:10:03 +0800386
macauley76cc8d22015-07-27 17:40:36 +0800387 vlan_id=1
388 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
389 dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
390 dip=0xc0a80001
391 for port in config["port_map"].keys():
392 #add l2 interface group
393 add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
394 dst_mac[5]=vlan_id
395 l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac)
396 ecmp_msg=add_l3_ecmp_group(self.controller, vlan_id, [l3_msg.group_id])
397 #add vlan flow table
398 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
399 #add termination flow
400 add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
401 #add unicast routing flow
402 dst_ip = dip + (vlan_id<<8)
403 #ECMP shall have prefix not 32
404 add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, ecmp_msg.group_id)
405 vlan_id += 1
406
407 do_barrier(self.controller)
408
409 port1=config["port_map"].keys()[0]
410 port2=config["port_map"].keys()[1]
411 #port 1 to port 2
412 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
413 dst_mac[5]=1
414 port1_mac=':'.join(['%02X' % x for x in dst_mac])
macauley52950382015-07-17 15:59:01 +0800415
macauley76cc8d22015-07-27 17:40:36 +0800416 parsed_pkt = simple_tcp_packet(pktlen=100,
417 eth_dst=switch_mac,
418 eth_src=port1_mac,
419 ip_ttl=64,
420 ip_src="192.168.1.1",
421 ip_dst='192.168.2.1')
422 pkt=str(parsed_pkt)
423 self.dataplane.send(port1, pkt)
424 #build expect packet
425 dst_mac[5]=2
426 port2_mac=':'.join(['%02X' % x for x in dst_mac])
427 exp_pkt = simple_tcp_packet(pktlen=100,
428 eth_dst=port2_mac,
429 eth_src=switch_mac,
430 ip_ttl=63,
431 ip_src="192.168.1.1",
432 ip_dst='192.168.2.1')
433 pkt=str(exp_pkt)
434 verify_packet(self, pkt, port2)
435 verify_no_other_packets(self)
macauley52950382015-07-17 15:59:01 +0800436
macauley76cc8d22015-07-27 17:40:36 +0800437 #port 2 to port 1
438 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
439 dst_mac[5]=2
440 port2_mac=':'.join(['%02X' % x for x in dst_mac])
441
442 parsed_pkt = simple_tcp_packet(pktlen=100,
443 eth_dst=switch_mac,
444 eth_src=port2_mac,
445 ip_ttl=64,
446 ip_src="192.168.2.1",
447 ip_dst='192.168.1.1')
448 pkt=str(parsed_pkt)
449 self.dataplane.send(port2, pkt)
450 #build expect packet
451 dst_mac[5]=1
452 port1_mac=':'.join(['%02X' % x for x in dst_mac])
453 exp_pkt = simple_tcp_packet(pktlen=100,
454 eth_dst=port1_mac,
455 eth_src=switch_mac,
456 ip_ttl=63,
457 ip_src="192.168.2.1",
458 ip_dst='192.168.1.1')
459 pkt=str(exp_pkt)
460 verify_packet(self, pkt, port1)
461 verify_no_other_packets(self)
462
463
464class L3McastRoute1(base_tests.SimpleDataPlane):
465 """
466 Mcast routing, From VLAN 1 to VLAN 2
467 """
468 def runTest(self):
469 """
470 port1 (vlan 1)-> port 2 (vlan 2)
471 """
472 delete_all_flows(self.controller)
473 delete_all_groups(self.controller)
474
475 if len(config["port_map"]) <2:
476 logging.info("Port count less than 2, can't run this case")
477 return
478
479 vlan_id =1
480 out_vlan=2
481 in_vlan=1 #macast group vid shall use input vlan diffe from l3 interface use output vlan
482 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
483 intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac])
484 dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01]
485 dst_mac_str=':'.join(['%02X' % x for x in dst_mac])
486 port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11]
487 port1_mac_str=':'.join(['%02X' % x for x in port1_mac])
488 src_ip=0xc0a80101
489 src_ip_str="192.168.1.1"
490 dst_ip=0xe0010101
491 dst_ip_str="224.1.1.1"
492
493 port1=config["port_map"].keys()[0]
494 port2=config["port_map"].keys()[1]
495
496 #add l2 interface group
497 for port in config["port_map"].keys():
498 add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
499 #add vlan flow table
500 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
501 vlan_id +=1
502
503 #add termination flow
504 add_termination_flow(self.controller, port1, 0x0800, [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00], vlan_id)
505
506 #add l3 interface group
507 port2_ucast_msg=add_l3_interface_group(self.controller, port2, out_vlan, 2, intf_src_mac)
508 mcat_group_msg=add_l3_mcast_group(self.controller, in_vlan, 2, [port2_ucast_msg.group_id])
509 add_mcast4_routing_flow(self.controller, in_vlan, src_ip, 0, dst_ip, mcat_group_msg.group_id)
510
511 parsed_pkt = simple_udp_packet(pktlen=100,
512 eth_dst=dst_mac_str,
513 eth_src=port1_mac_str,
514 ip_ttl=64,
515 ip_src=src_ip_str,
516 ip_dst=dst_ip_str)
517 pkt=str(parsed_pkt)
518 self.dataplane.send(port1, pkt)
519 parsed_pkt = simple_udp_packet(pktlen=100,
520 eth_dst=dst_mac_str,
521 eth_src=intf_src_mac_str,
522 ip_ttl=63,
523 ip_src=src_ip_str,
524 ip_dst=dst_ip_str)
525 pkt=str(parsed_pkt)
526 verify_packet(self, pkt, port2)
527 verify_no_other_packets(self)
528
529
530class L3McastRoute2(base_tests.SimpleDataPlane):
531 """
532 Mcast routing, From VLAN 1 to VLAN 2
533 """
534 def runTest(self):
535 """
536 port1 (vlan 1)-> port 2 (vlan 1)
537 """
538 delete_all_flows(self.controller)
539 delete_all_groups(self.controller)
540
541 if len(config["port_map"]) <2:
542 logging.info("Port count less than 2, can't run this case")
543 return
544
545 vlan_id =1
546 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
547 intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac])
548 dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01]
549 dst_mac_str=':'.join(['%02X' % x for x in dst_mac])
550 port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11]
551 port1_mac_str=':'.join(['%02X' % x for x in port1_mac])
552 src_ip=0xc0a80101
553 src_ip_str="192.168.1.1"
554 dst_ip=0xe0010101
555 dst_ip_str="224.1.1.1"
556
557 port1=config["port_map"].keys()[0]
558 port2=config["port_map"].keys()[1]
559
560 #add l2 interface group
561 l2_intf_group_list=[]
562 for port in config["port_map"].keys():
563 l2_intf_gid, msg=add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
564 l2_intf_group_list.append(l2_intf_gid)
565 #add vlan flow table
566 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
567
568 #add termination flow
569 add_termination_flow(self.controller, port1, 0x0800, [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00], vlan_id)
570
571 #add l3 interface group
572 mcat_group_msg=add_l3_mcast_group(self.controller, vlan_id, 2, l2_intf_group_list)
573 add_mcast4_routing_flow(self.controller, vlan_id, src_ip, 0, dst_ip, mcat_group_msg.group_id)
574
575 parsed_pkt = simple_udp_packet(pktlen=100,
576 eth_dst=dst_mac_str,
577 eth_src=port1_mac_str,
578 ip_ttl=64,
579 ip_src=src_ip_str,
580 ip_dst=dst_ip_str)
581 pkt=str(parsed_pkt)
582 self.dataplane.send(port1, pkt)
583 verify_packet(self, pkt, port2)
584 verify_no_other_packets(self)
585
586
587