blob: 89cd88f94c9dbba34df53b9c5b738ae860dba63e [file] [log] [blame]
Flavio Castro05d20bc2015-11-16 15:06:14 -05001"""
Flavio Castroc36621e2015-12-08 12:57:07 -05002The following tests are being done here
Flavio Castro3aec8902015-11-20 10:51:38 -050031) PacketInSrcMacMiss
castroflavio9e715f32015-12-08 14:04:12 -050042) VlanSupport
53) L2FloodQinQ
64) L2FloodTagged
75) L2Flood Tagged Unknown Src
86) L2 Unicast Tagged
97) MTU 1500
108) MTU 4100
119) MTU 4500
1210) L3UnicastTagged
1311) L3VPNMPLS
1412) MPLS Termination
Flavio Castro05d20bc2015-11-16 15:06:14 -050015"""
16
Flavio Castro05d20bc2015-11-16 15:06:14 -050017from oftest import config
Flavio Castro167f5bd2015-12-02 19:33:53 -050018import logging
19import oftest.base_tests as base_tests
Flavio Castro05d20bc2015-11-16 15:06:14 -050020import ofp
21from oftest.testutils import *
22from accton_util import *
Flavio Castrod8f8af22015-12-02 18:19:26 -050023
Flavio Castro05d20bc2015-11-16 15:06:14 -050024
Flavio Castroaabb5792015-11-18 19:03:50 -050025class PacketInSrcMacMiss(base_tests.SimpleDataPlane):
26 """
27 Test packet in function on a src-mac miss
28 Send a packet to each dataplane port and verify that a packet
29 in message is received from the controller for each
30 #todo verify you stop receiving after adding rule
31 """
32
Flavio Castro6efe1862015-11-18 16:28:06 -050033 def runTest(self):
34 delete_all_flows(self.controller)
35 delete_all_groups(self.controller)
36
Flavio Castro34352e72015-12-07 20:01:51 -050037 ports = sorted(config["port_map"].keys())
38 for port in ports:
castroflaviodd171472015-12-08 13:55:58 -050039 add_one_l2_interface_group(self.controller, port, 1, True, False)
Flavio Castro34352e72015-12-07 20:01:51 -050040 add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG)
41
Flavio Castroaabb5792015-11-18 19:03:50 -050042 parsed_vlan_pkt = simple_tcp_packet(pktlen=104,
43 vlan_vid=0x1001, dl_vlan_enable=True)
44 vlan_pkt = str(parsed_vlan_pkt)
Flavio Castro6efe1862015-11-18 16:28:06 -050045
Flavio Castroaabb5792015-11-18 19:03:50 -050046 for of_port in config["port_map"].keys():
47 logging.info("PacketInMiss test, port %d", of_port)
48 self.dataplane.send(of_port, vlan_pkt)
49
50 verify_packet_in(self, vlan_pkt, of_port, ofp.OFPR_NO_MATCH)
51
52 verify_no_other_packets(self)
53
Flavio Castro6d498522015-12-15 14:05:04 -050054class PacketInMiss(base_tests.SimpleDataPlane):
55 """
56 Test packet in function for a table-miss flow
57 Send a packet to each dataplane port and verify that a packet
58 in message is received from the controller for each
59
60 NOTE: Verify This case the oft option shall not use --switch-ip
61 """
62
63 def runTest(self):
64 delete_all_flows(self.controller)
65 delete_all_groups(self.controller)
66
67 parsed_vlan_pkt = simple_udp_packet(pktlen=104,
68 vlan_vid=0x1001, dl_vlan_enable=True)
69 vlan_pkt = str(parsed_vlan_pkt)
70 ports = sorted(config["port_map"].keys())
71 for port in ports:
72 add_one_l2_interface_group(self.controller, port, 1, True, False)
73 add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG)
74
75 # create match
76 match = ofp.match()
77 match.oxm_list.append(ofp.oxm.eth_type(0x0800))
78 match.oxm_list.append(ofp.oxm.ip_proto(17))
79 request = ofp.message.flow_add(
80 table_id=60,
81 cookie=42,
82 match=match,
83 instructions=[
84 ofp.instruction.apply_actions(
85 actions=[
86 ofp.action.output(
87 port=ofp.OFPP_CONTROLLER,
88 max_len=ofp.OFPCML_NO_BUFFER)]),
89 ],
90 buffer_id=ofp.OFP_NO_BUFFER,
91 priority=1)
92
93 logging.info("Inserting packet in flow to controller")
94 self.controller.message_send(request)
95 do_barrier(self.controller)
96
97 for of_port in config["port_map"].keys():
98 logging.info("PacketInMiss test, port %d", of_port)
99 self.dataplane.send(of_port, vlan_pkt)
100
101 verify_packet_in(self, vlan_pkt, of_port, ofp.OFPR_ACTION)
102
103 verify_no_other_packets(self)
104
Flavio Castro1b5c21d2015-12-08 12:41:56 -0500105class L2FloodQinQ(base_tests.SimpleDataPlane):
106 """
Flavio Castroc36621e2015-12-08 12:57:07 -0500107 Test L2 flood of double tagged vlan packets (802.1Q)
108 Sends a double tagged packet and verifies flooding behavior according to outer vlan
Flavio Castro1b5c21d2015-12-08 12:41:56 -0500109 """
110 def runTest(self):
111 ports = sorted(config["port_map"].keys())
112
113 delete_all_flows(self.controller)
114 delete_all_groups(self.controller)
115
116 # Installing flows to avoid packet-in
117 for port in ports:
castroflaviodd171472015-12-08 13:55:58 -0500118 add_one_l2_interface_group(self.controller, port, 1, True, False)
Flavio Castro1b5c21d2015-12-08 12:41:56 -0500119 add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG)
120
121 group_id = encode_l2_interface_group_id(1, port)
122 add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True)
123 msg=add_l2_flood_group(self.controller, ports, 1, 1)
124 add_bridge_flow(self.controller, None, 1, msg.group_id, True)
125 do_barrier(self.controller)
126
127 #verify flood
128 for ofport in ports:
129 # change dest based on port number
130 mac_src= '00:12:34:56:78:%02X' % ofport
131 parsed_pkt = simple_tcp_packet_two_vlan(pktlen=108, out_dl_vlan_enable=True, out_vlan_vid=1,
132 in_dl_vlan_enable=True, in_vlan_vid=10, eth_dst='00:12:34:56:78:9a', eth_src=mac_src)
133 pkt = str(parsed_pkt)
134 self.dataplane.send(ofport, pkt)
135 #self won't rx packet
136 verify_no_packet(self, pkt, ofport)
137 #others will rx packet
138 tmp_ports=list(ports)
139 tmp_ports.remove(ofport)
140 verify_packets(self, pkt, tmp_ports)
141
142 verify_no_other_packets(self)
143
144
Flavio Castro184cefe2015-11-19 20:52:49 -0500145class L2FloodTagged(base_tests.SimpleDataPlane):
146 """
147 Test L2 flood to a vlan
148 Send a packet with unknown dst_mac and check if the packet is flooded to all ports except inport
149 #todo take in account unknown src
150 """
151 def runTest(self):
152 ports = sorted(config["port_map"].keys())
Flavio Castro34352e72015-12-07 20:01:51 -0500153
Flavio Castro184cefe2015-11-19 20:52:49 -0500154 delete_all_flows(self.controller)
155 delete_all_groups(self.controller)
156
Flavio Castro184cefe2015-11-19 20:52:49 -0500157 # Installing flows to avoid packet-in
158 for port in ports:
castroflaviodd171472015-12-08 13:55:58 -0500159 add_one_l2_interface_group(self.controller, port, 1, True, False)
Flavio Castro34352e72015-12-07 20:01:51 -0500160 add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG)
161
Flavio Castro184cefe2015-11-19 20:52:49 -0500162 group_id = encode_l2_interface_group_id(1, port)
163 add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True)
Flavio Castro34352e72015-12-07 20:01:51 -0500164 msg=add_l2_flood_group(self.controller, ports, 1, 1)
165 add_bridge_flow(self.controller, None, 1, msg.group_id, True)
Flavio Castro184cefe2015-11-19 20:52:49 -0500166 do_barrier(self.controller)
167
168 #verify flood
169 for ofport in ports:
170 # change dest based on port number
171 mac_src= '00:12:34:56:78:%02X' % ofport
172 parsed_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=1, eth_dst='00:12:34:56:78:9a', eth_src=mac_src)
173 pkt = str(parsed_pkt)
174 self.dataplane.send(ofport, pkt)
175 #self won't rx packet
176 verify_no_packet(self, pkt, ofport)
177 #others will rx packet
178 tmp_ports=list(ports)
179 tmp_ports.remove(ofport)
180 verify_packets(self, pkt, tmp_ports)
181
182 verify_no_other_packets(self)
183
Flavio Castroaabb5792015-11-18 19:03:50 -0500184class L2FloodTaggedUnknownSrc(base_tests.SimpleDataPlane):
185 """
186 Test L2 flood to a vlan
187 Send a packet with unknown dst_mac and check if the packet is flooded to all ports except inport
188 #todo take in account unknown src
189 """
190 def runTest(self):
Flavio Castroaabb5792015-11-18 19:03:50 -0500191 delete_all_flows(self.controller)
192 delete_all_groups(self.controller)
193
Flavio Castro34352e72015-12-07 20:01:51 -0500194 ports = sorted(config["port_map"].keys())
195 for port in ports:
castroflaviodd171472015-12-08 13:55:58 -0500196 add_one_l2_interface_group(self.controller, port, 1, True, False)
Flavio Castro34352e72015-12-07 20:01:51 -0500197 add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG)
Flavio Castroaabb5792015-11-18 19:03:50 -0500198
199 msg=add_l2_flood_group(self.controller, ports, 1, 1)
200 add_bridge_flow(self.controller, None, 1, msg.group_id, True)
201
202 parsed_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=1, eth_dst='00:12:34:56:78:9a')
203 pkt = str(parsed_pkt)
204 #verify flood
205 for ofport in ports:
206 self.dataplane.send(ofport, pkt)
207 #self won't rx packet
208 verify_no_packet(self, pkt, ofport)
209 #others will rx packet
210 tmp_ports=list(ports)
211 tmp_ports.remove(ofport)
212 verify_packets(self, pkt, tmp_ports)
213
214 verify_no_other_packets(self)
215
Flavio Castroaabb5792015-11-18 19:03:50 -0500216class L2UnicastTagged(base_tests.SimpleDataPlane):
217 """
218 Test output function for an exact-match flow
219
220 For each port A, adds a flow directing matching packets to that port.
221 Then, for all other ports B != A, verifies that sending a matching packet
222 to B results in an output to A.
223 """
224 def runTest(self):
225 ports = sorted(config["port_map"].keys())
226
227 delete_all_flows(self.controller)
228 delete_all_groups(self.controller)
229
Flavio Castroaabb5792015-11-18 19:03:50 -0500230 for port in ports:
castroflaviodd171472015-12-08 13:55:58 -0500231 add_one_l2_interface_group(self.controller, port, 1, True, False)
Flavio Castro34352e72015-12-07 20:01:51 -0500232 add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG)
Flavio Castroaabb5792015-11-18 19:03:50 -0500233 group_id = encode_l2_interface_group_id(1, port)
234 add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True)
Flavio Castro6efe1862015-11-18 16:28:06 -0500235 do_barrier(self.controller)
236
Flavio Castroaabb5792015-11-18 19:03:50 -0500237 for out_port in ports:
238 # change dest based on port number
239 mac_dst= '00:12:34:56:78:%02X' % out_port
240 for in_port in ports:
241 if in_port == out_port:
242 continue
243 # change source based on port number to avoid packet-ins from learning
244 mac_src= '00:12:34:56:78:%02X' % in_port
245 parsed_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=1, eth_dst=mac_dst, eth_src=mac_src)
246 pkt = str(parsed_pkt)
247 self.dataplane.send(in_port, pkt)
248
249 for ofport in ports:
250 if ofport in [out_port]:
251 verify_packet(self, pkt, ofport)
252 else:
253 verify_no_packet(self, pkt, ofport)
254
255 verify_no_other_packets(self)
Flavio Castro6efe1862015-11-18 16:28:06 -0500256
Flavio Castrob6773032015-11-19 22:49:24 -0500257class Mtu1500(base_tests.SimpleDataPlane):
258
259 def runTest(self):
260 ports = sorted(config["port_map"].keys())
261
262 delete_all_flows(self.controller)
263 delete_all_groups(self.controller)
264
Flavio Castro34352e72015-12-07 20:01:51 -0500265 # set up tag groups for each port
Flavio Castrod4c44d12015-12-08 14:44:18 -0500266 add_l2_interface_group(self.controller, ports, 1, True, 1)
Flavio Castrob6773032015-11-19 22:49:24 -0500267
Flavio Castro34352e72015-12-07 20:01:51 -0500268 add_vlan_table_flow(self.controller, ports)
Flavio Castrob6773032015-11-19 22:49:24 -0500269
270 for port in ports:
castroflaviodd171472015-12-08 13:55:58 -0500271 add_one_l2_interface_group(self.controller, port, 1, True, False)
Flavio Castro34352e72015-12-07 20:01:51 -0500272 add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG)
Flavio Castrob6773032015-11-19 22:49:24 -0500273 group_id = encode_l2_interface_group_id(1, port)
274 add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True)
275 do_barrier(self.controller)
276
277 for out_port in ports:
278 # change dest based on port number
279 mac_dst= '00:12:34:56:78:%02X' % out_port
280 for in_port in ports:
281 if in_port == out_port:
282 continue
283 # change source based on port number to avoid packet-ins from learning
284 mac_src= '00:12:34:56:78:%02X' % in_port
285 parsed_pkt = simple_tcp_packet(pktlen=1500,dl_vlan_enable=True, vlan_vid=1, eth_dst=mac_dst, eth_src=mac_src)
286 pkt = str(parsed_pkt)
287 self.dataplane.send(in_port, pkt)
288
289 for ofport in ports:
290 if ofport in [out_port]:
291 verify_packet(self, pkt, ofport)
292 else:
293 verify_no_packet(self, pkt, ofport)
294
295 verify_no_other_packets(self)
296
297
298class Mtu4000(base_tests.SimpleDataPlane):
299 """
300 Test output function for an exact-match flow
301 For each port A, adds a flow directing matching packets to that port.
302 Then, for all other ports B != A, verifies that sending a matching packet
303 to B results in an output to A.
304 """
305 def runTest(self):
306 ports = sorted(config["port_map"].keys())
307
308 delete_all_flows(self.controller)
309 delete_all_groups(self.controller)
310
311 add_vlan_table_flow(self.controller, config["port_map"].keys())
312
313 # set up tag groups for each port
Flavio Castrod4c44d12015-12-08 14:44:18 -0500314 add_l2_interface_group(self.controller, config["port_map"].keys(), 1, True, 1)
Flavio Castrob6773032015-11-19 22:49:24 -0500315
316 for port in ports:
castroflaviodd171472015-12-08 13:55:58 -0500317 add_one_l2_interface_group(self.controller, port, 1, True, False)
Flavio Castro34352e72015-12-07 20:01:51 -0500318 add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG)
Flavio Castrob6773032015-11-19 22:49:24 -0500319 group_id = encode_l2_interface_group_id(1, port)
320 add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True)
321 do_barrier(self.controller)
322
323 for out_port in ports:
324 # change dest based on port number
325 mac_dst= '00:12:34:56:78:%02X' % out_port
326 for in_port in ports:
327 if in_port == out_port:
328 continue
329 # change source based on port number to avoid packet-ins from learning
330 mac_src= '00:12:34:56:78:%02X' % in_port
331 parsed_pkt = simple_tcp_packet(pktlen=4000,dl_vlan_enable=True, vlan_vid=1, eth_dst=mac_dst, eth_src=mac_src)
332 pkt = str(parsed_pkt)
333 self.dataplane.send(in_port, pkt)
334
335 for ofport in ports:
336 if ofport in [out_port]:
337 verify_packet(self, pkt, ofport)
338 else:
339 verify_no_packet(self, pkt, ofport)
340
341 verify_no_other_packets(self)
Flavio Castroaabb5792015-11-18 19:03:50 -0500342
343class L3UcastTagged(base_tests.SimpleDataPlane):
Flavio Castro05d20bc2015-11-16 15:06:14 -0500344 """
Flavio Castro35e64392015-12-02 16:53:14 -0500345 Port1(vid=in_port, src=00:00:00:22:22:in_port, 192.168.outport.1) ,
346 Port2(vid=outport, dst=00:00:00:22:22:outport, 192.168.outport.1)
Flavio Castro05d20bc2015-11-16 15:06:14 -0500347 """
Flavio Castrod8f8af22015-12-02 18:19:26 -0500348 def runTest(self):
Flavio Castro05d20bc2015-11-16 15:06:14 -0500349 delete_all_flows(self.controller)
350 delete_all_groups(self.controller)
351
352 if len(config["port_map"]) <2:
353 logging.info("Port count less than 2, can't run this case")
354 return
Flavio Castrod8f8af22015-12-02 18:19:26 -0500355
Flavio Castro05d20bc2015-11-16 15:06:14 -0500356 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
357 dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
358 dip=0xc0a80001
Flavio Castroa8233862015-12-02 14:41:11 -0500359 ports = config["port_map"].keys()
360 for port in ports:
Flavio Castro05d20bc2015-11-16 15:06:14 -0500361 #add l2 interface group
Flavio Castroa8233862015-12-02 14:41:11 -0500362 vlan_id=port
castroflaviodd171472015-12-08 13:55:58 -0500363 add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=True, send_barrier=False)
Flavio Castro05d20bc2015-11-16 15:06:14 -0500364 dst_mac[5]=vlan_id
365 l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac)
366 #add vlan flow table
Flavio Castro34352e72015-12-07 20:01:51 -0500367 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG)
Flavio Castro05d20bc2015-11-16 15:06:14 -0500368 #add termination flow
Flavio Castrod8f8af22015-12-02 18:19:26 -0500369 add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
Flavio Castro05d20bc2015-11-16 15:06:14 -0500370 #add unicast routing flow
Flavio Castrod8f8af22015-12-02 18:19:26 -0500371 dst_ip = dip + (vlan_id<<8)
Flavio Castro6efe1862015-11-18 16:28:06 -0500372 add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, l3_msg.group_id)
Flavio Castro6efe1862015-11-18 16:28:06 -0500373 #add entries in the Bridging table to avoid packet-in from mac learning
374 group_id = encode_l2_interface_group_id(vlan_id, port)
375 add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
Flavio Castrod8f8af22015-12-02 18:19:26 -0500376
377 do_barrier(self.controller)
378
Flavio Castro05d20bc2015-11-16 15:06:14 -0500379 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
Flavio Castroa8233862015-12-02 14:41:11 -0500380 for in_port in ports:
381 mac_src='00:00:00:22:22:%02X' % in_port
382 ip_src='192.168.%02d.1' % in_port
383 for out_port in ports:
384 if in_port == out_port:
385 continue
386 ip_dst='192.168.%02d.1' % out_port
387 parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port,
388 eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src,
Flavio Castrod8f8af22015-12-02 18:19:26 -0500389 ip_dst=ip_dst)
Flavio Castroa8233862015-12-02 14:41:11 -0500390 pkt=str(parsed_pkt)
391 self.dataplane.send(in_port, pkt)
Flavio Castro72a45d52015-12-02 16:37:05 -0500392 #build expected packet
Flavio Castroa8233862015-12-02 14:41:11 -0500393 mac_dst='00:00:00:22:22:%02X' % out_port
Flavio Castrod8f8af22015-12-02 18:19:26 -0500394 exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=out_port,
Flavio Castroa8233862015-12-02 14:41:11 -0500395 eth_dst=mac_dst, eth_src=switch_mac, ip_ttl=63,
396 ip_src=ip_src, ip_dst=ip_dst)
397 pkt=str(exp_pkt)
398 verify_packet(self, pkt, out_port)
399 verify_no_other_packets(self)
Flavio Castro05d20bc2015-11-16 15:06:14 -0500400
Flavio Castrod8f8af22015-12-02 18:19:26 -0500401class L3VPNMPLS(base_tests.SimpleDataPlane):
402 """
403 Insert IP packet
404 Receive MPLS packet
405 """
Flavio Castro72a45d52015-12-02 16:37:05 -0500406 def runTest(self):
407 delete_all_flows(self.controller)
408 delete_all_groups(self.controller)
409
410 if len(config["port_map"]) <2:
411 logging.info("Port count less than 2, can't run this case")
412 return
413
414 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
415 dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
416 dip=0xc0a80001
417 index=1
418 ports = config["port_map"].keys()
419 for port in ports:
420 #add l2 interface group
421 vlan_id=port
castroflaviodd171472015-12-08 13:55:58 -0500422 l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id, True, True)
Flavio Castro72a45d52015-12-02 16:37:05 -0500423 dst_mac[5]=vlan_id
Flavio Castro35e64392015-12-02 16:53:14 -0500424 #add MPLS interface group
Flavio Castro72a45d52015-12-02 16:37:05 -0500425 mpls_gid, mpls_msg = add_mpls_intf_group(self.controller, l2_gid, dst_mac, intf_src_mac, vlan_id, port)
Flavio Castro35e64392015-12-02 16:53:14 -0500426 #add MPLS L3 VPN group
Flavio Castrod8f8af22015-12-02 18:19:26 -0500427 mpls_label_gid, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL,
Flavio Castro72a45d52015-12-02 16:37:05 -0500428 index=port, ref_gid= mpls_gid, push_mpls_header=True, set_mpls_label=port, set_bos=1, set_ttl=32)
Flavio Castro80730822015-12-11 15:38:47 -0500429 #ecmp_msg=add_l3_ecmp_group(self.controller, vlan_id, [mpls_label_gid])
430 do_barrier(self.controller)
Flavio Castro72a45d52015-12-02 16:37:05 -0500431 #add vlan flow table
Flavio Castro80730822015-12-11 15:38:47 -0500432 add_one_vlan_table_flow(self.controller, port, vlan_id, vrf=2, flag=VLAN_TABLE_FLAG_ONLY_TAG)
Flavio Castro72a45d52015-12-02 16:37:05 -0500433 #add termination flow
434 add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
Flavio Castro35e64392015-12-02 16:53:14 -0500435 #add routing flow
Flavio Castro72a45d52015-12-02 16:37:05 -0500436 dst_ip = dip + (vlan_id<<8)
Flavio Castro80730822015-12-11 15:38:47 -0500437 add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, mpls_label_gid, vrf=2)
438 #add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, ecmp_msg.group_id, vrf=2)
439 #add entries in the Bridging table to avoid packet-in from mac learning
440 group_id = encode_l2_interface_group_id(vlan_id, port)
441 add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
442
443 do_barrier(self.controller)
444
445 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
446 for in_port in ports:
447 mac_src='00:00:00:22:22:%02X' % in_port
448 ip_src='192.168.%02d.1' % in_port
449 for out_port in ports:
450 if in_port == out_port:
451 continue
452 ip_dst='192.168.%02d.1' % out_port
453 parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port,
454 eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src,
455 ip_dst=ip_dst)
456 pkt=str(parsed_pkt)
457 self.dataplane.send(in_port, pkt)
458 #build expect packet
459 mac_dst='00:00:00:22:22:%02X' % out_port
460 label = (out_port, 0, 1, 32)
461 exp_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=out_port, ip_ttl=63, ip_src=ip_src,
462 ip_dst=ip_dst, eth_dst=mac_dst, eth_src=switch_mac, label=[label])
463 pkt=str(exp_pkt)
464 verify_packet(self, pkt, out_port)
465 verify_no_other_packets(self)
466
467class L3VPN_32(base_tests.SimpleDataPlane):
468 """
469 Insert IP packet
470 Receive MPLS packet
471 """
472 def runTest(self):
473 delete_all_flows(self.controller)
474 delete_all_groups(self.controller)
475
476 if len(config["port_map"]) <2:
477 logging.info("Port count less than 2, can't run this case")
478 return
479
480 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
481 dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
482 dip=0xc0a80001
483 index=1
484 ports = config["port_map"].keys()
485 for port in ports:
486 #add l2 interface group
487 vlan_id=port
488 l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id, True, True)
489 dst_mac[5]=vlan_id
490 #add MPLS interface group
491 mpls_gid, mpls_msg = add_mpls_intf_group(self.controller, l2_gid, dst_mac, intf_src_mac, vlan_id, port)
492 #add MPLS L3 VPN group
493 mpls_label_gid, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL,
494 index=port, ref_gid= mpls_gid, push_mpls_header=True, set_mpls_label=port, set_bos=1, set_ttl=32)
495 #ecmp_msg=add_l3_ecmp_group(self.controller, vlan_id, [mpls_label_gid])
496 do_barrier(self.controller)
497 #add vlan flow table
498 add_one_vlan_table_flow(self.controller, port, vlan_id, vrf=2, flag=VLAN_TABLE_FLAG_ONLY_TAG)
499 #add termination flow
500 add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
501 #add routing flow
502 dst_ip = dip + (vlan_id<<8)
503 add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, mpls_gid, vrf=2)
504 #ecmp_msg.group_id, vrf=2)
Flavio Castro72a45d52015-12-02 16:37:05 -0500505 #add entries in the Bridging table to avoid packet-in from mac learning
506 group_id = encode_l2_interface_group_id(vlan_id, port)
507 add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
508
509 do_barrier(self.controller)
510
511 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
512 for in_port in ports:
513 mac_src='00:00:00:22:22:%02X' % in_port
514 ip_src='192.168.%02d.1' % in_port
515 for out_port in ports:
516 if in_port == out_port:
517 continue
518 ip_dst='192.168.%02d.1' % out_port
519 parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port,
520 eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src,
521 ip_dst=ip_dst)
522 pkt=str(parsed_pkt)
523 self.dataplane.send(in_port, pkt)
524 #build expect packet
525 mac_dst='00:00:00:22:22:%02X' % out_port
526 label = (out_port, 0, 1, 32)
Flavio Castro34352e72015-12-07 20:01:51 -0500527 exp_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=out_port, ip_ttl=63, ip_src=ip_src,
Flavio Castro72a45d52015-12-02 16:37:05 -0500528 ip_dst=ip_dst, eth_dst=mac_dst, eth_src=switch_mac, label=[label])
529 pkt=str(exp_pkt)
530 verify_packet(self, pkt, out_port)
531 verify_no_other_packets(self)
Flavio Castrod8f8af22015-12-02 18:19:26 -0500532
533class MplsTermination(base_tests.SimpleDataPlane):
Flavio Castro34352e72015-12-07 20:01:51 -0500534 """
Flavio Castrod8f8af22015-12-02 18:19:26 -0500535 Insert IP packet
536 Receive MPLS packet
Flavio Castro34352e72015-12-07 20:01:51 -0500537 """
Flavio Castrod8f8af22015-12-02 18:19:26 -0500538 def runTest(self):
539 delete_all_flows(self.controller)
540 delete_all_groups(self.controller)
541
542 if len(config["port_map"]) <2:
543 logging.info("Port count less than 2, can't run this case")
544 return
545
546 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
547 dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
548 dip=0xc0a80001
549 index=1
550 ports = config["port_map"].keys()
551 for port in ports:
552 #add l2 interface group
553 vlan_id=port
castroflaviodd171472015-12-08 13:55:58 -0500554 l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id, True, False)
Flavio Castrod8f8af22015-12-02 18:19:26 -0500555 dst_mac[5]=vlan_id
556 #add L3 Unicast group
557 l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac)
Flavio Castro167f5bd2015-12-02 19:33:53 -0500558 #add L3 ecmp group
559 ecmp_msg = add_l3_ecmp_group(self.controller, port, [l3_msg.group_id])
Flavio Castrod8f8af22015-12-02 18:19:26 -0500560 #add vlan flow table
Flavio Castro80730822015-12-11 15:38:47 -0500561 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG)
Flavio Castrod8f8af22015-12-02 18:19:26 -0500562 #add termination flow
Flavio Castro167f5bd2015-12-02 19:33:53 -0500563 add_termination_flow(self.controller, port, 0x8847, intf_src_mac, vlan_id, goto_table=24)
Flavio Castrod8f8af22015-12-02 18:19:26 -0500564 #add routing flow
565 dst_ip = dip + (vlan_id<<8)
Flavio Castro167f5bd2015-12-02 19:33:53 -0500566 add_mpls_flow(self.controller, ecmp_msg.group_id, port)
Flavio Castrod8f8af22015-12-02 18:19:26 -0500567 #add entries in the Bridging table to avoid packet-in from mac learning
568 group_id = encode_l2_interface_group_id(vlan_id, port)
569 add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
570
571 do_barrier(self.controller)
572
573 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
574 for in_port in ports:
575 mac_src='00:00:00:22:22:%02X' % in_port
576 ip_src='192.168.%02d.1' % in_port
577 for out_port in ports:
578 if in_port == out_port:
579 continue
580 ip_dst='192.168.%02d.1' % out_port
Flavio Castro167f5bd2015-12-02 19:33:53 -0500581
582 label = (out_port, 0, 1, 32)
583 parsed_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=in_port, ip_src=ip_src,
584 ip_dst=ip_dst, eth_dst=switch_mac, eth_src=mac_src, label=[label])
Flavio Castrod8f8af22015-12-02 18:19:26 -0500585 pkt=str(parsed_pkt)
586 self.dataplane.send(in_port, pkt)
Flavio Castro167f5bd2015-12-02 19:33:53 -0500587
Flavio Castrod8f8af22015-12-02 18:19:26 -0500588 #build expect packet
589 mac_dst='00:00:00:22:22:%02X' % out_port
Flavio Castro167f5bd2015-12-02 19:33:53 -0500590 exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=out_port,
591 eth_dst=mac_dst, eth_src=switch_mac, ip_ttl=31, ip_src=ip_src, ip_dst=ip_dst)
Flavio Castrod8f8af22015-12-02 18:19:26 -0500592 pkt=str(exp_pkt)
593 verify_packet(self, pkt, out_port)
Flavio Castro167f5bd2015-12-02 19:33:53 -0500594 verify_no_other_packets(self)
595
Flavio Castro80730822015-12-11 15:38:47 -0500596class MPLSBUG(base_tests.SimpleDataPlane):
597
598 def runTest(self):
599 delete_all_flows(self.controller)
600 delete_all_groups(self.controller)
601
602 if len(config["port_map"]) <2:
603 logging.info("Port count less than 2, can't run this case")
604 return
605
606 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
607 dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
608 dip=0xc0a80001
609 index=1
610 ports = config["port_map"].keys()
611 for port in ports:
612 #add l2 interface group
613 vlan_id=port
614 l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id, True, False)
615 dst_mac[5]=vlan_id
616 #add L3 Unicast group
617 l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac)
618 #add vlan flow table
619 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
620 #add termination flow
621 add_termination_flow(self.controller, port, 0x8847, intf_src_mac, vlan_id, goto_table=24)
622 #add mpls flow
623 add_mpls_flow(self.controller, l3_msg.group_id, port)
624 #add termination flow
625 add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
626 #add unicast routing flow
627 dst_ip = dip + (vlan_id<<8)
628 add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, l3_msg.group_id)
629
630 #add entries in the Bridging table to avoid packet-in from mac learning
631 group_id = encode_l2_interface_group_id(vlan_id, port)
632 add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
633
634 do_barrier(self.controller)
635
636 switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
637 for in_port in ports:
638 mac_src='00:00:00:22:22:%02X' % in_port
639 ip_src='192.168.%02d.1' % in_port
640 for out_port in ports:
641 if in_port == out_port:
642 continue
643 ip_dst='192.168.%02d.1' % out_port
644 switch_mac = "00:00:00:cc:cc:cc"
645 label = (out_port, 0, 1, 32)
646 parsed_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=in_port, ip_src=ip_src,
647 ip_dst=ip_dst, eth_dst=switch_mac, eth_src=mac_src, label=[label])
648 pkt=str(parsed_pkt)
649 self.dataplane.send(in_port, pkt)
650
651 #build expect packet
652 mac_dst='00:00:00:22:22:%02X' % out_port
653 exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=out_port,
654 eth_dst=mac_dst, eth_src=switch_mac, ip_ttl=31, ip_src=ip_src, ip_dst=ip_dst)
655 pkt=str(exp_pkt)
656 verify_packet(self, pkt, out_port)
657 verify_no_other_packets(self)
658
659 parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port,
660 eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src,
661 ip_dst=ip_dst)
662 pkt=str(parsed_pkt)
663 self.dataplane.send(in_port, pkt)
664 #build expected packet
665 mac_dst='00:00:00:22:22:%02X' % out_port
666 exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=out_port,
667 eth_dst=mac_dst, eth_src=switch_mac, ip_ttl=63,
668 ip_src=ip_src, ip_dst=ip_dst)
669 pkt=str(exp_pkt)
670 verify_packet(self, pkt, out_port)
671 verify_no_other_packets(self)
672
Flavio Castro12296312015-12-15 17:48:26 -0500673class L3McastToL2(base_tests.SimpleDataPlane):
castroflaviocc403a92015-12-15 14:04:19 -0500674 """
Flavio Castro12296312015-12-15 17:48:26 -0500675 Mcast routing to L2
castroflaviocc403a92015-12-15 14:04:19 -0500676 """
677 def runTest(self):
678 """
679 port1 (vlan 300)-> All Ports (vlan 300)
680 """
681 delete_all_flows(self.controller)
682 delete_all_groups(self.controller)
683
684 if len(config["port_map"]) <2:
685 logging.info("Port count less than 2, can't run this case")
686 return
687
688 vlan_id =300
689 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
690 intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac])
691 dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01]
692 dst_mac_str=':'.join(['%02X' % x for x in dst_mac])
693 port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11]
694 port1_mac_str=':'.join(['%02X' % x for x in port1_mac])
695 src_ip=0xc0a80101
696 src_ip_str="192.168.1.1"
697 dst_ip=0xe0010101
698 dst_ip_str="224.1.1.1"
699
700 port1=config["port_map"].keys()[0]
701 port2=config["port_map"].keys()[1]
702
703 switch_mac = [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00]
704
705
706 #add l2 interface group
707 l2_intf_group_list=[]
708 for port in config["port_map"].keys():
709 if port == port2:
710 continue
Flavio Castro12296312015-12-15 17:48:26 -0500711 l2_intf_gid, msg=add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=True, send_barrier=False)
castroflaviocc403a92015-12-15 14:04:19 -0500712 l2_intf_group_list.append(l2_intf_gid)
713 #add vlan flow table
714 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG)
715
716 #add termination flow
717 add_termination_flow(self.controller, port1, 0x0800, switch_mac, vlan_id)
718
719 #add l3 interface group
720 mcat_group_msg=add_l3_mcast_group(self.controller, vlan_id, 2, l2_intf_group_list)
721 add_mcast4_routing_flow(self.controller, vlan_id, src_ip, 0, dst_ip, mcat_group_msg.group_id)
722
723 parsed_pkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=300,
724 eth_dst=dst_mac_str,
725 eth_src=port1_mac_str,
726 ip_ttl=64,
727 ip_src=src_ip_str,
728 ip_dst=dst_ip_str)
729 pkt=str(parsed_pkt)
730 self.dataplane.send(port1, pkt)
731 for port in config["port_map"].keys():
Flavio Castro12296312015-12-15 17:48:26 -0500732 if port == port2 or port == port1:
castroflaviocc403a92015-12-15 14:04:19 -0500733 verify_no_packet(self, pkt, port)
Flavio Castro12296312015-12-15 17:48:26 -0500734 continue
castroflaviocc403a92015-12-15 14:04:19 -0500735 verify_packet(self, pkt, port)
736 verify_no_other_packets(self)
737
Flavio Castro12296312015-12-15 17:48:26 -0500738class L3McastToL3(base_tests.SimpleDataPlane):
739 """
740 Mcast routing
741 """
742 def runTest(self):
743 """
744 port1 (vlan 1)-> port 2 (vlan 2)
745 """
746 delete_all_flows(self.controller)
747 delete_all_groups(self.controller)
748
749 if len(config["port_map"]) <3:
750 logging.info("Port count less than 2, can't run this case")
751 return
752
753 vlan_id =1
754 port2_out_vlan=2
755 port3_out_vlan=3
756 in_vlan=1 #macast group vid shall use input vlan diffe from l3 interface use output vlan
757 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
758 intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac])
759 dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01]
760 dst_mac_str=':'.join(['%02X' % x for x in dst_mac])
761 port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11]
762 port1_mac_str=':'.join(['%02X' % x for x in port1_mac])
763 src_ip=0xc0a80101
764 src_ip_str="192.168.1.1"
765 dst_ip=0xe0010101
766 dst_ip_str="224.1.1.1"
767
768 port1=config["port_map"].keys()[0]
769 port2=config["port_map"].keys()[1]
770 port3=config["port_map"].keys()[2]
771
772 #add l2 interface group
773 for port in config["port_map"].keys():
774 add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
775 #add vlan flow table
776 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG)
777 vlan_id +=1
778
779 #add termination flow
780 add_termination_flow(self.controller, port1, 0x0800, [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00], vlan_id)
781
782 #add l3 interface group
783 port2_ucast_msg=add_l3_interface_group(self.controller, port2, port2_out_vlan, 2, intf_src_mac)
784 port3_ucast_msg=add_l3_interface_group(self.controller, port3, port3_out_vlan, 3, intf_src_mac)
785 mcat_group_msg=add_l3_mcast_group(self.controller, in_vlan, 2, [port2_ucast_msg.group_id, port3_ucast_msg.group_id])
786 add_mcast4_routing_flow(self.controller, in_vlan, src_ip, 0, dst_ip, mcat_group_msg.group_id)
787
788 parsed_pkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=1,
789 eth_dst=dst_mac_str,
790 eth_src=port1_mac_str,
791 ip_ttl=64,
792 ip_src=src_ip_str,
793 ip_dst=dst_ip_str)
794 pkt=str(parsed_pkt)
795 self.dataplane.send(port1, pkt)
796 parsed_pkt = simple_udp_packet(pktlen=96,
797 eth_dst=dst_mac_str,
798 eth_src=intf_src_mac_str,
799 ip_ttl=63,
800 ip_src=src_ip_str,
801 ip_dst=dst_ip_str)
802 pkt=str(parsed_pkt)
803 verify_packet(self, pkt, port2)
804 verify_packet(self, pkt, port3)
805 verify_no_other_packets(self)
806
807class L3McastToVPN(base_tests.SimpleDataPlane):
808 """
809 Mcast routing
810 """
811 def runTest(self):
812 """
813 port1 (vlan 1)-> port 2 (vlan 2)
814 """
815 #delete_all_flows(self.controller)
816 #delete_all_groups(self.controller)
817
818 if len(config["port_map"]) <3:
819 logging.info("Port count less than 2, can't run this case")
820 return
821
822 vlan_id =1
823 port2_out_vlan=2
824 port3_out_vlan=3
825 in_vlan=1 #macast group vid shall use input vlan diffe from l3 interface use output vlan
826 intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
827 intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac])
828 dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01]
829 dst_mac_str=':'.join(['%02X' % x for x in dst_mac])
830 port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11]
831 port1_mac_str=':'.join(['%02X' % x for x in port1_mac])
832 src_ip=0xc0a80101
833 src_ip_str="192.168.1.1"
834 dst_ip=0xe0010101
835 dst_ip_str="224.1.1.1"
836
837 port1=config["port_map"].keys()[0]
838 port2=config["port_map"].keys()[1]
839 port3=config["port_map"].keys()[2]
840
841 #add l2 interface group
842 for port in config["port_map"].keys():
843 add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
844 #add vlan flow table
845 add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG)
846 vlan_id +=1
847
848 #add termination flow
849 add_termination_flow(self.controller, port1, 0x0800, [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00], vlan_id)
850
851 #add MPLS interface group
852 l2_gid = encode_l2_interface_group_id(port2_out_vlan, port2)
853 mpls_gid2, mpls_msg = add_mpls_intf_group(self.controller, l2_gid, dst_mac, intf_src_mac, port2_out_vlan, port2)
854 l2_gid3 = encode_l2_interface_group_id(port3_out_vlan, port3)
855 mpls_gid3, mpls_msg = add_mpls_intf_group(self.controller, l2_gid3, dst_mac, intf_src_mac, port3_out_vlan, port3)
856 #add L3VPN groups
857 mpls_label_gid2, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL,
858 index=(0x20000+port2), ref_gid= mpls_gid2, push_mpls_header=True, set_mpls_label=port2, set_bos=1, cpy_ttl_outward=True)
859 mpls_label_gid3, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL,
860 index=(0x10000+port3), ref_gid= mpls_gid3, push_mpls_header=True, set_mpls_label=port3, set_bos=1, cpy_ttl_outward=True)
861
862
863
864 mcat_group_msg=add_l3_mcast_group(self.controller, in_vlan, 2, [0x92020022 , 0x92010023])
865 add_mcast4_routing_flow(self.controller, in_vlan, src_ip, 0, dst_ip, mcat_group_msg.group_id)
866
867 parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=1,
868 eth_dst=dst_mac_str,
869 eth_src=port1_mac_str,
870 ip_ttl=64,
871 ip_src=src_ip_str,
872 ip_dst=dst_ip_str)
873 pkt=str(parsed_pkt)
874 self.dataplane.send(port1, pkt)
875 label = (in_vlan, 0, 1, 63)
876 parsed_pkt = mpls_packet(pktlen=100,
877 eth_dst=dst_mac_str,
878 eth_src=intf_src_mac_str,
879 ip_ttl=63,
880 ip_src=src_ip_str, label= [label],
881 ip_dst=dst_ip_str)
882 pkt=str(parsed_pkt)
883 verify_packet(self, pkt, port2)
884 verify_packet(self, pkt, port3)
885 verify_no_other_packets(self)
886
Flavio Castro34352e72015-12-07 20:01:51 -0500887