ofp-util: Use correct cookie value in "packet_in"s when no flow involved.
[sliver-openvswitch.git] / tests / ofproto-dpif.at
1 AT_BANNER([ofproto-dpif])
2
3 AT_SETUP([ofproto-dpif - resubmit])
4 OVS_VSWITCHD_START
5 ADD_OF_PORTS([br0], [1], [10], [11], [12], [13], [14], [15],
6                     [16], [17], [18], [19], [20], [21])
7 AT_DATA([flows.txt], [dnl
8 table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21)
9 table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18)
10 table=0 in_port=3 priority=2000 icmp actions=output(20)
11 table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15)
12 table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2)
13 table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2)
14 ])
15 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
16 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
17 AT_CHECK([tail -1 stdout], [0],
18   [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
19 ])
20 OVS_VSWITCHD_STOP
21 AT_CLEANUP
22
23 AT_SETUP([ofproto-dpif - goto table])
24 OVS_VSWITCHD_START
25 ADD_OF_PORTS([br0], [1], [10], [11])
26 echo "table=0 in_port=1 actions=output(10),goto_table(1)" > flows.txt
27 for i in `seq 1 63`; do echo "table=$i actions=goto_table($(($i+1)))"; done >> flows.txt
28 echo "table=64 actions=output(11)" >> flows.txt
29 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
30 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
31 AT_CHECK([tail -1 stdout], [0],
32   [Datapath actions: 10,11
33 ])
34 OVS_VSWITCHD_STOP
35 AT_CLEANUP
36
37 AT_SETUP([ofproto-dpif - write actions])
38 OVS_VSWITCHD_START
39 ADD_OF_PORTS([br0], [1], [10], [11], [12], [13])
40 AT_DATA([flows.txt], [dnl
41 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
42 table=1 ip actions=write_actions(output(13)),goto_table(2)
43 table=2 ip actions=set_field:192.168.3.91->ip_src,output(11)
44 ])
45 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
46 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
47 AT_CHECK([tail -1 stdout], [0],
48   [Datapath actions: 10,set(ipv4(src=192.168.3.91,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no)),11,set(ipv4(src=192.168.3.90,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no)),13
49 ])
50 OVS_VSWITCHD_STOP
51 AT_CLEANUP
52
53 AT_SETUP([ofproto-dpif - clear actions])
54 OVS_VSWITCHD_START
55 ADD_OF_PORTS([br0], [1], [10], [11], [12])
56 AT_DATA([flows.txt], [dnl
57 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
58 table=1 ip actions=set_field:192.168.3.91->ip_src,output(11),clear_actions
59 ])
60 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
61 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
62 AT_CHECK([tail -1 stdout], [0],
63   [Datapath actions: 10,set(ipv4(src=192.168.3.91,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no)),11
64 ])
65 OVS_VSWITCHD_STOP
66 AT_CLEANUP
67
68 AT_SETUP([ofproto-dpif - registers])
69 OVS_VSWITCHD_START
70 ADD_OF_PORTS([br0], [20], [21], [22], [33], [90])
71 AT_DATA([flows.txt], [dnl
72 in_port=90                 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
73 in_port=91                 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
74 in_port=92                 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
75 in_port=93                 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
76
77 in_port=2                  actions=load:0x000db000->NXM_NX_REG0[[]]
78 in_port=3                  actions=load:0xdea->NXM_NX_REG0[[20..31]]
79 in_port=4                  actions=load:0xeef->NXM_NX_REG0[[0..11]]
80 in_port=5                  actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
81 in_port=6                  actions=load:0x22222222->NXM_NX_REG2[[]]
82 in_port=7                  actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
83 in_port=8                  actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
84 in_port=9,reg0=0xdeadbeef  actions=output:20
85 in_port=10,reg1=0xdeadbeef actions=output:21
86 in_port=11,reg2=0xeef22dea actions=output:22
87
88 dnl Sanilty check all registers
89 in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
90 in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
91 in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
92 in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
93
94 ])
95 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
96 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
97 AT_CHECK([tail -1 stdout], [0],
98   [Datapath actions: 20,21,22,33
99 ])
100 OVS_VSWITCHD_STOP
101 AT_CLEANUP
102
103 AT_SETUP([ofproto-dpif - push-pop])
104 OVS_VSWITCHD_START
105 ADD_OF_PORTS([br0], [20], [21], [22], [33], [90])
106 AT_DATA([flows.txt], [dnl
107 in_port=90           actions=load:20->NXM_NX_REG0[[0..7]],load:21->NXM_NX_REG1[[0..7]],load:22->NXM_NX_REG2[[0..7]], load:33->NXM_NX_REG3[[0..7]], push:NXM_NX_REG0[[]], push:NXM_NX_REG1[[0..7]],push:NXM_NX_REG2[[0..15]], push:NXM_NX_REG3[[]], resubmit:2, resubmit:3, resubmit:4, resubmit:5
108 in_port=2            actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
109 in_port=3            actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
110 in_port=4            actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
111 in_port=5            actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
112
113 ])
114 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
115 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
116 AT_CHECK([tail -1 stdout], [0],
117   [Datapath actions: 33,22,21,20
118 ])
119 OVS_VSWITCHD_STOP
120 AT_CLEANUP
121
122 AT_SETUP([ofproto-dpif - output])
123 OVS_VSWITCHD_START
124 ADD_OF_PORTS([br0], [1], [9], [10], [11], [55], [66], [77], [88])
125 AT_DATA([flows.txt], [dnl
126 in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
127 in_port=2 actions=output:9
128 in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
129 in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
130 in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
131 in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
132 in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
133 in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
134 ])
135 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
136 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
137 AT_CHECK([tail -1 stdout], [0],
138   [Datapath actions: 9,55,10,55,66,11,77,88,9,1
139 ])
140 OVS_VSWITCHD_STOP
141 AT_CLEANUP
142
143 AT_SETUP([ofproto-dpif - dec_ttl])
144 OVS_VSWITCHD_START
145 ADD_OF_PORTS([br0], [1], [2], [3], [4])
146 AT_DATA([flows.txt], [dnl
147 table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
148 table=1 in_port=1 action=dec_ttl,output:3
149 ])
150 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
151 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=2,frag=no)' -generate], [0], [stdout])
152 AT_CHECK([tail -3 stdout], [0],
153   [Datapath actions: set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=1,frag=no)),2,4
154 This flow is handled by the userspace slow path because it:
155         - Sends "packet-in" messages to the OpenFlow controller.
156 ])
157 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=3,frag=no)'], [0], [stdout])
158 AT_CHECK([tail -1 stdout], [0],
159   [Datapath actions: set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=2,frag=no)),2,set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=1,frag=no)),3,4
160 ])
161 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)'], [0], [stdout])
162 AT_CHECK([tail -1 stdout], [0],
163   [Datapath actions: set(ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=127,frag=no)),2,set(ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=126,frag=no)),3,4
164 ])
165
166 AT_CAPTURE_FILE([ofctl_monitor.log])
167 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
168 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=2,frag=no)' -generate], [0], [stdout])
169 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
170 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
171 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 in_port=1 (via invalid_ttl) data_len=42 (unbuffered)
172 icmp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=1,icmp_type=0,icmp_code=0
173 ])
174 OVS_VSWITCHD_STOP
175 AT_CLEANUP
176
177
178 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
179 OVS_VSWITCHD_START
180 ADD_OF_PORTS([br0], [1], [2])
181
182 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
183
184 # "in_port" defaults to OFPP_NONE if it's not specified.
185 flow="icmp,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,icmp_type=8,icmp_code=0"
186 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
187 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
188 1
189 2
190 100
191 ])
192
193 OVS_VSWITCHD_STOP
194 AT_CLEANUP
195
196 AT_SETUP([ofproto-dpif - DSCP])
197 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
198 ADD_OF_PORTS([br0], [9])
199 AT_DATA([flows.txt], [dnl
200 actions=output:LOCAL,enqueue:1:1,enqueue:1:2,enqueue:1:2,enqueue:1:1,output:1,mod_nw_tos:0,output:1,output:LOCAL
201 ])
202 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
203 AT_CHECK([ovs-vsctl -- \
204         set Port p1 qos=@newqos --\
205         --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
206         --id=@q1 create Queue dscp=1 --\
207         --id=@q2 create Queue dscp=2], [0], [ignore])
208 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(9),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xff,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
209 AT_CHECK([tail -1 stdout], [0],
210   [Datapath actions: dnl
211 100,dnl
212 set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x7,ttl=128,frag=no)),set(skb_priority(0x1)),1,dnl
213 set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xb,ttl=128,frag=no)),set(skb_priority(0x2)),1,dnl
214 1,dnl
215 set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x7,ttl=128,frag=no)),set(skb_priority(0x1)),1,dnl
216 set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xff,ttl=128,frag=no)),set(skb_priority(0)),1,dnl
217 set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x3,ttl=128,frag=no)),1,dnl
218 100
219 ])
220 OVS_VSWITCHD_STOP
221 AT_CLEANUP
222
223 AT_SETUP([ofproto-dpif - output/flood flags])
224 OVS_VSWITCHD_START
225 ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [7])
226
227 AT_DATA([flows.txt], [dnl
228 in_port=local actions=local,flood
229 in_port=1 actions=flood
230 in_port=2 actions=all
231 in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
232 in_port=4 actions=enqueue:LOCAL:1,enqueue:1:1,enqueue:2:1,enqueue:3:2,enqueue:4:1,enqueue:5:1,enqueue:6:1,enqueue:7:1
233 ])
234 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
235 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
236 AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
237
238 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
239 AT_CHECK([tail -1 stdout \
240 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
241 1
242 2
243 3
244 4
245 7
246 ])
247
248 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
249 AT_CHECK([tail -1 stdout \
250 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
251 100
252 2
253 3
254 4
255 7
256 ])
257
258 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
259 AT_CHECK([tail -1 stdout \
260 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
261 1
262 100
263 3
264 4
265 6
266 7
267 ])
268
269 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
270 AT_CHECK([tail -1 stdout], [0],
271   [Datapath actions: 100,1,2,4,6,7
272 ])
273
274 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(4),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
275 AT_CHECK([tail -1 stdout], [0],
276   [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
277 ])
278 OVS_VSWITCHD_STOP
279 AT_CLEANUP
280
281 AT_SETUP([ofproto-dpif - controller])
282 OVS_VSWITCHD_START([dnl
283    add-port br0 p1 -- set Interface p1 type=dummy
284 ])
285 ON_EXIT([kill `cat ovs-ofctl.pid`])
286
287 AT_CAPTURE_FILE([ofctl_monitor.log])
288 AT_DATA([flows.txt], [dnl
289 cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
290 cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
291 cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
292
293 cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
294 cookie=0x4 table=2 in_port=81 actions=load:2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,controller,resubmit(82,3)
295 cookie=0x5 table=3 in_port=82 actions=load:3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,controller,resubmit(83,4)
296 cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
297 cookie=0x7 table=5 in_port=84 actions=load:5->NXM_NX_REG4[[]],load:6->NXM_NX_TUN_ID[[]],mod_nw_dst:84.84.84.84,controller,resubmit(85,6)
298 cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
299 cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
300 cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
301 cookie=0xa dl_src=40:44:44:44:44:42 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
302 cookie=0xa dl_src=41:44:44:44:44:42 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],pop_mpls:0x0800,controller
303 cookie=0xa dl_src=40:44:44:44:44:43 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
304 cookie=0xa dl_src=40:44:44:44:44:44 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
305 cookie=0xa dl_src=40:44:44:44:44:45 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,controller
306 cookie=0xa dl_src=40:44:44:44:44:46 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),controller
307 cookie=0xa dl_src=40:44:44:44:44:47 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,set_mpls_ttl(10),controller
308 cookie=0xa dl_src=40:44:44:44:44:48 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),dec_mpls_ttl,controller
309 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
310 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
311 cookie=0xc dl_src=70:77:77:77:77:77 actions=push_mpls:0x8848,load:1000->OXM_OF_MPLS_LABEL[[]],load:7->OXM_OF_MPLS_TC[[]],controller
312 cookie=0xd dl_src=80:88:88:88:88:88 arp actions=load:2->OXM_OF_ARP_OP[[]],controller,load:0xc0a88001->OXM_OF_ARP_SPA[[]],controller,load:0x404444444441->OXM_OF_ARP_THA[[]],controller
313 ])
314 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
315
316 dnl Flow miss.
317 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
318
319 for i in 1 2 3 ; do
320     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'
321 done
322 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
323 ovs-appctl -t ovs-ofctl exit
324
325 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
326 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
327 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9 tcp_csum:0
328 dnl
329 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
330 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9 tcp_csum:0
331 dnl
332 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
333 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9 tcp_csum:0
334 ])
335
336 dnl Singleton controller action.
337 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
338
339 for i in 1 2 3 ; do
340     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10)'
341 done
342 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
343 ovs-appctl -t ovs-ofctl exit
344
345 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
346 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
347 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10 tcp_csum:0
348 dnl
349 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
350 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10 tcp_csum:0
351 dnl
352 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
353 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10 tcp_csum:0
354 ])
355
356 dnl Modified controller action.
357 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
358
359 for i in 1 2 3 ; do
360     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=30:33:33:33:33:33,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10)'
361 done
362 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
363 ovs-appctl -t ovs-ofctl exit
364
365 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
366 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
367 tcp,metadata=0,in_port=0,dl_vlan=15,dl_vlan_pcp=0,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10 tcp_csum:0
368 dnl
369 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
370 tcp,metadata=0,in_port=0,dl_vlan=15,dl_vlan_pcp=0,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10 tcp_csum:0
371 dnl
372 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
373 tcp,metadata=0,in_port=0,dl_vlan=15,dl_vlan_pcp=0,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10 tcp_csum:0
374 ])
375
376 dnl Modified VLAN controller action.
377 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
378
379 for i in 1 2 3; do
380     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:41,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
381 done
382 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
383 ovs-appctl -t ovs-ofctl exit
384
385 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
386 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
387 tcp,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64 tcp_csum:0
388 dnl
389 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
390 tcp,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64 tcp_csum:0
391 dnl
392 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
393 tcp,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64 tcp_csum:0
394 ])
395
396 dnl Modified MPLS controller action.
397 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
398
399 for i in 1 2 3; do
400     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:42,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
401 done
402 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
403 ovs-appctl -t ovs-ofctl exit
404
405 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
406 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
407 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:42,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
408 dnl
409 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
410 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:42,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
411 dnl
412 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
413 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:42,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
414 ])
415
416 dnl Modified MPLS controller action.
417 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
418
419 for i in 1 2 3; do
420     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=41:44:44:44:44:42,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
421 done
422 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
423 ovs-appctl -t ovs-ofctl exit
424
425 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
426 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
427 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=41:44:44:44:44:42,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64 tcp_csum:0
428 dnl
429 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
430 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=41:44:44:44:44:42,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64 tcp_csum:0
431 dnl
432 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
433 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=41:44:44:44:44:42,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64 tcp_csum:0
434 ])
435
436 dnl Modified MPLS controller action.
437 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
438
439 dnl in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x8847),mpls(label=100,tc=3,ttl=64,bos=1)
440
441 for i in 1 2 3; do
442     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:43,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1)'
443 done
444
445 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
446 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
447 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
448 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0
449 dnl
450 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
451 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0
452 dnl
453 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
454 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0
455 ])
456
457 dnl Modified MPLS controller action.
458 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
459
460 for i in 1 2 3; do
461     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:44,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no))'
462 done
463 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
464 ovs-appctl -t ovs-ofctl exit
465
466 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
467 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
468 mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=7,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
469 dnl
470 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
471 mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=7,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
472 dnl
473 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
474 mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=7,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
475 ])
476
477 dnl Modified MPLS controller action.
478 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
479
480 for i in 1 2 3; do
481     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:45,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
482 done
483 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
484 ovs-appctl -t ovs-ofctl exit
485
486 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
487 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
488 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=63,mpls_bos=1
489 dnl
490 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
491 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=63,mpls_bos=1
492 dnl
493 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
494 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=63,mpls_bos=1
495 ])
496
497 dnl Modified MPLS controller action.
498 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
499
500 for i in 1 2 3; do
501     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:46,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
502 done
503 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
504 ovs-appctl -t ovs-ofctl exit
505
506 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
507 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
508 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
509 dnl
510 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
511 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
512 dnl
513 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
514 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
515 ])
516
517 dnl Modified MPLS controller action.
518 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
519
520 for i in 1 2 3; do
521     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:47,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
522 done
523 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
524 ovs-appctl -t ovs-ofctl exit
525
526 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
527 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
528 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
529 dnl
530 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
531 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
532 dnl
533 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
534 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
535 ])
536
537 dnl Modified MPLS controller action.
538 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
539
540 for i in 1 2 3; do
541     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:48,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
542 done
543 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
544 ovs-appctl -t ovs-ofctl exit
545
546 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
547 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
548 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=9,mpls_bos=1
549 dnl
550 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
551 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=9,mpls_bos=1
552 dnl
553 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
554 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=9,mpls_bos=1
555 ])
556
557 dnl Modified MPLS actions.
558 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
559
560 for i in 1 2 3; do
561     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:55:55:55:55:55,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=100,tc=7,ttl=64,bos=1)'
562 done
563 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
564 ovs-appctl -t ovs-ofctl exit
565
566 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
567 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
568 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=50:55:55:55:55:55,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
569 dnl
570 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
571 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=50:55:55:55:55:55,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
572 dnl
573 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
574 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=50:55:55:55:55:55,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
575 ])
576
577 dnl Modified MPLS ipv6 controller action.
578 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
579
580 for i in 1 2 3; do
581     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=70:77:77:77:77:77,dst=50:54:00:00:00:07),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)'
582 done
583 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
584 ovs-appctl -t ovs-ofctl exit
585
586 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
587 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
588 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=70:77:77:77:77:77,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
589 dnl
590 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
591 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=70:77:77:77:77:77,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
592 dnl
593 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
594 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=70:77:77:77:77:77,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
595 ])
596
597
598 dnl Modified MPLS pop action.
599 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
600 dnl 60:66:66:66:66:66 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
601 dnl             (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
602
603 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
604
605 for i in 1 2 3; do
606     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 66 66 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 40 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
607 done
608 #for i in 2 3; do
609 #    ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=60:66:66:66:66:66,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=10,tc=3,ttl=100,bos=1)'
610 #done
611 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
612 ovs-appctl -t ovs-ofctl exit
613
614 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
615 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
616 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0 tcp_csum:7744
617 dnl
618 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
619 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0 tcp_csum:7744
620 dnl
621 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
622 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0 tcp_csum:7744
623 ])
624
625 dnl Checksum TCP.
626 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --no-chdir --pidfile 2> ofctl_monitor.log])
627
628 for i in 1 ; do
629     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=20:22:22:22:22:22,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=11)'
630 done
631 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
632 ovs-appctl -t ovs-ofctl exit
633
634 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
635 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
636 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11 tcp_csum:0
637 dnl
638 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 in_port=1 reg0=0x1 (via action) data_len=64 (unbuffered)
639 tcp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11 tcp_csum:0
640 dnl
641 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 in_port=1 reg0=0x1 reg1=0x2 (via action) data_len=64 (unbuffered)
642 tcp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11 tcp_csum:0
643 dnl
644 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 (via action) data_len=64 (unbuffered)
645 tcp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11 tcp_csum:0
646 dnl
647 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 (via action) data_len=64 (unbuffered)
648 tcp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11 tcp_csum:1a03
649 dnl
650 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
651 tcp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11 tcp_csum:3205
652 dnl
653 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
654 tcp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=11 tcp_csum:31b8
655 dnl
656 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
657 tcp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86 tcp_csum:316d
658 dnl
659 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
660 tcp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86 tcp_csum:316d
661 ])
662
663 dnl Checksum UDP.
664 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
665
666 for i in 1 ; do
667     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 20 22 22 22 22 22 08 00 45 00 00 1C 00 00 00 00 00 11 00 00 C0 A8 00 01 C0 A8 00 02 00 08 00 0B 00 00 12 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
668 done
669 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
670 ovs-appctl -t ovs-ofctl exit
671
672 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
673 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
674 udp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
675 dnl
676 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 in_port=1 reg0=0x1 (via action) data_len=64 (unbuffered)
677 udp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
678 dnl
679 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 in_port=1 reg0=0x1 reg1=0x2 (via action) data_len=64 (unbuffered)
680 udp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
681 dnl
682 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 (via action) data_len=64 (unbuffered)
683 udp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
684 dnl
685 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 (via action) data_len=64 (unbuffered)
686 udp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:2c37
687 dnl
688 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
689 udp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:4439
690 dnl
691 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
692 udp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=11 udp_csum:43ec
693 dnl
694 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
695 udp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 udp_csum:43a1
696 dnl
697 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
698 udp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 udp_csum:43a1
699 ])
700
701 dnl Modified ARP controller action.
702 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
703
704 for i in 1 2 3; do
705     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=80:88:88:88:88:88,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
706 done
707
708 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
709 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
710 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
711 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
712 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
713 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
714 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
715 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
716 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
717 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
718 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
719 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
720 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
721 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
722 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
723 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
724 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
725 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
726 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
727 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
728 ])
729
730 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
731
732 dnl Checksum SCTP.
733 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
734
735 for i in 1 ; do
736     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 20 22 22 22 22 22 08 00 45 00 00 24 00 00 00 00 00 84 00 00 C0 A8 00 01 C0 A8 00 02 04 58 08 af 00 00 00 00 d9 d7 91 57 01 00 00 34 cf 28 ec 4e 00 01 40 00 00 0a ff ff b7 53 24 19 00 05 00 08 7f 00 00 01 00 05 00 08 c0 a8 02 07 00 0c 00 06 00 05 00 00 80 00 00 04 c0 00 00 04'
737 done
738
739 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
740 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
741 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
742 sctp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
743 dnl
744 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 in_port=1 reg0=0x1 (via action) data_len=102 (unbuffered)
745 sctp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
746 dnl
747 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=102 in_port=1 reg0=0x1 reg1=0x2 (via action) data_len=102 (unbuffered)
748 sctp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
749 dnl
750 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=102 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 (via action) data_len=102 (unbuffered)
751 sctp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
752 dnl
753 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=102 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 (via action) data_len=102 (unbuffered)
754 sctp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
755 dnl
756 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=102 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=102 (unbuffered)
757 sctp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
758 dnl
759 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=102 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=102 (unbuffered)
760 sctp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=2223 sctp_csum:7f12662e
761 dnl
762 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=102 (unbuffered)
763 sctp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 sctp_csum:a7e86f67
764 dnl
765 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=102 (unbuffered)
766 sctp,metadata=0,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 sctp_csum:a7e86f67
767 ])
768
769 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
770  cookie=0x1, n_packets=3, n_bytes=218, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
771  cookie=0x2, n_packets=3, n_bytes=180, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
772  cookie=0x3, table=1, n_packets=3, n_bytes=218, in_port=80 actions=load:0x1->NXM_NX_REG0[[]],mod_vlan_vid:80,CONTROLLER:65535,resubmit(81,2)
773  cookie=0x4, table=2, n_packets=3, n_bytes=218, in_port=81 actions=load:0x2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,CONTROLLER:65535,resubmit(82,3)
774  cookie=0x5, table=3, n_packets=3, n_bytes=218, in_port=82 actions=load:0x3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,CONTROLLER:65535,resubmit(83,4)
775  cookie=0x6, table=4, n_packets=3, n_bytes=218, in_port=83 actions=load:0x4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,CONTROLLER:65535,resubmit(84,5)
776  cookie=0x7, table=5, n_packets=3, n_bytes=218, in_port=84 actions=load:0x5->NXM_NX_REG4[[]],load:0x6->NXM_NX_TUN_ID[[]],mod_nw_dst:84.84.84.84,CONTROLLER:65535,resubmit(85,6)
777  cookie=0x8, table=6, n_packets=3, n_bytes=218, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
778  cookie=0x9, table=7, n_packets=3, n_bytes=218, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
779  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,CONTROLLER:65535
780  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:42 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
781  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:43 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
782  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:44 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
783  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:45 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,CONTROLLER:65535
784  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:46 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),CONTROLLER:65535
785  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:47 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,set_mpls_ttl(10),CONTROLLER:65535
786  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:48 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),dec_mpls_ttl,CONTROLLER:65535
787  cookie=0xa, n_packets=3, n_bytes=180, dl_src=41:44:44:44:44:42 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],pop_mpls:0x0800,CONTROLLER:65535
788  cookie=0xb, n_packets=3, n_bytes=180, mpls,dl_src=50:55:55:55:55:55 actions=load:0x3e8->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
789  cookie=0xc, n_packets=3, n_bytes=180, dl_src=70:77:77:77:77:77 actions=push_mpls:0x8848,load:0x3e8->OXM_OF_MPLS_LABEL[[]],load:0x7->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
790  cookie=0xd, n_packets=3, n_bytes=180, arp,dl_src=80:88:88:88:88:88 actions=load:0x2->NXM_OF_ARP_OP[[]],CONTROLLER:65535,load:0xc0a88001->NXM_OF_ARP_SPA[[]],CONTROLLER:65535,load:0x404444444441->NXM_NX_ARP_THA[[]],CONTROLLER:65535
791  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
792  n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
793 NXST_FLOW reply:
794 ])
795
796 OVS_VSWITCHD_STOP
797 AT_CLEANUP
798
799 AT_SETUP([ofproto-dpif - ARP modification slow-path])
800 OVS_VSWITCHD_START
801 ADD_OF_PORTS([br0], [1], [2])
802
803 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
804 ovs-ofctl add-flow br0 'in_port=1,arp actions=load:2->OXM_OF_ARP_OP[[]],2,load:0xc0a88001->OXM_OF_ARP_SPA[[]],2,load:0x404444444441->OXM_OF_ARP_THA[[]],2'
805
806 # Input some packets that should follow the arp modification slow-path.
807 for i in 1 2 3; do
808     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=80:88:88:88:88:88,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
809 done
810 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
811
812 # Check the packets that were output.
813 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
814 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
815 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
816 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
817 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
818 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
819 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
820 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
821 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
822 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
823 ])
824
825 # Check that each of the packets actually passed through the slow-path.
826 AT_CHECK([ovs-appctl coverage/show], [0], [stdout])
827 AT_CHECK([sed -n 's/[[  ]]\{2,\}/ /g
828 s/^dpif_execute_with_help.*total: //p' stdout], [0], [3
829 ])
830
831 OVS_VSWITCHD_STOP
832 AT_CLEANUP
833
834 AT_SETUP([ofproto-dpif - VLAN handling])
835 OVS_VSWITCHD_START(
836   [set Bridge br0 fail-mode=standalone -- \
837    add-port br0 p1                                  trunks=10,12 -- \
838    add-port br0 p2                           tag=10              -- \
839    add-port br0 p3                           tag=12              \
840                    other-config:priority-tags=true               -- \
841    add-port br0 p4                           tag=12              -- \
842    add-port br0 p5 vlan_mode=native-tagged   tag=10              -- \
843    add-port br0 p6 vlan_mode=native-tagged   tag=10 trunks=10,12 -- \
844    add-port br0 p7 vlan_mode=native-untagged tag=12              -- \
845    add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
846                    other-config:priority-tags=true               -- \
847    set Interface p1 type=dummy -- \
848    set Interface p2 type=dummy -- \
849    set Interface p3 type=dummy -- \
850    set Interface p4 type=dummy -- \
851    set Interface p5 type=dummy -- \
852    set Interface p6 type=dummy -- \
853    set Interface p7 type=dummy -- \
854    set Interface p8 type=dummy --])
855
856 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
857 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
858 dnl actions.
859 for tuple in \
860         "100 none 0 drop" \
861         "100 0    0 drop" \
862         "100 0    1 drop" \
863         "100 10   0 1,5,6,7,8,pop_vlan,2" \
864         "100 10   1 1,5,6,7,8,pop_vlan,2" \
865         "100 11   0 5,7" \
866         "100 11   1 5,7" \
867         "100 12   0 1,5,6,pop_vlan,3,4,7,8" \
868         "100 12   1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
869         "1  none 0 drop" \
870         "1  0    0 drop" \
871         "1  0    1 drop" \
872         "1  10   0 5,6,7,8,100,pop_vlan,2" \
873         "1  10   1 5,6,7,8,100,pop_vlan,2" \
874         "1  11   0 drop" \
875         "1  11   1 drop" \
876         "1  12   0 5,6,100,pop_vlan,3,4,7,8" \
877         "1  12   1 5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
878         "2  none 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
879         "2  0    0 pop_vlan,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
880         "2  0    1 pop_vlan,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
881         "2  10   0 drop" \
882         "2  10   1 drop" \
883         "2  11   0 drop" \
884         "2  11   1 drop" \
885         "2  12   0 drop" \
886         "2  12   1 drop" \
887         "3  none 0 4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
888         "3  0    0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
889         "3  0    1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
890         "3  10   0 drop" \
891         "3  10   1 drop" \
892         "3  11   0 drop" \
893         "3  11   1 drop" \
894         "3  12   0 drop" \
895         "3  12   1 drop" \
896         "4  none 0 3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
897         "4  0    0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
898         "4  0    1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
899         "4  10   0 drop" \
900         "4  10   1 drop" \
901         "4  11   0 drop" \
902         "4  11   1 drop" \
903         "4  12   0 drop" \
904         "4  12   1 drop" \
905         "5  none 0 2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
906         "5  0    0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
907         "5  0    1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
908         "5  10   0 1,6,7,8,100,pop_vlan,2" \
909         "5  10   1 1,6,7,8,100,pop_vlan,2" \
910         "5  11   0 7,100" \
911         "5  11   1 7,100" \
912         "5  12   0 1,6,100,pop_vlan,3,4,7,8" \
913         "5  12   1 1,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
914         "6  none 0 2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
915         "6  0    0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
916         "6  0    1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
917         "6  10   0 1,5,7,8,100,pop_vlan,2" \
918         "6  10   1 1,5,7,8,100,pop_vlan,2" \
919         "6  11   0 drop" \
920         "6  11   1 drop" \
921         "6  12   0 1,5,100,pop_vlan,3,4,7,8" \
922         "6  12   1 1,5,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
923         "7  none 0 3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
924         "7  0    0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
925         "7  0    1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),1,5,6,100" \
926         "7  10   0 1,5,6,8,100,pop_vlan,2" \
927         "7  10   1 1,5,6,8,100,pop_vlan,2" \
928         "7  11   0 5,100" \
929         "7  11   1 5,100" \
930         "7  12   0 1,5,6,100,pop_vlan,3,4,8" \
931         "7  12   1 1,5,6,100,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
932         "8  none 0 3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
933         "8  0    0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
934         "8  0    1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
935         "8  10   0 1,5,6,7,100,pop_vlan,2" \
936         "8  10   1 1,5,6,7,100,pop_vlan,2" \
937         "8  11   0 drop" \
938         "8  11   1 drop" \
939         "8  12   0 1,5,6,100,pop_vlan,3,4,7" \
940         "8  12   1 1,5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
941 do
942   set $tuple
943   in_port=$1
944   vlan=$2
945   pcp=$3
946   expected=$4
947
948   if test $vlan = none; then
949     flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
950   else
951     flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8100),vlan(vid=$vlan,pcp=$pcp),encap(eth_type(0xabcd))"
952   fi
953
954   echo "----------------------------------------------------------------------"
955   echo "in_port=$in_port vlan=$vlan pcp=$pcp"
956
957   AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
958   actual=`tail -1 stdout | sed 's/Datapath actions: //'`
959
960   AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
961   mv stdout expout
962   AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
963 done
964
965 OVS_VSWITCHD_STOP
966 AT_CLEANUP
967
968 AT_SETUP([ofproto-dpif - fragment handling])
969 OVS_VSWITCHD_START
970 ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [90])
971 AT_DATA([flows.txt], [dnl
972 priority=75 tcp ip_frag=no    tp_dst=80 actions=output:1
973 priority=75 tcp ip_frag=first tp_dst=80 actions=output:2
974 priority=75 tcp ip_frag=later tp_dst=80 actions=output:3
975 priority=50 tcp ip_frag=no              actions=output:4
976 priority=50 tcp ip_frag=first           actions=output:5
977 priority=50 tcp ip_frag=later           actions=output:6
978 ])
979 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
980
981 base_flow="in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=128"
982 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
983 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
984 later_flow="$base_flow,frag=later)"
985
986     # mode    no  first  later
987 for tuple in \
988     'normal    1     5      6' \
989     'drop      1  drop   drop' \
990     'nx-match  1     2      6'
991 do
992   set $tuple
993   mode=$1
994   no=$2
995   first=$3
996   later=$4
997
998   AT_CHECK([ovs-ofctl set-frags br0 $mode])
999   for type in no first later; do
1000     eval flow=\$${type}_flow exp_output=\$$type
1001     printf "\n%s\n" "----$mode $type-----"
1002     AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1003     : > expout
1004     if test $mode = drop && test $type != no; then
1005         echo 'Packets dropped because they are IP fragments and the fragment handling mode is "drop".' >> expout
1006     fi
1007     echo "Datapath actions: $exp_output" >> expout
1008     AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
1009   done
1010 done
1011 OVS_VSWITCHD_STOP
1012 AT_CLEANUP
1013
1014 AT_SETUP([ofproto-dpif - exit])
1015 OVS_VSWITCHD_START
1016 ADD_OF_PORTS([br0], [1], [2], [3], [10], [11], [12], [13], [14])
1017 AT_DATA([flows.txt], [dnl
1018 in_port=1 actions=output:10,exit,output:11
1019 in_port=2 actions=output:12,resubmit:1,output:12
1020 in_port=3 actions=output:13,resubmit:2,output:14
1021 ])
1022 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1023 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
1024 AT_CHECK([tail -1 stdout], [0],
1025   [Datapath actions: 10
1026 ])
1027 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
1028 AT_CHECK([tail -1 stdout], [0],
1029   [Datapath actions: 12,10
1030 ])
1031 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
1032 AT_CHECK([tail -1 stdout], [0],
1033   [Datapath actions: 13,12,10
1034 ])
1035 OVS_VSWITCHD_STOP
1036 AT_CLEANUP
1037
1038
1039 AT_SETUP([ofproto-dpif - mirroring, select_all])
1040 OVS_VSWITCHD_START
1041 ADD_OF_PORTS([br0], 1, 2, 3)
1042 ovs-vsctl \
1043         set Bridge br0 mirrors=@m --\
1044         --id=@p3 get Port p3 --\
1045         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
1046
1047 AT_DATA([flows.txt], [dnl
1048 in_port=1 actions=output:2
1049 in_port=2 actions=output:1
1050 ])
1051 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1052
1053 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1054 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1055 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1056   [Datapath actions: 2,3
1057 ])
1058
1059 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1060 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1061 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1062   [Datapath actions: 1,3
1063 ])
1064
1065 OVS_VSWITCHD_STOP
1066 AT_CLEANUP
1067
1068
1069 AT_SETUP([ofproto-dpif - mirroring, select_src])
1070 OVS_VSWITCHD_START
1071 ADD_OF_PORTS([br0], 1, 2, 3)
1072 ovs-vsctl \
1073         set Bridge br0 mirrors=@m --\
1074         --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
1075         --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
1076
1077 AT_DATA([flows.txt], [dnl
1078 in_port=1 actions=output:2
1079 in_port=2 actions=output:1
1080 ])
1081 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1082
1083 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1084 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1085 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1086   [Datapath actions: 2,3
1087 ])
1088
1089 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1090 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1091 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1092   [Datapath actions: 1
1093 ])
1094 OVS_VSWITCHD_STOP
1095 AT_CLEANUP
1096
1097 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
1098 OVS_VSWITCHD_START
1099 ADD_OF_PORTS([br0], 1, 2)
1100 ovs-vsctl \
1101         set Bridge br0 mirrors=@m --\
1102         --id=@p2 get Port p2 --\
1103         --id=@m create Mirror name=mymirror select_all=true output_port=@p2
1104
1105 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
1106
1107 # "in_port" defaults to OFPP_NONE if it's not specified.
1108 flow="icmp,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_ttl=128,icmp_type=8,icmp_code=0"
1109 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
1110 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1111   [Datapath actions: 1,2
1112 ])
1113
1114 OVS_VSWITCHD_STOP
1115 AT_CLEANUP
1116
1117
1118 AT_SETUP([ofproto-dpif - mirroring, select_dst])
1119 OVS_VSWITCHD_START
1120 ADD_OF_PORTS([br0], 1, 2, 3)
1121 ovs-vsctl \
1122         set Bridge br0 mirrors=@m --\
1123         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
1124         --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
1125
1126 AT_DATA([flows.txt], [dnl
1127 in_port=1 actions=output:2
1128 in_port=2 actions=output:1
1129 ])
1130 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1131
1132 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1133 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1134 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1135   [Datapath actions: 2,3
1136 ])
1137
1138 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1139 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1140 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1141   [Datapath actions: 1
1142 ])
1143
1144 OVS_VSWITCHD_STOP
1145 AT_CLEANUP
1146
1147
1148 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
1149 OVS_VSWITCHD_START
1150 ADD_OF_PORTS([br0], 1, 2, 3)
1151 ovs-vsctl \
1152         set Bridge br0 mirrors=@m --\
1153         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
1154         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
1155
1156 AT_DATA([flows.txt], [dnl
1157 in_port=1, actions=output:2
1158 ])
1159 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1160
1161 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1162 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1163 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1164   [Datapath actions: 2
1165 ])
1166
1167 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=10,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))"
1168 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1169 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1170   [Datapath actions: 2
1171 ])
1172
1173 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=11,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))"
1174 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1175 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1176   [Datapath actions: 2,3
1177 ])
1178
1179 OVS_VSWITCHD_STOP
1180 AT_CLEANUP
1181
1182
1183 AT_SETUP([ofproto-dpif - mirroring, output_port])
1184 OVS_VSWITCHD_START
1185 ADD_OF_PORTS([br0], 1, 2, 3)
1186 ovs-vsctl \
1187         set Bridge br0 mirrors=@m --\
1188         --id=@p3 get Port p3 --\
1189         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
1190
1191 AT_DATA([flows.txt], [dnl
1192 in_port=1 actions=mod_vlan_vid:17,output:2
1193 in_port=2 actions=output:1
1194 ])
1195 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1196
1197 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1198 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1199 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1200   [Datapath actions: push_vlan(vid=17,pcp=0),2,pop_vlan,3
1201 ])
1202
1203 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1204 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1205 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
1206   [Datapath actions: 1,3
1207 ])
1208
1209 OVS_VSWITCHD_STOP
1210 AT_CLEANUP
1211
1212 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
1213 OVS_VSWITCHD_START
1214 ADD_OF_PORTS([br0], 1, 2)
1215 ovs-vsctl \
1216         set Bridge br0 mirrors=@m --\
1217         --id=@m create Mirror name=mymirror select_all=true output_vlan=12
1218
1219 AT_DATA([flows.txt], [dnl
1220 in_port=1 actions=output:2
1221 in_port=2 actions=mod_vlan_vid:17,output:1
1222 ])
1223 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1224
1225 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1226 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1227 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
1228
1229 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
1230 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
1231 mv stdout expout
1232 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
1233
1234 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
1235 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1236 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
1237
1238 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
1239 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
1240 mv stdout expout
1241 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
1242
1243 OVS_VSWITCHD_STOP
1244 AT_CLEANUP
1245
1246 # Two testcases below are for the ofproto/trace command
1247 # The first one tests all correct syntax:
1248 # ofproto/trace [dp_name] odp_flow [-generate|packet]
1249 # ofproto/trace br_name br_flow [-generate|packet]
1250 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
1251 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
1252 ADD_OF_PORTS([br0], 1, 2, 3)
1253
1254 AT_DATA([flows.txt], [dnl
1255 in_port=1 actions=output:2
1256 in_port=2 actions=output:1
1257 ])
1258 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1259
1260 odp_flow="in_port(p1)"
1261 br_flow="in_port=1"
1262 # Test command: ofproto/trace odp_flow with in_port as a name.
1263 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
1264 AT_CHECK([tail -1 stdout], [0], [dnl
1265 Datapath actions: 2
1266 ])
1267
1268 odp_flow="in_port(1)"
1269 # Test command: ofproto/trace odp_flow
1270 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
1271 AT_CHECK([tail -1 stdout], [0], [dnl
1272 Datapath actions: 2
1273 ])
1274
1275 # Test command: ofproto/trace dp_name odp_flow
1276 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
1277 AT_CHECK([tail -1 stdout], [0], [dnl
1278 Datapath actions: 2
1279 ])
1280 # Test commmand: ofproto/trace br_name br_flow
1281 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
1282 AT_CHECK([tail -1 stdout], [0], [dnl
1283 Datapath actions: 2
1284 ])
1285
1286 # Delete the inserted flows
1287 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
1288 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
1289
1290 # This section beflow tests the [-generate] option
1291 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
1292 br_flow="arp,metadata=0,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=ff:ff:ff:ff:ff:ff"
1293
1294 # Test command: ofproto/trace odp_flow
1295 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
1296 # Check for no MAC learning entry
1297 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1298  port  VLAN  MAC                Age
1299 ])
1300
1301 # Test command: ofproto/trace br_name br_flow
1302 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
1303 # Check for no MAC learning entry
1304 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1305  port  VLAN  MAC                Age
1306 ])
1307
1308 # Test command: ofproto/trace odp_flow -generate
1309 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
1310 # Check for the MAC learning entry
1311 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1312  port  VLAN  MAC                Age
1313     3     0  50:54:00:00:00:05    ?
1314 ])
1315
1316 # Test command: ofproto/trace dp_name odp_flow -generate
1317 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
1318   "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
1319   -generate], [0], [stdout])
1320 # Check for both MAC learning entries
1321 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1322  port  VLAN  MAC                Age
1323     3     0  50:54:00:00:00:05    ?
1324     1     0  50:54:00:00:00:06    ?
1325 ])
1326
1327 # Test command: ofproto/trace br_name br_flow -generate
1328 AT_CHECK([ovs-appctl ofproto/trace br0 \
1329   "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
1330   -generate], [0], [stdout])
1331 # Check for both MAC learning entries.
1332 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1333  port  VLAN  MAC                Age
1334     3     0  50:54:00:00:00:05    ?
1335     1     0  50:54:00:00:00:06    ?
1336     2     0  50:54:00:00:00:07    ?
1337 ])
1338
1339 # This section beflow tests the [packet] option
1340 # The ovs-tcpundump of packets between port1 and port2
1341 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
1342 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
1343
1344 # Construct the MAC learning table
1345 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
1346   "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
1347   -generate], [0], [stdout])
1348
1349 # Construct the MAC learning table
1350 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
1351   "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
1352   -generate], [0], [stdout])
1353
1354 # Test command: ofproto/trace odp_flow packet
1355 AT_CHECK([ovs-appctl ofproto/trace \
1356   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
1357 AT_CHECK([tail -1 stdout], [0], [dnl
1358 Datapath actions: 2
1359 ])
1360 AT_CHECK([head -n 3 stdout], [0], [dnl
1361 Bridge: br0
1362 Packet: arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
1363 Flow: pkt_mark=0x2,skb_priority=0x1,arp,metadata=0,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
1364 ])
1365
1366 # Test command: ofproto/trace dp_name odp_flow packet
1367 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
1368   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
1369 AT_CHECK([tail -1 stdout], [0], [dnl
1370 Datapath actions: 2
1371 ])
1372 AT_CHECK([head -n 3 stdout], [0], [dnl
1373 Bridge: br0
1374 Packet: arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
1375 Flow: pkt_mark=0x2,skb_priority=0x1,arp,metadata=0,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
1376 ])
1377
1378 # Test command: ofproto/trace br_name br_flow packet
1379 AT_CHECK([ovs-appctl ofproto/trace br0 \
1380   "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
1381 AT_CHECK([tail -1 stdout], [0], [dnl
1382 Datapath actions: 1
1383 ])
1384 AT_CHECK([head -n 2 stdout], [0], [dnl
1385 Packet: arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:02,dl_dst=50:54:00:00:00:01,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
1386 Flow: pkt_mark=0x1,skb_priority=0x2,arp,metadata=0,in_port=2,vlan_tci=0x0000,dl_src=50:54:00:00:00:02,dl_dst=50:54:00:00:00:01,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
1387 ])
1388
1389 OVS_VSWITCHD_STOP
1390 AT_CLEANUP
1391
1392 # The second test tests the corner cases
1393 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
1394 OVS_VSWITCHD_START
1395 ADD_OF_PORTS([br0], 1, 2)
1396
1397 # Define flows
1398 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
1399 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
1400 # Define options
1401 generate="-generate"
1402 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
1403
1404 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
1405 m4_foreach(
1406 [option],
1407 [[],
1408 ["$generate"],
1409 ["$pkt"]],
1410 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
1411   [2], [], [stderr])
1412 AT_CHECK([tail -2 stderr], [0], [dnl
1413 Cannot find the datapath
1414 ovs-appctl: ovs-vswitchd: server returned an error
1415 ])])
1416
1417 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
1418 m4_foreach(
1419 [option],
1420 [[],
1421 ["$generate"],
1422 ["$pkt"]],
1423 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
1424   [2], [], [stderr])
1425 AT_CHECK([tail -2 stderr], [0], [dnl
1426 Cannot find the datapath
1427 ovs-appctl: ovs-vswitchd: server returned an error
1428 ])])
1429
1430 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
1431 m4_foreach(
1432 [option],
1433 [[],
1434 ["$generate"],
1435 ["$pkt"]],
1436 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
1437   [2], [], [stderr])
1438 AT_CHECK([tail -2 stderr], [0], [dnl
1439 Cannot find the datapath
1440 ovs-appctl: ovs-vswitchd: server returned an error
1441 ])])
1442
1443 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
1444 m4_foreach(
1445 [option],
1446 [[],
1447 ["$generate"],
1448 ["$pkt"]],
1449 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
1450   [2], [], [stderr])
1451 AT_CHECK([tail -2 stderr], [0], [dnl
1452 Cannot find the datapath
1453 ovs-appctl: ovs-vswitchd: server returned an error
1454 ])])
1455
1456 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
1457 m4_foreach(
1458 [option],
1459 [[],
1460 ["$generate"],
1461 ["$pkt"]],
1462 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
1463   [2], [], [stderr])
1464 AT_CHECK([tail -2 stderr], [0], [dnl
1465 Unknown bridge name
1466 ovs-appctl: ovs-vswitchd: server returned an error
1467 ])])
1468
1469 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
1470 m4_foreach(
1471 [option],
1472 [[],
1473 ["$generate"],
1474 ["$pkt"]],
1475 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
1476   [2], [], [stderr])
1477 AT_CHECK([tail -2 stderr], [0], [dnl
1478 Must specify bridge name
1479 ovs-appctl: ovs-vswitchd: server returned an error
1480 ])])
1481
1482 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
1483 AT_CHECK([ovs-appctl ofproto/trace \
1484   ovs-dummy "$odp_flow" garbage_option],
1485   [2], [stdout],[stderr])
1486 AT_CHECK([tail -2 stderr], [0], [dnl
1487 Trailing garbage in packet data
1488 ovs-appctl: ovs-vswitchd: server returned an error
1489 ])
1490
1491 # Test incorrect command: ofproto/trace with 4 arguments
1492 AT_CHECK([ovs-appctl ofproto/trace \
1493   arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
1494 AT_CHECK([tail -2 stderr], [0], [dnl
1495 "ofproto/trace" command takes at most 3 arguments
1496 ovs-appctl: ovs-vswitchd: server returned an error
1497 ])
1498
1499 # Test incorrect command: ofproto/trace with 0 argument
1500 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
1501 AT_CHECK([tail -2 stderr], [0], [dnl
1502 "ofproto/trace" command requires at least 1 arguments
1503 ovs-appctl: ovs-vswitchd: server returned an error
1504 ])
1505
1506 OVS_VSWITCHD_STOP
1507 AT_CLEANUP
1508
1509 m4_define([OFPROTO_TRACE],
1510   [flow="$2"
1511    AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
1512    actual=`tail -1 stdout | sed 's/Datapath actions: //'`
1513    expected="$4"
1514    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
1515      [0], [stdout])
1516    mv stdout expout
1517    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
1518      [0], [expout])])
1519
1520 AT_SETUP([ofproto-dpif - MAC learning])
1521 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
1522 ADD_OF_PORTS([br0], 1, 2, 3)
1523
1524 arp='eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
1525
1526 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
1527 OFPROTO_TRACE(
1528   [ovs-dummy],
1529   [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
1530   [-generate],
1531   [1,2,100])
1532
1533 # Check for the MAC learning entry.
1534 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1535  port  VLAN  MAC                Age
1536     3     0  50:54:00:00:00:05    ?
1537 ])
1538
1539 # Trace a packet arrival destined for the learned MAC.
1540 # (This will also learn a MAC.)
1541 OFPROTO_TRACE(
1542   [ovs-dummy],
1543   [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
1544   [-generate],
1545   [3])
1546
1547 # Check for both MAC learning entries.
1548 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1549  port  VLAN  MAC                Age
1550     3     0  50:54:00:00:00:05    ?
1551     1     0  50:54:00:00:00:06    ?
1552 ])
1553
1554 # Trace a packet arrival that updates the first learned MAC entry.
1555 OFPROTO_TRACE(
1556   [ovs-dummy],
1557   [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
1558   [-generate],
1559   [1,3,100])
1560
1561 # Check that the MAC learning entry was updated.
1562 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1563  port  VLAN  MAC                Age
1564     1     0  50:54:00:00:00:06    ?
1565     2     0  50:54:00:00:00:05    ?
1566 ])
1567
1568 # Add another bridge.
1569 AT_CHECK(
1570   [ovs-vsctl \
1571      -- add-br br1 \
1572      -- set bridge br1 datapath-type=dummy])
1573 ADD_OF_PORTS([br1], 4, 5)
1574
1575 # Trace some packet arrivals in br1 to create MAC learning entries there too.
1576 OFPROTO_TRACE(
1577   [ovs-dummy],
1578   [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
1579   [-generate],
1580   [5,101])
1581 OFPROTO_TRACE(
1582   [ovs-dummy],
1583   [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
1584   [-generate],
1585   [4,101])
1586
1587 # Check that the MAC learning entries were added.
1588 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1589  port  VLAN  MAC                Age
1590     4     0  50:54:00:00:00:06    ?
1591     5     0  50:54:00:00:00:07    ?
1592 ])
1593
1594 # Delete port p1 and see that its MAC learning entry disappeared, and
1595 # that the MAC learning entry for the same MAC was also deleted from br1.
1596 AT_CHECK([ovs-vsctl del-port p1])
1597 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1598  port  VLAN  MAC                Age
1599     2     0  50:54:00:00:00:05    ?
1600 ])
1601 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
1602  port  VLAN  MAC                Age
1603     5     0  50:54:00:00:00:07    ?
1604 ])
1605
1606 OVS_VSWITCHD_STOP
1607 AT_CLEANUP
1608
1609 AT_SETUP([ofproto-dpif - MAC table overflow])
1610 OVS_VSWITCHD_START(
1611   [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
1612 ADD_OF_PORTS([br0], 1, 2, 3)
1613
1614 arp='eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
1615
1616 AT_CHECK([ovs-appctl time/stop])
1617
1618 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
1619 for i in 0 1 2 3 4 5 6 7 8 9; do
1620     OFPROTO_TRACE(
1621       [ovs-dummy],
1622       [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
1623       [-generate],
1624       [1,2,100])
1625     ovs-appctl time/warp 1000
1626 done
1627
1628 # Check for the MAC learning entries.
1629 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
1630   [0], [dnl
1631     3     0  50:54:00:00:00:00
1632     3     0  50:54:00:00:00:01
1633     3     0  50:54:00:00:00:02
1634     3     0  50:54:00:00:00:03
1635     3     0  50:54:00:00:00:04
1636     3     0  50:54:00:00:00:05
1637     3     0  50:54:00:00:00:06
1638     3     0  50:54:00:00:00:07
1639     3     0  50:54:00:00:00:08
1640     3     0  50:54:00:00:00:09
1641  port  VLAN  MAC                Age
1642 ])
1643
1644 # Trace another ARP packet on another MAC.
1645 OFPROTO_TRACE(
1646   [ovs-dummy],
1647   [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
1648   [-generate],
1649   [1,2,100])
1650
1651 # Check that the new one chased the oldest one out of the table.
1652 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
1653   [0], [dnl
1654     3     0  50:54:00:00:00:01    ?
1655     3     0  50:54:00:00:00:02    ?
1656     3     0  50:54:00:00:00:03    ?
1657     3     0  50:54:00:00:00:04    ?
1658     3     0  50:54:00:00:00:05    ?
1659     3     0  50:54:00:00:00:06    ?
1660     3     0  50:54:00:00:00:07    ?
1661     3     0  50:54:00:00:00:08    ?
1662     3     0  50:54:00:00:00:09    ?
1663     3     0  50:54:00:00:00:10    ?
1664  port  VLAN  MAC                Age
1665 ])
1666 OVS_VSWITCHD_STOP
1667 AT_CLEANUP
1668
1669 dnl Test that sFlow samples packets correctly.
1670 AT_SETUP([ofproto-dpif - sFlow packet sampling])
1671 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
1672
1673 ON_EXIT([kill `cat test-sflow.pid`])
1674 AT_CHECK([test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
1675 AT_CAPTURE_FILE([sflow.log])
1676 SFLOW_PORT=`parse_listening_port < test-sflow.log`
1677
1678 ovs-appctl time/stop
1679
1680 ADD_OF_PORTS([br0], 1, 2)
1681 ovs-vsctl \
1682    set Interface br0 options:ifindex=1002 -- \
1683    set Interface p1 options:ifindex=1004 -- \
1684    set Interface p2 options:ifindex=1003 -- \
1685    set Bridge br0 sflow=@sf -- \
1686    --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
1687      header=128 sampling=1 polling=1
1688
1689 dnl open with ARP packets to seed the bridge-learning.  The output
1690 dnl ifIndex numbers should be reported predictably after that.
1691 dnl Since we set sampling=1 we should see all of these packets
1692 dnl reported. Sorting the output by data-source and seqNo makes
1693 dnl it deterministic. Ensuring that we send at least two packets
1694 dnl into each port means we get to check the seq nos are
1695 dnl incrementing correctly.
1696
1697 ovs-appctl netdev-dummy/receive p1 'in_port(2),eth(src=50:54:00:00:00:05,dst=FF:FF:FF:FF:FF:FF),eth_type(0x0806),arp(sip=192.168.0.2,tip=192.168.0.1,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
1698 ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=FF:FF:FF:FF:FF:FF),eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:07,tha=00:00:00:00:00:00)'
1699 ovs-appctl netdev-dummy/receive p1 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
1700 ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)'
1701 ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x86dd),ipv6(src=fe80::1,dst=fe80::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)'
1702
1703 dnl sleep long enough to get more than one counter sample
1704 dnl from each datasource so we can check sequence numbers
1705 for i in `seq 1 30`; do
1706     ovs-appctl time/warp 100
1707 done
1708 OVS_VSWITCHD_STOP
1709 ovs-appctl -t test-sflow exit
1710
1711 AT_CHECK([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
1712         /g']], [0], [dnl
1713 HEADER
1714         dgramSeqNo=1
1715         ds=127.0.0.1>2:1000
1716         fsSeqNo=1
1717         in_vlan=0
1718         in_priority=0
1719         out_vlan=0
1720         out_priority=0
1721         meanSkip=1
1722         samplePool=1
1723         dropEvents=0
1724         in_ifindex=1004
1725         in_format=0
1726         out_ifindex=2
1727         out_format=2
1728         hdr_prot=1
1729         pkt_len=64
1730         stripped=4
1731         hdr_len=60
1732         hdr=FF-FF-FF-FF-FF-FF-50-54-00-00-00-05-08-06-00-01-08-00-06-04-00-01-50-54-00-00-00-05-C0-A8-00-02-00-00-00-00-00-00-C0-A8-00-01-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
1733 HEADER
1734         dgramSeqNo=1
1735         ds=127.0.0.1>2:1000
1736         fsSeqNo=2
1737         in_vlan=0
1738         in_priority=0
1739         out_vlan=0
1740         out_priority=0
1741         meanSkip=1
1742         samplePool=2
1743         dropEvents=0
1744         in_ifindex=1003
1745         in_format=0
1746         out_ifindex=2
1747         out_format=2
1748         hdr_prot=1
1749         pkt_len=64
1750         stripped=4
1751         hdr_len=60
1752         hdr=FF-FF-FF-FF-FF-FF-50-54-00-00-00-07-08-06-00-01-08-00-06-04-00-01-50-54-00-00-00-07-C0-A8-00-01-00-00-00-00-00-00-C0-A8-00-02-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
1753 HEADER
1754         dgramSeqNo=1
1755         ds=127.0.0.1>2:1000
1756         fsSeqNo=3
1757         in_vlan=0
1758         in_priority=0
1759         out_vlan=0
1760         out_priority=0
1761         meanSkip=1
1762         samplePool=3
1763         dropEvents=0
1764         in_ifindex=1004
1765         in_format=0
1766         out_ifindex=1003
1767         out_format=0
1768         hdr_prot=1
1769         pkt_len=64
1770         stripped=4
1771         hdr_len=60
1772         hdr=50-54-00-00-00-07-50-54-00-00-00-05-08-00-45-00-00-1C-00-00-00-00-40-01-F9-8D-C0-A8-00-01-C0-A8-00-02-08-00-F7-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
1773 HEADER
1774         dgramSeqNo=1
1775         ds=127.0.0.1>2:1000
1776         fsSeqNo=4
1777         in_vlan=0
1778         in_priority=0
1779         out_vlan=0
1780         out_priority=0
1781         meanSkip=1
1782         samplePool=4
1783         dropEvents=0
1784         in_ifindex=1003
1785         in_format=0
1786         out_ifindex=1004
1787         out_format=0
1788         hdr_prot=1
1789         pkt_len=64
1790         stripped=4
1791         hdr_len=60
1792         hdr=50-54-00-00-00-05-50-54-00-00-00-07-08-00-45-00-00-1C-00-00-00-00-40-01-F9-8D-C0-A8-00-02-C0-A8-00-01-00-00-FF-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
1793 HEADER
1794         dgramSeqNo=1
1795         ds=127.0.0.1>2:1000
1796         fsSeqNo=5
1797         in_vlan=0
1798         in_priority=0
1799         out_vlan=0
1800         out_priority=0
1801         meanSkip=1
1802         samplePool=5
1803         dropEvents=0
1804         in_ifindex=1003
1805         in_format=0
1806         out_ifindex=1004
1807         out_format=0
1808         hdr_prot=1
1809         pkt_len=64
1810         stripped=4
1811         hdr_len=60
1812         hdr=50-54-00-00-00-05-50-54-00-00-00-07-86-DD-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
1813 ])
1814
1815 AT_CHECK([[sort sflow.log | $EGREP 'IFCOUNTERS|ERROR' | head -6 | sed 's/ /\
1816         /g']], [0], [dnl
1817 IFCOUNTERS
1818         dgramSeqNo=2
1819         ds=127.0.0.1>0:1002
1820         csSeqNo=1
1821         ifindex=1002
1822         type=6
1823         ifspeed=100000000
1824         direction=0
1825         status=3
1826         in_octets=0
1827         in_unicasts=0
1828         in_multicasts=0
1829         in_broadcasts=4294967295
1830         in_discards=0
1831         in_errors=0
1832         in_unknownprotos=4294967295
1833         out_octets=120
1834         out_unicasts=2
1835         out_multicasts=4294967295
1836         out_broadcasts=4294967295
1837         out_discards=0
1838         out_errors=0
1839         promiscuous=0
1840 IFCOUNTERS
1841         dgramSeqNo=2
1842         ds=127.0.0.1>0:1003
1843         csSeqNo=1
1844         ifindex=1003
1845         type=6
1846         ifspeed=100000000
1847         direction=0
1848         status=0
1849         in_octets=98
1850         in_unicasts=3
1851         in_multicasts=0
1852         in_broadcasts=4294967295
1853         in_discards=0
1854         in_errors=0
1855         in_unknownprotos=4294967295
1856         out_octets=120
1857         out_unicasts=2
1858         out_multicasts=4294967295
1859         out_broadcasts=4294967295
1860         out_discards=0
1861         out_errors=0
1862         promiscuous=0
1863 IFCOUNTERS
1864         dgramSeqNo=2
1865         ds=127.0.0.1>0:1004
1866         csSeqNo=1
1867         ifindex=1004
1868         type=6
1869         ifspeed=100000000
1870         direction=0
1871         status=0
1872         in_octets=84
1873         in_unicasts=2
1874         in_multicasts=0
1875         in_broadcasts=4294967295
1876         in_discards=0
1877         in_errors=0
1878         in_unknownprotos=4294967295
1879         out_octets=180
1880         out_unicasts=3
1881         out_multicasts=4294967295
1882         out_broadcasts=4294967295
1883         out_discards=0
1884         out_errors=0
1885         promiscuous=0
1886 IFCOUNTERS
1887         dgramSeqNo=3
1888         ds=127.0.0.1>0:1002
1889         csSeqNo=2
1890         ifindex=1002
1891         type=6
1892         ifspeed=100000000
1893         direction=0
1894         status=3
1895         in_octets=0
1896         in_unicasts=0
1897         in_multicasts=0
1898         in_broadcasts=4294967295
1899         in_discards=0
1900         in_errors=0
1901         in_unknownprotos=4294967295
1902         out_octets=120
1903         out_unicasts=2
1904         out_multicasts=4294967295
1905         out_broadcasts=4294967295
1906         out_discards=0
1907         out_errors=0
1908         promiscuous=0
1909 IFCOUNTERS
1910         dgramSeqNo=3
1911         ds=127.0.0.1>0:1003
1912         csSeqNo=2
1913         ifindex=1003
1914         type=6
1915         ifspeed=100000000
1916         direction=0
1917         status=0
1918         in_octets=98
1919         in_unicasts=3
1920         in_multicasts=0
1921         in_broadcasts=4294967295
1922         in_discards=0
1923         in_errors=0
1924         in_unknownprotos=4294967295
1925         out_octets=120
1926         out_unicasts=2
1927         out_multicasts=4294967295
1928         out_broadcasts=4294967295
1929         out_discards=0
1930         out_errors=0
1931         promiscuous=0
1932 IFCOUNTERS
1933         dgramSeqNo=3
1934         ds=127.0.0.1>0:1004
1935         csSeqNo=2
1936         ifindex=1004
1937         type=6
1938         ifspeed=100000000
1939         direction=0
1940         status=0
1941         in_octets=84
1942         in_unicasts=2
1943         in_multicasts=0
1944         in_broadcasts=4294967295
1945         in_discards=0
1946         in_errors=0
1947         in_unknownprotos=4294967295
1948         out_octets=180
1949         out_unicasts=3
1950         out_multicasts=4294967295
1951         out_broadcasts=4294967295
1952         out_discards=0
1953         out_errors=0
1954         promiscuous=0
1955 ])
1956 AT_CLEANUP
1957
1958
1959
1960 dnl Test that basic NetFlow reports flow statistics correctly:
1961 dnl - The initial packet of a flow are correctly accounted.
1962 dnl - Later packets within a flow are correctly accounted.
1963 dnl - Flow actions changing (in this case, due to MAC learning)
1964 dnl   cause a record to be sent.
1965 AT_SETUP([ofproto-dpif - NetFlow flow expiration])
1966
1967 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
1968 ADD_OF_PORTS([br0], 1, 2)
1969
1970 ovs-appctl time/stop
1971 ON_EXIT([kill `cat test-netflow.pid`])
1972 AT_CHECK([test-netflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > netflow.log], [0], [], [ignore])
1973 AT_CAPTURE_FILE([netflow.log])
1974 NETFLOW_PORT=`parse_listening_port < test-netflow.log`
1975
1976 ovs-vsctl \
1977    set Bridge br0 netflow=@nf -- \
1978    --id=@nf create NetFlow targets=\"127.0.0.1:$NETFLOW_PORT\" \
1979      engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
1980
1981 for delay in 1000 30000; do
1982     ovs-appctl netdev-dummy/receive p1 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
1983     ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)'
1984
1985     ovs-appctl time/warp $delay
1986 done
1987
1988 sleep 1
1989 OVS_VSWITCHD_STOP
1990 ovs-appctl -t test-netflow exit
1991
1992 AT_CHECK([[sed -e 's/, uptime [0-9]*//
1993 s/, now [0-9.]*//
1994 s/time \([0-9]*\)\.\.\.\1$/time <moment>/
1995 s/time [0-9]*\.\.\.[0-9]*/time <range>/
1996 ' netflow.log | sort]], [0],
1997   [
1998 header: v5, seq 0, engine 2,1
1999 header: v5, seq 1, engine 2,1
2000 seq 0: 192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 60 bytes, ICMP 8:0, time <moment>
2001 seq 1: 192.168.0.1 > 192.168.0.2, if 1 > 2, 1 pkts, 60 bytes, ICMP 8:0, time <moment>
2002 seq 1: 192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 120 bytes, ICMP 0:0, time <range>
2003 ])
2004 AT_CLEANUP
2005
2006 dnl Test that basic NetFlow reports active expirations correctly.
2007 AT_SETUP([ofproto-dpif - NetFlow active expiration])
2008
2009 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
2010 ADD_OF_PORTS([br0], 1, 2)
2011
2012 ON_EXIT([kill `cat test-netflow.pid`])
2013 AT_CHECK([test-netflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > netflow.log], [0], [], [ignore])
2014 AT_CAPTURE_FILE([netflow.log])
2015 NETFLOW_PORT=`parse_listening_port < test-netflow.log`
2016
2017 ovs-vsctl \
2018    set Bridge br0 netflow=@nf -- \
2019    --id=@nf create NetFlow targets=\"127.0.0.1:$NETFLOW_PORT\" \
2020      engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
2021
2022 AT_CHECK([ovs-appctl time/stop])
2023 n=1
2024 while test $n -le 60; do
2025     n=`expr $n + 1`
2026
2027     ovs-appctl netdev-dummy/receive p1 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=1234,dst=80)'
2028     ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=1234)'
2029
2030     ovs-appctl time/warp 1000
2031 done
2032
2033 ovs-appctl time/warp 10000
2034
2035 sleep 1
2036 OVS_VSWITCHD_STOP
2037 ovs-appctl -t test-netflow exit
2038
2039 # Count the number of reported packets:
2040 # - From source to destination before MAC learning kicks in (just one).
2041 # - From source to destination after that.
2042 # - From destination to source.
2043 n_learn=0
2044 n_in=0
2045 n_out=0
2046 n_other=0
2047 n_recs=0
2048 none=0
2049 while read line; do
2050     pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
2051     case $pkts in
2052          [[0-9]]*) ;;
2053          *) continue ;;
2054     esac
2055
2056     case $line in
2057         "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
2058             counter=n_learn
2059             ;;
2060         "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
2061             counter=n_in
2062             ;;
2063         "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
2064             counter=n_out
2065             ;;
2066         *)
2067             counter=n_other
2068             ;;
2069     esac
2070     eval $counter=\`expr \$$counter + \$pkts\`
2071     n_recs=`expr $n_recs + 1`
2072 done < netflow.log
2073
2074 # There should be exactly 1 MAC learning packet,
2075 # exactly 59 other packets in that direction,
2076 # and exactly 60 packets in the other direction.
2077 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
2078 ])
2079
2080 # There should be 1 expiration for MAC learning,
2081 # at least 5 active and a final expiration in one direction,
2082 # and at least 5 active and a final expiration in the other direction.
2083 echo $n_recs
2084 AT_CHECK([test $n_recs -ge 13])
2085
2086 AT_CLEANUP
2087
2088 AT_SETUP([idle_age and hard_age increase over time])
2089 OVS_VSWITCHD_START
2090
2091 # get_ages DURATION HARD IDLE
2092 #
2093 # Fetch the flow duration, hard age, and idle age into the variables
2094 # whose names are given as arguments.  Rounds DURATION down to the
2095 # nearest integer.  If hard_age doesn't appear in the output, sets
2096 # HARD to "none".  If idle_age doesn't appear in the output, sets IDLE
2097 # to 0.
2098 get_ages () {
2099     AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
2100
2101     duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
2102     AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
2103     AS_VAR_COPY([$1], [duration])
2104
2105     hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
2106     if test X"$hard" = X; then
2107         hard=none
2108     else
2109         AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
2110     fi
2111     AS_VAR_COPY([$2], [hard])
2112
2113     idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
2114     if test X"$idle" = X; then
2115         idle=0
2116     else
2117         AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
2118     fi
2119     AS_VAR_COPY([$3], [idle])
2120 }
2121
2122 # Add a flow and get its initial hard and idle age.
2123 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
2124 get_ages duration1 hard1 idle1
2125
2126 ovs-appctl time/stop
2127 # Warp time forward by 10 seconds, then modify the flow's actions.
2128 ovs-appctl time/warp 10000
2129 get_ages duration2 hard2 idle2
2130 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
2131
2132 # Warp time forward by 10 seconds.
2133 ovs-appctl time/warp 10000
2134 get_ages duration3 hard3 idle3
2135
2136 # Warp time forward 10 more seconds, then pass some packets through the flow,
2137 # then warp forward a few more times because idle times are only updated
2138 # occasionally.
2139 ovs-appctl time/warp 10000
2140 ovs-appctl netdev-dummy/receive br0 'in_port(0),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=1234)'
2141 ovs-appctl time/warp 1000
2142 ovs-appctl time/warp 1000
2143 ovs-appctl time/warp 1000
2144 get_ages duration4 hard4 idle4
2145
2146 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
2147 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
2148 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
2149
2150 # Duration should increase steadily over time.
2151 AT_CHECK([test $duration1 -lt $duration2])
2152 AT_CHECK([test $duration2 -lt $duration3])
2153 AT_CHECK([test $duration3 -lt $duration4])
2154
2155 # Hard age should be "none" initially because it's the same as flow_duration,
2156 # then it should increase.
2157 AT_CHECK([test $hard1 = none])
2158 AT_CHECK([test $hard2 = none])
2159 AT_CHECK([test $hard3 != none])
2160 AT_CHECK([test $hard4 != none])
2161 AT_CHECK([test $hard3 -lt $hard4])
2162
2163 # Idle age should increase from 1 to 2 to 3, then decrease.
2164 AT_CHECK([test $idle1 -lt $idle2])
2165 AT_CHECK([test $idle2 -lt $idle3])
2166 AT_CHECK([test $idle3 -gt $idle4])
2167
2168 # Check some invariant relationships.
2169 AT_CHECK([test $duration1 = $idle1])
2170 AT_CHECK([test $duration2 = $idle2])
2171 AT_CHECK([test $duration3 = $idle3])
2172 AT_CHECK([test $idle3 -gt $hard3])
2173 AT_CHECK([test $idle4 -lt $hard4])
2174 AT_CHECK([test $hard4 -lt $duration4])
2175
2176 OVS_VSWITCHD_STOP
2177 AT_CLEANUP
2178
2179 AT_SETUP([ofproto-dpif - fin_timeout])
2180 OVS_VSWITCHD_START
2181 AT_DATA([flows.txt], [dnl
2182 in_port=1 actions=output:2
2183 in_port=2 actions=mod_vlan_vid:17,output:1
2184 ])
2185 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
2186 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
2187 [NXST_FLOW reply:
2188  idle_timeout=60, actions=fin_timeout(idle_timeout=5)
2189 ])
2190
2191 ovs-appctl time/stop
2192 # Check that a TCP SYN packet does not change the timeout.  (Because
2193 # flow stats updates are mainly what implements the fin_timeout
2194 # feature, we warp forward a couple of times to ensure that flow stats
2195 # run before re-checking the flow table.)
2196 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
2197 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
2198 warped
2199 ])
2200 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
2201 [NXST_FLOW reply:
2202  n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
2203 ])
2204 # Check that a TCP FIN packet does change the timeout.
2205 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
2206 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
2207 warped
2208 ])
2209 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
2210 [NXST_FLOW reply:
2211  n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
2212 ])
2213 OVS_VSWITCHD_STOP
2214 AT_CLEANUP
2215
2216 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
2217 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
2218 ADD_OF_PORTS([br0], [1], [2])
2219 ADD_OF_PORTS([br1], [3])
2220
2221 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
2222 dummy@br0
2223 dummy@br1
2224 ])
2225 OVS_VSWITCHD_STOP
2226 AT_CLEANUP
2227
2228 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
2229 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
2230 ADD_OF_PORTS([br0], [1], [2])
2231 ADD_OF_PORTS([br1], [3])
2232
2233 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
2234 dummy@ovs-dummy: hit:0 missed:0
2235         flows: cur: 0, avg: 0, max: 0, life span: 0ms
2236         br0: hit:0 missed:0
2237                 br0 65534/100: (dummy)
2238                 p1 1/1: (dummy)
2239                 p2 2/2: (dummy)
2240         br1: hit:0 missed:0
2241                 br1 65534/101: (dummy)
2242                 p3 3/3: (dummy)
2243 ])
2244 OVS_VSWITCHD_STOP
2245 AT_CLEANUP
2246
2247 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
2248 OVS_VSWITCHD_START([add-br br1 -- \
2249                     set bridge br1 datapath-type=dummy fail-mode=secure])
2250 ADD_OF_PORTS([br0], [1], [2])
2251 ADD_OF_PORTS([br1], [3])
2252
2253 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2254 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)'])
2255 AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2256
2257 AT_CHECK([ovs-appctl dpif/dump-flows br0 | sort | STRIP_USED], [0], [dnl
2258 skb_priority(0),in_port(1),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff), packets:0, bytes:0, used:0.0s, actions:userspace(pid=0,slow_path(controller))
2259 skb_priority(0),in_port(2),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff), packets:0, bytes:0, used:0.0s, actions:userspace(pid=0,slow_path(controller))
2260 ])
2261
2262 AT_CHECK([ovs-appctl dpif/dump-flows br1 | sort | STRIP_USED], [0], [dnl
2263 skb_priority(0),in_port(3),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff), packets:0, bytes:0, used:0.0s, actions:userspace(pid=0,slow_path(controller))
2264 ])
2265
2266 OVS_VSWITCHD_STOP
2267 AT_CLEANUP
2268
2269 AT_SETUP([ofproto-dpif - ovs-appctl dpif/del-flows])
2270 OVS_VSWITCHD_START([add-br br1 -- \
2271                     set bridge br1 datapath-type=dummy fail-mode=secure])
2272 ADD_OF_PORTS([br0], [1], [2])
2273 ADD_OF_PORTS([br1], [3])
2274
2275 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2276 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)'])
2277 AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2278
2279 AT_CHECK([ovs-appctl dpif/dump-flows br0 | sort | STRIP_USED], [0], [dnl
2280 skb_priority(0),in_port(1),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff), packets:0, bytes:0, used:0.0s, actions:userspace(pid=0,slow_path(controller))
2281 skb_priority(0),in_port(2),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff), packets:0, bytes:0, used:0.0s, actions:userspace(pid=0,slow_path(controller))
2282 ])
2283
2284 AT_CHECK([ovs-appctl dpif/dump-flows br1 | sort | STRIP_USED], [0], [dnl
2285 skb_priority(0),in_port(3),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff), packets:0, bytes:0, used:0.0s, actions:userspace(pid=0,slow_path(controller))
2286 ])
2287
2288 AT_CHECK([ovs-appctl dpif/del-flows br0])
2289 AT_CHECK([ovs-appctl dpif/dump-flows br0 | sort | STRIP_USED], [0], [dnl
2290 ])
2291
2292 AT_CHECK([ovs-appctl dpif/dump-flows br1 | sort | STRIP_USED], [0], [dnl
2293 skb_priority(0),in_port(3),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff), packets:0, bytes:0, used:0.0s, actions:userspace(pid=0,slow_path(controller))
2294 ])
2295
2296 OVS_VSWITCHD_STOP
2297 AT_CLEANUP
2298
2299 AT_SETUP([ofproto-dpif - patch ports])
2300 OVS_VSWITCHD_START([add-br br1 \
2301 -- set bridge br1 datapath-type=dummy fail-mode=secure \
2302 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
2303 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
2304
2305 ADD_OF_PORTS([br0], [2])
2306 ADD_OF_PORTS([br1], [3])
2307
2308 AT_CHECK([ovs-appctl time/stop]) dnl Make life span averages consistent.
2309
2310 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
2311 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
2312
2313 for i in $(seq 1 10); do
2314     ovs-appctl netdev-dummy/receive br0 'in_port(100),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
2315 done
2316
2317 for i in $(seq 1 5); do
2318     ovs-appctl netdev-dummy/receive br1 'in_port(101),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
2319 done
2320
2321 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
2322 warped
2323 ])
2324
2325 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
2326 dummy@ovs-dummy: hit:13 missed:2
2327         flows: cur: 2, avg: 1, max: 2, life span: 1250ms
2328         br0: hit:9 missed:1
2329                 br0 65534/100: (dummy)
2330                 p2 2/2: (dummy)
2331                 pbr0 1/none: (patch: peer=pbr1)
2332         br1: hit:4 missed:1
2333                 br1 65534/101: (dummy)
2334                 p3 3/3: (dummy)
2335                 pbr1 1/none: (patch: peer=pbr0)
2336 ])
2337
2338 AT_CHECK([ovs-appctl dpif/dump-flows br0 | STRIP_USED], [0], [dnl
2339 skb_priority(0),in_port(100),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff), packets:9, bytes:540, used:0.0s, actions:101,3,2
2340 ]),
2341 AT_CHECK([ovs-appctl dpif/dump-flows br1 | STRIP_USED], [0], [dnl
2342 skb_priority(0),in_port(101),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff), packets:4, bytes:240, used:0.0s, actions:100,2,3
2343 ])
2344
2345 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
2346 OFPST_PORT reply (xid=0x4): 1 ports
2347   port  1: rx pkts=5, bytes=300, drop=0, errs=0, frame=0, over=0, crc=0
2348            tx pkts=10, bytes=600, drop=0, errs=0, coll=0
2349 ])
2350
2351 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
2352 OFPST_PORT reply (xid=0x4): 1 ports
2353   port  1: rx pkts=10, bytes=600, drop=0, errs=0, frame=0, over=0, crc=0
2354            tx pkts=5, bytes=300, drop=0, errs=0, coll=0
2355 ])
2356
2357 OVS_VSWITCHD_STOP
2358 AT_CLEANUP
2359
2360 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show rates])
2361 OVS_VSWITCHD_START([set Bridge br0 fail-mode=secure])
2362 ADD_OF_PORTS([br0], 1, 2)
2363
2364 AT_CHECK([ovs-appctl time/stop]) dnl Make life span averages consistent.
2365 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
2366
2367 for i in $(seq 1 61); do
2368     ovs-appctl netdev-dummy/receive br0 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
2369     ovs-appctl time/warp 10000
2370     ovs-appctl time/warp 50000
2371 done
2372
2373 AT_CHECK([ovs-appctl time/warp 10000], [0], [warped
2374 ])
2375
2376 AT_CHECK([ovs-appctl dpif/show | sed 's/ 10[[0-9]]\{3\}(ms)$/ 10000(ms)/'], [0], [dnl
2377 dummy@ovs-dummy: hit:0 missed:61
2378         flows: cur: 0, avg: 0, max: 1, life span: 1666ms
2379         br0: hit:0 missed:61
2380                 br0 65534/100: (dummy)
2381                 p1 1/1: (dummy)
2382                 p2 2/2: (dummy)
2383 ])
2384
2385 OVS_VSWITCHD_STOP
2386 AT_CLEANUP
2387
2388 AT_SETUP([ofproto-dpif - port duration])
2389 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
2390 ADD_OF_PORTS([br0], 1, 2)
2391
2392 ovs-appctl time/stop
2393 ovs-appctl time/warp 10000
2394
2395 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
2396 AT_CHECK([sed 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/' stdout], [0],
2397 [dnl
2398 OFPST_PORT reply (OF1.3) (xid=0x2): 3 ports
2399   port  1: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
2400            tx pkts=0, bytes=0, drop=0, errs=0, coll=0
2401            duration=?s
2402   port  2: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
2403            tx pkts=0, bytes=0, drop=0, errs=0, coll=0
2404            duration=?s
2405   port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
2406            tx pkts=0, bytes=0, drop=0, errs=0, coll=0
2407            duration=?s
2408 ])
2409 OVS_VSWITCHD_STOP
2410 AT_CLEANUP
2411
2412 dnl ----------------------------------------------------------------------
2413 AT_BANNER([ofproto-dpif -- megaflows])
2414
2415 # Strips out uninteresting parts of megaflow output, as well as parts
2416 # that vary from one run to another (e.g., timing and bond actions).
2417 m4_define([STRIP_USED], [[sed '
2418     s/used:[0-9]*\.[0-9]*/used:0.0/
2419 ' | sort]])
2420 m4_define([STRIP_XOUT], [[sed '
2421     s/used:[0-9]*\.[0-9]*/used:0.0/
2422     s/Datapath actions:.*/Datapath actions: <del>/
2423 ' | sort]])
2424
2425 AT_SETUP([ofproto-dpif megaflow - port classification])
2426 OVS_VSWITCHD_START
2427 ADD_OF_PORTS([br0], [1], [2])
2428 AT_DATA([flows.txt], [dnl
2429 table=0 in_port=1 actions=output(2)
2430 ])
2431 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2432 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2433 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2434 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2435 skb_priority=0,ip,in_port=1,nw_frag=no, n_subfacets:2, used:0.0s, Datapath actions: <del>
2436 ])
2437 OVS_VSWITCHD_STOP
2438 AT_CLEANUP
2439
2440 AT_SETUP([ofproto-dpif megaflow - L2 classification])
2441 OVS_VSWITCHD_START
2442 ADD_OF_PORTS([br0], [1], [2])
2443 AT_DATA([flows.txt], [dnl
2444 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
2445 ])
2446 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2447 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2448 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2449 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2450 skb_priority=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2451 skb_priority=0,ip,in_port=1,dl_src=50:54:00:00:00:0b,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2452 ])
2453 OVS_VSWITCHD_STOP
2454 AT_CLEANUP
2455
2456 AT_SETUP([ofproto-dpif megaflow - L3 classification])
2457 OVS_VSWITCHD_START
2458 ADD_OF_PORTS([br0], [1], [2])
2459 AT_DATA([flows.txt], [dnl
2460 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
2461 ])
2462 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2463 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2464 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2465 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2466 skb_priority=0,icmp,in_port=1,nw_src=10.0.0.2,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2467 skb_priority=0,icmp,in_port=1,nw_src=10.0.0.4,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2468 ])
2469 OVS_VSWITCHD_STOP
2470 AT_CLEANUP
2471
2472 AT_SETUP([ofproto-dpif megaflow - L4 classification])
2473 OVS_VSWITCHD_START
2474 ADD_OF_PORTS([br0], [1], [2])
2475 AT_DATA([flows.txt], [dnl
2476 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
2477 ])
2478 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2479 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2480 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2481 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2482 skb_priority=0,icmp,in_port=1,nw_frag=no,icmp_type=8, n_subfacets:2, used:0.0s, Datapath actions: <del>
2483 ])
2484 OVS_VSWITCHD_STOP
2485 AT_CLEANUP
2486
2487 AT_SETUP([ofproto-dpif megaflow - normal])
2488 OVS_VSWITCHD_START
2489 ADD_OF_PORTS([br0], [1], [2])
2490 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
2491 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2492 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2493 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2494 skb_priority=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2495 skb_priority=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2496 ])
2497 OVS_VSWITCHD_STOP
2498 AT_CLEANUP
2499
2500 AT_SETUP([ofproto-dpif megaflow - mpls])
2501 OVS_VSWITCHD_START
2502 ADD_OF_PORTS([br0], [1], [2])
2503 AT_DATA([flows.txt], [dnl
2504 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
2505 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
2506 ])
2507 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2508 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1)'])
2509 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0a),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1)'])
2510 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2511 skb_priority=0,mpls,in_port=1,dl_src=50:54:00:00:00:09,mpls_label=11,mpls_tc=3,mpls_ttl=64,mpls_bos=1,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2512 skb_priority=0,mpls,in_port=1,dl_src=50:54:00:00:00:0b,mpls_label=11,mpls_tc=3,mpls_ttl=64,mpls_bos=1,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2513 ])
2514 OVS_VSWITCHD_STOP
2515 AT_CLEANUP
2516
2517 AT_SETUP([ofproto-dpif megaflow - netflow])
2518 OVS_VSWITCHD_START
2519 ADD_OF_PORTS([br0], [1], [2])
2520
2521 dnl NetFlow configuration disables wildcarding relevant fields
2522 ON_EXIT([kill `cat test-netflow.pid`])
2523 AT_CHECK([test-netflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > netflow.log], [0], [], [ignore])
2524 AT_CAPTURE_FILE([netflow.log])
2525 NETFLOW_PORT=`parse_listening_port < test-netflow.log`
2526 ovs-vsctl \
2527    set Bridge br0 netflow=@nf -- \
2528    --id=@nf create NetFlow targets=\"127.0.0.1:$NETFLOW_PORT\" \
2529      engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
2530
2531 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
2532 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2533 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2534 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2535 skb_priority=0,icmp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_frag=no,icmp_type=8,icmp_code=0, n_subfacets:1, used:0.0s, Datapath actions: <del>
2536 skb_priority=0,icmp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_src=10.0.0.4,nw_dst=10.0.0.3,nw_tos=0,nw_frag=no,icmp_type=8,icmp_code=0, n_subfacets:1, used:0.0s, Datapath actions: <del>
2537 ])
2538 OVS_VSWITCHD_STOP
2539 AT_CLEANUP
2540
2541 AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding])
2542 OVS_VSWITCHD_START(
2543   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
2544    add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
2545    set interface p2 type=dummy ofport_request=2 -- \
2546    set interface p3 type=dummy ofport_request=3])
2547 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
2548 ])
2549
2550 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
2551 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2552 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2553 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2554 skb_priority=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2555 skb_priority=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2556 ])
2557 OVS_VSWITCHD_STOP
2558 AT_CLEANUP
2559
2560 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
2561 OVS_VSWITCHD_START(
2562   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
2563    add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
2564    set interface p2 type=dummy ofport_request=2 -- \
2565    set interface p3 type=dummy ofport_request=3])
2566 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
2567 ])
2568
2569 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
2570 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2571 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2572 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2573 skb_priority=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2574 skb_priority=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2575 ])
2576 OVS_VSWITCHD_STOP
2577 AT_CLEANUP
2578
2579 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
2580 # Create bond0 on br0 with interfaces p0 and p1
2581 #    and bond1 on br1 with interfaces p2 and p3
2582 # with p0 patched to p2 and p1 patched to p3.
2583 OVS_VSWITCHD_START(
2584   [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
2585                             other-config:lacp-time=fast \
2586                             other-config:bond-rebalance-interval=0 -- \
2587    set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
2588    set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
2589    add-br br1 -- \
2590    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
2591    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
2592                   fail-mode=secure -- \
2593    add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
2594                             other-config:lacp-time=fast \
2595                             other-config:bond-rebalance-interval=0 -- \
2596    set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
2597    set interface p3 type=patch options:peer=p1 ofport_request=4 --])
2598
2599 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
2600 ])
2601 ADD_OF_PORTS([br0], [7])
2602 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
2603 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
2604 ovs-appctl time/stop
2605 ovs-appctl time/warp 5000
2606 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2607 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2608
2609 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2610 skb_priority=0,icmp,in_port=7,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_frag=no,icmp_type=8,icmp_code=0, n_subfacets:1, used:0.0s, Datapath actions: <del>
2611 skb_priority=0,icmp,in_port=7,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_src=10.0.0.4,nw_dst=10.0.0.3,nw_frag=no,icmp_type=8,icmp_code=0, n_subfacets:1, used:0.0s, Datapath actions: <del>
2612 ])
2613 OVS_VSWITCHD_STOP
2614 AT_CLEANUP
2615
2616 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
2617 OVS_VSWITCHD_START
2618 ADD_OF_PORTS([br0], [1], [2])
2619 AT_DATA([flows.txt], [dnl
2620 table=0 in_port=1,ip actions=resubmit(90)
2621 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
2622 ])
2623 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2624 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2625 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2626 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2627 skb_priority=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2628 skb_priority=0,ip,in_port=1,dl_src=50:54:00:00:00:0b,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2629 ])
2630 OVS_VSWITCHD_STOP
2631 AT_CLEANUP
2632
2633 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
2634 OVS_VSWITCHD_START
2635 ADD_OF_PORTS([br0], [1], [2])
2636 AT_DATA([flows.txt], [dnl
2637 table=0 in_port=1,ip actions=resubmit(,1)
2638 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
2639 ])
2640 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2641 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2642 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=
2643 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2644 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2645 skb_priority=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2646 skb_priority=0,ip,in_port=1,dl_src=50:54:00:00:00:0b,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2647 ])
2648 OVS_VSWITCHD_STOP
2649 AT_CLEANUP
2650
2651 AT_SETUP([ofproto-dpif megaflow - goto_table action])
2652 OVS_VSWITCHD_START
2653 ADD_OF_PORTS([br0], [1], [2])
2654 AT_DATA([flows.txt], [dnl
2655 table=0 in_port=1,ip actions=goto_table(1)
2656 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
2657 ])
2658 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2659 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2660 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2661 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2662 skb_priority=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2663 skb_priority=0,ip,in_port=1,dl_src=50:54:00:00:00:0b,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2664 ])
2665 OVS_VSWITCHD_STOP
2666 AT_CLEANUP
2667
2668 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
2669 OVS_VSWITCHD_START
2670 ADD_OF_PORTS([br0], [1], [2], [3])
2671 ovs-vsctl \
2672         set Bridge br0 mirrors=@m --\
2673         --id=@p3 get Port p3 --\
2674         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
2675
2676 AT_DATA([flows.txt], [dnl
2677 in_port=1 actions=output:2
2678 ])
2679 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2680 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2681 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2682 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2683 skb_priority=0,ip,in_port=1,nw_frag=no, n_subfacets:2, used:0.0s, Datapath actions: <del>
2684 ])
2685 OVS_VSWITCHD_STOP
2686 AT_CLEANUP
2687
2688 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
2689 OVS_VSWITCHD_START
2690 ADD_OF_PORTS([br0], [1], [2], [3])
2691 ovs-vsctl \
2692         set Bridge br0 mirrors=@m --\
2693         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
2694         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
2695
2696 AT_DATA([flows.txt], [dnl
2697 in_port=1 actions=output:2
2698 ])
2699 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2700 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8100),vlan(vid=11,pcp=7),encap(eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0))'])
2701 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2702 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2703 skb_priority=0,ip,in_port=1,dl_vlan=11,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2704 skb_priority=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2705 ])
2706 OVS_VSWITCHD_STOP
2707 AT_CLEANUP
2708
2709 AT_SETUP([ofproto-dpif megaflow - move action])
2710 OVS_VSWITCHD_START
2711 ADD_OF_PORTS([br0], [1], [2])
2712 AT_DATA([flows.txt], [dnl
2713 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
2714 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
2715 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
2716 ])
2717 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2718 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2719 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2720 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2721 skb_priority=0,ip,in_port=1,nw_src=10.0.0.2,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2722 skb_priority=0,ip,in_port=1,nw_src=10.0.0.4,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2723 ])
2724 OVS_VSWITCHD_STOP
2725 AT_CLEANUP
2726
2727 AT_SETUP([ofproto-dpif megaflow - push action])
2728 OVS_VSWITCHD_START
2729 ADD_OF_PORTS([br0], [1], [2])
2730 AT_DATA([flows.txt], [dnl
2731 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
2732 ])
2733 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2734 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2735 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2736 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2737 skb_priority=0,ip,in_port=1,nw_src=10.0.0.2,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2738 skb_priority=0,ip,in_port=1,nw_src=10.0.0.4,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2739 ])
2740 OVS_VSWITCHD_STOP
2741 AT_CLEANUP
2742
2743 AT_SETUP([ofproto-dpif megaflow - learning])
2744 OVS_VSWITCHD_START
2745 ADD_OF_PORTS([br0], [1], [2])
2746 AT_DATA([flows.txt], [dnl
2747 table=0 in_port=1 actions=load:2->NXM_NX_REG0[[0..15]],learn(table=1,priority=65535,NXM_OF_ETH_SRC[[]],NXM_OF_VLAN_TCI[[0..11]],output:NXM_NX_REG0[[0..15]]),output:2
2748 ])
2749 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2750 ovs-appctl time/stop
2751 # We send each packet twice because the first packet in each flow causes the
2752 # flow table to change and thus revalidations, which (depending on timing)
2753 # can keep a megaflow from being installed.  The revalidations are done by
2754 # the second iteration, allowing the flows to be installed.
2755 for i in 1 2; do
2756     AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2757     AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2758     ovs-appctl time/warp 100
2759 done
2760 dnl The original flow is missing due to a revalidation.
2761 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2762 skb_priority=0,ip,in_port=1,vlan_tci=0x0000/0x0fff,dl_src=50:54:00:00:00:09,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2763 skb_priority=0,ip,in_port=1,vlan_tci=0x0000/0x0fff,dl_src=50:54:00:00:00:0b,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2764 ])
2765 OVS_VSWITCHD_STOP
2766 AT_CLEANUP
2767
2768 AT_SETUP([ofproto-dpif megaflow - tunnels])
2769 OVS_VSWITCHD_START(
2770   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 \
2771      ofport_request=1 -- \
2772    add-port br0 p2 -- set Interface p2 type=gre options:remote_ip=1.1.1.1 \
2773      ofport_request=2 options:key=flow -- \
2774    add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3 \
2775      ofport_request=3 -- \
2776    add-port br0 p4 -- set Interface p4 type=gre options:remote_ip=1.1.1.2 \
2777      options:tos=inherit options:ttl=inherit ofport_request=4 options:key=flow])
2778 AT_DATA([flows.txt], [dnl
2779 in_port=1,actions=output(2)
2780 in_port=3,actions=output(4)
2781 ])
2782 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2783 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
2784 dnl will cause the packet to be dropped.
2785 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0xfd,ttl=128,frag=no),icmp(type=8,code=0)'])
2786 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0x1,ttl=64,frag=no),icmp(type=8,code=0)'])
2787 AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0xfd,ttl=128,frag=no),icmp(type=8,code=0)'])
2788 AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0x1,ttl=64,frag=no),icmp(type=8,code=0)'])
2789 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2790 skb_priority=0,ip,in_port=1,nw_ecn=1,nw_frag=no, n_subfacets:2, used:0.0s, Datapath actions: <del>
2791 skb_priority=0,ip,in_port=3,nw_tos=0,nw_ecn=1,nw_ttl=64,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2792 skb_priority=0,ip,in_port=3,nw_tos=252,nw_ecn=1,nw_ttl=128,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2793 ])
2794 OVS_VSWITCHD_STOP
2795 AT_CLEANUP
2796
2797 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
2798 OVS_VSWITCHD_START
2799 ADD_OF_PORTS([br0], [1], [2])
2800 AT_DATA([flows.txt], [dnl
2801 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
2802 ])
2803 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2804 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2805 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2806 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_XOUT], [0], [dnl
2807 skb_priority=0,icmp,in_port=1,nw_src=10.0.0.2,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: <del>
2808 skb_priority=0,icmp,in_port=1,nw_src=10.0.0.4,nw_dst=10.0.0.3,nw_tos=0,nw_ecn=0,nw_ttl=64, n_subfacets:1, used:0.0s, Datapath actions: <del>
2809 ])
2810 OVS_VSWITCHD_STOP
2811 AT_CLEANUP
2812
2813 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
2814 OVS_VSWITCHD_START
2815 ADD_OF_PORTS([br0], [1], [2])
2816 AT_DATA([flows.txt], [dnl
2817 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
2818 ])
2819 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2820 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2821 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
2822 dnl The megaflows do not match the same fields, since the first packet
2823 dnl is essentially a no-op.  (The new destination MAC is the same as the
2824 dnl original.) The ofproto-dpif library un-wildcards the destination MAC
2825 dnl so that a packet that doesn't need its MAC address changed doesn't
2826 dnl hide one that does.  Since the first entry doesn't need to change,
2827 dnl only the destination MAC address is matched (as decided by
2828 dnl ofproto-dpif).  The second entry actually updates the destination
2829 dnl MAC, so both the source and destination MAC addresses are
2830 dnl un-wildcarded, since the ODP commit functions update both the source
2831 dnl and destination MAC addresses.
2832 AT_CHECK([ovs-appctl dpif/dump-megaflows br0 | STRIP_USED], [0], [dnl
2833 skb_priority=0,ip,in_port=1,dl_dst=50:54:00:00:00:0a,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: 2
2834 skb_priority=0,ip,in_port=1,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, n_subfacets:1, used:0.0s, Datapath actions: set(eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0a)),2
2835 ])
2836 OVS_VSWITCHD_STOP
2837 AT_CLEANUP
2838
2839 AT_SETUP([ofproto-dpif - datapath port number change])
2840 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
2841 ADD_OF_PORTS([br0], 1)
2842
2843 # Trace a flow that should output to p1.
2844 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
2845   [0], [stdout])
2846 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
2847 ])
2848
2849 # Change p1's port number to 5.
2850 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
2851
2852 # Trace a flow that should output to p1 in its new location.
2853 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
2854   [0], [stdout])
2855 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
2856 ])
2857 OVS_VSWITCHD_STOP
2858 AT_CLEANUP
2859
2860 # Tests the bundling with various bfd and cfm configurations.
2861 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
2862 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
2863                     add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
2864                     add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
2865                     set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
2866                     set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
2867                     set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
2868                     set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
2869                     set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
2870                     set Interface p0 cfm_mpid=1 -- \
2871                     set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
2872
2873 ovs-appctl time/stop
2874 # advance the clock to stablize everything.
2875 for i in `seq 0 49`; do ovs-appctl time/warp 100; done
2876 # cfm/show should show 'recv' fault.
2877 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
2878         fault: recv
2879 ])
2880 # bfd/show should show 'up'.
2881 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
2882         Local Session State: up
2883         Remote Session State: up
2884         Local Session State: up
2885         Remote Session State: up
2886 ])
2887 # bond/show should show 'may-enable: true' for all slaves.
2888 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
2889         may_enable: true
2890         may_enable: true
2891         may_enable: true
2892         may_enable: true
2893 ])
2894
2895 # now disable the bfd on p1.
2896 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
2897 # advance the clock to stablize everything.
2898 for i in `seq 0 49`; do ovs-appctl time/warp 100; done
2899 # cfm/show should show 'recv' fault.
2900 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
2901         fault: recv
2902 ])
2903 # bfd/show should show 'down'.
2904 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
2905         Local Session State: down
2906         Remote Session State: down
2907 ])
2908 # bond/show should show 'may-enable: false' for p0.
2909 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
2910         may_enable: false
2911         may_enable: true
2912         may_enable: true
2913         may_enable: true
2914 ])
2915
2916 # now enable the bfd on p1 and disable bfd on p0.
2917 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
2918 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
2919 # advance the clock to stablize everything.
2920 for i in `seq 0 49`; do ovs-appctl time/warp 100; done
2921 # cfm/show should show 'recv' fault.
2922 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
2923         fault: recv
2924 ])
2925 # bfd/show should show 'down'.
2926 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
2927         Local Session State: down
2928         Remote Session State: down
2929 ])
2930 # bond/show should show 'may-enable: false' for p0 and p1.
2931 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
2932         may_enable: false
2933         may_enable: true
2934         may_enable: false
2935         may_enable: true
2936 ])
2937
2938 OVS_VSWITCHD_STOP
2939 AT_CLEANUP
2940
2941 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
2942 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
2943
2944 # enable bfd on p0.
2945 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
2946 # check log.
2947 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
2948 monitor thread created
2949 ])
2950 # disable bfd on p0.
2951 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
2952 # check log.
2953 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
2954 monitor thread terminated
2955 ])
2956 AT_CHECK([cat ovs-vswitchd.log | sed -e '/^.*ofproto_dpif_monitor.*$/d' > ovs-vswitchd.log])
2957
2958 # enable cfm on p0.
2959 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
2960 # check log.
2961 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
2962 monitor thread created
2963 ])
2964 # disable cfm on p0.
2965 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
2966 # check log.
2967 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
2968 monitor thread terminated
2969 ])
2970 AT_CHECK([cat ovs-vswitchd.log | sed -e '/^.*ofproto_dpif_monitor.*$/d' > ovs-vswitchd.log])
2971
2972 # enable both bfd and cfm on p0.
2973 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
2974 # check log.
2975 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
2976 monitor thread created
2977 ])
2978 # disable bfd on p0.
2979 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
2980 # check log, there should not be the log of thread terminated.
2981 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
2982 ])
2983 # reenable bfd on p0.
2984 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
2985 # check log, should still be on log of thread created.
2986 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
2987 monitor thread created
2988 ])
2989 # disable bfd and cfm together.
2990 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
2991 # check log.
2992 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
2993 monitor thread terminated
2994 ])
2995
2996 OVS_VSWITCHD_STOP
2997 AT_CLEANUP
2998
2999 # this test helps avoid the deadlock between the main thread and monitor thread.
3000 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
3001 OVS_VSWITCHD_START
3002
3003 for i in `seq 1 199`
3004 do
3005     AT_CHECK([ovs-vsctl add-port br0 p$i -- set interface p$i type=gre options:remote_ip=1.2.3.4 options:key=$i bfd:enable=true])
3006 done
3007
3008 OVS_VSWITCHD_STOP
3009 AT_CLEANUP
3010 \f
3011 AT_BANNER([ofproto-dpif - flow translation resource limits])
3012
3013 AT_SETUP([ofproto-dpif - infinite resubmit])
3014 OVS_VSWITCHD_START
3015 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
3016 AT_CHECK([ovs-appctl ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
3017   [0], [stdout])
3018 AT_CHECK([tail -1 stdout], [0], [Datapath actions: drop
3019 ])
3020 AT_CHECK([grep -c 'resubmit actions recursed over 64 times' ovs-vswitchd.log],
3021   [0], [1
3022 ])
3023 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
3024 AT_CLEANUP
3025
3026 AT_SETUP([ofproto-dpif - exponential resubmit chain])
3027 OVS_VSWITCHD_START
3028 ADD_OF_PORTS([br0], 1)
3029 (for i in `seq 1 64`; do
3030      j=`expr $i + 1`
3031      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
3032  done
3033  echo "in_port=65, actions=local") > flows
3034  AT_CHECK([ovs-ofctl add-flows br0 flows])
3035 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
3036 AT_CHECK([grep -c 'over 4096 resubmit actions' ovs-vswitchd.log], [0], [1
3037 ])
3038 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
3039 AT_CLEANUP
3040
3041 AT_SETUP([ofproto-dpif - too many output actions])
3042 OVS_VSWITCHD_START
3043 ADD_OF_PORTS([br0], 1)
3044 (for i in `seq 1 12`; do
3045      j=`expr $i + 1`
3046      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
3047  done
3048  echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
3049 AT_CHECK([ovs-ofctl add-flows br0 flows])
3050 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
3051 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' ovs-vswitchd.log], [0], [1
3052 ])
3053 AT_CHECK([grep -c 'discarding oversize datapath actions' ovs-vswitchd.log], [0], [1
3054 ])
3055 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d
3056 /discarding oversize datapath actions/d"])
3057 AT_CLEANUP
3058
3059 AT_SETUP([ofproto-dpif - stack too deep])
3060 OVS_VSWITCHD_START
3061 ADD_OF_PORTS([br0], 1)
3062 (for i in `seq 1 12`; do
3063      j=`expr $i + 1`
3064      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
3065  done
3066  push="push:NXM_NX_REG0[[]]"
3067  echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
3068  AT_CHECK([ovs-ofctl add-flows br0 flows])
3069 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
3070 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' ovs-vswitchd.log], [0], [1
3071 ])
3072 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
3073 AT_CLEANUP