blob: 88d788e085ccf3d6b37de783e239c91614ca3f34 [file] [log] [blame]
macauley_cheng0a0a7f62015-11-06 11:36:50 +08001import logging
2import oftest.base_tests as base_tests
3from oftest import config
4from oftest.testutils import *
5from util import *
6from accton_util import convertIP4toStr as toIpV4Str
7from accton_util import convertMACtoStr as toMacStr
8
9
10class l3ucast_route(base_tests.SimpleDataPlane):
11 """
12 [L3 unicast route]
13 Do unicast route and output to specified port
14
15 Inject eth 1/3 Tag2, SA000000112233, DA7072cf7cf3a3, SIP 192.168.1.100, DIP 192.168.2.2
16 Output eth 1/1 Tag3, SA 000004223355, DA 000004224466
17
18 ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
19 ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20
20 ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=70:72:cf:7c:f3:a3,eth_type=0x0800 goto:30
21 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x30001 group=any,port=any,weight=0 output=1
22 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20000003 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=3,group=0x30001
23 ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x20000003 goto:60
24 """
25 def runTest(self):
26 delete_all_flows(self.controller)
27 delete_all_groups(self.controller)
28
29 test_ports = sorted(config["port_map"].keys())
30
31 input_port = test_ports[0]
32 output_port = test_ports[1]
33
34 apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
35 apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
36 apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",eth_dst=70:72:cf:7c:f3:a3,eth_type=0x0800 goto:30")
37 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
38 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20000003 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=3,group=0x3000"+str(output_port))
39 apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x20000003 goto:60")
40
41 input_pkt = simple_packet(
42 '70 72 cf 7c f3 a3 00 00 00 11 22 33 81 00 00 02 '
43 '08 00 45 00 00 4e 04 d2 00 00 7f 06 b2 7b c0 a8 '
44 '01 0a c0 a8 02 02 00 03 00 06 00 01 f7 fa 00 00 '
45 '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '
46 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
47 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
48
49 output_pkt = simple_packet(
50 '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 03 '
51 '08 00 45 00 00 4e 04 d2 00 00 7e 06 b3 7b c0 a8 '
52 '01 0a c0 a8 02 02 00 03 00 06 00 01 f7 fa 00 00 '
53 '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '
54 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
55 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
56
57 self.dataplane.send(input_port, str(input_pkt))
58 verify_packet(self, str(output_pkt), output_port)
59
60
61class l3ucast_route6(base_tests.SimpleDataPlane):
62 """
63 [L3 IPv6 unicast route]
64 Do unicast route and output to specified port
65
66 Inject eth 1/3 Tag2, SA000000112233, DA7072cf7cf3a3, SIP 2014::2, DIP 2014::1
67 Output eth 1/1 Tag2, SA 000004223355, DA 000004224466
68
69 ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
70 ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20
71 ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=70:72:cf:7c:f3:a3,eth_type=0x86dd goto:30
72 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
73 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
74 ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x86dd,ipv6_dst=2014::1/64 write:group=0x20000001 goto:60
75 """
76 def runTest(self):
77 delete_all_flows(self.controller)
78 delete_all_groups(self.controller)
79
80 test_ports = sorted(config["port_map"].keys())
81
82 input_port = test_ports[0]
83 output_port = test_ports[1]
84
85 apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
86 apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
87 apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",eth_dst=70:72:cf:7c:f3:a3,eth_type=0x86dd goto:30")
88 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
89 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
90 apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x86dd,ipv6_dst=2014::1/64 write:group=0x20000001 goto:60")
91
92 input_pkt = simple_packet(
93 '70 72 cf 7c f3 a3 00 00 00 11 22 33 81 00 00 02 '
94 '86 dd 60 00 00 00 00 08 11 7f 20 14 00 00 00 00 '
95 '00 00 00 00 00 00 00 00 00 02 20 14 00 00 00 00 '
96 '00 00 00 00 00 00 00 00 00 01 00 0d 00 07 00 08 '
97 'bf 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
98 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
99
100 output_pkt = simple_packet(
101 '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
102 '86 dd 60 00 00 00 00 08 11 7e 20 14 00 00 00 00 '
103 '00 00 00 00 00 00 00 00 00 02 20 14 00 00 00 00 '
104 '00 00 00 00 00 00 00 00 00 01 00 0d 00 07 00 08 '
105 'bf 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
106 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
107
108 self.dataplane.send(input_port, str(input_pkt))
109 verify_packet(self, str(output_pkt), output_port)
110
111
112class l3mcast_route(base_tests.SimpleDataPlane):
113 """
114 [L3 multicast route]
115 Do multicast route and output to specified ports
116
117 Inject eth 1/3 Tag2, SA000000112233, DA01005E404477, SIP 192.168.1.100, DIP 224.0.2.2
118 Output eth 1/1 original
119
120 ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
121 ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20
122 ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 eth_dst=01:00:5e:40:44:77/ff:ff:ff:80:00:00,eth_type=0x0800 goto:40
123 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
124 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x20001
125 ./dpctl tcp:192.168.1.1:6633 flow-mod table=40,cmd=add,prio=401 eth_type=0x0800,ip_src=192.168.2.2,ip_dst=224.0.2.2,vlan_vid=2 write:group=0x60020001 goto:60
126 """
127 def runTest(self):
128 delete_all_flows(self.controller)
129 delete_all_groups(self.controller)
130
131 test_ports = sorted(config["port_map"].keys())
132
133 input_port = test_ports[0]
134 output_port = test_ports[1]
135
136 apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
137 apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
138 apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 eth_dst=01:00:5e:40:44:77/ff:ff:ff:80:00:00,eth_type=0x0800 goto:40")
139 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
140 apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x2000"+str(output_port))
141 apply_dpctl_mod(self, config, "flow-mod table=40,cmd=add,prio=401 eth_type=0x0800,ip_src=192.168.2.2,ip_dst=224.0.2.2,vlan_vid=2 write:group=0x60020001 goto:60")
142
143 input_pkt = simple_packet(
144 '01 00 5e 40 44 77 00 00 00 11 22 33 81 00 00 02 '
145 '08 00 45 00 00 4e 04 d2 00 00 7f 84 91 ad c0 a8 '
146 '02 02 e0 00 02 02 00 17 00 08 00 01 f7 fa 00 00 '
147 '00 00 50 00 04 00 0e 79 00 00 00 00 00 00 00 00 '
148 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
149 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
150
151 output_pkt = simple_packet(
152 '01 00 5e 40 44 77 00 00 00 11 22 33 81 00 00 02 '
153 '08 00 45 00 00 4e 04 d2 00 00 7f 84 91 ad c0 a8 '
154 '02 02 e0 00 02 02 00 17 00 08 00 01 f7 fa 00 00 '
155 '00 00 50 00 04 00 0e 79 00 00 00 00 00 00 00 00 '
156 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
157 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
158
159 self.dataplane.send(input_port, str(input_pkt))
160 verify_packet(self, str(output_pkt), output_port)
161
162
163class l3mcast_route6(base_tests.SimpleDataPlane):
164 """
165 [L3 IPv6 multicast route]
166 Do multicast route and output to specified ports
167
168 Inject eth 1/5 Tag2, SA000000112233, DA333300224477, SIP 2014::2, DIP ff01::2
169 Output eth 1/1 Tag2, original
170 Output eth 1/3 Tag3, original
171
172 ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
173 ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=5,vlan_vid=0x1002/0x1fff goto:20
174 ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 eth_dst=33:33:00:22:44:77/ff:ff:00:00:00:00,eth_type=0x86dd goto:40
175 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
176 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x30003 group=any,port=any,weight=0 output=3
177 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x50000003 group=any,port=any,weight=0 set_field=eth_src=00:00:05:22:33:99,set_field=vlan_vid=3,group=0x30003
178 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x20001 group=any,port=any,weight=0 group=0x50000003
179 ./dpctl tcp:192.168.1.1:6633 flow-mod table=40,cmd=add,prio=501 eth_type=0x86dd,ipv6_dst=ff01::2,vlan_vid=2 write:group=0x60020001 goto:60
180 """
181 def runTest(self):
182 delete_all_flows(self.controller)
183 delete_all_groups(self.controller)
184
185 test_ports = sorted(config["port_map"].keys())
186
187 input_port = test_ports[0]
188 output_port = test_ports[1]
189 output_port2 = test_ports[2]
190
191 apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
192 apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
193 apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 eth_dst=33:33:00:22:44:77/ff:ff:00:00:00:00,eth_type=0x86dd goto:40")
194 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
195 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(output_port2)+" group=any,port=any,weight=0 output="+str(output_port2))
196 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x50000003 group=any,port=any,weight=0 set_field=eth_src=00:00:05:22:33:99,set_field=vlan_vid=3,group=0x3000"+str(output_port2))
197 apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x2000"+str(output_port)+" group=any,port=any,weight=0 group=0x50000003")
198 apply_dpctl_mod(self, config, "flow-mod table=40,cmd=add,prio=401 eth_type=0x86dd,ipv6_dst=ff01::2,vlan_vid=2 write:group=0x60020001 goto:60")
199
200 input_pkt = simple_packet(
201 '33 33 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '
202 '86 dd 60 00 00 00 00 26 3b 7f 20 14 00 00 00 00 '
203 '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '
204 '00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 '
205 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
206 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
207
208 output_pkt = simple_packet(
209 '33 33 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '
210 '86 dd 60 00 00 00 00 26 3b 7f 20 14 00 00 00 00 '
211 '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '
212 '00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 '
213 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
214 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
215
216 output_pkt2 = simple_packet(
217 '33 33 00 22 44 77 00 00 05 22 33 99 81 00 00 03 '
218 '86 dd 60 00 00 00 00 26 3b 7e 20 14 00 00 00 00 '
219 '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '
220 '00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 '
221 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
222 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
223
224 self.dataplane.send(input_port, str(input_pkt))
225 verify_packet(self, str(output_pkt), output_port)
226 verify_packet(self, str(output_pkt2), output_port2)
227
228
229class bridge_ucast(base_tests.SimpleDataPlane):
230 """
231 [Bridge unicast]
232 Do unicast bridge
233
234 Inject eth 1/1 Tag2, SA000000112233, DA000000224477, SIP 192.168.2.1, DIP 192.168.2.2
235 Output eth 1/3 untag
236
237 ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
238 ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
239 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 pop_vlan,output=3
240 ./dpctl tcp:192.168.1.1:6633 flow-mod table=50,cmd=add,prio=501 vlan_vid=2,eth_dst=00:00:00:22:44:77 write:group=0x20003 goto:60
241 """
242 def runTest(self):
243 delete_all_flows(self.controller)
244 delete_all_groups(self.controller)
245
246 test_ports = sorted(config["port_map"].keys())
247
248 input_port = test_ports[0]
249 output_port = test_ports[1]
250
251 apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
252 apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
253 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 pop_vlan,output="+str(output_port))
254 apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=2,eth_dst=00:00:00:22:44:77 write:group=0x2000"+str(output_port)+" goto:60")
255
256 input_pkt = simple_packet(
257 '00 00 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '
258 '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '
259 '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
260 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
261 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
262 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
263
264 output_pkt = simple_packet(
265 '00 00 00 22 44 77 00 00 00 11 22 33 08 00 45 00 '
266 '00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 02 01 c0 a8 '
267 '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
268 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
269 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
270 '00 00 00 00 00 00 00 00 00 00 00 00')
271
272 self.dataplane.send(input_port, str(input_pkt))
273 verify_packet(self, str(output_pkt), output_port)
274
275
276class bridge_mcast(base_tests.SimpleDataPlane):
277 """
278 [Bridge multicast]
279 Do multicast bridge
280
281 Inject eth 1/5 Tag2, SA000000112233, DA110000224477, SIP 192.168.2.1, DIP 192.168.2.2
282 Output eth 1/1 Tag2, SA000000112233, DA110000224477, SIP 192.168.2.1, DIP 192.168.2.2
283 Output eth 1/3 untag
284
285 ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
286 ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=5,vlan_vid=0x1002/0x1fff goto:20
287 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
288 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 pop_vlan,output=3
289 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x30020001 group=any,port=any,weight=0 group=0x20001 group=any,port=any,weight=0 group=0x20003
290 ./dpctl tcp:192.168.1.1:6633 flow-mod table=50,cmd=add,prio=601 vlan_vid=2,eth_dst=11:00:00:22:44:77 write:group=0x30020001 goto:60
291 """
292 def runTest(self):
293 delete_all_flows(self.controller)
294 delete_all_groups(self.controller)
295
296 test_ports = sorted(config["port_map"].keys())
297
298 input_port = test_ports[0]
299 output_port = test_ports[1]
300 output_port2 = test_ports[2]
301
302 apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
303 apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
304 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
305 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port2)+" group=any,port=any,weight=0 pop_vlan,output="+str(output_port2))
306 apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x30020001 group=any,port=any,weight=0 group=0x2000"+str(output_port)+" group=any,port=any,weight=0 group=0x2000"+str(output_port2))
307 apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=2,eth_dst=11:00:00:22:44:77 write:group=0x30020001 goto:60")
308
309 input_pkt = simple_packet(
310 '11 00 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '
311 '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '
312 '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
313 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
314 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
315 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
316
317 output_pkt = simple_packet(
318 '11 00 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '
319 '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '
320 '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
321 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
322 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
323 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
324
325 output_pkt2 = simple_packet(
326 '11 00 00 22 44 77 00 00 00 11 22 33 08 00 45 00 '
327 '00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 02 01 c0 a8 '
328 '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
329 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
330 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
331 '00 00 00 00 00 00 00 00 00 00 00 00')
332
333 self.dataplane.send(input_port, str(input_pkt))
334 verify_packet(self, str(output_pkt), output_port)
335 verify_packet(self, str(output_pkt2), output_port2)
336
337
338class bridge_dlf(base_tests.SimpleDataPlane):
339 """
340 [Bridge DLF]
341 Do DLF bridge
342
343 Inject eth 1/5 Tag2, SA000000112233, DA110000224466, SIP 192.168.2.1, DIP 192.168.2.2
344 Output eth 1/1 Tag2, SA000000112233, DA110000224477, SIP 192.168.2.1, DIP 192.168.2.2
345 Output eth 1/3 untag
346
347 ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
348 ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=5,vlan_vid=0x1002/0x1fff goto:20
349 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
350 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 pop_vlan,output=3
351 ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x40020001 group=any,port=any,weight=0 group=0x20001 group=any,port=any,weight=0 group=0x20003
352 ./dpctl tcp:192.168.1.1:6633 flow-mod table=50,cmd=add,prio=601 vlan_vid=2 write:group=0x40020001 goto:60
353 """
354 def runTest(self):
355 delete_all_flows(self.controller)
356 delete_all_groups(self.controller)
357
358 test_ports = sorted(config["port_map"].keys())
359
360 input_port = test_ports[0]
361 output_port = test_ports[1]
362 output_port2 = test_ports[2]
363
364 apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
365 apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
366 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
367 apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port2)+" group=any,port=any,weight=0 pop_vlan,output="+str(output_port2))
368 apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x40020001 group=any,port=any,weight=0 group=0x2000"+str(output_port)+" group=any,port=any,weight=0 group=0x2000"+str(output_port2))
369 apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=601 vlan_vid=2 write:group=0x40020001 goto:60")
370
371 input_pkt = simple_packet(
372 '00 00 00 22 44 66 00 00 00 11 22 33 81 00 00 02 '
373 '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '
374 '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
375 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
376 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
377 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
378
379 output_pkt = simple_packet(
380 '00 00 00 22 44 66 00 00 00 11 22 33 81 00 00 02 '
381 '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '
382 '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
383 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
384 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
385 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
386
387 output_pkt2 = simple_packet(
388 '00 00 00 22 44 66 00 00 00 11 22 33 08 00 45 00 '
389 '00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 02 01 c0 a8 '
390 '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
391 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
392 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
393 '00 00 00 00 00 00 00 00 00 00 00 00')
394
395 self.dataplane.send(input_port, str(input_pkt))
396 verify_packet(self, str(output_pkt), output_port)
397 verify_packet(self, str(output_pkt2), output_port2)
398