blob: 4220232ab672f72173e9c3eda5a31b3b6766426e [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
macauley53e64c42015-07-30 14:07:45 +080040 test_macs = [[0x01, 0x00, 0x5e, 0x0f, 0xff, 0xff]]
macauley1e26c5b2015-07-16 17:27:32 +080041
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
macauley53e64c42015-07-30 14:07:45 +0800123
macauley76cc8d22015-07-27 17:40:36 +0800124 #no fllod group create, veriy all drop
125 parsed_pkt = simple_tcp_packet(eth_dst='00:12:34:56:78:9a')
126 pkt = str(parsed_pkt)
127 self.dataplane.send(input_port, pkt)
128 verify_no_other_packets(self)
129 parsed_pkt = simple_tcp_packet(eth_dst='FF:FF:FF:FF:FF:FF')
130 pkt = str(parsed_pkt)
131 self.dataplane.send(input_port, pkt)
132 verify_no_other_packets(self)
133 #add flood groupo
134 msg=add_l2_flood_group(self.controller, flood_ports, 1, 1)
135 add_bridge_flow(self.controller, None, 1, msg.group_id, True)
136 #verify flood
137 parsed_pkt = simple_tcp_packet(eth_dst='00:12:34:56:78:9a')
138 pkt = str(parsed_pkt)
139 self.dataplane.send(input_port, pkt)
140 for ofport in flood_ports:
141 verify_packet(self, pkt, ofport)
142
143 verify_no_other_packets(self)
144
145 for ofport in flood_ports:
146 self.dataplane.send(ofport, pkt)
macauley53e64c42015-07-30 14:07:45 +0800147 #self won't rx packet
macauley76cc8d22015-07-27 17:40:36 +0800148 verify_no_packet(self, pkt, ofport)
macauley53e64c42015-07-30 14:07:45 +0800149 #others will rx packet
150 tmp_ports=[]
151 for tmp in flood_ports:
152 if tmp != ofport:
153 tmp_ports.append(tmp)
154 verify_packets(self, pkt, tmp_ports)
155
macauley76cc8d22015-07-27 17:40:36 +0800156 verify_no_other_packets(self)
157
158 parsed_pkt = simple_tcp_packet(eth_dst='FF:FF:FF:FF:FF:FF')
159 pkt = str(parsed_pkt)
160 self.dataplane.send(input_port, pkt)
161 for ofport in flood_ports:
162 verify_packet(self, pkt, ofport)
163
164
macauley1e26c5b2015-07-16 17:27:32 +0800165class PacketInMiss(base_tests.SimpleDataPlane):
166 """
167 Test packet in function for a table-miss flow
168
169 Send a packet to each dataplane port and verify that a packet
170 in message is received from the controller for each
macauley52950382015-07-17 15:59:01 +0800171
172 NOTE: Verify This case the oft option shall not use --switch-ip
macauley1e26c5b2015-07-16 17:27:32 +0800173 """
174
175 def runTest(self):
176 delete_all_flows(self.controller)
177 delete_all_groups(self.controller)
178
179 parsed_pkt = simple_tcp_packet(pktlen=100)
180 parsed_vlan_pkt = simple_tcp_packet(pktlen=104,
181 vlan_vid=0x1001, dl_vlan_enable=True)
182 pkt = str(parsed_pkt)
183 vlan_pkt = str(parsed_vlan_pkt)
184 # table 10: vlan
185 # send to table 20
186 add_vlan_table_flow(self.controller, config["port_map"].keys(), 1)
187
188 # group table
189 # set up untag groups for each port
190 add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, 1)
191
192 # create match
193 match = ofp.match()
194 match.oxm_list.append(ofp.oxm.vlan_vid(0x1001))
195 request = ofp.message.flow_add(
196 table_id=60,
197 cookie=42,
198 match=match,
199 instructions=[
200 ofp.instruction.apply_actions(
201 actions=[
202 ofp.action.output(
203 port=ofp.OFPP_CONTROLLER,
204 max_len=ofp.OFPCML_NO_BUFFER)]),
205 ],
206 buffer_id=ofp.OFP_NO_BUFFER,
207 priority=1)
208
209 logging.info("Inserting packet in flow to controller")
210 self.controller.message_send(request)
211 do_barrier(self.controller)
212
213 for of_port in config["port_map"].keys():
214 logging.info("PacketInMiss test, port %d", of_port)
215 self.dataplane.send(of_port, pkt)
216
217 #AOS current packet in will not have vlan tag
macauley52950382015-07-17 15:59:01 +0800218 if config["cicada_poject"]:
219 verify_packet_in(self, vlan_pkt, of_port, ofp.OFPR_ACTION)
220 else:
221 verify_packet_in(self, pkt, of_port, ofp.OFPR_ACTION)
222
macauley1e26c5b2015-07-16 17:27:32 +0800223 verify_no_other_packets(self)
224
macauley52950382015-07-17 15:59:01 +0800225class PacketOut(base_tests.SimpleDataPlane):
226 """
227 Verify action Flood, ALL, in port
228 """
229
230 def runTest(self):
231 if config["cicada_poject"]:
232 pass
233
234 delete_all_flows(self.controller)
235 delete_all_groups(self.controller)
236
237 parsed_pkt = simple_tcp_packet(pktlen=100)
238 parsed_vlan_pkt = simple_tcp_packet(pktlen=104,
239 vlan_vid=0x1002, dl_vlan_enable=True)
240
241 pkt = str(parsed_pkt)
242 vlan_pkt = str(parsed_vlan_pkt)
243
244
245 #packet out flood, untag packet
246 self.controller.message_send(ofp.message.packet_out(in_port=ofp.OFPP_CONTROLLER,
247 buffer_id=ofp.OFP_NO_BUFFER,
248 actions=[ofp.action.output(
249 port=ofp.OFPP_FLOOD)],
250 data=pkt))
251
252 for of_port in config["port_map"].keys():
253 verify_packet(self, pkt, of_port)
254
255 verify_no_other_packets(self)
256
257 #packet out flood, tag packet, because it can't identify vlan has which port
258 #so we do as all action.
259 self.controller.message_send(ofp.message.packet_out(in_port=ofp.OFPP_CONTROLLER,
260 buffer_id=ofp.OFP_NO_BUFFER,
261 actions=[ofp.action.output(
262 port=ofp.OFPP_FLOOD)],
263 data=vlan_pkt))
264
265 for of_port in config["port_map"].keys():
266 verify_packet(self, vlan_pkt, of_port)
267
268 verify_no_other_packets(self)
269
270 #packet out all
271 self.controller.message_send(ofp.message.packet_out(in_port=ofp.OFPP_CONTROLLER,
272 buffer_id=ofp.OFP_NO_BUFFER,
273 actions=[ofp.action.output(
274 port=ofp.OFPP_FLOOD)],
275 data=pkt))
276
277 for of_port in config["port_map"].keys():
278 verify_packet(self, pkt, of_port)
279
280 verify_no_other_packets(self)
281
282 #packet out to in port
283 in_port = config["port_map"].keys()[0]
284 self.controller.message_send(ofp.message.packet_out(in_port=in_port,
285 buffer_id=ofp.OFP_NO_BUFFER,
286 actions=[ofp.action.output(
287 port=in_port)],
288 data=pkt))
289
290 verify_packet(self, pkt, in_port)
291 verify_no_other_packets(self)
292
macauleyfa788eb2015-07-23 15:13:54 +0800293class L3UcastRoute(base_tests.SimpleDataPlane):
macauley0c54d3f2015-07-17 18:10:03 +0800294 """
macauley76cc8d22015-07-27 17:40:36 +0800295 Port1(vlan1, 0x00, 0x00, 0x00, 0x22, 0x22, 0x01, 192.168.1.1) ,
296 Port2(vlan2, 0x00, 0x00, 0x00, 0x22, 0x22, 0x02, 19.168.2.1)
macauley0c54d3f2015-07-17 18:10:03 +0800297 """
298 def runTest(self):
299 delete_all_flows(self.controller)
300 delete_all_groups(self.controller)
macauleyfa788eb2015-07-23 15:13:54 +0800301
302 if len(config["port_map"]) <2:
303 logging.info("Port count less than 2, can't run this case")
304 return
305
macauley0c54d3f2015-07-17 18:10:03 +0800306 vlan_id=1
307 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
308 dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
309 dip=0xc0a80001
310 for port in config["port_map"].keys():
311 #add l2 interface group
312 add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
313 dst_mac[5]=vlan_id
314 l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac)
315 #add vlan flow table
316 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
317 #add termination flow
318 add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
319 #add unicast routing flow
320 dst_ip = dip + (vlan_id<<8)
macauleyfa788eb2015-07-23 15:13:54 +0800321 add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, l3_msg.group_id)
macauley0c54d3f2015-07-17 18:10:03 +0800322 vlan_id += 1
323
macauleyfa788eb2015-07-23 15:13:54 +0800324 do_barrier(self.controller)
macauley0c54d3f2015-07-17 18:10:03 +0800325
326 port1=config["port_map"].keys()[0]
327 port2=config["port_map"].keys()[1]
328 #port 1 to port 2
macauleyfa788eb2015-07-23 15:13:54 +0800329 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
macauley0c54d3f2015-07-17 18:10:03 +0800330 dst_mac[5]=1
macauleyfa788eb2015-07-23 15:13:54 +0800331 port1_mac=':'.join(['%02X' % x for x in dst_mac])
macauley0c54d3f2015-07-17 18:10:03 +0800332
333 parsed_pkt = simple_tcp_packet(pktlen=100,
macauleyfa788eb2015-07-23 15:13:54 +0800334 eth_dst=switch_mac,
335 eth_src=port1_mac,
336 ip_ttl=64,
macauley0c54d3f2015-07-17 18:10:03 +0800337 ip_src="192.168.1.1",
338 ip_dst='192.168.2.1')
339 pkt=str(parsed_pkt)
340 self.dataplane.send(port1, pkt)
macauleyfa788eb2015-07-23 15:13:54 +0800341 #build expect packet
342 dst_mac[5]=2
343 port2_mac=':'.join(['%02X' % x for x in dst_mac])
344 exp_pkt = simple_tcp_packet(pktlen=100,
345 eth_dst=port2_mac,
346 eth_src=switch_mac,
347 ip_ttl=63,
348 ip_src="192.168.1.1",
349 ip_dst='192.168.2.1')
350 pkt=str(exp_pkt)
macauley0c54d3f2015-07-17 18:10:03 +0800351 verify_packet(self, pkt, port2)
352 verify_no_other_packets(self)
macauleyfa788eb2015-07-23 15:13:54 +0800353
macauley0c54d3f2015-07-17 18:10:03 +0800354 #port 2 to port 1
macauleyfa788eb2015-07-23 15:13:54 +0800355 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
macauley0c54d3f2015-07-17 18:10:03 +0800356 dst_mac[5]=2
macauleyfa788eb2015-07-23 15:13:54 +0800357 port2_mac=':'.join(['%02X' % x for x in dst_mac])
macauley0c54d3f2015-07-17 18:10:03 +0800358
359 parsed_pkt = simple_tcp_packet(pktlen=100,
macauleyfa788eb2015-07-23 15:13:54 +0800360 eth_dst=switch_mac,
361 eth_src=port2_mac,
362 ip_ttl=64,
macauley0c54d3f2015-07-17 18:10:03 +0800363 ip_src="192.168.2.1",
364 ip_dst='192.168.1.1')
365 pkt=str(parsed_pkt)
366 self.dataplane.send(port2, pkt)
macauleyfa788eb2015-07-23 15:13:54 +0800367 #build expect packet
368 dst_mac[5]=1
369 port1_mac=':'.join(['%02X' % x for x in dst_mac])
370 exp_pkt = simple_tcp_packet(pktlen=100,
371 eth_dst=port1_mac,
372 eth_src=switch_mac,
373 ip_ttl=63,
374 ip_src="192.168.2.1",
375 ip_dst='192.168.1.1')
376 pkt=str(exp_pkt)
377 verify_packet(self, pkt, port1)
378 verify_no_other_packets(self)
macauley76cc8d22015-07-27 17:40:36 +0800379
380
381class L3UcastECMP(base_tests.SimpleDataPlane):
382 """
383 Port1(vlan1, 0x00, 0x00, 0x00, 0x22, 0x22, 0x01, 192.168.1.1) ,
384 Port2(vlan2, 0x00, 0x00, 0x00, 0x22, 0x22, 0x02, 19.168.2.1)
385 """
macauley0c54d3f2015-07-17 18:10:03 +0800386 def runTest(self):
387 delete_all_flows(self.controller)
388 delete_all_groups(self.controller)
macauley76cc8d22015-07-27 17:40:36 +0800389
390 if len(config["port_map"]) <2:
391 logging.info("Port count less than 2, can't run this case")
392 return
macauley0c54d3f2015-07-17 18:10:03 +0800393
macauley76cc8d22015-07-27 17:40:36 +0800394 vlan_id=1
395 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
396 dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
397 dip=0xc0a80001
398 for port in config["port_map"].keys():
399 #add l2 interface group
400 add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
401 dst_mac[5]=vlan_id
402 l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac)
403 ecmp_msg=add_l3_ecmp_group(self.controller, vlan_id, [l3_msg.group_id])
404 #add vlan flow table
405 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
406 #add termination flow
407 add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
408 #add unicast routing flow
409 dst_ip = dip + (vlan_id<<8)
410 #ECMP shall have prefix not 32
411 add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, ecmp_msg.group_id)
412 vlan_id += 1
413
414 do_barrier(self.controller)
415
416 port1=config["port_map"].keys()[0]
417 port2=config["port_map"].keys()[1]
418 #port 1 to port 2
419 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
420 dst_mac[5]=1
421 port1_mac=':'.join(['%02X' % x for x in dst_mac])
macauley52950382015-07-17 15:59:01 +0800422
macauley76cc8d22015-07-27 17:40:36 +0800423 parsed_pkt = simple_tcp_packet(pktlen=100,
424 eth_dst=switch_mac,
425 eth_src=port1_mac,
426 ip_ttl=64,
427 ip_src="192.168.1.1",
428 ip_dst='192.168.2.1')
429 pkt=str(parsed_pkt)
430 self.dataplane.send(port1, pkt)
431 #build expect packet
432 dst_mac[5]=2
433 port2_mac=':'.join(['%02X' % x for x in dst_mac])
434 exp_pkt = simple_tcp_packet(pktlen=100,
435 eth_dst=port2_mac,
436 eth_src=switch_mac,
437 ip_ttl=63,
438 ip_src="192.168.1.1",
439 ip_dst='192.168.2.1')
440 pkt=str(exp_pkt)
441 verify_packet(self, pkt, port2)
442 verify_no_other_packets(self)
macauley52950382015-07-17 15:59:01 +0800443
macauley76cc8d22015-07-27 17:40:36 +0800444 #port 2 to port 1
445 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
446 dst_mac[5]=2
447 port2_mac=':'.join(['%02X' % x for x in dst_mac])
448
449 parsed_pkt = simple_tcp_packet(pktlen=100,
450 eth_dst=switch_mac,
451 eth_src=port2_mac,
452 ip_ttl=64,
453 ip_src="192.168.2.1",
454 ip_dst='192.168.1.1')
455 pkt=str(parsed_pkt)
456 self.dataplane.send(port2, pkt)
457 #build expect packet
458 dst_mac[5]=1
459 port1_mac=':'.join(['%02X' % x for x in dst_mac])
460 exp_pkt = simple_tcp_packet(pktlen=100,
461 eth_dst=port1_mac,
462 eth_src=switch_mac,
463 ip_ttl=63,
464 ip_src="192.168.2.1",
465 ip_dst='192.168.1.1')
466 pkt=str(exp_pkt)
467 verify_packet(self, pkt, port1)
468 verify_no_other_packets(self)
469
470
471class L3McastRoute1(base_tests.SimpleDataPlane):
472 """
473 Mcast routing, From VLAN 1 to VLAN 2
474 """
475 def runTest(self):
476 """
477 port1 (vlan 1)-> port 2 (vlan 2)
478 """
479 delete_all_flows(self.controller)
480 delete_all_groups(self.controller)
481
482 if len(config["port_map"]) <2:
483 logging.info("Port count less than 2, can't run this case")
484 return
485
486 vlan_id =1
487 out_vlan=2
488 in_vlan=1 #macast group vid shall use input vlan diffe from l3 interface use output vlan
489 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
490 intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac])
491 dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01]
492 dst_mac_str=':'.join(['%02X' % x for x in dst_mac])
493 port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11]
494 port1_mac_str=':'.join(['%02X' % x for x in port1_mac])
495 src_ip=0xc0a80101
496 src_ip_str="192.168.1.1"
497 dst_ip=0xe0010101
498 dst_ip_str="224.1.1.1"
499
500 port1=config["port_map"].keys()[0]
501 port2=config["port_map"].keys()[1]
502
503 #add l2 interface group
504 for port in config["port_map"].keys():
505 add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
506 #add vlan flow table
507 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
508 vlan_id +=1
509
510 #add termination flow
511 add_termination_flow(self.controller, port1, 0x0800, [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00], vlan_id)
512
513 #add l3 interface group
514 port2_ucast_msg=add_l3_interface_group(self.controller, port2, out_vlan, 2, intf_src_mac)
515 mcat_group_msg=add_l3_mcast_group(self.controller, in_vlan, 2, [port2_ucast_msg.group_id])
516 add_mcast4_routing_flow(self.controller, in_vlan, src_ip, 0, dst_ip, mcat_group_msg.group_id)
517
518 parsed_pkt = simple_udp_packet(pktlen=100,
519 eth_dst=dst_mac_str,
520 eth_src=port1_mac_str,
521 ip_ttl=64,
522 ip_src=src_ip_str,
523 ip_dst=dst_ip_str)
524 pkt=str(parsed_pkt)
525 self.dataplane.send(port1, pkt)
526 parsed_pkt = simple_udp_packet(pktlen=100,
527 eth_dst=dst_mac_str,
528 eth_src=intf_src_mac_str,
529 ip_ttl=63,
530 ip_src=src_ip_str,
531 ip_dst=dst_ip_str)
532 pkt=str(parsed_pkt)
533 verify_packet(self, pkt, port2)
534 verify_no_other_packets(self)
535
536
537class L3McastRoute2(base_tests.SimpleDataPlane):
538 """
539 Mcast routing, From VLAN 1 to VLAN 2
540 """
541 def runTest(self):
542 """
543 port1 (vlan 1)-> port 2 (vlan 1)
544 """
545 delete_all_flows(self.controller)
546 delete_all_groups(self.controller)
547
548 if len(config["port_map"]) <2:
549 logging.info("Port count less than 2, can't run this case")
550 return
551
552 vlan_id =1
553 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
554 intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac])
555 dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01]
556 dst_mac_str=':'.join(['%02X' % x for x in dst_mac])
557 port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11]
558 port1_mac_str=':'.join(['%02X' % x for x in port1_mac])
559 src_ip=0xc0a80101
560 src_ip_str="192.168.1.1"
561 dst_ip=0xe0010101
562 dst_ip_str="224.1.1.1"
563
564 port1=config["port_map"].keys()[0]
565 port2=config["port_map"].keys()[1]
566
567 #add l2 interface group
568 l2_intf_group_list=[]
569 for port in config["port_map"].keys():
570 l2_intf_gid, msg=add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
571 l2_intf_group_list.append(l2_intf_gid)
572 #add vlan flow table
573 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
574
575 #add termination flow
576 add_termination_flow(self.controller, port1, 0x0800, [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00], vlan_id)
577
578 #add l3 interface group
579 mcat_group_msg=add_l3_mcast_group(self.controller, vlan_id, 2, l2_intf_group_list)
580 add_mcast4_routing_flow(self.controller, vlan_id, src_ip, 0, dst_ip, mcat_group_msg.group_id)
581
582 parsed_pkt = simple_udp_packet(pktlen=100,
583 eth_dst=dst_mac_str,
584 eth_src=port1_mac_str,
585 ip_ttl=64,
586 ip_src=src_ip_str,
587 ip_dst=dst_ip_str)
588 pkt=str(parsed_pkt)
589 self.dataplane.send(port1, pkt)
590 verify_packet(self, pkt, port2)
591 verify_no_other_packets(self)
592
593
594