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