]> git.proxmox.com Git - ovs.git/blob - tests/ofproto-dpif.at
Fix ovs-dpctl-top by removing 3 wrong hunks in py3-compat.patch.
[ovs.git] / tests / ofproto-dpif.at
1 AT_BANNER([ofproto-dpif])
2
3 m4_divert_push([PREPARE_TESTS])
4
5 # Helper function to check the spread of dp_hash flows over buckets in the datapath
6 check_dpflow_stats () {
7 min_flows=$1
8 min_buckets=$2
9 dpflows=`cat`
10 if [[ $# -eq 3 ]]; then
11 echo "$dpflows" | grep "actions:hash"
12 n_flows=`echo "$dpflows" | grep -c dp_hash`
13 n_buckets=`echo "$dpflows" | grep dp_hash | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l`
14 else
15 n_flows=`echo "$dpflows" | wc -l`
16 n_buckets=`echo "$dpflows" | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l`
17 fi
18 if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi
19 if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi
20 echo "n_flows=$flows n_buckets=$buckets"
21 }
22
23 m4_divert_pop([PREPARE_TESTS])
24
25
26 AT_SETUP([ofproto-dpif - revalidator/wait])
27 OVS_VSWITCHD_START
28 AT_CHECK([ovs-appctl revalidator/wait])
29 OVS_VSWITCHD_STOP
30 AT_CLEANUP
31
32 AT_SETUP([ofproto-dpif - active-backup bonding (with primary)])
33
34 dnl Create br0 with members p1, p2 and p7, creating bond0 with p1 and
35 dnl p2 (p1 as primary) and br1 with members p3, p4 and p8.
36 dnl toggle p1,p2 of bond0 up and down to test bonding in active-backup mode.
37 dnl With p1 down and p2 up/active, bring p1 back up. Since p1 is the primary,
38 dnl it should become active.
39 OVS_VSWITCHD_START(
40 [add-bond br0 bond0 p1 p2 bond_mode=active-backup \
41 other_config:bond-primary=p1 -- \
42 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
43 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
44 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
45 add-br br1 -- \
46 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
47 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
48 fail-mode=secure -- \
49 add-port br1 p3 -- set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
50 add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
51 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
52 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53 WAIT_FOR_DUMMY_PORTS([p3], [p4])
54 OVS_WAIT_UNTIL([test -n "`ovs-appctl bond/show | grep 'active-backup primary: p1'`"])
55
56
57 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
58 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
59 ovs-appctl netdev-dummy/set-admin-state up
60 ovs-appctl time/warp 100
61 ovs-appctl netdev-dummy/set-admin-state p2 down
62 ovs-appctl time/stop
63 ovs-appctl time/warp 100
64 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),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)'])
65 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
66 ovs-appctl time/warp 100
67 ovs-appctl netdev-dummy/set-admin-state p2 up
68 ovs-appctl netdev-dummy/set-admin-state p1 down
69 ovs-appctl time/warp 100
70 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0d),eth_type(0x0800),ipv4(src=10.0.0.5,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
71 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(src=10.0.0.6,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
72 ovs-appctl time/warp 2000 100
73 AT_CHECK([ovs-appctl dpctl/dump-flows | grep 'in_port([[348]])' | strip_xout], [0], [dnl
74 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions: <del>
75 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions: <del>
76 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0d),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions: <del>
77 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions: <del>
78 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), packets:0, bytes:0, used:never, actions: <del>
79 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), packets:0, bytes:0, used:never, actions: <del>
80 ])
81
82 ovs-appctl netdev-dummy/set-admin-state p1 up
83 ovs-appctl time/warp 100
84 OVS_WAIT_UNTIL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [0], [dnl
85 ---- bond0 ----
86 bond_mode: active-backup
87 bond may use recirculation: no, <del>
88 bond-hash-basis: 0
89 updelay: 0 ms
90 downdelay: 0 ms
91 lacp_status: off
92 lacp_fallback_ab: false
93 active-backup primary: p1
94 <active member mac del>
95
96 member p1: enabled
97 active member
98 may_enable: true
99
100 member p2: enabled
101 may_enable: true
102
103 ])
104
105 OVS_VSWITCHD_STOP
106 AT_CLEANUP
107
108 AT_SETUP([ofproto-dpif - active-backup bonding (primary validation)])
109 dnl Make a switch with 3 ports in a bond, so that when we delete one of
110 dnl the ports from the bond, there are still 2 ports left and the bond
111 dnl remains functional.
112 OVS_VSWITCHD_START(
113 [add-bond br0 bond0 p1 p2 p3 bond_mode=active-backup \
114 other_config:bond-primary=p1 -- \
115 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
116 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
117 set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
118 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy --])
119 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
120
121 dnl Make sure the initial primary member is set
122 OVS_WAIT_UNTIL([test -n "`ovs-appctl bond/show | grep 'active-backup primary: p1'`"])
123
124 dnl Down the primary member and verify that we switched. Then
125 dnl bring the primary back and verify that we switched back to the
126 dnl primary.
127 ovs-appctl netdev-dummy/set-admin-state p1 down
128 ovs-appctl time/warp 100
129 OVS_WAIT_UNTIL([test -n "`ovs-appctl bond/show | fgrep 'member p1: disabled'`"])
130 ovs-appctl netdev-dummy/set-admin-state p1 up
131 ovs-appctl time/warp 100
132 OVS_WAIT_UNTIL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [0], [dnl
133 ---- bond0 ----
134 bond_mode: active-backup
135 bond may use recirculation: no, <del>
136 bond-hash-basis: 0
137 updelay: 0 ms
138 downdelay: 0 ms
139 lacp_status: off
140 lacp_fallback_ab: false
141 active-backup primary: p1
142 <active member mac del>
143
144 member p1: enabled
145 active member
146 may_enable: true
147
148 member p2: enabled
149 may_enable: true
150
151 member p3: enabled
152 may_enable: true
153
154 ])
155
156 dnl Now delete the primary and verify that the output shows that the
157 dnl primary is no longer an member
158 ovs-vsctl --id=@p1 get Interface p1 -- remove Port bond0 interfaces @p1
159 ovs-appctl time/warp 100
160 OVS_WAIT_UNTIL([test -n "`ovs-appctl bond/show | fgrep 'active-backup primary: p1 (no such member)'`"])
161
162 dnl Now re-add the primary and verify that the output shows that the
163 dnl primary is available again.
164 dnl
165 dnl First, get the UUIDs of the members that exist on bond0.
166 dnl Strip the trailing ] so that we can add a new UUID to the end.
167 uuids=`ovs-vsctl get Port bond0 interfaces | sed -e 's/]//'`
168 dnl Create a new port "p1" and add its UUID to the set of members
169 dnl on bond0.
170 ovs-vsctl \
171 --id=@p1 create Interface name=p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
172 set Port bond0 interfaces="$uuids, @p1]"
173 ovs-appctl time/warp 100
174 OVS_WAIT_UNTIL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [0], [dnl
175 ---- bond0 ----
176 bond_mode: active-backup
177 bond may use recirculation: no, <del>
178 bond-hash-basis: 0
179 updelay: 0 ms
180 downdelay: 0 ms
181 lacp_status: off
182 lacp_fallback_ab: false
183 active-backup primary: p1
184 <active member mac del>
185
186 member p1: enabled
187 active member
188 may_enable: true
189
190 member p2: enabled
191 may_enable: true
192
193 member p3: enabled
194 may_enable: true
195
196 ])
197
198 dnl Switch to another primary
199 ovs-vsctl set port bond0 other_config:bond-primary=p2
200 ovs-appctl time/warp 100
201 OVS_WAIT_UNTIL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [0], [dnl
202 ---- bond0 ----
203 bond_mode: active-backup
204 bond may use recirculation: no, <del>
205 bond-hash-basis: 0
206 updelay: 0 ms
207 downdelay: 0 ms
208 lacp_status: off
209 lacp_fallback_ab: false
210 active-backup primary: p2
211 <active member mac del>
212
213 member p1: enabled
214 active member
215 may_enable: true
216
217 member p2: enabled
218 may_enable: true
219
220 member p3: enabled
221 may_enable: true
222
223 ])
224
225 dnl Remove the "bond-primary" config directive from the bond.
226 AT_CHECK([ovs-vsctl remove Port bond0 other_config bond-primary])
227 ovs-appctl time/warp 100
228 OVS_WAIT_UNTIL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [0], [dnl
229 ---- bond0 ----
230 bond_mode: active-backup
231 bond may use recirculation: no, <del>
232 bond-hash-basis: 0
233 updelay: 0 ms
234 downdelay: 0 ms
235 lacp_status: off
236 lacp_fallback_ab: false
237 active-backup primary: <none>
238 <active member mac del>
239
240 member p1: enabled
241 active member
242 may_enable: true
243
244 member p2: enabled
245 may_enable: true
246
247 member p3: enabled
248 may_enable: true
249
250 ])
251
252 OVS_VSWITCHD_STOP
253 AT_CLEANUP
254
255 AT_SETUP([ofproto-dpif - active-backup bonding (without primary)])
256 dnl Create br0 with members p1, p2 and p7, creating bond0 with p1 and p2
257 dnl and br1 with members p3, p4 and p8.
258 dnl toggle p1,p2 of bond0 up and down to test bonding in active-backup mode.
259 OVS_VSWITCHD_START(
260 [add-bond br0 bond0 p1 p2 bond_mode=active-backup --\
261 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
262 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
263 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
264 add-br br1 -- \
265 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
266 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
267 fail-mode=secure -- \
268 add-port br1 p3 -- set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
269 add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
270 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
271 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
272 WAIT_FOR_DUMMY_PORTS([p3], [p4])
273 OVS_WAIT_UNTIL([test -n "`ovs-appctl bond/show | grep 'active-backup primary: <none>'`"])
274
275 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
276 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
277 ovs-appctl netdev-dummy/set-admin-state up
278 ovs-appctl time/warp 100
279 ovs-appctl netdev-dummy/set-admin-state p2 down
280 ovs-appctl time/stop
281 ovs-appctl time/warp 100
282 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),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)'])
283 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
284 ovs-appctl time/warp 100
285 ovs-appctl netdev-dummy/set-admin-state p2 up
286 ovs-appctl netdev-dummy/set-admin-state p1 down
287 ovs-appctl time/warp 100
288 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0d),eth_type(0x0800),ipv4(src=10.0.0.5,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
289 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(src=10.0.0.6,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
290 ovs-appctl time/warp 2000 100
291 AT_CHECK([ovs-appctl dpctl/dump-flows | grep 'in_port([[348]])' | strip_xout], [0], [dnl
292 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions: <del>
293 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions: <del>
294 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0d),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions: <del>
295 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions: <del>
296 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), packets:0, bytes:0, used:never, actions: <del>
297 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), packets:0, bytes:0, used:never, actions: <del>
298 ])
299 OVS_VSWITCHD_STOP
300 AT_CLEANUP
301
302 AT_SETUP([ofproto-dpif - balance-slb bonding])
303 # Create br0 with members bond0(p1, p2, p3) and p7,
304 # and br1 with members p4, p5, p6 and p8.
305 # p1 <-> p4, p2 <-> p5, p3 <-> p6
306 # Send some traffic, make sure the traffic are spread based on source mac.
307 OVS_VSWITCHD_START(
308 [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-slb --\
309 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
310 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
311 set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
312 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
313 add-br br1 -- \
314 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
315 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
316 fail-mode=secure -- \
317 add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
318 add-port br1 p5 -- set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
319 add-port br1 p6 -- set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
320 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
321 WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
322 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
323 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
324 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
325 ])
326 ovs-appctl time/stop
327 ovs-appctl time/warp 100
328 (
329 for i in `seq 0 100 |xargs printf '%02x\n'`;
330 do
331 pkt="in_port(7),eth(src=50:54:00:00:00:$i,dst=50:54:00:00:01:00),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)"
332 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
333 done
334 )
335 ovs-appctl time/warp 100
336 AT_CHECK([ovs-appctl dpif/dump-flows br1 > br1_flows.txt])
337 # Make sure there is resonable distribution to all three ports.
338 # We don't want to make this check precise, in case hash function changes.
339 AT_CHECK([test `egrep 'in_port\(4\)' br1_flows.txt |wc -l` -gt 3])
340 AT_CHECK([test `egrep 'in_port\(5\)' br1_flows.txt |wc -l` -gt 3])
341 AT_CHECK([test `egrep 'in_port\(6\)' br1_flows.txt |wc -l` -gt 3])
342 OVS_VSWITCHD_STOP
343 AT_CLEANUP
344
345 AT_SETUP([ofproto-dpif - balance-tcp bonding])
346 # Create br0 with members bond0(p1, p2, p3) and p7,
347 # and br1 with members bond1(p4, p5, p6) and p8.
348 # bond0 <-> bond1
349 # Send some traffic, make sure the traffic are spread based on L4 headers.
350 OVS_VSWITCHD_START(
351 [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-tcp lacp=active \
352 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
353 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
354 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
355 set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
356 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
357 add-br br1 -- \
358 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
359 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
360 fail-mode=secure -- \
361 add-bond br1 bond1 p4 p5 p6 bond_mode=balance-tcp lacp=active \
362 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
363 set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
364 set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
365 set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
366 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
367 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
368 ])
369 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
370 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
371 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
372 ], [])
373 OVS_WAIT_WHILE([ovs-appctl bond/show | grep "may_enable: false"])
374 ovs-appctl time/stop
375 ovs-appctl time/warp 100
376 ovs-appctl lacp/show > lacp.txt
377 ovs-appctl bond/show > bond.txt
378 # Check that lb_output is not enabled by default.
379 AT_CHECK([grep -q '^lb_output action: disabled' bond.txt])
380 (
381 for i in `seq 0 255` ;
382 do
383 pkt="in_port(7),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=$i),tcp_flags(ack)"
384 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
385 done
386 )
387 ovs-appctl time/warp 300 100
388 AT_CHECK([ovs-appctl dpif/dump-flows br0 |grep tcp > br0_flows.txt])
389 AT_CHECK([ovs-appctl dpif/dump-flows br1 |grep tcp > br1_flows.txt])
390 # Make sure there is resonable distribution to all three ports.
391 # We don't want to make this check precise, in case hash function changes.
392 AT_CHECK([test $(grep -c in_port.4 br1_flows.txt) -gt 24])
393 AT_CHECK([test $(grep -c in_port.5 br1_flows.txt) -gt 24])
394 AT_CHECK([test $(grep -c in_port.6 br1_flows.txt) -gt 24])
395 # Check that bonding is doing dp_hash.
396 AT_CHECK([grep -q dp_hash br0_flows.txt])
397 # Enabling lb_output.
398 AT_CHECK([ovs-vsctl set Port bond0 other_config:lb-output-action=true])
399 OVS_WAIT_UNTIL([ovs-appctl bond/show | grep -q '^lb_output action: enabled'])
400 ovs-appctl time/warp 10000 500
401 ovs-appctl revalidator/wait
402 OVS_WAIT_WHILE([ovs-appctl dpif/dump-flows br1 | grep -q tcp])
403 (
404 for i in $(seq 256) ;
405 do
406 pkt="in_port(7),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=$i),tcp_flags(ack)"
407 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
408 done
409 )
410 ovs-appctl time/warp 300 100
411 AT_CHECK([ovs-appctl dpif/dump-flows br0 | grep tcp > br0_flows.txt])
412 AT_CHECK([ovs-appctl dpif/dump-flows br1 | grep tcp > br1_flows.txt])
413 # Make sure there is resonable distribution to all three ports, again.
414 AT_CHECK([test $(grep -c in_port.4 br1_flows.txt) -gt 24])
415 AT_CHECK([test $(grep -c in_port.5 br1_flows.txt) -gt 24])
416 AT_CHECK([test $(grep -c in_port.6 br1_flows.txt) -gt 24])
417 AT_CHECK([grep -q lb_output br0_flows.txt])
418
419 AT_CHECK([test $(ovs-appctl dpif-netdev/bond-show | grep -c bucket) -eq 256])
420 AT_CHECK([ovs-vsctl set Port bond0 other_config:lb-output-action=false])
421 OVS_WAIT_UNTIL([test -z "$(ovs-appctl dpif-netdev/bond-show)"])
422
423 OVS_VSWITCHD_STOP()
424 AT_CLEANUP
425
426 # Makes sure recirculation does not change the way packet is handled.
427 AT_SETUP([ofproto-dpif - balance-tcp bonding, different recirc flow ])
428 OVS_VSWITCHD_START(
429 [add-bond br0 bond0 p1 p2 bond_mode=balance-tcp lacp=active \
430 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 -- \
431 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
432 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
433 add-br br1 -- \
434 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
435 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
436 fail-mode=standalone -- \
437 add-bond br1 bond1 p3 p4 bond_mode=balance-tcp lacp=active \
438 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 -- \
439 set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
440 set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
441 add-port br1 br1- -- set interface br1- type=patch options:peer=br1+ ofport_request=100 -- \
442 add-br br-int -- \
443 set bridge br-int other-config:hwaddr=aa:77:aa:77:00:00 -- \
444 set bridge br-int datapath-type=dummy other-config:datapath-id=1235 \
445 fail-mode=secure -- \
446 add-port br-int br1+ -- set interface br1+ type=patch options:peer=br1- ofport_request=101 -- \
447 add-port br-int p5 -- set interface p5 ofport_request=5 type=dummy
448 ])
449 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
450 ])
451
452 # Waits for all ifaces enabled.
453 OVS_WAIT_UNTIL([test `ovs-appctl bond/show | grep -- "may_enable: true" | wc -l` -ge 4])
454
455 # The dl_vlan flow should not be ever matched,
456 # since recirculation should not change the flow handling.
457 AT_DATA([flows.txt], [dnl
458 table=0 priority=1 in_port=5 actions=mod_vlan_vid:1,output(101)
459 table=0 priority=2 in_port=5 dl_vlan=1 actions=drop
460 ])
461 AT_CHECK([ovs-ofctl add-flows br-int flows.txt])
462
463 # Sends a packet to trigger recirculation.
464 AT_CHECK([ovs-appctl netdev-dummy/receive p5 "in_port(5),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1)"])
465
466 # Collects flow stats.
467 AT_CHECK([ovs-appctl revalidator/purge], [0])
468
469 # Checks the flow stats in br1, should only be one flow with non-zero
470 # 'n_packets' from internal table.
471 AT_CHECK([ovs-appctl bridge/dump-flows br1 | ofctl_strip | grep -- "n_packets" | grep -- "table_id" | sed -e 's/output:[[0-9]][[0-9]]*/output/'] , [0], [dnl
472 table_id=254, n_packets=1, n_bytes=38, priority=20,recirc_id=0x0,dp_hash=0x0/0xff,actions=output
473 ])
474
475 # Checks the flow stats in br-int, should be only one match.
476 AT_CHECK([ovs-ofctl dump-flows br-int | ofctl_strip | sort], [0], [dnl
477 n_packets=1, n_bytes=34, priority=1,in_port=5 actions=mod_vlan_vid:1,output:101
478 priority=2,in_port=5,dl_vlan=1 actions=drop
479 NXST_FLOW reply:
480 ])
481
482 OVS_VSWITCHD_STOP()
483 AT_CLEANUP
484
485 AT_SETUP([ofproto-dpif - resubmit])
486 OVS_VSWITCHD_START
487 add_of_ports br0 1 10 11 12 13 14 15 16 17 18 19 20 21
488 AT_DATA([flows.txt], [dnl
489 table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21)
490 table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18)
491 table=0 in_port=3 priority=2000 icmp actions=output(20)
492 table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15)
493 table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2)
494 table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2)
495 ])
496 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
497 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=p1,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])
498 AT_CHECK([tail -1 stdout], [0],
499 [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
500 ])
501 OVS_VSWITCHD_STOP
502 AT_CLEANUP
503
504 AT_SETUP([ofproto-dpif - goto table])
505 OVS_VSWITCHD_START
506 add_of_ports br0 1 10 11
507 echo "table=0 in_port=1 actions=output(10),goto_table(1)" > flows.txt
508 for i in `seq 1 63`; do echo "table=$i actions=goto_table($(($i+1)))"; done >> flows.txt
509 echo "table=64 actions=output(11)" >> flows.txt
510 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
511 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])
512 AT_CHECK([tail -1 stdout], [0],
513 [Datapath actions: 10,11
514 ])
515 OVS_VSWITCHD_STOP
516 AT_CLEANUP
517
518 AT_SETUP([ofproto-dpif - write actions])
519 OVS_VSWITCHD_START
520 add_of_ports br0 1 10 11 12 13
521 AT_DATA([flows.txt], [dnl
522 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
523 table=1 ip actions=write_actions(output(13)),goto_table(2)
524 table=2 ip actions=set_field:192.168.3.91->ip_src,output(11)
525 ])
526 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
527 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])
528 AT_CHECK([tail -2 stdout], [0],
529 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
530 Datapath actions: 10,set(ipv4(src=192.168.3.91)),11,set(ipv4(src=192.168.3.90)),13
531 ])
532 OVS_VSWITCHD_STOP
533 AT_CLEANUP
534
535 AT_SETUP([ofproto-dpif - modify IPv6 Neighbor Solitication (ND)])
536 OVS_VSWITCHD_START
537 add_of_ports br0 1 10 11 12 13
538 AT_DATA([flows.txt], [dnl
539 table=0 in_port=1,icmp6,icmpv6_type=135 actions=output(10),write_actions(set_field:fe80::3->nd_target,set_field:aa:aa:aa:aa:aa:aa->nd_sll,output(12)),goto_table(1)
540 table=1 icmp6 actions=write_actions(output(13)),goto_table(2)
541 table=2 in_port=1,icmp6,icmpv6_type=135 actions=set_field:fe80::4->nd_target,set_field:cc:cc:cc:cc:cc:cc->nd_sll,output(11)
542 ])
543 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
544 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,icmp6,ipv6_src=fe80::1,ipv6_dst=fe80::2,nw_tos=0,nw_ttl=128,icmpv6_type=135,nd_target=fe80::2020,nd_sll=66:55:44:33:22:11'], [0], [stdout])
545 AT_CHECK([tail -4 stdout], [0],
546 [Megaflow: recirc_id=0,eth,icmp6,in_port=1,nw_frag=no,icmp_type=0x87/0xff,icmp_code=0x0/0xff,nd_target=fe80::2020,nd_sll=66:55:44:33:22:11
547 Datapath actions: 10,set(nd(target=fe80::4,sll=cc:cc:cc:cc:cc:cc)),11,set(nd(target=fe80::3,sll=aa:aa:aa:aa:aa:aa)),13
548 This flow is handled by the userspace slow path because it:
549 - Uses action(s) not supported by datapath.
550 ])
551 OVS_VSWITCHD_STOP
552 AT_CLEANUP
553
554 AT_SETUP([ofproto-dpif - clear actions])
555 OVS_VSWITCHD_START
556 add_of_ports br0 1 10 11 12
557 AT_DATA([flows.txt], [dnl
558 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
559 table=1 tcp actions=set_field:91->tp_src,output(11),clear_actions
560 ])
561 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
562 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=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=9'], [0], [stdout])
563 AT_CHECK([tail -2 stdout], [0],
564 [Megaflow: recirc_id=0,eth,tcp,in_port=1,nw_frag=no,tp_src=8
565 Datapath actions: 10,set(tcp(src=91)),11
566 ])
567 OVS_VSWITCHD_STOP
568 AT_CLEANUP
569
570 AT_SETUP([ofproto-dpif - group chaining])
571 OVS_VSWITCHD_START
572 add_of_ports br0 1 10 11
573 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=set_field:192.168.3.90->ip_src,group:123,bucket=output:11'])
574 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=123,type=all,bucket=output:10'])
575 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
576 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])
577 AT_CHECK([tail -1 stdout], [0],
578 [Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
579 ])
580 OVS_VSWITCHD_STOP
581 AT_CLEANUP
582
583 AT_SETUP([ofproto-dpif - all group in action list])
584 OVS_VSWITCHD_START
585 add_of_ports br0 1 10 11
586 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,set_field:192.168.3.90->ip_src,bucket=output:11'])
587 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
588 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])
589 # Must match on the source address to be able to restore it's value for
590 # the second bucket
591 AT_CHECK([tail -2 stdout], [0],
592 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
593 Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
594 ])
595 OVS_VSWITCHD_STOP
596 AT_CLEANUP
597
598 AT_SETUP([ofproto-dpif - indirect group in action list])
599 OVS_VSWITCHD_START
600 add_of_ports br0 1 10
601 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
602 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
603 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])
604 AT_CHECK([tail -1 stdout], [0],
605 [Datapath actions: 10
606 ])
607 OVS_VSWITCHD_STOP
608 AT_CLEANUP
609
610 AT_SETUP([ofproto-dpif - group actions have no effect afterwards])
611 OVS_VSWITCHD_START
612 add_of_ports br0 1 10
613 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=set_field:192.168.3.90->ip_src,output:10'])
614 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234,output:10'])
615
616 for d in 0 1 2 3; do
617 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.1.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
618 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
619 done
620
621 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | sed 's/packets.*actions:/actions:/' | strip_ufid | strip_used | sort], [0], [dnl
622 flow-dump from the main thread:
623 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:hash(sym_l4(0)),recirc(0x1)
624 recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),10
625 ])
626
627 OVS_VSWITCHD_STOP
628 AT_CLEANUP
629
630 AT_SETUP([ofproto-dpif - all group in action set])
631 OVS_VSWITCHD_START
632 add_of_ports br0 1 10 11
633 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,set_field:192.168.3.90->ip_src,bucket=output:11'])
634 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
635 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])
636 # Must match on the source address to be able to restore it's value for
637 # the third bucket
638 AT_CHECK([tail -2 stdout], [0],
639 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
640 Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
641 ])
642 OVS_VSWITCHD_STOP
643 AT_CLEANUP
644
645 AT_SETUP([ofproto-dpif - indirect group in action set])
646 OVS_VSWITCHD_START
647 add_of_ports br0 1 10
648 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
649 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
650 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])
651 AT_CHECK([tail -1 stdout], [0],
652 [Datapath actions: 10
653 ])
654 OVS_VSWITCHD_STOP
655 AT_CLEANUP
656
657 AT_SETUP([ofproto-dpif - patch port with action set])
658 OVS_VSWITCHD_START([ \
659 add-br br1 -- \
660 set bridge br1 datapath-type=dummy fail-mode=secure -- \
661 add-port br0 patch10 -- \
662 set interface patch10 type=patch options:peer=patch20 ofport_request=10 -- \
663 add-port br1 patch20 -- \
664 set interface patch20 type=patch options:peer=patch10 ofport_request=20
665 ])
666 add_of_ports br0 1
667 add_of_ports br1 2
668 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br1 'ip actions=write_actions(pop_vlan,output:2)'])
669 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=output:10'])
670 AT_CHECK([ovs-appctl ofproto/trace br1 'in_port=20,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_vlan=100,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])
671 AT_CHECK([tail -1 stdout], [0],
672 [Datapath actions: pop_vlan,2
673 ])
674 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_vlan=100,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])
675 AT_CHECK([tail -1 stdout], [0],
676 [Datapath actions: pop_vlan,2
677 ])
678 OVS_VSWITCHD_STOP
679 AT_CLEANUP
680
681
682 AT_SETUP([ofproto-dpif - select group])
683
684 OVS_VSWITCHD_START
685 add_of_ports br0 1 10 11
686
687 ovs-appctl vlog/set ofproto_dpif:file:dbg
688 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
689 AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
690 ofproto_dpif|DBG|Constructing select group 1234
691 ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
692 ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
693 ofproto_dpif|DBG| Using 16 hash values:
694 ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
695 ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
696 ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 1.
697 ])
698 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
699
700 # Try a bunch of different flows and make sure that they get distributed
701 # # at least somewhat.
702 for d in 0 1 2 3; do
703 for s in 1 2 3 4 ; do
704 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.$s,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
705 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
706 done
707 done
708
709 AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 5 2 dp_hash], [0], [dnl
710 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
711 n_flows=ok n_buckets=ok
712 ])
713
714 OVS_VSWITCHD_STOP
715 AT_CLEANUP
716
717 AT_SETUP([ofproto-dpif - select group with watch port])
718
719 OVS_VSWITCHD_START
720 add_of_ports br0 1 10 11
721 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
722 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
723
724 for d in 0 1 2 3; do
725 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),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)"
726 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
727 done
728
729 AT_CHECK([ovs-appctl dpctl/dump-flows | sort| sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | strip_ufid | strip_used], [0], [dnl
730 flow-dump from the main thread:
731 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:3, bytes:318, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
732 recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:3, bytes:318, used:0.0s, actions:11
733 ])
734
735 OVS_VSWITCHD_STOP
736 AT_CLEANUP
737
738 AT_SETUP([ofproto-dpif - select group with weights])
739
740 # Helper function to check the accuracy of distribution of packets over buckets
741 check_group_stats () {
742 buckets=`grep -o 'packet_count=[[0-9]]*' | cut -d'=' -f2 | tail -n +2`
743 i=0
744 for bucket in $buckets; do
745 min=$1
746 shift
747 if [[ $bucket -ge $min ]]; then
748 echo "bucket$i >= $min"
749 else
750 echo "bucket$i < $min"
751 fi
752 i=`expr $i + 1`
753 if [[ $i -ge 4 ]]; then break; fi
754 done
755 }
756
757 OVS_VSWITCHD_START
758 add_of_ports br0 1 10 11 12 13 14
759
760 ovs-appctl vlog/set ofproto_dpif:file:dbg
761 AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=1234,type=select,bucket=weight:5,output:10,bucket=weight:10,output:11,bucket=weight:25,output:12,bucket=weight:60,output:13,bucket=weight:0,output:14'])
762 AT_CHECK([grep -A9 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
763 ofproto_dpif|DBG|Constructing select group 1234
764 ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
765 ofproto_dpif|DBG| Minimum weight: 5, total weight: 100
766 ofproto_dpif|DBG| Using 32 hash values:
767 ofproto_dpif|DBG| Bucket 0: weight=5, target=1.60 hits=2
768 ofproto_dpif|DBG| Bucket 1: weight=10, target=3.20 hits=3
769 ofproto_dpif|DBG| Bucket 2: weight=25, target=8.00 hits=8
770 ofproto_dpif|DBG| Bucket 3: weight=60, target=19.20 hits=19
771 ofproto_dpif|DBG| Bucket 4: weight=0, target=0.00 hits=0
772 ofproto_dpif|DBG|Use dp_hash with 32 hash values using algorithm 1.
773 ])
774 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
775
776 # Try 1000 different flows and make sure that they get distributed according to weights
777 for d1 in 0 1 2 3 4 5 6 7 8 9 ; do
778 for d2 in 0 1 2 3 4 5 6 7 8 9 ; do
779 for s in 0 1 2 3 4 5 6 7 8 9 ; do
780 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.1.$s,dst=192.168.$d1.$d2,proto=6,tos=0,ttl=128,frag=no),tcp(src=1000$s,dst=1000)"
781 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
782 done
783 done
784 done
785
786 # Check balanced distribution over 32 dp_hash values
787 AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 32 4 dp_hash], [0], [dnl
788 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:999, bytes:117882, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
789 n_flows=ok n_buckets=ok
790 ])
791
792 # Check that actual distribution over the buckets is reasonably accurate:
793 ideal weights dp_hash values
794 # bucket0: 5%*1000 = 50 2/32*1000 = 63
795 # bucket1: 10%*1000 = 100 3/32*1000 = 94
796 # bucket2: 25%*1000 = 250 8/32*1000 = 250
797 # bucket3: 60%*1000 = 600 19/32*1000 = 594
798 # bucket4: 0 0
799
800 ovs-appctl time/warp 1000
801 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-group-stats br0 | sed 's/duration=[[0-9]]\.[[0-9]]*s,//' | check_group_stats 40 80 200 500],
802 [0], [dnl
803 bucket0 >= 40
804 bucket1 >= 80
805 bucket2 >= 200
806 bucket3 >= 500
807 ])
808
809 OVS_VSWITCHD_STOP
810 AT_CLEANUP
811
812 AT_SETUP([ofproto-dpif - select group with explicit dp_hash selection method])
813
814 OVS_VSWITCHD_START
815 add_of_ports br0 1 10 11
816
817 ovs-appctl vlog/set ofproto_dpif:file:dbg
818 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11'])
819 AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
820 ofproto_dpif|DBG|Constructing select group 1234
821 ofproto_dpif|DBG|Selection method specified: dp_hash.
822 ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
823 ofproto_dpif|DBG| Using 16 hash values:
824 ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
825 ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
826 ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 0.
827 ])
828
829 # Fall back to legacy hash with zero buckets
830 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method=dp_hash'])
831 AT_CHECK([grep -A3 "Constructing select group 1235" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
832 ofproto_dpif|DBG|Constructing select group 1235
833 ofproto_dpif|DBG|Selection method specified: dp_hash.
834 ofproto_dpif|DBG| Don't apply dp_hash method without buckets.
835 ofproto_dpif|DBG|Falling back to default hash method.
836 ])
837
838 # Fall back to legacy hash with zero buckets
839 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1236,type=select,selection_method=dp_hash,bucket=weight=1,output:10,bucket=weight=1000,output:11'])
840 AT_CHECK([grep -A4 "Constructing select group 1236" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
841 ofproto_dpif|DBG|Constructing select group 1236
842 ofproto_dpif|DBG|Selection method specified: dp_hash.
843 ofproto_dpif|DBG| Minimum weight: 1, total weight: 1001
844 ofproto_dpif|DBG| Too many hash values required: 1024
845 ofproto_dpif|DBG|Falling back to default hash method.
846 ])
847
848 OVS_VSWITCHD_STOP
849 AT_CLEANUP
850
851 AT_SETUP([ofproto-dpif - select group with legacy hash selection method])
852
853 OVS_VSWITCHD_START
854 add_of_ports br0 1 10 11
855
856 ovs-appctl vlog/set ofproto_dpif:file:dbg
857 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,bucket=output:10,bucket=output:11'])
858 AT_CHECK([grep -A2 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
859 ofproto_dpif|DBG|Constructing select group 1234
860 ofproto_dpif|DBG|Selection method specified: hash.
861 ofproto_dpif|DBG|No hash fields. Falling back to default hash method.
862 ])
863
864 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
865
866 # Try 16 flows with differing default hash values.
867 for d in 0 1 2 3; do
868 for s in 1 2 3 4 ; do
869 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.$s,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
870 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
871 done
872 done
873
874 # Check that the packets installed 16 data path flows and each of the two
875 # buckets is hit at least once.
876 AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
877 n_flows=ok n_buckets=ok
878 ])
879
880 OVS_VSWITCHD_STOP
881 AT_CLEANUP
882
883 AT_SETUP([ofproto-dpif - select group with custom hash selection method])
884
885 OVS_VSWITCHD_START
886 add_of_ports br0 1 10 11
887
888 # Check that parse failures after 'fields' parsing work
889 AT_CHECK([ovs-ofctl -O OpenFlow10 add-group br0 'group_id=1,type=select,fields(eth_dst),bukket=output:10'], [1], ,[dnl
890 ovs-ofctl: unknown keyword bukket
891 ])
892
893 # Check that fields are rejected without "selection_method=hash".
894 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11'], 1, [], [dnl
895 ovs-ofctl: fields may only be specified with "selection_method=hash"
896 ])
897
898 # Check that selection_method_param without selection_method is rejected.
899 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method_param=1,bucket=output:10,bucket=output:11'], 1, [], [dnl
900 ovs-ofctl: selection_method_param is only allowed with "selection_method"
901 ])
902
903 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11'])
904 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
905
906 # Try 16 flows with differing custom hash and check that they give rise to
907 # 16 data path flows and each of the two buckets is hit at least once
908 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
909 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:$d),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)"
910 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
911 done
912
913 AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
914 n_flows=ok n_buckets=ok
915 ])
916
917 AT_CHECK([ovs-appctl revalidator/purge], [0])
918
919 # Try 16 flows that differ only in fields that are not part of the custom
920 # hash and check that there is only a single datapath flow
921 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
922 pkt="in_port(1),eth(src=50:54:00:00:00:$d,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)"
923 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
924 done
925
926 AT_CHECK([ovs-appctl dpctl/dump-flows | grep -c recirc_id], [0], [dnl
927 1
928 ])
929
930 OVS_VSWITCHD_STOP
931 AT_CLEANUP
932
933 AT_SETUP([ofproto-dpif - fast failover group])
934 OVS_VSWITCHD_START
935 add_of_ports br0 1 10 11
936 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=ff,bucket=watch_port:10,output:10,bucket=watch_port:11,output:11'])
937 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
938 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])
939 AT_CHECK([tail -1 stdout], [0],
940 [Datapath actions: 10
941 ])
942 OVS_VSWITCHD_STOP
943 AT_CLEANUP
944
945 AT_SETUP([ofproto-dpif - group stats single bucket])
946 OVS_VSWITCHD_START
947 add_of_ports br0 1 10 11
948 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
949 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
950 (
951 for i in `seq 0 2`;
952 do
953 pkt="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),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)"
954 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
955 done
956 )
957 AT_CHECK([ovs-appctl revalidator/purge], [0])
958 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
959 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
960 group_id=1234,ref_count=1,packet_count=3,byte_count=318,bucket0:packet_count=3,byte_count=318,bucket1:packet_count=0,byte_count=0
961 OFPST_GROUP reply (OF1.2):
962 ])
963 OVS_VSWITCHD_STOP
964 AT_CLEANUP
965
966 AT_SETUP([ofproto-dpif - group stats all buckets])
967 OVS_VSWITCHD_START
968 add_of_ports br0 1 10 11
969 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
970 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
971 (
972 for i in `seq 0 2`;
973 do
974 pkt="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),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)"
975 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
976 done
977 )
978 AT_CHECK([ovs-appctl revalidator/purge], [0])
979 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
980 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
981 group_id=1234,ref_count=1,packet_count=3,byte_count=318,bucket0:packet_count=3,byte_count=318,bucket1:packet_count=3,byte_count=318
982 OFPST_GROUP reply (OF1.2):
983 ])
984 OVS_VSWITCHD_STOP
985 AT_CLEANUP
986
987 AT_SETUP([ofproto-dpif - registers])
988 OVS_VSWITCHD_START
989 add_of_ports br0 20 21 22 33 90
990 AT_DATA([flows.txt], [dnl
991 in_port=90 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
992 in_port=91 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
993 in_port=92 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
994 in_port=93 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
995
996 in_port=2 actions=load:0x000db000->NXM_NX_REG0[[]]
997 in_port=3 actions=load:0xdea->NXM_NX_REG0[[20..31]]
998 in_port=4 actions=load:0xeef->NXM_NX_REG0[[0..11]]
999 in_port=5 actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
1000 in_port=6 actions=load:0x22222222->NXM_NX_REG2[[]]
1001 in_port=7 actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
1002 in_port=8 actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
1003 in_port=9,reg0=0xdeadbeef actions=output:20
1004 in_port=10,reg1=0xdeadbeef actions=output:21
1005 in_port=11,reg2=0xeef22dea actions=output:22
1006
1007 dnl Sanilty check all registers
1008 in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
1009 in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
1010 in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
1011 in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
1012
1013 ])
1014 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1015 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])
1016 AT_CHECK([tail -1 stdout], [0],
1017 [Datapath actions: 20,21,22,33
1018 ])
1019 OVS_VSWITCHD_STOP
1020 AT_CLEANUP
1021
1022 dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
1023 dnl in the manner documented in ovs-ofctl(8).
1024 AT_SETUP([ofproto-dpif - extended registers])
1025 OVS_VSWITCHD_START
1026 add_of_ports br0 1 2 3
1027 AT_DATA([flows.txt], [dnl
1028 table=0 actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
1029 table=1,reg2=0xfedcba98,reg3=0x76543210 actions=2
1030
1031 # These low-priority rules shouldn't match. They're here only to make really
1032 # sure that the test fails if either of the above rules fails to match.
1033 table=0,priority=0 actions=3
1034 table=1,priority=0 actions=3
1035 ])
1036 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1037 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])
1038 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
1039 ])
1040 OVS_VSWITCHD_STOP
1041 AT_CLEANUP
1042
1043 dnl Tests that the standardized xxregs are mapped onto the legacy OVS
1044 dnl registers in the manner documented in ovs-ofctl(8).
1045 AT_SETUP([ofproto-dpif - extended-extended registers])
1046 OVS_VSWITCHD_START
1047 add_of_ports br0 1 2 3
1048 AT_DATA([flows.txt], [dnl
1049 table=0 actions=load:0x0123456789abcdeffedcba9876543210->NXM_NX_XXREG1[[]],resubmit(,1)
1050 table=1,reg4=0x01234567,reg5=0x89abcdef,reg6=0xfedcba98,reg7=0x76543210 actions=2
1051
1052 # These low-priority rules shouldn't match. They're here only to make really
1053 # sure that the test fails if either of the above rules fails to match.
1054 table=0,priority=0 actions=3
1055 table=1,priority=0 actions=3
1056 ])
1057 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1058 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])
1059 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
1060 ])
1061 OVS_VSWITCHD_STOP
1062 AT_CLEANUP
1063
1064 AT_SETUP([ofproto-dpif - load and move order])
1065 OVS_VSWITCHD_START
1066 add_of_ports br0 1 10 11
1067 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,move:NXM_NX_REG1[[]]->NXM_OF_IP_SRC[[]],bucket=output:11'])
1068 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(load:0xffffffff->NXM_NX_REG1[[]],move:NXM_NX_REG1[[]]->NXM_NX_REG2[[]],group:1234)'])
1069 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])
1070 AT_CHECK([tail -2 stdout], [0],
1071 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
1072 Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
1073 ])
1074 OVS_VSWITCHD_STOP
1075 AT_CLEANUP
1076
1077 dnl Tests that 1.5 copy-field can copy into the standardized xregs.
1078 AT_SETUP([ofproto-dpif - copy-field into extended registers])
1079 OVS_VSWITCHD_START
1080 add_of_ports br0 1 2 3
1081 AT_DATA([flows.txt], [dnl
1082 table=0 actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
1083 table=1,xreg0=0x0000505400000005 actions=2
1084
1085 # These low-priority rules shouldn't match. They're here only to make really
1086 # sure that the test fails if either of the above rules fails to match.
1087 table=0,priority=0 actions=3
1088 table=1,priority=0 actions=3
1089 ])
1090 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
1091 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])
1092 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
1093 ])
1094 OVS_VSWITCHD_STOP
1095 AT_CLEANUP
1096
1097 dnl Tests that 1.5 set-field with mask in the metadata register.
1098 AT_SETUP([ofproto-dpif - masked set-field into metadata])
1099 OVS_VSWITCHD_START
1100 add_of_ports br0 1 2 3
1101 AT_DATA([flows.txt], [dnl
1102 table=0 actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
1103 table=1 actions=set_field:0x6b/0xff->metadata,goto_table(2)
1104 table=2,metadata=0xfafafafa5a5a5a6b actions=2
1105
1106 # These low-priority rules shouldn't match. They're here only to make really
1107 # sure that the test fails if either of the above rules fails to match.
1108 table=0,priority=0 actions=3
1109 table=1,priority=0 actions=3
1110 table=2,priority=0 actions=3
1111 ])
1112 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
1113 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])
1114 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
1115 ])
1116 OVS_VSWITCHD_STOP
1117 AT_CLEANUP
1118
1119
1120 AT_SETUP([ofproto-dpif - actset_output])
1121 OVS_VSWITCHD_START
1122 add_of_ports br0 1 2 3 4 5 6 7 8 9 10 11 12 13
1123 AT_DATA([flows.txt], [dnl
1124 table=0,actset_output=unset actions=write_actions(output(2)),goto_table(1)
1125 table=1 actions=move:ONFOXM_ET_ACTSET_OUTPUT[[0..31]]->OXM_OF_PKT_REG0[[0..31]],goto_table(2)
1126
1127 # Verify that actset_output got set.
1128 table=2,priority=20,actset_output=2 actions=4,goto_table(3)
1129 table=2,priority=10 actions=5,goto_table(3)
1130
1131 # Verify that xreg0 got copied properly from actset_output.
1132 table=3,priority=20,xreg0=2 actions=6,goto_table(4)
1133 table=3,priority=10 actions=7,goto_table(4)
1134
1135 # Verify that xxreg0 got copied properly from actset_output.
1136 table=3,priority=20,xxreg0=2 actions=6,goto_table(4)
1137 table=3,priority=10 actions=7,goto_table(4)
1138
1139 # Verify that adding a group action unsets actset_output,
1140 # even if output follows group.
1141 table=4 actions=write_actions(group(5),output(10)),goto_table(5)
1142 table=5,priority=20,actset_output=unset actions=8,goto_table(6)
1143 table=5,priority=10 actions=9,goto_table(6)
1144
1145 # Verify that adding another output action doesn't change actset_output
1146 # (since there's still a group).
1147 table=6 actions=write_actions(output(3)),goto_table(7)
1148 table=7,priority=20,actset_output=unset actions=10,goto_table(8)
1149 table=7,priority=10 actions=11,goto_table(8)
1150
1151 # Verify that clearing the action set, then writing an output action,
1152 # causes actset_output to be set again.
1153 table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
1154 table=9,priority=20,actset_output=2 actions=12
1155 table=9,priority=10 actions=13
1156 ])
1157 AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=5,type=all,bucket=output:1'])
1158 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
1159 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])
1160 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
1161 ])
1162 OVS_VSWITCHD_STOP
1163 AT_CLEANUP
1164
1165 AT_SETUP([ofproto-dpif - push-pop])
1166 OVS_VSWITCHD_START
1167 add_of_ports br0 20 21 22 33 90
1168 AT_DATA([flows.txt], [dnl
1169 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
1170 in_port=2 actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
1171 in_port=3 actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
1172 in_port=4 actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
1173 in_port=5 actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
1174
1175 ])
1176 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1177 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])
1178 AT_CHECK([tail -1 stdout], [0],
1179 [Datapath actions: 33,22,21,20
1180 ])
1181 OVS_VSWITCHD_STOP
1182 AT_CLEANUP
1183
1184 AT_SETUP([ofproto-dpif - output])
1185 OVS_VSWITCHD_START
1186 add_of_ports br0 1 9 10 11 55 66 77 88
1187 AT_DATA([flows.txt], [dnl
1188 in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
1189 in_port=2 actions=output:9
1190 in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
1191 in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
1192 in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
1193 in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
1194 in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
1195 in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
1196 ])
1197 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1198 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])
1199 AT_CHECK([tail -1 stdout], [0],
1200 [Datapath actions: 9,55,10,55,66,11,77,88,9,1
1201 ])
1202 OVS_VSWITCHD_STOP
1203 AT_CLEANUP
1204
1205 AT_SETUP([ofproto-dpif - dec_ttl])
1206 OVS_VSWITCHD_START
1207 add_of_ports br0 1 2 3 4
1208 AT_DATA([flows.txt], [dnl
1209 table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
1210 table=1 in_port=1 action=dec_ttl,output:3
1211 ])
1212 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1213 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=111,tos=0,ttl=2,frag=no)' -generate], [0], [stdout])
1214 AT_CHECK([tail -4 stdout], [0], [
1215 Final flow: ip,in_port=1,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_proto=111,nw_tos=0,nw_ecn=0,nw_ttl=1
1216 Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=2,nw_frag=no
1217 Datapath actions: set(ipv4(ttl=1)),2,userspace(pid=0,controller(reason=2,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535)),4
1218 ])
1219 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=111,tos=0,ttl=3,frag=no)'], [0], [stdout])
1220 AT_CHECK([tail -2 stdout], [0],
1221 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=3,nw_frag=no
1222 Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
1223 ])
1224 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])
1225 AT_CHECK([tail -2 stdout], [0],
1226 [Megaflow: recirc_id=0,eth,ipv6,in_port=1,nw_ttl=128,nw_frag=no
1227 Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
1228 ])
1229
1230 AT_CAPTURE_FILE([ofctl_monitor.log])
1231 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1232
1233 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=111,tos=0,ttl=2,frag=no)'
1234
1235 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1236 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1237 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
1238 ip,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_proto=111,nw_tos=0,nw_ecn=0,nw_ttl=1
1239 ])
1240 OVS_VSWITCHD_STOP
1241 AT_CLEANUP
1242
1243 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
1244 dnl buffer to be resized just before pushing the id of the dec_ttl action.
1245 dnl Thus the implementation must account for this by using the
1246 dnl reallocated buffer rather than the original buffer.
1247 dnl
1248 dnl A number of similar rules are added to try and exercise
1249 dnl xrealloc sufficiently that it returns a different base pointer
1250 AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
1251 OVS_VSWITCHD_START
1252 add_of_ports br0 1
1253 (for i in `seq 0 255`; do
1254 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
1255 done) > flows.txt
1256 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1257 OVS_VSWITCHD_STOP
1258 AT_CLEANUP
1259
1260 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
1261 dnl buffer to be resized just before pushing the id of the dec_ttl action.
1262 dnl Thus the implementation must account for this by using the
1263 dnl reallocated buffer rather than the original buffer.
1264 dnl
1265 dnl A number of similar rules are added to try and exercise
1266 dnl xrealloc sufficiently that it returns a different base pointer
1267 AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
1268 OVS_VSWITCHD_START
1269 add_of_ports br0 1
1270 (for i in `seq 0 255`; do
1271 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
1272 done) > flows.txt
1273 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1274 OVS_VSWITCHD_STOP
1275 AT_CLEANUP
1276
1277 dnl A note action at offset 24 in ofpacts will cause the ofpacts
1278 dnl buffer to be resized just before pushing the id of the dec_ttl action.
1279 dnl Thus the implementation must account for this by using the
1280 dnl reallocated buffer rather than the original buffer.
1281 dnl
1282 dnl A number of similar rules are added to try and exercise
1283 dnl xrealloc sufficiently that it returns a different base pointer
1284 AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
1285 OVS_VSWITCHD_START
1286 add_of_ports br0 1
1287 (for i in `seq 0 255`; do
1288 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
1289 done) > flows.txt
1290 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1291 OVS_VSWITCHD_STOP
1292 AT_CLEANUP
1293
1294 dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
1295 dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
1296 dnl Using `make check-valgrind' here checks for use-after-free in this
1297 dnl codepath.
1298 AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
1299 OVS_VSWITCHD_START
1300 AT_CHECK([ovs-ofctl add-flow br0 'actions=set_field:0x1->metadata,set_field:0x2->metadata,set_field:0x3->metadata,set_field:0x4->metadata,note:00000000000000000000000000000000,note:00000000000000000000000000000000'])
1301 OVS_VSWITCHD_STOP
1302 AT_CLEANUP
1303
1304 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
1305 OVS_VSWITCHD_START
1306 add_of_ports br0 1 2
1307
1308 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
1309
1310 # "in_port" defaults to OFPP_NONE if it's not specified.
1311 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"
1312 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
1313 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
1314 1
1315 2
1316 100
1317 ])
1318
1319 OVS_VSWITCHD_STOP
1320 AT_CLEANUP
1321
1322 AT_SETUP([ofproto-dpif - DSCP])
1323 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
1324 add_of_ports br0 9
1325 AT_DATA([flows.txt], [dnl
1326 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
1327 ])
1328 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1329 AT_CHECK([ovs-vsctl -- \
1330 set Port p1 qos=@newqos --\
1331 --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
1332 --id=@q1 create Queue dscp=1 --\
1333 --id=@q2 create Queue dscp=2], [0], [ignore])
1334 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])
1335 AT_CHECK([tail -2 stdout], [0],
1336 [Megaflow: recirc_id=0,skb_priority=0,eth,ip,in_port=9,nw_tos=252,nw_frag=no
1337 Datapath actions: dnl
1338 100,dnl
1339 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1340 set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
1341 1,dnl
1342 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1343 set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
1344 set(ipv4(tos=0/0xfc)),1,100
1345 ])
1346 OVS_VSWITCHD_STOP
1347 AT_CLEANUP
1348
1349 AT_SETUP([ofproto-dpif - output/flood flags])
1350 OVS_VSWITCHD_START
1351 add_of_ports br0 1 2 3 4 5 6 7
1352
1353 AT_DATA([flows.txt], [dnl
1354 in_port=local actions=local,flood
1355 in_port=1 actions=flood
1356 in_port=2 actions=all
1357 in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
1358 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
1359 ])
1360 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1361 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
1362 AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
1363
1364 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])
1365 AT_CHECK([tail -1 stdout \
1366 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
1367 1
1368 2
1369 3
1370 4
1371 7
1372 ])
1373
1374 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])
1375 AT_CHECK([tail -1 stdout \
1376 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
1377 100
1378 2
1379 3
1380 4
1381 7
1382 ])
1383
1384 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])
1385 AT_CHECK([tail -1 stdout \
1386 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
1387 1
1388 100
1389 3
1390 4
1391 6
1392 7
1393 ])
1394
1395 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])
1396 AT_CHECK([tail -1 stdout], [0],
1397 [Datapath actions: 100,1,2,4,6,7
1398 ])
1399
1400 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])
1401 AT_CHECK([tail -1 stdout], [0],
1402 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
1403 ])
1404 OVS_VSWITCHD_STOP
1405 AT_CLEANUP
1406
1407 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
1408 OVS_VSWITCHD_START([dnl
1409 add-port br0 p1 -- set Interface p1 type=dummy
1410 ])
1411 on_exit 'kill `cat ovs-ofctl.pid`'
1412
1413 AT_CAPTURE_FILE([ofctl_monitor.log])
1414
1415 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1416
1417 for i in 1 2 3 ; do
1418 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),tcp_flags(syn)'
1419 done
1420 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1421 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1422 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1423 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1424 tcp,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_flags=syn tcp_csum:2e7e
1425 dnl
1426 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1427 tcp,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_flags=syn tcp_csum:2e7e
1428 dnl
1429 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1430 tcp,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_flags=syn tcp_csum:2e7e
1431 ])
1432
1433 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1434 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1435 NXST_FLOW reply:
1436 ])
1437
1438 OVS_VSWITCHD_STOP
1439 AT_CLEANUP
1440
1441 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
1442 OVS_VSWITCHD_START([dnl
1443 add-port br0 p1 -- set Interface p1 type=dummy
1444 ])
1445 on_exit 'kill `cat ovs-ofctl.pid`'
1446
1447 AT_CAPTURE_FILE([ofctl_monitor.log])
1448 AT_CHECK([ovs-ofctl del-flows br0])
1449
1450 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1451
1452 dnl Test that missed packets are dropped
1453 for i in 1 2 3 ; do
1454 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),tcp_flags(ack,syn)'
1455 done
1456 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1457
1458 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1459 ])
1460
1461 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1462 AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1463 OFPST_FLOW reply (OF1.3):
1464 ])
1465
1466 OVS_VSWITCHD_STOP
1467 AT_CLEANUP
1468
1469 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
1470 OVS_VSWITCHD_START([dnl
1471 add-port br0 p1 -- set Interface p1 type=dummy
1472 ])
1473 on_exit 'kill `cat ovs-ofctl.pid`'
1474
1475 AT_CAPTURE_FILE([ofctl_monitor.log])
1476 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1477
1478 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1479
1480 for i in 1 2 3 ; do
1481 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),tcp_flags(urg|rst)'
1482 done
1483 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1484 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1485 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1486 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1487 tcp,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_flags=rst|urg tcp_csum:2e5c
1488 dnl
1489 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1490 tcp,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_flags=rst|urg tcp_csum:2e5c
1491 dnl
1492 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1493 tcp,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_flags=rst|urg tcp_csum:2e5c
1494 ])
1495
1496 AT_CHECK([ovs-appctl revalidator/purge], [0])
1497 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1498 n_packets=3, n_bytes=162, actions=goto_table:1
1499 OFPST_FLOW reply (OF1.2):
1500 ])
1501
1502 OVS_VSWITCHD_STOP
1503 AT_CLEANUP
1504
1505 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
1506 OVS_VSWITCHD_START([dnl
1507 add-port br0 p1 -- set Interface p1 type=dummy
1508 ])
1509 on_exit 'kill `cat ovs-ofctl.pid`'
1510
1511 AT_CAPTURE_FILE([ofctl_monitor.log])
1512 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1513
1514 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1515
1516 for i in 1 2 3 ; do
1517 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),tcp_flags(0x010)'
1518 done
1519
1520 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1521 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1522 ])
1523
1524 AT_CHECK([ovs-appctl revalidator/purge], [0])
1525 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1526 n_packets=3, n_bytes=354, actions=resubmit(1,1)
1527 OFPST_FLOW reply (OF1.2):
1528 ])
1529
1530 OVS_VSWITCHD_STOP
1531 AT_CLEANUP
1532
1533 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1534 OVS_VSWITCHD_START([dnl
1535 add-port br0 p1 -- set Interface p1 type=dummy
1536 ])
1537 on_exit 'kill `cat ovs-ofctl.pid`'
1538
1539 AT_CAPTURE_FILE([ofctl_monitor.log])
1540 AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1541 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1542
1543 dnl Miss table 0, Hit table 1
1544 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1545
1546 for i in 1 2 3 ; do
1547 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=9),tcp_flags(0x010)'
1548 done
1549 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1550 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1551
1552 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1553 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1554 tcp,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=9,tcp_flags=ack tcp_csum:4a2c
1555 dnl
1556 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1557 tcp,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=9,tcp_flags=ack tcp_csum:4a2c
1558 dnl
1559 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1560 tcp,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=9,tcp_flags=ack tcp_csum:4a2c
1561 ])
1562
1563 dnl Hit table 0, Miss all other tables, sent to controller
1564 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1565
1566 for i in 1 2 3 ; do
1567 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),tcp_flags(0x010)'
1568 done
1569 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1570 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1571
1572 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1573 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1574 tcp,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_flags=ack tcp_csum:4a2c
1575 dnl
1576 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1577 tcp,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_flags=ack tcp_csum:4a2c
1578 dnl
1579 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1580 tcp,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_flags=ack tcp_csum:4a2c
1581 ])
1582
1583 AT_CHECK([ovs-appctl revalidator/purge], [0])
1584 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1585 table=1, n_packets=3, n_bytes=354, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1586 OFPST_FLOW reply (OF1.2):
1587 ])
1588
1589 OVS_VSWITCHD_STOP
1590 AT_CLEANUP
1591
1592 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1593 OVS_VSWITCHD_START([dnl
1594 add-port br0 p1 -- set Interface p1 type=dummy
1595 ])
1596 on_exit 'kill `cat ovs-ofctl.pid`'
1597
1598 AT_CAPTURE_FILE([ofctl_monitor.log])
1599 AT_DATA([flows.txt], [dnl
1600 table=0 actions=goto_table(1)
1601 table=2 dl_src=10:11:11:11:11:11 actions=controller
1602 ])
1603 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1604 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1605
1606 dnl Hit table 0, Miss table 1, Hit table 2
1607 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1608
1609 for i in 1 2 3 ; do
1610 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=9),tcp_flags(0x010)'
1611 done
1612 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1613 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1614
1615 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1616 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1617 tcp,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=9,tcp_flags=ack tcp_csum:4a2c
1618 dnl
1619 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1620 tcp,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=9,tcp_flags=ack tcp_csum:4a2c
1621 dnl
1622 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1623 tcp,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=9,tcp_flags=ack tcp_csum:4a2c
1624 ])
1625
1626 dnl Hit table 1, Miss all other tables, sent to controller
1627 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1628
1629 for i in 1 2 3 ; do
1630 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),tcp_flags(0x010)'
1631 done
1632 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1633 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1634
1635 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1636 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1637 tcp,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_flags=ack tcp_csum:4a2c
1638 dnl
1639 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1640 tcp,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_flags=ack tcp_csum:4a2c
1641 dnl
1642 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1643 tcp,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_flags=ack tcp_csum:4a2c
1644 ])
1645
1646 AT_CHECK([ovs-appctl revalidator/purge], [0])
1647 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1648 n_packets=6, n_bytes=708, actions=goto_table:1
1649 table=2, n_packets=3, n_bytes=354, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1650 OFPST_FLOW reply (OF1.2):
1651 ])
1652
1653 OVS_VSWITCHD_STOP
1654 AT_CLEANUP
1655
1656 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1657 OVS_VSWITCHD_START([dnl
1658 add-port br0 p1 -- set Interface p1 type=dummy
1659 ])
1660 on_exit 'kill `cat ovs-ofctl.pid`'
1661
1662 AT_CAPTURE_FILE([ofctl_monitor.log])
1663 AT_DATA([flows.txt], [dnl
1664 table=0 actions=resubmit(1,1)
1665 table=2 dl_src=10:11:11:11:11:11 actions=controller
1666 ])
1667 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1668 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1669
1670 dnl Hit table 0, Miss table 1, Dropped
1671 AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1672
1673 for i in 1 2 3 ; do
1674 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=9),tcp_flags(0x010)'
1675 done
1676 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1677
1678 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1679 ])
1680
1681 dnl Hit table 1, Dropped
1682 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1683
1684 for i in 1 2 3 ; do
1685 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),tcp_flags(0x010)'
1686 done
1687 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1688
1689 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1690 ])
1691
1692 AT_CHECK([ovs-appctl revalidator/purge], [0])
1693 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1694 n_packets=6, n_bytes=708, actions=resubmit(1,1)
1695 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1696 OFPST_FLOW reply (OF1.2):
1697 ])
1698
1699 OVS_VSWITCHD_STOP
1700 AT_CLEANUP
1701
1702 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1703 OVS_VSWITCHD_START([dnl
1704 add-port br0 p1 -- set Interface p1 type=dummy
1705 ])
1706 on_exit 'kill `cat ovs-ofctl.pid`'
1707
1708 AT_CAPTURE_FILE([ofctl_monitor.log])
1709 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1710
1711 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1712
1713 dnl Test that missed packets are dropped
1714 for i in 1 2 3 ; do
1715 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),tcp_flags(0x010)'
1716 done
1717 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1718
1719 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1720 ])
1721
1722 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1723 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1724 NXST_FLOW reply:
1725 ])
1726
1727 OVS_VSWITCHD_STOP
1728 AT_CLEANUP
1729
1730 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1731 OVS_VSWITCHD_START([dnl
1732 add-port br0 p1 -- set Interface p1 type=dummy
1733 ])
1734 on_exit 'kill `cat ovs-ofctl.pid`'
1735
1736 AT_CAPTURE_FILE([ofctl_monitor.log])
1737 AT_CHECK([ovs-ofctl del-flows br0])
1738 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1739 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1740
1741 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1742
1743 dnl Test that missed packets are dropped
1744 for i in 1 2 3 ; do
1745 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),tcp_flags(0x010)'
1746 done
1747 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1748
1749 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1750 ])
1751
1752 AT_CHECK([ovs-appctl revalidator/purge], [0])
1753 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1754 n_packets=3, n_bytes=354, actions=goto_table:1
1755 OFPST_FLOW reply (OF1.2):
1756 ])
1757
1758 OVS_VSWITCHD_STOP
1759 AT_CLEANUP
1760
1761 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1762 OVS_VSWITCHD_START([dnl
1763 add-port br0 p1 -- set Interface p1 type=dummy
1764 ])
1765 on_exit 'kill `cat ovs-ofctl.pid`'
1766
1767 AT_CAPTURE_FILE([ofctl_monitor.log])
1768 AT_CHECK([ovs-ofctl del-flows br0])
1769 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1770 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1771
1772 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1773
1774 dnl Test that missed packets are dropped
1775 for i in 1 2 3 ; do
1776 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),tcp_flags(0x010)'
1777 done
1778 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1779
1780 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1781 ])
1782
1783 AT_CHECK([ovs-appctl revalidator/purge], [0])
1784 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1785 n_packets=3, n_bytes=354, actions=resubmit(1,1)
1786 OFPST_FLOW reply (OF1.2):
1787 ])
1788
1789 OVS_VSWITCHD_STOP
1790 AT_CLEANUP
1791
1792 AT_SETUP([ofproto-dpif - controller])
1793 OVS_VSWITCHD_START([dnl
1794 add-port br0 p1 -- set Interface p1 type=dummy
1795 ])
1796 on_exit 'kill `cat ovs-ofctl.pid`'
1797
1798 AT_CAPTURE_FILE([ofctl_monitor.log])
1799 AT_DATA([flows.txt], [dnl
1800 cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
1801 cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
1802 cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1803
1804 cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1805 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)
1806 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)
1807 cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1808 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)
1809 cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1810 cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
1811 cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
1812 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[[]],load:0x01010101->OXM_OF_ARP_SPA[[]],load:0x02020202->OXM_OF_ARP_TPA[[]],controller
1813 ])
1814 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1815
1816 dnl Flow miss.
1817 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1818
1819 for i in 1 2 3 ; do
1820 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),tcp_flags(0x010)'
1821 done
1822 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1823 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1824
1825 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1826 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1827 tcp,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_flags=ack tcp_csum:4a2c
1828 dnl
1829 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1830 tcp,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_flags=ack tcp_csum:4a2c
1831 dnl
1832 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1833 tcp,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_flags=ack tcp_csum:4a2c
1834 ])
1835
1836 dnl Singleton controller action.
1837 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1838
1839 for i in 1 2 3 ; do
1840 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),tcp_flags(0x002)'
1841 done
1842 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1843 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1844
1845 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1846 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1847 tcp,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_flags=syn tcp_csum:2e7d
1848 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1849 tcp,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_flags=syn tcp_csum:2e7d
1850 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1851 tcp,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_flags=syn tcp_csum:2e7d
1852 ])
1853
1854 dnl Modified controller action.
1855 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1856
1857 for i in 1 2 3 ; do
1858 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),tcp_flags(0x001)'
1859 done
1860 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1861 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1862
1863 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1864 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1865 tcp,dl_vlan=15,dl_vlan_pcp=0,vlan_tci1=0x0000,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_flags=fin tcp_csum:2e7e
1866 dnl
1867 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1868 tcp,dl_vlan=15,dl_vlan_pcp=0,vlan_tci1=0x0000,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_flags=fin tcp_csum:2e7e
1869 dnl
1870 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1871 tcp,dl_vlan=15,dl_vlan_pcp=0,vlan_tci1=0x0000,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_flags=fin tcp_csum:2e7e
1872 ])
1873
1874 dnl Modified VLAN controller action.
1875 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1876
1877 for i in 1 2 3; do
1878 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=16,tos=0,ttl=64,frag=no)'
1879 done
1880 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1881 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1882
1883 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1884 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1885 ip,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,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_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1886 dnl
1887 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1888 ip,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,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_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1889 dnl
1890 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1891 ip,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,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_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1892 ])
1893
1894 dnl Checksum TCP.
1895 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1896
1897 for i in 1 ; do
1898 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),tcp_flags(0x001)'
1899 done
1900 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1901 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1902
1903 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1904 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1905 tcp,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_flags=fin tcp_csum:2e7d
1906 dnl
1907 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=58 reg0=0x1,in_port=1 (via action) data_len=58 (unbuffered)
1908 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=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_flags=fin tcp_csum:2e7d
1909 dnl
1910 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=58 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=58 (unbuffered)
1911 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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_flags=fin tcp_csum:2e7d
1912 dnl
1913 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=58 (unbuffered)
1914 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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_flags=fin tcp_csum:2e7d
1915 dnl
1916 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=58 (unbuffered)
1917 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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_flags=fin tcp_csum:4880
1918 dnl
1919 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1920 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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_flags=fin tcp_csum:6082
1921 dnl
1922 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1923 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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_flags=fin tcp_csum:6035
1924 dnl
1925 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1926 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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_flags=fin tcp_csum:5fea
1927 dnl
1928 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1929 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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_flags=fin tcp_csum:5fea
1930 ])
1931
1932 dnl Checksum UDP.
1933 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1934
1935 for i in 1 ; do
1936 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'
1937 done
1938 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1939 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1940
1941 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1942 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1943 udp,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
1944 dnl
1945 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
1946 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=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
1947 dnl
1948 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=64 (unbuffered)
1949 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
1950 dnl
1951 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=64 (unbuffered)
1952 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
1953 dnl
1954 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=64 (unbuffered)
1955 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
1956 dnl
1957 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1958 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
1959 dnl
1960 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1961 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
1962 dnl
1963 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1964 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
1965 dnl
1966 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1967 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
1968 ])
1969
1970 dnl Modified ARP controller action.
1971 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1972
1973 for i in 1 2 3; do
1974 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)'
1975 done
1976
1977 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1978 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1979 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1980 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1981 arp,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
1982 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1983 arp,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
1984 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1985 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=1.1.1.1,arp_tpa=2.2.2.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
1986 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1987 arp,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
1988 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1989 arp,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
1990 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1991 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=1.1.1.1,arp_tpa=2.2.2.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
1992 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1993 arp,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
1994 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1995 arp,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
1996 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1997 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=1.1.1.1,arp_tpa=2.2.2.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
1998 ])
1999
2000 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2001
2002 dnl Checksum SCTP.
2003 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2004
2005 for i in 1 ; do
2006 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'
2007 done
2008
2009 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
2010 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
2011 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2012 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2013 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
2014 sctp,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
2015 dnl
2016 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
2017 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=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
2018 dnl
2019 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=102 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=102 (unbuffered)
2020 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
2021 dnl
2022 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=102 (unbuffered)
2023 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
2024 dnl
2025 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=102 (unbuffered)
2026 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
2027 dnl
2028 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
2029 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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
2030 dnl
2031 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
2032 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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:dd778f5f
2033 dnl
2034 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
2035 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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:62051f56
2036 dnl
2037 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
2038 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,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:62051f56
2039 ])
2040
2041 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2042 cookie=0x1, n_packets=3, n_bytes=212, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
2043 cookie=0x2, n_packets=3, n_bytes=162, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
2044 cookie=0x3, table=1, n_packets=3, n_bytes=212, in_port=80 actions=load:0x1->NXM_NX_REG0[[]],mod_vlan_vid:80,CONTROLLER:65535,resubmit(81,2)
2045 cookie=0x4, table=2, n_packets=3, n_bytes=212, in_port=81 actions=load:0x2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,CONTROLLER:65535,resubmit(82,3)
2046 cookie=0x5, table=3, n_packets=3, n_bytes=212, in_port=82 actions=load:0x3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,CONTROLLER:65535,resubmit(83,4)
2047 cookie=0x6, table=4, n_packets=3, n_bytes=212, in_port=83 actions=load:0x4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,CONTROLLER:65535,resubmit(84,5)
2048 cookie=0x7, table=5, n_packets=3, n_bytes=212, 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)
2049 cookie=0x8, table=6, n_packets=3, n_bytes=212, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
2050 cookie=0x9, table=7, n_packets=3, n_bytes=212, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
2051 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,CONTROLLER:65535
2052 cookie=0xd, n_packets=3, n_bytes=126, 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[[]],load:0x1010101->NXM_OF_ARP_SPA[[]],load:0x2020202->NXM_OF_ARP_TPA[[]],CONTROLLER:65535
2053 n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
2054 NXST_FLOW reply:
2055 ])
2056
2057 OVS_VSWITCHD_STOP
2058 AT_CLEANUP
2059
2060
2061 AT_SETUP([ofproto-dpif - controller with slow-path action])
2062 OVS_VSWITCHD_START
2063 add_of_ports br0 1 2
2064
2065 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,controller"])
2066
2067 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2068
2069 for i in 1 2 3 ; do
2070 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),tcp_flags(0x010)'
2071 done
2072
2073 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
2074 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2075
2076 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2077 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
2078 tcp,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_flags=ack tcp_csum:4a2c
2079 dnl
2080 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
2081 tcp,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_flags=ack tcp_csum:4a2c
2082 dnl
2083 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
2084 tcp,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_flags=ack tcp_csum:4a2c
2085 ])
2086
2087 OVS_VSWITCHD_STOP
2088 AT_CLEANUP
2089
2090
2091 AT_SETUP([ofproto-dpif - controller action without megaflows])
2092 OVS_VSWITCHD_START
2093 add_of_ports br0 1
2094
2095 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,action=controller])
2096 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [dnl
2097 megaflows disabled
2098 ])
2099
2100 AT_CAPTURE_FILE([ofctl_monitor.log])
2101 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2102
2103 for i in 1 2; do
2104 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(0x1234)'])
2105 done
2106
2107 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
2108 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
2109
2110 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
2111 flow-dump from the main thread:
2112 packets:1, bytes:14, used:0.001s, actions:userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
2113 ])
2114
2115 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2116 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
2117 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
2118 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
2119 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
2120 ])
2121
2122 AT_CHECK([ovs-appctl revalidator/purge])
2123 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2124
2125 dnl Add a controller meter.
2126 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=controller pktps stats bands=type=drop rate=2'])
2127
2128 dnl Advance time by 1 second.
2129 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
2130
2131 for i in `seq 1 8`; do
2132 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(0x4321)'])
2133 done
2134
2135 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
2136 flow-dump from the main thread:
2137 packets:7, bytes:98, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=2,rule_cookie=0,controller_id=0,max_len=65535))))
2138 ])
2139
2140 AT_CHECK([ovs-appctl time/warp 1], [0], [ignore])
2141 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
2142
2143 dnl Out of 8 packets we sent, two were passed by the rate limiter, and
2144 dnl the rest of packets were blocked.
2145 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2146 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
2147 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
2148 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
2149 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
2150 ])
2151 dnl Check meter stats to make it gives the same picture;
2152 dnl 7 packets hit the meter, but 6 packets are dropped by band0.
2153 AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
2154 OFPST_METER reply (OF1.3) (xid=0x2):
2155 meter:controller flow_count:0 packet_in_count:8 byte_in_count:112 duration:0.0s bands:
2156 0: packet_count:6 byte_count:84
2157 ])
2158
2159 OVS_VSWITCHD_STOP
2160 AT_CLEANUP
2161
2162 AT_SETUP([ofproto-dpif - MPLS handling])
2163 OVS_VSWITCHD_START([dnl
2164 add-port br0 p1 -- set Interface p1 type=dummy
2165 ])
2166 on_exit 'kill `cat ovs-ofctl.pid`'
2167
2168 AT_CAPTURE_FILE([ofctl_monitor.log])
2169 AT_DATA([flows.txt], [dnl
2170 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
2171 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
2172 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
2173 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
2174 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
2175 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
2176 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
2177 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
2178 cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
2179 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
2180 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
2181 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
2182
2183 cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
2184 cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
2185 cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
2186 cookie=0xd dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:OXM_OF_IPV4_DST[[]],pop:OXM_OF_IPV4_SRC[[]],controller
2187 cookie=0xd dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,1,0,OXM_OF_IPV4_SRC[[0..7]]),controller
2188 cookie=0xd dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,OXM_OF_IPV4_SRC[[0..15]],members:1,2),controller
2189 cookie=0xd dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,OXM_OF_IPV4_SRC[[]]=OXM_OF_IPV4_DST[[]]),controller
2190
2191 cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
2192 cookie=0xd table=1 arp actions=controller
2193
2194 cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
2195 cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
2196 cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
2197 cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
2198
2199 cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
2200 cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
2201 cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
2202
2203 cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
2204 cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
2205 cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
2206
2207 cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
2208 cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
2209 cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
2210
2211 cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
2212 cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
2213 cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
2214
2215 cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
2216 cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
2217 cookie=0x5 dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
2218 ])
2219 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2220
2221 dnl Modified MPLS controller action.
2222 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2223
2224 for i in 1 2 3; do
2225 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=17,tos=0,ttl=64,frag=no),udp(src=7777,dst=80)'
2226 done
2227 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2228 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2229
2230 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2231 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
2232 mpls,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
2233 dnl
2234 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
2235 mpls,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
2236 dnl
2237 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
2238 mpls,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
2239 ])
2240
2241 dnl Modified MPLS controller action.
2242 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2243
2244 for i in 1 2 3; do
2245 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=16,tos=0,ttl=64,frag=no)'
2246 done
2247 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2248 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2249
2250 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2251 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
2252 ip,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_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
2253 dnl
2254 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
2255 ip,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_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
2256 dnl
2257 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
2258 ip,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_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
2259 ])
2260
2261 dnl Modified MPLS controller action.
2262 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2263
2264 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)
2265
2266 for i in 1 2 3; do
2267 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)'
2268 done
2269 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2270 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2271
2272 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2273 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2274 mpls,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,mpls_lse1=46912
2275 dnl
2276 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2277 mpls,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,mpls_lse1=46912
2278 dnl
2279 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2280 mpls,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,mpls_lse1=46912
2281 ])
2282
2283 dnl Modified MPLS controller action.
2284 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2285
2286 for i in 1 2 3; do
2287 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=16,tos=0,ttl=64,frag=no))'
2288 done
2289 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2290 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2291
2292 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2293 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2294 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,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
2295 dnl
2296 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2297 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,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
2298 dnl
2299 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2300 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,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
2301 ])
2302
2303 dnl Modified MPLS controller action.
2304 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2305
2306 for i in 1 2 3; do
2307 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=16,tos=0,ttl=64,frag=no)'
2308 done
2309 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2310 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2311
2312 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2313 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2314 mpls,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
2315 dnl
2316 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2317 mpls,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
2318 dnl
2319 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2320 mpls,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
2321 ])
2322
2323 dnl Modified MPLS controller action.
2324 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2325
2326 for i in 1 2 3; do
2327 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=16,tos=0,ttl=64,frag=no)'
2328 done
2329 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2330 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2331
2332 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2333 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2334 mpls,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
2335 dnl
2336 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2337 mpls,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
2338 dnl
2339 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2340 mpls,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
2341 ])
2342
2343 dnl Modified MPLS controller action.
2344 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2345
2346 for i in 1 2 3; do
2347 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=16,tos=0,ttl=64,frag=no)'
2348 done
2349 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2350 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2351
2352 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2353 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2354 mpls,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
2355 dnl
2356 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2357 mpls,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
2358 dnl
2359 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2360 mpls,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
2361 ])
2362
2363 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2364
2365 dnl Modified MPLS controller action.
2366 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2367
2368 for i in 1 2 3; do
2369 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:49,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=10,tc=3,ttl=64,bos=1)'
2370 done
2371 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2372 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2373
2374 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2375 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2376 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
2377 dnl
2378 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2379 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
2380 dnl
2381 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2382 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
2383 ])
2384
2385 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2386
2387 dnl Modified MPLS controller action.
2388 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2389
2390 for i in 1 2 3; do
2391 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=16,tos=0,ttl=64,frag=no)'
2392 done
2393 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2394 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2395
2396 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2397 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2398 mpls,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
2399 dnl
2400 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2401 mpls,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
2402 dnl
2403 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2404 mpls,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
2405 ])
2406
2407 dnl Modified MPLS actions.
2408 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2409
2410 for i in 1 2 3; do
2411 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)'
2412 done
2413 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2414 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2415
2416 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2417 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
2418 mpls,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
2419 dnl
2420 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
2421 mpls,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
2422 dnl
2423 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
2424 mpls,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
2425 ])
2426
2427 dnl Modified MPLS ipv6 controller action.
2428 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2429
2430 for i in 1 2 3; do
2431 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)'
2432 done
2433 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2434 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2435
2436 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2437 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2438 mplsm,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=128,mpls_bos=1
2439 dnl
2440 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2441 mplsm,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=128,mpls_bos=1
2442 dnl
2443 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2444 mplsm,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=128,mpls_bos=1
2445 ])
2446
2447
2448 dnl Modified MPLS pop action.
2449 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
2450 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)
2451 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
2452
2453 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2454
2455 for i in 1 2 3; do
2456 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'
2457 done
2458 #for i in 2 3; do
2459 # 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)'
2460 #done
2461 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2462 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2463
2464 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2465 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2466 tcp,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_flags=0 tcp_csum:7744
2467 dnl
2468 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2469 tcp,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_flags=0 tcp_csum:7744
2470 dnl
2471 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2472 tcp,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_flags=0 tcp_csum:7744
2473 ])
2474
2475 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2476
2477 dnl Modified MPLS pop action.
2478 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2479 dnl 60:66:66:66:00:01 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2480 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2481 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2482 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2483
2484 for i in 1 2 3; do
2485 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 01 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
2486 done
2487 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2488 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2489
2490 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2491 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2492 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,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=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2493 dnl
2494 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2495 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,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=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2496 dnl
2497 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2498 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,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=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2499 ])
2500
2501 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2502
2503 dnl Modified MPLS pop action.
2504 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2505 dnl 60:66:66:66:00:02 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2506 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2507 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2508 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2509
2510 for i in 1 2 3; do
2511 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 02 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
2512 done
2513 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2514 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2515
2516 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2517 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2518 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2519 dnl
2520 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2521 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2522 dnl
2523 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2524 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2525 ])
2526
2527 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2528
2529 dnl Modified MPLS pop action.
2530 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2531 dnl 60:66:66:66:00:03 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2532 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2533 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2534 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2535
2536 for i in 1 2 3; do
2537 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 03 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
2538 done
2539 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2540 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2541
2542 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2543 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2544 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2545 dnl
2546 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2547 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2548 dnl
2549 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2550 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2551 ])
2552
2553 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2554
2555 dnl Modified MPLS pop action.
2556 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2557 dnl 60:66:66:66:00:04 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2558 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2559 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2560 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2561
2562 for i in 1 2 3; do
2563 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 04 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
2564 done
2565 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2566 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2567
2568 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2569 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2570 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2571 dnl
2572 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2573 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2574 dnl
2575 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2576 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2577 ])
2578
2579 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2580
2581 dnl Modified MPLS pop action.
2582 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2583 dnl 60:66:66:66:00:05 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2584 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2585 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2586 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2587
2588 for i in 1 2 3; do
2589 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 05 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
2590 done
2591 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2592 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2593
2594 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2595 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2596 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2597 dnl
2598 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2599 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2600 dnl
2601 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2602 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2603 ])
2604
2605 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2606
2607 dnl Modified MPLS pop action.
2608 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2609 dnl 60:66:66:66:00:06 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2610 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2611 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2612 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2613
2614 for i in 1 2 3; do
2615 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 06 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
2616 done
2617 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2618 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2619
2620 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2621 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2622 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2623 dnl
2624 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2625 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2626 dnl
2627 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2628 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2629 ])
2630
2631 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2632
2633 dnl Modified MPLS pop action.
2634 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2635 dnl 60:66:66:66:00:07 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2636 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2637 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2638 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2639
2640 for i in 1 2 3; do
2641 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 07 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
2642 done
2643 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2644 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2645
2646 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2647 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2648 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2649 dnl
2650 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2651 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2652 dnl
2653 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2654 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2655 ])
2656
2657 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2658
2659 dnl Modified MPLS pop action.
2660 dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2661 dnl 60:66:66:66:00:08 > ff:ff:ff:ff:ff:ff, ethertype MPLS unicast (0x8847), length 46: MPLS (label 20, exp 0, [S], ttl 32)
2662 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2663
2664 for i in 1 2 3; do
2665 ovs-appctl netdev-dummy/receive p1 'ff ff ff ff ff ff 60 66 66 66 00 08 88 47 00 01 41 20 00 01 08 00 06 04 00 02 60 66 66 66 00 08 c0 a8 00 01 ff ff ff ff ff ff ff ff ff ff'
2666 done
2667 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2668 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2669
2670 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2671 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2672 arp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
2673 dnl
2674 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2675 arp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
2676 dnl
2677 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2678 arp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
2679 ])
2680
2681 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2682
2683 dnl Modified MPLS pop action.
2684 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2685 dnl 60:66:66:66:00:09 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2686 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2687 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2688 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2689
2690 for i in 1 2 3; do
2691 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 09 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
2692 done
2693 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2694 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2695
2696 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2697 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2698 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2699 dnl
2700 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2701 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2702 dnl
2703 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2704 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2705 ])
2706
2707 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2708
2709 dnl Modified MPLS pop action.
2710 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2711 dnl 60:66:66:66:00:0a > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2712 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2713 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2714 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2715
2716 for i in 1 2 3; do
2717 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 0a 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
2718 done
2719 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2720 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2721
2722 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2723 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2724 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2725 dnl
2726 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2727 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2728 dnl
2729 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2730 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2731 ])
2732
2733 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2734
2735 dnl Modified MPLS pop action.
2736 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2737 dnl 60:66:66:66:00:0b > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2738 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2739 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2740 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2741
2742 for i in 1 2 3; do
2743 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 0b 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
2744 done
2745 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2746 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2747
2748 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2749 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2750 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
2751 dnl
2752 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2753 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
2754 dnl
2755 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2756 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
2757 ])
2758
2759 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2760
2761 dnl Modified MPLS pop action.
2762 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2763 dnl 60:66:66:66:01:00 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2764 dnl (label 20, exp 0, [S], ttl 31)
2765 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2766 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2767 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2768
2769 for i in 1 2 3; do
2770 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 01 00 88 48 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 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'
2771 done
2772 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2773 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2774
2775 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2776 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2777 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2778 dnl
2779 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2780 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2781 dnl
2782 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2783 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2784 ])
2785
2786 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2787
2788 dnl Modified MPLS pop action.
2789 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2790 dnl 60:66:66:66:01:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2791 dnl (label 20, exp 0, [S], ttl 31)
2792 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2793 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2794 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2795
2796 for i in 1 2 3; do
2797 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 01 01 88 47 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 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'
2798 done
2799 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2800 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2801
2802 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2803 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2804 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2805 dnl
2806 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2807 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2808 dnl
2809 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2810 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2811 ])
2812
2813 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2814
2815 dnl Modified MPLS pop action.
2816 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2817 dnl 60:66:66:66:01:02 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2818 dnl (label 20, exp 0, [S], ttl 31)
2819 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2820 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2821 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2822
2823 for i in 1 2 3; do
2824 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 01 02 88 48 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 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'
2825 done
2826 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2827 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2828
2829 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2830 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2831 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
2832 dnl
2833 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2834 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
2835 dnl
2836 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2837 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
2838 ])
2839
2840 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2841
2842 dnl Modified MPLS pop action.
2843 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2844 dnl 60:66:66:66:02:00 > 50:54:00:00:02:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2845 dnl (label 20, exp 0, [S], ttl 31)
2846 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2847 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2848 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2849
2850 for i in 1 2 3; do
2851 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 02 00 88 47 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 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'
2852 done
2853 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2854 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2855
2856 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2857 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2858 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2859 dnl
2860 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2861 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2862 dnl
2863 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2864 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2865 ])
2866
2867 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2868
2869 dnl Modified MPLS pop action.
2870 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2871 dnl 60:66:66:66:02:01 > 50:54:00:00:02:01, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2872 dnl (label 20, exp 0, [S], ttl 31)
2873 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2874 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2875 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2876
2877 for i in 1 2 3; do
2878 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 02 01 88 48 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 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'
2879 done
2880
2881 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2882 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2883
2884 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2885 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2886 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,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=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2887 dnl
2888 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2889 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,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=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2890 dnl
2891 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2892 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,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=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2893 ])
2894
2895 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2896
2897 dnl Modified MPLS pop action.
2898 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2899 dnl 60:66:66:66:02:10 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2900 dnl (label 20, exp 0, [S], ttl 31)
2901 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2902 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2903 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2904
2905 for i in 1 2 3; do
2906 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 02 10 88 47 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 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'
2907 done
2908 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2909 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2910
2911 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2912 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2913 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,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=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2914 dnl
2915 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2916 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,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=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2917 dnl
2918 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2919 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,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=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2920 ])
2921
2922 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2923
2924 dnl Modified MPLS pop action.
2925 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2926 dnl 60:66:66:66:03:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2927 dnl (label 20, exp 0, ttl 31)
2928 dnl (label 20, exp 0, [S], ttl 30)
2929 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2930 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2931 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2932
2933 for i in 1 2 3; do
2934 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 00 88 47 00 01 40 20 00 01 40 1f 00 01 41 1e 45 00 00 2c 00 00 00 00 ff 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'
2935 done
2936 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2937 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2938
2939 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2940 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2941 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2942 dnl
2943 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2944 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2945 dnl
2946 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2947 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2948 ])
2949
2950 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2951
2952 dnl Modified MPLS pop action.
2953 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2954 dnl 60:66:66:66:03:01 > 50:54:00:00:00:00, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2955 dnl (label 20, exp 0, ttl 31)
2956 dnl (label 20, exp 0, [S], ttl 30)
2957 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2958 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2959 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2960
2961 for i in 1 2 3; do
2962 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 01 88 48 00 01 40 20 00 01 40 1f 00 01 41 1e 45 00 00 2c 00 00 00 00 ff 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'
2963 done
2964 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2965 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2966
2967 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2968 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2969 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2970 dnl
2971 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2972 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2973 dnl
2974 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2975 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2976 ])
2977
2978 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2979
2980 dnl Modified MPLS pop action.
2981 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2982 dnl 60:66:66:66:03:10 > 50:54:00:00:00:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2983 dnl (label 20, exp 0, ttl 31)
2984 dnl (label 20, exp 0, [S], ttl 30)
2985 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2986 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2987 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2988
2989 for i in 1 2 3; do
2990 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 10 88 47 00 01 40 20 00 01 40 1f 00 01 41 1e 45 00 00 2c 00 00 00 00 ff 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'
2991 done
2992 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2993 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2994
2995 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2996 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2997 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2998 dnl
2999 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3000 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
3001 dnl
3002 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3003 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
3004 ])
3005
3006 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3007
3008 dnl Modified MPLS pop action.
3009 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3010 dnl 60:66:66:66:04:00 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
3011 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3012 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
3013 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3014
3015 for i in 1 2 3; do
3016 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 04 00 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
3017 done
3018 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3019 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3020
3021 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
3022 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3023 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
3024 dnl
3025 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3026 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
3027 dnl
3028 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3029 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
3030 ])
3031
3032 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3033
3034 dnl Modified MPLS pop action.
3035 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3036 dnl 60:66:66:66:04:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
3037 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3038 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
3039 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3040
3041 for i in 1 2 3; do
3042 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 04 01 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
3043 done
3044 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3045 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3046
3047 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
3048 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3049 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
3050 dnl
3051 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3052 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
3053 dnl
3054 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3055 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
3056 ])
3057
3058 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3059
3060 dnl Modified MPLS pop action.
3061 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3062 dnl 60:66:66:66:04:10 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
3063 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3064 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
3065 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3066
3067 for i in 1 2 3; do
3068 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 04 10 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
3069 done
3070 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3071 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3072
3073 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
3074 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3075 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
3076 dnl
3077 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3078 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
3079 dnl
3080 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3081 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
3082 ])
3083
3084 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3085
3086 dnl Modified MPLS pop action.
3087 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3088 dnl 60:66:66:66:05:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
3089 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3090 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
3091 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3092
3093 for i in 1 2 3; do
3094 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 05 00 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
3095 done
3096
3097 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3098 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3099
3100 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3101 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3102 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
3103 dnl
3104 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3105 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
3106 dnl
3107 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3108 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
3109 ])
3110
3111 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3112
3113 dnl Modified MPLS pop action.
3114 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3115 dnl 60:66:66:66:05:01 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
3116 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3117 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
3118 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3119
3120 for i in 1 2 3; do
3121 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 05 01 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
3122 done
3123 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3124 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3125
3126 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3127 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3128 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
3129 dnl
3130 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3131 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
3132 dnl
3133 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3134 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
3135 ])
3136
3137 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3138
3139 dnl Modified MPLS pop action.
3140 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3141 dnl 60:66:66:66:05:10 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
3142 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3143 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
3144 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3145
3146 for i in 1 2 3; do
3147 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 05 10 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 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'
3148 done
3149
3150 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3151 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3152
3153 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3154 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3155 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
3156 dnl
3157 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3158 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
3159 dnl
3160 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3161 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
3162 ])
3163
3164 AT_CHECK([ovs-appctl revalidator/purge], [0])
3165 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3166 cookie=0x5, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,CONTROLLER:65535
3167 cookie=0x5, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
3168 cookie=0x5, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,CONTROLLER:65535
3169 cookie=0xa, n_packets=3, n_bytes=102, 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
3170 cookie=0xa, n_packets=3, n_bytes=102, 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
3171 cookie=0xa, n_packets=3, n_bytes=102, 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
3172 cookie=0xa, n_packets=3, n_bytes=102, 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
3173 cookie=0xa, n_packets=3, n_bytes=102, 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
3174 cookie=0xa, n_packets=3, n_bytes=114, 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
3175 cookie=0xa, n_packets=3, n_bytes=318, 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
3176 cookie=0xa, n_packets=3, n_bytes=54, 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
3177 cookie=0xa, n_packets=3, n_bytes=54, mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
3178 cookie=0xb, n_packets=3, n_bytes=54, mpls,dl_src=50:55:55:55:55:55 actions=load:0x3e8->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
3179 cookie=0xc, n_packets=3, n_bytes=162, 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
3180 cookie=0xd, n_packets=3, n_bytes=138, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
3181 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
3182 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->NXM_OF_IP_DST[[]],CONTROLLER:65535
3183 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:NXM_OF_IP_DST[[]]->NXM_OF_IP_SRC[[]],CONTROLLER:65535
3184 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:NXM_OF_IP_DST[[]],pop:NXM_OF_IP_SRC[[]],CONTROLLER:65535
3185 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,1,0,NXM_OF_IP_SRC[[0..7]]),CONTROLLER:65535
3186 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,NXM_OF_IP_SRC[[0..15]],members:1,2),CONTROLLER:65535
3187 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,NXM_OF_IP_SRC[[]]=NXM_OF_IP_DST[[]]),CONTROLLER:65535
3188 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
3189 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,CONTROLLER:65535
3190 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,CONTROLLER:65535
3191 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
3192 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
3193 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,CONTROLLER:65535
3194 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
3195 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,CONTROLLER:65535
3196 cookie=0xd, table=1, n_packets=3, n_bytes=126, arp actions=CONTROLLER:65535
3197 cookie=0xdeadbeef, table=2, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
3198 cookie=0xe, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
3199 cookie=0xe, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
3200 cookie=0xe, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,CONTROLLER:65535
3201 cookie=0xe, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,CONTROLLER:65535
3202 cookie=0xe, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
3203 cookie=0xf, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,CONTROLLER:65535
3204 cookie=0xf, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
3205 cookie=0xf, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
3206 NXST_FLOW reply:
3207 ])
3208
3209 OVS_VSWITCHD_STOP
3210 AT_CLEANUP
3211
3212 AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
3213 OVS_VSWITCHD_START([dnl
3214 add-port br0 p1 -- set Interface p1 type=dummy
3215 ])
3216 on_exit 'kill `cat ovs-ofctl.pid`'
3217
3218 AT_CAPTURE_FILE([ofctl_monitor.log])
3219 AT_DATA([flows.txt], [dnl
3220 table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
3221 table=1 ip,ip_dscp=8 actions=controller
3222 ])
3223 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
3224
3225
3226 dnl Modified MPLS pop action.
3227 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3228 dnl 60:66:66:66:00:08 > 50:54:00:00:00:01, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
3229 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3230 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
3231 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3232
3233 for i in 1 2 3; do
3234 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 01 60 66 66 66 00 08 88 48 00 01 41 20 45 20 00 2c 00 00 00 00 ff 06 3a 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'
3235 done
3236 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3237 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3238
3239 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
3240 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3241 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3242 dnl
3243 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3244 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3245 dnl
3246 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3247 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3248 ])
3249
3250 AT_CHECK([ovs-appctl revalidator/purge], [0])
3251 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3252 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
3253 table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
3254 OFPST_FLOW reply (OF1.2):
3255 ])
3256
3257 OVS_VSWITCHD_STOP
3258 AT_CLEANUP
3259
3260 AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
3261 OVS_VSWITCHD_START([dnl
3262 add-port br0 p1 -- set Interface p1 type=dummy
3263 ])
3264 on_exit 'kill `cat ovs-ofctl.pid`'
3265
3266 dnl N.B: The first (and only) action that accesses L3 data after the
3267 dnl pop_mpls action is present in write_actions. This exercises recirculation
3268 dnl triggered in write_actions due to a previous action not in write actions.
3269 AT_CAPTURE_FILE([ofctl_monitor.log])
3270 AT_DATA([flows.txt], [dnl
3271 mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
3272 ])
3273 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
3274
3275 dnl Modified MPLS pop action.
3276 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3277 dnl 60:66:66:66:00:08 > 50:54:00:00:00:01, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
3278 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3279 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
3280 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3281
3282 for i in 1 2 3; do
3283 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 01 60 66 66 66 00 08 88 48 00 01 41 20 45 20 00 2c 00 00 00 00 ff 06 3a 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'
3284 done
3285 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3286 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3287
3288 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
3289 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3290 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3291 dnl
3292 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3293 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3294 dnl
3295 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3296 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3297 ])
3298
3299 AT_CHECK([ovs-appctl revalidator/purge], [0])
3300 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3301 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
3302 OFPST_FLOW reply (OF1.2):
3303 ])
3304
3305 OVS_VSWITCHD_STOP
3306 AT_CLEANUP
3307
3308 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
3309 OVS_VSWITCHD_START([dnl
3310 add-port br0 p1 -- set Interface p1 type=dummy
3311 ])
3312 on_exit 'kill `cat ovs-ofctl.pid`'
3313
3314 AT_CAPTURE_FILE([ofctl_monitor.log])
3315 # A table-miss flow has priority 0 and no match
3316 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3317
3318 dnl Singleton controller action.
3319 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3320
3321 for i in 1 2 3 ; do
3322 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),tcp_flags(0x002)'
3323 done
3324 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3325 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3326
3327 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3328 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3329 tcp,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_flags=syn tcp_csum:2e7d
3330 dnl
3331 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3332 tcp,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_flags=syn tcp_csum:2e7d
3333 dnl
3334 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3335 tcp,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_flags=syn tcp_csum:2e7d
3336 ])
3337
3338 AT_CHECK([ovs-appctl revalidator/purge], [0])
3339 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3340 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3341 NXST_FLOW reply:
3342 ])
3343
3344 OVS_VSWITCHD_STOP
3345 AT_CLEANUP
3346
3347
3348 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
3349 OVS_VSWITCHD_START([dnl
3350 add-port br0 p1 -- set Interface p1 type=dummy
3351 ])
3352 on_exit 'kill `cat ovs-ofctl.pid`'
3353
3354 AT_CAPTURE_FILE([ofctl_monitor.log])
3355 # A table-miss flow has priority 0 and no match
3356 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3357
3358 dnl Singleton controller action.
3359 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3360
3361 for i in 1 2 3 ; do
3362 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),tcp_flags(0x002)'
3363 done
3364 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3365 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3366
3367 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3368
3369 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3370 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3371 tcp,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_flags=syn tcp_csum:2e7d
3372 dnl
3373 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3374 tcp,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_flags=syn tcp_csum:2e7d
3375 dnl
3376 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3377 tcp,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_flags=syn tcp_csum:2e7d
3378 ])
3379
3380 AT_CHECK([ovs-appctl revalidator/purge], [0])
3381 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3382 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3383 OFPST_FLOW reply (OF1.3):
3384 ])
3385
3386 OVS_VSWITCHD_STOP
3387 AT_CLEANUP
3388
3389 AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
3390 OVS_VSWITCHD_START([dnl
3391 add-port br0 p1 -- set Interface p1 type=dummy
3392 ])
3393 on_exit 'kill `cat ovs-ofctl.pid`'
3394
3395 ovs-appctl time/stop
3396
3397 AT_CAPTURE_FILE([ofctl_monitor.log])
3398 # A table-miss flow has priority 0 and no match
3399 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3400
3401 dnl Singleton controller action.
3402 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3403
3404 # Become secondary (OF 1.3), which should disable everything except port status.
3405 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3406
3407 # Ensure that ovs-vswitchd gets a chance to reply before sending another command.
3408 ovs-appctl time/warp 500 100
3409
3410 # Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for secondary only.
3411 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
3412
3413 ovs-appctl time/warp 500 100
3414 for i in 1 2 3 ; do
3415 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),tcp_flags(0x002)'
3416 done
3417 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3418 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3419
3420 AT_CHECK([ovs-appctl revalidator/purge], [0])
3421 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3422 send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=secondary generation_id=1
3423 OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=secondary generation_id=1
3424 dnl
3425 send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
3426 primary:
3427 PACKET_IN: (off)
3428 PORT_STATUS: (off)
3429 FLOW_REMOVED: (off)
3430 ROLE_STATUS: (off)
3431 TABLE_STATUS: (off)
3432 REQUESTFORWARD: (off)
3433
3434 secondary:
3435 PACKET_IN: no_match
3436 PORT_STATUS: (off)
3437 FLOW_REMOVED: (off)
3438 ROLE_STATUS: (off)
3439 TABLE_STATUS: (off)
3440 REQUESTFORWARD: (off)
3441 dnl
3442 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3443 tcp,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_flags=syn tcp_csum:2e7d
3444 dnl
3445 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3446 tcp,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_flags=syn tcp_csum:2e7d
3447 dnl
3448 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3449 tcp,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_flags=syn tcp_csum:2e7d
3450 ])
3451
3452 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3453
3454 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3455 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3456 OFPST_FLOW reply (OF1.3):
3457 ])
3458
3459 OVS_VSWITCHD_STOP
3460 AT_CLEANUP
3461
3462
3463 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
3464 OVS_VSWITCHD_START([dnl
3465 add-port br0 p1 -- set Interface p1 type=dummy
3466 ])
3467 on_exit 'kill `cat ovs-ofctl.pid`'
3468
3469 AT_CAPTURE_FILE([ofctl_monitor.log])
3470 # A table-miss flow has priority 0 and no match
3471 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3472
3473 dnl Singleton controller action.
3474 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3475
3476 for i in 1 2 3 ; do
3477 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),tcp_flags(0x002)'
3478 done
3479 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3480 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3481
3482 AT_CHECK([ovs-appctl revalidator/purge], [0])
3483 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3484 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3485 tcp,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_flags=syn tcp_csum:2e7d
3486 dnl
3487 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3488 tcp,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_flags=syn tcp_csum:2e7d
3489 dnl
3490 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3491 tcp,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_flags=syn tcp_csum:2e7d
3492 ])
3493
3494 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3495
3496 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3497 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3498 OFPST_FLOW reply (OF1.4):
3499 ])
3500
3501 OVS_VSWITCHD_STOP
3502 AT_CLEANUP
3503
3504
3505 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3506 OVS_VSWITCHD_START([dnl
3507 add-port br0 p1 -- set Interface p1 type=dummy
3508 ])
3509 on_exit 'kill `cat ovs-ofctl.pid`'
3510
3511 AT_CAPTURE_FILE([ofctl_monitor.log])
3512 AT_DATA([flows.txt], [dnl
3513 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3514 table=1 actions=output(CONTROLLER),goto_table(2)
3515 table=2 actions=group:1234
3516 ])
3517 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3518 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3519
3520 dnl Singleton controller action.
3521 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3522
3523 for i in 1 2 3 ; do
3524 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),tcp_flags(0x002)'
3525 done
3526 AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3527 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
3528 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3529
3530 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3531
3532 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3533 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3534 tcp,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_flags=syn tcp_csum:2e7d
3535 dnl
3536 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3537 tcp,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_flags=syn tcp_csum:2e7d
3538 dnl
3539 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3540 tcp,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_flags=syn tcp_csum:2e7d
3541 dnl
3542 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3543 tcp,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_flags=syn tcp_csum:2e7d
3544 dnl
3545 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3546 tcp,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_flags=syn tcp_csum:2e7d
3547 dnl
3548 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3549 tcp,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_flags=syn tcp_csum:2e7d
3550 dnl
3551 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3552 tcp,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_flags=syn tcp_csum:2e7d
3553 dnl
3554 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3555 tcp,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_flags=syn tcp_csum:2e7d
3556 dnl
3557 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3558 tcp,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_flags=syn tcp_csum:2e7d
3559 dnl
3560 OFPT_PACKET_IN (OF1.3) (xid=0x0): total_len=54 in_port=ANY (via action) data_len=54 (unbuffered)
3561 tcp,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_flags=syn tcp_csum:2e7d
3562 ])
3563
3564 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3565
3566 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3567 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3568 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3569 table=2, n_packets=3, n_bytes=162, actions=group:1234
3570 OFPST_FLOW reply (OF1.3):
3571 ])
3572
3573 OVS_VSWITCHD_STOP
3574 AT_CLEANUP
3575
3576
3577 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3578 OVS_VSWITCHD_START([dnl
3579 add-port br0 p1 -- set Interface p1 type=dummy
3580 ])
3581 on_exit 'kill `cat ovs-ofctl.pid`'
3582
3583 AT_CAPTURE_FILE([ofctl_monitor.log])
3584 AT_DATA([flows.txt], [dnl
3585 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3586 table=1 actions=output(CONTROLLER),goto_table(2)
3587 table=2 actions=group:1234
3588 ])
3589 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3590 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3591
3592 dnl Singleton controller action.
3593 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3594
3595 for i in 1 2 3 ; do
3596 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),tcp_flags(0x002)'
3597 done
3598 AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3599 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
3600 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3601
3602 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3603
3604 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3605 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3606 tcp,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_flags=syn tcp_csum:2e7d
3607 dnl
3608 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3609 tcp,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_flags=syn tcp_csum:2e7d
3610 dnl
3611 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3612 tcp,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_flags=syn tcp_csum:2e7d
3613 dnl
3614 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3615 tcp,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_flags=syn tcp_csum:2e7d
3616 dnl
3617 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3618 tcp,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_flags=syn tcp_csum:2e7d
3619 dnl
3620 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3621 tcp,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_flags=syn tcp_csum:2e7d
3622 dnl
3623 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3624 tcp,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_flags=syn tcp_csum:2e7d
3625 dnl
3626 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3627 tcp,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_flags=syn tcp_csum:2e7d
3628 dnl
3629 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3630 tcp,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_flags=syn tcp_csum:2e7d
3631 dnl
3632 OFPT_PACKET_IN (OF1.4) (xid=0x0): total_len=54 in_port=ANY (via packet_out) data_len=54 (unbuffered)
3633 tcp,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_flags=syn tcp_csum:2e7d
3634 ])
3635
3636 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3637
3638 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3639 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3640 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3641 table=2, n_packets=3, n_bytes=162, actions=group:1234
3642 OFPST_FLOW reply (OF1.4):
3643 ])
3644
3645 OVS_VSWITCHD_STOP
3646 AT_CLEANUP
3647
3648 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3649
3650 OVS_VSWITCHD_START([dnl
3651 set bridge br0 datapath_type=dummy \
3652 protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
3653 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
3654
3655 AT_CHECK([
3656 ovs-ofctl -OOpenFlow13 del-flows br0
3657 ovs-ofctl -OOpenFlow13 add-group br0 "group_id=6000,type=all,bucket=actions=controller,bucket=actions=resubmit(,48),bucket=actions=resubmit(,81)"
3658 ovs-ofctl -OOpenFlow13 add-flow br0 "table=0, in_port=1, vlan_tci=0x0000/0x1fff actions=write_metadata:0x67870000000000/0xffffff0000000001,goto_table:17"
3659 ovs-ofctl -OOpenFlow13 add-flow br0 "table=17, priority=10,metadata=0x67870000000000/0xffffff0000000000 actions=write_metadata:0xe067870000000000/0xfffffffffffffffe,goto_table:60"
3660 ovs-ofctl -OOpenFlow13 add-flow br0 "table=60, priority=0 actions=resubmit(,17)"
3661 ovs-ofctl -OOpenFlow13 add-flow br0 "table=17, priority=10,metadata=0xe067870000000000/0xffffff0000000000 actions=write_metadata:0x67871d4d000000/0xfffffffffffffffe,goto_table:43"
3662 ovs-ofctl -OOpenFlow13 add-flow br0 "table=43, priority=100,icmp actions=group:6000"
3663 ovs-ofctl -OOpenFlow13 add-flow br0 "table=48, priority=0 actions=resubmit(,49),resubmit(,50)"
3664 ovs-ofctl -OOpenFlow13 add-flow br0 "table=50, priority=0 actions=controller"
3665 ], [0], [ignore])
3666
3667 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3668
3669 AT_CHECK([
3670 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
3671 ], [0], [ignore])
3672
3673 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
3674 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3675
3676 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3677 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=43 cookie=0x0 total_len=98 metadata=0x67871d4d000000,in_port=1 (via action) data_len=98 (unbuffered)
3678 icmp,vlan_tci=0x0000,dl_src=3a:6d:d2:09:9c:ab,dl_dst=1e:2c:e9:2a:66:9e,nw_src=192.168.10.10,nw_dst=192.168.10.30,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:6f20
3679 dnl
3680 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=50 cookie=0x0 total_len=98 metadata=0x67871d4d000000,in_port=1 (via no_match) data_len=98 (unbuffered)
3681 icmp,vlan_tci=0x0000,dl_src=3a:6d:d2:09:9c:ab,dl_dst=1e:2c:e9:2a:66:9e,nw_src=192.168.10.10,nw_dst=192.168.10.30,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:6f20
3682 ])
3683
3684 OVS_VSWITCHD_STOP
3685 AT_CLEANUP
3686
3687 AT_SETUP([ofproto-dpif - ARP modification slow-path])
3688 OVS_VSWITCHD_START
3689 add_of_ports br0 1 2
3690
3691 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3692 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'
3693
3694 # Input some packets that should follow the arp modification slow-path.
3695 for i in 1 2 3; do
3696 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)'
3697 done
3698 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3699
3700 # Check the packets that were output.
3701 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
3702 arp,in_port=ANY,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
3703 arp,in_port=ANY,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
3704 arp,in_port=ANY,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
3705 arp,in_port=ANY,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
3706 arp,in_port=ANY,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
3707 arp,in_port=ANY,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
3708 arp,in_port=ANY,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
3709 arp,in_port=ANY,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
3710 arp,in_port=ANY,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
3711 ])
3712
3713 OVS_VSWITCHD_STOP
3714 AT_CLEANUP
3715
3716 AT_SETUP([ofproto-dpif - VLAN handling])
3717 OVS_VSWITCHD_START(
3718 [set Bridge br0 fail-mode=standalone -- \
3719 add-port br0 p1 trunks=10,12 -- \
3720 add-port br0 p2 tag=10 -- \
3721 add-port br0 p3 tag=12 \
3722 other-config:priority-tags=if-nonzero -- \
3723 add-port br0 p4 tag=12 -- \
3724 add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
3725 add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
3726 add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
3727 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
3728 other-config:priority-tags=if-nonzero -- \
3729 add-port br0 p9 vlan_mode=dot1q-tunnel tag=10 other-config:qinq-ethtype=802.1q -- \
3730 add-port br0 p10 vlan_mode=dot1q-tunnel tag=10 cvlans=10,12 other-config:qinq-ethtype=802.1q -- \
3731 add-port br0 p11 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q -- \
3732 add-port br0 p12 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q \
3733 other-config:priority-tags=if-nonzero -- \
3734 set Interface p1 type=dummy -- \
3735 set Interface p2 type=dummy -- \
3736 set Interface p3 type=dummy -- \
3737 set Interface p4 type=dummy -- \
3738 set Interface p5 type=dummy -- \
3739 set Interface p6 type=dummy -- \
3740 set Interface p7 type=dummy -- \
3741 set Interface p8 type=dummy -- \
3742 set Interface p9 type=dummy -- \
3743 set Interface p10 type=dummy -- \
3744 set Interface p11 type=dummy -- \
3745 set Interface p12 type=dummy --])
3746
3747 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3748 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
3749 dnl actions.
3750 for tuple in \
3751 "100 none 0 drop" \
3752 "100 0 0 drop" \
3753 "100 0 1 drop" \
3754 "100 10 0 1,5,6,7,8,pop_vlan,2,9" \
3755 "100 10 1 1,5,6,7,8,pop_vlan,2,9" \
3756 "100 11 0 5,7" \
3757 "100 11 1 5,7" \
3758 "100 12 0 1,5,6,pop_vlan,3,4,7,8,11,12" \
3759 "100 12 1 1,5,6,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3760 "1 none 0 drop" \
3761 "1 0 0 drop" \
3762 "1 0 1 drop" \
3763 "1 10 0 5,6,7,8,100,pop_vlan,2,9" \
3764 "1 10 1 5,6,7,8,100,pop_vlan,2,9" \
3765 "1 11 0 drop" \
3766 "1 11 1 drop" \
3767 "1 12 0 5,6,100,pop_vlan,3,4,7,8,11,12" \
3768 "1 12 1 5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3769 "2 none 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3770 "2 0 0 pop_vlan,9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3771 "2 0 1 pop_vlan,9,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
3772 "2 10 0 drop" \
3773 "2 10 1 drop" \
3774 "2 11 0 drop" \
3775 "2 11 1 drop" \
3776 "2 12 0 drop" \
3777 "2 12 1 drop" \
3778 "3 none 0 4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3779 "3 0 0 pop_vlan,4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3780 "3 0 1 8,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3781 "3 10 0 drop" \
3782 "3 10 1 drop" \
3783 "3 11 0 drop" \
3784 "3 11 1 drop" \
3785 "3 12 0 drop" \
3786 "3 12 1 drop" \
3787 "4 none 0 3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3788 "4 0 0 pop_vlan,3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3789 "4 0 1 3,8,12,pop_vlan,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3790 "4 10 0 drop" \
3791 "4 10 1 drop" \
3792 "4 11 0 drop" \
3793 "4 11 1 drop" \
3794 "4 12 0 drop" \
3795 "4 12 1 drop" \
3796 "5 none 0 2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3797 "5 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3798 "5 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3799 "5 10 0 1,6,7,8,100,pop_vlan,2,9" \
3800 "5 10 1 1,6,7,8,100,pop_vlan,2,9" \
3801 "5 11 0 7,100" \
3802 "5 11 1 7,100" \
3803 "5 12 0 1,6,100,pop_vlan,3,4,7,8,11,12" \
3804 "5 12 1 1,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3805 "6 none 0 2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3806 "6 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3807 "6 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3808 "6 10 0 1,5,7,8,100,pop_vlan,2,9" \
3809 "6 10 1 1,5,7,8,100,pop_vlan,2,9" \
3810 "6 11 0 drop" \
3811 "6 11 1 drop" \
3812 "6 12 0 1,5,100,pop_vlan,3,4,7,8,11,12" \
3813 "6 12 1 1,5,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3814 "7 none 0 3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3815 "7 0 0 pop_vlan,3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3816 "7 0 1 3,8,12,pop_vlan,4,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3817 "7 10 0 1,5,6,8,100,pop_vlan,2,9" \
3818 "7 10 1 1,5,6,8,100,pop_vlan,2,9" \
3819 "7 11 0 5,100" \
3820 "7 11 1 5,100" \
3821 "7 12 0 1,5,6,100,pop_vlan,3,4,8,11,12" \
3822 "7 12 1 1,5,6,100,pop_vlan,4,11,push_vlan(vid=0,pcp=1),3,8,12" \
3823 "8 none 0 3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3824 "8 0 0 pop_vlan,3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3825 "8 0 1 3,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3826 "8 10 0 1,5,6,7,100,pop_vlan,2,9" \
3827 "8 10 1 1,5,6,7,100,pop_vlan,2,9" \
3828 "8 11 0 drop" \
3829 "8 11 1 drop" \
3830 "8 12 0 1,5,6,100,pop_vlan,3,4,7,11,12" \
3831 "8 12 1 1,5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,12" \
3832 "9 none 0 2,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3833 "9 10 0 10,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3834 "9 11 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3835 "10 none 0 drop" \
3836 "10 0 0 drop" \
3837 "10 11 0 drop" \
3838 "10 12 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3839 "11 10 0 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3840 "11 10 1 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100"
3841 do
3842 set $tuple
3843 in_port=$1
3844 vlan=$2
3845 pcp=$3
3846 expected=$4
3847
3848 if test $vlan = none; then
3849 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
3850 else
3851 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))"
3852 fi
3853
3854 echo "----------------------------------------------------------------------"
3855 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3856
3857 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3858 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
3859
3860 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
3861 mv stdout expout
3862 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
3863 done
3864
3865 OVS_VSWITCHD_STOP
3866 AT_CLEANUP
3867
3868 AT_SETUP([ofproto-dpif - VLAN depth limit])
3869 OVS_VSWITCHD_START([dnl
3870 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3871 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
3872 add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3
3873 ])
3874
3875 AT_DATA([flows.txt], [dnl
3876 table=0 in_port=1,eth_type=0x8100,vlan_tci=0x0010/0x01ff actions=output:2
3877 table=0 in_port=1,eth_type=0xabcd,vlan_tci=0x0010/0x01ff actions=output:3
3878 ])
3879 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3880 flow="in_port(1),eth(src=00:11:22:33:44:55,dst=00:22:44:66:88:00),eth_type(0x8100),vlan(vid=16,pcp=0), \
3881 encap(eth_type(0x8100),vlan(vid=17,pcp=0),encap(eth_type(0xabcd)))"
3882
3883 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3884 AT_CHECK([tail -1 stdout], [0],
3885 [Datapath actions: 2
3886 ])
3887
3888 AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3889 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3890 AT_CHECK([tail -1 stdout], [0],
3891 [Datapath actions: 3
3892 ])
3893
3894 OVS_VSWITCHD_STOP
3895 AT_CLEANUP
3896
3897 AT_SETUP([ofproto-dpif - Multi-VLAN actions])
3898 OVS_VSWITCHD_START([dnl
3899 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3900 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2
3901 ])
3902 AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3903
3904 AT_DATA([flows.txt], [dnl
3905 table=0 in_port=1,vlan_tci=0x1100/0x1fff actions=pop_vlan,output:2
3906 table=0 in_port=1,vlan_tci=0x1101/0x1fff actions=push_vlan:0x8100,set_field:0x1201/0x1fff->vlan_tci,output:2
3907 table=0 in_port=1,vlan_tci=0x1102/0x1fff actions=push_vlan:0x88a8,set_field:0x1202/0x1fff->vlan_tci,output:2
3908 table=0 in_port=1,vlan_tci=0x1103/0x1fff actions=set_field:0x1203/0x1fff->vlan_tci,output:2
3909 table=0 in_port=1,vlan_tci=0x1104/0x1fff actions=pop_vlan,goto_table:1
3910 table=1 vlan_tci=0 actions=output:2
3911 table=1 vlan_tci=0x1300/0x1fff actions=pop_vlan,output:2
3912 table=1 vlan_tci=0x1301/0x1fff actions=push_vlan:0x88a8,set_field:0x1401/0x1fff->vlan_tci,output:2
3913 table=1 vlan_tci=0x1302/0x1fff actions=set_field:0x1402/0x1fff->vlan_tci,output:2
3914 ])
3915
3916 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3917
3918 check_act() {
3919 psd_hdr="in_port(1),eth(src=00:11:22:33:44:55,dst=00:22:44:66:88:00),"
3920 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$psd_hdr$1"], [0], [stdout])
3921 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $2
3922 ])
3923 }
3924
3925 check_act "eth_type(0x8100),vlan(vid=0x0100,pcp=0),encap(eth_type(0xabcd))" \
3926 "pop_vlan,2"
3927
3928 check_act "eth_type(0x8100),vlan(vid=0x0101,pcp=0),encap(eth_type(0xabcd))" \
3929 "push_vlan(vid=513,pcp=0),2"
3930
3931 check_act "eth_type(0x8100),vlan(vid=0x0102,pcp=0),encap(eth_type(0xabcd))" \
3932 "push_vlan(tpid=0x88a8,vid=514,pcp=0),2"
3933
3934 check_act "eth_type(0x8100),vlan(vid=0x0103,pcp=0),encap(eth_type(0xabcd))" \
3935 "pop_vlan,push_vlan(vid=515,pcp=0),2"
3936
3937 check_act "eth_type(0x8100),vlan(vid=0x0104,pcp=0),encap(eth_type(0xabcd))" \
3938 "pop_vlan,2"
3939
3940 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3941 vlan(vid=0x0300,pcp=0),encap(eth_type(0xabcd)))" "pop_vlan,pop_vlan,2"
3942
3943 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3944 vlan(vid=0x0301,pcp=0),encap(eth_type(0xabcd)))" \
3945 "pop_vlan,push_vlan(tpid=0x88a8,vid=1025,pcp=0),2"
3946
3947 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3948 vlan(vid=0x0302,pcp=0),encap(eth_type(0xabcd)))" \
3949 "pop_vlan,pop_vlan,push_vlan(vid=1026,pcp=0),2"
3950
3951 OVS_VSWITCHD_STOP
3952 AT_CLEANUP
3953
3954 AT_SETUP([ofproto-dpif - MPLS handling])
3955 OVS_VSWITCHD_START([dnl
3956 add-port br0 p1 -- set Interface p1 type=dummy
3957 ])
3958 on_exit 'kill `cat ovs-ofctl.pid`'
3959
3960 AT_CAPTURE_FILE([ofctl_monitor.log])
3961 AT_DATA([flows.txt], [dnl
3962 dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
3963 dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
3964 dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
3965 ])
3966 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3967
3968 dnl In this test, we push an MPLS tag to an ethernet packet.
3969 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3970
3971 for i in 1 2 3; do
3972 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:00:00,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)'
3973 done
3974 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3975 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3976
3977 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3978 OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
3979 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3980 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3981 00000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
3982 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3983 00000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
3984 00000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
3985 00000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
3986 00000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
3987 00000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3988 OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
3989 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3990 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3991 00000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
3992 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3993 00000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
3994 00000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
3995 00000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
3996 00000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
3997 00000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3998 OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
3999 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4000 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
4001 00000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
4002 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
4003 00000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
4004 00000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
4005 00000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
4006 00000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
4007 00000070 36 37 38 39 3a 3b 3c 3d-3e 3f
4008 ])
4009
4010 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
4011 dnl copied exactly, except for the BOS bit.
4012 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4013
4014 for i in 1 2 3; do
4015 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:00:01,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=10,tc=0,ttl=64,bos=1)'
4016 done
4017 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4018 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4019
4020 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4021 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
4022 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:01,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
4023 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
4024 00000010 a0 40 00 00 a1 40
4025 dnl
4026 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
4027 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:01,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
4028 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
4029 00000010 a0 40 00 00 a1 40
4030 dnl
4031 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
4032 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:01,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
4033 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
4034 00000010 a0 40 00 00 a1 40
4035 ])
4036
4037 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
4038 dnl copied exactly, except for the BOS bit. The ethertype should be updated
4039 dnl to the MPLS ethertype of the MPLS push action which differs to that
4040 dnl of the input packet.
4041 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4042
4043 for i in 1 2 3; do
4044 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:00:02,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=10,tc=0,ttl=64,bos=1)'
4045 done
4046 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4047 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4048
4049 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4050 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
4051 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:00:02,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
4052 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
4053 00000010 a0 40 00 00 a1 40
4054 dnl
4055 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
4056 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:00:02,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
4057 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
4058 00000010 a0 40 00 00 a1 40
4059 dnl
4060 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
4061 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:00:02,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
4062 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
4063 00000010 a0 40 00 00 a1 40
4064 ])
4065
4066 OVS_VSWITCHD_STOP
4067 AT_CLEANUP
4068
4069 AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
4070 OVS_VSWITCHD_START([dnl
4071 add-port br0 p1 -- set Interface p1 type=dummy
4072 ])
4073 on_exit 'kill `cat ovs-ofctl.pid`'
4074
4075 AT_CAPTURE_FILE([ofctl_monitor.log])
4076 AT_DATA([flows.txt], [dnl
4077 cookie=0xa dl_src=40:44:44:44:54:50 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,controller
4078 cookie=0xa dl_src=40:44:44:44:54:51 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,controller
4079 cookie=0xa dl_src=40:44:44:44:54:52 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,controller
4080 cookie=0xa dl_src=40:44:44:44:54:53 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,controller
4081 cookie=0xa dl_src=40:44:44:44:54:54 actions=push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller
4082 cookie=0xa dl_src=40:44:44:44:54:55 actions=push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller
4083 cookie=0xa dl_src=40:44:44:44:54:56 actions=push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller
4084 cookie=0xa dl_src=40:44:44:44:54:57 actions=push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller
4085 cookie=0xa dl_src=40:44:44:44:54:58,vlan_tci=0x1000/0x1000 actions=load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller
4086 cookie=0xa dl_src=40:44:44:44:54:59,vlan_tci=0x1000/0x1000 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],set_vlan_pcp:1,load:99->OXM_OF_VLAN_VID[[]],controller
4087 ])
4088 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
4089
4090 dnl Modified MPLS controller action.
4091 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
4092 dnl both of these in the final flow
4093 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4094
4095 for i in 1 2 3; do
4096 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:50,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)'
4097 done
4098 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4099 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4100
4101 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4102 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4103 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4104 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
4105 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4106 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4107 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4108 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4109 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4110 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4111 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4112 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4113 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4114 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
4115 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4116 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4117 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4118 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4119 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4120 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4121 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4122 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4123 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4124 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
4125 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4126 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4127 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4128 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4129 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4130 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4131 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4132 ])
4133
4134 dnl Modified MPLS controller action.
4135 dnl In this test, the input packet is vlan-tagged, which should be kept as
4136 dnl inner vlan.
4137 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4138
4139 for i in 1 2 3; do
4140 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:51,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,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))'
4141 done
4142 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4143 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4144
4145 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4146 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4147 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4148 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
4149 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4150 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4151 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4152 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4153 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4154 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4155 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4156 00000080 3e 3f
4157 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4158 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4159 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
4160 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4161 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4162 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4163 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4164 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4165 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4166 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4167 00000080 3e 3f
4168 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4169 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4170 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
4171 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4172 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4173 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4174 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4175 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4176 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4177 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4178 00000080 3e 3f
4179 ])
4180
4181 dnl Modified MPLS controller action.
4182 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
4183 dnl both of these in the final flow
4184 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4185
4186 for i in 1 2 3; do
4187 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:52,dst=52: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)'
4188 done
4189 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4190 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4191
4192 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4193 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4194 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4195 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
4196 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4197 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4198 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4199 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4200 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4201 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4202 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4203 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4204 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4205 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
4206 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4207 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4208 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4209 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4210 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4211 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4212 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4213 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4214 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4215 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
4216 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4217 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4218 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4219 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4220 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4221 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4222 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4223 ])
4224
4225 dnl Modified MPLS controller action.
4226 dnl In this test, the input packet is vlan-tagged, which should be kept as
4227 dnl inner vlan.
4228 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4229
4230 for i in 1 2 3; do
4231 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:53,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,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))'
4232 done
4233 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4234 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4235
4236 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4237 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4238 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4239 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
4240 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4241 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4242 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4243 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4244 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4245 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4246 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4247 00000080 3e 3f
4248 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4249 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4250 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
4251 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4252 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4253 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4254 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4255 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4256 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4257 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4258 00000080 3e 3f
4259 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4260 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4261 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
4262 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4263 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4264 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4265 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4266 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4267 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4268 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4269 00000080 3e 3f
4270 ])
4271
4272 dnl Modified MPLS controller action.
4273 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
4274 dnl actions are reordered, so we see both of these in the final flow.
4275 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4276
4277 for i in 1 2 3; do
4278 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:54,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)'
4279 done
4280 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4281 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4282
4283 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4284 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4285 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4286 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
4287 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4288 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4289 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4290 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4291 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4292 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4293 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4294 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4295 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4296 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
4297 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4298 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4299 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4300 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4301 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4302 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4303 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4304 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4305 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4306 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
4307 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4308 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4309 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4310 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4311 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4312 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4313 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4314 ])
4315
4316 dnl Modified MPLS controller action.
4317 dnl In this test, the input packet is vlan-tagged, which should be kept as
4318 dnl inner vlan.
4319 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4320
4321 for i in 1 2 3; do
4322 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:55,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,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))'
4323 done
4324 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4325 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4326
4327 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4328 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4329 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4330 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
4331 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4332 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4333 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4334 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4335 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4336 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4337 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4338 00000080 3e 3f
4339 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4340 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4341 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
4342 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4343 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4344 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4345 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4346 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4347 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4348 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4349 00000080 3e 3f
4350 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4351 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4352 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
4353 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4354 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4355 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4356 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4357 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4358 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4359 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4360 00000080 3e 3f
4361 ])
4362
4363 dnl Modified MPLS controller action.
4364 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
4365 dnl actions are reordered, so we see both of these in the final flow.
4366 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4367
4368 for i in 1 2 3; do
4369 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:56,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)'
4370 done
4371 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4372 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4373
4374 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4375 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4376 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4377 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
4378 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4379 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4380 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4381 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4382 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4383 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4384 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4385 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4386 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4387 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
4388 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4389 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4390 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4391 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4392 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4393 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4394 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4395 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4396 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4397 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
4398 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4399 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4400 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4401 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4402 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4403 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4404 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4405 ])
4406
4407 dnl Modified MPLS controller action.
4408 dnl In this test, the input packet is vlan-tagged, which should be kept as
4409 dnl inner vlan.
4410 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4411
4412 for i in 1 2 3; do
4413 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:57,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,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))'
4414 done
4415 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4416 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4417
4418 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4419 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4420 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4421 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
4422 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4423 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4424 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4425 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4426 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4427 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4428 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4429 00000080 3e 3f
4430 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4431 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4432 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
4433 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4434 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4435 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4436 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4437 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4438 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4439 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4440 00000080 3e 3f
4441 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4442 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4443 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
4444 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4445 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4446 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4447 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4448 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4449 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4450 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4451 00000080 3e 3f
4452 ])
4453
4454 dnl Modified MPLS controller action.
4455 dnl In this test, the input packet is vlan-tagged, which should be kept as
4456 dnl inner vlan.
4457 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4458
4459 for i in 1 2 3; do
4460 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:58,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,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))'
4461 done
4462 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4463 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4464
4465 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4466 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4467 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4468 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
4469 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4470 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4471 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4472 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4473 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4474 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4475 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4476 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4477 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4478 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
4479 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4480 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4481 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4482 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4483 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4484 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4485 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4486 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4487 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4488 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
4489 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4490 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4491 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4492 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4493 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4494 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4495 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4496 ])
4497
4498 dnl Modified MPLS controller action.
4499 dnl In this test, the input packet is vlan-tagged, which should be modified
4500 dnl before we push MPLS and VLAN tags.
4501 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4502
4503 for i in 1 2 3; do
4504 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:59,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,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))'
4505 done
4506 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4507 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4508
4509 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4510 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4511 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4512 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
4513 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4514 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4515 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4516 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4517 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4518 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4519 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4520 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4521 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4522 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
4523 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4524 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4525 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4526 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4527 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4528 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4529 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4530 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4531 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4532 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
4533 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4534 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4535 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4536 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4537 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4538 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4539 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4540 ])
4541
4542 AT_CHECK([ovs-appctl revalidator/purge], [0])
4543 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
4544 cookie=0xa, n_packets=3, n_bytes=354, dl_src=40:44:44:44:54:50 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,CONTROLLER:65535
4545 cookie=0xa, n_packets=3, n_bytes=354, dl_src=40:44:44:44:54:52 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,CONTROLLER:65535
4546 cookie=0xa, n_packets=3, n_bytes=354, dl_src=40:44:44:44:54:54 actions=push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
4547 cookie=0xa, n_packets=3, n_bytes=354, dl_src=40:44:44:44:54:56 actions=push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
4548 cookie=0xa, n_packets=3, n_bytes=366, dl_src=40:44:44:44:54:51 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,CONTROLLER:65535
4549 cookie=0xa, n_packets=3, n_bytes=366, dl_src=40:44:44:44:54:53 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,CONTROLLER:65535
4550 cookie=0xa, n_packets=3, n_bytes=366, dl_src=40:44:44:44:54:55 actions=push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
4551 cookie=0xa, n_packets=3, n_bytes=366, dl_src=40:44:44:44:54:57 actions=push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
4552 cookie=0xa, n_packets=3, n_bytes=366, vlan_tci=0x1000/0x1000,dl_src=40:44:44:44:54:58 actions=load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
4553 cookie=0xa, n_packets=3, n_bytes=366, vlan_tci=0x1000/0x1000,dl_src=40:44:44:44:54:59 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],set_field:1->vlan_pcp,load:0x63->OXM_OF_VLAN_VID[[]],CONTROLLER:65535
4554 OFPST_FLOW reply (OF1.2):
4555 ])
4556
4557 OVS_VSWITCHD_STOP
4558 AT_CLEANUP
4559
4560 AT_SETUP([ofproto-dpif - fragment handling - trace])
4561 OVS_VSWITCHD_START
4562 add_of_ports br0 1 2 3 4 5 6 90
4563 AT_DATA([flows.txt], [dnl
4564 priority=75 tcp nw_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
4565 priority=75 tcp nw_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
4566 priority=50 tcp nw_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
4567 priority=50 tcp nw_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
4568 priority=50 tcp nw_frag=later actions=output:6
4569 ])
4570 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4571
4572 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"
4573 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4574 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4575 later_flow="$base_flow,frag=later)"
4576
4577 # mode no first later
4578 for tuple in \
4579 'normal 1 5 6' \
4580 'drop 1 drop drop' \
4581 'nx-match 1 2 6'
4582 do
4583 set $tuple
4584 mode=$1
4585 no=$2
4586 first=$3
4587 later=$4
4588
4589 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4590 for type in no first later; do
4591 eval flow=\$${type}_flow exp_output=\$$type
4592 printf "\n%s\n" "----$mode $type-----"
4593 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4594 : > expout
4595 if test $mode = drop && test $type != no; then
4596 echo ' 0. Packets are IP fragments and the fragment handling mode is "drop".' >> expout
4597 echo "Datapath actions: $exp_output" >> expout
4598 elif test $type = later; then
4599 echo "Datapath actions: $exp_output" >> expout
4600 else
4601 echo "Datapath actions: set(tcp(src=80)),$exp_output" >> expout
4602 fi
4603 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
4604 done
4605 done
4606 OVS_VSWITCHD_STOP
4607 AT_CLEANUP
4608
4609 AT_SETUP([ofproto-dpif - fragment handling - upcall])
4610 OVS_VSWITCHD_START
4611 add_of_ports br0 1 2 3 4 5 6 90
4612 AT_DATA([flows.txt], [dnl
4613 priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
4614 priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
4615 priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
4616 priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
4617 priority=50 tcp ip_frag=later actions=output:6
4618 ])
4619 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4620
4621 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"
4622 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4623 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4624 later_flow="$base_flow,frag=later)"
4625
4626 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4627
4628 mode=normal
4629
4630 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4631 for type in no first later; do
4632 eval flow=\$${type}_flow
4633 printf "\n%s\n" "----$mode $type-----"
4634
4635 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4636 done
4637
4638 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4639 flow-dump from the main thread:
4640 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4641 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),5
4642 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4643 ])
4644
4645 mode=drop
4646
4647 AT_CHECK([ovs-appctl revalidator/purge], [0])
4648 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4649 for type in no first later; do
4650 eval flow=\$${type}_flow
4651 printf "\n%s\n" "----$mode $type-----"
4652
4653 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4654 done
4655
4656 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4657 flow-dump from the main thread:
4658 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4659 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
4660 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
4661 ])
4662
4663 mode=nx-match
4664
4665 AT_CHECK([ovs-appctl revalidator/purge], [0])
4666 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4667 for type in no first later; do
4668 eval flow=\$${type}_flow
4669 printf "\n%s\n" "----$mode $type-----"
4670
4671 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4672 done
4673
4674 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4675 flow-dump from the main thread:
4676 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4677 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),2
4678 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4679 ])
4680
4681 OVS_VSWITCHD_STOP
4682 AT_CLEANUP
4683
4684 AT_SETUP([ofproto-dpif - fragment handling - actions])
4685 OVS_VSWITCHD_START
4686 add_of_ports br0 1 2 3 4 5 6 90
4687
4688 AT_CHECK([ovs-ofctl add-flow br0 "tcp,ip_frag=later actions=move:OXM_OF_TCP_DST[[0..7]]->OXM_OF_TCP_SRC[[0..7]],output:1"], [1], [], [stderr])
4689 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4690 source field tcp_dst lacks correct prerequisites
4691 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4692 ])
4693
4694 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 "tcp,ip_frag=later actions=move:OXM_OF_PKT_REG0[[0..7]]->OXM_OF_TCP_SRC[[0..7]],output:1"], [1], [], [stderr])
4695 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4696 destination field tcp_src lacks correct prerequisites
4697 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4698 ])
4699
4700 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
4701 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4702 set_field udp_src lacks correct prerequisites
4703 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4704 ])
4705
4706 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
4707 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4708 set_field udp_dst lacks correct prerequisites
4709 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4710 ])
4711
4712 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
4713 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4714 set_field sctp_src lacks correct prerequisites
4715 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4716 ])
4717
4718 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
4719 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4720 set_field sctp_dst lacks correct prerequisites
4721 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4722 ])
4723
4724 AT_CHECK([ovs-ofctl add-flow br0 "tcp,ip_frag=later actions=learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,NXM_OF_IP_SRC[[]]=NXM_OF_IP_DST[[]],NXM_OF_TCP_SRC[[]]=NXM_OF_TCP_DST[[]],output:NXM_NX_REG0[[0..15]]),output:1"], [1], [], [stderr])
4725 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4726 source field tcp_dst lacks correct prerequisites
4727 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4728 ])
4729
4730 AT_DATA([flows.txt], [dnl
4731 priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
4732 ])
4733 AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
4734
4735 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4736
4737 mode=normal
4738
4739 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4740 for frag in 4000 6000 6008 4010; do
4741 printf "\n%s\n" "----$mode $frag-----"
4742
4743 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 003c 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016 751e267b 00000000 a002 16d0 1736 0000 02 04 05 b4 04 02 08 0a 2d 25 08 5f 00 00 00 00 01 03 03 07"])
4744 done
4745
4746 dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
4747 dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
4748 dnl OVS-2.5, the wildcards and set_field mask are shared internally.
4749 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4750 flow-dump from the main thread:
4751 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4752 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4753 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
4754 ])
4755
4756 AT_CHECK([ovs-appctl revalidator/purge], [0])
4757 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4758 for frag in 4000 6000 6008 4010; do
4759 printf "\n%s\n" "----$mode $frag truncated transport header -----"
4760
4761 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
4762 done
4763
4764 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4765 flow-dump from the main thread:
4766 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4767 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4768 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:38, used:0.001s, actions:1
4769 ])
4770
4771 AT_CHECK([ovs-appctl revalidator/purge], [0])
4772 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4773 for frag in 4000 6000 6001 4002; do
4774 printf "\n%s\n" "----$mode $frag missing transport header-----"
4775
4776 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
4777 done
4778
4779 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4780 flow-dump from the main thread:
4781 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4782 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4783 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:34, used:0.001s, actions:1
4784 ])
4785
4786 OVS_VSWITCHD_STOP
4787 AT_CLEANUP
4788
4789 AT_SETUP([ofproto-dpif - exit])
4790 OVS_VSWITCHD_START
4791 add_of_ports br0 1 2 3 10 11 12 13 14
4792 AT_DATA([flows.txt], [dnl
4793 in_port=1 actions=output:10,exit,output:11
4794 in_port=2 actions=output:12,resubmit:1,output:12
4795 in_port=3 actions=output:13,resubmit:2,output:14
4796 ])
4797 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4798 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])
4799 AT_CHECK([tail -1 stdout], [0],
4800 [Datapath actions: 10
4801 ])
4802 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])
4803 AT_CHECK([tail -1 stdout], [0],
4804 [Datapath actions: 12,10
4805 ])
4806 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])
4807 AT_CHECK([tail -1 stdout], [0],
4808 [Datapath actions: 13,12,10
4809 ])
4810 OVS_VSWITCHD_STOP
4811 AT_CLEANUP
4812
4813
4814 AT_SETUP([ofproto-dpif - mirroring, select_all])
4815 AT_KEYWORDS([mirror mirrors mirroring])
4816 OVS_VSWITCHD_START
4817 add_of_ports br0 1 2 3
4818 ovs-vsctl \
4819 set Bridge br0 mirrors=@m --\
4820 --id=@p3 get Port p3 --\
4821 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4822
4823 AT_DATA([flows.txt], [dnl
4824 in_port=1 actions=output:2
4825 in_port=2 actions=output:1
4826 ])
4827 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4828
4829 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)"
4830 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4831 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4832 [Datapath actions: 3,2
4833 ])
4834
4835 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)"
4836 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4837 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4838 [Datapath actions: 3,1
4839 ])
4840
4841 OVS_VSWITCHD_STOP
4842 AT_CLEANUP
4843
4844
4845 AT_SETUP([ofproto-dpif - mirroring, select_src])
4846 AT_KEYWORDS([mirror mirrors mirroring])
4847 OVS_VSWITCHD_START
4848 add_of_ports br0 1 2 3
4849 ovs-vsctl \
4850 set Bridge br0 mirrors=@m --\
4851 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4852 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
4853
4854 AT_DATA([flows.txt], [dnl
4855 in_port=1 actions=output:2
4856 in_port=2 actions=output:1
4857 ])
4858 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4859
4860 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)"
4861 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4862 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4863 [Datapath actions: 3,2
4864 ])
4865
4866 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)"
4867 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4868 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4869 [Datapath actions: 1
4870 ])
4871 OVS_VSWITCHD_STOP
4872 AT_CLEANUP
4873
4874 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
4875 AT_KEYWORDS([mirror mirrors mirroring])
4876 OVS_VSWITCHD_START
4877 add_of_ports br0 1 2
4878 ovs-vsctl \
4879 set Bridge br0 mirrors=@m --\
4880 --id=@p2 get Port p2 --\
4881 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
4882
4883 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4884
4885 # "in_port" defaults to OFPP_NONE if it's not specified.
4886 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"
4887 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4888 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4889 [Datapath actions: 1,2
4890 ])
4891
4892 OVS_VSWITCHD_STOP
4893 AT_CLEANUP
4894
4895
4896 AT_SETUP([ofproto-dpif - mirroring, select_dst])
4897 AT_KEYWORDS([mirror mirrors mirroring])
4898 OVS_VSWITCHD_START
4899 add_of_ports br0 1 2 3
4900 ovs-vsctl \
4901 set Bridge br0 mirrors=@m --\
4902 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4903 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
4904
4905 AT_DATA([flows.txt], [dnl
4906 in_port=1 actions=output:2
4907 in_port=2 actions=output:1
4908 ])
4909 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4910
4911 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)"
4912 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4913 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4914 [Datapath actions: 2,3
4915 ])
4916
4917 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)"
4918 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4919 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4920 [Datapath actions: 1
4921 ])
4922
4923 OVS_VSWITCHD_STOP
4924 AT_CLEANUP
4925
4926
4927 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
4928 AT_KEYWORDS([mirror mirrors mirroring])
4929 OVS_VSWITCHD_START
4930 add_of_ports br0 1 2 3
4931 ovs-vsctl \
4932 set Bridge br0 mirrors=@m --\
4933 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4934 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
4935
4936 AT_DATA([flows.txt], [dnl
4937 in_port=1, actions=output:2
4938 ])
4939 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4940
4941 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)"
4942 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4943 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4944 [Datapath actions: 2
4945 ])
4946
4947 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))"
4948 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4949 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4950 [Datapath actions: 2
4951 ])
4952
4953 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))"
4954 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4955 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4956 [Datapath actions: 3,2
4957 ])
4958
4959 OVS_VSWITCHD_STOP
4960 AT_CLEANUP
4961
4962
4963 AT_SETUP([ofproto-dpif - mirroring, output_port])
4964 AT_KEYWORDS([mirror mirrors mirroring])
4965 OVS_VSWITCHD_START
4966 add_of_ports br0 1 2 3
4967 ovs-vsctl \
4968 set Bridge br0 mirrors=@m --\
4969 --id=@p3 get Port p3 --\
4970 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4971
4972 AT_DATA([flows.txt], [dnl
4973 in_port=1 actions=mod_vlan_vid:17,output:2
4974 in_port=2 actions=output:1
4975 ])
4976 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4977
4978 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)"
4979 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4980 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4981 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
4982 ])
4983
4984 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)"
4985 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4986 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4987 [Datapath actions: 3,1
4988 ])
4989
4990 OVS_VSWITCHD_STOP
4991 AT_CLEANUP
4992
4993 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
4994 AT_KEYWORDS([mirror mirrors mirroring])
4995 OVS_VSWITCHD_START
4996 add_of_ports br0 1 2
4997 ovs-vsctl \
4998 set Bridge br0 mirrors=@m --\
4999 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
5000
5001 AT_DATA([flows.txt], [dnl
5002 in_port=1 actions=output:2
5003 in_port=2 actions=mod_vlan_vid:17,output:1
5004 ])
5005 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5006
5007 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)"
5008 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5009 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5010
5011 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
5012 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
5013 mv stdout expout
5014 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
5015
5016 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)"
5017 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5018 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5019
5020 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
5021 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
5022 mv stdout expout
5023 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
5024
5025 OVS_VSWITCHD_STOP
5026 AT_CLEANUP
5027
5028 # This verifies that we don't get duplicate mirroring when mirror_packet()
5029 # might be invoked recursively, as a check against regression.
5030 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
5031 AT_KEYWORDS([mirror mirrors mirroring])
5032 OVS_VSWITCHD_START
5033 add_of_ports br0 1 2 3
5034 ovs-vsctl \
5035 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
5036 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
5037 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
5038 -- set Port br0 tag=0 \
5039 -- set Port p1 tag=0 \
5040 -- set Port p2 tag=500 \
5041 -- set Port p3 tag=501
5042
5043 flow='in_port=1'
5044 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
5045 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
5046 s/,/\
5047 /g' | sort], [0], [100
5048 2
5049 3
5050 ])
5051
5052 OVS_VSWITCHD_STOP
5053 AT_CLEANUP
5054
5055 # This test verifies that mirror state is preserved across recirculation.
5056 #
5057 # Otherwise, post-recirculation the ingress and the output to port 4
5058 # would cause the packet to be mirrored to port 3 a second time.
5059 AT_SETUP([ofproto-dpif - mirroring with recirculation])
5060 AT_KEYWORDS([mirror mirrors mirroring])
5061 OVS_VSWITCHD_START
5062 add_of_ports br0 1 2 3 4
5063 ovs-vsctl \
5064 set Bridge br0 mirrors=@m --\
5065 --id=@p3 get Port p3 --\
5066 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
5067
5068 AT_DATA([flows.txt], [dnl
5069 in_port=1 actions=2,debug_recirc,4
5070 ])
5071 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5072
5073 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)"
5074 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5075 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
5076 ])
5077 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5078 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
5079 ])
5080
5081 OVS_VSWITCHD_STOP
5082 AT_CLEANUP
5083
5084 # Tests below verify the snaplen support for mirroring
5085 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen])
5086 AT_KEYWORDS([mirror mirrors mirroring])
5087 OVS_VSWITCHD_START
5088 add_of_ports br0 1 2 3
5089 ovs-vsctl \
5090 set Bridge br0 mirrors=@m --\
5091 --id=@p3 get Port p3 --\
5092 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
5093
5094 AT_DATA([flows.txt], [dnl
5095 in_port=1 actions=output:2
5096 in_port=2 actions=output:1
5097 ])
5098 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5099
5100 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)"
5101 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5102 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5103 [Datapath actions: trunc(100),3,2
5104 ])
5105
5106 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)"
5107 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5108 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5109 [Datapath actions: trunc(100),3,1
5110 ])
5111
5112 OVS_VSWITCHD_STOP
5113 AT_CLEANUP
5114
5115 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen and reset snaplen])
5116 AT_KEYWORDS([mirror mirrors mirroring])
5117 OVS_VSWITCHD_START
5118 add_of_ports br0 1 2 3
5119 ovs-vsctl \
5120 set Bridge br0 mirrors=@m --\
5121 --id=@p3 get Port p3 --\
5122 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
5123
5124 AT_DATA([flows.txt], [dnl
5125 in_port=1 actions=output:2
5126 in_port=2 actions=output:1
5127 ])
5128 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5129
5130 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)"
5131 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5132 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5133 [Datapath actions: trunc(100),3,2
5134 ])
5135
5136 ovs-vsctl set mirror mymirror snaplen=77
5137
5138 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)"
5139 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5140 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5141 [Datapath actions: trunc(77),3,1
5142 ])
5143
5144 ovs-vsctl set mirror mymirror snaplen=65535
5145
5146 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)"
5147 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5148 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5149 [Datapath actions: 3,1
5150 ])
5151
5152 OVS_VSWITCHD_STOP
5153 AT_CLEANUP
5154
5155 AT_SETUP([ofproto-dpif - mirroring, select_src with snaplen])
5156 AT_KEYWORDS([mirror mirrors mirroring])
5157 OVS_VSWITCHD_START
5158 add_of_ports br0 1 2 3
5159 ovs-vsctl \
5160 set Bridge br0 mirrors=@m --\
5161 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
5162 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3 snaplen=100
5163
5164 AT_DATA([flows.txt], [dnl
5165 in_port=1 actions=output:2
5166 in_port=2 actions=output:1
5167 ])
5168 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5169
5170 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)"
5171 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5172 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5173 [Datapath actions: trunc(100),3,2
5174 ])
5175
5176 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)"
5177 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5178 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5179 [Datapath actions: 1
5180 ])
5181 OVS_VSWITCHD_STOP
5182 AT_CLEANUP
5183
5184 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port with snaplen])
5185 AT_KEYWORDS([mirror mirrors mirroring])
5186 OVS_VSWITCHD_START
5187 add_of_ports br0 1 2
5188 ovs-vsctl \
5189 set Bridge br0 mirrors=@m --\
5190 --id=@p2 get Port p2 --\
5191 --id=@m create Mirror name=mymirror select_all=true output_port=@p2 snaplen=100
5192
5193 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
5194
5195 # "in_port" defaults to OFPP_NONE if it's not specified.
5196 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"
5197 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
5198 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5199 [Datapath actions: 1,trunc(100),2
5200 ])
5201
5202 OVS_VSWITCHD_STOP
5203 AT_CLEANUP
5204
5205 AT_SETUP([ofproto-dpif - mirroring, select_dst with snaplen])
5206 AT_KEYWORDS([mirror mirrors mirroring])
5207 OVS_VSWITCHD_START
5208 add_of_ports br0 1 2 3
5209 ovs-vsctl \
5210 set Bridge br0 mirrors=@m --\
5211 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
5212 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3 snaplen=100
5213
5214 AT_DATA([flows.txt], [dnl
5215 in_port=1 actions=output:2
5216 in_port=2 actions=output:1
5217 ])
5218 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5219
5220 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)"
5221 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5222 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5223 [Datapath actions: 2,trunc(100),3
5224 ])
5225
5226 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)"
5227 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5228 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5229 [Datapath actions: 1
5230 ])
5231
5232 OVS_VSWITCHD_STOP
5233 AT_CLEANUP
5234
5235 AT_SETUP([ofproto-dpif - mirroring, select_vlan with snaplen])
5236 AT_KEYWORDS([mirror mirrors mirroring])
5237 OVS_VSWITCHD_START
5238 add_of_ports br0 1 2 3
5239 ovs-vsctl \
5240 set Bridge br0 mirrors=@m --\
5241 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
5242 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3 snaplen=100
5243
5244 AT_DATA([flows.txt], [dnl
5245 in_port=1, actions=output:2
5246 ])
5247 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5248
5249 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)"
5250 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5251 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5252 [Datapath actions: 2
5253 ])
5254
5255 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))"
5256 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5257 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5258 [Datapath actions: 2
5259 ])
5260
5261 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))"
5262 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5263 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5264 [Datapath actions: trunc(100),3,2
5265 ])
5266
5267 OVS_VSWITCHD_STOP
5268 AT_CLEANUP
5269
5270 AT_SETUP([ofproto-dpif - mirroring, output_port with snaplen])
5271 AT_KEYWORDS([mirror mirrors mirroring])
5272 OVS_VSWITCHD_START
5273 add_of_ports br0 1 2 3
5274 ovs-vsctl \
5275 set Bridge br0 mirrors=@m --\
5276 --id=@p3 get Port p3 --\
5277 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
5278
5279 AT_DATA([flows.txt], [dnl
5280 in_port=1 actions=mod_vlan_vid:17,output:2
5281 in_port=2 actions=output:1
5282 ])
5283 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5284
5285 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)"
5286 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5287 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5288 [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2
5289 ])
5290
5291 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)"
5292 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5293 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5294 [Datapath actions: trunc(100),3,1
5295 ])
5296
5297 OVS_VSWITCHD_STOP
5298 AT_CLEANUP
5299
5300 AT_SETUP([ofproto-dpif - mirroring, output_vlan with snaplen])
5301 AT_KEYWORDS([mirror mirrors mirroring])
5302 OVS_VSWITCHD_START
5303 add_of_ports br0 1 2
5304 ovs-vsctl \
5305 set Bridge br0 mirrors=@m --\
5306 --id=@m create Mirror name=mymirror select_all=true output_vlan=12 snaplen=100
5307
5308 AT_DATA([flows.txt], [dnl
5309 in_port=1 actions=output:2
5310 in_port=2 actions=mod_vlan_vid:17,output:1
5311 ])
5312 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5313
5314 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)"
5315 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5316 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5317 dnl Expect: "trunc(100),100,trunc(100),2,trunc(100),1", with different order
5318 AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
5319
5320 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)"
5321 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5322 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5323 AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
5324
5325 OVS_VSWITCHD_STOP
5326 AT_CLEANUP
5327
5328 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors with snaplen])
5329 AT_KEYWORDS([mirror mirrors mirroring])
5330 OVS_VSWITCHD_START
5331 add_of_ports br0 1 2 3
5332 ovs-vsctl \
5333 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
5334 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 snaplen=200 \
5335 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 snaplen=300 \
5336 -- set Port br0 tag=0 \
5337 -- set Port p1 tag=0 \
5338 -- set Port p2 tag=500 \
5339 -- set Port p3 tag=501
5340
5341 flow="in_port=1"
5342 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
5343 AT_CHECK([tail -1 stdout | egrep "trunc\(200\),2,trunc\(300\),3,100|trunc\(300\),3,trunc\(200\),2,100"], [0], [stdout])
5344
5345 OVS_VSWITCHD_STOP
5346 AT_CLEANUP
5347
5348 # This test verifies that the table ID is preserved across recirculation
5349 # when a resubmit action requires it (because the action is relative to
5350 # the current table rather than specifying a table).
5351 AT_SETUP([ofproto-dpif - resubmit with recirculation])
5352 OVS_VSWITCHD_START
5353 add_of_ports br0 1 2 3
5354
5355 AT_DATA([flows.txt], [dnl
5356 table=0 in_port=1 actions=2,resubmit(,1)
5357 table=1 in_port=1 actions=debug_recirc,resubmit:55
5358 table=1 in_port=55 actions=3
5359 ])
5360 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5361
5362 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)"
5363 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5364 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
5365 ])
5366 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5367 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
5368 ])
5369
5370 OVS_VSWITCHD_STOP
5371 AT_CLEANUP
5372
5373
5374 # This test verifies that tunnel metadata is preserved across
5375 # recirculation. At the time of recirculation, fields such as "tun_id"
5376 # may be set before the tunnel is "valid" (ie, has a destination
5377 # address), but the field should still be available after recirculation.
5378 AT_SETUP([ofproto-dpif - resubmit with tun_id])
5379 OVS_VSWITCHD_START
5380 add_of_ports br0 1 2 3
5381
5382 AT_DATA([flows.txt], [dnl
5383 table=0 in_port=1 actions=2,load:6->NXM_NX_TUN_ID[[]],resubmit(,1)
5384 table=1 in_port=1 actions=debug_recirc,resubmit:55
5385 table=1 in_port=55 actions=3
5386 ])
5387 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5388
5389 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)"
5390 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5391 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: icmp,tun_id=0x6,in_port=1,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=128,icmp_type=8,icmp_code=0
5392 ])
5393
5394 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5395 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: recirc_id=0x1,eth,icmp,tun_id=0x6,in_port=1,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=128,icmp_type=8,icmp_code=0
5396 ])
5397
5398 OVS_VSWITCHD_STOP
5399 AT_CLEANUP
5400
5401
5402 # This test verifies that "resubmit", when it triggers recirculation
5403 # indirectly through the flow that it recursively invokes, is not
5404 # re-executed when execution continues later post-recirculation.
5405 AT_SETUP([ofproto-dpif - recirculation after resubmit])
5406 OVS_VSWITCHD_START
5407 add_of_ports br0 1 2
5408
5409 AT_DATA([flows.txt], [dnl
5410 table=0 in_port=1 actions=resubmit(,1),2
5411 table=1 in_port=1 actions=debug_recirc
5412 ])
5413 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5414
5415 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)"
5416 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5417 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
5418 ])
5419 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5420 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
5421 ])
5422
5423 OVS_VSWITCHD_STOP
5424 AT_CLEANUP
5425
5426 # Checks for regression against a bug in which OVS dropped packets
5427 # with in_port=CONTROLLER when they were recirculated (because
5428 # CONTROLLER isn't a real port and could not be looked up).
5429 AT_SETUP([ofproto-dpif - packet-out recirculation])
5430 OVS_VSWITCHD_START
5431 add_of_ports br0 1 2
5432
5433 AT_DATA([flows.txt], [dnl
5434 table=0 ip actions=mod_dl_dst:83:83:83:83:83:83,ct(table=1)
5435 table=1 ip actions=ct(commit),output:2
5436 ])
5437 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5438
5439 packet=ffffffffffff00102030405008004500001c00000000401100000a000002ffffffff0035111100080000
5440 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=$packet actions=table"])
5441
5442 # Dumps out the flow table, extracts the number of packets that have gone
5443 # through the (single) flow in table 1, and returns success if it's exactly 1.
5444 #
5445 # If this remains 0, then the recirculation isn't working properly since the
5446 # packet never goes through flow in table 1.
5447 check_flows () {
5448 n=$(ovs-ofctl dump-flows br0 table=1 | sed -n 's/.*n_packets=\([[0-9]]\{1,\}\).*/\1/p')
5449 echo "n_packets=$n"
5450 test "$n" = 1
5451 }
5452 OVS_WAIT_UNTIL([check_flows], [ovs dump-flows br0])
5453
5454 OVS_VSWITCHD_STOP
5455 AT_CLEANUP
5456
5457 AT_SETUP([ofproto-dpif - debug_slow action])
5458 OVS_VSWITCHD_START
5459 add_of_ports br0 1 2 3
5460
5461 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,2"])
5462
5463 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)"
5464
5465 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5466 AT_CHECK_UNQUOTED([tail -3 stdout], [0], [Datapath actions: 2
5467 This flow is handled by the userspace slow path because it:
5468 - Uses action(s) not supported by datapath.
5469 ])
5470
5471 OVS_VSWITCHD_STOP
5472 AT_CLEANUP
5473
5474
5475 dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
5476 dnl
5477 dnl Checks the implementation of the continuation mechanism that allows the
5478 dnl packet processing pipeline to be paused and resumed. Starts by creating
5479 dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
5480 dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
5481 dnl in the bridge, resuming each time the pipeline pauses, and expects a single
5482 dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
5483 dnl ACTIONS0 still contains at least one "pause" action, removes one of them
5484 dnl and repeats the process.
5485 dnl
5486 dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
5487 dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
5488 dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
5489 dnl into port 1 on br0, so br1 only comes into action if a patch port (added
5490 dnl by EXTRA_SETUP) jumps from one bridge to another.
5491 dnl
5492 dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
5493 dnl both bridges, e.g. to configure mirrors or patch ports.
5494 m4_define([CHECK_CONTINUATION], [dnl
5495 AT_SETUP([ofproto-dpif - continuation - $1])
5496 AT_KEYWORDS([continuations pause resume])
5497 OVS_VSWITCHD_START
5498
5499 # count_matches STRING
5500 #
5501 # Prints on stdout the number of occurrences of STRING in stdin.
5502 count_matches () {
5503 sed -n ":start
5504 s/$[1]//p
5505 t start" | wc -l
5506 }
5507
5508 add_of_ports --pcap br0 `seq 1 $2`
5509 m4_if([$3], [0], [],
5510 [add_of_br 1
5511 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
5512
5513 AT_CAPTURE_FILE([ofctl_monitor0.log])
5514 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
5515 m4_if([$3], [0], [],
5516 [AT_CAPTURE_FILE([ofctl_monitor1.log])
5517 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
5518
5519 actions0='$4'
5520 actions1='$5'
5521 $6
5522 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)"
5523 n_packets=0
5524 n_resumes=0
5525 while true; do
5526 printf "\n\nactions for br0:\n%s\n" "$actions0"
5527 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
5528
5529 # Add flows.
5530 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
5531 m4_if([$3], [0], [],
5532 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
5533
5534 # Make sure the datapath is up-to-date before sending the packet.
5535 ovs-appctl revalidator/wait
5536
5537 # Run a packet through the switch.
5538 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5539
5540 # Wait for the expected number of packets to show up.
5541 n_packets=`expr $n_packets + $2 - 1 + $3`
5542 echo "waiting for $n_packets packets..."
5543 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
5544
5545 # Wait for the expected number of NXT_RESUMEs to be logged.
5546 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
5547 echo "waiting for $n_resumes NXT_RESUMEs..."
5548 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
5549
5550 # Eliminate one "pause" from the actions.
5551 #
5552 # If there were none left, then we're done.
5553 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
5554 if test X"$actions0" = X"$next_actions0"; then
5555 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
5556 if test X"$actions1" = X"$next_actions1"; then
5557 break
5558 else
5559 actions1=$next_actions1
5560 fi
5561 else
5562 actions0=$next_actions0
5563 fi
5564
5565 # Delete all the flows and verify that there are none, so that we
5566 # can be sure that our updated flow tables is actually in use
5567 # later.
5568 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
5569 [NXST_FLOW reply:
5570 ])
5571 m4_if([$3], [0], [],
5572 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
5573 [NXST_FLOW reply:
5574 ])])
5575 done
5576 OVS_VSWITCHD_STOP
5577 AT_CLEANUP
5578 ])
5579
5580 # Check that pause at the end of the pipeline works OK.
5581 #
5582 # (xlate_continuation() has a special case for no-op actions; this
5583 # fails without that special case.)
5584 CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
5585
5586 # Check that remaining actions are preserved following resume.
5587 CHECK_CONTINUATION([actions], [7], [0],
5588 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
5589
5590 # Check that multiple levels of resubmit continue following resume.
5591 #
5592 # The "resubmit:55", which is relative to the current table, is
5593 # particularly interesting because it checks that the notion of the
5594 # current table is correctly preserved.
5595 CHECK_CONTINUATION([resubmit], [10], [0],
5596 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
5597 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
5598 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
5599 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
5600 table=3 in_port=55 actions=pause 6 pause])
5601
5602 # Check that the action set is preserved across pause/resume.
5603 CHECK_CONTINUATION([action set], [3], [0],
5604 [in_port=1 actions=1 pause resubmit(,1) pause 2
5605 table=1 actions=write_actions(3)])
5606
5607 # Check that metadata and the stack used by push and pop is preserved
5608 # across pause/resume.
5609 CHECK_CONTINUATION([data stack], [3], [0],
5610 [in_port=1 actions=pause dnl
5611 set_field:1->reg0 dnl
5612 pause dnl
5613 set_field:2->reg1 dnl
5614 pause dnl
5615 output:NXM_NX_REG0[[]] dnl
5616 pause dnl
5617 push:NXM_NX_REG1[[]] dnl
5618 dnl
5619 pop:NXM_NX_REG2[[]] dnl
5620 pause dnl
5621 output:NXM_NX_REG2[[]] dnl
5622 pause dnl
5623 3])
5624
5625 # Check that mirror output occurs once and once only, even if
5626 # separated by pause/resume.
5627 CHECK_CONTINUATION([mirroring], [5], [0],
5628 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
5629 [ovs-vsctl \
5630 set Bridge br0 mirrors=@m --\
5631 --id=@p2 get Port p2 --\
5632 --id=@p3 get Port p3 --\
5633 --id=@p4 get Port p4 --\
5634 --id=@p5 get Port p5 --\
5635 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
5636
5637 # Check that pause works in the presence of patch ports.
5638 CHECK_CONTINUATION([patch ports], [4], [1],
5639 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
5640 table=1 in_port=1 actions=pause 3 pause 10 pause],
5641 [table=0 in_port=11 actions=pause 5 pause],
5642 [ovs-vsctl \
5643 -- add-port br0 patch10 \
5644 -- set interface patch10 type=patch options:peer=patch11 \
5645 ofport_request=10 \
5646 -- add-port br1 patch11 \
5647 -- set interface patch11 type=patch options:peer=patch10 \
5648 ofport_request=11])
5649
5650 AT_SETUP([ofproto-dpif - continuation flow stats])
5651 AT_KEYWORDS([continuations pause resume])
5652 OVS_VSWITCHD_START
5653
5654 add_of_ports --pcap br0 `seq 1 2`
5655
5656 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)"
5657
5658 AT_DATA([flows.txt], [dnl
5659 table=0 in_port=1 actions=set_field:1->reg1 controller(pause) resubmit(,2)
5660 table=2 reg1=0x1 actions=2
5661 ])
5662
5663 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5664
5665 AT_CAPTURE_FILE([ofctl_monitor0.log])
5666 ovs-ofctl monitor br0 resume --detach --no-chdir \
5667 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5668
5669 # Run a packet through the switch.
5670 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5671
5672 # Check flow stats
5673 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5674 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sed -n 's/idle_age=[[0-9]]*/idle_age=0/p' | grep 'table=2'], [0], [dnl
5675 cookie=0x0, duration=0.0s, table=2, n_packets=1, n_bytes=106, idle_age=0, reg1=0x1 actions=output:2
5676 ])
5677
5678 # The packet should be received by port 2
5679 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5680
5681 OVS_VSWITCHD_STOP
5682 AT_CLEANUP
5683
5684 AT_SETUP([ofproto-dpif - continuation with conntrack])
5685 AT_KEYWORDS([continuations pause resume])
5686 OVS_VSWITCHD_START
5687
5688 add_of_ports --pcap br0 `seq 1 2`
5689
5690 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)"
5691
5692 AT_DATA([flows.txt], [dnl
5693 table=0, in_port=1 icmp action=ct(table=1)
5694 table=1, icmp action=controller(pause) resubmit(,2)
5695 table=2, in_port=1 icmp ct_state=+trk+new action=output:2
5696 ])
5697
5698 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5699
5700 AT_CAPTURE_FILE([ofctl_monitor0.log])
5701 ovs-ofctl monitor br0 resume --detach --no-chdir \
5702 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5703
5704 # Run a packet through the switch.
5705 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5706
5707 # Check flow stats
5708 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5709 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sed -n 's/idle_age=[[0-9]]*/idle_age=0/p' | grep 'table=2'], [0], [dnl
5710 cookie=0x0, duration=0.0s, table=2, n_packets=1, n_bytes=106, idle_age=0, ct_state=+new+trk,icmp,in_port=1 actions=output:2
5711 ])
5712
5713 # The packet should be received by port 2
5714 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5715
5716 OVS_VSWITCHD_STOP
5717 AT_CLEANUP
5718
5719 AT_SETUP([ofproto-dpif - continuation with patch port])
5720 AT_KEYWORDS([continuations pause resume])
5721 OVS_VSWITCHD_START(
5722 [add-port br0 p0 -- set Interface p0 type=dummy -- \
5723 add-port br0 patch- -- \
5724 set interface patch- type=patch options:peer=patch+ -- \
5725 add-br br1 -- set bridge br1 datapath-type=dummy fail-mode=secure -- \
5726 add-port br1 patch+ -- set interface patch+ type=patch options:peer=patch-
5727 ])
5728 add_of_ports --pcap br1 1
5729
5730 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)"
5731
5732 AT_DATA([flows.txt], [dnl
5733 table=0, in_port=patch+ icmp action=controller(pause), resubmit(,1)
5734 table=1, in_port=patch+ icmp action=ct(table=2)
5735 table=2, in_port=patch+ icmp ct_state=+trk+new action=ct(commit, table=3)
5736 table=3, in_port=patch+ icmp action=p1
5737 ])
5738
5739 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5740 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br1 flows.txt])
5741
5742 AT_CAPTURE_FILE([ofctl_monitor.log])
5743 ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl.pid 2> ofctl_monitor.log
5744
5745 # Run a packet through the switch.
5746 AT_CHECK([ovs-appctl netdev-dummy/receive p0 "$flow"], [0], [stdout])
5747
5748 # Check flow stats
5749 AT_CHECK([ovs-ofctl dump-flows br1], [0], [stdout])
5750 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sed -n 's/idle_age=[[0-9]]*/idle_age=0/p' | grep 'table=3' | grep -v 'commit'], [0], [dnl
5751 cookie=0x0, duration=0.0s, table=3, n_packets=1, n_bytes=106, idle_age=0, icmp,in_port=1 actions=output:2
5752 ])
5753
5754 # The packet should be received by port 1
5755 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p1-tx.pcap | wc -l`])
5756
5757 OVS_VSWITCHD_STOP
5758 AT_CLEANUP
5759
5760 # Check that pause works after the packet is cloned.
5761 AT_SETUP([ofproto-dpif - continuation after clone])
5762 AT_KEYWORDS([continuations clone pause resume])
5763 OVS_VSWITCHD_START
5764
5765 add_of_ports --pcap br0 `seq 1 3`
5766
5767 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)"
5768
5769 AT_DATA([flows.txt], [dnl
5770 table=0 in_port=1 actions=set_field:1->reg1 resubmit(,2)
5771 table=1 reg1=0x5 actions=controller(pause) resubmit(,3)
5772 table=1 reg1=0x1 actions=2
5773 table=2 in_port=1 actions=clone(set_field:5->reg1, resubmit(,1))
5774 table=3 reg1=0x1 actions=3
5775 table=3 reg1=0x5 actions=2
5776 ])
5777
5778 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5779
5780 AT_CAPTURE_FILE([ofctl_monitor0.log])
5781 ovs-ofctl monitor br0 resume --detach --no-chdir \
5782 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5783
5784 # Run a packet through the switch.
5785 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5786
5787 ovs-vsctl show
5788 ovs-ofctl dump-flows br0
5789
5790 # The packet should be received by port 2 and not port 3
5791 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5792 AT_CHECK([test 0 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p3-tx.pcap | wc -l`])
5793
5794 # NXT_RESUMEs should be 1 and reg1 should be set to 0x5.
5795 OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor*.log | grep NXT_RESUME | grep -c reg1=0x5`])
5796
5797 OVS_VSWITCHD_STOP
5798 AT_CLEANUP
5799
5800 # Two testcases below are for the ofproto/trace command
5801 # The first one tests all correct syntax:
5802 # ofproto/trace [dp_name] odp_flow [-generate|packet]
5803 # ofproto/trace br_name br_flow [-generate|packet]
5804 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
5805 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5806 add_of_ports br0 1 2 3
5807
5808 AT_DATA([flows.txt], [dnl
5809 in_port=1 actions=output:2
5810 in_port=2 actions=output:1
5811 ])
5812 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5813
5814 odp_flow="in_port(p1)"
5815 br_flow="in_port=1"
5816 # Test command: ofproto/trace odp_flow with in_port as a name.
5817 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5818 AT_CHECK([tail -1 stdout], [0], [dnl
5819 Datapath actions: 2
5820 ])
5821
5822 odp_flow="in_port(1)"
5823 # Test command: ofproto/trace odp_flow
5824 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5825 AT_CHECK([tail -1 stdout], [0], [dnl
5826 Datapath actions: 2
5827 ])
5828
5829 # Test command: ofproto/trace dp_name odp_flow
5830 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
5831 AT_CHECK([tail -1 stdout], [0], [dnl
5832 Datapath actions: 2
5833 ])
5834 # Test commmand: ofproto/trace br_name br_flow
5835 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5836 AT_CHECK([tail -1 stdout], [0], [dnl
5837 Datapath actions: 2
5838 ])
5839
5840 # Delete the inserted flows
5841 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
5842 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
5843
5844 # This section below tests the [-generate] option
5845 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
5846 br_flow="arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=ff:ff:ff:ff:ff:ff"
5847
5848 # Test command: ofproto/trace odp_flow
5849 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5850 # Check for no MAC learning entry
5851 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5852 port VLAN MAC Age
5853 ])
5854
5855 # Test command: ofproto/trace br_name br_flow
5856 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5857 # Check for no MAC learning entry
5858 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5859 port VLAN MAC Age
5860 ])
5861
5862 # Test command: ofproto/trace odp_flow -generate
5863 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
5864 # Check for the MAC learning entry
5865 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5866 port VLAN MAC Age
5867 3 0 50:54:00:00:00:05 ?
5868 ])
5869
5870 # Test command: ofproto/trace dp_name odp_flow -generate
5871 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5872 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
5873 -generate], [0], [stdout])
5874 # Check for both MAC learning entries
5875 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5876 port VLAN MAC Age
5877 3 0 50:54:00:00:00:05 ?
5878 1 0 50:54:00:00:00:06 ?
5879 ])
5880
5881 # Test command: ofproto/trace br_name br_flow -generate
5882 AT_CHECK([ovs-appctl ofproto/trace br0 \
5883 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
5884 -generate], [0], [stdout])
5885 # Check for both MAC learning entries.
5886 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5887 port VLAN MAC Age
5888 3 0 50:54:00:00:00:05 ?
5889 1 0 50:54:00:00:00:06 ?
5890 2 0 50:54:00:00:00:07 ?
5891 ])
5892
5893 # This section beflow tests the [packet] option
5894 # The ovs-tcpundump of packets between port1 and port2
5895 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5896 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
5897
5898 # Construct the MAC learning table
5899 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5900 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
5901 -generate], [0], [stdout])
5902
5903 # Construct the MAC learning table
5904 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5905 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
5906 -generate], [0], [stdout])
5907
5908 # Test command: ofproto/trace odp_flow packet
5909 AT_CHECK([ovs-appctl ofproto/trace \
5910 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5911 AT_CHECK([tail -1 stdout], [0], [dnl
5912 Datapath actions: 2
5913 ])
5914 AT_CHECK([head -n 3 stdout], [0], [dnl
5915 Flow: pkt_mark=0x2,skb_priority=0x1,arp,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_op=0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
5916
5917 bridge("br0")
5918 ])
5919
5920 # Test command: ofproto/trace dp_name odp_flow packet
5921 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5922 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5923 AT_CHECK([tail -1 stdout], [0], [dnl
5924 Datapath actions: 2
5925 ])
5926 AT_CHECK([head -n 3 stdout], [0], [dnl
5927 Flow: pkt_mark=0x2,skb_priority=0x1,arp,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_op=0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
5928
5929 bridge("br0")
5930 ])
5931
5932 # Test command: ofproto/trace br_name br_flow packet
5933 AT_CHECK([ovs-appctl ofproto/trace br0 \
5934 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
5935 AT_CHECK([tail -1 stdout], [0], [dnl
5936 Datapath actions: 1
5937 ])
5938 AT_CHECK([head -n 3 stdout], [0], [dnl
5939 Flow: pkt_mark=0x1,skb_priority=0x2,arp,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_op=0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
5940
5941 bridge("br0")
5942 ])
5943
5944 OVS_VSWITCHD_STOP
5945 AT_CLEANUP
5946
5947 # The second test tests the corner cases
5948 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
5949 OVS_VSWITCHD_START
5950 add_of_ports br0 1 2
5951
5952 # Define flows
5953 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
5954 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
5955 # Define options
5956 generate="-generate"
5957 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5958
5959 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
5960 m4_foreach(
5961 [option],
5962 [[],
5963 ["$generate"],
5964 ["$pkt"]],
5965 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
5966 [2], [], [stderr])
5967 AT_CHECK([tail -2 stderr], [0], [dnl
5968 Cannot find the datapath
5969 ovs-appctl: ovs-vswitchd: server returned an error
5970 ])])
5971
5972 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
5973 m4_foreach(
5974 [option],
5975 [[],
5976 ["$generate"],
5977 ["$pkt"]],
5978 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
5979 [2], [], [stderr])
5980 AT_CHECK([tail -2 stderr], [0], [dnl
5981 Cannot find the datapath
5982 ovs-appctl: ovs-vswitchd: server returned an error
5983 ])])
5984
5985 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
5986 m4_foreach(
5987 [option],
5988 [[],
5989 ["$generate"],
5990 ["$pkt"]],
5991 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
5992 [2], [], [stderr])
5993 AT_CHECK([tail -2 stderr], [0], [dnl
5994 Cannot find the datapath
5995 ovs-appctl: ovs-vswitchd: server returned an error
5996 ])])
5997
5998 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
5999 m4_foreach(
6000 [option],
6001 [[],
6002 ["$generate"],
6003 ["$pkt"]],
6004 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
6005 [2], [], [stderr])
6006 AT_CHECK([tail -2 stderr], [0], [dnl
6007 Cannot find the datapath
6008 ovs-appctl: ovs-vswitchd: server returned an error
6009 ])])
6010
6011 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
6012 m4_foreach(
6013 [option],
6014 [[],
6015 ["$generate"],
6016 ["$pkt"]],
6017 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
6018 [2], [], [stderr])
6019 AT_CHECK([tail -2 stderr], [0], [dnl
6020 ovs-dummy: unknown bridge
6021 ovs-appctl: ovs-vswitchd: server returned an error
6022 ])])
6023
6024 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
6025 m4_foreach(
6026 [option],
6027 [[],
6028 ["$generate"],
6029 ["$pkt"]],
6030 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
6031 [2], [], [stderr])
6032 AT_CHECK([tail -2 stderr], [0], [dnl
6033 syntax error at in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02 (or the bridge name was omitted)
6034 ovs-appctl: ovs-vswitchd: server returned an error
6035 ])])
6036
6037 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
6038 AT_CHECK([ovs-appctl ofproto/trace \
6039 ovs-dummy "$odp_flow" garbage_option],
6040 [2], [stdout],[stderr])
6041 AT_CHECK([tail -2 stderr], [0], [dnl
6042 Trailing garbage in packet data
6043 ovs-appctl: ovs-vswitchd: server returned an error
6044 ])
6045
6046 # Test incorrect command: ofproto/trace with 0 argument
6047 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
6048 AT_CHECK([tail -2 stderr], [0], [dnl
6049 "ofproto/trace" command requires at least 1 arguments
6050 ovs-appctl: ovs-vswitchd: server returned an error
6051 ])
6052
6053 OVS_VSWITCHD_STOP
6054 AT_CLEANUP
6055
6056 # The third test checks that the output of "ovs-dpctl -m" is valid to trace.
6057 AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
6058 OVS_VSWITCHD_START([dnl
6059 set Open_vSwitch . other_config:max-idle=10000 \
6060 -- add-port br0 p1 -- set Interface p1 type=dummy])
6061
6062 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)'])
6063 ovs-appctl revalidator/wait
6064 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
6065
6066 odp_flow=`cat dp_flows1.txt`
6067 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
6068 Flow: <cleared>
6069
6070 bridge("br0")
6071 -------------
6072 0. No match.
6073 drop
6074
6075 Final flow: <cleared>
6076 Megaflow: <cleared>
6077 Datapath actions: drop
6078 ])
6079
6080 dnl Now, try again without megaflows:
6081 ovs-appctl upcall/disable-megaflows
6082
6083 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)'])
6084 ovs-appctl revalidator/wait
6085 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
6086
6087 odp_flow=`cat dp_flows2.txt`
6088 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
6089 Flow: <cleared>
6090
6091 bridge("br0")
6092 -------------
6093 0. No match.
6094 drop
6095
6096 Final flow: <cleared>
6097 Megaflow: <cleared>
6098 Datapath actions: drop
6099 ])
6100
6101 OVS_VSWITCHD_STOP
6102 AT_CLEANUP
6103
6104 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
6105 OVS_VSWITCHD_START
6106 add_of_ports br0 1 2 3
6107
6108 AT_DATA([flows.txt], [dnl
6109 in_port=1 actions=output:2
6110 in_port=2 actions=output:1
6111 ])
6112 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6113
6114 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
6115 AT_CHECK([tail -1 stdout], [0], [dnl
6116 Datapath actions: push_vlan(vid=123,pcp=0),2
6117 ])
6118
6119 OVS_VSWITCHD_STOP
6120 AT_CLEANUP
6121
6122
6123 m4_define([OFPROTO_TRACE],
6124 [flow="$2"
6125 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
6126 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
6127 expected="$4"
6128 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
6129 [0], [stdout])
6130 mv stdout expout
6131 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
6132 [0], [expout])])
6133
6134 AT_SETUP([ofproto-dpif - MAC learning])
6135 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
6136 add_of_ports br0 1 2 3
6137
6138 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)'
6139
6140 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
6141 OFPROTO_TRACE(
6142 [ovs-dummy],
6143 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
6144 [-generate],
6145 [1,2,100])
6146
6147 # Check for the MAC learning entry.
6148 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
6149 port VLAN MAC Age
6150 3 0 50:54:00:00:00:05 ?
6151 ])
6152
6153 # Trace a packet arrival destined for the learned MAC.
6154 # (This will also learn a MAC.)
6155 OFPROTO_TRACE(
6156 [ovs-dummy],
6157 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
6158 [-generate],
6159 [3])
6160
6161 # Check for both MAC learning entries.
6162 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
6163 port VLAN MAC Age
6164 3 0 50:54:00:00:00:05 ?
6165 1 0 50:54:00:00:00:06 ?
6166 ])
6167
6168 # Trace a packet arrival that updates the first learned MAC entry.
6169 OFPROTO_TRACE(
6170 [ovs-dummy],
6171 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
6172 [-generate],
6173 [1,3,100])
6174
6175 # Check that the MAC learning entry was updated.
6176 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
6177 port VLAN MAC Age
6178 1 0 50:54:00:00:00:06 ?
6179 2 0 50:54:00:00:00:05 ?
6180 ])
6181
6182 # Add another bridge.
6183 AT_CHECK(
6184 [ovs-vsctl \
6185 -- add-br br1 \
6186 -- set bridge br1 datapath-type=dummy])
6187 add_of_ports br1 4 5
6188
6189 # Trace some packet arrivals in br1 to create MAC learning entries there too.
6190 OFPROTO_TRACE(
6191 [ovs-dummy],
6192 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
6193 [-generate],
6194 [5,101])
6195 OFPROTO_TRACE(
6196 [ovs-dummy],
6197 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
6198 [-generate],
6199 [4,101])
6200
6201 # Check that the MAC learning entries were added.
6202 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
6203 port VLAN MAC Age
6204 4 0 50:54:00:00:00:06 ?
6205 5 0 50:54:00:00:00:07 ?
6206 ])
6207
6208 # Delete port p1 and see that its MAC learning entry disappeared, and
6209 # that the MAC learning entry for the same MAC was also deleted from br1.
6210 AT_CHECK([ovs-vsctl del-port p1])
6211 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
6212 port VLAN MAC Age
6213 2 0 50:54:00:00:00:05 ?
6214 ])
6215 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
6216 port VLAN MAC Age
6217 5 0 50:54:00:00:00:07 ?
6218 ])
6219
6220 OVS_VSWITCHD_STOP
6221 AT_CLEANUP
6222
6223 AT_SETUP([ofproto-dpif - MAC table overflow])
6224 OVS_VSWITCHD_START(
6225 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
6226 add_of_ports br0 1 2 3
6227
6228 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)'
6229
6230 AT_CHECK([ovs-appctl time/stop])
6231
6232 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
6233 for i in 0 1 2 3 4 5 6 7 8 9; do
6234 OFPROTO_TRACE(
6235 [ovs-dummy],
6236 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
6237 [-generate],
6238 [1,2,100])
6239 ovs-appctl time/warp 1000
6240 done
6241
6242 # Check for the MAC learning entries.
6243 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
6244 [0], [dnl
6245 3 0 50:54:00:00:00:00
6246 3 0 50:54:00:00:00:01
6247 3 0 50:54:00:00:00:02
6248 3 0 50:54:00:00:00:03
6249 3 0 50:54:00:00:00:04
6250 3 0 50:54:00:00:00:05
6251 3 0 50:54:00:00:00:06
6252 3 0 50:54:00:00:00:07
6253 3 0 50:54:00:00:00:08
6254 3 0 50:54:00:00:00:09
6255 port VLAN MAC Age
6256 ])
6257
6258 # Trace another ARP packet on another MAC.
6259 OFPROTO_TRACE(
6260 [ovs-dummy],
6261 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
6262 [-generate],
6263 [1,2,100])
6264
6265 # Check that the new one chased the oldest one out of the table.
6266 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
6267 [0], [dnl
6268 3 0 50:54:00:00:00:01 ?
6269 3 0 50:54:00:00:00:02 ?
6270 3 0 50:54:00:00:00:03 ?
6271 3 0 50:54:00:00:00:04 ?
6272 3 0 50:54:00:00:00:05 ?
6273 3 0 50:54:00:00:00:06 ?
6274 3 0 50:54:00:00:00:07 ?
6275 3 0 50:54:00:00:00:08 ?
6276 3 0 50:54:00:00:00:09 ?
6277 3 0 50:54:00:00:00:10 ?
6278 port VLAN MAC Age
6279 ])
6280 OVS_VSWITCHD_STOP
6281 AT_CLEANUP
6282
6283 AT_SETUP([ofproto-dpif - MAC table overflow fairness])
6284 OVS_VSWITCHD_START(
6285 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
6286 add_of_ports br0 1 2 3 4 5 6
6287
6288 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)'
6289
6290 AT_CHECK([ovs-appctl time/stop])
6291
6292 # Trace packets with 2 different source MACs arriving on each of the 5
6293 # ports, filling up the 10-entry learning table.
6294 for i in 0 1 2 3 4 5 6 7 8 9; do
6295 p=`expr $i / 2 + 1`
6296 ovs-appctl ofproto/trace ovs-dummy "in_port($p),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp" -generate
6297 ovs-appctl time/warp 1000
6298 done
6299
6300 # Check for the MAC learning entries.
6301 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
6302 [0], [dnl
6303 1 0 50:54:00:00:00:00
6304 1 0 50:54:00:00:00:01
6305 2 0 50:54:00:00:00:02
6306 2 0 50:54:00:00:00:03
6307 3 0 50:54:00:00:00:04
6308 3 0 50:54:00:00:00:05
6309 4 0 50:54:00:00:00:06
6310 4 0 50:54:00:00:00:07
6311 5 0 50:54:00:00:00:08
6312 5 0 50:54:00:00:00:09
6313 port VLAN MAC Age
6314 ])
6315
6316 # Now trace 16 new MACs on another port.
6317 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
6318 ovs-appctl ofproto/trace ovs-dummy "in_port(6),eth(src=50:54:00:00:0$i:ff,dst=ff:ff:ff:ff:ff:ff),$arp" -generate
6319 ovs-appctl time/warp 1000
6320 done
6321
6322 # Check the results.
6323 #
6324 # Our eviction algorithm on overflow is that an arbitrary (but deterministic)
6325 # one of the ports with the most learned MACs loses the least recently used
6326 # one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
6327 # MAC each, and the other 2 of the old ports with 2 MACs each.
6328 #
6329 # (If someone changes lib/heap.c to do something different with equal-priority
6330 # nodes, then the output below could change, but it would still follow the
6331 # rules explained above.)
6332 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
6333 [0], [dnl
6334 1 0 50:54:00:00:00:01
6335 2 0 50:54:00:00:00:03
6336 3 0 50:54:00:00:00:04
6337 3 0 50:54:00:00:00:05
6338 4 0 50:54:00:00:00:07
6339 5 0 50:54:00:00:00:08
6340 5 0 50:54:00:00:00:09
6341 6 0 50:54:00:00:0d:ff
6342 6 0 50:54:00:00:0e:ff
6343 6 0 50:54:00:00:0f:ff
6344 port VLAN MAC Age
6345 ])
6346 OVS_VSWITCHD_STOP
6347 AT_CLEANUP
6348
6349 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
6350 #
6351 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
6352 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
6353 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6354 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6355
6356 on_exit 'kill `cat test-sflow.pid`'
6357 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
6358 AT_CAPTURE_FILE([sflow.log])
6359 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6360 ovs-appctl time/stop
6361
6362 add_of_ports br0 1 2
6363 ovs-vsctl \
6364 set Interface br0 options:ifindex=1002 -- \
6365 set Interface p1 options:ifindex=1004 -- \
6366 set Interface p2 options:ifindex=1003 -- \
6367 set Bridge br0 sflow=@sf -- \
6368 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
6369 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
6370
6371 dnl open with ARP packets to seed the bridge-learning. The output
6372 dnl ifIndex numbers should be reported predictably after that.
6373 dnl Since we set sampling=1 we should see all of these packets
6374 dnl reported. Sorting the output by data-source and seqNo makes
6375 dnl it deterministic. Ensuring that we send at least two packets
6376 dnl into each port means we get to check the seq nos are
6377 dnl incrementing correctly.
6378 dnl because packets from different ports can be handled by separate
6379 dnl threads, put some sleeps
6380
6381 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)'
6382 sleep 1
6383 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)'
6384 sleep 1
6385 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)'
6386 sleep 1
6387 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)'
6388 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)'
6389
6390 dnl sleep long enough to get more than one counter sample
6391 dnl from each datasource so we can check sequence numbers
6392 ovs-appctl time/warp 2000 100
6393 OVS_VSWITCHD_STOP
6394 OVS_APP_EXIT_AND_WAIT([test-sflow])
6395
6396 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6397 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
6398 HEADER
6399 dgramSeqNo=1
6400 ds=127.0.0.1>2:1000
6401 fsSeqNo=1
6402 in_vlan=0
6403 in_priority=0
6404 out_vlan=0
6405 out_priority=0
6406 meanSkip=1
6407 samplePool=1
6408 dropEvents=0
6409 in_ifindex=1004
6410 in_format=0
6411 out_ifindex=2
6412 out_format=2
6413 hdr_prot=1
6414 pkt_len=46
6415 stripped=4
6416 hdr_len=42
6417 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
6418 HEADER
6419 dgramSeqNo=1
6420 ds=127.0.0.1>2:1000
6421 fsSeqNo=2
6422 in_vlan=0
6423 in_priority=0
6424 out_vlan=0
6425 out_priority=0
6426 meanSkip=1
6427 samplePool=2
6428 dropEvents=0
6429 in_ifindex=1003
6430 in_format=0
6431 out_ifindex=2
6432 out_format=2
6433 hdr_prot=1
6434 pkt_len=46
6435 stripped=4
6436 hdr_len=42
6437 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
6438 HEADER
6439 dgramSeqNo=1
6440 ds=127.0.0.1>2:1000
6441 fsSeqNo=3
6442 in_vlan=0
6443 in_priority=0
6444 out_vlan=0
6445 out_priority=0
6446 meanSkip=1
6447 samplePool=3
6448 dropEvents=0
6449 in_ifindex=1004
6450 in_format=0
6451 out_ifindex=1003
6452 out_format=0
6453 hdr_prot=1
6454 pkt_len=110
6455 stripped=4
6456 hdr_len=106
6457 hdr=50-54-00-00-00-07-50-54-00-00-00-05-08-00-45-00-00-5C-00-00-00-00-40-01-F9-4D-C0-A8-00-01-C0-A8-00-02-08-00-13-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
6458 HEADER
6459 dgramSeqNo=1
6460 ds=127.0.0.1>2:1000
6461 fsSeqNo=4
6462 in_vlan=0
6463 in_priority=0
6464 out_vlan=0
6465 out_priority=0
6466 meanSkip=1
6467 samplePool=4
6468 dropEvents=0
6469 in_ifindex=1003
6470 in_format=0
6471 out_ifindex=1004
6472 out_format=0
6473 hdr_prot=1
6474 pkt_len=110
6475 stripped=4
6476 hdr_len=106
6477 hdr=50-54-00-00-00-05-50-54-00-00-00-07-08-00-45-00-00-5C-00-00-00-00-40-01-F9-4D-C0-A8-00-02-C0-A8-00-01-00-00-1B-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
6478 HEADER
6479 dgramSeqNo=1
6480 ds=127.0.0.1>2:1000
6481 fsSeqNo=5
6482 in_vlan=0
6483 in_priority=0
6484 out_vlan=0
6485 out_priority=0
6486 meanSkip=1
6487 samplePool=5
6488 dropEvents=0
6489 in_ifindex=1003
6490 in_format=0
6491 out_ifindex=1004
6492 out_format=0
6493 hdr_prot=1
6494 pkt_len=58
6495 stripped=4
6496 hdr_len=54
6497 hdr=50-54-00-00-00-05-50-54-00-00-00-07-86-DD-67-00-00-00-00-00-0A-80-FE-80-00-00-00-00-00-00-00-00-00-00-00-00-00-01-FE-80-00-00-00-00-00-00-00-00-00-00-00-00-00-02
6498 ])
6499
6500 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'ETHCOUNTERS|IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -24 | sed 's/ /\
6501 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
6502 ETHCOUNTERS
6503 dot3StatsAlignmentErrors=4294967295
6504 dot3StatsFCSErrors=4294967295
6505 dot3StatsSingleCollisionFrames=4294967295
6506 dot3StatsMultipleCollisionFrames=4294967295
6507 dot3StatsSQETestErrors=4294967295
6508 dot3StatsDeferredTransmissions=4294967295
6509 dot3StatsLateCollisions=4294967295
6510 dot3StatsExcessiveCollisions=4294967295
6511 dot3StatsInternalMacTransmitErrors=4294967295
6512 dot3StatsCarrierSenseErrors=4294967295
6513 dot3StatsFrameTooLongs=4294967295
6514 dot3StatsInternalMacReceiveErrors=4294967295
6515 dot3StatsSymbolErrors=4294967295
6516 ETHCOUNTERS
6517 dot3StatsAlignmentErrors=4294967295
6518 dot3StatsFCSErrors=4294967295
6519 dot3StatsSingleCollisionFrames=4294967295
6520 dot3StatsMultipleCollisionFrames=4294967295
6521 dot3StatsSQETestErrors=4294967295
6522 dot3StatsDeferredTransmissions=4294967295
6523 dot3StatsLateCollisions=4294967295
6524 dot3StatsExcessiveCollisions=4294967295
6525 dot3StatsInternalMacTransmitErrors=4294967295
6526 dot3StatsCarrierSenseErrors=4294967295
6527 dot3StatsFrameTooLongs=4294967295
6528 dot3StatsInternalMacReceiveErrors=4294967295
6529 dot3StatsSymbolErrors=4294967295
6530 ETHCOUNTERS
6531 dot3StatsAlignmentErrors=4294967295
6532 dot3StatsFCSErrors=4294967295
6533 dot3StatsSingleCollisionFrames=4294967295
6534 dot3StatsMultipleCollisionFrames=4294967295
6535 dot3StatsSQETestErrors=4294967295
6536 dot3StatsDeferredTransmissions=4294967295
6537 dot3StatsLateCollisions=4294967295
6538 dot3StatsExcessiveCollisions=4294967295
6539 dot3StatsInternalMacTransmitErrors=4294967295
6540 dot3StatsCarrierSenseErrors=4294967295
6541 dot3StatsFrameTooLongs=4294967295
6542 dot3StatsInternalMacReceiveErrors=4294967295
6543 dot3StatsSymbolErrors=4294967295
6544 ETHCOUNTERS
6545 dot3StatsAlignmentErrors=4294967295
6546 dot3StatsFCSErrors=4294967295
6547 dot3StatsSingleCollisionFrames=4294967295
6548 dot3StatsMultipleCollisionFrames=4294967295
6549 dot3StatsSQETestErrors=4294967295
6550 dot3StatsDeferredTransmissions=4294967295
6551 dot3StatsLateCollisions=4294967295
6552 dot3StatsExcessiveCollisions=4294967295
6553 dot3StatsInternalMacTransmitErrors=4294967295
6554 dot3StatsCarrierSenseErrors=4294967295
6555 dot3StatsFrameTooLongs=4294967295
6556 dot3StatsInternalMacReceiveErrors=4294967295
6557 dot3StatsSymbolErrors=4294967295
6558 ETHCOUNTERS
6559 dot3StatsAlignmentErrors=4294967295
6560 dot3StatsFCSErrors=4294967295
6561 dot3StatsSingleCollisionFrames=4294967295
6562 dot3StatsMultipleCollisionFrames=4294967295
6563 dot3StatsSQETestErrors=4294967295
6564 dot3StatsDeferredTransmissions=4294967295
6565 dot3StatsLateCollisions=4294967295
6566 dot3StatsExcessiveCollisions=4294967295
6567 dot3StatsInternalMacTransmitErrors=4294967295
6568 dot3StatsCarrierSenseErrors=4294967295
6569 dot3StatsFrameTooLongs=4294967295
6570 dot3StatsInternalMacReceiveErrors=4294967295
6571 dot3StatsSymbolErrors=4294967295
6572 ETHCOUNTERS
6573 dot3StatsAlignmentErrors=4294967295
6574 dot3StatsFCSErrors=4294967295
6575 dot3StatsSingleCollisionFrames=4294967295
6576 dot3StatsMultipleCollisionFrames=4294967295
6577 dot3StatsSQETestErrors=4294967295
6578 dot3StatsDeferredTransmissions=4294967295
6579 dot3StatsLateCollisions=4294967295
6580 dot3StatsExcessiveCollisions=4294967295
6581 dot3StatsInternalMacTransmitErrors=4294967295
6582 dot3StatsCarrierSenseErrors=4294967295
6583 dot3StatsFrameTooLongs=4294967295
6584 dot3StatsInternalMacReceiveErrors=4294967295
6585 dot3StatsSymbolErrors=4294967295
6586 IFCOUNTERS
6587 dgramSeqNo=1
6588 ds=127.0.0.1>0:1003
6589 csSeqNo=1
6590 ifindex=1003
6591 type=6
6592 ifspeed=100000000
6593 direction=0
6594 status=3
6595 in_octets=202
6596 in_unicasts=3
6597 in_multicasts=4294967295
6598 in_broadcasts=4294967295
6599 in_discards=4294967295
6600 in_errors=4294967295
6601 in_unknownprotos=4294967295
6602 out_octets=148
6603 out_unicasts=2
6604 out_multicasts=4294967295
6605 out_broadcasts=4294967295
6606 out_discards=4294967295
6607 out_errors=4294967295
6608 promiscuous=0
6609 IFCOUNTERS
6610 dgramSeqNo=1
6611 ds=127.0.0.1>0:1004
6612 csSeqNo=1
6613 ifindex=1004
6614 type=6
6615 ifspeed=100000000
6616 direction=0
6617 status=3
6618 in_octets=148
6619 in_unicasts=2
6620 in_multicasts=4294967295
6621 in_broadcasts=4294967295
6622 in_discards=4294967295
6623 in_errors=4294967295
6624 in_unknownprotos=4294967295
6625 out_octets=202
6626 out_unicasts=3
6627 out_multicasts=4294967295
6628 out_broadcasts=4294967295
6629 out_discards=4294967295
6630 out_errors=4294967295
6631 promiscuous=0
6632 IFCOUNTERS
6633 dgramSeqNo=2
6634 ds=127.0.0.1>0:1002
6635 csSeqNo=1
6636 ifindex=1002
6637 type=6
6638 ifspeed=100000000
6639 direction=0
6640 status=3
6641 in_octets=0
6642 in_unicasts=0
6643 in_multicasts=4294967295
6644 in_broadcasts=4294967295
6645 in_discards=4294967295
6646 in_errors=4294967295
6647 in_unknownprotos=4294967295
6648 out_octets=84
6649 out_unicasts=2
6650 out_multicasts=4294967295
6651 out_broadcasts=4294967295
6652 out_discards=4294967295
6653 out_errors=4294967295
6654 promiscuous=0
6655 IFCOUNTERS
6656 dgramSeqNo=3
6657 ds=127.0.0.1>0:1002
6658 csSeqNo=2
6659 ifindex=1002
6660 type=6
6661 ifspeed=100000000
6662 direction=0
6663 status=3
6664 in_octets=0
6665 in_unicasts=0
6666 in_multicasts=4294967295
6667 in_broadcasts=4294967295
6668 in_discards=4294967295
6669 in_errors=4294967295
6670 in_unknownprotos=4294967295
6671 out_octets=84
6672 out_unicasts=2
6673 out_multicasts=4294967295
6674 out_broadcasts=4294967295
6675 out_discards=4294967295
6676 out_errors=4294967295
6677 promiscuous=0
6678 IFCOUNTERS
6679 dgramSeqNo=3
6680 ds=127.0.0.1>0:1003
6681 csSeqNo=2
6682 ifindex=1003
6683 type=6
6684 ifspeed=100000000
6685 direction=0
6686 status=3
6687 in_octets=202
6688 in_unicasts=3
6689 in_multicasts=4294967295
6690 in_broadcasts=4294967295
6691 in_discards=4294967295
6692 in_errors=4294967295
6693 in_unknownprotos=4294967295
6694 out_octets=148
6695 out_unicasts=2
6696 out_multicasts=4294967295
6697 out_broadcasts=4294967295
6698 out_discards=4294967295
6699 out_errors=4294967295
6700 promiscuous=0
6701 IFCOUNTERS
6702 dgramSeqNo=3
6703 ds=127.0.0.1>0:1004
6704 csSeqNo=2
6705 ifindex=1004
6706 type=6
6707 ifspeed=100000000
6708 direction=0
6709 status=3
6710 in_octets=148
6711 in_unicasts=2
6712 in_multicasts=4294967295
6713 in_broadcasts=4294967295
6714 in_discards=4294967295
6715 in_errors=4294967295
6716 in_unknownprotos=4294967295
6717 out_octets=202
6718 out_unicasts=3
6719 out_multicasts=4294967295
6720 out_broadcasts=4294967295
6721 out_discards=4294967295
6722 out_errors=4294967295
6723 promiscuous=0
6724 OPENFLOWPORT
6725 datapath_id=18364758544493064720
6726 port_no=1
6727 OPENFLOWPORT
6728 datapath_id=18364758544493064720
6729 port_no=1
6730 OPENFLOWPORT
6731 datapath_id=18364758544493064720
6732 port_no=2
6733 OPENFLOWPORT
6734 datapath_id=18364758544493064720
6735 port_no=2
6736 OPENFLOWPORT
6737 datapath_id=18364758544493064720
6738 port_no=65534
6739 OPENFLOWPORT
6740 datapath_id=18364758544493064720
6741 port_no=65534
6742 PORTNAME
6743 portName=br0
6744 PORTNAME
6745 portName=br0
6746 PORTNAME
6747 portName=p1
6748 PORTNAME
6749 portName=p1
6750 PORTNAME
6751 portName=p2
6752 PORTNAME
6753 portName=p2
6754 ])])
6755
6756 AT_SETUP([ofproto-dpif - basic truncate action])
6757 OVS_VSWITCHD_START
6758 add_of_ports br0 1 2 3 4 5
6759
6760 AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
6761 AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
6762 AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
6763 AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
6764 AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
6765
6766 AT_DATA([flows.txt], [dnl
6767 in_port=3,actions=drop
6768 in_port=5,actions=drop
6769 in_port=1,actions=output(port=2,max_len=64),output:4
6770 ])
6771 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6772
6773 dnl Datapath actions
6774 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=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
6775 AT_CHECK([tail -1 stdout], [0],
6776 [Datapath actions: trunc(64),2,4
6777 ])
6778
6779 dnl An 170 byte packet
6780 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6781
6782 AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
6783 icmp,in_port=ANY,vlan_tci=0x0000,dl_src=00:50:56:c0:00:08,dl_dst=00:0c:29:c8:a0:a4,nw_src=192.168.218.1,nw_dst=192.168.218.100,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0
6784 ])
6785
6786 AT_CHECK([ovs-appctl revalidator/purge], [0])
6787 dnl packet with truncated size
6788 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6789 n_bytes=64
6790 ])
6791 dnl packet with original size
6792 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6793 n_bytes=170
6794 ])
6795
6796 dnl More complicated case
6797 AT_CHECK([ovs-ofctl del-flows br0])
6798 AT_DATA([flows.txt], [dnl
6799 in_port=3,actions=drop
6800 in_port=5,actions=drop
6801 in_port=1,actions=output(port=2,max_len=64),output(port=2,max_len=128),output(port=4,max_len=60),output:2,output:4
6802 ])
6803 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6804
6805 dnl Datapath actions
6806 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=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
6807 AT_CHECK([tail -1 stdout], [0],
6808 [Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
6809 ])
6810
6811 dnl An 170 byte packet
6812 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6813
6814 AT_CHECK([ovs-appctl revalidator/purge], [0])
6815 dnl packet size: 64 + 128 + 170 = 362
6816 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6817 n_bytes=362
6818 ])
6819 dnl packet size: 60 + 170 = 230
6820 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6821 n_bytes=230
6822 ])
6823
6824 dnl syntax checking
6825 AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
6826 ovs-ofctl: output to unsupported truncate port: ALL
6827 ])
6828
6829 OVS_VSWITCHD_STOP
6830 AT_CLEANUP
6831
6832 AT_SETUP([ofproto-dpif - truncate and output to patch port])
6833 OVS_VSWITCHD_START([add-br br1 \
6834 -- set bridge br1 datapath-type=dummy fail-mode=secure \
6835 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 ofport_request=1 \
6836 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6837
6838 add_of_ports br0 2
6839
6840 AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
6841 AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
6842
6843 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6844 [0], [stdout])
6845 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
6846 ])
6847 dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
6848 AT_CHECK([grep "output_trunc does not support patch port [[0-9]]*" stdout], [0], [stdout])
6849
6850 OVS_VSWITCHD_STOP
6851 AT_CLEANUP
6852
6853 AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
6854 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6855 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6856 options:key=5 ofport_request=1\
6857 -- add-port br0 p2 -- set Interface p2 type=dummy \
6858 ofport_request=2])
6859 AT_DATA([flows.txt], [dnl
6860 actions=output(max_len=100, port=1)
6861 ])
6862 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6863 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6864
6865 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
6866 br0 65534/100: (dummy-internal)
6867 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
6868 p2 2/2: (dummy)
6869 ])
6870
6871 dnl Basic
6872 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=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
6873 AT_CHECK([tail -1 stdout], [0],
6874 [Datapath actions: trunc(100),set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),1
6875 ])
6876
6877 OVS_VSWITCHD_STOP
6878 AT_CLEANUP
6879
6880 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
6881 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
6882 AT_CLEANUP
6883
6884 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
6885 AT_SKIP_IF([test $HAVE_IPV6 = no])
6886 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
6887 AT_CLEANUP
6888
6889 dnl Test sFlow LAG structures
6890 AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
6891 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
6892 OVS_VSWITCHD_START([dnl
6893 add-bond br0 bond p1 p2 -- \
6894 set Port bond lacp=active bond-mode=active-backup \
6895 other_config:lacp-time="fast" \
6896 other_config:lacp-system-id=11:22:33:44:55:66 \
6897 other_config:lacp-system-priority=54321 -- \
6898 set Interface p1 type=dummy \
6899 other_config:lacp-port-id=11 \
6900 other_config:lacp-port-priority=111 \
6901 other_config:lacp-aggregation-key=3333 -- \
6902 set Interface p2 type=dummy \
6903 other_config:lacp-port-id=22 \
6904 other_config:lacp-port-priority=222 \
6905 other_config:lacp-aggregation-key=3333 ])
6906
6907 on_exit 'kill `cat test-sflow.pid`'
6908 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6909 AT_CAPTURE_FILE([sflow.log])
6910 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6911
6912 ovs-appctl time/stop
6913
6914 ovs-vsctl \
6915 set Interface p1 options:ifindex=1003 -- \
6916 set Bridge br0 sflow=@sf -- \
6917 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6918 header=128 sampling=1 polling=1 agent=127.0.0.1
6919
6920 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6921 AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
6922 AT_CHECK([ovs-appctl revalidator/purge], [0])
6923 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6924 OVS_APP_EXIT_AND_WAIT([test-sflow])
6925 AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
6926 /g']], [0], [dnl
6927 LACPCOUNTERS
6928 sysID=11:22:33:44:55:66
6929 partnerID=00:00:00:00:00:00
6930 aggID=3333
6931 actorAdmin=0x7
6932 actorOper=0xbf
6933 partnerAdmin=0x0
6934 partnerOper=0x2
6935 LACPDUsRx=0
6936 markerPDUsRx=4294967295
6937 markerRespPDUsRx=4294967295
6938 unknownRx=4294967295
6939 illegalRx=0
6940 LACPDUsTx=1
6941 markerPDUsTx=4294967295
6942 markerRespPDUsTx=4294967295
6943 ])
6944
6945 AT_CLEANUP
6946
6947 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
6948 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6949 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6950
6951 dnl set up sFlow logging
6952 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6953 AT_CAPTURE_FILE([sflow.log])
6954 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6955 ovs-appctl time/stop
6956
6957 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6958 AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
6959 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
6960 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
6961
6962 AT_CHECK([ovs-ofctl add-flow br0 action=3])
6963
6964 dnl enable sflow
6965 ovs-vsctl \
6966 set Bridge br0 sflow=@sf -- \
6967 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
6968 header=128 sampling=1 polling=0
6969
6970 dnl introduce a packet that will be flooded to the tunnel
6971 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(4),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'])
6972
6973 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6974 for i in `seq 1 30`; do
6975 ovs-appctl time/warp 100
6976 done
6977
6978 OVS_APP_EXIT_AND_WAIT([test-sflow])
6979
6980 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6981 /g']], [0], [dnl
6982 HEADER
6983 dgramSeqNo=1
6984 ds=127.0.0.1>2:1000
6985 fsSeqNo=1
6986 tunnel4_out_length=0
6987 tunnel4_out_protocol=47
6988 tunnel4_out_src=0.0.0.0
6989 tunnel4_out_dst=1.1.1.1
6990 tunnel4_out_src_port=0
6991 tunnel4_out_dst_port=0
6992 tunnel4_out_tcp_flags=0
6993 tunnel4_out_tos=1
6994 tunnel_out_vni=456
6995 in_vlan=0
6996 in_priority=0
6997 out_vlan=0
6998 out_priority=0
6999 meanSkip=1
7000 samplePool=1
7001 dropEvents=0
7002 in_ifindex=0
7003 in_format=0
7004 out_ifindex=1
7005 out_format=2
7006 hdr_prot=1
7007 pkt_len=110
7008 stripped=4
7009 hdr_len=106
7010 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-08-00-45-01-00-5C-00-00-00-00-80-01-12-8A-0A-0A-0A-02-0A-0A-0A-01-08-00-13-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
7011 ])
7012
7013 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
7014 AT_CLEANUP
7015
7016 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
7017 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
7018
7019 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
7020
7021 dnl set up sFlow logging
7022 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
7023 AT_CAPTURE_FILE([sflow.log])
7024 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7025 ovs-appctl time/stop
7026
7027 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7028 AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
7029 AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
7030 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
7031 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
7032 options:ifindex=2011 ofport_request=5
7033 ], [0])
7034
7035 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
7036 dummy@ovs-dummy: hit:0 missed:0
7037 br0:
7038 br0 65534/100: (dummy-internal)
7039 p0 1/1: (dummy: ifindex=1010)
7040 int-br:
7041 int-br 65534/2: (dummy-internal)
7042 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
7043 vm1 5/3: (dummy: ifindex=2011)
7044 ])
7045
7046 dnl set up route to 1.1.2.92 via br0 and action=normal
7047 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
7048 ])
7049 AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
7050 ])
7051 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7052
7053 dnl Prime ARP Cache for 1.1.2.92
7054 AT_CHECK([ovs-appctl netdev-dummy/receive p0 'recirc_id(0),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
7055
7056 dnl configure sflow on int-br only
7057 ovs-vsctl \
7058 set Bridge int-br sflow=@sf -- \
7059 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7060 header=128 sampling=1 polling=0
7061
7062 dnl set up route to 192.168.1.2 via br0
7063 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
7064 ])
7065 AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
7066 ])
7067
7068 dnl add rule for int-br to force packet onto tunnel. There is no ifindex
7069 dnl for this port so the sFlow output will just report that it went to
7070 dnl 1 output (out_format=2, out_ifindex=1)
7071 AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
7072
7073 AT_CHECK([ovs-appctl netdev-dummy/receive vm1 'in_port(3),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=192.168.1.1,dst=192.168.2.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'])
7074
7075 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
7076 for i in `seq 1 30`; do
7077 ovs-appctl time/warp 100
7078 done
7079
7080 OVS_APP_EXIT_AND_WAIT([test-sflow])
7081
7082 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
7083 /g']], [0], [dnl
7084 HEADER
7085 dgramSeqNo=1
7086 ds=127.0.0.1>2:1000
7087 fsSeqNo=1
7088 tunnel4_out_length=0
7089 tunnel4_out_protocol=47
7090 tunnel4_out_src=1.1.2.88
7091 tunnel4_out_dst=1.1.2.92
7092 tunnel4_out_src_port=0
7093 tunnel4_out_dst_port=0
7094 tunnel4_out_tcp_flags=0
7095 tunnel4_out_tos=0
7096 tunnel_out_vni=456
7097 in_vlan=0
7098 in_priority=0
7099 out_vlan=0
7100 out_priority=0
7101 meanSkip=1
7102 samplePool=1
7103 dropEvents=0
7104 in_ifindex=2011
7105 in_format=0
7106 out_ifindex=1
7107 out_format=2
7108 hdr_prot=1
7109 pkt_len=110
7110 stripped=4
7111 hdr_len=106
7112 hdr=50-54-00-00-00-0A-50-54-00-00-00-05-08-00-45-00-00-5C-00-00-00-00-80-01-B6-4D-C0-A8-01-01-C0-A8-02-02-08-00-13-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
7113 ])
7114
7115 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
7116 AT_CLEANUP
7117
7118 AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
7119 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
7120 OVS_VSWITCHD_START
7121 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7122 add_of_ports br0 1 2
7123 AT_DATA([flows.txt], [dnl
7124 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,set_mpls_label:789,set_mpls_tc:4,set_mpls_ttl:32,2
7125 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
7126 ])
7127 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7128
7129 dnl set up sFlow logging
7130 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
7131 AT_CAPTURE_FILE([sflow.log])
7132 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7133 ovs-appctl time/stop
7134
7135 dnl configure sflow
7136 ovs-vsctl \
7137 set Bridge br0 sflow=@sf -- \
7138 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7139 header=128 sampling=1 polling=0
7140
7141 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)'])
7142 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)'])
7143
7144 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
7145 for i in `seq 1 30`; do
7146 ovs-appctl time/warp 100
7147 done
7148
7149 OVS_APP_EXIT_AND_WAIT([test-sflow])
7150
7151 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
7152 /g']], [0], [dnl
7153 HEADER
7154 dgramSeqNo=1
7155 ds=127.0.0.1>2:1000
7156 fsSeqNo=1
7157 mpls_label_0=789
7158 mpls_tc_0=4
7159 mpls_ttl_0=32
7160 mpls_bos_0=0
7161 mpls_label_1=11
7162 mpls_tc_1=3
7163 mpls_ttl_1=64
7164 mpls_bos_1=1
7165 in_vlan=0
7166 in_priority=0
7167 out_vlan=0
7168 out_priority=0
7169 meanSkip=1
7170 samplePool=1
7171 dropEvents=0
7172 in_ifindex=0
7173 in_format=0
7174 out_ifindex=1
7175 out_format=2
7176 hdr_prot=1
7177 pkt_len=22
7178 stripped=4
7179 hdr_len=18
7180 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40
7181 HEADER
7182 dgramSeqNo=1
7183 ds=127.0.0.1>2:1000
7184 fsSeqNo=2
7185 mpls_label_0=789
7186 mpls_tc_0=4
7187 mpls_ttl_0=32
7188 mpls_bos_0=1
7189 in_vlan=0
7190 in_priority=0
7191 out_vlan=0
7192 out_priority=0
7193 meanSkip=1
7194 samplePool=2
7195 dropEvents=0
7196 in_ifindex=0
7197 in_format=0
7198 out_ifindex=1
7199 out_format=2
7200 hdr_prot=1
7201 pkt_len=38
7202 stripped=4
7203 hdr_len=34
7204 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-08-00-45-00-00-14-00-00-00-00-00-00-BA-EB-00-00-00-00-00-00-00-00
7205 ])
7206
7207 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
7208 AT_CLEANUP
7209
7210
7211 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
7212 #
7213 # Test that basic NetFlow reports flow statistics correctly:
7214 # The initial packet of a flow are correctly accounted.
7215 # Later packets within a flow are correctly accounted.
7216 # Flow actions changing (in this case, due to MAC learning)
7217 # cause a record to be sent.
7218 m4_define([CHECK_NETFLOW_EXPIRATION],
7219 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
7220 add_of_ports br0 1 2
7221
7222 ovs-appctl time/stop
7223 on_exit 'kill `cat test-netflow.pid`'
7224 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
7225 AT_CAPTURE_FILE([netflow.log])
7226 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
7227
7228 ovs-vsctl \
7229 set Bridge br0 netflow=@nf -- \
7230 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
7231 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
7232
7233 for delay in 1000 30000; do
7234 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)'
7235 sleep 1 # ensure the order in which these two packets are processed
7236 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)'
7237
7238 ovs-appctl time/warp $delay
7239 done
7240
7241 ovs-appctl time/warp 6000
7242 ovs-appctl revalidator/wait
7243 OVS_VSWITCHD_STOP
7244 OVS_APP_EXIT_AND_WAIT([test-netflow])
7245
7246 AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 106 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
7247
7248 AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 2, 1 pkts, 106 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
7249
7250 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 212 bytes, ICMP 0:0" netflow.log | wc -l`
7251 separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 106 bytes, ICMP 0:0" netflow.log | wc -l`
7252 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
7253
7254 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
7255 CHECK_NETFLOW_EXPIRATION([127.0.0.1])
7256 AT_CLEANUP
7257
7258 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
7259 AT_SKIP_IF([test $HAVE_IPV6 = no])
7260 CHECK_NETFLOW_EXPIRATION([[[::1]]])
7261 AT_CLEANUP
7262
7263 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
7264 #
7265 # Test that basic NetFlow reports active expirations correctly.
7266 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
7267 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
7268 add_of_ports br0 1 2
7269
7270 on_exit 'kill `cat test-netflow.pid`'
7271 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
7272 AT_CAPTURE_FILE([netflow.log])
7273 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
7274
7275 ovs-vsctl \
7276 set Bridge br0 netflow=@nf -- \
7277 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
7278 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
7279
7280 AT_CHECK([ovs-appctl time/stop])
7281 n=1
7282 while test $n -le 60; do
7283 n=`expr $n + 1`
7284
7285 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)'
7286 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)'
7287
7288 ovs-appctl time/warp 1000
7289 done
7290
7291 ovs-appctl time/warp 10000
7292
7293 ovs-appctl revalidator/wait
7294 OVS_VSWITCHD_STOP
7295 OVS_APP_EXIT_AND_WAIT([test-netflow])
7296
7297 # Count the number of reported packets:
7298 # - From source to destination before MAC learning kicks in (just one).
7299 # - From source to destination after that.
7300 # - From destination to source.
7301 n_learn=0
7302 n_in=0
7303 n_out=0
7304 n_other=0
7305 n_recs=0
7306 none=0
7307 while read line; do
7308 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
7309 case $pkts in
7310 [[0-9]]*) ;;
7311 *) continue ;;
7312 esac
7313
7314 case $line in
7315 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
7316 counter=n_learn
7317 ;;
7318 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
7319 counter=n_in
7320 ;;
7321 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
7322 counter=n_out
7323 ;;
7324 *)
7325 counter=n_other
7326 ;;
7327 esac
7328 eval $counter=\`expr \$$counter + \$pkts\`
7329 n_recs=`expr $n_recs + 1`
7330 done < netflow.log
7331
7332 # There should be exactly 1 MAC learning packet,
7333 # exactly 59 other packets in that direction,
7334 # and exactly 60 packets in the other direction.
7335 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
7336 ])])
7337
7338 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
7339 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
7340 AT_CLEANUP
7341
7342 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
7343 AT_SKIP_IF([test $HAVE_IPV6 = no])
7344 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
7345 AT_CLEANUP
7346
7347 dnl In the absence of an IPFIX collector to verify protocol correctness, simply
7348 dnl configure bridge IPFIX and ensure that sample action generation works at the
7349 dnl datapath level.
7350 AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
7351 OVS_VSWITCHD_START
7352 add_of_ports br0 1 2
7353
7354 dnl Sample every packet using bridge-based sampling.
7355 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7356 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7357 sampling=1], [0], [ignore])
7358
7359 dnl Send some packets that should be sampled.
7360 for i in `seq 1 3`; do
7361 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)'])
7362 done
7363 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7364 flow-dump from the main thread:
7365 packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))
7366 ])
7367
7368 AT_CHECK([ovs-appctl revalidator/purge])
7369 dnl
7370 dnl Add a slowpath meter. The userspace action should be metered.
7371 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])
7372
7373 dnl Send some packets that should be sampled and metered.
7374 for i in `seq 1 3`; do
7375 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)'])
7376 done
7377 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7378 flow-dump from the main thread:
7379 packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))
7380 ])
7381
7382 dnl Remove the IPFIX configuration.
7383 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7384 AT_CHECK([ovs-appctl revalidator/purge])
7385
7386 dnl Send some more packets, to ensure that these are not sampled.
7387 for i in `seq 1 3`; do
7388 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)'])
7389 done
7390 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7391 flow-dump from the main thread:
7392 packets:2, bytes:68, used:0.001s, actions:drop
7393 ])
7394
7395 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7396 AT_CLEANUP
7397
7398 dnl Bridge IPFIX statistics check
7399 AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
7400 OVS_VSWITCHD_START
7401 add_of_ports br0 1 2
7402
7403 dnl Negative test check.
7404 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7405 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7406 NXST_IPFIX_BRIDGE request (xid=0x2):
7407 ])
7408
7409 dnl Sample every packet using bridge-based sampling.
7410 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7411 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7412 sampling=1], [0], [ignore])
7413
7414 dnl Send some packets that should be sampled.
7415 for i in `seq 1 20`; do
7416 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)'])
7417 done
7418
7419 dnl There are 4 extra IPFIX template packets.
7420 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0 | sed 's/tx pkts=[[0-9]]*/tx pkts=24/' | sed 's/tx errs=[[0-9]]*/tx errs=0/'], [0], [dnl
7421 NXST_IPFIX_BRIDGE reply (xid=0x2):
7422 bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7423 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
7424 ])
7425
7426 dnl Remove the IPFIX configuration.
7427 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7428 AT_CHECK([ovs-appctl revalidator/purge])
7429
7430 dnl Send some more packets, to ensure that these are not sampled.
7431 for i in `seq 1 2`; do
7432 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)'])
7433 done
7434 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7435 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7436 NXST_IPFIX_BRIDGE request (xid=0x2):
7437 ])
7438
7439 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7440 AT_CLEANUP
7441
7442 dnl Flow IPFIX sanity check
7443 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
7444 OVS_VSWITCHD_START
7445 add_of_ports br0 1 2
7446
7447 # Check for regression against a bug where an invalid target caused an
7448 # assertion failure and a crash.
7449 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7450 -- --id=@ipfix create IPFIX targets=\"xyzzy\" \
7451 -- --id=@cs create Flow_Sample_Collector_Set id=0 bridge=@br0 ipfix=@ipfix],
7452 [0], [ignore])
7453
7454 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7455 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7456 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7457 [0], [ignore])
7458
7459 AT_DATA([flows.txt], [dnl
7460 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7461 ])
7462
7463 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7464
7465 dnl Send some packets that should be sampled.
7466 for i in `seq 1 3`; do
7467 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)'])
7468 done
7469 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7470 flow-dump from the main thread:
7471 packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=4294967295)),2
7472 ])
7473
7474 dnl Remove the flow which contains sample action.
7475 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7476 AT_CHECK([ovs-appctl revalidator/purge])
7477
7478 dnl Send some more packets, to ensure that these are not sampled.
7479 for i in `seq 1 3`; do
7480 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)'])
7481 done
7482 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7483 flow-dump from the main thread:
7484 packets:2, bytes:68, used:0.001s, actions:drop
7485 ])
7486
7487 OVS_VSWITCHD_STOP(["/sending to collector failed/d
7488 /xyzzy/d
7489 /no collectors/d"])
7490 AT_CLEANUP
7491
7492 dnl Flow IPFIX sanity check for tunnel set
7493 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
7494 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
7495 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
7496 options:key=5 ofport_request=1\
7497 -- add-port br0 p2 -- set Interface p2 type=stt \
7498 options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
7499 options:key=6 ofport_request=2\
7500 -- add-port br0 p3 -- set Interface p3 type=dummy \
7501 ofport_request=3 \
7502 -- --id=@br0 get Bridge br0 \
7503 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7504 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7505 [<0>
7506 <1>
7507 ])
7508
7509 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
7510
7511 dnl Add openflow sample action without sampling_port.
7512 AT_DATA([flows.txt], [dnl
7513 in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
7514 ])
7515 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7516
7517 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7518 AT_CHECK([tail -1 stdout], [0], [dnl
7519 Datapath actions: userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=4294967295)),set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),1
7520 ])
7521
7522 dnl Remove the flow which contains sample action.
7523 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7524 AT_CHECK([ovs-appctl revalidator/purge])
7525
7526 dnl Add openflow sample action with sampling_port which is
7527 dnl equal to output port.
7528 AT_DATA([flows2.txt], [dnl
7529 in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
7530 ])
7531 AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
7532
7533 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7534 dnl Make sure flow sample action in datapath is behind set tunnel
7535 dnl action at egress point of tunnel port.
7536 AT_CHECK([tail -1 stdout], [0], [dnl
7537 Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=1),tunnel_out_port=1),1
7538 ])
7539
7540 dnl Remove the flow which contains sample action.
7541 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7542 AT_CHECK([ovs-appctl revalidator/purge])
7543
7544 dnl Add a rule with two sample actions and each sample action
7545 dnl has a sampling_port
7546 AT_DATA([flows3.txt], [dnl
7547 in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1,sample(probability=65535,collector_set_id=1,sampling_port=2),output:2
7548 ])
7549 AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
7550
7551 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7552 dnl Make sure flow sample action in datapath is behind set tunnel
7553 dnl action at egress point of tunnel port.
7554 AT_CHECK([tail -1 stdout], [0], [dnl
7555 Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=1),tunnel_out_port=1),1,set(tunnel(tun_id=0x6,src=2.2.2.3,dst=1.1.1.2,tos=0x1,ttl=64,tp_dst=7471,flags(df|key))),userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=7471),tunnel_out_port=7471),7471
7556 ])
7557
7558 dnl Remove the flow which contains sample action.
7559 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7560 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7561
7562 OVS_VSWITCHD_STOP
7563 AT_CLEANUP
7564
7565 AT_SETUP([ofproto-dpif - clone action])
7566 OVS_VSWITCHD_START
7567 add_of_ports br0 1 2 3 4
7568
7569 dnl Reversible open flow clone actions, no datapath clone action should be generated.
7570 AT_DATA([flows.txt], [dnl
7571 in_port=1, ip, actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(mod_dl_src:80:81:81:81:81:81,set_field:192.168.5.5->ip_dst,output:3),output:4
7572 ])
7573 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7574
7575 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7576
7577 AT_CHECK([tail -1 stdout], [0], [dnl
7578 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4
7579 ])
7580
7581 dnl Test flow xlate openflow clone action without using datapath clone action.
7582 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7583
7584 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7585
7586 AT_CHECK([tail -1 stdout], [0], [dnl
7587 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4
7588 ])
7589
7590 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7591 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7592
7593 AT_CHECK([tail -1 stdout], [0], [dnl
7594 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4
7595 ])
7596
7597 dnl Mixing reversible and irreversible open flow clone actions. Datapath clone action
7598 dnl should be generated when necessary.
7599
7600 dnl Restore the datapath support level.
7601 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone true], [0], [])
7602 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 10], [0], [])
7603
7604 AT_DATA([flows.txt], [dnl
7605 in_port=1, ip, actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(ct(commit),output:3),output:4
7606 ])
7607 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7608
7609 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7610
7611 AT_CHECK([tail -1 stdout], [0], [dnl
7612 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),clone(ct(commit),3),4
7613 ])
7614
7615 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7616
7617 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7618
7619 AT_CHECK([tail -1 stdout], [0], [dnl
7620 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),sample(sample=100.0%,actions(ct(commit),3)),4
7621 ])
7622
7623 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7624 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7625
7626 AT_CHECK([tail -1 stdout], [0], [dnl
7627 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),4
7628 ])
7629 AT_CHECK([grep "Failed to compose clone action" stdout], [0], [ignore])
7630
7631 OVS_VSWITCHD_STOP
7632 AT_CLEANUP
7633
7634 dnl Flow based IPFIX statistics check
7635 AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
7636 OVS_VSWITCHD_START
7637 add_of_ports br0 1 2
7638
7639 dnl Negative test check.
7640 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7641 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7642 NXST_IPFIX_FLOW request (xid=0x2):
7643 ])
7644
7645 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7646 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7647 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7648 [0], [ignore])
7649
7650 AT_DATA([flows.txt], [dnl
7651 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7652 ])
7653
7654 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7655
7656 dnl Send some packets that should be sampled.
7657 for i in `seq 1 20`; do
7658 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)'])
7659 done
7660
7661 dnl There are 4 extra IPFIX template packets.
7662 AT_CHECK([ovs-ofctl dump-ipfix-flow br0 | sed 's/tx pkts=[[0-9]]*/tx pkts=24/' | sed 's/tx errs=[[0-9]]*/tx errs=0/'], [0], [dnl
7663 NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
7664 id 1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7665 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
7666 ])
7667
7668 dnl Remove the flow which contains sample action.
7669 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7670 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7671 AT_CHECK([ovs-appctl revalidator/purge])
7672
7673 dnl Send some more packets, to ensure that these are not sampled.
7674 for i in `seq 1 3`; do
7675 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)'])
7676 done
7677 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7678 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7679 NXST_IPFIX_FLOW request (xid=0x2):
7680 ])
7681
7682 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7683 AT_CLEANUP
7684
7685 AT_SETUP([ofproto-dpif - flow stats])
7686 OVS_VSWITCHD_START
7687 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7688 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7689
7690 ovs-appctl time/stop
7691
7692 for i in `seq 1 10`; do
7693 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)'
7694 done
7695
7696 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7697 AT_CHECK([ovs-appctl revalidator/purge], [0])
7698 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7699 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
7700 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
7701 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
7702 ])
7703 OVS_VSWITCHD_STOP
7704 AT_CLEANUP
7705
7706 AT_SETUP([ofproto-dpif - flow stats reset_counts])
7707 OVS_VSWITCHD_START
7708 flow="ip,actions=NORMAL"
7709
7710 ovs-appctl time/stop
7711
7712 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7713
7714 warp_and_dump_NXM () {
7715 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7716 AT_CHECK([ovs-appctl revalidator/purge], [0])
7717
7718 AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0], [0], [stdout])
7719 if [[ $5 -gt 0 ]]; then
7720 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, hard_age=$5, ip actions=NORMAL"
7721 else
7722 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, ip actions=NORMAL"
7723 fi
7724 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7725 $expected
7726 ])
7727 }
7728
7729 warp_and_dump_OF () {
7730 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7731 AT_CHECK([ovs-appctl revalidator/purge], [0])
7732
7733 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0], [0], [stdout])
7734 if [[ $1 -lt 13 -o "$5X" = "X" ]]; then
7735 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, ip actions=NORMAL"
7736 else
7737 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $5 ip actions=NORMAL"
7738 fi
7739 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7740 $expected
7741 ])
7742 }
7743
7744 send_packet () {
7745 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)'
7746 }
7747
7748 # OpenFlow 1.0, implicit reset_counts
7749 send_packet
7750 warp_and_dump_NXM 1 1 118 1
7751 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 add-flow br0 $flow])
7752 # add-flow resets duration and counts,
7753 # but idle age is inherited from the old flow
7754 warp_and_dump_NXM 1 0 0 2
7755
7756 send_packet
7757 warp_and_dump_NXM 2 1 118 1
7758 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 mod-flows br0 $flow])
7759 # mod-flows resets hard_age, but not counts
7760 # but duration and idle_age is inherited from the old flow
7761 warp_and_dump_NXM 3 1 118 2 1
7762
7763 # OpenFlow 1.1, implicit reset_counts
7764 send_packet
7765 warp_and_dump_OF 11 4 2 236
7766 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 add-flow br0 $flow])
7767 # add-flow resets duration and counts,
7768 # but idle age is inherited from the old flow
7769 warp_and_dump_NXM 1 0 0 2
7770 warp_and_dump_OF 11 2 0 0
7771
7772 send_packet
7773 warp_and_dump_OF 11 3 1 118
7774 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 mod-flows br0 $flow])
7775 # mod-flows resets hard_age, but not counts
7776 # but duration and idle_age is inherited from the old flow
7777 warp_and_dump_NXM 4 1 118 2 1
7778 warp_and_dump_OF 11 5 1 118
7779
7780 # OpenFlow 1.2, explicit reset_counts
7781 send_packet
7782 warp_and_dump_OF 12 6 2 236
7783 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 $flow])
7784 # add-flow without flags resets duration, but not counts,
7785 # idle age is inherited from the old flow
7786 warp_and_dump_NXM 1 2 236 2
7787 warp_and_dump_OF 12 2 2 236
7788
7789 send_packet
7790 warp_and_dump_OF 12 3 3 354
7791 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 $flow])
7792 # mod-flows without flags does not reset duration nor counts,
7793 # idle age is inherited from the old flow
7794 warp_and_dump_NXM 4 3 354 2 1
7795 warp_and_dump_OF 12 5 3 354
7796
7797 send_packet
7798 warp_and_dump_OF 12 6 4 472
7799 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 reset_counts,$flow])
7800 # add-flow with reset_counts resets both duration and counts,
7801 # idle age is inherited from the old flow
7802 warp_and_dump_NXM 1 0 0 2
7803 warp_and_dump_OF 12 2 0 0
7804
7805 send_packet
7806 warp_and_dump_OF 12 3 1 118
7807 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 reset_counts,$flow])
7808 # mod-flows with reset_counts resets counts, but not duration,
7809 # idle age is inherited from the old flow
7810 warp_and_dump_NXM 4 0 0 2 1
7811 warp_and_dump_OF 12 5 0 0
7812
7813 # OpenFlow > 1.3, explicit reset_counts
7814 flow_mods_reset_counts () {
7815 # Reset to a known state
7816 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7817
7818 send_packet
7819 warp_and_dump_OF $1 1 1 118 reset_counts
7820 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7821 # add-flow without flags resets duration, but not counts,
7822 # idle age is inherited from the old flow
7823 warp_and_dump_NXM 1 1 118 2
7824 warp_and_dump_OF $1 2 1 118
7825
7826 send_packet
7827 warp_and_dump_OF $1 3 2 236
7828 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7829 # mod-flows without flags does not reset duration nor counts,
7830 # idle age is inherited from the old flow
7831 warp_and_dump_NXM 4 2 236 2 1
7832 warp_and_dump_OF $1 5 2 236
7833
7834 send_packet
7835 warp_and_dump_OF $1 6 3 354
7836 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7837 # add-flow with reset_counts resets both duration and counts,
7838 # idle age is inherited from the old flow
7839 warp_and_dump_NXM 1 0 0 2
7840 warp_and_dump_OF $1 2 0 0 reset_counts
7841
7842 send_packet
7843 warp_and_dump_OF $1 3 1 118 reset_counts
7844 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7845 # mod-flows with reset_counts resets counts, but not duration,
7846 # idle age is inherited from the old flow
7847 warp_and_dump_NXM 4 0 0 2 1
7848 warp_and_dump_OF $1 5 0 0 reset_counts
7849
7850 # Modify flow having reset_counts flag without reset_counts
7851 send_packet
7852 warp_and_dump_OF $1 6 1 118 reset_counts
7853 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7854 warp_and_dump_NXM 7 1 118 2 1
7855 warp_and_dump_OF $1 8 1 118 reset_counts
7856
7857 # Add flow having reset_counts flag without reset_counts
7858 send_packet
7859 warp_and_dump_OF $1 9 2 236 reset_counts
7860 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7861 warp_and_dump_NXM 1 2 236 2
7862 warp_and_dump_OF $1 2 2 236
7863
7864 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7865 send_packet
7866 warp_and_dump_OF $1 3 3 354
7867 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7868 warp_and_dump_NXM 4 0 0 2 1
7869 warp_and_dump_OF $1 5 0 0
7870 }
7871
7872 # OpenFlow versions >= 1.3 should behave the same way
7873 flow_mods_reset_counts 13
7874 flow_mods_reset_counts 14
7875
7876 OVS_VSWITCHD_STOP
7877 AT_CLEANUP
7878
7879 AT_SETUP([ofproto-dpif - flow stats reset_counts OpenFlow1.5])
7880 OVS_VSWITCHD_START
7881 flow="ip,actions=NORMAL"
7882
7883 ovs-appctl time/stop
7884
7885 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7886
7887 warp_and_dump_OF () {
7888 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7889 AT_CHECK([ovs-appctl revalidator/purge], [0])
7890
7891 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0 ], [0], [stdout])
7892 if [[ "$6X" = "X" ]]; then
7893 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, idle_age=$5, ip actions=NORMAL"
7894 else
7895 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $6 idle_age=$5, ip actions=NORMAL"
7896 fi
7897 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7898 $expected
7899 ])
7900 }
7901
7902 send_packet () {
7903 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)'
7904 }
7905
7906 # OpenFlow 1.5, explicit reset_counts
7907 flow_mods_reset_counts () {
7908 # Reset to a known state
7909 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7910
7911 send_packet
7912 warp_and_dump_OF $1 1 1 118 1 reset_counts
7913 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7914 # add-flow without flags resets duration, but not counts,
7915 # idle age is inherited from the old flow
7916 warp_and_dump_OF $1 1 1 118 2
7917
7918 send_packet
7919 warp_and_dump_OF $1 2 2 236 1
7920 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7921 # mod-flows without flags does not reset duration nor counts,
7922 # idle age is inherited from the old flow
7923 warp_and_dump_OF $1 3 2 236 2
7924
7925 send_packet
7926 warp_and_dump_OF $1 4 3 354 1
7927 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7928 # add-flow with reset_counts resets both duration and counts,
7929 # idle age is inherited from the old flow
7930 warp_and_dump_OF $1 1 0 0 2 reset_counts
7931
7932 send_packet
7933 warp_and_dump_OF $1 2 1 118 1 reset_counts
7934 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7935 # mod-flows with reset_counts resets counts, but not duration,
7936 # idle age is inherited from the old flow
7937 warp_and_dump_OF $1 3 0 0 2 reset_counts
7938
7939 # Modify flow having reset_counts flag without reset_counts
7940 send_packet
7941 warp_and_dump_OF $1 4 1 118 1 reset_counts
7942 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7943 warp_and_dump_OF $1 5 1 118 2 reset_counts
7944
7945 # Add flow having reset_counts flag without reset_counts
7946 send_packet
7947 warp_and_dump_OF $1 6 2 236 1 reset_counts
7948 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7949 warp_and_dump_OF $1 1 2 236 2
7950
7951 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7952 send_packet
7953 warp_and_dump_OF $1 2 3 354 1
7954 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7955 warp_and_dump_OF $1 3 0 0 2
7956 }
7957
7958 # OpenFlow versions >= 1.3 should behave the same way
7959 flow_mods_reset_counts 15
7960
7961 OVS_VSWITCHD_STOP
7962 AT_CLEANUP
7963
7964
7965 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
7966 OVS_VSWITCHD_START
7967 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7968 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7969
7970 ovs-appctl time/stop
7971
7972 for i in `seq 1 10`; do
7973 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)'
7974 done
7975
7976 ovs-appctl time/warp 100
7977 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
7978 ovs-appctl time/warp 1000
7979
7980 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7981 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
7982 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
7983 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
7984 ])
7985 OVS_VSWITCHD_STOP
7986 AT_CLEANUP
7987
7988 AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
7989 OVS_VSWITCHD_START
7990
7991 # get_ages DURATION HARD IDLE
7992 #
7993 # Fetch the flow duration, hard age, and idle age into the variables
7994 # whose names are given as arguments. Rounds DURATION down to the
7995 # nearest integer. If hard_age doesn't appear in the output, sets
7996 # HARD to "none". If idle_age doesn't appear in the output, sets IDLE
7997 # to 0.
7998 get_ages () {
7999 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8000
8001 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
8002 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
8003 AS_VAR_COPY([$1], [duration])
8004
8005 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
8006 if test X"$hard" = X; then
8007 hard=none
8008 else
8009 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
8010 fi
8011 AS_VAR_COPY([$2], [hard])
8012
8013 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
8014 if test X"$idle" = X; then
8015 idle=0
8016 else
8017 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
8018 fi
8019 AS_VAR_COPY([$3], [idle])
8020 }
8021
8022 # Add a flow and get its initial hard and idle age.
8023 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
8024 get_ages duration1 hard1 idle1
8025
8026 ovs-appctl time/stop
8027 # Warp time forward by 10 seconds, then modify the flow's actions.
8028 ovs-appctl time/warp 10000
8029 get_ages duration2 hard2 idle2
8030 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
8031
8032 # Warp time forward by 10 seconds.
8033 ovs-appctl time/warp 10000
8034 get_ages duration3 hard3 idle3
8035
8036 # Warp time forward 10 more seconds, then pass some packets through the flow,
8037 # then warp forward a few more times because idle times are only updated
8038 # occasionally.
8039 ovs-appctl time/warp 10000
8040 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)'
8041 ovs-appctl time/warp 3000 1000
8042 sleep 1
8043 get_ages duration4 hard4 idle4
8044
8045 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
8046 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
8047 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
8048
8049 # Duration should increase steadily over time.
8050 AT_CHECK([test $duration1 -lt $duration2])
8051 AT_CHECK([test $duration2 -lt $duration3])
8052 AT_CHECK([test $duration3 -lt $duration4])
8053
8054 # Hard age should be "none" initially because it's the same as flow_duration,
8055 # then it should increase.
8056 AT_CHECK([test $hard1 = none])
8057 AT_CHECK([test $hard2 = none])
8058 AT_CHECK([test $hard3 != none])
8059 AT_CHECK([test $hard4 != none])
8060 AT_CHECK([test $hard3 -lt $hard4])
8061
8062 # Idle age should increase from 1 to 2 to 3, then decrease.
8063 AT_CHECK([test $idle1 -lt $idle2])
8064 AT_CHECK([test $idle2 -lt $idle3])
8065 AT_CHECK([test $idle3 -gt $idle4])
8066
8067 # Check some invariant relationships.
8068 AT_CHECK([test $duration1 = $idle1])
8069 AT_CHECK([test $duration2 = $idle2])
8070 AT_CHECK([test $duration3 = $idle3])
8071 AT_CHECK([test $idle3 -gt $hard3])
8072 AT_CHECK([test $idle4 -lt $hard4])
8073 AT_CHECK([test $hard4 -lt $duration4])
8074
8075 OVS_VSWITCHD_STOP
8076 AT_CLEANUP
8077
8078 AT_SETUP([ofproto-dpif - fin_timeout])
8079 OVS_VSWITCHD_START
8080 ovs-appctl time/stop
8081 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
8082 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
8083 [NXST_FLOW reply:
8084 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
8085 ])
8086
8087 # Check that a TCP SYN packet does not change the timeout. (Because
8088 # flow stats updates are mainly what implements the fin_timeout
8089 # feature, we warp forward a couple of times to ensure that flow stats
8090 # run before re-checking the flow table.)
8091 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
8092 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
8093 warped
8094 ])
8095 AT_CHECK([ovs-appctl revalidator/purge], [0])
8096 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
8097 [NXST_FLOW reply:
8098 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
8099 ])
8100 # Check that a TCP FIN packet does change the timeout.
8101 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
8102 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
8103 warped
8104 ])
8105 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
8106 [NXST_FLOW reply:
8107 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
8108 ])
8109 OVS_VSWITCHD_STOP
8110 AT_CLEANUP
8111
8112 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
8113 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
8114 add_of_ports br0 1 2
8115 add_of_ports br1 3
8116
8117 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
8118 dummy@br0
8119 dummy@br1
8120 ])
8121 OVS_VSWITCHD_STOP
8122 AT_CLEANUP
8123
8124 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
8125 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
8126 [--dummy-numa="0,0,0,0,1,1,1,1"])
8127 add_pmd_of_ports br0 1 2
8128 add_of_ports br1 3
8129
8130 AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
8131 dummy@ovs-dummy: hit:0 missed:0
8132 br0:
8133 br0 65534/100: (dummy-internal)
8134 p1 1/1: (dummy-pmd: <cleared>)
8135 p2 2/2: (dummy-pmd: <cleared>)
8136 br1:
8137 br1 65534/101: (dummy-internal)
8138 p3 3/3: (dummy)
8139 ])
8140 OVS_VSWITCHD_STOP
8141 AT_CLEANUP
8142
8143 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
8144 # bump max-idle to avoid the flows being reclaimed behind us
8145 OVS_VSWITCHD_START([add-br br1 -- \
8146 set bridge br1 datapath-type=dummy fail-mode=secure -- \
8147 set Open_vSwitch . other_config:max-idle=10000], [], [],
8148 [--dummy-numa="0,0,0,0,1,1,1,1"])
8149 add_of_ports br0 1
8150 add_pmd_of_ports br0 2
8151 add_of_ports br1 3
8152
8153 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)'])
8154 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)'])
8155 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)'])
8156 ovs-appctl revalidator/wait
8157 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8158 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
8159 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
8160 ])
8161
8162 AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
8163 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
8164 ])
8165
8166 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
8167 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),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),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
8168 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p2),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),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),icmp(type=0/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
8169 ])
8170
8171 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
8172 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),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),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
8173 ])
8174
8175 OVS_VSWITCHD_STOP
8176 AT_CLEANUP
8177
8178 m4_define([OFPROTO_DPIF_GET_FLOW],
8179 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
8180
8181 OVS_VSWITCHD_START([add-br br1 -- \
8182 set bridge br1 datapath-type=dummy fail-mode=secure -- \
8183 set Open_vSwitch . other_config:max-idle=10000], [], [],
8184 [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8185
8186 func=`printf '%s_' "$1" | cut -c 4-`
8187 add_${func}of_ports br0 1 2
8188
8189 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)'])
8190 ovs-appctl revalidator/wait
8191 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
8192
8193 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
8194 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
8195 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
8196 ])
8197
8198 OVS_VSWITCHD_STOP
8199 AT_CLEANUP])
8200
8201 OFPROTO_DPIF_GET_FLOW([])
8202 OFPROTO_DPIF_GET_FLOW([ - pmd])
8203
8204 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
8205 OVS_VSWITCHD_START([dnl
8206 add-port br0 p1 -- set Interface p1 type=dummy
8207 ])
8208 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8209 on_exit 'kill `cat ovs-ofctl.pid`'
8210
8211 AT_CAPTURE_FILE([ofctl_monitor.log])
8212 AT_DATA([flows.txt], [dnl
8213 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
8214 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8215 ])
8216 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8217
8218 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
8219 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
8220 dnl
8221 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
8222 dnl 60:66:66:66:66:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 74: MPLS (label 20, exp 0, ttl 32)
8223 dnl (label 20, exp 0, [S], ttl 32)
8224 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
8225 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
8226
8227 for dl_src in 00 01; do
8228 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "505400000007 6066666666$dl_src 8847 00014020 00014120 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"])
8229 done
8230 sleep 1 # wait for the datapath flow installed
8231 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8232 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:00),eth_type(0x8847),mpls(label=20,tc=0,ttl=32,bos=0,label=20,tc=0,ttl=32,bos=1), actions:push_mpls(label=20,tc=0,ttl=32,bos=0,eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
8233 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:01),eth_type(0x8847),mpls(label=20/0x0,tc=0/0,ttl=32/0x0,bos=0/1,label=20/0xfffff,tc=0/7,ttl=32/0xff,bos=1/1), actions:pop_mpls(eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
8234 ])
8235
8236 OVS_VSWITCHD_STOP
8237 AT_CLEANUP
8238
8239
8240 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
8241 OVS_VSWITCHD_START([dnl
8242 add-port br0 p1 -- set Interface p1 type=dummy
8243 ])
8244 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8245 on_exit 'kill `cat ovs-ofctl.pid`'
8246
8247 AT_CAPTURE_FILE([ofctl_monitor.log])
8248 AT_DATA([flows.txt], [dnl
8249 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
8250 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8251 ])
8252 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8253
8254 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
8255 dnl 4 MPLS LSEs but ovs-vswitchd can only handle up to 3 MPLS LSEs and thus
8256 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
8257 dnl
8258 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
8259 dnl 60:66:66:66:66:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 74: MPLS (label 20, exp 0, ttl 32)
8260 dnl (label 20, exp 0, ttl 32)
8261 dnl (label 20, exp 0, ttl 32)
8262 dnl (label 20, exp 0, [S], ttl 32)
8263 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
8264 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
8265
8266 for dl_src in 00 01; do
8267 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "505400000007 6066666666$dl_src 8847 00014020 00014120 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"])
8268 done
8269 sleep 1 # wait for the datapath flow installed
8270 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8271 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:00),eth_type(0x8847),mpls(label=20,tc=0,ttl=32,bos=0,label=20,tc=0,ttl=32,bos=1), actions:push_mpls(label=20,tc=0,ttl=32,bos=0,eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
8272 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:01),eth_type(0x8847),mpls(label=20/0x0,tc=0/0,ttl=32/0x0,bos=0/1,label=20/0xfffff,tc=0/7,ttl=32/0xff,bos=1/1), actions:pop_mpls(eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
8273 ])
8274
8275 OVS_VSWITCHD_STOP
8276 AT_CLEANUP
8277
8278 AT_SETUP([ofproto-dpif - patch ports])
8279 OVS_VSWITCHD_START([add-br br1 \
8280 -- set bridge br1 datapath-type=dummy fail-mode=secure \
8281 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
8282 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
8283
8284 add_of_ports br0 2
8285 add_of_ports br1 3
8286
8287 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8288 ], [])
8289 AT_CHECK([ovs-appctl time/stop])
8290 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8291
8292 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
8293 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
8294
8295 for i in $(seq 1 10); do
8296 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)'
8297 if [[ $i -eq 1 ]]; then
8298 sleep 1
8299 fi
8300 done
8301
8302 for i in $(seq 1 5); do
8303 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)'
8304 if [[ $i -eq 1 ]]; then
8305 sleep 1
8306 fi
8307 done
8308
8309 AT_CHECK([ovs-appctl time/warp 500], [0],
8310 [warped
8311 ])
8312 sleep 1 # wait for log writer
8313
8314 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
8315 dummy@ovs-dummy: hit:13 missed:2
8316 br0:
8317 br0 65534/100: (dummy-internal)
8318 p2 2/2: (dummy)
8319 pbr0 1/none: (patch: peer=pbr1)
8320 br1:
8321 br1 65534/101: (dummy-internal)
8322 p3 3/3: (dummy)
8323 pbr1 1/none: (patch: peer=pbr0)
8324 ])
8325
8326 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8327 recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
8328 recirc_id(0),in_port(101),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
8329 ])
8330
8331 AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
8332 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(100),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),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),icmp(type=8/0,code=0/0), packets:9, bytes:954, used:0.0s, actions:101,3,2
8333 ])
8334 AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
8335 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(101),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),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),icmp(type=8/0,code=0/0), packets:4, bytes:424, used:0.0s, actions:100,2,3
8336 ])
8337
8338 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
8339 OFPST_PORT reply (xid=0x4): 1 ports
8340 port 1: rx pkts=5, bytes=530, drop=?, errs=?, frame=?, over=?, crc=?
8341 tx pkts=10, bytes=1060, drop=?, errs=?, coll=?
8342 ])
8343
8344 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
8345 OFPST_PORT reply (xid=0x4): 1 ports
8346 port 1: rx pkts=10, bytes=1060, drop=?, errs=?, frame=?, over=?, crc=?
8347 tx pkts=5, bytes=530, drop=?, errs=?, coll=?
8348 ])
8349
8350 OVS_VSWITCHD_STOP
8351 AT_CLEANUP
8352
8353 AT_SETUP([ofproto-dpif - patch ports - stack])
8354 OVS_VSWITCHD_START([add-br br1 \
8355 -- set bridge br1 datapath-type=dummy fail-mode=secure \
8356 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
8357 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
8358
8359 add_of_ports br0 2
8360 add_of_ports br1 3
8361
8362 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8363 ], [])
8364 AT_CHECK([ovs-appctl time/stop])
8365 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8366
8367 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=push:OXM_OF_IN_PORT[[0..31]],output:1,pop:OXM_OF_IPV4_SRC[[0..31]],output:2"])
8368 # Try to pop from empty stack, and push and leave data to stack.
8369 AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
8370
8371 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)'
8372
8373 AT_CHECK([ovs-appctl time/warp 500], [0],
8374 [warped
8375 ])
8376
8377 OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
8378
8379 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
8380 dummy@ovs-dummy: hit:0 missed:1
8381 br0:
8382 br0 65534/100: (dummy-internal)
8383 p2 2/2: (dummy)
8384 pbr0 1/none: (patch: peer=pbr1)
8385 br1:
8386 br1 65534/101: (dummy-internal)
8387 p3 3/3: (dummy)
8388 pbr1 1/none: (patch: peer=pbr0)
8389 ])
8390
8391 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8392 recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:101,set(ipv4(src=255.255.255.254)),2
8393 ])
8394
8395 AT_CHECK([grep -e '|ofproto_dpif_xlate|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
8396 stack underflow on bridge br1 while processing icmp,in_port=LOCAL,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,icmp_type=8,icmp_code=0
8397 ])
8398
8399 OVS_VSWITCHD_STOP(["/stack underflow/d"])
8400 AT_CLEANUP
8401
8402 AT_SETUP([ofproto-dpif - port duration])
8403 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
8404 add_of_ports br0 1 2
8405
8406 ovs-appctl time/stop
8407 ovs-appctl time/warp 10000
8408
8409 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
8410 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
8411 [dnl
8412 duration=?s
8413 duration=?s
8414 duration=?s
8415 ])
8416 OVS_VSWITCHD_STOP
8417 AT_CLEANUP
8418
8419 dnl ----------------------------------------------------------------------
8420 AT_BANNER([ofproto-dpif -- megaflows])
8421
8422 AT_SETUP([ofproto-dpif megaflow - port classification])
8423 OVS_VSWITCHD_START
8424 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8425 add_of_ports br0 1 2
8426 AT_DATA([flows.txt], [dnl
8427 table=0 in_port=1 actions=output(2)
8428 ])
8429 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8430 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)'])
8431 sleep 1
8432 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)'])
8433 sleep 1
8434 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8435 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8436 ])
8437 OVS_VSWITCHD_STOP
8438 AT_CLEANUP
8439
8440 AT_SETUP([ofproto-dpif megaflow - L2 classification])
8441 OVS_VSWITCHD_START
8442 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8443 add_of_ports br0 1 2
8444 AT_DATA([flows.txt], [dnl
8445 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
8446 ])
8447 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8448 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)'])
8449 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)'])
8450 sleep 1
8451 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8452 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8453 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
8454 ])
8455 OVS_VSWITCHD_STOP
8456 AT_CLEANUP
8457
8458 AT_SETUP([ofproto-dpif megaflow - L3 classification])
8459 OVS_VSWITCHD_START
8460 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8461 add_of_ports br0 1 2
8462 AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=nw_dst,nw_src], [0], [ignore], [])
8463 AT_DATA([flows.txt], [dnl
8464 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
8465 ])
8466 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8467 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)'])
8468 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)'])
8469 sleep 1
8470 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8471 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
8472 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,frag=no), actions: <del>
8473 ])
8474 OVS_VSWITCHD_STOP
8475 AT_CLEANUP
8476
8477 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
8478 OVS_VSWITCHD_START
8479 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8480 add_of_ports br0 1 2
8481 AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=ipv6_dst,ipv6_src], [0], [ignore], [])
8482 AT_DATA([flows.txt], [dnl
8483 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
8484 ])
8485 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8486 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5,dst=fe80::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)'])
8487 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(0x86dd),ipv6(src=2001:db8:3c4d:5:4:3:2:1,dst=2001:db8:3c4d:1:2:3:4:1,label=0,proto=99,tclass=0x70,hlimit=64,frag=no)'])
8488 sleep 1
8489 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8490 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5,frag=no), actions: <del>
8491 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:5:4:3:2:1/ffff:ffff:ffff:fffc::,frag=no), actions: <del>
8492 ])
8493 OVS_VSWITCHD_STOP
8494 AT_CLEANUP
8495
8496 AT_SETUP([ofproto-dpif megaflow - L4 classification])
8497 OVS_VSWITCHD_START
8498 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8499 add_of_ports br0 1 2
8500 AT_DATA([flows.txt], [dnl
8501 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
8502 ])
8503 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8504 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)'])
8505 sleep 1
8506 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)'])
8507 sleep 1
8508 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8509 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=1,frag=no),icmp(type=8), actions: <del>
8510 ])
8511 OVS_VSWITCHD_STOP
8512 AT_CLEANUP
8513
8514 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
8515 [AT_SETUP([ofproto-dpif megaflow - normal$1])
8516 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8517 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8518 func=`printf '%s_' "$1" | cut -c 4-`
8519 add_${func}of_ports br0 1 2
8520 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8521 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)'])
8522 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)'])
8523 sleep 1
8524 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8525 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8526 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
8527 ])
8528 OVS_VSWITCHD_STOP
8529 AT_CLEANUP])
8530
8531 OFPROTO_DPIF_MEGAFLOW_NORMAL([])
8532 OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
8533
8534 AT_SETUP([ofproto-dpif megaflow - mpls])
8535 OVS_VSWITCHD_START
8536 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8537 add_of_ports br0 1 2
8538 AT_DATA([flows.txt], [dnl
8539 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
8540 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
8541 ])
8542 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8543 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)'])
8544 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)'])
8545 sleep 1
8546 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
8547 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1), actions:push_mpls(label=11,tc=3,ttl=64,bos=0,eth_type=0x8847),2
8548 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x8847),mpls(label=11/0x0,tc=3/0,ttl=64/0x0,bos=1/1), actions:pop_mpls(eth_type=0x800),2
8549 ])
8550 OVS_VSWITCHD_STOP
8551 AT_CLEANUP
8552
8553 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
8554 m4_define([CHECK_MEGAFLOW_NETFLOW],
8555 [OVS_VSWITCHD_START
8556 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8557 add_of_ports br0 1 2
8558
8559 dnl NetFlow configuration disables wildcarding relevant fields
8560 on_exit 'kill `cat test-netflow.pid`'
8561 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
8562 AT_CAPTURE_FILE([netflow.log])
8563 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
8564 ovs-vsctl \
8565 set Bridge br0 netflow=@nf -- \
8566 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
8567 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
8568
8569 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8570 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)'])
8571 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)'])
8572 sleep 1
8573 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8574 recirc_id(0),in_port(1),packet_type(ns=0,id=0),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/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
8575 recirc_id(0),in_port(1),packet_type(ns=0,id=0),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/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
8576 ])
8577 OVS_APP_EXIT_AND_WAIT([test-netflow])
8578 OVS_VSWITCHD_STOP])
8579
8580 AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
8581 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
8582 AT_CLEANUP
8583
8584 AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
8585 AT_SKIP_IF([test $HAVE_IPV6 = no])
8586 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
8587 AT_CLEANUP
8588
8589 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
8590 [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
8591 OVS_VSWITCHD_START(
8592 [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
8593 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
8594 set interface p2 type=$1 ofport_request=2 -- \
8595 set interface p3 type=$1 ofport_request=3], [], [],
8596 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
8597 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8598 ])
8599 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8600
8601 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8602 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)'])
8603 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)'])
8604 sleep 1
8605 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8606 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8607 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
8608 ])
8609 OVS_VSWITCHD_STOP
8610 AT_CLEANUP])
8611
8612 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
8613 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
8614
8615 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
8616 OVS_VSWITCHD_START(
8617 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
8618 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
8619 set interface p2 type=dummy ofport_request=2 -- \
8620 set interface p3 type=dummy ofport_request=3])
8621 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8622 ])
8623 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8624
8625 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8626 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)'])
8627 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)'])
8628 sleep 1
8629 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8630 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8631 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
8632 ])
8633 OVS_VSWITCHD_STOP
8634 AT_CLEANUP
8635
8636 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
8637 # Create bond0 on br0 with members p0 and p1
8638 # and bond1 on br1 with members p2 and p3
8639 # with p0 patched to p2 and p1 patched to p3.
8640 OVS_VSWITCHD_START(
8641 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
8642 other-config:lacp-time=fast \
8643 other-config:bond-rebalance-interval=0 -- \
8644 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
8645 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
8646 add-br br1 -- \
8647 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
8648 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
8649 fail-mode=secure -- \
8650 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
8651 other-config:lacp-time=fast \
8652 other-config:bond-rebalance-interval=0 -- \
8653 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
8654 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
8655
8656 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8657 ])
8658 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8659 add_of_ports br0 7
8660 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8661 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
8662 ovs-appctl time/stop
8663 ovs-appctl time/warp 5000
8664 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)'])
8665 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)'])
8666 sleep 1
8667 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8668 recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8669 recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
8670 ])
8671 OVS_VSWITCHD_STOP
8672 AT_CLEANUP
8673
8674 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
8675 OVS_VSWITCHD_START
8676 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8677 add_of_ports br0 1 2
8678 AT_DATA([flows.txt], [dnl
8679 table=0 in_port=1,ip actions=resubmit(90)
8680 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
8681 ])
8682 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8683 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)'])
8684 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)'])
8685 sleep 1
8686 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8687 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8688 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
8689 ])
8690 OVS_VSWITCHD_STOP
8691 AT_CLEANUP
8692
8693 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
8694 OVS_VSWITCHD_START
8695 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8696 add_of_ports br0 1 2
8697 AT_DATA([flows.txt], [dnl
8698 table=0 in_port=1,ip actions=resubmit(,1)
8699 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8700 ])
8701 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8702 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)'])
8703 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=
8704 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8705 sleep 1
8706 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8707 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8708 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
8709 ])
8710 OVS_VSWITCHD_STOP
8711 AT_CLEANUP
8712
8713 AT_SETUP([ofproto-dpif megaflow - goto_table action])
8714 OVS_VSWITCHD_START
8715 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8716 add_of_ports br0 1 2
8717 AT_DATA([flows.txt], [dnl
8718 table=0 in_port=1,ip actions=goto_table(1)
8719 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8720 ])
8721 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
8722 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)'])
8723 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)'])
8724 sleep 1
8725 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8726 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8727 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
8728 ])
8729 OVS_VSWITCHD_STOP
8730 AT_CLEANUP
8731
8732 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
8733 AT_KEYWORDS([mirror mirrors mirroring])
8734 OVS_VSWITCHD_START
8735 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8736 add_of_ports br0 1 2 3
8737 ovs-vsctl \
8738 set Bridge br0 mirrors=@m --\
8739 --id=@p3 get Port p3 --\
8740 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
8741
8742 AT_DATA([flows.txt], [dnl
8743 in_port=1 actions=output:2
8744 ])
8745 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8746 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)'])
8747 sleep 1
8748 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)'])
8749 sleep 1
8750 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8751 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8752 ])
8753 OVS_VSWITCHD_STOP
8754 AT_CLEANUP
8755
8756 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
8757 OVS_VSWITCHD_START
8758 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8759 add_of_ports br0 1 2 3
8760 ovs-vsctl \
8761 set Bridge br0 mirrors=@m --\
8762 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
8763 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
8764
8765 AT_DATA([flows.txt], [dnl
8766 in_port=1 actions=output:2
8767 ])
8768 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8769 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))'])
8770 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)'])
8771 sleep 1
8772 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8773 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8774 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=11,pcp=7/0x0),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
8775 ])
8776 OVS_VSWITCHD_STOP
8777 AT_CLEANUP
8778
8779 AT_SETUP([ofproto-dpif megaflow - move action])
8780 OVS_VSWITCHD_START
8781 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8782 add_of_ports br0 1 2
8783 AT_DATA([flows.txt], [dnl
8784 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
8785 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
8786 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
8787 ])
8788 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8789 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)'])
8790 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)'])
8791 sleep 1
8792 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8793 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
8794 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
8795 ])
8796 OVS_VSWITCHD_STOP
8797 AT_CLEANUP
8798
8799 AT_SETUP([ofproto-dpif megaflow - push action])
8800 OVS_VSWITCHD_START
8801 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8802 add_of_ports br0 1 2
8803 AT_DATA([flows.txt], [dnl
8804 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
8805 ])
8806 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8807 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)'])
8808 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)'])
8809 sleep 1
8810 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8811 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
8812 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
8813 ])
8814 OVS_VSWITCHD_STOP
8815 AT_CLEANUP
8816
8817 AT_SETUP([ofproto-dpif megaflow - learning])
8818 OVS_VSWITCHD_START
8819 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8820 add_of_ports br0 1 2
8821 AT_DATA([flows.txt], [dnl
8822 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
8823 ])
8824 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8825 ovs-appctl time/stop
8826 # We send each packet twice because the first packet in each flow causes the
8827 # flow table to change and thus revalidations, which (depending on timing)
8828 # can keep a megaflow from being installed. The revalidations are done by
8829 # the second iteration, allowing the flows to be installed.
8830 for i in 1 2; do
8831 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)'])
8832 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)'])
8833 ovs-appctl time/warp 100
8834 done
8835 sleep 1
8836 dnl The original flow is missing due to a revalidation.
8837 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8838 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8839 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
8840 ])
8841 OVS_VSWITCHD_STOP
8842 AT_CLEANUP
8843
8844 AT_SETUP([ofproto-dpif megaflow - tunnels])
8845 OVS_VSWITCHD_START(
8846 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8847 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8848 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
8849 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
8850 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
8851 ofport_request=3])
8852 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
8853 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
8854 ofport_request=4 options:key=flow])
8855 AT_DATA([flows.txt], [dnl
8856 in_port=1,actions=output(2)
8857 in_port=3,actions=output(4)
8858 ])
8859 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8860 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
8861 dnl will cause the packet to be dropped.
8862 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)'])
8863 sleep 1
8864 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)'])
8865 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)'])
8866 sleep 1
8867 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)'])
8868 sleep 1
8869 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8870 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
8871 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
8872 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
8873 ])
8874 OVS_VSWITCHD_STOP
8875 AT_CLEANUP
8876
8877 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
8878 OVS_VSWITCHD_START
8879 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8880 add_of_ports br0 1 2
8881 AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=nw_dst,nw_src], [0], [ignore], [])
8882 AT_DATA([flows.txt], [dnl
8883 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
8884 ])
8885 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8886 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)'])
8887 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)'])
8888 sleep 1
8889 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8890 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
8891 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,ttl=64,frag=no), actions: <del>
8892 ])
8893 OVS_VSWITCHD_STOP
8894 AT_CLEANUP
8895
8896 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
8897 OVS_VSWITCHD_START
8898 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8899 add_of_ports br0 1 2
8900 AT_DATA([flows.txt], [dnl
8901 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
8902 ])
8903 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8904 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)'])
8905 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)'])
8906 sleep 1
8907 dnl The first packet is essentially a no-op, as the new destination MAC is the
8908 dnl same as the original. The second entry actually updates the destination
8909 dnl MAC.
8910 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8911 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions:2
8912 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions:set(eth(dst=50:54:00:00:00:0a)),2
8913 ])
8914 OVS_VSWITCHD_STOP
8915 AT_CLEANUP
8916
8917 AT_SETUP([ofproto-dpif megaflow - set dl_dst with match on dl_src])
8918 OVS_VSWITCHD_START
8919 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8920 add_of_ports br0 1 2
8921 AT_DATA([flows.txt], [dnl
8922 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
8923 ])
8924 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8925 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)'])
8926 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: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)'])
8927 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.6,dst=10.0.0.5,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8928 sleep 1
8929 dnl The first packet is essentially a no-op, as the new destination MAC is the
8930 dnl same as the original. The second entry actually updates the destination
8931 dnl MAC. The last one must be dropped as it doesn't match with dl_src.
8932 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8933 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions:2
8934 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions:set(eth(dst=50:54:00:00:00:0a)),2
8935 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions:drop
8936 ])
8937 OVS_VSWITCHD_STOP
8938 AT_CLEANUP
8939
8940 m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
8941 [AT_SETUP([ofproto-dpif megaflow - disabled$1])
8942 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8943 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8944 func=`printf '%s_' "$1" | cut -c 4-`
8945 add_${func}of_ports br0 1 2
8946 AT_DATA([flows.txt], [dnl
8947 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
8948 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
8949 ])
8950 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8951 ], [])
8952 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8953 ], [])
8954 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
8955 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8956 for i in 1 2 3 4; do
8957 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)'])
8958 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)'])
8959 if [[ $i -eq 1 ]]; then
8960 sleep 1
8961 fi
8962 done
8963 sleep 1
8964 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8965 skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),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), actions:2
8966 skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),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), actions:drop
8967 ])
8968 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
8969 skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),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), packets:3, bytes:318, used:0.0s, actions:2
8970 skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),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), packets:3, bytes:318, used:0.0s, actions:drop
8971 ])
8972 OVS_VSWITCHD_STOP
8973 AT_CLEANUP])
8974
8975 OFPROTO_DPIF_MEGAFLOW_DISABLED([])
8976 OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
8977
8978 AT_SETUP([ofproto-dpif - datapath port number change])
8979 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
8980 add_of_ports br0 1
8981
8982 # Trace a flow that should output to p1.
8983 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8984 [0], [stdout])
8985 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
8986 ])
8987
8988 # Change p1's port number to 5.
8989 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
8990
8991 # Trace a flow that should output to p1 in its new location.
8992 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8993 [0], [stdout])
8994 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
8995 ])
8996 OVS_VSWITCHD_STOP
8997 AT_CLEANUP
8998
8999 # Tests the bundling with various bfd and cfm configurations.
9000 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
9001 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
9002 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
9003 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
9004 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
9005 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
9006 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
9007 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
9008 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
9009 set Interface p0 cfm_mpid=1 -- \
9010 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
9011
9012 ovs-appctl time/stop
9013 # advance the clock to stablize everything.
9014 ovs-appctl time/warp 5000 100
9015 # cfm/show should show 'recv' fault.
9016 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
9017 fault: recv
9018 ])
9019 # bfd/show should show 'up'.
9020 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
9021 Local Session State: up
9022 Remote Session State: up
9023 Local Session State: up
9024 Remote Session State: up
9025 ])
9026 # bond/show should show 'may-enable: true' for all members.
9027 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
9028 may_enable: true
9029 may_enable: true
9030 may_enable: true
9031 may_enable: true
9032 ])
9033
9034 # now disable the bfd on p1.
9035 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
9036 # advance the clock to stablize everything.
9037 ovs-appctl time/warp 5000 100
9038 # cfm/show should show 'recv' fault.
9039 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
9040 fault: recv
9041 ])
9042 # bfd/show should show 'down'.
9043 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
9044 Local Session State: down
9045 Remote Session State: down
9046 ])
9047 # bond/show should show 'may-enable: false' for p0.
9048 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
9049 may_enable: false
9050 may_enable: true
9051 ])
9052
9053 # now enable the bfd on p1 and disable bfd on p0.
9054 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
9055 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
9056 # advance the clock to stablize everything.
9057 ovs-appctl time/warp 5000 100
9058 # cfm/show should show 'recv' fault.
9059 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
9060 fault: recv
9061 ])
9062 # bfd/show should show 'down'.
9063 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
9064 Local Session State: down
9065 Remote Session State: down
9066 ])
9067 # bond/show should show 'may-enable: false' for p0 and p1.
9068 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
9069 may_enable: false
9070 may_enable: true
9071 may_enable: false
9072 may_enable: true
9073 ])
9074
9075 OVS_VSWITCHD_STOP
9076 AT_CLEANUP
9077
9078 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
9079 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
9080
9081 # enable bfd on p0.
9082 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
9083 # check log.
9084 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
9085 # disable bfd on p0.
9086 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
9087 # check log.
9088 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
9089 AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && ovs-appctl vlog/close && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
9090
9091 # enable cfm on p0.
9092 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
9093 # check log.
9094 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
9095 # disable cfm on p0.
9096 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
9097 # check log.
9098 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
9099 AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && ovs-appctl vlog/close && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
9100
9101 # enable both bfd and cfm on p0.
9102 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
9103 # check log.
9104 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
9105 # disable bfd on p0.
9106 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
9107 # check log, there should not be the log of thread terminated.
9108 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
9109 ])
9110 # reenable bfd on p0.
9111 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
9112 # check log, should still be on log of thread created.
9113 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
9114 monitor thread created
9115 ])
9116 # disable bfd and cfm together.
9117 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
9118 # check log.
9119 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
9120
9121 OVS_VSWITCHD_STOP
9122 AT_CLEANUP
9123
9124 # this test helps avoid the deadlock between the main thread and monitor thread.
9125 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
9126 OVS_VSWITCHD_START
9127
9128 for i in `seq 1 199`
9129 do
9130 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])
9131 done
9132
9133 OVS_VSWITCHD_STOP
9134 AT_CLEANUP
9135 \f
9136 AT_BANNER([ofproto-dpif - flow translation resource limits])
9137
9138 dnl Resubmits to later tables do not count against the depth limit, so we
9139 dnl can do 99 of them even though the maximum depth is 64.
9140 AT_SETUP([ofproto-dpif - forward resubmit])
9141 OVS_VSWITCHD_START
9142 (for i in `seq 0 99`; do
9143 j=`expr $i + 1`
9144 echo "table=$i, actions=resubmit(,$j)"
9145 done
9146 echo "table=100, actions=local") > flows
9147 AT_CHECK([ovs-ofctl add-flows br0 flows])
9148 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
9149 [0], [stdout])
9150 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
9151 ])
9152 OVS_VSWITCHD_STOP
9153 AT_CLEANUP
9154
9155 dnl Resubmits to the same or an earlier table count against the depth limit,
9156 dnl so only 64 of them are allowed.
9157 AT_SETUP([ofproto-dpif - backward resubmit])
9158 OVS_VSWITCHD_START
9159 (echo "table=0, actions=resubmit(,66)"
9160 for i in `seq 2 66`; do
9161 j=`expr $i - 1`
9162 echo "table=$i, actions=resubmit(,$j)"
9163 done
9164 echo "table=1, actions=local") > flows
9165 AT_CHECK([ovs-ofctl add-flows br0 flows])
9166 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
9167 [0], [stdout])
9168 AT_CHECK([tail -1 stdout], [0],
9169 [Translation failed (Recursion too deep), packet is dropped.
9170 ])
9171 AT_CHECK([grep -c 'over max translation depth 64' stdout],
9172 [0], [1
9173 ])
9174 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
9175 AT_CLEANUP
9176
9177 AT_SETUP([ofproto-dpif - infinite resubmit])
9178 OVS_VSWITCHD_START
9179 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
9180 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
9181 [0], [stdout])
9182 AT_CHECK([tail -1 stdout], [0],
9183 [Translation failed (Recursion too deep), packet is dropped.
9184 ])
9185 AT_CHECK([grep -c 'over max translation depth 64' stdout],
9186 [0], [1
9187 ])
9188 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
9189 AT_CLEANUP
9190
9191 dnl Without using ofproto/trace, make sure the
9192 dnl ofproto trace is still logged
9193 AT_SETUP([ofproto-dpif - backward resubmit without trace])
9194 OVS_VSWITCHD_START
9195 (echo "table=0, actions=resubmit(,66)"
9196 for i in `seq 2 66`; do
9197 j=`expr $i - 1`
9198 echo "table=$i, actions=resubmit(,$j)"
9199 done
9200 echo "table=1, actions=local") > flows
9201 AT_CHECK([ovs-ofctl add-flows br0 flows])
9202
9203 AT_CHECK([ovs-appctl netdev-dummy/receive br0 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'], [0], [stdout])
9204
9205 OVS_WAIT_UNTIL([grep 'packet is dropped' ovs-vswitchd.log])
9206
9207 dnl make sure the full ofproto trace dump is present
9208 AT_CHECK([grep -c "^ *resubmit" ovs-vswitchd.log],
9209 [0], [66
9210 ])
9211
9212 OVS_VSWITCHD_STOP(["/over max translation depth/d
9213 /ofproto_dpif_upcall/d"])
9214 AT_CLEANUP
9215
9216 AT_SETUP([ofproto-dpif - exponential resubmit chain])
9217 OVS_VSWITCHD_START
9218 add_of_ports br0 1
9219 (for i in `seq 1 64`; do
9220 j=`expr $i + 1`
9221 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
9222 done
9223 echo "in_port=65, actions=local") > flows
9224 AT_CHECK([ovs-ofctl add-flows br0 flows])
9225 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
9226 AT_CHECK([tail -1 stdout], [0],
9227 [Translation failed (Too many resubmits), packet is dropped.
9228 ])
9229 AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
9230 ])
9231 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
9232 AT_CLEANUP
9233
9234 AT_SETUP([ofproto-dpif - too many output actions])
9235 OVS_VSWITCHD_START
9236 add_of_ports br0 1
9237 (for i in `seq 1 12`; do
9238 j=`expr $i + 1`
9239 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
9240 done
9241 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
9242 AT_CHECK([ovs-ofctl add-flows br0 flows])
9243 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
9244 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
9245 [0], [1
9246 ])
9247 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
9248 ])
9249 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
9250 AT_CLEANUP
9251
9252 AT_SETUP([ofproto-dpif - stack too deep])
9253 OVS_VSWITCHD_START
9254 add_of_ports br0 1
9255 (for i in `seq 1 12`; do
9256 j=`expr $i + 1`
9257 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
9258 done
9259 push="push:NXM_NX_REG0[[]]"
9260 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
9261 AT_CHECK([ovs-ofctl add-flows br0 flows])
9262 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
9263 AT_CHECK([tail -1 stdout], [0],
9264 [Translation failed (Stack too deep), packet is dropped.
9265 ])
9266 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
9267 ])
9268 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
9269 AT_CLEANUP
9270
9271
9272 AT_SETUP([ofproto-dpif packet-out controller])
9273 OVS_VSWITCHD_START
9274 add_of_ports br0 1 2
9275
9276 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
9277
9278 AT_CAPTURE_FILE([ofctl_monitor.log])
9279 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9280
9281 for i in 1 2 3; do
9282 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
9283 done
9284
9285 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9286 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9287 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
9288 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9289 dnl
9290 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
9291 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9292 dnl
9293 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
9294 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9295 ])
9296
9297 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
9298 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9299 NXST_FLOW reply:
9300 ])
9301
9302 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0],
9303 [OFPST_TABLE reply (OF1.3) (xid=0x2):
9304 table 0:
9305 active=1, lookup=0, matched=0
9306
9307 table 1:
9308 active=0, lookup=0, matched=0
9309
9310 tables 2...253: ditto
9311 ])
9312
9313 OVS_VSWITCHD_STOP
9314 AT_CLEANUP
9315
9316 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
9317 OVS_VSWITCHD_START(
9318 [-- \
9319 add-port br0 p1 -- \
9320 set interface p1 type=patch options:peer=p2 -- \
9321 add-br br1 -- \
9322 set bridge br1 datapath-type=dummy -- \
9323 set bridge br1 fail-mode=secure -- \
9324 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
9325 add-port br1 p2 -- \
9326 set interface p2 type=patch options:peer=p1 --])
9327
9328 AT_CAPTURE_FILE([ofctl_monitor.log])
9329 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9330
9331 for i in 1 2 3; do
9332 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
9333 done
9334
9335 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9336 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9337 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
9338 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9339 dnl
9340 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
9341 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9342 dnl
9343 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
9344 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9345 ])
9346
9347 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9348 OFPST_TABLE reply (OF1.3) (xid=0x2):
9349 table 0:
9350 active=0, lookup=0, matched=0
9351
9352 tables 1...253: ditto
9353 ])
9354
9355 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1], [0], [dnl
9356 OFPST_TABLE reply (OF1.3) (xid=0x2):
9357 table 0:
9358 active=0, lookup=3, matched=0
9359
9360 table 1:
9361 active=0, lookup=0, matched=0
9362
9363 tables 2...253: ditto
9364 ])
9365
9366 OVS_VSWITCHD_STOP
9367 AT_CLEANUP
9368
9369 AT_SETUP([ofproto-dpif packet-out pipeline match field (OpenFlow 1.5)])
9370 OVS_VSWITCHD_START
9371
9372 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=8}->tun_metadata2"])
9373 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata3"])
9374 AT_DATA([flows.txt], [dnl
9375 table=0,in_port=1 actions=controller
9376 table=0,tun_id=3 actions=controller
9377 table=0,metadata=5 actions=controller
9378 table=0,reg0=1,reg4=2,reg8=3,reg12=5 actions=controller
9379 table=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 actions=controller
9380 table=0,tun_metadata3=0x11 actions=controller
9381 ])
9382 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
9383
9384 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
9385 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
9386 ovs-appctl -t ovs-ofctl ofctl/barrier
9387 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
9388 AT_CAPTURE_FILE([monitor.log])
9389
9390 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=1 packet=0001020304050010203040501111 actions=table"])
9391 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tunnel_id=3 packet=0001020304050010203040502222 actions=table"])
9392 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,metadata=5 packet=0001020304050010203040503333 actions=table"])
9393 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,reg0=1,reg4=2,reg8=3,reg12=5 packet=0001020304050010203040503333 actions=table"])
9394 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 packet=0001020304050010203040503333 actions=table"])
9395 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_metadata2=0x22,tun_metadata3=0x11 packet=0001020304050010203040503333 actions=table"])
9396
9397 ovs-appctl -t ovs-ofctl ofctl/barrier
9398 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9399
9400 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
9401 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 in_port=1 (via packet_out) data_len=14 (unbuffered)
9402 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1111
9403 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_id=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
9404 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x2222
9405 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 metadata=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
9406 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9407 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 reg0=0x1,reg4=0x2,reg8=0x3,reg12=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
9408 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9409 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=1,tun_gbp_flags=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
9410 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9411 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_metadata2=0x22,tun_metadata3=0x11,in_port=2 (via packet_out) data_len=14 (unbuffered)
9412 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9413 OFPT_BARRIER_REPLY (OF1.5):
9414 ])
9415
9416 OVS_VSWITCHD_STOP
9417 AT_CLEANUP
9418
9419 AT_SETUP([ofproto-dpif packet-out goto_table])
9420 OVS_VSWITCHD_START
9421 add_of_ports br0 1 2
9422
9423 AT_DATA([flows.txt], [dnl
9424 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
9425 table=1 dl_dst=50:54:00:00:00:0a actions=controller
9426 ])
9427 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
9428
9429 AT_CAPTURE_FILE([ofctl_monitor.log])
9430 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9431
9432 for i in 1 2 3; do
9433 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(0x1234)'
9434 done
9435
9436 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
9437 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9438 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9439 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9440 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9441 dnl
9442 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9443 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9444 dnl
9445 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9446 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9447 ])
9448
9449 AT_CHECK([ovs-appctl revalidator/purge], [0])
9450 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
9451 n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=goto_table:1
9452 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9453 OFPST_FLOW reply (OF1.3):
9454 ])
9455
9456 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9457 OFPST_TABLE reply (OF1.3) (xid=0x2):
9458 table 0:
9459 active=1, lookup=3, matched=3
9460
9461 table 1: ditto
9462
9463 table 2:
9464 active=0, lookup=0, matched=0
9465
9466 tables 3...253: ditto
9467 ])
9468
9469 OVS_VSWITCHD_STOP
9470 AT_CLEANUP
9471
9472
9473 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
9474 OVS_VSWITCHD_START
9475 add_of_ports br0 1 2
9476
9477 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
9478 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
9479
9480 AT_CAPTURE_FILE([ofctl_monitor.log])
9481 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9482
9483 for i in 1 2 3; do
9484 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(0x1234)'
9485 done
9486
9487 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
9488 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9489 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9490 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9491 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9492 dnl
9493 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9494 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9495 dnl
9496 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9497 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9498 ])
9499
9500 AT_CHECK([ovs-appctl revalidator/purge], [0])
9501 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
9502 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9503 OFPST_FLOW reply (OF1.1):
9504 ])
9505
9506 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9507 OFPST_TABLE reply (OF1.3) (xid=0x2):
9508 table 0:
9509 active=0, lookup=3, matched=0
9510
9511 table 1:
9512 active=1, lookup=3, matched=3
9513
9514 table 2:
9515 active=0, lookup=0, matched=0
9516
9517 tables 3...253: ditto
9518 ])
9519
9520 OVS_VSWITCHD_STOP
9521 AT_CLEANUP
9522
9523 AT_SETUP([ofproto-dpif - ICMPv6])
9524 OVS_VSWITCHD_START
9525 add_of_ports br0 1
9526
9527 AT_CAPTURE_FILE([ofctl_monitor.log])
9528
9529 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9530
9531 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9532
9533 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9534
9535 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9536 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
9537 icmp6,vlan_tci=0x0000,dl_src=00:00:86:05:80:da,dl_dst=00:60:97:07:69:ea,ipv6_src=fe80::200:86ff:fe05:80da,ipv6_dst=fe80::260:97ff:fe07:69ea,ipv6_label=0x00000,nw_tos=0,nw_ecn=0,nw_ttl=255,icmp_type=135,icmp_code=0,nd_target=fe80::260:97ff:fe07:69ea,nd_sll=00:00:86:05:80:da,nd_tll=00:00:00:00:00:00 icmp6_csum:68bd
9538 ])
9539
9540 OVS_VSWITCHD_STOP
9541 AT_CLEANUP
9542
9543 AT_SETUP([ofproto-dpif - ICMPv6 type match])
9544 OVS_VSWITCHD_START
9545 add_of_ports br0 1 2 3
9546
9547 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
9548 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
9549
9550 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9551
9552 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128)'])
9553 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128)'])
9554 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129)'])
9555 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129)'])
9556
9557 AT_CHECK([ovs-appctl revalidator/purge], [0])
9558
9559 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9560 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128), actions:2
9561 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129), actions:3
9562 ])
9563
9564 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
9565 n_packets=2, n_bytes=252, icmp6,icmp_type=128 actions=output:2
9566 n_packets=2, n_bytes=252, icmp6,icmp_type=129 actions=output:3
9567 NXST_FLOW reply:
9568 ])
9569
9570 OVS_VSWITCHD_STOP
9571 AT_CLEANUP
9572
9573 AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
9574 OVS_VSWITCHD_START
9575 add_of_ports br0 1
9576 AT_CHECK([ovs-ofctl add-flow br0 icmp6,icmpv6_type=135,action=set_field:fe80::1-\>nd_target,set_field:32:21:14:86:11:74-\>nd_sll,output:controller])
9577
9578 AT_CAPTURE_FILE([ofctl_monitor.log])
9579
9580 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9581
9582 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9583
9584 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9585
9586 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9587 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
9588 icmp6,vlan_tci=0x0000,dl_src=00:00:86:05:80:da,dl_dst=00:60:97:07:69:ea,ipv6_src=fe80::200:86ff:fe05:80da,ipv6_dst=fe80::260:97ff:fe07:69ea,ipv6_label=0x00000,nw_tos=0,nw_ecn=0,nw_ttl=255,icmp_type=135,icmp_code=0,nd_target=fe80::1,nd_sll=32:21:14:86:11:74,nd_tll=00:00:00:00:00:00 icmp6_csum:19d3
9589 ])
9590
9591 OVS_VSWITCHD_STOP
9592 AT_CLEANUP
9593
9594 # Tests the exact match of CFI bit in installed datapath flows matching VLAN.
9595 AT_SETUP([ofproto-dpif - vlan matching])
9596 OVS_VSWITCHD_START(
9597 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
9598 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9599
9600 AT_CHECK([ovs-ofctl del-flows br0])
9601 AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
9602
9603 AT_CHECK([ovs-appctl netdev-dummy/receive p0 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8100),vlan(vid=10,pcp=0),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))'])
9604
9605 OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
9606 AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
9607 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=10),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
9608 ])
9609 OVS_VSWITCHD_STOP
9610 AT_CLEANUP
9611
9612 # Tests in place modification of installed datapath flows.
9613 AT_SETUP([ofproto-dpif - in place modification])
9614 OVS_VSWITCHD_START(
9615 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9616 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9617
9618 AT_CHECK([ovs-ofctl del-flows br0])
9619 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
9620
9621 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9622
9623 ovs-appctl time/stop
9624
9625 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(0x1234)'])
9626
9627 # Wait for the flow setup to be done.
9628 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9629
9630 for i in 1 2; do
9631 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(0x1234)'
9632 done
9633
9634 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9635 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
9636 ])
9637
9638 AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
9639
9640 ovs-appctl time/warp 500
9641 ovs-appctl time/warp 500
9642
9643 for i in 1 2 3; do
9644 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(0x1234)'
9645 done
9646
9647 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9648 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
9649 ])
9650
9651 AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
9652 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:push_vlan(vid=4,pcp=0),100
9653 ])
9654 OVS_VSWITCHD_STOP
9655 AT_CLEANUP
9656
9657 # Tests in place modification of installed datapath flows with vlans.
9658 AT_SETUP([ofproto-dpif - in place modification (vlan)])
9659 OVS_VSWITCHD_START(
9660 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9661 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9662
9663 # Always drop misses
9664 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all drop])
9665 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
9666
9667 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9668
9669 ovs-appctl time/stop
9670
9671 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(0x1234)'])
9672
9673 # Check that a correct datapath flow is created.
9674 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9675
9676 for i in 1 2; do
9677 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(0x1234)'
9678 done
9679
9680 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9681 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:100
9682 ])
9683
9684 # Delete the flow. Then check that the datapath flow is modified to
9685 # drop the packets. A modified flow inherits the stats, a new
9686 # datapath flow would start from sero.
9687 AT_CHECK([ovs-ofctl del-flows br0])
9688
9689 ovs-appctl time/warp 500
9690 ovs-appctl time/warp 500
9691
9692 for i in 1 2 3; do
9693 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(0x1234)'
9694 done
9695
9696 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9697 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:drop
9698 ])
9699
9700 # Add a flow that matches the non-presence of a vlan tag, and check
9701 # that the datapath flow is modified accordingly.
9702 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
9703
9704 ovs-appctl time/warp 500
9705 ovs-appctl time/warp 500
9706
9707 for i in 1 2 3; do
9708 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(0x1234)'
9709 done
9710
9711 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9712 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9713 ])
9714
9715 # Check that VLAN packets will not hit the same datapath megaflow.
9716
9717 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=99,pcp=7),encap(eth_type(0x1234))'])
9718 OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
9719
9720 for i in 1 2; do
9721 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=99,pcp=7),encap(eth_type(0x1234))'
9722 done
9723
9724 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9725 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9726 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:36, used:0.0s, actions:drop
9727 ])
9728
9729 # Check that the new flow matches the CFI bit, while both vid and pcp
9730 # are wildcarded.
9731 AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
9732 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), actions:100
9733 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:drop
9734 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:100
9735 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), actions:drop
9736 ])
9737 OVS_VSWITCHD_STOP
9738 AT_CLEANUP
9739
9740 AT_SETUP([ofproto-dpif - trace (unchanged)])
9741 OVS_VSWITCHD_START
9742 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
9743 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9744 ])
9745 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
9746 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9747 ])
9748
9749 OVS_VSWITCHD_STOP
9750 AT_CLEANUP
9751
9752 AT_SETUP([ofproto-dpif - conntrack - controller])
9753 OVS_VSWITCHD_START
9754
9755 add_of_ports br0 1 2
9756
9757 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9758
9759 dnl Allow new UDP connections on p1 for dst port 2, drop everything else.
9760 AT_DATA([flows.txt], [dnl
9761 dnl Table 0
9762 dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2).
9763 dnl
9764 table=0,priority=100,arp,action=normal
9765 table=0,priority=10,in_port=1,ip,action=set_field:1->reg4,set_field:1->reg3,ct(zone=NXM_NX_REG4[[0..15]],table=1)
9766 table=0,priority=10,in_port=2,ip,action=set_field:1->reg4,set_field:2->reg3,ct(zone=NXM_NX_REG4[[0..15]],table=1)
9767 table=0,priority=1,action=drop
9768 dnl
9769 dnl Pass tracked traffic through ACL, drop everything else.
9770 dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers
9771 dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets
9772 dnl get the ACL lookup using the conntrack tuple and the inverted direction.
9773 dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
9774 dnl of the parent connection, as storted in ct_mark.
9775 dnl
9776 dnl Incoming non-related packet in the original direction (ACL IN)
9777 table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5
9778 dnl Incoming non-related reply packet (CT ACL OUT)
9779 table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4
9780 dnl Outgoing non-related packet (ACL OUT)
9781 table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5
9782 dnl Outgoing non-related reply packet (CT ACL IN)
9783 table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
9784 dnl
9785 dnl Related packet (CT ACL in the direction of the parent connection.)
9786 table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
9787 dnl Drop everything else.
9788 table=1 priority=0, action=drop
9789 dnl
9790 dnl "ACL table"
9791 dnl
9792 dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with
9793 dnl UDP destination port '2'. Store rule ID (1234) in reg1, verdict
9794 dnl in reg2.
9795 table=3 priority=10, reg0=1, udp, udp_dst=2 action=set_field:1234->reg1,set_field:1->reg2
9796 dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235)
9797 table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2
9798 dnl
9799 dnl Re-process stateful traffic that was not accepted by a stateful rule as
9800 dnl normal traffic in the current direction. This should also delete the
9801 dnl now stale conntrack state, so that new state can be created in it's place.
9802 dnl
9803 dnl Stateful accepts go to next table.
9804 table=4 priority=100 reg2=1, action=goto_table:5
9805 dnl Everything else is reprocessed disregarding the CT state, using the actual
9806 dnl packet direction.
9807 table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5
9808 dnl
9809 dnl "ACL verdict processing table."
9810 dnl
9811 dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0)
9812 dnl
9813 dnl Drop all non-accepted packets.
9814 table=5 reg2=0 priority=1000 action=drop
9815 dnl Commit new non-related IP connections.
9816 table=5 priority=10 reg2=1 ct_state=+new-rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,exec(move:NXM_NX_REG3[[0..31]]->NXM_NX_CT_MARK[[0..31]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
9817 dnl Commit new related connections in either direction, which inherit the mark
9818 dnl (the direction of the original direction parent tuple) from the parent
9819 dnl connection.
9820 table=5 priority=10 reg2=1 ct_state=+new+rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,exec(move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
9821 dnl Forward everything else, including stateless accepts.
9822 table=5 priority=0 action=goto_table:6
9823 dnl
9824 dnl "Forwarding table"
9825 dnl
9826 table=6 action=controller
9827 ])
9828
9829 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9830
9831 AT_CAPTURE_FILE([ofctl_monitor.log])
9832 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9833
9834 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9835
9836 dnl OK, now start a new connection from port 1.
9837 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
9838
9839 dnl Now try a reply from port 2.
9840 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9841
9842 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9843 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9844
9845 dnl Check this output. We only see the latter two packets, not the first.
9846 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9847 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=106 (unbuffered)
9848 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
9849 dnl
9850 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_zone=1,ct_mark=0x1,ct_label=0x4d2000000000000000000000000,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x2,reg4=0x1,in_port=2 (via action) data_len=106 (unbuffered)
9851 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
9852 ])
9853
9854 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9855
9856 dnl OK, now start a second connection from port 1
9857 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=2)'])
9858
9859 dnl Now try a reply from port 2.
9860 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=3)'])
9861
9862
9863 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9864 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9865
9866 dnl Check this output. We should see both packets
9867 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9868 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=106 (unbuffered)
9869 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=2 udp_csum:551
9870 dnl
9871 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_zone=1,ct_mark=0x1,ct_label=0x4d2000000000000000000000000,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=2,ip,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x2,reg4=0x1,in_port=2 (via action) data_len=106 (unbuffered)
9872 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=3 udp_csum:551
9873 ])
9874
9875 OVS_VSWITCHD_STOP
9876 AT_CLEANUP
9877
9878 AT_SETUP([ofproto-dpif - conntrack - force commit])
9879 OVS_VSWITCHD_START
9880
9881 add_of_ports br0 1 2
9882
9883 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9884
9885 dnl Allow new connections on p1->p2, but not on p2->p1.
9886 AT_DATA([flows.txt], [dnl
9887 dnl Table 0
9888 dnl
9889 table=0,priority=100,arp,action=normal
9890 table=0,priority=10,in_port=1,udp,action=ct(commit),controller
9891 table=0,priority=10,in_port=2,udp,action=ct(table=1)
9892 table=0,priority=1,action=drop
9893 dnl
9894 dnl Table 1
9895 dnl
9896 table=1,priority=10,in_port=2,ct_state=+est,udp,action=ct(force,commit),controller
9897 table=1,priority=1,action=drop
9898 ])
9899
9900 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9901
9902 AT_CAPTURE_FILE([ofctl_monitor.log])
9903 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9904
9905 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9906
9907 dnl OK, now start a new connection from port 1.
9908 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
9909
9910 dnl Now try a reply from port 2.
9911 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9912
9913 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9914 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9915
9916 dnl Check this output. We only see the latter two packets, not the first.
9917 dnl Note that the first packet doesn't have the ct_state bits set. This
9918 dnl happens because the ct_state field is available only after recirc.
9919 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9920 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9921 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
9922 dnl
9923 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9924 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
9925 ])
9926
9927 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9928
9929 dnl OK, now start a second connection from port 1
9930 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=4)'])
9931
9932 dnl Now try a reply from port 2.
9933 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=4,dst=3)'])
9934
9935 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9936 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9937
9938 dnl Check this output. We should see both packets
9939 dnl Note that the first packet doesn't have the ct_state bits set. This
9940 dnl happens because the ct_state field is available only after recirc.
9941 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9942 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9943 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=4 udp_csum:54f
9944 dnl
9945 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9946 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:54f
9947 ])
9948
9949 dnl
9950 dnl Check that the directionality has been changed by force commit.
9951 dnl
9952 AT_CHECK([ovs-appctl dpctl/dump-conntrack | sort], [], [dnl
9953 udp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=2,dport=1),reply=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=2)
9954 udp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=4,dport=3),reply=(src=10.1.1.1,dst=10.1.1.2,sport=3,dport=4)
9955 ])
9956
9957 OVS_VSWITCHD_STOP
9958 AT_CLEANUP
9959
9960 AT_SETUP([ofproto-dpif - conntrack - ipv6])
9961 OVS_VSWITCHD_START
9962
9963 add_of_ports br0 1 2
9964
9965 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9966
9967 dnl Allow new connections on p1->p2, but not on p2->p1.
9968 AT_DATA([flows.txt], [dnl
9969 dnl Table 0
9970 dnl
9971 table=0,priority=100,arp,action=normal
9972 table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
9973 table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
9974 table=0,priority=1,action=drop
9975 dnl Table 1
9976 dnl
9977 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
9978 table=1,priority=1,action=drop
9979 ])
9980
9981 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9982
9983 AT_CAPTURE_FILE([ofctl_monitor.log])
9984 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9985
9986 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x86dd),ipv6(src=2001:db8::2,dst=2001:db8::1,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=2,dst=1)'])
9987
9988 dnl OK, now start a new connection from port 1.
9989 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(0x86dd),ipv6(src=2001:db8::1,dst=2001:db8::2,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=1,dst=2)'])
9990
9991 dnl Now try a reply from port 2.
9992 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x86dd),ipv6(src=2001:db8::2,dst=2001:db8::1,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=2,dst=1)'])
9993
9994 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9995 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9996
9997 dnl Check this output. We only see the latter two packets, not the first.
9998 dnl Note that the first packet doesn't have the ct_state bits set. This
9999 dnl happens because the ct_state field is available only after recirc.
10000 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10001 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
10002 udp6,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,ipv6_src=2001:db8::1,ipv6_dst=2001:db8::2,ipv6_label=0x00000,nw_tos=112,nw_ecn=0,nw_ttl=128,tp_src=1,tp_dst=2 udp_csum:bfe2
10003 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=126 ct_state=est|rpl|trk,ct_ipv6_src=2001:db8::1,ct_ipv6_dst=2001:db8::2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ipv6,in_port=2 (via action) data_len=126 (unbuffered)
10004 udp6,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,ipv6_src=2001:db8::2,ipv6_dst=2001:db8::1,ipv6_label=0x00000,nw_tos=112,nw_ecn=0,nw_ttl=128,tp_src=2,tp_dst=1 udp_csum:bfe2
10005 ])
10006
10007 OVS_VSWITCHD_STOP
10008 AT_CLEANUP
10009
10010 AT_SETUP([ofproto-dpif - conntrack - output action])
10011 OVS_VSWITCHD_START
10012
10013 add_of_ports br0 1 2
10014
10015 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10016
10017 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10018 AT_DATA([flows.txt], [dnl
10019 dnl The flows are in two separate tables for two reasons:
10020 dnl * To make the pipeline more clear.
10021 dnl * To make megaflows more consistent (we check megaflows below). The
10022 dnl unwildcarding in megaflows depends on the internal ordering of the
10023 dnl subtables, which are sorted using the system qsort(). qsort()
10024 dnl is provided by libc and may or may not be stable, so we can't rely
10025 dnl on that. By having separate tables we have more control over which
10026 dnl subtables are visited, meaning consistent megaflows.
10027 dnl
10028 dnl Table 0
10029 dnl
10030 table=0,priority=100,arp,action=normal
10031 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
10032 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10033 table=0,priority=1,action=drop
10034 dnl
10035 dnl Table 1
10036 dnl
10037 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
10038 table=1,priority=1,action=drop
10039 ])
10040
10041 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10042
10043
10044 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10045
10046 dnl OK, now start a new connection from port 1.
10047 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10048
10049 dnl Now try a reply from port 2.
10050 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10051
10052 dnl OK, now start a second connection from port 1
10053 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10054
10055 dnl Now try a reply from port 2.
10056 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10057
10058
10059 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
10060 ct_state(+new-est+trk),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:drop
10061 ct_state(-new+est+trk),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:1
10062 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
10063 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct,recirc(0x1)
10064 ])
10065
10066 OVS_VSWITCHD_STOP
10067 AT_CLEANUP
10068
10069 AT_SETUP([ofproto-dpif - conntrack - expiration])
10070 OVS_VSWITCHD_START
10071
10072 add_of_ports br0 1 2
10073
10074 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10075
10076 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10077 AT_DATA([flows.txt], [dnl
10078 dnl Table 0
10079 dnl
10080 table=0,priority=100,arp,action=normal
10081 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
10082 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10083 table=0,priority=1,action=drop
10084 dnl
10085 dnl Table 1
10086 dnl
10087 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
10088 table=1,priority=1,action=drop
10089 ])
10090
10091 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10092
10093 AT_CAPTURE_FILE([ofctl_monitor.log])
10094 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10095
10096 AT_CHECK([ovs-appctl time/stop])
10097
10098 dnl Start a new connection from port 1.
10099 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10100
10101 dnl Now try a reply from port 2.
10102 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10103
10104 ovs-appctl time/warp 100000
10105
10106 dnl Now try another reply from port 2.
10107 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10108
10109 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
10110 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10111
10112 dnl Check this output. Only one reply must be there
10113 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10114 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10115 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10116 dnl
10117 OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
10118 ])
10119
10120 OVS_VSWITCHD_STOP
10121 AT_CLEANUP
10122
10123 AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
10124 OVS_VSWITCHD_START
10125
10126 add_of_ports br0 1 2
10127
10128 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10129
10130 AT_DATA([flows.txt], [dnl
10131 ipv6,ct_state=-trk,action=ct(table=0,zone=0)
10132 ct_state=+trk,action=controller
10133 ])
10134
10135 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10136
10137 AT_CAPTURE_FILE([ofctl_monitor.log])
10138 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10139
10140 AT_CHECK([ovs-appctl time/stop])
10141
10142 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
10143
10144 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
10145 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10146
10147 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10148 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,ipv6,in_port=2 (via action) data_len=86 (unbuffered)
10149 icmp6,vlan_tci=0x0000,dl_src=00:00:86:05:80:da,dl_dst=00:60:97:07:69:ea,ipv6_src=fe80::200:86ff:fe05:80da,ipv6_dst=fe80::260:97ff:fe07:69ea,ipv6_label=0x00000,nw_tos=0,nw_ecn=0,nw_ttl=255,icmp_type=135,icmp_code=0,nd_target=fe80::260:97ff:fe07:69ea,nd_sll=00:00:86:05:80:da,nd_tll=00:00:00:00:00:00 icmp6_csum:68bd
10150 ])
10151
10152 OVS_VSWITCHD_STOP
10153 AT_CLEANUP
10154
10155 AT_SETUP([ofproto-dpif - conntrack - zones])
10156 OVS_VSWITCHD_START
10157
10158 add_of_ports br0 1 2 3 4
10159
10160 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10161
10162 dnl Allow new connections on p1->p2 or p3->p4.
10163 dnl Allow only established connections p2->p1 and p4->p3
10164 dnl p1,p2 and p3,p4 are on different zones
10165 AT_DATA([flows.txt], [dnl
10166 dnl Table 0
10167 dnl
10168 table=0,priority=100,arp,action=normal
10169 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
10170 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10171 table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
10172 table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
10173 table=0,priority=1,action=drop
10174 dnl
10175 dnl Table 1
10176 dnl
10177 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
10178 table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
10179 table=1,priority=1,action=drop
10180 ])
10181
10182 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10183
10184 AT_CAPTURE_FILE([ofctl_monitor.log])
10185 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10186
10187 dnl Basic "only established" test on ports 1,2
10188
10189 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10190 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10191 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10192
10193 dnl Now use the same 5-tuples but on ports 3,4
10194
10195 AT_CHECK([ovs-appctl netdev-dummy/receive p4 'in_port(4),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10196 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10197 AT_CHECK([ovs-appctl netdev-dummy/receive p4 'in_port(4),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10198
10199 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
10200 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10201
10202 dnl Check this output. We only see the latter two packets (for each zone), not the first.
10203 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10204 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10205 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
10206 dnl
10207 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10208 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10209 dnl
10210 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=3 (via action) data_len=106 (unbuffered)
10211 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
10212 dnl
10213 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_zone=1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=4 (via action) data_len=106 (unbuffered)
10214 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10215 ])
10216
10217 OVS_VSWITCHD_STOP
10218 AT_CLEANUP
10219
10220 AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
10221 OVS_VSWITCHD_START
10222
10223 add_of_ports br0 1 2
10224
10225 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10226
10227 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10228 AT_DATA([flows.txt], [dnl
10229 dnl Table 0
10230 dnl
10231 table=0,priority=100,arp,action=normal
10232 table=0,priority=10,udp,action=ct(table=1,zone=0)
10233 table=0,priority=1,action=drop
10234 dnl
10235 dnl Table 1
10236 dnl
10237 table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
10238 table=1,priority=10,ct_state=+trk+est,udp,action=controller
10239 table=1,priority=1,action=drop
10240 ])
10241
10242 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10243
10244 AT_CAPTURE_FILE([ofctl_monitor.log])
10245 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10246
10247 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10248
10249 dnl OK, now start a new connection from port 1.
10250 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10251
10252 dnl Now try a reply from port 2.
10253 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10254
10255 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10256 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10257
10258 dnl Check this output. We only see the latter two packets, not the first.
10259 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10260 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10261 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
10262 dnl
10263 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10264 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10265 ])
10266
10267 OVS_VSWITCHD_STOP
10268 AT_CLEANUP
10269
10270 AT_SETUP([ofproto-dpif - conntrack - ICMP related])
10271 OVS_VSWITCHD_START
10272
10273 add_of_ports br0 1 2
10274
10275 dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
10276 AT_DATA([flows.txt], [dnl
10277 dnl Table 0
10278 dnl
10279 table=0,priority=100,arp,action=normal
10280 table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
10281 table=0,priority=10,ip,in_port=2,action=ct(table=1)
10282 table=0,priority=1,action=drop
10283 dnl
10284 dnl Table 1
10285 dnl
10286 table=1,priority=10,in_port=1,ct_state=+trk,action=controller
10287 table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
10288 table=1,priority=1,action=drop
10289 ])
10290
10291 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10292
10293 AT_CAPTURE_FILE([ofctl_monitor.log])
10294 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10295
10296 dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
10297 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
10298
10299 dnl 2. Send and UDP packet to port 5555
10300 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
10301
10302 dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
10303 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
10304
10305 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10306 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10307
10308 dnl Check this output. We only see the first and the last packet
10309 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10310 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=47 ct_state=new|trk,ct_nw_src=172.16.0.1,ct_nw_dst=172.16.0.2,ct_nw_proto=17,ct_tp_src=41614,ct_tp_dst=5555,ip,in_port=1 (via action) data_len=47 (unbuffered)
10311 udp,vlan_tci=0x0000,dl_src=e6:4c:47:35:28:c9,dl_dst=c6:f9:4e:cb:72:db,nw_src=172.16.0.1,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=41614,tp_dst=5555 udp_csum:2096
10312 dnl
10313 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=75 ct_state=rel|rpl|trk,ct_nw_src=172.16.0.1,ct_nw_dst=172.16.0.2,ct_nw_proto=17,ct_tp_src=41614,ct_tp_dst=5555,ip,in_port=2 (via action) data_len=75 (unbuffered)
10314 icmp,vlan_tci=0x0000,dl_src=c6:f9:4e:cb:72:db,dl_dst=e6:4c:47:35:28:c9,nw_src=172.16.0.2,nw_dst=172.16.0.1,nw_tos=192,nw_ecn=0,nw_ttl=64,icmp_type=3,icmp_code=3 icmp_csum:553f
10315 ])
10316
10317 OVS_VSWITCHD_STOP
10318 AT_CLEANUP
10319
10320 AT_SETUP([ofproto-dpif - conntrack - ct_mark])
10321 OVS_VSWITCHD_START
10322
10323 add_of_ports br0 1 2
10324
10325 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10326
10327 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10328 AT_DATA([flows.txt], [dnl
10329 dnl Table 0
10330 dnl
10331 table=0,arp,action=normal
10332 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
10333 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
10334 table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
10335 table=0,ip,in_port=2,actions=ct(table=1)
10336 table=0,priority=0,action=drop
10337 dnl
10338 dnl Table 1
10339 dnl
10340 table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
10341 table=1,priority=1,action=drop
10342 ])
10343
10344 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10345
10346 AT_CAPTURE_FILE([ofctl_monitor.log])
10347 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10348
10349 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10350 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=4)'])
10351 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=5,dst=6)'])
10352
10353 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10354 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=4,dst=3)'])
10355 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=6,dst=5)'])
10356
10357 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
10358 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10359
10360 dnl Check this output.
10361 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10362 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10363 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
10364 dnl
10365 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10366 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=4 udp_csum:54f
10367 dnl
10368 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10369 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=5,tp_dst=6 udp_csum:54b
10370 dnl
10371 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_mark=0x1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10372 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10373 dnl
10374 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_mark=0x3,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=4,ip,in_port=2 (via action) data_len=106 (unbuffered)
10375 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:54f
10376 ])
10377
10378 OVS_VSWITCHD_STOP
10379 AT_CLEANUP
10380
10381 AT_SETUP([ofproto-dpif - conntrack - ct_label])
10382 OVS_VSWITCHD_START
10383
10384 add_of_ports br0 1 2
10385
10386 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10387
10388 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10389 AT_DATA([flows.txt], [dnl
10390 dnl Table 0
10391 dnl
10392 table=0,arp,action=normal
10393 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
10394 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
10395 table=0,ip,in_port=2,actions=ct(table=1)
10396 dnl
10397 dnl Table 1
10398 dnl
10399 table=1,priority=10,ct_state=+trk+rpl,actions=controller
10400 table=1,priority=1,action=drop
10401 ])
10402
10403 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10404
10405 AT_CAPTURE_FILE([ofctl_monitor.log])
10406 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10407
10408 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10409 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=4)'])
10410
10411 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10412 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=4,dst=3)'])
10413
10414 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10415 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10416
10417 dnl Check this output.
10418 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10419 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_label=0x1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10420 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10421 dnl
10422 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_label=0x2,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=4,ip,in_port=2 (via action) data_len=106 (unbuffered)
10423 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:54f
10424 ])
10425
10426 OVS_VSWITCHD_STOP
10427 AT_CLEANUP
10428
10429 AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
10430 OVS_VSWITCHD_START
10431
10432 add_of_ports br0 1 2
10433
10434 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10435
10436 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10437 AT_DATA([flows.txt], [dnl
10438 dnl The flows are in two separate tables for two reasons:
10439 dnl * To make the pipeline more clear.
10440 dnl * To make megaflows more consistent (we check megaflows below). The
10441 dnl unwildcarding in megaflows depends on the internal ordering of the
10442 dnl subtables, which are sorted using the system qsort(). qsort()
10443 dnl is provided by libc and may or may not be stable, so we can't rely
10444 dnl on that. By having separate tables we have more control over which
10445 dnl subtables are visited, meaning consistent megaflows.
10446 dnl
10447 dnl Table 0
10448 dnl
10449 table=0,arp,action=normal
10450 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
10451 table=0,ip,in_port=2,actions=ct(table=1)
10452 table=0,priority=0,action=drop
10453 dnl
10454 dnl Table 1
10455 dnl
10456 table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
10457 table=1,priority=1,action=drop
10458 ])
10459
10460 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10461
10462 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10463 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10464
10465 # Give time for logs to appear.
10466 ovs-appctl revalidator/wait
10467
10468 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
10469 ct_state(+rpl+trk),ct_label(0x1),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:1
10470 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no),udp(src=1), actions:ct(commit,label=0x1),2
10471 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
10472 ])
10473
10474 OVS_VSWITCHD_STOP
10475 AT_CLEANUP
10476
10477 AT_SETUP([ofproto-dpif - conntrack - no output])
10478 OVS_VSWITCHD_START
10479
10480 add_of_ports br0 1
10481
10482 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10483
10484 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10485 AT_DATA([flows.txt], [dnl
10486 in_port=1,udp,action=ct(commit,zone=0)
10487 ])
10488
10489 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10490
10491 dnl Start a new connection from port 1.
10492 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10493
10494 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
10495 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
10496 ])
10497
10498 OVS_VSWITCHD_STOP
10499 AT_CLEANUP
10500
10501 AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
10502 OVS_VSWITCHD_START
10503
10504 add_of_ports br0 1 2
10505
10506 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10507
10508 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10509 AT_DATA([flows.txt], [dnl
10510 dnl Table 0
10511 dnl
10512 table=0,priority=100,arp,action=normal
10513 table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10514 table=0,priority=10,in_port=2,ip,action=ct(table=1)
10515 table=0,priority=1,action=drop
10516 dnl
10517 dnl Table 1
10518 dnl
10519 dnl The following two flows are separated to explicitly count the packets
10520 dnl that create a new connection
10521 table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10522 table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
10523 dnl
10524 table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10525 table=1,ip,ct_state=+trk+inv,action=drop
10526 ])
10527
10528 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10529
10530 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10531 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10532 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10533 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
10534 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10535 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10536 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10537 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10538 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10539
10540 AT_CHECK([ovs-appctl revalidator/purge])
10541 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10542 dnl Only one new connection
10543 n_packets=1
10544 ])
10545
10546 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
10547 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
10548 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
10549 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
10550 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
10551 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
10552 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
10553 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
10554 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
10555
10556 AT_CHECK([ovs-appctl revalidator/purge])
10557 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10558 dnl Two new connections
10559 n_packets=2
10560 ])
10561
10562 OVS_VSWITCHD_STOP
10563 AT_CLEANUP
10564
10565 AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
10566 OVS_VSWITCHD_START
10567
10568 add_of_ports br0 1 2
10569
10570 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10571
10572 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10573 AT_DATA([flows.txt], [dnl
10574 dnl Table 0
10575 dnl
10576 table=0,priority=100,arp,action=normal
10577 table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
10578 table=0,priority=10,in_port=2,tcp,action=ct(table=1)
10579 table=0,priority=1,action=drop
10580 dnl
10581 dnl Table 1
10582 dnl
10583 table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
10584 table=1,priority=1,action=drop
10585 ])
10586
10587 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10588
10589 AT_CHECK([ovs-appctl revalidator/purge])
10590 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10591 dnl No dropped packets
10592 n_packets=0
10593 ])
10594
10595 AT_CAPTURE_FILE([ofctl_monitor.log])
10596 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10597
10598 dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
10599 dnl sure that the connection tracker is able to pick up already established
10600 dnl connections that use window scaling.
10601 dnl
10602 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
10603 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
10604 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
10605 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
10606 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
10607 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a08004500022afc284000400626a10a0101020a01010100020001396bb35b8cadbdb45018000a941f0000 dnl
10608 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10609 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10610 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10611 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10612 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10613 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10614 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10615 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10616 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10617 6666666666666666666666666666666666666666666666666666660a'])
10618 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
10619 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a5054000000090800450001fdf2ca40004006302c0a0101010a010102000100028cadbdb4396bb55d5018000aa60c0000 dnl
10620 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10621 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10622 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10623 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10624 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10625 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10626 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10627 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10628 6565656565656565656565656565656565656565656565656565656565656565656565650a'])
10629 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
10630 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
10631 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
10632 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
10633 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
10634
10635 AT_CHECK([ovs-appctl revalidator/purge])
10636
10637 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10638
10639 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10640 ])
10641
10642 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10643 dnl No dropped packets
10644 n_packets=0
10645 ])
10646
10647 OVS_VSWITCHD_STOP
10648 AT_CLEANUP
10649
10650 AT_SETUP([ofproto-dpif - conntrack - disable tcp sequence checking])
10651 OVS_VSWITCHD_START
10652
10653 add_of_ports br0 1 2
10654
10655 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10656 AT_DATA([flows.txt], [dnl
10657 dnl Table 0
10658 dnl
10659 table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10660 table=0,priority=10,in_port=2,ip,action=ct(table=1)
10661 table=0,priority=1,action=drop
10662 dnl
10663 dnl Table 1
10664 dnl
10665 dnl The following two flows are separated to explicitly count the packets
10666 dnl that create a new connection
10667 table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10668 table=1,priority=100,cookie=0x2,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
10669 dnl
10670 table=1,priority=100,cookie=0x3,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10671 table=1,cookie=0x4,ip,ct_state=+trk+inv,action=drop
10672 ])
10673
10674 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10675
10676 dnl Send 9 packets; one packet will be marked invalid.
10677 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10678 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10679 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10680 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10681 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10682 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10683 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10684 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10685 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10686
10687 AT_CHECK([ovs-appctl revalidator/purge])
10688 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10689 n_packets=1
10690 ])
10691
10692 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10693 n_packets=4
10694 ])
10695
10696 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10697 n_packets=3
10698 ])
10699
10700 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10701 n_packets=1
10702 ])
10703
10704 AT_CHECK([ovs-appctl dpctl/flush-conntrack])
10705
10706 AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10707 TCP sequence checking: enabled
10708 ])
10709
10710 AT_CHECK([ovs-appctl dpctl/ct-disable-tcp-seq-chk], [], [dnl
10711 disabling TCP sequence checking successful
10712 ])
10713
10714 AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10715 TCP sequence checking: disabled
10716 ])
10717
10718 dnl Send exactly the same 9 packets to confirm no additional packets are marked invalid.
10719 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10720 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10721 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10722 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10723 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10724 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10725 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10726 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10727 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10728
10729 AT_CHECK([ovs-appctl revalidator/purge])
10730 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10731 n_packets=2
10732 ])
10733
10734 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10735 n_packets=8
10736 ])
10737
10738 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10739 n_packets=7
10740 ])
10741
10742 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10743 n_packets=1
10744 ])
10745
10746 AT_CHECK([ovs-appctl dpctl/ct-enable-tcp-seq-chk], [], [dnl
10747 enabling TCP sequence checking successful
10748 ])
10749
10750 AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10751 TCP sequence checking: enabled
10752 ])
10753
10754 AT_CHECK([ovs-appctl dpctl/flush-conntrack])
10755
10756 dnl Send exactly the same 9 packets after disabling TCP sequence checking to
10757 dnl confirm one more packet is marked invalid.
10758 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10759 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10760 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10761 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10762 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10763 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10764 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10765 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10766 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10767
10768 AT_CHECK([ovs-appctl revalidator/purge])
10769 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10770 n_packets=3
10771 ])
10772
10773 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10774 n_packets=12
10775 ])
10776
10777 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10778 n_packets=10
10779 ])
10780
10781 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10782 n_packets=2
10783 ])
10784
10785 OVS_VSWITCHD_STOP
10786 AT_CLEANUP
10787
10788 dnl This is a truncated version of "ofproto-dpif - conntrack - controller",
10789 dnl with extra send-to-controller actions following ct_clear to show that
10790 dnl the connection tracking data has been cleared.
10791 AT_SETUP([ofproto-dpif - conntrack - ct_clear])
10792 OVS_VSWITCHD_START
10793
10794 add_of_ports br0 1 2
10795
10796 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10797
10798 dnl Allow new connections on p1->p2, but not on p2->p1.
10799 AT_DATA([flows.txt], [dnl
10800 dnl Table 0
10801 dnl
10802 table=0,priority=100,arp,action=normal
10803 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller,ct_clear,controller
10804 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10805 table=0,priority=1,action=drop
10806 dnl
10807 dnl Table 1
10808 dnl
10809 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller,ct_clear,controller
10810 table=1,priority=1,action=drop
10811 ])
10812
10813 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10814
10815 AT_CAPTURE_FILE([ofctl_monitor.log])
10816 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10817
10818 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10819
10820 dnl OK, now start a new connection from port 1.
10821 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10822
10823 dnl Now try a reply from port 2.
10824 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10825
10826 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
10827 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10828
10829 dnl Check this output. We only see the latter two packets, not the first.
10830 dnl Note that the first packet doesn't have the ct_state bits set. This
10831 dnl happens because the ct_state field is available only after recirc.
10832 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10833 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10834 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
10835 dnl
10836 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10837 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
10838 dnl
10839 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10840 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10841 dnl
10842 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
10843 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10844 ])
10845 OVS_VSWITCHD_STOP
10846 AT_CLEANUP
10847
10848 AT_SETUP([ofproto-dpif - conntrack - match masked ct fields])
10849 OVS_VSWITCHD_START
10850
10851 add_of_ports br0 1 2
10852
10853 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10854
10855 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10856 AT_DATA([flows.txt], [dnl
10857 table=0,arp,action=normal
10858 table=0,ip,in_port=1,udp,nw_src=10.1.2.1/24,action=ct(commit)
10859 table=0,ip,in_port=1,udp6,ipv6_dst=2001:db8::1/64,action=ct(commit)
10860 table=0,ip,in_port=1,udp,tp_src=3/0x1,action=ct(commit)
10861 table=0,ip,in_port=2,actions=ct(table=1)
10862 table=0,ip6,in_port=2,actions=ct(table=1)
10863 table=1,priority=10,udp,ct_state=+trk+rpl,ct_nw_src=10.1.2.1/24,actions=controller
10864 table=1,priority=10,udp6,ct_state=+trk+rpl,ct_ipv6_dst=2001:db8::1/64,actions=controller
10865 table=1,priority=10,udp,ct_state=+trk+rpl,ct_tp_src=3/0x1,actions=controller
10866 table=1,priority=1,action=drop
10867 ])
10868
10869 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10870
10871 AT_CAPTURE_FILE([ofctl_monitor.log])
10872 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10873
10874 dnl Match ct_nw_src=10.1.2.1/24
10875 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.1.2.100,dst=10.1.2.200,proto=17,tos=0,ttl=64,frag=no),udp(src=6,dst=6)'])
10876 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.2.200,dst=10.1.2.100,proto=17,tos=0,ttl=64,frag=no),udp(src=6,dst=6)'])
10877
10878 dnl Match ct_ipv6_dst=2001:db8::1/64
10879 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(0x86dd),ipv6(src=2001:db8::1,dst=2001:db8::2,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=1,dst=2)'])
10880 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x86dd),ipv6(src=2001:db8::2,dst=2001:db8::1,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=2,dst=1)'])
10881
10882 dnl Match ct_tp_src=3/0x1
10883 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.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10884 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10885
10886 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
10887 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10888
10889 dnl Check this output.
10890 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10891 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.2.100,ct_nw_dst=10.1.2.200,ct_nw_proto=17,ct_tp_src=6,ct_tp_dst=6,ip,in_port=2 (via action) data_len=106 (unbuffered)
10892 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.2.200,nw_dst=10.1.2.100,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=6,tp_dst=6 udp_csum:221
10893 dnl
10894 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=126 ct_state=est|rpl|trk,ct_ipv6_src=2001:db8::1,ct_ipv6_dst=2001:db8::2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ipv6,in_port=2 (via action) data_len=126 (unbuffered)
10895 udp6,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,ipv6_src=2001:db8::2,ipv6_dst=2001:db8::1,ipv6_label=0x00000,nw_tos=112,nw_ecn=0,nw_ttl=128,tp_src=2,tp_dst=1 udp_csum:bfe2
10896 dnl
10897 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10898 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10899 ])
10900
10901 OVS_VSWITCHD_STOP
10902 AT_CLEANUP
10903
10904 AT_SETUP([ofproto-dpif - conntrack - ofproto/trace])
10905 OVS_VSWITCHD_START
10906
10907 add_of_ports br0 1 2 3 4
10908
10909 AT_DATA([flows.txt], [dnl
10910 dnl Table 0
10911 dnl
10912 table=0,priority=100,arp,action=normal
10913 table=0,priority=10,udp,action=ct(table=1,zone=0)
10914 table=0,priority=10,tcp,action=ct(table=2,zone=1)
10915 table=0,priority=1,action=drop
10916 dnl
10917 dnl Table 1
10918 dnl
10919 table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+new,udp,action=ct(commit,zone=0),2
10920 table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+est,udp,action=2
10921 table=1,priority=10,in_port=2,ct_zone=0,ct_state=+trk+est,udp,action=1
10922 table=1,priority=1,action=drop
10923 dnl
10924 dnl Table 2
10925 dnl
10926 table=2,priority=10,in_port=1,tcp,ct_zone=1,ct_state=+trk+new,tcp,action=ct(commit,zone=1),ct(table=3,zone=2)
10927 table=2,priority=10,in_port=1,tcp,ct_zone=1,ct_state=+trk+est,tcp,action=ct(table=3,zone=2)
10928 table=2,priority=1,action=drop
10929 dnl
10930 dnl Table 3
10931 dnl
10932 table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+new,tcp,action=ct(commit,zone=2),4
10933 table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+est,tcp,action=3
10934 table=2,priority=1,action=drop
10935 ])
10936
10937 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10938
10939 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,udp'], [0], [stdout])
10940 AT_CHECK([tail -1 stdout], [0],
10941 [Datapath actions: drop
10942 ])
10943
10944 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,udp'], [0], [stdout])
10945 AT_CHECK([tail -1 stdout], [0],
10946 [Datapath actions: ct(commit),2
10947 ])
10948
10949 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp'], [0], [stdout])
10950 AT_CHECK([tail -1 stdout], [0],
10951 [Datapath actions: ct(commit,zone=2),4
10952 ])
10953
10954 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp' --ct-next 'trk,est' --ct-next 'trk,est' ], [0], [stdout])
10955 AT_CHECK([tail -1 stdout], [0],
10956 [Datapath actions: 3
10957 ])
10958
10959 OVS_VSWITCHD_STOP
10960 AT_CLEANUP
10961
10962 AT_SETUP([ofproto-dpif - nat - ofproto/trace])
10963 OVS_VSWITCHD_START
10964
10965 add_of_ports br0 1 2 3
10966
10967 flow="in_port=1,udp,nw_src=1.1.1.1,nw_dst=1.1.1.2,udp_src=100,udp_dst=200"
10968 AT_DATA([flows.txt], [dnl
10969 table=0,priority=100,ip,nw_src=1.1.1.1,ct_state=-trk,action=ct(commit,nat(src=10.0.0.1-10.0.0.42:1000-1042),table=0)
10970 table=0,priority=100,udp,ct_state=+trk,nw_src=10.0.0.1,nw_dst=1.1.1.2,tp_src=1000,tp_dst=200,action=ct(commit,nat(dst=20.0.0.1-20.0.0.42:2000-2042),table=0)
10971 table=0,priority=100,udp,ct_state=+trk,nw_src=10.0.0.1,nw_dst=20.0.0.1,tp_src=1000,tp_dst=2000,action=3
10972 table=0,priority=90,ip,ct_state=+trk,action=2
10973 ])
10974 AT_CHECK([ovs-ofctl del-flows br0])
10975 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10976 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
10977 AT_CHECK([tail -1 stdout], [0],
10978 [Datapath actions: 3
10979 ])
10980
10981 flow="in_port=1,udp6,ipv6_src=1::1,ipv6_dst=1::2,udp_src=100,udp_dst=200"
10982 AT_DATA([flows.txt], [dnl
10983 table=0,priority=100,ip6,ipv6_src=1::1,ct_state=-trk,action=ct(commit,nat(src=[[10::1]]-[[10::42]]:1000-1042),table=0)
10984 table=0,priority=100,udp6,ct_state=+trk,ipv6_src=10::1,ipv6_dst=1::2,tp_src=1000,tp_dst=200,action=ct(commit,nat(dst=[[20::1]]-[[20::42]]:2000-2042),table=0)
10985 table=0,priority=100,udp6,ct_state=+trk,ipv6_src=10::1,ipv6_dst=20::1,tp_src=1000,tp_dst=2000,action=3
10986 table=0,priority=90,ip6,ct_state=+trk,action=2
10987 ])
10988 AT_CHECK([ovs-ofctl del-flows br0])
10989 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10990 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
10991 AT_CHECK([tail -1 stdout], [0],
10992 [Datapath actions: 3
10993 ])
10994
10995 OVS_VSWITCHD_STOP
10996 AT_CLEANUP
10997
10998 AT_SETUP([ofproto - set mtu])
10999 OVS_VSWITCHD_START
11000
11001 add_of_ports br0 1
11002
11003 # Check that initial MTU is 1500 for 'br0' and 'p1'.
11004 AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
11005 1500
11006 ])
11007 AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
11008 1500
11009 ])
11010
11011 # Request new MTU for 'p1'
11012 AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
11013
11014 # Check that the new MTU is applied
11015 AT_CHECK([ovs-vsctl wait-until Interface p1 mtu=1600])
11016 # The internal port 'br0' should have the same MTU value as p1, becase it's
11017 # the new bridge minimum.
11018 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1600])
11019
11020 AT_CHECK([ovs-vsctl del-port br0 p1])
11021
11022 # When 'p1' is deleted, the internal port should return to the default MTU
11023 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1500])
11024
11025 # New port with 'mtu_request' in the same transaction.
11026 AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
11027 AT_CHECK([ovs-vsctl wait-until Interface p2 mtu=1600])
11028 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1600])
11029
11030 # Explicitly set mtu_request on the internal member. This should prevent
11031 # the MTU from being overriden.
11032 AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
11033 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1700])
11034
11035 # The new MTU on p2 should not affect br0.
11036 AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
11037 AT_CHECK([ovs-vsctl wait-until Interface p2 mtu=1400])
11038 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1700])
11039
11040 # Remove explicit mtu_request from br0. Now it should track the bridge
11041 # minimum again.
11042 AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
11043 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1400])
11044
11045 OVS_VSWITCHD_STOP
11046 AT_CLEANUP
11047
11048 AT_SETUP([ofproto - fragment prerequisites])
11049 OVS_VSWITCHD_START
11050
11051 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
11052
11053 add_of_ports br0 1
11054
11055 AT_DATA([flows.txt], [dnl
11056 priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
11057 priority=1,in_port=1,udp,action=drop
11058 ])
11059
11060 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
11061
11062 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
11063
11064 ovs-appctl time/stop
11065 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
11066 ovs-appctl time/warp 5000
11067
11068 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
11069 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
11070 ])
11071
11072 dnl Change the flow table. This will trigger revalidation of all the flows.
11073 AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
11074 AT_CHECK([ovs-appctl revalidator/wait], [0])
11075
11076 dnl We don't want revalidators to delete any flow. If the flow has been
11077 dnl deleted it means that there's some inconsistency with the revalidation.
11078 AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
11079
11080 OVS_VSWITCHD_STOP
11081 AT_CLEANUP
11082
11083 AT_SETUP([ofproto-dpif - check_pkt_larger action])
11084 OVS_VSWITCHD_START
11085 add_of_ports br0 1 2 3 4
11086
11087 AT_DATA([flows.txt], [dnl
11088 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11089 table=1,in_port=1,reg0=0x1/0x1 actions=output:2,resubmit(,2)
11090 table=1,in_port=1,actions=output:3,resubmit(,2)
11091 table=2,in_port=1,actions=mod_dl_dst:82:82:82:82:82:82,output:4
11092 ])
11093
11094 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11095 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
11096 AT_CHECK([tail -1 stdout], [0], [dnl
11097 Datapath actions: check_pkt_len(size=200,gt(2,set(eth(dst=82:82:82:82:82:82)),4),le(3,set(eth(dst=82:82:82:82:82:82)),4))
11098 ])
11099
11100 dnl Test flow xlate check_pkt_large clone action without using datapath check_pkt_len action.
11101 AT_CHECK([ovs-appctl dpif/set-dp-features br0 check_pkt_len false], [0], [ignore])
11102
11103 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
11104 AT_CHECK([tail -3 stdout], [0], [dnl
11105 Datapath actions: 3,set(eth(dst=82:82:82:82:82:82)),4
11106 This flow is handled by the userspace slow path because it:
11107 - Uses action(s) not supported by datapath.
11108 ])
11109
11110 dnl Enable datapath check_pkt_len action
11111 AT_CHECK([ovs-appctl dpif/set-dp-features br0 check_pkt_len true], [0], [ignore])
11112
11113 ovs-ofctl del-flows br0
11114
11115 AT_DATA([flows.txt], [dnl
11116 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11117 table=1,in_port=1,priority=200,reg0=0x1/0x1 actions=output:2
11118 ])
11119
11120 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11121 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
11122 AT_CHECK([tail -1 stdout], [0], [dnl
11123 Datapath actions: check_pkt_len(size=200,gt(2),le(drop))
11124 ])
11125
11126 ovs-ofctl del-flows br0
11127 AT_DATA([flows.txt], [dnl
11128 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]]
11129 ])
11130
11131 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11132 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
11133 AT_CHECK([tail -1 stdout], [0], [dnl
11134 Datapath actions: check_pkt_len(size=200,gt(drop),le(drop))
11135 ])
11136
11137 ovs-ofctl del-flows br0
11138 AT_DATA([flows.txt], [dnl
11139 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11140 table=1,in_port=1,priority=200,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(mod_dl_src:80:81:81:81:81:81,set_field:192.168.5.5->ip_dst,output:3),output:4
11141 table=1,in_port=1,priority=0,ip actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(ct(commit),output:3),output:4
11142 ])
11143
11144 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11145 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
11146 AT_CHECK([tail -1 stdout], [0], [dnl
11147 Datapath actions: check_pkt_len(size=200,gt(set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4),le(set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),clone(ct(commit),3),4))
11148 ])
11149
11150 AT_DATA([flows.txt], [dnl
11151 table=0,priority=0 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11152 table=1,in_port=1,priority=200,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src, resubmit(,0))
11153 table=1,in_port=1,priority=0,ip actions=clone(set_field:192.168.3.4->ip_src, resubmit(,0))
11154 ])
11155
11156 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11157 ovs-ofctl dump-flows br0
11158
11159 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
11160 AT_CHECK([tail -3 stdout], [0], [dnl
11161 Megaflow: recirc_id=0,eth,ip,reg0=0/0x1,in_port=1,nw_src=10.10.10.2,nw_frag=no
11162 Datapath actions: drop
11163 Translation failed (Recursion too deep), packet is dropped.
11164 ])
11165
11166 ovs-ofctl del-flows br0
11167 AT_DATA([flows.txt], [dnl
11168 table=0,priority=0 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11169 table=1,ip,nw_src=192.168.3.3 actions=output:3
11170 table=1,ip,nw_src=192.168.3.4 actions=output:4
11171 table=1,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src, resubmit(,0))
11172 table=1,ip actions=clone(set_field:192.168.3.4->ip_src, resubmit(,0))
11173 ])
11174
11175 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11176 ovs-ofctl dump-flows br0
11177
11178 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
11179 AT_CHECK([tail -1 stdout], [0], [dnl
11180 Datapath actions: check_pkt_len(size=200,gt(set(ipv4(src=192.168.3.3)),check_pkt_len(size=200,gt(3),le(3))),le(set(ipv4(src=192.168.3.4)),check_pkt_len(size=200,gt(4),le(4))))
11181 ])
11182
11183 ovs-ofctl del-flows br0
11184 AT_DATA([flows.txt], [dnl
11185 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11186 table=1,in_port=1,reg0=0x1/0x1 actions=mod_dl_dst:82:82:82:82:82:82,controller(),resubmit(,2)
11187 table=1,in_port=1 actions=resubmit(,2)
11188 table=2,ip,dl_dst=82:82:82:82:82:82 actions=ct(table=3)
11189 table=2,ip,dl_dst=50:54:00:00:00:0a actions=ct(table=3)
11190 table=3,ip,reg0=0x1/0x1 actions=output:2
11191 table=3,ip actions=output:4
11192 ])
11193
11194 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11195 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
11196 AT_CHECK([cat stdout | grep Datapath -B1], [0], [dnl
11197 Megaflow: recirc_id=0,eth,ip,in_port=1,dl_dst=50:54:00:00:00:0a,nw_frag=no
11198 Datapath actions: check_pkt_len(size=200,gt(set(eth(dst=82:82:82:82:82:82)),userspace(pid=0,controller(reason=1,dont_send=1,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535)),ct,recirc(0x2)),le(ct,recirc(0x3)))
11199 --
11200 Megaflow: recirc_id=0x2,eth,ip,in_port=1,nw_frag=no
11201 Datapath actions: 2
11202 --
11203 Megaflow: recirc_id=0x3,eth,ip,in_port=1,nw_frag=no
11204 Datapath actions: 4
11205 ])
11206
11207 OVS_VSWITCHD_STOP
11208 AT_CLEANUP
11209
11210 AT_SETUP([ofproto-dpif - check_pkt_larger with continuation and ct])
11211 OVS_VSWITCHD_START
11212 add_of_ports --pcap br0 `seq 1 4`
11213
11214 AT_CAPTURE_FILE([ofctl_monitor0.log])
11215 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
11216
11217 AT_DATA([flows.txt], [dnl
11218 table=0,in_port=1 actions=check_pkt_larger(150)->NXM_NX_REG0[[0]],resubmit(,1)
11219 table=1,ip,reg0=0x1/0x1 actions=mod_dl_dst:82:82:82:82:82:82,controller(pause),resubmit(,2)
11220 table=1,ip,reg0=0 actions=mod_dl_dst:83:83:83:83:83:83,controller(pause),resubmit(,2)
11221 table=2,ip,dl_dst=82:82:82:82:82:82 actions=ct(table=3)
11222 table=2,ip,dl_dst=83:83:83:83:83:83 actions=ct(table=3)
11223 table=3,ip,reg0=0x1/0x1 actions=ct(commit),output:2
11224 table=3,ip actions=ct(commit),output:4
11225 ])
11226
11227 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11228
11229 flow="in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)"
11230
11231 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
11232
11233 OVS_WAIT_UNTIL([test 1 = `ovs-ofctl parse-pcap p4-tx.pcap \
11234 | grep dl_dst=83:83:83:83:83:83 | wc -l`])
11235 AT_CHECK([test 0 = `ovs-ofctl parse-pcap p2-tx.pcap | wc -l`])
11236
11237 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow" --len 200], [0], [stdout])
11238
11239 OVS_WAIT_UNTIL([test 1 = `ovs-ofctl parse-pcap p2-tx.pcap \
11240 | grep dl_dst=82:82:82:82:82:82 | wc -l`])
11241 AT_CHECK([test 1 = `ovs-ofctl parse-pcap p2-tx.pcap | wc -l`])
11242
11243 OVS_VSWITCHD_STOP
11244 AT_CLEANUP