]> git.proxmox.com Git - ovs.git/blame - tests/ofproto-dpif.at
Fix ovs-dpctl-top by removing 3 wrong hunks in py3-compat.patch.
[ovs.git] / tests / ofproto-dpif.at
CommitLineData
29901626
BP
1AT_BANNER([ofproto-dpif])
2
fe07df80
IM
3m4_divert_push([PREPARE_TESTS])
4
5# Helper function to check the spread of dp_hash flows over buckets in the datapath
6check_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
23m4_divert_pop([PREPARE_TESTS])
24
25
27f57736
JS
26AT_SETUP([ofproto-dpif - revalidator/wait])
27OVS_VSWITCHD_START
28AT_CHECK([ovs-appctl revalidator/wait])
29OVS_VSWITCHD_STOP
30AT_CLEANUP
31
b4e50218
JS
32AT_SETUP([ofproto-dpif - active-backup bonding (with primary)])
33
91fc374a
BP
34dnl Create br0 with members p1, p2 and p7, creating bond0 with p1 and
35dnl p2 (p1 as primary) and br1 with members p3, p4 and p8.
b4e50218
JS
36dnl toggle p1,p2 of bond0 up and down to test bonding in active-backup mode.
37dnl With p1 down and p2 up/active, bring p1 back up. Since p1 is the primary,
38dnl it should become active.
adcf00ba 39OVS_VSWITCHD_START(
b4e50218
JS
40 [add-bond br0 bond0 p1 p2 bond_mode=active-backup \
41 other_config:bond-primary=p1 -- \
adcf00ba
AZ
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 --])
b4e50218 52AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
55466d72 53WAIT_FOR_DUMMY_PORTS([p3], [p4])
b4e50218
JS
54OVS_WAIT_UNTIL([test -n "`ovs-appctl bond/show | grep 'active-backup primary: p1'`"])
55
56
57AT_CHECK([ovs-ofctl add-flow br0 action=normal])
58AT_CHECK([ovs-ofctl add-flow br1 action=normal])
59ovs-appctl netdev-dummy/set-admin-state up
60ovs-appctl time/warp 100
61ovs-appctl netdev-dummy/set-admin-state p2 down
62ovs-appctl time/stop
63ovs-appctl time/warp 100
64AT_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)'])
65AT_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)'])
66ovs-appctl time/warp 100
67ovs-appctl netdev-dummy/set-admin-state p2 up
68ovs-appctl netdev-dummy/set-admin-state p1 down
69ovs-appctl time/warp 100
70AT_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)'])
71AT_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)'])
72ovs-appctl time/warp 2000 100
73AT_CHECK([ovs-appctl dpctl/dump-flows | grep 'in_port([[348]])' | strip_xout], [0], [dnl
74recirc_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>
75recirc_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>
76recirc_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>
77recirc_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>
78recirc_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>
79recirc_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
82ovs-appctl netdev-dummy/set-admin-state p1 up
83ovs-appctl time/warp 100
91fc374a 84OVS_WAIT_UNTIL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [0], [dnl
b4e50218
JS
85---- bond0 ----
86bond_mode: active-backup
87bond may use recirculation: no, <del>
88bond-hash-basis: 0
89updelay: 0 ms
90downdelay: 0 ms
91lacp_status: off
92lacp_fallback_ab: false
93active-backup primary: p1
91fc374a 94<active member mac del>
b4e50218 95
91fc374a
BP
96member p1: enabled
97 active member
b4e50218
JS
98 may_enable: true
99
91fc374a 100member p2: enabled
b4e50218
JS
101 may_enable: true
102
103])
104
105OVS_VSWITCHD_STOP
106AT_CLEANUP
107
108AT_SETUP([ofproto-dpif - active-backup bonding (primary validation)])
109dnl Make a switch with 3 ports in a bond, so that when we delete one of
110dnl the ports from the bond, there are still 2 ports left and the bond
111dnl remains functional.
112OVS_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 --])
623540e4 119AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
adcf00ba 120
91fc374a 121dnl Make sure the initial primary member is set
b4e50218
JS
122OVS_WAIT_UNTIL([test -n "`ovs-appctl bond/show | grep 'active-backup primary: p1'`"])
123
91fc374a 124dnl Down the primary member and verify that we switched. Then
b4e50218
JS
125dnl bring the primary back and verify that we switched back to the
126dnl primary.
127ovs-appctl netdev-dummy/set-admin-state p1 down
128ovs-appctl time/warp 100
91fc374a 129OVS_WAIT_UNTIL([test -n "`ovs-appctl bond/show | fgrep 'member p1: disabled'`"])
b4e50218
JS
130ovs-appctl netdev-dummy/set-admin-state p1 up
131ovs-appctl time/warp 100
91fc374a 132OVS_WAIT_UNTIL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [0], [dnl
b4e50218
JS
133---- bond0 ----
134bond_mode: active-backup
135bond may use recirculation: no, <del>
136bond-hash-basis: 0
137updelay: 0 ms
138downdelay: 0 ms
139lacp_status: off
140lacp_fallback_ab: false
141active-backup primary: p1
91fc374a 142<active member mac del>
b4e50218 143
91fc374a
BP
144member p1: enabled
145 active member
b4e50218
JS
146 may_enable: true
147
91fc374a 148member p2: enabled
b4e50218
JS
149 may_enable: true
150
91fc374a 151member p3: enabled
b4e50218
JS
152 may_enable: true
153
154])
155
156dnl Now delete the primary and verify that the output shows that the
91fc374a 157dnl primary is no longer an member
b4e50218
JS
158ovs-vsctl --id=@p1 get Interface p1 -- remove Port bond0 interfaces @p1
159ovs-appctl time/warp 100
91fc374a 160OVS_WAIT_UNTIL([test -n "`ovs-appctl bond/show | fgrep 'active-backup primary: p1 (no such member)'`"])
b4e50218
JS
161
162dnl Now re-add the primary and verify that the output shows that the
163dnl primary is available again.
164dnl
91fc374a 165dnl First, get the UUIDs of the members that exist on bond0.
b4e50218
JS
166dnl Strip the trailing ] so that we can add a new UUID to the end.
167uuids=`ovs-vsctl get Port bond0 interfaces | sed -e 's/]//'`
91fc374a 168dnl Create a new port "p1" and add its UUID to the set of members
b4e50218
JS
169dnl on bond0.
170ovs-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]"
173ovs-appctl time/warp 100
91fc374a 174OVS_WAIT_UNTIL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [0], [dnl
b4e50218
JS
175---- bond0 ----
176bond_mode: active-backup
177bond may use recirculation: no, <del>
178bond-hash-basis: 0
179updelay: 0 ms
180downdelay: 0 ms
181lacp_status: off
182lacp_fallback_ab: false
183active-backup primary: p1
91fc374a 184<active member mac del>
b4e50218 185
91fc374a
BP
186member p1: enabled
187 active member
b4e50218
JS
188 may_enable: true
189
91fc374a 190member p2: enabled
b4e50218
JS
191 may_enable: true
192
91fc374a 193member p3: enabled
b4e50218
JS
194 may_enable: true
195
196])
197
198dnl Switch to another primary
199ovs-vsctl set port bond0 other_config:bond-primary=p2
200ovs-appctl time/warp 100
91fc374a 201OVS_WAIT_UNTIL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [0], [dnl
b4e50218
JS
202---- bond0 ----
203bond_mode: active-backup
204bond may use recirculation: no, <del>
205bond-hash-basis: 0
206updelay: 0 ms
207downdelay: 0 ms
208lacp_status: off
209lacp_fallback_ab: false
210active-backup primary: p2
91fc374a 211<active member mac del>
b4e50218 212
91fc374a
BP
213member p1: enabled
214 active member
b4e50218
JS
215 may_enable: true
216
91fc374a 217member p2: enabled
b4e50218
JS
218 may_enable: true
219
91fc374a 220member p3: enabled
b4e50218
JS
221 may_enable: true
222
223])
224
225dnl Remove the "bond-primary" config directive from the bond.
226AT_CHECK([ovs-vsctl remove Port bond0 other_config bond-primary])
227ovs-appctl time/warp 100
91fc374a 228OVS_WAIT_UNTIL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [0], [dnl
b4e50218
JS
229---- bond0 ----
230bond_mode: active-backup
231bond may use recirculation: no, <del>
232bond-hash-basis: 0
233updelay: 0 ms
234downdelay: 0 ms
235lacp_status: off
236lacp_fallback_ab: false
237active-backup primary: <none>
91fc374a 238<active member mac del>
b4e50218 239
91fc374a
BP
240member p1: enabled
241 active member
b4e50218
JS
242 may_enable: true
243
91fc374a 244member p2: enabled
b4e50218
JS
245 may_enable: true
246
91fc374a 247member p3: enabled
b4e50218
JS
248 may_enable: true
249
250])
251
252OVS_VSWITCHD_STOP
253AT_CLEANUP
254
255AT_SETUP([ofproto-dpif - active-backup bonding (without primary)])
91fc374a
BP
256dnl Create br0 with members p1, p2 and p7, creating bond0 with p1 and p2
257dnl and br1 with members p3, p4 and p8.
b4e50218
JS
258dnl toggle p1,p2 of bond0 up and down to test bonding in active-backup mode.
259OVS_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 --])
271AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
272WAIT_FOR_DUMMY_PORTS([p3], [p4])
273OVS_WAIT_UNTIL([test -n "`ovs-appctl bond/show | grep 'active-backup primary: <none>'`"])
274
adcf00ba
AZ
275AT_CHECK([ovs-ofctl add-flow br0 action=normal])
276AT_CHECK([ovs-ofctl add-flow br1 action=normal])
277ovs-appctl netdev-dummy/set-admin-state up
278ovs-appctl time/warp 100
279ovs-appctl netdev-dummy/set-admin-state p2 down
280ovs-appctl time/stop
281ovs-appctl time/warp 100
282AT_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)'])
283AT_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)'])
284ovs-appctl time/warp 100
285ovs-appctl netdev-dummy/set-admin-state p2 up
286ovs-appctl netdev-dummy/set-admin-state p1 down
287ovs-appctl time/warp 100
288AT_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)'])
289AT_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)'])
b4e50218
JS
290ovs-appctl time/warp 2000 100
291AT_CHECK([ovs-appctl dpctl/dump-flows | grep 'in_port([[348]])' | strip_xout], [0], [dnl
292recirc_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>
293recirc_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>
294recirc_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>
295recirc_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>
296recirc_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>
297recirc_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>
adcf00ba
AZ
298])
299OVS_VSWITCHD_STOP
300AT_CLEANUP
301
5f5ebd4c 302AT_SETUP([ofproto-dpif - balance-slb bonding])
91fc374a
BP
303# Create br0 with members bond0(p1, p2, p3) and p7,
304# and br1 with members p4, p5, p6 and p8.
adcf00ba
AZ
305# p1 <-> p4, p2 <-> p5, p3 <-> p6
306# Send some traffic, make sure the traffic are spread based on source mac.
307OVS_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 --])
55466d72 321WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
adcf00ba
AZ
322AT_CHECK([ovs-ofctl add-flow br0 action=normal])
323AT_CHECK([ovs-ofctl add-flow br1 action=normal])
324AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
325])
adcf00ba
AZ
326ovs-appctl time/stop
327ovs-appctl time/warp 100
328(
329for 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)
335ovs-appctl time/warp 100
336AT_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.
339AT_CHECK([test `egrep 'in_port\(4\)' br1_flows.txt |wc -l` -gt 3])
340AT_CHECK([test `egrep 'in_port\(5\)' br1_flows.txt |wc -l` -gt 3])
341AT_CHECK([test `egrep 'in_port\(6\)' br1_flows.txt |wc -l` -gt 3])
342OVS_VSWITCHD_STOP
343AT_CLEANUP
344
5f5ebd4c 345AT_SETUP([ofproto-dpif - balance-tcp bonding])
91fc374a
BP
346# Create br0 with members bond0(p1, p2, p3) and p7,
347# and br1 with members bond1(p4, p5, p6) and p8.
adcf00ba
AZ
348# bond0 <-> bond1
349# Send some traffic, make sure the traffic are spread based on L4 headers.
350OVS_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 --])
367AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
368])
369AT_CHECK([ovs-ofctl add-flow br0 action=normal])
370AT_CHECK([ovs-ofctl add-flow br1 action=normal])
371AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
372], [])
48105e85 373OVS_WAIT_WHILE([ovs-appctl bond/show | grep "may_enable: false"])
adcf00ba
AZ
374ovs-appctl time/stop
375ovs-appctl time/warp 100
376ovs-appctl lacp/show > lacp.txt
377ovs-appctl bond/show > bond.txt
3950e350
MC
378# Check that lb_output is not enabled by default.
379AT_CHECK([grep -q '^lb_output action: disabled' bond.txt])
adcf00ba 380(
25d6a6a8 381for i in `seq 0 255` ;
adcf00ba 382 do
ea2735d3 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)"
adcf00ba
AZ
384 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
385 done
386)
bdba1947 387ovs-appctl time/warp 300 100
adcf00ba
AZ
388AT_CHECK([ovs-appctl dpif/dump-flows br0 |grep tcp > br0_flows.txt])
389AT_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.
3950e350
MC
392AT_CHECK([test $(grep -c in_port.4 br1_flows.txt) -gt 24])
393AT_CHECK([test $(grep -c in_port.5 br1_flows.txt) -gt 24])
394AT_CHECK([test $(grep -c in_port.6 br1_flows.txt) -gt 24])
395# Check that bonding is doing dp_hash.
396AT_CHECK([grep -q dp_hash br0_flows.txt])
397# Enabling lb_output.
398AT_CHECK([ovs-vsctl set Port bond0 other_config:lb-output-action=true])
399OVS_WAIT_UNTIL([ovs-appctl bond/show | grep -q '^lb_output action: enabled'])
400ovs-appctl time/warp 10000 500
401ovs-appctl revalidator/wait
402OVS_WAIT_WHILE([ovs-appctl dpif/dump-flows br1 | grep -q tcp])
403(
404for 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)
410ovs-appctl time/warp 300 100
411AT_CHECK([ovs-appctl dpif/dump-flows br0 | grep tcp > br0_flows.txt])
412AT_CHECK([ovs-appctl dpif/dump-flows br1 | grep tcp > br1_flows.txt])
413# Make sure there is resonable distribution to all three ports, again.
414AT_CHECK([test $(grep -c in_port.4 br1_flows.txt) -gt 24])
415AT_CHECK([test $(grep -c in_port.5 br1_flows.txt) -gt 24])
416AT_CHECK([test $(grep -c in_port.6 br1_flows.txt) -gt 24])
417AT_CHECK([grep -q lb_output br0_flows.txt])
f9038ef6 418
82a106eb
AM
419AT_CHECK([test $(ovs-appctl dpif-netdev/bond-show | grep -c bucket) -eq 256])
420AT_CHECK([ovs-vsctl set Port bond0 other_config:lb-output-action=false])
421OVS_WAIT_UNTIL([test -z "$(ovs-appctl dpif-netdev/bond-show)"])
422
f9038ef6
AW
423OVS_VSWITCHD_STOP()
424AT_CLEANUP
425
426# Makes sure recirculation does not change the way packet is handled.
5f5ebd4c 427AT_SETUP([ofproto-dpif - balance-tcp bonding, different recirc flow ])
f9038ef6
AW
428OVS_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])
449AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
450])
451
f12bfd04
AW
452# Waits for all ifaces enabled.
453OVS_WAIT_UNTIL([test `ovs-appctl bond/show | grep -- "may_enable: true" | wc -l` -ge 4])
454
f9038ef6
AW
455# The dl_vlan flow should not be ever matched,
456# since recirculation should not change the flow handling.
457AT_DATA([flows.txt], [dnl
458table=0 priority=1 in_port=5 actions=mod_vlan_vid:1,output(101)
459table=0 priority=2 in_port=5 dl_vlan=1 actions=drop
460])
461AT_CHECK([ovs-ofctl add-flows br-int flows.txt])
462
463# Sends a packet to trigger recirculation.
f9038ef6
AW
464AT_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.
467AT_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.
e2167cb7 471AT_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
efe179e0 472table_id=254, n_packets=1, n_bytes=38, priority=20,recirc_id=0x0,dp_hash=0x0/0xff,actions=output
f9038ef6
AW
473])
474
475# Checks the flow stats in br-int, should be only one match.
476AT_CHECK([ovs-ofctl dump-flows br-int | ofctl_strip | sort], [0], [dnl
efe179e0 477 n_packets=1, n_bytes=34, priority=1,in_port=5 actions=mod_vlan_vid:1,output:101
f9038ef6
AW
478 priority=2,in_port=5,dl_vlan=1 actions=drop
479NXST_FLOW reply:
480])
481
adcf00ba
AZ
482OVS_VSWITCHD_STOP()
483AT_CLEANUP
484
29901626 485AT_SETUP([ofproto-dpif - resubmit])
023e1e0a 486OVS_VSWITCHD_START
ca5792f0 487add_of_ports br0 1 10 11 12 13 14 15 16 17 18 19 20 21
29901626
BP
488AT_DATA([flows.txt], [dnl
489table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21)
490table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18)
491table=0 in_port=3 priority=2000 icmp actions=output(20)
492table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15)
493table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2)
494table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2)
495])
496AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50f96b10 497AT_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])
29901626
BP
498AT_CHECK([tail -1 stdout], [0],
499 [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
500])
023e1e0a 501OVS_VSWITCHD_STOP
29901626 502AT_CLEANUP
58a89177 503
55599423
JR
504AT_SETUP([ofproto-dpif - goto table])
505OVS_VSWITCHD_START
ca5792f0 506add_of_ports br0 1 10 11
55599423 507echo "table=0 in_port=1 actions=output(10),goto_table(1)" > flows.txt
4468099e
EJ
508for i in `seq 1 63`; do echo "table=$i actions=goto_table($(($i+1)))"; done >> flows.txt
509echo "table=64 actions=output(11)" >> flows.txt
55599423
JR
510AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
511AT_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])
512AT_CHECK([tail -1 stdout], [0],
513 [Datapath actions: 10,11
514])
515OVS_VSWITCHD_STOP
516AT_CLEANUP
517
7fdb60a7
SH
518AT_SETUP([ofproto-dpif - write actions])
519OVS_VSWITCHD_START
ca5792f0 520add_of_ports br0 1 10 11 12 13
7fdb60a7
SH
521AT_DATA([flows.txt], [dnl
522table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
523table=1 ip actions=write_actions(output(13)),goto_table(2)
524table=2 ip actions=set_field:192.168.3.91->ip_src,output(11)
525])
526AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
527AT_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])
ce58df5b 528AT_CHECK([tail -2 stdout], [0],
e3981271 529 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 530Datapath actions: 10,set(ipv4(src=192.168.3.91)),11,set(ipv4(src=192.168.3.90)),13
7fdb60a7
SH
531])
532OVS_VSWITCHD_STOP
533AT_CLEANUP
534
e60e935b
SRCSA
535AT_SETUP([ofproto-dpif - modify IPv6 Neighbor Solitication (ND)])
536OVS_VSWITCHD_START
ca5792f0 537add_of_ports br0 1 10 11 12 13
e60e935b
SRCSA
538AT_DATA([flows.txt], [dnl
539table=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)
540table=1 icmp6 actions=write_actions(output(13)),goto_table(2)
541table=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])
543AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
544AT_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])
545AT_CHECK([tail -4 stdout], [0],
e3981271 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
e60e935b
SRCSA
547Datapath 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
548This flow is handled by the userspace slow path because it:
393e9f7c 549 - Uses action(s) not supported by datapath.
e60e935b
SRCSA
550])
551OVS_VSWITCHD_STOP
552AT_CLEANUP
553
7fdb60a7
SH
554AT_SETUP([ofproto-dpif - clear actions])
555OVS_VSWITCHD_START
ca5792f0 556add_of_ports br0 1 10 11 12
7fdb60a7
SH
557AT_DATA([flows.txt], [dnl
558table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
ce58df5b 559table=1 tcp actions=set_field:91->tp_src,output(11),clear_actions
7fdb60a7
SH
560])
561AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
ce58df5b
JR
562AT_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])
563AT_CHECK([tail -2 stdout], [0],
e3981271 564 [Megaflow: recirc_id=0,eth,tcp,in_port=1,nw_frag=no,tp_src=8
d23df9a8 565Datapath actions: 10,set(tcp(src=91)),11
7fdb60a7
SH
566])
567OVS_VSWITCHD_STOP
568AT_CLEANUP
569
0eb48fe1 570AT_SETUP([ofproto-dpif - group chaining])
5a070238 571OVS_VSWITCHD_START
ca5792f0 572add_of_ports br0 1 10 11
0eb48fe1
BP
573AT_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'])
574AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=123,type=all,bucket=output:10'])
575AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
576AT_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])
577AT_CHECK([tail -1 stdout], [0],
578 [Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
5a070238
BP
579])
580OVS_VSWITCHD_STOP
581AT_CLEANUP
582
f4fb341b
SH
583AT_SETUP([ofproto-dpif - all group in action list])
584OVS_VSWITCHD_START
ca5792f0 585add_of_ports br0 1 10 11
f4fb341b
SH
586AT_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'])
587AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
588AT_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])
d23df9a8
JR
589# Must match on the source address to be able to restore it's value for
590# the second bucket
ce58df5b 591AT_CHECK([tail -2 stdout], [0],
e3981271 592 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 593Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
f4fb341b
SH
594])
595OVS_VSWITCHD_STOP
596AT_CLEANUP
597
598AT_SETUP([ofproto-dpif - indirect group in action list])
599OVS_VSWITCHD_START
ca5792f0 600add_of_ports br0 1 10
f4fb341b
SH
601AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
602AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
603AT_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])
604AT_CHECK([tail -1 stdout], [0],
605 [Datapath actions: 10
606])
607OVS_VSWITCHD_STOP
608AT_CLEANUP
609
5b09e569
JR
610AT_SETUP([ofproto-dpif - group actions have no effect afterwards])
611OVS_VSWITCHD_START
ca5792f0 612add_of_ports br0 1 10
5b09e569
JR
613AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=set_field:192.168.3.90->ip_src,output:10'])
614AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234,output:10'])
06db81cc
JS
615
616for 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])
619done
620
621AT_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
138d30a9 622flow-dump from the main thread:
06db81cc
JS
623recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:hash(sym_l4(0)),recirc(0x1)
624recirc_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
5b09e569 625])
06db81cc 626
5b09e569
JR
627OVS_VSWITCHD_STOP
628AT_CLEANUP
629
f4fb341b
SH
630AT_SETUP([ofproto-dpif - all group in action set])
631OVS_VSWITCHD_START
ca5792f0 632add_of_ports br0 1 10 11
f4fb341b
SH
633AT_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'])
634AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
635AT_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])
d23df9a8
JR
636# Must match on the source address to be able to restore it's value for
637# the third bucket
ce58df5b 638AT_CHECK([tail -2 stdout], [0],
e3981271 639 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 640Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
f4fb341b
SH
641])
642OVS_VSWITCHD_STOP
643AT_CLEANUP
644
645AT_SETUP([ofproto-dpif - indirect group in action set])
646OVS_VSWITCHD_START
ca5792f0 647add_of_ports br0 1 10
f4fb341b
SH
648AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
649AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
650AT_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])
651AT_CHECK([tail -1 stdout], [0],
652 [Datapath actions: 10
653])
654OVS_VSWITCHD_STOP
655AT_CLEANUP
656
14ebc6c1
EG
657AT_SETUP([ofproto-dpif - patch port with action set])
658OVS_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 ])
666add_of_ports br0 1
667add_of_ports br1 2
668AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br1 'ip actions=write_actions(pop_vlan,output:2)'])
669AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=output:10'])
670AT_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])
671AT_CHECK([tail -1 stdout], [0],
672 [Datapath actions: pop_vlan,2
673])
674AT_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])
675AT_CHECK([tail -1 stdout], [0],
676 [Datapath actions: pop_vlan,2
677])
678OVS_VSWITCHD_STOP
679AT_CLEANUP
680
681
fe7e5749 682AT_SETUP([ofproto-dpif - select group])
06db81cc 683
fe7e5749 684OVS_VSWITCHD_START
ca5792f0 685add_of_ports br0 1 10 11
06db81cc
JS
686
687ovs-appctl vlog/set ofproto_dpif:file:dbg
fe7e5749 688AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
06db81cc
JS
689AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
690ofproto_dpif|DBG|Constructing select group 1234
691ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
692ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
693ofproto_dpif|DBG| Using 16 hash values:
694ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
695ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
696ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 1.
697])
fe7e5749 698AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
7cb279c2
SH
699
700# Try a bunch of different flows and make sure that they get distributed
06db81cc
JS
701# # at least somewhat.
702for 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
7cb279c2 707done
06db81cc 708
fe07df80 709AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 5 2 dp_hash], [0], [dnl
06db81cc
JS
710recirc_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)
711n_flows=ok n_buckets=ok
fe7e5749 712])
06db81cc 713
fe7e5749
SH
714OVS_VSWITCHD_STOP
715AT_CLEANUP
716
717AT_SETUP([ofproto-dpif - select group with watch port])
06db81cc 718
fe7e5749 719OVS_VSWITCHD_START
ca5792f0 720add_of_ports br0 1 10 11
fe7e5749
SH
721AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
722AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
06db81cc
JS
723
724for 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])
727done
728
729AT_CHECK([ovs-appctl dpctl/dump-flows | sort| sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | strip_ufid | strip_used], [0], [dnl
138d30a9 730flow-dump from the main thread:
06db81cc
JS
731recirc_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)
732recirc_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
fe7e5749 733])
06db81cc 734
fe7e5749
SH
735OVS_VSWITCHD_STOP
736AT_CLEANUP
737
06db81cc
JS
738AT_SETUP([ofproto-dpif - select group with weights])
739
06db81cc
JS
740# Helper function to check the accuracy of distribution of packets over buckets
741check_group_stats () {
06db81cc
JS
742 buckets=`grep -o 'packet_count=[[0-9]]*' | cut -d'=' -f2 | tail -n +2`
743 i=0
744 for bucket in $buckets; do
99c3ae0b
IM
745 min=$1
746 shift
747 if [[ $bucket -ge $min ]]; then
748 echo "bucket$i >= $min"
06db81cc 749 else
99c3ae0b 750 echo "bucket$i < $min"
06db81cc 751 fi
99c3ae0b 752 i=`expr $i + 1`
06db81cc
JS
753 if [[ $i -ge 4 ]]; then break; fi
754 done
755}
756
7cb279c2 757OVS_VSWITCHD_START
06db81cc
JS
758add_of_ports br0 1 10 11 12 13 14
759
760ovs-appctl vlog/set ofproto_dpif:file:dbg
761AT_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'])
762AT_CHECK([grep -A9 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
763ofproto_dpif|DBG|Constructing select group 1234
764ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
765ofproto_dpif|DBG| Minimum weight: 5, total weight: 100
766ofproto_dpif|DBG| Using 32 hash values:
767ofproto_dpif|DBG| Bucket 0: weight=5, target=1.60 hits=2
768ofproto_dpif|DBG| Bucket 1: weight=10, target=3.20 hits=3
769ofproto_dpif|DBG| Bucket 2: weight=25, target=8.00 hits=8
770ofproto_dpif|DBG| Bucket 3: weight=60, target=19.20 hits=19
771ofproto_dpif|DBG| Bucket 4: weight=0, target=0.00 hits=0
772ofproto_dpif|DBG|Use dp_hash with 32 hash values using algorithm 1.
773])
7cb279c2 774AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
06db81cc
JS
775
776# Try 1000 different flows and make sure that they get distributed according to weights
777for 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
784done
785
786# Check balanced distribution over 32 dp_hash values
fe07df80 787AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 32 4 dp_hash], [0], [dnl
06db81cc
JS
788recirc_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)
789n_flows=ok n_buckets=ok
7cb279c2 790])
06db81cc
JS
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
800ovs-appctl time/warp 1000
801AT_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
803bucket0 >= 40
804bucket1 >= 80
805bucket2 >= 200
806bucket3 >= 500
807])
808
7cb279c2
SH
809OVS_VSWITCHD_STOP
810AT_CLEANUP
811
06db81cc
JS
812AT_SETUP([ofproto-dpif - select group with explicit dp_hash selection method])
813
0c4b9393 814OVS_VSWITCHD_START
ca5792f0 815add_of_ports br0 1 10 11
06db81cc
JS
816
817ovs-appctl vlog/set ofproto_dpif:file:dbg
818AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11'])
819AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
820ofproto_dpif|DBG|Constructing select group 1234
821ofproto_dpif|DBG|Selection method specified: dp_hash.
822ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
823ofproto_dpif|DBG| Using 16 hash values:
824ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
825ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
826ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 0.
827])
828
829# Fall back to legacy hash with zero buckets
830AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method=dp_hash'])
831AT_CHECK([grep -A3 "Constructing select group 1235" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
832ofproto_dpif|DBG|Constructing select group 1235
833ofproto_dpif|DBG|Selection method specified: dp_hash.
834ofproto_dpif|DBG| Don't apply dp_hash method without buckets.
835ofproto_dpif|DBG|Falling back to default hash method.
836])
837
838# Fall back to legacy hash with zero buckets
839AT_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'])
840AT_CHECK([grep -A4 "Constructing select group 1236" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
841ofproto_dpif|DBG|Constructing select group 1236
842ofproto_dpif|DBG|Selection method specified: dp_hash.
843ofproto_dpif|DBG| Minimum weight: 1, total weight: 1001
844ofproto_dpif|DBG| Too many hash values required: 1024
845ofproto_dpif|DBG|Falling back to default hash method.
8b666728 846])
06db81cc
JS
847
848OVS_VSWITCHD_STOP
849AT_CLEANUP
850
851AT_SETUP([ofproto-dpif - select group with legacy hash selection method])
852
06db81cc
JS
853OVS_VSWITCHD_START
854add_of_ports br0 1 10 11
855
856ovs-appctl vlog/set ofproto_dpif:file:dbg
857AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,bucket=output:10,bucket=output:11'])
858AT_CHECK([grep -A2 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
859ofproto_dpif|DBG|Constructing select group 1234
860ofproto_dpif|DBG|Selection method specified: hash.
861ofproto_dpif|DBG|No hash fields. Falling back to default hash method.
862])
863
0c4b9393
SH
864AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
865
06db81cc
JS
866# Try 16 flows with differing default hash values.
867for 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
0c4b9393 872done
06db81cc
JS
873
874# Check that the packets installed 16 data path flows and each of the two
875# buckets is hit at least once.
876AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
877n_flows=ok n_buckets=ok
0c4b9393
SH
878])
879
06db81cc
JS
880OVS_VSWITCHD_STOP
881AT_CLEANUP
882
883AT_SETUP([ofproto-dpif - select group with custom hash selection method])
884
06db81cc
JS
885OVS_VSWITCHD_START
886add_of_ports br0 1 10 11
887
888# Check that parse failures after 'fields' parsing work
889AT_CHECK([ovs-ofctl -O OpenFlow10 add-group br0 'group_id=1,type=select,fields(eth_dst),bukket=output:10'], [1], ,[dnl
890ovs-ofctl: unknown keyword bukket
0c4b9393
SH
891])
892
60dfb5ed
JR
893# Check that fields are rejected without "selection_method=hash".
894AT_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
895ovs-ofctl: fields may only be specified with "selection_method=hash"
896])
897
898# Check that selection_method_param without selection_method is rejected.
899AT_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
900ovs-ofctl: selection_method_param is only allowed with "selection_method"
901])
902
06db81cc
JS
903AT_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'])
904AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
53cc166a 905
06db81cc
JS
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
908for 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)"
53cc166a
JR
910 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
911done
912
06db81cc
JS
913AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
914n_flows=ok n_buckets=ok
53cc166a
JR
915])
916
917AT_CHECK([ovs-appctl revalidator/purge], [0])
918
06db81cc
JS
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
53cc166a
JR
921for 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])
924done
925
06db81cc
JS
926AT_CHECK([ovs-appctl dpctl/dump-flows | grep -c recirc_id], [0], [dnl
9271
53cc166a
JR
928])
929
930OVS_VSWITCHD_STOP
931AT_CLEANUP
932
dd8cd4b4
SH
933AT_SETUP([ofproto-dpif - fast failover group])
934OVS_VSWITCHD_START
ca5792f0 935add_of_ports br0 1 10 11
dd8cd4b4
SH
936AT_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'])
937AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
938AT_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])
939AT_CHECK([tail -1 stdout], [0],
c9c8c8a1 940 [Datapath actions: 10
dd8cd4b4
SH
941])
942OVS_VSWITCHD_STOP
943AT_CLEANUP
944
b2af3288
AZ
945AT_SETUP([ofproto-dpif - group stats single bucket])
946OVS_VSWITCHD_START
ca5792f0 947add_of_ports br0 1 10 11
b2af3288
AZ
948AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
949AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
950(
951for 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)
cea4a6d7 957AT_CHECK([ovs-appctl revalidator/purge], [0])
b2af3288 958AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 959AT_CHECK([strip_xids < stdout | sort], [0], [dnl
6f068379 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
b2af3288
AZ
961OFPST_GROUP reply (OF1.2):
962])
963OVS_VSWITCHD_STOP
964AT_CLEANUP
965
966AT_SETUP([ofproto-dpif - group stats all buckets])
967OVS_VSWITCHD_START
ca5792f0 968add_of_ports br0 1 10 11
b2af3288
AZ
969AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
970AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
971(
972for 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)
cea4a6d7 978AT_CHECK([ovs-appctl revalidator/purge], [0])
b2af3288 979AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 980AT_CHECK([strip_xids < stdout | sort], [0], [dnl
6f068379 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
b2af3288
AZ
982OFPST_GROUP reply (OF1.2):
983])
984OVS_VSWITCHD_STOP
985AT_CLEANUP
986
58a89177 987AT_SETUP([ofproto-dpif - registers])
023e1e0a 988OVS_VSWITCHD_START
ca5792f0 989add_of_ports br0 20 21 22 33 90
58a89177
EJ
990AT_DATA([flows.txt], [dnl
991in_port=90 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
992in_port=91 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
e9358af6
EJ
993in_port=92 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
994in_port=93 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
995
58a89177
EJ
996in_port=2 actions=load:0x000db000->NXM_NX_REG0[[]]
997in_port=3 actions=load:0xdea->NXM_NX_REG0[[20..31]]
998in_port=4 actions=load:0xeef->NXM_NX_REG0[[0..11]]
999in_port=5 actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
1000in_port=6 actions=load:0x22222222->NXM_NX_REG2[[]]
1001in_port=7 actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
1002in_port=8 actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
1003in_port=9,reg0=0xdeadbeef actions=output:20
1004in_port=10,reg1=0xdeadbeef actions=output:21
1005in_port=11,reg2=0xeef22dea actions=output:22
e9358af6
EJ
1006
1007dnl Sanilty check all registers
1008in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
1009in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
1010in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
1011in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
bd85dac1 1012
58a89177
EJ
1013])
1014AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 1015AT_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])
58a89177 1016AT_CHECK([tail -1 stdout], [0],
e9358af6 1017 [Datapath actions: 20,21,22,33
58a89177 1018])
023e1e0a 1019OVS_VSWITCHD_STOP
58a89177 1020AT_CLEANUP
f694937d 1021
57fa8167
BP
1022dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
1023dnl in the manner documented in ovs-ofctl(8).
1024AT_SETUP([ofproto-dpif - extended registers])
1025OVS_VSWITCHD_START
ca5792f0 1026add_of_ports br0 1 2 3
57fa8167
BP
1027AT_DATA([flows.txt], [dnl
1028table=0 actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
1029table=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.
1033table=0,priority=0 actions=3
1034table=1,priority=0 actions=3
1035])
1036AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1037AT_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])
1038AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
1039])
1040OVS_VSWITCHD_STOP
1041AT_CLEANUP
1042
b23ada8e
JP
1043dnl Tests that the standardized xxregs are mapped onto the legacy OVS
1044dnl registers in the manner documented in ovs-ofctl(8).
1045AT_SETUP([ofproto-dpif - extended-extended registers])
1046OVS_VSWITCHD_START
1047add_of_ports br0 1 2 3
1048AT_DATA([flows.txt], [dnl
1049table=0 actions=load:0x0123456789abcdeffedcba9876543210->NXM_NX_XXREG1[[]],resubmit(,1)
1050table=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.
1054table=0,priority=0 actions=3
1055table=1,priority=0 actions=3
1056])
1057AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1058AT_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])
1059AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
1060])
1061OVS_VSWITCHD_STOP
1062AT_CLEANUP
1063
1b0ee636
TG
1064AT_SETUP([ofproto-dpif - load and move order])
1065OVS_VSWITCHD_START
ca5792f0 1066add_of_ports br0 1 10 11
1b0ee636
TG
1067AT_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'])
1068AT_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)'])
1069AT_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])
1070AT_CHECK([tail -2 stdout], [0],
e3981271 1071 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 1072Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
1b0ee636
TG
1073])
1074OVS_VSWITCHD_STOP
1075AT_CLEANUP
1076
eb1cbc6b
JT
1077dnl Tests that 1.5 copy-field can copy into the standardized xregs.
1078AT_SETUP([ofproto-dpif - copy-field into extended registers])
1079OVS_VSWITCHD_START
ca5792f0 1080add_of_ports br0 1 2 3
eb1cbc6b
JT
1081AT_DATA([flows.txt], [dnl
1082table=0 actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
1083table=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.
1087table=0,priority=0 actions=3
1088table=1,priority=0 actions=3
1089])
1090AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
1091AT_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])
1092AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
1093])
1094OVS_VSWITCHD_STOP
1095AT_CLEANUP
1096
2bef8e07
JT
1097dnl Tests that 1.5 set-field with mask in the metadata register.
1098AT_SETUP([ofproto-dpif - masked set-field into metadata])
1099OVS_VSWITCHD_START
ca5792f0 1100add_of_ports br0 1 2 3
2bef8e07
JT
1101AT_DATA([flows.txt], [dnl
1102table=0 actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
1103table=1 actions=set_field:0x6b/0xff->metadata,goto_table(2)
1104table=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.
1108table=0,priority=0 actions=3
1109table=1,priority=0 actions=3
1110table=2,priority=0 actions=3
1111])
1112AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
1113AT_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])
1114AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
1115])
1116OVS_VSWITCHD_STOP
1117AT_CLEANUP
1118
c61f3870
BP
1119
1120AT_SETUP([ofproto-dpif - actset_output])
1121OVS_VSWITCHD_START
ca5792f0 1122add_of_ports br0 1 2 3 4 5 6 7 8 9 10 11 12 13
c61f3870 1123AT_DATA([flows.txt], [dnl
3ca3ce0c 1124table=0,actset_output=unset actions=write_actions(output(2)),goto_table(1)
c61f3870
BP
1125table=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.
1128table=2,priority=20,actset_output=2 actions=4,goto_table(3)
1129table=2,priority=10 actions=5,goto_table(3)
1130
1131# Verify that xreg0 got copied properly from actset_output.
1132table=3,priority=20,xreg0=2 actions=6,goto_table(4)
1133table=3,priority=10 actions=7,goto_table(4)
1134
b23ada8e
JP
1135# Verify that xxreg0 got copied properly from actset_output.
1136table=3,priority=20,xxreg0=2 actions=6,goto_table(4)
1137table=3,priority=10 actions=7,goto_table(4)
1138
9055ca9a
BP
1139# Verify that adding a group action unsets actset_output,
1140# even if output follows group.
1141table=4 actions=write_actions(group(5),output(10)),goto_table(5)
c61f3870
BP
1142table=5,priority=20,actset_output=unset actions=8,goto_table(6)
1143table=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).
1147table=6 actions=write_actions(output(3)),goto_table(7)
1148table=7,priority=20,actset_output=unset actions=10,goto_table(8)
1149table=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.
1153table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
1154table=9,priority=20,actset_output=2 actions=12
1155table=9,priority=10 actions=13
1156])
4f20179d 1157AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=5,type=all,bucket=output:1'])
c61f3870
BP
1158AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
1159AT_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])
1160AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
1161])
1162OVS_VSWITCHD_STOP
1163AT_CLEANUP
880b1458 1164
bd85dac1
AZ
1165AT_SETUP([ofproto-dpif - push-pop])
1166OVS_VSWITCHD_START
ca5792f0 1167add_of_ports br0 20 21 22 33 90
bd85dac1
AZ
1168AT_DATA([flows.txt], [dnl
1169in_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
1170in_port=2 actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
1171in_port=3 actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
1172in_port=4 actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
1173in_port=5 actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
1174
1175])
1176AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 1177AT_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])
bd85dac1
AZ
1178AT_CHECK([tail -1 stdout], [0],
1179 [Datapath actions: 33,22,21,20
1180])
1181OVS_VSWITCHD_STOP
1182AT_CLEANUP
1183
f694937d 1184AT_SETUP([ofproto-dpif - output])
023e1e0a 1185OVS_VSWITCHD_START
ca5792f0 1186add_of_ports br0 1 9 10 11 55 66 77 88
f694937d 1187AT_DATA([flows.txt], [dnl
557323cd 1188in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
f694937d
EJ
1189in_port=2 actions=output:9
1190in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
1191in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
1192in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
1193in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
1194in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
557323cd 1195in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
f694937d
EJ
1196])
1197AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 1198AT_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])
f694937d 1199AT_CHECK([tail -1 stdout], [0],
557323cd 1200 [Datapath actions: 9,55,10,55,66,11,77,88,9,1
f694937d 1201])
023e1e0a 1202OVS_VSWITCHD_STOP
f694937d 1203AT_CLEANUP
8e9ce036 1204
f0fd1a17
PS
1205AT_SETUP([ofproto-dpif - dec_ttl])
1206OVS_VSWITCHD_START
ca5792f0 1207add_of_ports br0 1 2 3 4
f0fd1a17
PS
1208AT_DATA([flows.txt], [dnl
1209table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
1210table=1 in_port=1 action=dec_ttl,output:3
1211])
1212AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8249a1fe 1213AT_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])
d39ec23d
JP
1214AT_CHECK([tail -4 stdout], [0], [
1215Final 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
1216Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=2,nw_frag=no
74c4530d 1217Datapath 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
f0fd1a17 1218])
8249a1fe 1219AT_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])
ce58df5b 1220AT_CHECK([tail -2 stdout], [0],
e3981271 1221 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=3,nw_frag=no
d23df9a8 1222Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
f0fd1a17 1223])
50aa28fd 1224AT_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])
ce58df5b 1225AT_CHECK([tail -2 stdout], [0],
e3981271 1226 [Megaflow: recirc_id=0,eth,ipv6,in_port=1,nw_ttl=128,nw_frag=no
d23df9a8 1227Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
f0fd1a17
PS
1228])
1229
982697a4 1230AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 1231AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d39ec23d
JP
1232
1233ovs-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
d9c8c57c 1235OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
f0fd1a17 1236AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8249a1fe 1237NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
e6d9ab56 1238ip,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
f0fd1a17
PS
1239])
1240OVS_VSWITCHD_STOP
1241AT_CLEANUP
1242
65bfce4a
SH
1243dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
1244dnl buffer to be resized just before pushing the id of the dec_ttl action.
1245dnl Thus the implementation must account for this by using the
1246dnl reallocated buffer rather than the original buffer.
1247dnl
1248dnl A number of similar rules are added to try and exercise
1249dnl xrealloc sufficiently that it returns a different base pointer
1250AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
1251OVS_VSWITCHD_START
ca5792f0 1252add_of_ports br0 1
65bfce4a
SH
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
1256AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1257OVS_VSWITCHD_STOP
1258AT_CLEANUP
1259
1260dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
1261dnl buffer to be resized just before pushing the id of the dec_ttl action.
1262dnl Thus the implementation must account for this by using the
1263dnl reallocated buffer rather than the original buffer.
1264dnl
1265dnl A number of similar rules are added to try and exercise
1266dnl xrealloc sufficiently that it returns a different base pointer
1267AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
1268OVS_VSWITCHD_START
ca5792f0 1269add_of_ports br0 1
65bfce4a
SH
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
1273AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1274OVS_VSWITCHD_STOP
1275AT_CLEANUP
1276
1277dnl A note action at offset 24 in ofpacts will cause the ofpacts
1278dnl buffer to be resized just before pushing the id of the dec_ttl action.
1279dnl Thus the implementation must account for this by using the
1280dnl reallocated buffer rather than the original buffer.
1281dnl
1282dnl A number of similar rules are added to try and exercise
1283dnl xrealloc sufficiently that it returns a different base pointer
1284AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
1285OVS_VSWITCHD_START
ca5792f0 1286add_of_ports br0 1
65bfce4a
SH
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
1290AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1291OVS_VSWITCHD_STOP
1292AT_CLEANUP
f0fd1a17 1293
ace39a6f
JS
1294dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
1295dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
1296dnl Using `make check-valgrind' here checks for use-after-free in this
1297dnl codepath.
1298AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
1299OVS_VSWITCHD_START
1300AT_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'])
1301OVS_VSWITCHD_STOP
1302AT_CLEANUP
1303
77750738 1304AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
e44768b7 1305OVS_VSWITCHD_START
ca5792f0 1306add_of_ports br0 1 2
77750738 1307
77750738
JP
1308AT_CHECK([ovs-ofctl add-flow br0 action=normal])
1309
1310# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 1311flow="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"
77750738 1312AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
72d64e33
EJ
1313AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
13141
13152
1316100
1317])
77750738
JP
1318
1319OVS_VSWITCHD_STOP
1320AT_CLEANUP
1321
8b36f51e 1322AT_SETUP([ofproto-dpif - DSCP])
8b36f51e 1323OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
ca5792f0 1324add_of_ports br0 9
8b36f51e 1325AT_DATA([flows.txt], [dnl
bdda5aca 1326actions=output:LOCAL,enqueue:1:1,enqueue:1:2,enqueue:1:2,enqueue:1:1,output:1,mod_nw_tos:0,output:1,output:LOCAL
8b36f51e
EJ
1327])
1328AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1329AT_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])
50aa28fd 1334AT_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])
ce58df5b 1335AT_CHECK([tail -2 stdout], [0],
e3981271 1336 [Megaflow: recirc_id=0,skb_priority=0,eth,ip,in_port=9,nw_tos=252,nw_frag=no
ce58df5b 1337Datapath actions: dnl
e44768b7 1338100,dnl
d23df9a8
JR
1339set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1340set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
8b36f51e 13411,dnl
d23df9a8
JR
1342set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1343set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
1344set(ipv4(tos=0/0xfc)),1,100
8b36f51e
EJ
1345])
1346OVS_VSWITCHD_STOP
1347AT_CLEANUP
1348
fd19297b 1349AT_SETUP([ofproto-dpif - output/flood flags])
f7b8e494 1350OVS_VSWITCHD_START
ca5792f0 1351add_of_ports br0 1 2 3 4 5 6 7
fd19297b
EJ
1352
1353AT_DATA([flows.txt], [dnl
a0fbe94a 1354in_port=local actions=local,flood
fd19297b
EJ
1355in_port=1 actions=flood
1356in_port=2 actions=all
bdda5aca
BP
1357in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
1358in_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
fd19297b
EJ
1359])
1360AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1361AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
1362AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
1363
50aa28fd 1364AT_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])
a0fbe94a
AR
1365AT_CHECK([tail -1 stdout \
1366| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
13671
13682
13693
13704
13717
1372])
1373
50aa28fd 1374AT_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])
fd19297b
EJ
1375AT_CHECK([tail -1 stdout \
1376| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
e44768b7 1377100
fd19297b
EJ
13782
13793
13804
13817
1382])
1383
50aa28fd 1384AT_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])
fd19297b
EJ
1385AT_CHECK([tail -1 stdout \
1386| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
fd19297b 13871
e44768b7 1388100
fd19297b
EJ
13893
13904
13916
13927
1393])
1394
50aa28fd 1395AT_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])
fd19297b 1396AT_CHECK([tail -1 stdout], [0],
e44768b7 1397 [Datapath actions: 100,1,2,4,6,7
fd19297b
EJ
1398])
1399
50aa28fd 1400AT_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])
fd19297b 1401AT_CHECK([tail -1 stdout], [0],
1b567fb9 1402 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
fd19297b
EJ
1403])
1404OVS_VSWITCHD_STOP
1405AT_CLEANUP
1406
6b83a3c5 1407AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
6d328fa2
SH
1408OVS_VSWITCHD_START([dnl
1409 add-port br0 p1 -- set Interface p1 type=dummy
1410])
53eb8cb8 1411on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1412
1413AT_CAPTURE_FILE([ofctl_monitor.log])
1414
6409e008 1415AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1416
1417for i in 1 2 3 ; do
ea2735d3 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)'
6d328fa2 1419done
8bd16974 1420OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1421OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2 1422AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1423NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1424tcp,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
6d328fa2 1425dnl
efe179e0 1426NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1427tcp,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
6d328fa2 1428dnl
efe179e0 1429NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1430tcp,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
6d328fa2
SH
1431])
1432
1433AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1434AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1435NXST_FLOW reply:
1436])
1437
1438OVS_VSWITCHD_STOP
1439AT_CLEANUP
1440
6b83a3c5
SH
1441AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
1442OVS_VSWITCHD_START([dnl
1443 add-port br0 p1 -- set Interface p1 type=dummy
1444])
53eb8cb8 1445on_exit 'kill `cat ovs-ofctl.pid`'
6b83a3c5
SH
1446
1447AT_CAPTURE_FILE([ofctl_monitor.log])
1448AT_CHECK([ovs-ofctl del-flows br0])
1449
6409e008 1450AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6b83a3c5 1451
40ebbf78 1452dnl Test that missed packets are dropped
6b83a3c5 1453for i in 1 2 3 ; do
ea2735d3 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)'
6b83a3c5 1455done
d9c8c57c 1456OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6b83a3c5
SH
1457
1458AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1459])
1460
1461AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1462AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1463OFPST_FLOW reply (OF1.3):
1464])
1465
1466OVS_VSWITCHD_STOP
1467AT_CLEANUP
1468
6d328fa2
SH
1469AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
1470OVS_VSWITCHD_START([dnl
1471 add-port br0 p1 -- set Interface p1 type=dummy
1472])
53eb8cb8 1473on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1474
1475AT_CAPTURE_FILE([ofctl_monitor.log])
1476AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1477
6409e008 1478AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1479
1480for i in 1 2 3 ; do
8e4c1621 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)'
6d328fa2 1482done
8bd16974 1483OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1484OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2 1485AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1486OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1487tcp,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
6d328fa2 1488dnl
efe179e0 1489OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1490tcp,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
6d328fa2 1491dnl
efe179e0 1492OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1493tcp,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
6d328fa2
SH
1494])
1495
cea4a6d7 1496AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1497AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 1498 n_packets=3, n_bytes=162, actions=goto_table:1
6d328fa2
SH
1499OFPST_FLOW reply (OF1.2):
1500])
1501
1502OVS_VSWITCHD_STOP
1503AT_CLEANUP
1504
1505AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
1506OVS_VSWITCHD_START([dnl
1507 add-port br0 p1 -- set Interface p1 type=dummy
1508])
53eb8cb8 1509on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1510
1511AT_CAPTURE_FILE([ofctl_monitor.log])
1512AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1513
6409e008 1514AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1515
1516for 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)'
1518done
1519
d9c8c57c 1520OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1521AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1522])
1523
cea4a6d7 1524AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1525AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1526 n_packets=3, n_bytes=354, actions=resubmit(1,1)
6d328fa2
SH
1527OFPST_FLOW reply (OF1.2):
1528])
1529
1530OVS_VSWITCHD_STOP
1531AT_CLEANUP
1532
1533AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1534OVS_VSWITCHD_START([dnl
1535 add-port br0 p1 -- set Interface p1 type=dummy
1536])
53eb8cb8 1537on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1538
1539AT_CAPTURE_FILE([ofctl_monitor.log])
1540AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1541AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1542
1543dnl Miss table 0, Hit table 1
6409e008 1544AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1545
1546for 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)'
1548done
8bd16974 1549OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1550OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1551
1552AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1553NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1554tcp,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
6d328fa2 1555dnl
6f068379
BP
1556NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1557tcp,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
6d328fa2 1558dnl
6f068379
BP
1559NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1560tcp,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
6d328fa2
SH
1561])
1562
1563dnl Hit table 0, Miss all other tables, sent to controller
6409e008 1564AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1565
1566for 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)'
1568done
8bd16974 1569OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1570OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1571
1572AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1573NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1574tcp,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
6d328fa2 1575dnl
6f068379
BP
1576NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1577tcp,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
6d328fa2 1578dnl
6f068379
BP
1579NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1580tcp,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
6d328fa2
SH
1581])
1582
cea4a6d7 1583AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1584AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1585 table=1, n_packets=3, n_bytes=354, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
6d328fa2
SH
1586OFPST_FLOW reply (OF1.2):
1587])
1588
1589OVS_VSWITCHD_STOP
1590AT_CLEANUP
1591
1592AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1593OVS_VSWITCHD_START([dnl
1594 add-port br0 p1 -- set Interface p1 type=dummy
1595])
53eb8cb8 1596on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1597
1598AT_CAPTURE_FILE([ofctl_monitor.log])
1599AT_DATA([flows.txt], [dnl
1600table=0 actions=goto_table(1)
1601table=2 dl_src=10:11:11:11:11:11 actions=controller
1602])
1603AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1604AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1605
1606dnl Hit table 0, Miss table 1, Hit table 2
6409e008 1607AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1608
1609for 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)'
1611done
8bd16974 1612OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1613OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1614
1615AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1616NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1617tcp,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
6d328fa2 1618dnl
6f068379
BP
1619NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1620tcp,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
6d328fa2 1621dnl
6f068379
BP
1622NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1623tcp,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
6d328fa2
SH
1624])
1625
1626dnl Hit table 1, Miss all other tables, sent to controller
6409e008 1627AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1628
1629for 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)'
1631done
8bd16974 1632OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1633OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1634
1635AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1636NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1637tcp,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
6d328fa2 1638dnl
6f068379
BP
1639NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1640tcp,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
6d328fa2 1641dnl
6f068379
BP
1642NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1643tcp,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
6d328fa2
SH
1644])
1645
cea4a6d7 1646AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1647AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379
BP
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
6d328fa2
SH
1650OFPST_FLOW reply (OF1.2):
1651])
1652
1653OVS_VSWITCHD_STOP
1654AT_CLEANUP
1655
1656AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1657OVS_VSWITCHD_START([dnl
1658 add-port br0 p1 -- set Interface p1 type=dummy
1659])
53eb8cb8 1660on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1661
1662AT_CAPTURE_FILE([ofctl_monitor.log])
1663AT_DATA([flows.txt], [dnl
1664table=0 actions=resubmit(1,1)
1665table=2 dl_src=10:11:11:11:11:11 actions=controller
1666])
1667AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1668AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1669
1670dnl Hit table 0, Miss table 1, Dropped
6409e008 1671AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1672
1673for 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)'
1675done
0c473314 1676OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1677
1678AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1679])
1680
1681dnl Hit table 1, Dropped
6409e008 1682AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1683
1684for 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)'
1686done
d9c8c57c 1687OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1688
1689AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1690])
1691
cea4a6d7 1692AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1693AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1694 n_packets=6, n_bytes=708, actions=resubmit(1,1)
6d328fa2
SH
1695 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1696OFPST_FLOW reply (OF1.2):
1697])
1698
1699OVS_VSWITCHD_STOP
1700AT_CLEANUP
1701
1702AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1703OVS_VSWITCHD_START([dnl
1704 add-port br0 p1 -- set Interface p1 type=dummy
1705])
53eb8cb8 1706on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1707
1708AT_CAPTURE_FILE([ofctl_monitor.log])
1709AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1710
6409e008 1711AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1712
40ebbf78 1713dnl Test that missed packets are dropped
6d328fa2
SH
1714for 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)'
1716done
d9c8c57c 1717OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1718
1719AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1720])
1721
1722AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1723AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1724NXST_FLOW reply:
1725])
1726
1727OVS_VSWITCHD_STOP
1728AT_CLEANUP
1729
1730AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1731OVS_VSWITCHD_START([dnl
1732 add-port br0 p1 -- set Interface p1 type=dummy
1733])
53eb8cb8 1734on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1735
1736AT_CAPTURE_FILE([ofctl_monitor.log])
1737AT_CHECK([ovs-ofctl del-flows br0])
1738AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1739AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1740
6409e008 1741AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1742
40ebbf78 1743dnl Test that missed packets are dropped
6d328fa2
SH
1744for 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)'
1746done
d9c8c57c 1747OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1748
1749AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1750])
1751
cea4a6d7 1752AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1753AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1754 n_packets=3, n_bytes=354, actions=goto_table:1
6d328fa2
SH
1755OFPST_FLOW reply (OF1.2):
1756])
1757
1758OVS_VSWITCHD_STOP
1759AT_CLEANUP
1760
1761AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1762OVS_VSWITCHD_START([dnl
1763 add-port br0 p1 -- set Interface p1 type=dummy
1764])
53eb8cb8 1765on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1766
1767AT_CAPTURE_FILE([ofctl_monitor.log])
1768AT_CHECK([ovs-ofctl del-flows br0])
1769AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1770AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1771
6409e008 1772AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1773
40ebbf78 1774dnl Test that missed packets are dropped
6d328fa2
SH
1775for 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)'
1777done
d9c8c57c 1778OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1779
1780AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1781])
1782
cea4a6d7 1783AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1784AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1785 n_packets=3, n_bytes=354, actions=resubmit(1,1)
6d328fa2
SH
1786OFPST_FLOW reply (OF1.2):
1787])
1788
1789OVS_VSWITCHD_STOP
1790AT_CLEANUP
1791
15056dc8
EJ
1792AT_SETUP([ofproto-dpif - controller])
1793OVS_VSWITCHD_START([dnl
1794 add-port br0 p1 -- set Interface p1 type=dummy
1795])
53eb8cb8 1796on_exit 'kill `cat ovs-ofctl.pid`'
15056dc8
EJ
1797
1798AT_CAPTURE_FILE([ofctl_monitor.log])
1799AT_DATA([flows.txt], [dnl
1800cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
54834960 1801cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
15056dc8
EJ
1802cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1803
54834960
EJ
1804cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1805cookie=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)
1806cookie=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)
1807cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1808cookie=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)
1809cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1810cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
78cef7fd 1811cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
56d72f37 1812cookie=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
15056dc8
EJ
1813])
1814AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1815
1816dnl Flow miss.
6409e008 1817AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1818
1819for i in 1 2 3 ; do
dc235f7f 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)'
15056dc8 1821done
57c94f35 1822OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1823OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1824
15056dc8 1825AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1826OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1827tcp,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
15056dc8 1828dnl
6f068379
BP
1829OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1830tcp,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
15056dc8 1831dnl
6f068379
BP
1832OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1833tcp,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
15056dc8
EJ
1834])
1835
1836dnl Singleton controller action.
6409e008 1837AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1838
1839for i in 1 2 3 ; do
dc235f7f 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)'
15056dc8 1841done
57c94f35 1842OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1843OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1844
15056dc8 1845AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1846OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1847tcp,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
efe179e0 1848OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1849tcp,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
efe179e0 1850OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1851tcp,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
15056dc8
EJ
1852])
1853
1854dnl Modified controller action.
6409e008 1855AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1856
1857for i in 1 2 3 ; do
dc235f7f 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)'
15056dc8 1859done
57c94f35 1860OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1861OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1862
15056dc8 1863AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1864OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1865tcp,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
15056dc8 1866dnl
efe179e0 1867OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1868tcp,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
15056dc8 1869dnl
efe179e0 1870OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1871tcp,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
15056dc8
EJ
1872])
1873
363dd1d9 1874dnl Modified VLAN controller action.
9a403b07 1875AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
363dd1d9
JS
1876
1877for i in 1 2 3; do
8249a1fe 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)'
363dd1d9 1879done
57c94f35 1880OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1881OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
363dd1d9 1882
363dd1d9 1883AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1884NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1885ip,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
363dd1d9 1886dnl
efe179e0 1887NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1888ip,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
363dd1d9 1889dnl
efe179e0 1890NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1891ip,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
363dd1d9
JS
1892])
1893
349fbdc2 1894dnl Checksum TCP.
6409e008 1895AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1896
1897for 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)'
1899done
1900OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1901OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1902
1903AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1904NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1905tcp,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
349fbdc2 1906dnl
efe179e0 1907NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=58 reg0=0x1,in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1908tcp,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
349fbdc2 1909dnl
efe179e0 1910NXT_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)
f0fb825a 1911tcp,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
349fbdc2 1912dnl
efe179e0 1913NXT_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)
f0fb825a 1914tcp,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
349fbdc2 1915dnl
efe179e0 1916NXT_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)
f0fb825a 1917tcp,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
349fbdc2 1918dnl
efe179e0 1919NXT_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)
f0fb825a 1920tcp,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
349fbdc2 1921dnl
efe179e0 1922NXT_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)
f0fb825a 1923tcp,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
349fbdc2 1924dnl
efe179e0 1925NXT_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)
f0fb825a 1926tcp,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
349fbdc2 1927dnl
efe179e0 1928NXT_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)
f0fb825a 1929tcp,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
349fbdc2
SH
1930])
1931
1932dnl Checksum UDP.
6409e008 1933AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1934
1935for 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'
1937done
1938OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1939OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1940
1941AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1942NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1943udp,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
349fbdc2 1944dnl
50dcbd8e 1945NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
f0fb825a 1946udp,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
349fbdc2 1947dnl
50dcbd8e 1948NXT_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)
f0fb825a 1949udp,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
349fbdc2 1950dnl
50dcbd8e 1951NXT_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)
f0fb825a 1952udp,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
349fbdc2 1953dnl
50dcbd8e 1954NXT_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)
f0fb825a 1955udp,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
349fbdc2 1956dnl
50dcbd8e 1957NXT_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)
f0fb825a 1958udp,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
349fbdc2 1959dnl
50dcbd8e 1960NXT_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)
f0fb825a 1961udp,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
349fbdc2 1962dnl
50dcbd8e 1963NXT_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)
f0fb825a 1964udp,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
349fbdc2 1965dnl
50dcbd8e 1966NXT_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)
f0fb825a 1967udp,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
349fbdc2
SH
1968])
1969
1970dnl Modified ARP controller action.
9a403b07 1971AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1972
1973for 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)'
1975done
1976
368a198a 1977OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1978OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2 1979AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1980NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1981arp,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
efe179e0 1982NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1983arp,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
efe179e0 1984NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1985arp,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
efe179e0 1986NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1987arp,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
efe179e0 1988NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1989arp,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
efe179e0 1990NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1991arp,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
efe179e0 1992NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1993arp,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
efe179e0 1994NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1995arp,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
efe179e0 1996NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1997arp,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
349fbdc2
SH
1998])
1999
2000AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2001
2002dnl Checksum SCTP.
6409e008 2003AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
2004
2005for 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'
2007done
2008
f7a22c7e 2009AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
349fbdc2 2010OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 2011OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
2012AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2013NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
e6d9ab56 2014sctp,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
349fbdc2 2015dnl
50dcbd8e 2016NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
f0fb825a 2017sctp,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
349fbdc2 2018dnl
50dcbd8e 2019NXT_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)
f0fb825a 2020sctp,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
349fbdc2 2021dnl
50dcbd8e 2022NXT_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)
f0fb825a 2023sctp,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
349fbdc2 2024dnl
50dcbd8e 2025NXT_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)
f0fb825a 2026sctp,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
349fbdc2 2027dnl
50dcbd8e 2028NXT_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)
f0fb825a 2029sctp,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
349fbdc2 2030dnl
50dcbd8e 2031NXT_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)
f0fb825a 2032sctp,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
349fbdc2 2033dnl
50dcbd8e 2034NXT_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)
f0fb825a 2035sctp,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
349fbdc2 2036dnl
50dcbd8e 2037NXT_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)
f0fb825a 2038sctp,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
349fbdc2
SH
2039])
2040
2041AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
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
349fbdc2
SH
2054NXST_FLOW reply:
2055])
2056
2057OVS_VSWITCHD_STOP
2058AT_CLEANUP
2059
d39ec23d
JP
2060
2061AT_SETUP([ofproto-dpif - controller with slow-path action])
2062OVS_VSWITCHD_START
2063add_of_ports br0 1 2
2064
2065AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,controller"])
2066
2067AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2068
2069for 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)'
2071done
2072
2073OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
2074OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2075
2076AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
2077OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
2078tcp,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
d39ec23d 2079dnl
6f068379
BP
2080OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
2081tcp,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
d39ec23d 2082dnl
6f068379
BP
2083OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
2084tcp,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
d39ec23d
JP
2085])
2086
2087OVS_VSWITCHD_STOP
2088AT_CLEANUP
2089
2090
1dea1435 2091AT_SETUP([ofproto-dpif - controller action without megaflows])
2092OVS_VSWITCHD_START
2093add_of_ports br0 1
2094
2095AT_CHECK([ovs-ofctl add-flow br0 in_port=1,action=controller])
2096AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [dnl
2097megaflows disabled
2098])
2099
2100AT_CAPTURE_FILE([ofctl_monitor.log])
2101AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2102
2103for 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)'])
2105done
2106
2107OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
2108OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
2109
2110AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 2111flow-dump from the main thread:
74c4530d 2112packets: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))
1dea1435 2113])
2114
2115AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2116NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
2117vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
2118NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
2119vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
2120])
2121
af7535e7
AZ
2122AT_CHECK([ovs-appctl revalidator/purge])
2123AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2124
2125dnl Add a controller meter.
d39ec23d 2126AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=controller pktps stats bands=type=drop rate=2'])
af7535e7
AZ
2127
2128dnl Advance time by 1 second.
2129AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
2130
2131for 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)'])
2133done
2134
2135AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 2136flow-dump from the main thread:
74c4530d 2137packets: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))))
af7535e7
AZ
2138])
2139
2140AT_CHECK([ovs-appctl time/warp 1], [0], [ignore])
2141OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
2142
d39ec23d
JP
2143dnl Out of 8 packets we sent, two were passed by the rate limiter, and
2144dnl the rest of packets were blocked.
af7535e7
AZ
2145AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2146NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
2147vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
2148NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
2149vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
2150])
2151dnl Check meter stats to make it gives the same picture;
2152dnl 7 packets hit the meter, but 6 packets are dropped by band0.
bad98905 2153AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
af7535e7 2154OFPST_METER reply (OF1.3) (xid=0x2):
d39ec23d 2155meter:controller flow_count:0 packet_in_count:8 byte_in_count:112 duration:0.0s bands:
af7535e7
AZ
21560: packet_count:6 byte_count:84
2157])
2158
1dea1435 2159OVS_VSWITCHD_STOP
2160AT_CLEANUP
2161
349fbdc2
SH
2162AT_SETUP([ofproto-dpif - MPLS handling])
2163OVS_VSWITCHD_START([dnl
2164 add-port br0 p1 -- set Interface p1 type=dummy
2165])
53eb8cb8 2166on_exit 'kill `cat ovs-ofctl.pid`'
349fbdc2
SH
2167
2168AT_CAPTURE_FILE([ofctl_monitor.log])
2169AT_DATA([flows.txt], [dnl
2170cookie=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
2171cookie=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
2172cookie=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
2173cookie=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
2174cookie=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
2175cookie=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
2176cookie=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
2177cookie=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
1ffd16af 2178cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
349fbdc2
SH
2179cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
2180cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
2181cookie=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
1ffd16af
SH
2182
2183cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
2184cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
2185cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
2186cookie=0xd dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:OXM_OF_IPV4_DST[[]],pop:OXM_OF_IPV4_SRC[[]],controller
961cf8e0 2187cookie=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
91fc374a 2188cookie=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
1ffd16af
SH
2189cookie=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
2191cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
2192cookie=0xd table=1 arp actions=controller
2193
e672ff9b
JR
2194cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
2195cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1ffd16af
SH
2196cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
2197cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
2198
2199cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
2200cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
2201cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
2202
2203cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
e672ff9b
JR
2204cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
2205cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1ffd16af 2206
e672ff9b
JR
2207cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
2208cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
2209cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 2210
e672ff9b
JR
2211cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
2212cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
2213cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 2214
e672ff9b
JR
2215cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
2216cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
2217cookie=0x5 dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
349fbdc2
SH
2218])
2219AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2220
b02475c5 2221dnl Modified MPLS controller action.
9a403b07 2222AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2223
2224for i in 1 2 3; do
791a09be 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)'
b02475c5 2226done
57c94f35 2227OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2228OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2229
b02475c5 2230AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379 2231NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
e6d9ab56 2232mpls,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
b02475c5 2233dnl
6f068379 2234NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
e6d9ab56 2235mpls,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
b02475c5 2236dnl
6f068379 2237NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
e6d9ab56 2238mpls,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
b02475c5
SH
2239])
2240
2241dnl Modified MPLS controller action.
9a403b07 2242AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5 2243
b0a17866 2244for i in 1 2 3; do
8249a1fe 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)'
b0a17866
SH
2246done
2247OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2248OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b0a17866
SH
2249
2250AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2251NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 2252ip,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
b0a17866 2253dnl
efe179e0 2254NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 2255ip,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
b0a17866 2256dnl
efe179e0 2257NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 2258ip,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
b0a17866
SH
2259])
2260
2261dnl Modified MPLS controller action.
9a403b07 2262AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b0a17866 2263
b02475c5
SH
2264dnl 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
2266for 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)'
2268done
bece9ea7 2269OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2270OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
bece9ea7 2271
b02475c5 2272AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2273NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2274mpls,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
b02475c5 2275dnl
efe179e0 2276NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2277mpls,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
b02475c5 2278dnl
efe179e0 2279NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2280mpls,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
b02475c5
SH
2281])
2282
2283dnl Modified MPLS controller action.
9a403b07 2284AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2285
2286for i in 1 2 3; do
8249a1fe 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))'
b02475c5 2288done
57c94f35 2289OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2290OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2291
b02475c5 2292AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2293NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 2294mpls,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
b02475c5 2295dnl
efe179e0 2296NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 2297mpls,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
b02475c5 2298dnl
efe179e0 2299NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 2300mpls,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
b02475c5
SH
2301])
2302
b676167a 2303dnl Modified MPLS controller action.
9a403b07 2304AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b676167a
SH
2305
2306for i in 1 2 3; do
8249a1fe 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)'
b676167a 2308done
57c94f35 2309OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2310OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b676167a 2311
b676167a 2312AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2313NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2314mpls,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
b676167a 2315dnl
efe179e0 2316NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2317mpls,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
b676167a 2318dnl
efe179e0 2319NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2320mpls,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
b676167a
SH
2321])
2322
0f3f3c3d 2323dnl Modified MPLS controller action.
9a403b07 2324AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
2325
2326for i in 1 2 3; do
8249a1fe 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)'
0f3f3c3d 2328done
57c94f35 2329OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2330OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 2331
0f3f3c3d 2332AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2333NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2334mpls,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
0f3f3c3d 2335dnl
efe179e0 2336NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2337mpls,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
0f3f3c3d 2338dnl
efe179e0 2339NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2340mpls,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
0f3f3c3d
SH
2341])
2342
2343dnl Modified MPLS controller action.
9a403b07 2344AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
2345
2346for i in 1 2 3; do
8249a1fe 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)'
0f3f3c3d 2348done
57c94f35 2349OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2350OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 2351
0f3f3c3d 2352AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2353NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2354mpls,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
0f3f3c3d 2355dnl
efe179e0 2356NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2357mpls,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
0f3f3c3d 2358dnl
efe179e0 2359NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2360mpls,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
0f3f3c3d
SH
2361])
2362
1ffd16af
SH
2363AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2364
2365dnl Modified MPLS controller action.
9a403b07 2366AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2367
2368for 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)'
2370done
2371OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2372OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1ffd16af
SH
2373
2374AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2375NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2376mplsm,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
1ffd16af 2377dnl
efe179e0 2378NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2379mplsm,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
1ffd16af 2380dnl
efe179e0 2381NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2382mplsm,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
1ffd16af
SH
2383])
2384
2385AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2386
0f3f3c3d 2387dnl Modified MPLS controller action.
9a403b07 2388AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
2389
2390for i in 1 2 3; do
8249a1fe 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)'
0f3f3c3d 2392done
57c94f35 2393OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2394OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 2395
0f3f3c3d 2396AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2397NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2398mpls,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
0f3f3c3d 2399dnl
efe179e0 2400NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2401mpls,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
0f3f3c3d 2402dnl
efe179e0 2403NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2404mpls,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
0f3f3c3d
SH
2405])
2406
b02475c5 2407dnl Modified MPLS actions.
9a403b07 2408AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2409
2410for i in 1 2 3; do
02830175 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)'
b02475c5 2412done
57c94f35 2413OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2414OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2415
b02475c5 2416AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2417NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 2418mpls,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
b02475c5 2419dnl
efe179e0 2420NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 2421mpls,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
b02475c5 2422dnl
efe179e0 2423NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 2424mpls,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
b02475c5
SH
2425])
2426
2427dnl Modified MPLS ipv6 controller action.
9a403b07 2428AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2429
2430for 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)'
2432done
57c94f35 2433OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2434OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2435
b02475c5 2436AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2437NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2438mplsm,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
b02475c5 2439dnl
efe179e0 2440NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2441mplsm,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
b02475c5 2442dnl
efe179e0 2443NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2444mplsm,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
b02475c5
SH
2445])
2446
2447
2448dnl Modified MPLS pop action.
cff78c88
SH
2449dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
2450dnl 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)
2451dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
2452
9a403b07 2453AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2454
2455for i in 1 2 3; do
cff78c88 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'
b02475c5 2457done
cff78c88
SH
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
57c94f35 2461OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2462OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2463
b02475c5 2464AT_CHECK([cat ofctl_monitor.log], [0], [dnl
cff78c88 2465NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2466tcp,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
b02475c5 2467dnl
cff78c88 2468NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2469tcp,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
b02475c5 2470dnl
cff78c88 2471NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2472tcp,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
b02475c5
SH
2473])
2474
5c0243a9 2475AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
0d56eaf2 2476
1ffd16af
SH
2477dnl Modified MPLS pop action.
2478dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2479dnl 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)
2480dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2481dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2482AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2483
2484for 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'
2486done
2487OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2488OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2489
2be3fe44 2490AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2491NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2492tcp,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
1ffd16af 2493dnl
e672ff9b 2494NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2495tcp,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
1ffd16af 2496dnl
e672ff9b 2497NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2498tcp,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
1ffd16af
SH
2499])
2500
2501AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2502
2503dnl Modified MPLS pop action.
2504dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2505dnl 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)
2506dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2507dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2508AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2509
2510for 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'
2512done
2513OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2514OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2515
2be3fe44 2516AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2517NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2518tcp,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
1ffd16af 2519dnl
e672ff9b 2520NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2521tcp,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
1ffd16af 2522dnl
e672ff9b 2523NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2524tcp,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
1ffd16af
SH
2525])
2526
2527AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2528
2529dnl Modified MPLS pop action.
2530dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2531dnl 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)
2532dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2533dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2534AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2535
2536for 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'
2538done
2539OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2540OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2541
2be3fe44 2542AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2543NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2544tcp,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
1ffd16af 2545dnl
e672ff9b 2546NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2547tcp,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
1ffd16af 2548dnl
e672ff9b 2549NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2550tcp,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
1ffd16af
SH
2551])
2552
2553AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2554
2555dnl Modified MPLS pop action.
2556dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2557dnl 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)
2558dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2559dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2560AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2561
2562for 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'
2564done
2565OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2566OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2567
2be3fe44 2568AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2569NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2570tcp,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
1ffd16af 2571dnl
e672ff9b 2572NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2573tcp,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
1ffd16af 2574dnl
e672ff9b 2575NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2576tcp,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
1ffd16af
SH
2577])
2578
2579AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2580
2581dnl Modified MPLS pop action.
2582dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2583dnl 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)
2584dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2585dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2586AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2587
2588for 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'
2590done
2591OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2592OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2593
2be3fe44 2594AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2595NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2596tcp,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
1ffd16af 2597dnl
e672ff9b 2598NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2599tcp,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
1ffd16af 2600dnl
e672ff9b 2601NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2602tcp,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
1ffd16af
SH
2603])
2604
2605AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2606
2607dnl Modified MPLS pop action.
2608dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2609dnl 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)
2610dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2611dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2612AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2613
2614for 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'
2616done
2617OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2618OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2619
2be3fe44 2620AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2621NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
c9c8c8a1 2622tcp,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
1ffd16af 2623dnl
e672ff9b 2624NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
c9c8c8a1 2625tcp,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
1ffd16af 2626dnl
e672ff9b 2627NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
c9c8c8a1 2628tcp,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
1ffd16af
SH
2629])
2630
2631AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2632
2633dnl Modified MPLS pop action.
2634dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2635dnl 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)
2636dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2637dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2638AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2639
2640for 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'
2642done
2643OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2644OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2645
2be3fe44 2646AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2647NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2648tcp,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
1ffd16af 2649dnl
e672ff9b 2650NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2651tcp,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
1ffd16af 2652dnl
e672ff9b 2653NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2654tcp,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
1ffd16af
SH
2655])
2656
2657AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2658
2659dnl Modified MPLS pop action.
2660dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2661dnl 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)
9a403b07 2662AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2663
2664for 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'
2666done
2667OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2668OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2669
2be3fe44 2670AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
efe179e0 2671NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2672arp,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
1ffd16af 2673dnl
efe179e0 2674NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2675arp,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
1ffd16af 2676dnl
efe179e0 2677NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2678arp,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
1ffd16af
SH
2679])
2680
2681AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2682
2683dnl Modified MPLS pop action.
2684dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2685dnl 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)
2686dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2687dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2688AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2689
2690for 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'
2692done
2693OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2694OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2695
2be3fe44 2696AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2697NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2698tcp,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
1ffd16af 2699dnl
e672ff9b 2700NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2701tcp,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
1ffd16af 2702dnl
e672ff9b 2703NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2704tcp,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
1ffd16af
SH
2705])
2706
2707AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2708
2709dnl Modified MPLS pop action.
2710dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2711dnl 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)
2712dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2713dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2714AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2715
2716for 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'
2718done
2719OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2720OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2721
2be3fe44 2722AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2723NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2724tcp,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
1ffd16af 2725dnl
e672ff9b 2726NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2727tcp,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
1ffd16af 2728dnl
e672ff9b 2729NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2730tcp,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
1ffd16af
SH
2731])
2732
2733AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2734
2735dnl Modified MPLS pop action.
2736dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2737dnl 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)
2738dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2739dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2740AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2741
2742for 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'
2744done
2745OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2746OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2747
2be3fe44 2748AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2749NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2750tcp,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
1ffd16af 2751dnl
e672ff9b 2752NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2753tcp,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
1ffd16af 2754dnl
e672ff9b 2755NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2756tcp,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
1ffd16af
SH
2757])
2758
2759AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2760
2761dnl Modified MPLS pop action.
2762dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2763dnl 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)
5a0e4aec
BP
2764dnl (label 20, exp 0, [S], ttl 31)
2765dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2766dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2767AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2768
2769for 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'
2771done
2772OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2773OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2774
2775AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2776NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2777mplsm,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
1ffd16af
SH
2778dnl
2779NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2780mplsm,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
1ffd16af
SH
2781dnl
2782NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2783mplsm,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
1ffd16af
SH
2784])
2785
2786AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2787
2788dnl Modified MPLS pop action.
2789dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2790dnl 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)
5a0e4aec
BP
2791dnl (label 20, exp 0, [S], ttl 31)
2792dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2793dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2794AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2795
2796for 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'
2798done
2799OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2800OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2801
2802AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2803NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2804mpls,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
1ffd16af 2805dnl
e672ff9b 2806NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2807mpls,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
1ffd16af 2808dnl
e672ff9b 2809NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2810mpls,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
1ffd16af
SH
2811])
2812
2813AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2814
2815dnl Modified MPLS pop action.
2816dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2817dnl 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)
5a0e4aec
BP
2818dnl (label 20, exp 0, [S], ttl 31)
2819dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2820dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2821AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2822
2823for 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'
2825done
2826OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2827OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2828
2829AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2830NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2831mplsm,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
1ffd16af
SH
2832dnl
2833NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2834mplsm,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
1ffd16af
SH
2835dnl
2836NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2837mplsm,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
1ffd16af
SH
2838])
2839
2840AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2841
2842dnl Modified MPLS pop action.
2843dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2844dnl 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)
5a0e4aec
BP
2845dnl (label 20, exp 0, [S], ttl 31)
2846dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2847dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2848AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2849
2850for 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'
2852done
2853OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2854OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2855
2856AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2857NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2858tcp,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
1ffd16af 2859dnl
e672ff9b 2860NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2861tcp,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
1ffd16af 2862dnl
e672ff9b 2863NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2864tcp,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
1ffd16af
SH
2865])
2866
2867AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2868
2869dnl Modified MPLS pop action.
2870dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2871dnl 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)
5a0e4aec
BP
2872dnl (label 20, exp 0, [S], ttl 31)
2873dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2874dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2875AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2876
2877for 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'
2879done
e672ff9b 2880
1ffd16af
SH
2881OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2882OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2883
2be3fe44 2884AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2885NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2886tcp,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
1ffd16af 2887dnl
e672ff9b 2888NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2889tcp,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
1ffd16af 2890dnl
e672ff9b 2891NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2892tcp,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
1ffd16af
SH
2893])
2894
2895AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2896
2897dnl Modified MPLS pop action.
2898dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2899dnl 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)
5a0e4aec
BP
2900dnl (label 20, exp 0, [S], ttl 31)
2901dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2902dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2903AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2904
2905for 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'
2907done
2908OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2909OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2910
2be3fe44 2911AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2912NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2913tcp,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
1ffd16af 2914dnl
e672ff9b 2915NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2916tcp,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
1ffd16af 2917dnl
e672ff9b 2918NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2919tcp,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
1ffd16af
SH
2920])
2921
2922AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2923
2924dnl Modified MPLS pop action.
2925dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2926dnl 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)
5a0e4aec
BP
2927dnl (label 20, exp 0, ttl 31)
2928dnl (label 20, exp 0, [S], ttl 30)
2929dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2930dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2931AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2932
2933for 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'
2935done
2936OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2937OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2938
2939AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2940NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2941mplsm,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
1ffd16af 2942dnl
e672ff9b 2943NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2944mplsm,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
1ffd16af 2945dnl
e672ff9b 2946NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2947mplsm,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
1ffd16af
SH
2948])
2949
2950AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2951
2952dnl Modified MPLS pop action.
2953dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2954dnl 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)
5a0e4aec
BP
2955dnl (label 20, exp 0, ttl 31)
2956dnl (label 20, exp 0, [S], ttl 30)
2957dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2958dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2959AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2960
2961for 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'
2963done
2964OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2965OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2966
2967AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2968NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2969mpls,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
1ffd16af 2970dnl
e672ff9b 2971NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2972mpls,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
1ffd16af 2973dnl
e672ff9b 2974NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2975mpls,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
1ffd16af
SH
2976])
2977
2978AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2979
2980dnl Modified MPLS pop action.
2981dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2982dnl 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)
5a0e4aec
BP
2983dnl (label 20, exp 0, ttl 31)
2984dnl (label 20, exp 0, [S], ttl 30)
2985dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2986dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2987AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2988
2989for 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'
2991done
2992OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2993OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2994
2995AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2996NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2997mplsm,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
1ffd16af 2998dnl
e672ff9b 2999NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3000mplsm,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
1ffd16af 3001dnl
e672ff9b 3002NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3003mplsm,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
1ffd16af
SH
3004])
3005
3006AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3007
3008dnl Modified MPLS pop action.
3009dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3010dnl 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)
3011dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3012dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 3013AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3014
3015for 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'
3017done
3018OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3019OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3020
2be3fe44 3021AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 3022NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3023mpls,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
1ffd16af 3024dnl
e672ff9b 3025NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3026mpls,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
1ffd16af 3027dnl
e672ff9b 3028NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3029mpls,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
1ffd16af
SH
3030])
3031
3032AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3033
3034dnl Modified MPLS pop action.
3035dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3036dnl 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)
3037dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3038dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 3039AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3040
3041for 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'
3043done
3044OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3045OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3046
2be3fe44 3047AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 3048NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3049mplsm,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
1ffd16af 3050dnl
e672ff9b 3051NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3052mplsm,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
1ffd16af 3053dnl
e672ff9b 3054NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3055mplsm,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
1ffd16af
SH
3056])
3057
3058AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3059
3060dnl Modified MPLS pop action.
3061dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3062dnl 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)
3063dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3064dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 3065AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3066
3067for 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'
3069done
3070OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3071OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3072
2be3fe44 3073AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 3074NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3075mplsm,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
1ffd16af 3076dnl
e672ff9b 3077NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3078mplsm,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
1ffd16af 3079dnl
e672ff9b 3080NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3081mplsm,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
1ffd16af
SH
3082])
3083
3084AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3085
3086dnl Modified MPLS pop action.
3087dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3088dnl 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)
3089dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3090dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 3091AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3092
3093for 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'
3095done
e672ff9b 3096
1ffd16af
SH
3097OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3098OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3099
3100AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 3101NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3102mpls,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
1ffd16af 3103dnl
e672ff9b 3104NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3105mpls,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
1ffd16af 3106dnl
e672ff9b 3107NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3108mpls,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
1ffd16af
SH
3109])
3110
3111AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3112
3113dnl Modified MPLS pop action.
3114dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3115dnl 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)
3116dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3117dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 3118AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3119
3120for 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'
3122done
3123OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3124OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3125
3126AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 3127NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3128mplsm,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
1ffd16af 3129dnl
e672ff9b 3130NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3131mplsm,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
1ffd16af 3132dnl
e672ff9b 3133NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3134mplsm,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
1ffd16af
SH
3135])
3136
3137AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3138
3139dnl Modified MPLS pop action.
3140dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3141dnl 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)
3142dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3143dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 3144AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3145
3146for 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'
3148done
e672ff9b 3149
1ffd16af
SH
3150OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3151OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3152
3153AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 3154NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3155mpls,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
1ffd16af 3156dnl
e672ff9b 3157NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3158mpls,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
1ffd16af 3159dnl
e672ff9b 3160NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 3161mpls,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
1ffd16af
SH
3162])
3163
cea4a6d7 3164AT_CHECK([ovs-appctl revalidator/purge], [0])
ef0ce8ae 3165AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
e672ff9b
JR
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
efe179e0
DDP
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
6f068379 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
efe179e0
DDP
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)
c2d936a4 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
1ffd16af
SH
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
961cf8e0 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
91fc374a 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
1ffd16af 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
e672ff9b 3188 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
1ffd16af
SH
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
cff78c88 3191 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
1ffd16af
SH
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
efe179e0 3196 cookie=0xd, table=1, n_packets=3, n_bytes=126, arp actions=CONTROLLER:65535
e672ff9b
JR
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
ef0ce8ae 3206NXST_FLOW reply:
15056dc8
EJ
3207])
3208
3209OVS_VSWITCHD_STOP
8e9ce036 3210AT_CLEANUP
04c956fc 3211
1ffd16af
SH
3212AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
3213OVS_VSWITCHD_START([dnl
3214 add-port br0 p1 -- set Interface p1 type=dummy
3215])
53eb8cb8 3216on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
3217
3218AT_CAPTURE_FILE([ofctl_monitor.log])
3219AT_DATA([flows.txt], [dnl
3220table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
3221table=1 ip,ip_dscp=8 actions=controller
3222])
3223AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
3224
3225
3226dnl Modified MPLS pop action.
3227dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3228dnl 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)
3229dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3230dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 3231AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3232
3233for 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'
3235done
3236OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3237OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3238
2be3fe44 3239AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1ffd16af 3240OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3241tcp,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
1ffd16af
SH
3242dnl
3243OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3244tcp,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
1ffd16af
SH
3245dnl
3246OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3247tcp,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
1ffd16af
SH
3248])
3249
cea4a6d7 3250AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
3251AT_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
3254OFPST_FLOW reply (OF1.2):
3255])
3256
3257OVS_VSWITCHD_STOP
3258AT_CLEANUP
3259
3260AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
3261OVS_VSWITCHD_START([dnl
3262 add-port br0 p1 -- set Interface p1 type=dummy
3263])
53eb8cb8 3264on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
3265
3266dnl N.B: The first (and only) action that accesses L3 data after the
3267dnl pop_mpls action is present in write_actions. This exercises recirculation
3268dnl triggered in write_actions due to a previous action not in write actions.
3269AT_CAPTURE_FILE([ofctl_monitor.log])
3270AT_DATA([flows.txt], [dnl
3271mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
3272])
3273AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
3274
3275dnl Modified MPLS pop action.
3276dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3277dnl 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)
3278dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3279dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 3280AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3281
3282for 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'
3284done
3285OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3286OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3287
2be3fe44 3288AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 3289OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3290tcp,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
1ffd16af 3291dnl
e672ff9b 3292OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3293tcp,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
1ffd16af 3294dnl
e672ff9b 3295OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3296tcp,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
1ffd16af
SH
3297])
3298
cea4a6d7 3299AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
3300AT_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)
3302OFPST_FLOW reply (OF1.2):
3303])
3304
3305OVS_VSWITCHD_STOP
3306AT_CLEANUP
527ae97e
SH
3307
3308AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
3309OVS_VSWITCHD_START([dnl
3310 add-port br0 p1 -- set Interface p1 type=dummy
3311])
53eb8cb8 3312on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
3313
3314AT_CAPTURE_FILE([ofctl_monitor.log])
3315# A table-miss flow has priority 0 and no match
3316AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3317
3318dnl Singleton controller action.
6409e008 3319AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
3320
3321for 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)'
3323done
3324OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3325OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
527ae97e
SH
3326
3327AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3328OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3329tcp,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
527ae97e 3330dnl
efe179e0 3331OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3332tcp,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
527ae97e 3333dnl
efe179e0 3334OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3335tcp,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
527ae97e
SH
3336])
3337
cea4a6d7 3338AT_CHECK([ovs-appctl revalidator/purge], [0])
527ae97e 3339AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3340 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
527ae97e
SH
3341NXST_FLOW reply:
3342])
3343
3344OVS_VSWITCHD_STOP
3345AT_CLEANUP
3346
3347
3348AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
3349OVS_VSWITCHD_START([dnl
3350 add-port br0 p1 -- set Interface p1 type=dummy
3351])
53eb8cb8 3352on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
3353
3354AT_CAPTURE_FILE([ofctl_monitor.log])
3355# A table-miss flow has priority 0 and no match
3356AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3357
3358dnl Singleton controller action.
6409e008 3359AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
3360
3361for 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)'
3363done
3364OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3365OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
527ae97e
SH
3366
3367AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3368
3369AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3370OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3371tcp,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
527ae97e 3372dnl
efe179e0 3373OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3374tcp,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
527ae97e 3375dnl
efe179e0 3376OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3377tcp,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
ba96552a
SS
3378])
3379
cea4a6d7 3380AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a 3381AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3382 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
ba96552a
SS
3383OFPST_FLOW reply (OF1.3):
3384])
3385
3386OVS_VSWITCHD_STOP
3387AT_CLEANUP
3388
3389AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
3390OVS_VSWITCHD_START([dnl
3391 add-port br0 p1 -- set Interface p1 type=dummy
3392])
53eb8cb8 3393on_exit 'kill `cat ovs-ofctl.pid`'
ba96552a 3394
5b7278a1
JS
3395ovs-appctl time/stop
3396
ba96552a
SS
3397AT_CAPTURE_FILE([ofctl_monitor.log])
3398# A table-miss flow has priority 0 and no match
3399AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3400
3401dnl Singleton controller action.
6409e008 3402AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
ba96552a 3403
807152a4 3404# Become secondary (OF 1.3), which should disable everything except port status.
ba96552a
SS
3405ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3406
5b7278a1
JS
3407# Ensure that ovs-vswitchd gets a chance to reply before sending another command.
3408ovs-appctl time/warp 500 100
3409
807152a4 3410# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for secondary only.
ba96552a
SS
3411ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
3412
5b7278a1 3413ovs-appctl time/warp 500 100
ba96552a
SS
3414for 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)'
3416done
3417OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3418OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
ba96552a 3419
cea4a6d7 3420AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a 3421AT_CHECK([cat ofctl_monitor.log], [0], [dnl
807152a4
BP
3422send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=secondary generation_id=1
3423OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=secondary generation_id=1
ba96552a
SS
3424dnl
3425send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
807152a4 3426 primary:
ba96552a
SS
3427 PACKET_IN: (off)
3428 PORT_STATUS: (off)
3429 FLOW_REMOVED: (off)
904e5202
BP
3430 ROLE_STATUS: (off)
3431 TABLE_STATUS: (off)
3432 REQUESTFORWARD: (off)
ba96552a 3433
807152a4 3434 secondary:
ba96552a
SS
3435 PACKET_IN: no_match
3436 PORT_STATUS: (off)
3437 FLOW_REMOVED: (off)
904e5202
BP
3438 ROLE_STATUS: (off)
3439 TABLE_STATUS: (off)
3440 REQUESTFORWARD: (off)
ba96552a 3441dnl
efe179e0 3442OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3443tcp,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
ba96552a 3444dnl
efe179e0 3445OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3446tcp,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
ba96552a 3447dnl
efe179e0 3448OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3449tcp,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
527ae97e
SH
3450])
3451
3452AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3453
3454AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3455 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
527ae97e
SH
3456OFPST_FLOW reply (OF1.3):
3457])
3458
3459OVS_VSWITCHD_STOP
3460AT_CLEANUP
3461
807c7989
SS
3462
3463AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
3464OVS_VSWITCHD_START([dnl
3465 add-port br0 p1 -- set Interface p1 type=dummy
3466])
53eb8cb8 3467on_exit 'kill `cat ovs-ofctl.pid`'
807c7989
SS
3468
3469AT_CAPTURE_FILE([ofctl_monitor.log])
3470# A table-miss flow has priority 0 and no match
3471AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3472
3473dnl Singleton controller action.
6409e008 3474AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
807c7989
SS
3475
3476for 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)'
3478done
3479OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3480OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
807c7989 3481
cea4a6d7 3482AT_CHECK([ovs-appctl revalidator/purge], [0])
807c7989 3483AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3484OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3485tcp,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
807c7989 3486dnl
efe179e0 3487OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3488tcp,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
807c7989 3489dnl
efe179e0 3490OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3491tcp,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
807c7989
SS
3492])
3493
3494AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3495
3496AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3497 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
807c7989
SS
3498OFPST_FLOW reply (OF1.4):
3499])
3500
3501OVS_VSWITCHD_STOP
3502AT_CLEANUP
3503
3504
029ca940 3505AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3a11fd5b
SS
3506OVS_VSWITCHD_START([dnl
3507 add-port br0 p1 -- set Interface p1 type=dummy
3508])
53eb8cb8 3509on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
3510
3511AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
3512AT_DATA([flows.txt], [dnl
3513table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3514table=1 actions=output(CONTROLLER),goto_table(2)
3515table=2 actions=group:1234
3516])
3a11fd5b 3517AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 3518AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3a11fd5b
SS
3519
3520dnl Singleton controller action.
6409e008 3521AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
3522
3523for 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)'
3525done
331c07ac
YHW
3526AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3527OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
d9c8c57c 3528OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3a11fd5b
SS
3529
3530AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3531
3532AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3533OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3534tcp,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
029ca940 3535dnl
efe179e0 3536OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3537tcp,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
029ca940 3538dnl
efe179e0 3539OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3540tcp,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
3a11fd5b 3541dnl
efe179e0 3542OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3543tcp,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
029ca940 3544dnl
efe179e0 3545OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3546tcp,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
029ca940 3547dnl
efe179e0 3548OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3549tcp,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
3a11fd5b 3550dnl
efe179e0 3551OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3552tcp,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
029ca940 3553dnl
efe179e0 3554OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3555tcp,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
029ca940 3556dnl
efe179e0 3557OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3558tcp,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
331c07ac
YHW
3559dnl
3560OFPT_PACKET_IN (OF1.3) (xid=0x0): total_len=54 in_port=ANY (via action) data_len=54 (unbuffered)
3561tcp,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
3a11fd5b
SS
3562])
3563
3564AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3565
3566AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
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
3a11fd5b
SS
3570OFPST_FLOW reply (OF1.3):
3571])
3572
3573OVS_VSWITCHD_STOP
3574AT_CLEANUP
3575
3576
029ca940 3577AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3a11fd5b
SS
3578OVS_VSWITCHD_START([dnl
3579 add-port br0 p1 -- set Interface p1 type=dummy
3580])
53eb8cb8 3581on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
3582
3583AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
3584AT_DATA([flows.txt], [dnl
3585table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3586table=1 actions=output(CONTROLLER),goto_table(2)
3587table=2 actions=group:1234
3588])
3a11fd5b 3589AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 3590AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3a11fd5b
SS
3591
3592dnl Singleton controller action.
6409e008 3593AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
3594
3595for 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)'
3597done
331c07ac
YHW
3598AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3599OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
d9c8c57c 3600OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3a11fd5b
SS
3601
3602AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3603
3604AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3605OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3606tcp,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
029ca940 3607dnl
efe179e0 3608OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3609tcp,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
029ca940 3610dnl
efe179e0 3611OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3612tcp,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
029ca940 3613dnl
efe179e0 3614OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3615tcp,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
029ca940 3616dnl
efe179e0 3617OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3618tcp,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
029ca940 3619dnl
efe179e0 3620OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3621tcp,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
029ca940 3622dnl
efe179e0 3623OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3624tcp,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
3a11fd5b 3625dnl
efe179e0 3626OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3627tcp,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
3a11fd5b 3628dnl
efe179e0 3629OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3630tcp,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
331c07ac
YHW
3631dnl
3632OFPT_PACKET_IN (OF1.4) (xid=0x0): total_len=54 in_port=ANY (via packet_out) data_len=54 (unbuffered)
3633tcp,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
3a11fd5b
SS
3634])
3635
3636AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3637
3638AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
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
3a11fd5b
SS
3642OFPST_FLOW reply (OF1.4):
3643])
3644
3645OVS_VSWITCHD_STOP
3646AT_CLEANUP
3647
f5634764
KG
3648AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3649
3650OVS_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
3655AT_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
3667AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3668
3669AT_CHECK([
3670 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
3671], [0], [ignore])
3672
3673OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
3674OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3675
3676AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3677OFPT_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)
3678icmp,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
3679dnl
3680OFPT_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)
3681icmp,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
3684OVS_VSWITCHD_STOP
3685AT_CLEANUP
029ca940 3686
f6c8a6b1
BP
3687AT_SETUP([ofproto-dpif - ARP modification slow-path])
3688OVS_VSWITCHD_START
ca5792f0 3689add_of_ports br0 1 2
f6c8a6b1
BP
3690
3691ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3692ovs-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.
3695for 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)'
3697done
3698AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3699
3700# Check the packets that were output.
3701AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
78c9486d
JR
3702arp,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
3703arp,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
3704arp,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
3705arp,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
3706arp,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
3707arp,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
3708arp,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
3709arp,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
3710arp,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
f6c8a6b1
BP
3711])
3712
f6c8a6b1
BP
3713OVS_VSWITCHD_STOP
3714AT_CLEANUP
3715
ecac4ebf 3716AT_SETUP([ofproto-dpif - VLAN handling])
04c956fc 3717OVS_VSWITCHD_START(
023e1e0a
BP
3718 [set Bridge br0 fail-mode=standalone -- \
3719 add-port br0 p1 trunks=10,12 -- \
ecac4ebf 3720 add-port br0 p2 tag=10 -- \
5e9ceccd 3721 add-port br0 p3 tag=12 \
88f52d7f 3722 other-config:priority-tags=if-nonzero -- \
ecac4ebf
BP
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 -- \
5e9ceccd 3727 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
88f52d7f 3728 other-config:priority-tags=if-nonzero -- \
fed8962a
EG
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 \
88f52d7f 3733 other-config:priority-tags=if-nonzero -- \
ecac4ebf
BP
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 -- \
fed8962a
EG
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 --])
04c956fc 3746
247527db
BP
3747dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3748dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
ecac4ebf 3749dnl actions.
04c956fc 3750for tuple in \
e44768b7
JP
3751 "100 none 0 drop" \
3752 "100 0 0 drop" \
3753 "100 0 1 drop" \
fed8962a
EG
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" \
e44768b7
JP
3756 "100 11 0 5,7" \
3757 "100 11 1 5,7" \
fed8962a
EG
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" \
247527db
BP
3760 "1 none 0 drop" \
3761 "1 0 0 drop" \
3762 "1 0 1 drop" \
fed8962a
EG
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" \
247527db
BP
3765 "1 11 0 drop" \
3766 "1 11 1 drop" \
fed8962a
EG
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" \
247527db
BP
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" \
fed8962a
EG
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" \
247527db
BP
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" \
fed8962a
EG
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" \
247527db
BP
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" \
fed8962a
EG
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" \
e44768b7
JP
3801 "5 11 0 7,100" \
3802 "5 11 1 7,100" \
fed8962a
EG
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" \
247527db
BP
3810 "6 11 0 drop" \
3811 "6 11 1 drop" \
fed8962a
EG
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" \
e44768b7
JP
3819 "7 11 0 5,100" \
3820 "7 11 1 5,100" \
fed8962a
EG
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" \
247527db
BP
3828 "8 11 0 drop" \
3829 "8 11 1 drop" \
fed8962a
EG
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"
04c956fc
BP
3841do
3842 set $tuple
3843 in_port=$1
3844 vlan=$2
ecac4ebf
BP
3845 pcp=$3
3846 expected=$4
04c956fc
BP
3847
3848 if test $vlan = none; then
247527db 3849 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
04c956fc 3850 else
247527db 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))"
04c956fc
BP
3852 fi
3853
395e68ce
BP
3854 echo "----------------------------------------------------------------------"
3855 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3856
50aa28fd 3857 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
ecac4ebf 3858 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
04c956fc 3859
247527db 3860 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
becffb86 3861 mv stdout expout
247527db 3862 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
04c956fc
BP
3863done
3864
3865OVS_VSWITCHD_STOP
3866AT_CLEANUP
7257b535 3867
f0fb825a
EG
3868AT_SETUP([ofproto-dpif - VLAN depth limit])
3869OVS_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
3875AT_DATA([flows.txt], [dnl
3876table=0 in_port=1,eth_type=0x8100,vlan_tci=0x0010/0x01ff actions=output:2
3877table=0 in_port=1,eth_type=0xabcd,vlan_tci=0x0010/0x01ff actions=output:3
3878])
3879AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3880flow="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
3883AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3884AT_CHECK([tail -1 stdout], [0],
3885 [Datapath actions: 2
3886])
3887
3888AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3889AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3890AT_CHECK([tail -1 stdout], [0],
3891 [Datapath actions: 3
3892])
3893
3894OVS_VSWITCHD_STOP
3895AT_CLEANUP
3896
3897AT_SETUP([ofproto-dpif - Multi-VLAN actions])
3898OVS_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])
3902AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3903
3904AT_DATA([flows.txt], [dnl
3905table=0 in_port=1,vlan_tci=0x1100/0x1fff actions=pop_vlan,output:2
3906table=0 in_port=1,vlan_tci=0x1101/0x1fff actions=push_vlan:0x8100,set_field:0x1201/0x1fff->vlan_tci,output:2
3907table=0 in_port=1,vlan_tci=0x1102/0x1fff actions=push_vlan:0x88a8,set_field:0x1202/0x1fff->vlan_tci,output:2
3908table=0 in_port=1,vlan_tci=0x1103/0x1fff actions=set_field:0x1203/0x1fff->vlan_tci,output:2
3909table=0 in_port=1,vlan_tci=0x1104/0x1fff actions=pop_vlan,goto_table:1
3910table=1 vlan_tci=0 actions=output:2
3911table=1 vlan_tci=0x1300/0x1fff actions=pop_vlan,output:2
3912table=1 vlan_tci=0x1301/0x1fff actions=push_vlan:0x88a8,set_field:0x1401/0x1fff->vlan_tci,output:2
3913table=1 vlan_tci=0x1302/0x1fff actions=set_field:0x1402/0x1fff->vlan_tci,output:2
3914])
3915
3916AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3917
3918check_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
3925check_act "eth_type(0x8100),vlan(vid=0x0100,pcp=0),encap(eth_type(0xabcd))" \
3926 "pop_vlan,2"
3927
3928check_act "eth_type(0x8100),vlan(vid=0x0101,pcp=0),encap(eth_type(0xabcd))" \
3929 "push_vlan(vid=513,pcp=0),2"
3930
3931check_act "eth_type(0x8100),vlan(vid=0x0102,pcp=0),encap(eth_type(0xabcd))" \
3932 "push_vlan(tpid=0x88a8,vid=514,pcp=0),2"
3933
3934check_act "eth_type(0x8100),vlan(vid=0x0103,pcp=0),encap(eth_type(0xabcd))" \
3935 "pop_vlan,push_vlan(vid=515,pcp=0),2"
3936
3937check_act "eth_type(0x8100),vlan(vid=0x0104,pcp=0),encap(eth_type(0xabcd))" \
3938 "pop_vlan,2"
3939
3940check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3941vlan(vid=0x0300,pcp=0),encap(eth_type(0xabcd)))" "pop_vlan,pop_vlan,2"
3942
3943check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3944vlan(vid=0x0301,pcp=0),encap(eth_type(0xabcd)))" \
3945 "pop_vlan,push_vlan(tpid=0x88a8,vid=1025,pcp=0),2"
3946
3947check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3948vlan(vid=0x0302,pcp=0),encap(eth_type(0xabcd)))" \
3949 "pop_vlan,pop_vlan,push_vlan(vid=1026,pcp=0),2"
3950
3951OVS_VSWITCHD_STOP
3952AT_CLEANUP
3953
56879058
JS
3954AT_SETUP([ofproto-dpif - MPLS handling])
3955OVS_VSWITCHD_START([dnl
3956 add-port br0 p1 -- set Interface p1 type=dummy
3957])
53eb8cb8 3958on_exit 'kill `cat ovs-ofctl.pid`'
56879058
JS
3959
3960AT_CAPTURE_FILE([ofctl_monitor.log])
3961AT_DATA([flows.txt], [dnl
3962dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
63636ee8 3963dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
0c1625e8 3964dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
56879058
JS
3965])
3966AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3967
3968dnl In this test, we push an MPLS tag to an ethernet packet.
9a403b07 3969AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
56879058
JS
3970
3971for 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)'
3973done
62022172 3974OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3975OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
56879058 3976
38b0b29f 3977AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 3978OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
e6d9ab56 3979mpls,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
56879058 398000000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
6f068379 398100000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
56879058 398200000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
6f068379
BP
398300000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
398400000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
398500000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
398600000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
398700000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3988OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
e6d9ab56 3989mpls,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
56879058 399000000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
6f068379 399100000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
56879058 399200000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
6f068379
BP
399300000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
399400000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
399500000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
399600000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
399700000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3998OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
e6d9ab56 3999mpls,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
56879058 400000000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
6f068379 400100000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
56879058 400200000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
6f068379
BP
400300000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
400400000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
400500000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
400600000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
400700000070 36 37 38 39 3a 3b 3c 3d-3e 3f
56879058
JS
4008])
4009
63636ee8
JS
4010dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
4011dnl copied exactly, except for the BOS bit.
9a403b07 4012AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
63636ee8
JS
4013
4014for 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)'
4016done
62022172 4017OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4018OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
63636ee8 4019
38b0b29f 4020AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 4021OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 4022mpls,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
63636ee8 402300000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 402400000010 a0 40 00 00 a1 40
63636ee8 4025dnl
efe179e0 4026OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 4027mpls,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
63636ee8 402800000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 402900000010 a0 40 00 00 a1 40
63636ee8 4030dnl
efe179e0 4031OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 4032mpls,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
63636ee8 403300000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 403400000010 a0 40 00 00 a1 40
0c1625e8
SH
4035])
4036
4037dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
4038dnl copied exactly, except for the BOS bit. The ethertype should be updated
4039dnl to the MPLS ethertype of the MPLS push action which differs to that
4040dnl of the input packet.
9a403b07 4041AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
0c1625e8
SH
4042
4043for 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)'
4045done
62022172 4046OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
d9c8c57c 4047OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
0c1625e8 4048
38b0b29f 4049AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 4050OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 4051mplsm,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
0c1625e8 405200000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 405300000010 a0 40 00 00 a1 40
0c1625e8 4054dnl
efe179e0 4055OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 4056mplsm,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
0c1625e8 405700000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 405800000010 a0 40 00 00 a1 40
0c1625e8 4059dnl
efe179e0 4060OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 4061mplsm,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
0c1625e8 406200000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 406300000010 a0 40 00 00 a1 40
63636ee8
JS
4064])
4065
56879058
JS
4066OVS_VSWITCHD_STOP
4067AT_CLEANUP
4068
846e159a
SH
4069AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
4070OVS_VSWITCHD_START([dnl
4071 add-port br0 p1 -- set Interface p1 type=dummy
4072])
53eb8cb8 4073on_exit 'kill `cat ovs-ofctl.pid`'
846e159a
SH
4074
4075AT_CAPTURE_FILE([ofctl_monitor.log])
4076AT_DATA([flows.txt], [dnl
4077cookie=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
4078cookie=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
4079cookie=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
4080cookie=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
4081cookie=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
4082cookie=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
4083cookie=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
4084cookie=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
4085cookie=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
4086cookie=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])
4088AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
4089
4090dnl Modified MPLS controller action.
4091dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
4092dnl both of these in the final flow
9a403b07 4093AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4094
4095for 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)'
4097done
62022172 4098OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4099OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4100
38b0b29f 4101AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4102OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4103mpls,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
846e159a 410400000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
6f068379
BP
410500000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
410600000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
410700000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
410800000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
410900000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
411000000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
411100000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4112OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4113mpls,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
846e159a 411400000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
6f068379
BP
411500000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
411600000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
411700000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
411800000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
411900000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
412000000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
412100000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4122OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4123mpls,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
846e159a 412400000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
6f068379
BP
412500000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
412600000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
412700000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
412800000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
412900000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
413000000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
413100000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4132])
4133
4134dnl Modified MPLS controller action.
f0fb825a
EG
4135dnl In this test, the input packet is vlan-tagged, which should be kept as
4136dnl inner vlan.
9a403b07 4137AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4138
4139for 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))'
4141done
62022172 4142OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4143OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4144
38b0b29f 4145AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4146OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4147mpls,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
846e159a 414800000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
6f068379
BP
414900000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
415000000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
415100000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
415200000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
415300000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
415400000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
415500000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
415600000080 3e 3f
4157OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4158mpls,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
846e159a 415900000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
6f068379
BP
416000000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
416100000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
416200000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
416300000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
416400000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
416500000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
416600000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
416700000080 3e 3f
4168OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4169mpls,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
846e159a 417000000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
6f068379
BP
417100000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
417200000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
417300000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
417400000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
417500000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
417600000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
417700000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
417800000080 3e 3f
846e159a
SH
4179])
4180
4181dnl Modified MPLS controller action.
4182dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
4183dnl both of these in the final flow
9a403b07 4184AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4185
4186for 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)'
4188done
62022172 4189OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4190OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4191
38b0b29f 4192AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4193OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4194mpls,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
846e159a 419500000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
6f068379
BP
419600000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
419700000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
419800000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
419900000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
420000000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
420100000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
420200000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4203OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4204mpls,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
846e159a 420500000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
6f068379
BP
420600000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
420700000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
420800000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
420900000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
421000000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
421100000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
421200000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4213OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4214mpls,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
846e159a 421500000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
6f068379
BP
421600000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
421700000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
421800000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
421900000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
422000000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
422100000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
422200000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4223])
4224
4225dnl Modified MPLS controller action.
f0fb825a
EG
4226dnl In this test, the input packet is vlan-tagged, which should be kept as
4227dnl inner vlan.
9a403b07 4228AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4229
4230for 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))'
4232done
62022172 4233OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4234OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4235
38b0b29f 4236AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4237OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4238mpls,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
846e159a 423900000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
6f068379
BP
424000000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
424100000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
424200000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
424300000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
424400000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
424500000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
424600000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
424700000080 3e 3f
4248OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4249mpls,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
846e159a 425000000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
6f068379
BP
425100000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
425200000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
425300000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
425400000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
425500000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
425600000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
425700000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
425800000080 3e 3f
4259OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4260mpls,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
846e159a 426100000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
6f068379
BP
426200000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
426300000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
426400000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
426500000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
426600000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
426700000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
426800000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
426900000080 3e 3f
846e159a
SH
4270])
4271
4272dnl Modified MPLS controller action.
4273dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
4274dnl actions are reordered, so we see both of these in the final flow.
9a403b07 4275AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4276
4277for 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)'
4279done
62022172 4280OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4281OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4282
38b0b29f 4283AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4284OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4285mpls,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
846e159a 428600000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
6f068379
BP
428700000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
428800000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
428900000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
429000000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
429100000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
429200000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
429300000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4294OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4295mpls,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
846e159a 429600000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
6f068379
BP
429700000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
429800000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
429900000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
430000000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
430100000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
430200000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
430300000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4304OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4305mpls,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
846e159a 430600000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
6f068379
BP
430700000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
430800000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
430900000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
431000000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
431100000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
431200000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
431300000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4314])
4315
4316dnl Modified MPLS controller action.
f0fb825a
EG
4317dnl In this test, the input packet is vlan-tagged, which should be kept as
4318dnl inner vlan.
9a403b07 4319AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4320
4321for 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))'
4323done
62022172 4324OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
28ae2f37 4325OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 4326
38b0b29f 4327AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4328OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4329mpls,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
846e159a 433000000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
6f068379
BP
433100000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
433200000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
433300000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
433400000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
433500000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
433600000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
433700000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
433800000080 3e 3f
4339OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4340mpls,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
846e159a 434100000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
6f068379
BP
434200000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
434300000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
434400000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
434500000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
434600000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
434700000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
434800000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
434900000080 3e 3f
4350OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4351mpls,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
846e159a 435200000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
6f068379
BP
435300000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
435400000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
435500000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
435600000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
435700000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
435800000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
435900000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
436000000080 3e 3f
846e159a
SH
4361])
4362
4363dnl Modified MPLS controller action.
4364dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
4365dnl actions are reordered, so we see both of these in the final flow.
9a403b07 4366AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4367
4368for 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)'
4370done
62022172 4371OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4372OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4373
38b0b29f 4374AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4375OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4376mpls,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
846e159a 437700000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
6f068379
BP
437800000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
437900000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
438000000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
438100000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
438200000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
438300000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
438400000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4385OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4386mpls,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
846e159a 438700000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
6f068379
BP
438800000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
438900000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
439000000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
439100000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
439200000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
439300000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
439400000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4395OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4396mpls,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
846e159a 439700000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
6f068379
BP
439800000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
439900000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
440000000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
440100000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
440200000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
440300000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
440400000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4405])
4406
4407dnl Modified MPLS controller action.
f0fb825a
EG
4408dnl In this test, the input packet is vlan-tagged, which should be kept as
4409dnl inner vlan.
9a403b07 4410AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4411
4412for 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))'
4414done
62022172 4415OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4416OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4417
38b0b29f 4418AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4419OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4420mpls,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
846e159a 442100000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
6f068379
BP
442200000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
442300000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
442400000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
442500000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
442600000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
442700000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
442800000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
442900000080 3e 3f
4430OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4431mpls,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
846e159a 443200000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
6f068379
BP
443300000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
443400000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
443500000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
443600000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
443700000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
443800000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
443900000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
444000000080 3e 3f
4441OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4442mpls,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
846e159a 444300000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
6f068379
BP
444400000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
444500000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
444600000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
444700000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
444800000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
444900000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
445000000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
445100000080 3e 3f
846e159a
SH
4452])
4453
4454dnl Modified MPLS controller action.
f0fb825a
EG
4455dnl In this test, the input packet is vlan-tagged, which should be kept as
4456dnl inner vlan.
9a403b07 4457AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4458
4459for 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))'
4461done
62022172 4462OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4463OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4464
38b0b29f 4465AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4466OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4467mpls,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
846e159a 446800000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
6f068379
BP
446900000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
447000000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
447100000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
447200000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
447300000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
447400000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
447500000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4476OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4477mpls,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
846e159a 447800000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
6f068379
BP
447900000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
448000000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
448100000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
448200000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
448300000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
448400000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
448500000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4486OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4487mpls,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
846e159a 448800000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
6f068379
BP
448900000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
449000000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
449100000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
449200000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
449300000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
449400000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
449500000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4496])
4497
4498dnl Modified MPLS controller action.
4dc94d7e 4499dnl In this test, the input packet is vlan-tagged, which should be modified
846e159a 4500dnl before we push MPLS and VLAN tags.
9a403b07 4501AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4502
4503for 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))'
4505done
62022172 4506OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
d9c8c57c 4507OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 4508
38b0b29f 4509AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4510OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4511mpls,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
846e159a 451200000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
6f068379
BP
451300000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
451400000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
451500000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
451600000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
451700000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
451800000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
451900000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4520OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4521mpls,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
846e159a 452200000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
6f068379
BP
452300000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
452400000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
452500000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
452600000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
452700000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
452800000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
452900000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4530OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4531mpls,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
846e159a 453200000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
6f068379
BP
453300000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
453400000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
453500000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
453600000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
453700000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
453800000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
453900000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4540])
4541
cea4a6d7 4542AT_CHECK([ovs-appctl revalidator/purge], [0])
846e159a 4543AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379
BP
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
846e159a
SH
4554OFPST_FLOW reply (OF1.2):
4555])
4556
4557OVS_VSWITCHD_STOP
4558AT_CLEANUP
4559
b8778a0d 4560AT_SETUP([ofproto-dpif - fragment handling - trace])
023e1e0a 4561OVS_VSWITCHD_START
ca5792f0 4562add_of_ports br0 1 2 3 4 5 6 90
7257b535 4563AT_DATA([flows.txt], [dnl
586ebdec
BP
4564priority=75 tcp nw_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
4565priority=75 tcp nw_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
4566priority=50 tcp nw_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
4567priority=50 tcp nw_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
4568priority=50 tcp nw_frag=later actions=output:6
7257b535
BP
4569])
4570AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4571
a61680c6 4572base_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"
7257b535
BP
4573no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4574first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4575later_flow="$base_flow,frag=later)"
4576
4577 # mode no first later
4578for tuple in \
4579 'normal 1 5 6' \
4580 'drop 1 drop drop' \
4581 'nx-match 1 2 6'
4582do
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
7fd51d39 4592 printf "\n%s\n" "----$mode $type-----"
50aa28fd 4593 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
7fd51d39
BP
4594 : > expout
4595 if test $mode = drop && test $type != no; then
2d9b49dd 4596 echo ' 0. Packets are IP fragments and the fragment handling mode is "drop".' >> expout
12e4681c 4597 echo "Datapath actions: $exp_output" >> expout
b8778a0d 4598 elif test $type = later; then
12e4681c
JR
4599 echo "Datapath actions: $exp_output" >> expout
4600 else
dbf4a928 4601 echo "Datapath actions: set(tcp(src=80)),$exp_output" >> expout
7fd51d39 4602 fi
7fd51d39 4603 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
7257b535
BP
4604 done
4605done
023e1e0a 4606OVS_VSWITCHD_STOP
7257b535 4607AT_CLEANUP
848e8809 4608
b8778a0d
JR
4609AT_SETUP([ofproto-dpif - fragment handling - upcall])
4610OVS_VSWITCHD_START
ca5792f0 4611add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
4612AT_DATA([flows.txt], [dnl
4613priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
4614priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
4615priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
4616priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
4617priority=50 tcp ip_frag=later actions=output:6
4618])
4619AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4620
4621base_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"
4622no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4623first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4624later_flow="$base_flow,frag=later)"
4625
4626AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4627
4628mode=normal
4629
4630AT_CHECK([ovs-ofctl set-frags br0 $mode])
4631for 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])
4636done
4637
4638AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
138d30a9 4639flow-dump from the main thread:
3d4b2e6e
JS
4640recirc_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
4641recirc_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
4642recirc_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
b8778a0d
JR
4643])
4644
4645mode=drop
4646
98bb4286 4647AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4648AT_CHECK([ovs-ofctl set-frags br0 $mode])
4649for 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])
4654done
4655
4656AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
138d30a9 4657flow-dump from the main thread:
3d4b2e6e
JS
4658recirc_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
4659recirc_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
4660recirc_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
b8778a0d
JR
4661])
4662
4663mode=nx-match
4664
98bb4286 4665AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4666AT_CHECK([ovs-ofctl set-frags br0 $mode])
4667for 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])
4672done
4673
4674AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
138d30a9 4675flow-dump from the main thread:
3d4b2e6e
JS
4676recirc_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
4677recirc_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
4678recirc_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
b8778a0d
JR
4679])
4680
4681OVS_VSWITCHD_STOP
4682AT_CLEANUP
4683
4684AT_SETUP([ofproto-dpif - fragment handling - actions])
4685OVS_VSWITCHD_START
ca5792f0 4686add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
4687
4688AT_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])
4689AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4690source field tcp_dst lacks correct prerequisites
4691ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4692])
4693
4694AT_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])
4695AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4696destination field tcp_src lacks correct prerequisites
4697ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4698])
4699
4700AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
4701AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4702set_field udp_src lacks correct prerequisites
b8778a0d
JR
4703ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4704])
4705
4706AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
4707AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4708set_field udp_dst lacks correct prerequisites
b8778a0d
JR
4709ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4710])
4711
4712AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
4713AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4714set_field sctp_src lacks correct prerequisites
b8778a0d
JR
4715ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4716])
4717
4718AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
4719AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4720set_field sctp_dst lacks correct prerequisites
b8778a0d
JR
4721ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4722])
4723
4724AT_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])
4725AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4726source field tcp_dst lacks correct prerequisites
4727ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4728])
4729
4730AT_DATA([flows.txt], [dnl
4731priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
4732])
4733AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
4734
4735AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4736
4737mode=normal
4738
4739AT_CHECK([ovs-ofctl set-frags br0 $mode])
4740for 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"])
4744done
4745
4d182934
JS
4746dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
4747dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
4748dnl OVS-2.5, the wildcards and set_field mask are shared internally.
b8778a0d 4749AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 4750flow-dump from the main thread:
3d4b2e6e
JS
4751recirc_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
4752recirc_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
4753recirc_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
b8778a0d
JR
4754])
4755
98bb4286 4756AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4757AT_CHECK([ovs-ofctl set-frags br0 $mode])
4758for 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"])
4762done
4763
4764AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 4765flow-dump from the main thread:
3d4b2e6e
JS
4766recirc_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
4767recirc_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
4768recirc_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
b8778a0d
JR
4769])
4770
98bb4286 4771AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4772AT_CHECK([ovs-ofctl set-frags br0 $mode])
4773for 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"])
4777done
4778
4779AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 4780flow-dump from the main thread:
3d4b2e6e
JS
4781recirc_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
4782recirc_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
4783recirc_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
b8778a0d
JR
4784])
4785
4786OVS_VSWITCHD_STOP
4787AT_CLEANUP
4788
848e8809
EJ
4789AT_SETUP([ofproto-dpif - exit])
4790OVS_VSWITCHD_START
ca5792f0 4791add_of_ports br0 1 2 3 10 11 12 13 14
848e8809
EJ
4792AT_DATA([flows.txt], [dnl
4793in_port=1 actions=output:10,exit,output:11
4794in_port=2 actions=output:12,resubmit:1,output:12
4795in_port=3 actions=output:13,resubmit:2,output:14
4796])
4797AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 4798AT_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])
848e8809
EJ
4799AT_CHECK([tail -1 stdout], [0],
4800 [Datapath actions: 10
4801])
50aa28fd 4802AT_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])
848e8809
EJ
4803AT_CHECK([tail -1 stdout], [0],
4804 [Datapath actions: 12,10
4805])
50aa28fd 4806AT_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])
848e8809
EJ
4807AT_CHECK([tail -1 stdout], [0],
4808 [Datapath actions: 13,12,10
4809])
4810OVS_VSWITCHD_STOP
4811AT_CLEANUP
c06bba01
JP
4812
4813
4814AT_SETUP([ofproto-dpif - mirroring, select_all])
2d5c1a20 4815AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4816OVS_VSWITCHD_START
ca5792f0 4817add_of_ports br0 1 2 3
432fca23 4818ovs-vsctl \
c06bba01
JP
4819 set Bridge br0 mirrors=@m --\
4820 --id=@p3 get Port p3 --\
432fca23 4821 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 4822
c06bba01
JP
4823AT_DATA([flows.txt], [dnl
4824in_port=1 actions=output:2
4825in_port=2 actions=output:1
4826])
4827AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4828
247527db 4829flow="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)"
50aa28fd 4830AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4831AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4832 [Datapath actions: 3,2
c06bba01
JP
4833])
4834
247527db 4835flow="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)"
50aa28fd 4836AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4837AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4838 [Datapath actions: 3,1
c06bba01
JP
4839])
4840
4841OVS_VSWITCHD_STOP
4842AT_CLEANUP
4843
4844
4845AT_SETUP([ofproto-dpif - mirroring, select_src])
2d5c1a20 4846AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4847OVS_VSWITCHD_START
ca5792f0 4848add_of_ports br0 1 2 3
432fca23 4849ovs-vsctl \
c06bba01
JP
4850 set Bridge br0 mirrors=@m --\
4851 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
432fca23 4852 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
c06bba01 4853
c06bba01
JP
4854AT_DATA([flows.txt], [dnl
4855in_port=1 actions=output:2
4856in_port=2 actions=output:1
4857])
4858AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4859
247527db 4860flow="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)"
50aa28fd 4861AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4862AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4863 [Datapath actions: 3,2
c06bba01
JP
4864])
4865
247527db 4866flow="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)"
50aa28fd 4867AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4868AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4869 [Datapath actions: 1
c06bba01
JP
4870])
4871OVS_VSWITCHD_STOP
4872AT_CLEANUP
4873
33158a18 4874AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
2d5c1a20 4875AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4876OVS_VSWITCHD_START
ca5792f0 4877add_of_ports br0 1 2
432fca23 4878ovs-vsctl \
33158a18
JP
4879 set Bridge br0 mirrors=@m --\
4880 --id=@p2 get Port p2 --\
432fca23 4881 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
33158a18 4882
33158a18
JP
4883AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4884
4885# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 4886flow="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"
33158a18
JP
4887AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4888AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4889 [Datapath actions: 1,2
33158a18
JP
4890])
4891
4892OVS_VSWITCHD_STOP
4893AT_CLEANUP
4894
c06bba01
JP
4895
4896AT_SETUP([ofproto-dpif - mirroring, select_dst])
2d5c1a20 4897AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4898OVS_VSWITCHD_START
ca5792f0 4899add_of_ports br0 1 2 3
432fca23 4900ovs-vsctl \
c06bba01
JP
4901 set Bridge br0 mirrors=@m --\
4902 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4903 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
c06bba01 4904
c06bba01
JP
4905AT_DATA([flows.txt], [dnl
4906in_port=1 actions=output:2
4907in_port=2 actions=output:1
4908])
4909AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4910
247527db 4911flow="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)"
50aa28fd 4912AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4913AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4914 [Datapath actions: 2,3
c06bba01
JP
4915])
4916
247527db 4917flow="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)"
50aa28fd 4918AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4919AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4920 [Datapath actions: 1
c06bba01
JP
4921])
4922
4923OVS_VSWITCHD_STOP
4924AT_CLEANUP
4925
4926
4927AT_SETUP([ofproto-dpif - mirroring, select_vlan])
2d5c1a20 4928AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4929OVS_VSWITCHD_START
ca5792f0 4930add_of_ports br0 1 2 3
432fca23 4931ovs-vsctl \
c06bba01
JP
4932 set Bridge br0 mirrors=@m --\
4933 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4934 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
c06bba01 4935
c06bba01
JP
4936AT_DATA([flows.txt], [dnl
4937in_port=1, actions=output:2
4938])
4939AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4940
247527db 4941flow="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)"
50aa28fd 4942AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4943AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4944 [Datapath actions: 2
c06bba01
JP
4945])
4946
247527db 4947flow="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))"
50aa28fd 4948AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4949AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4950 [Datapath actions: 2
c06bba01
JP
4951])
4952
247527db 4953flow="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))"
50aa28fd 4954AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4955AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4956 [Datapath actions: 3,2
c06bba01
JP
4957])
4958
4959OVS_VSWITCHD_STOP
4960AT_CLEANUP
4961
4962
4963AT_SETUP([ofproto-dpif - mirroring, output_port])
2d5c1a20 4964AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4965OVS_VSWITCHD_START
ca5792f0 4966add_of_ports br0 1 2 3
432fca23 4967ovs-vsctl \
c06bba01
JP
4968 set Bridge br0 mirrors=@m --\
4969 --id=@p3 get Port p3 --\
432fca23 4970 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 4971
c06bba01
JP
4972AT_DATA([flows.txt], [dnl
4973in_port=1 actions=mod_vlan_vid:17,output:2
4974in_port=2 actions=output:1
4975])
4976AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4977
247527db 4978flow="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)"
50aa28fd 4979AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4980AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4981 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
c06bba01
JP
4982])
4983
247527db 4984flow="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)"
50aa28fd 4985AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4986AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4987 [Datapath actions: 3,1
c06bba01
JP
4988])
4989
4990OVS_VSWITCHD_STOP
4991AT_CLEANUP
4992
c06bba01 4993AT_SETUP([ofproto-dpif - mirroring, output_vlan])
2d5c1a20 4994AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4995OVS_VSWITCHD_START
ca5792f0 4996add_of_ports br0 1 2
432fca23 4997ovs-vsctl \
c06bba01 4998 set Bridge br0 mirrors=@m --\
432fca23 4999 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
c06bba01 5000
c06bba01
JP
5001AT_DATA([flows.txt], [dnl
5002in_port=1 actions=output:2
5003in_port=2 actions=mod_vlan_vid:17,output:1
5004])
5005AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5006
247527db 5007flow="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)"
50aa28fd 5008AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
5009actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5010
e44768b7 5011expected="2,push_vlan(vid=12,pcp=0),1,2,100"
247527db 5012AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 5013mv stdout expout
247527db 5014AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01 5015
247527db 5016flow="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)"
50aa28fd 5017AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
5018actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5019
e44768b7 5020expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
247527db 5021AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 5022mv stdout expout
247527db 5023AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01
JP
5024
5025OVS_VSWITCHD_STOP
5026AT_CLEANUP
b44a10b7 5027
faa624b4
BP
5028# This verifies that we don't get duplicate mirroring when mirror_packet()
5029# might be invoked recursively, as a check against regression.
5030AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
2d5c1a20 5031AT_KEYWORDS([mirror mirrors mirroring])
faa624b4
BP
5032OVS_VSWITCHD_START
5033add_of_ports br0 1 2 3
5034ovs-vsctl \
5035 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
5a0e4aec
BP
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
faa624b4
BP
5042
5043flow='in_port=1'
5044AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
5045AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
5046s/,/\
5047/g' | sort], [0], [100
50482
50493
5050])
5051
5052OVS_VSWITCHD_STOP
5053AT_CLEANUP
5054
29bae541
BP
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.
5059AT_SETUP([ofproto-dpif - mirroring with recirculation])
2d5c1a20 5060AT_KEYWORDS([mirror mirrors mirroring])
29bae541 5061OVS_VSWITCHD_START
ca5792f0 5062add_of_ports br0 1 2 3 4
29bae541
BP
5063ovs-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
5068AT_DATA([flows.txt], [dnl
5069in_port=1 actions=2,debug_recirc,4
5070])
5071AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5072
5073flow="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)"
5074AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5075AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
5076])
5077AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5078AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
5079])
5080
5081OVS_VSWITCHD_STOP
5082AT_CLEANUP
5083
1356dbd1
WT
5084# Tests below verify the snaplen support for mirroring
5085AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen])
5086AT_KEYWORDS([mirror mirrors mirroring])
5087OVS_VSWITCHD_START
5088add_of_ports br0 1 2 3
5089ovs-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
5094AT_DATA([flows.txt], [dnl
5095in_port=1 actions=output:2
5096in_port=2 actions=output:1
5097])
5098AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5099
5100flow="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)"
5101AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5102AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5103 [Datapath actions: trunc(100),3,2
5104])
5105
5106flow="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)"
5107AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5108AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5109 [Datapath actions: trunc(100),3,1
5110])
5111
5112OVS_VSWITCHD_STOP
5113AT_CLEANUP
5114
091d64c4
ZG
5115AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen and reset snaplen])
5116AT_KEYWORDS([mirror mirrors mirroring])
5117OVS_VSWITCHD_START
5118add_of_ports br0 1 2 3
5119ovs-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
5124AT_DATA([flows.txt], [dnl
5125in_port=1 actions=output:2
5126in_port=2 actions=output:1
5127])
5128AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5129
5130flow="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)"
5131AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5132AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5133 [Datapath actions: trunc(100),3,2
5134])
5135
5136ovs-vsctl set mirror mymirror snaplen=77
5137
5138flow="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)"
5139AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5140AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5141 [Datapath actions: trunc(77),3,1
5142])
5143
5144ovs-vsctl set mirror mymirror snaplen=65535
5145
5146flow="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)"
5147AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5148AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5149 [Datapath actions: 3,1
5150])
5151
5152OVS_VSWITCHD_STOP
5153AT_CLEANUP
5154
1356dbd1
WT
5155AT_SETUP([ofproto-dpif - mirroring, select_src with snaplen])
5156AT_KEYWORDS([mirror mirrors mirroring])
5157OVS_VSWITCHD_START
5158add_of_ports br0 1 2 3
5159ovs-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
5164AT_DATA([flows.txt], [dnl
5165in_port=1 actions=output:2
5166in_port=2 actions=output:1
5167])
5168AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5169
5170flow="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)"
5171AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5172AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5173 [Datapath actions: trunc(100),3,2
5174])
5175
5176flow="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)"
5177AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5178AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5179 [Datapath actions: 1
5180])
5181OVS_VSWITCHD_STOP
5182AT_CLEANUP
5183
5184AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port with snaplen])
5185AT_KEYWORDS([mirror mirrors mirroring])
5186OVS_VSWITCHD_START
5187add_of_ports br0 1 2
5188ovs-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
5193AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
5194
5195# "in_port" defaults to OFPP_NONE if it's not specified.
5196flow="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"
5197AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
5198AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5199 [Datapath actions: 1,trunc(100),2
5200])
5201
5202OVS_VSWITCHD_STOP
5203AT_CLEANUP
5204
5205AT_SETUP([ofproto-dpif - mirroring, select_dst with snaplen])
5206AT_KEYWORDS([mirror mirrors mirroring])
5207OVS_VSWITCHD_START
5208add_of_ports br0 1 2 3
5209ovs-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
5214AT_DATA([flows.txt], [dnl
5215in_port=1 actions=output:2
5216in_port=2 actions=output:1
5217])
5218AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5219
5220flow="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)"
5221AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5222AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5223 [Datapath actions: 2,trunc(100),3
5224])
5225
5226flow="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)"
5227AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5228AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5229 [Datapath actions: 1
5230])
5231
5232OVS_VSWITCHD_STOP
5233AT_CLEANUP
5234
5235AT_SETUP([ofproto-dpif - mirroring, select_vlan with snaplen])
5236AT_KEYWORDS([mirror mirrors mirroring])
5237OVS_VSWITCHD_START
5238add_of_ports br0 1 2 3
5239ovs-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
5244AT_DATA([flows.txt], [dnl
5245in_port=1, actions=output:2
5246])
5247AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5248
5249flow="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)"
5250AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5251AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5252 [Datapath actions: 2
5253])
5254
5255flow="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))"
5256AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5257AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5258 [Datapath actions: 2
5259])
5260
5261flow="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))"
5262AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5263AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5264 [Datapath actions: trunc(100),3,2
5265])
5266
5267OVS_VSWITCHD_STOP
5268AT_CLEANUP
5269
5270AT_SETUP([ofproto-dpif - mirroring, output_port with snaplen])
5271AT_KEYWORDS([mirror mirrors mirroring])
5272OVS_VSWITCHD_START
5273add_of_ports br0 1 2 3
5274ovs-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
5279AT_DATA([flows.txt], [dnl
5280in_port=1 actions=mod_vlan_vid:17,output:2
5281in_port=2 actions=output:1
5282])
5283AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5284
5285flow="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)"
5286AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5287AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5288 [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2
5289])
5290
5291flow="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)"
5292AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5293AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5294 [Datapath actions: trunc(100),3,1
5295])
5296
5297OVS_VSWITCHD_STOP
5298AT_CLEANUP
5299
5300AT_SETUP([ofproto-dpif - mirroring, output_vlan with snaplen])
5301AT_KEYWORDS([mirror mirrors mirroring])
5302OVS_VSWITCHD_START
5303add_of_ports br0 1 2
5304ovs-vsctl \
5305 set Bridge br0 mirrors=@m --\
5306 --id=@m create Mirror name=mymirror select_all=true output_vlan=12 snaplen=100
5307
5308AT_DATA([flows.txt], [dnl
5309in_port=1 actions=output:2
5310in_port=2 actions=mod_vlan_vid:17,output:1
5311])
5312AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5313
5314flow="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)"
5315AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5316actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5317dnl Expect: "trunc(100),100,trunc(100),2,trunc(100),1", with different order
5318AT_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
5320flow="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)"
5321AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5322actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5323AT_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
5325OVS_VSWITCHD_STOP
5326AT_CLEANUP
5327
5328AT_SETUP([ofproto-dpif - multiple VLAN output mirrors with snaplen])
5329AT_KEYWORDS([mirror mirrors mirroring])
5330OVS_VSWITCHD_START
5331add_of_ports br0 1 2 3
5332ovs-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
5341flow="in_port=1"
5342AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
5343AT_CHECK([tail -1 stdout | egrep "trunc\(200\),2,trunc\(300\),3,100|trunc\(300\),3,trunc\(200\),2,100"], [0], [stdout])
5344
5345OVS_VSWITCHD_STOP
5346AT_CLEANUP
5347
83a31283
BP
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).
5351AT_SETUP([ofproto-dpif - resubmit with recirculation])
5352OVS_VSWITCHD_START
ca5792f0 5353add_of_ports br0 1 2 3
83a31283
BP
5354
5355AT_DATA([flows.txt], [dnl
5356table=0 in_port=1 actions=2,resubmit(,1)
5357table=1 in_port=1 actions=debug_recirc,resubmit:55
5358table=1 in_port=55 actions=3
5359])
5360AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5361
5362flow="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)"
5363AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5364AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
5365])
5366AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5367AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
5368])
5369
5370OVS_VSWITCHD_STOP
5371AT_CLEANUP
5372
8014f465
JP
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.
5378AT_SETUP([ofproto-dpif - resubmit with tun_id])
5379OVS_VSWITCHD_START
5380add_of_ports br0 1 2 3
5381
5382AT_DATA([flows.txt], [dnl
5383table=0 in_port=1 actions=2,load:6->NXM_NX_TUN_ID[[]],resubmit(,1)
5384table=1 in_port=1 actions=debug_recirc,resubmit:55
5385table=1 in_port=55 actions=3
5386])
5387AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5388
5389flow="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)"
5390AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5391AT_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
5394AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
e3981271 5395AT_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
8014f465
JP
5396])
5397
5398OVS_VSWITCHD_STOP
5399AT_CLEANUP
5400
5401
6b1c5734
BP
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.
5405AT_SETUP([ofproto-dpif - recirculation after resubmit])
5406OVS_VSWITCHD_START
ca5792f0 5407add_of_ports br0 1 2
6b1c5734
BP
5408
5409AT_DATA([flows.txt], [dnl
5410table=0 in_port=1 actions=resubmit(,1),2
5411table=1 in_port=1 actions=debug_recirc
5412])
5413AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5414
5415flow="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)"
5416AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5417AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
5418])
5419AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5420AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
5421])
5422
5423OVS_VSWITCHD_STOP
5424AT_CLEANUP
5425
323ae1e8
BP
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).
5429AT_SETUP([ofproto-dpif - packet-out recirculation])
5430OVS_VSWITCHD_START
5431add_of_ports br0 1 2
5432
5433AT_DATA([flows.txt], [dnl
5434table=0 ip actions=mod_dl_dst:83:83:83:83:83:83,ct(table=1)
5435table=1 ip actions=ct(commit),output:2
5436])
5437AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5438
5439packet=ffffffffffff00102030405008004500001c00000000401100000a000002ffffffff0035111100080000
5440AT_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.
5447check_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}
5452OVS_WAIT_UNTIL([check_flows], [ovs dump-flows br0])
5453
5454OVS_VSWITCHD_STOP
5455AT_CLEANUP
a934a3dd
JP
5456
5457AT_SETUP([ofproto-dpif - debug_slow action])
5458OVS_VSWITCHD_START
5459add_of_ports br0 1 2 3
5460
5461AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,2"])
5462
5463flow="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
5465AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5466AT_CHECK_UNQUOTED([tail -3 stdout], [0], [Datapath actions: 2
5467This flow is handled by the userspace slow path because it:
393e9f7c 5468 - Uses action(s) not supported by datapath.
a934a3dd
JP
5469])
5470
5471OVS_VSWITCHD_STOP
5472AT_CLEANUP
5473
5474
77ab5fd2
BP
5475dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
5476dnl
5477dnl Checks the implementation of the continuation mechanism that allows the
5478dnl packet processing pipeline to be paused and resumed. Starts by creating
5479dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
5480dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
5481dnl in the bridge, resuming each time the pipeline pauses, and expects a single
5482dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
5483dnl ACTIONS0 still contains at least one "pause" action, removes one of them
5484dnl and repeats the process.
5485dnl
5486dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
5487dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
5488dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
5489dnl into port 1 on br0, so br1 only comes into action if a patch port (added
5490dnl by EXTRA_SETUP) jumps from one bridge to another.
5491dnl
5492dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
5493dnl both bridges, e.g. to configure mirrors or patch ports.
5494m4_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
70d0cd06
JR
5534 # Make sure the datapath is up-to-date before sending the packet.
5535 ovs-appctl revalidator/wait
5536
77ab5fd2
BP
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.)
5584CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
5585
5586# Check that remaining actions are preserved following resume.
5587CHECK_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.
5595CHECK_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.
5603CHECK_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.
5609CHECK_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.
5627CHECK_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.
5638CHECK_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
2f355bff
YHW
5650AT_SETUP([ofproto-dpif - continuation flow stats])
5651AT_KEYWORDS([continuations pause resume])
5652OVS_VSWITCHD_START
5653
5654add_of_ports --pcap br0 `seq 1 2`
5655
5656flow="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
5658AT_DATA([flows.txt], [dnl
5659table=0 in_port=1 actions=set_field:1->reg1 controller(pause) resubmit(,2)
5660table=2 reg1=0x1 actions=2
5661])
5662
5663AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5664
5665AT_CAPTURE_FILE([ofctl_monitor0.log])
5666ovs-ofctl monitor br0 resume --detach --no-chdir \
5667--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5668
5669# Run a packet through the switch.
5670AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5671
5672# Check flow stats
5673AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5674AT_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
420632af 5678# The packet should be received by port 2
1ca0323e 5679AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
07706c50
YHW
5680
5681OVS_VSWITCHD_STOP
5682AT_CLEANUP
5683
5684AT_SETUP([ofproto-dpif - continuation with conntrack])
5685AT_KEYWORDS([continuations pause resume])
5686OVS_VSWITCHD_START
5687
5688add_of_ports --pcap br0 `seq 1 2`
5689
5690flow="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
5692AT_DATA([flows.txt], [dnl
5693table=0, in_port=1 icmp action=ct(table=1)
5694table=1, icmp action=controller(pause) resubmit(,2)
5695table=2, in_port=1 icmp ct_state=+trk+new action=output:2
5696])
5697
5698AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5699
5700AT_CAPTURE_FILE([ofctl_monitor0.log])
5701ovs-ofctl monitor br0 resume --detach --no-chdir \
5702--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5703
5704# Run a packet through the switch.
5705AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5706
5707# Check flow stats
5708AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5709AT_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
1ca0323e 5714AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
2f355bff
YHW
5715
5716OVS_VSWITCHD_STOP
5717AT_CLEANUP
0d3239e8 5718
88d2ac50
YHW
5719AT_SETUP([ofproto-dpif - continuation with patch port])
5720AT_KEYWORDS([continuations pause resume])
5721OVS_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])
5728add_of_ports --pcap br1 1
5729
5730flow="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
5732AT_DATA([flows.txt], [dnl
5733table=0, in_port=patch+ icmp action=controller(pause), resubmit(,1)
5734table=1, in_port=patch+ icmp action=ct(table=2)
5735table=2, in_port=patch+ icmp ct_state=+trk+new action=ct(commit, table=3)
5736table=3, in_port=patch+ icmp action=p1
5737])
5738
5739AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5740AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br1 flows.txt])
5741
5742AT_CAPTURE_FILE([ofctl_monitor.log])
5743ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl.pid 2> ofctl_monitor.log
5744
5745# Run a packet through the switch.
5746AT_CHECK([ovs-appctl netdev-dummy/receive p0 "$flow"], [0], [stdout])
5747
5748# Check flow stats
5749AT_CHECK([ovs-ofctl dump-flows br1], [0], [stdout])
5750AT_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
1ca0323e 5755AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p1-tx.pcap | wc -l`])
88d2ac50
YHW
5756
5757OVS_VSWITCHD_STOP
5758AT_CLEANUP
5759
0d3239e8
NS
5760# Check that pause works after the packet is cloned.
5761AT_SETUP([ofproto-dpif - continuation after clone])
5762AT_KEYWORDS([continuations clone pause resume])
5763OVS_VSWITCHD_START
5764
5765add_of_ports --pcap br0 `seq 1 3`
5766
5767flow="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
5769AT_DATA([flows.txt], [dnl
5770table=0 in_port=1 actions=set_field:1->reg1 resubmit(,2)
5771table=1 reg1=0x5 actions=controller(pause) resubmit(,3)
5772table=1 reg1=0x1 actions=2
5773table=2 in_port=1 actions=clone(set_field:5->reg1, resubmit(,1))
5774table=3 reg1=0x1 actions=3
5775table=3 reg1=0x5 actions=2
5776])
5777
5778AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5779
5780AT_CAPTURE_FILE([ofctl_monitor0.log])
5781ovs-ofctl monitor br0 resume --detach --no-chdir \
5782--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5783
5784# Run a packet through the switch.
5785AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5786
5787ovs-vsctl show
5788ovs-ofctl dump-flows br0
5789
420632af 5790# The packet should be received by port 2 and not port 3
1ca0323e
BP
5791AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5792AT_CHECK([test 0 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p3-tx.pcap | wc -l`])
0d3239e8
NS
5793
5794# NXT_RESUMEs should be 1 and reg1 should be set to 0x5.
5795OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor*.log | grep NXT_RESUME | grep -c reg1=0x5`])
5796
5797OVS_VSWITCHD_STOP
5798AT_CLEANUP
5799
22bb3cbc
AW
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]
5804AT_SETUP([ofproto-dpif - ofproto/trace command 1])
5805OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 5806add_of_ports br0 1 2 3
22bb3cbc
AW
5807
5808AT_DATA([flows.txt], [dnl
5809in_port=1 actions=output:2
5810in_port=2 actions=output:1
5811])
5812AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5813
e063a73a 5814odp_flow="in_port(p1)"
22bb3cbc 5815br_flow="in_port=1"
0a37839c
GS
5816# Test command: ofproto/trace odp_flow with in_port as a name.
5817AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5818AT_CHECK([tail -1 stdout], [0], [dnl
5819Datapath actions: 2
5820])
5821
5822odp_flow="in_port(1)"
22bb3cbc
AW
5823# Test command: ofproto/trace odp_flow
5824AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5825AT_CHECK([tail -1 stdout], [0], [dnl
5826Datapath actions: 2
5827])
5828
5829# Test command: ofproto/trace dp_name odp_flow
5830AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
5831AT_CHECK([tail -1 stdout], [0], [dnl
5832Datapath actions: 2
5833])
5834# Test commmand: ofproto/trace br_name br_flow
5835AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5836AT_CHECK([tail -1 stdout], [0], [dnl
5837Datapath actions: 2
5838])
5839
5840# Delete the inserted flows
5841AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
5842AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
5843
78c9486d 5844# This section below tests the [-generate] option
22bb3cbc 5845odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
78c9486d 5846br_flow="arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=ff:ff:ff:ff:ff:ff"
22bb3cbc
AW
5847
5848# Test command: ofproto/trace odp_flow
5849AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5850# Check for no MAC learning entry
5851AT_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
5856AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5857# Check for no MAC learning entry
5858AT_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
5863AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
5864# Check for the MAC learning entry
5865AT_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
5871AT_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
5875AT_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
5882AT_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.
5886AT_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
5895pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5896pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
5897
5898# Construct the MAC learning table
5899AT_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
5904AT_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
5909AT_CHECK([ovs-appctl ofproto/trace \
5910 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5911AT_CHECK([tail -1 stdout], [0], [dnl
5912Datapath actions: 2
5913])
2d9b49dd 5914AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5915Flow: 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
2d9b49dd
BP
5916
5917bridge("br0")
22bb3cbc
AW
5918])
5919
5920# Test command: ofproto/trace dp_name odp_flow packet
5921AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5922 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5923AT_CHECK([tail -1 stdout], [0], [dnl
5924Datapath actions: 2
5925])
2d9b49dd 5926AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5927Flow: 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
2d9b49dd
BP
5928
5929bridge("br0")
22bb3cbc
AW
5930])
5931
5932# Test command: ofproto/trace br_name br_flow packet
5933AT_CHECK([ovs-appctl ofproto/trace br0 \
1362e248 5934 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
22bb3cbc 5935AT_CHECK([tail -1 stdout], [0], [dnl
ed2e7245 5936Datapath actions: 1
22bb3cbc 5937])
2d9b49dd 5938AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5939Flow: 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
2d9b49dd
BP
5940
5941bridge("br0")
22bb3cbc
AW
5942])
5943
5944OVS_VSWITCHD_STOP
5945AT_CLEANUP
5946
5947# The second test tests the corner cases
5948AT_SETUP([ofproto-dpif - ofproto/trace command 2])
5949OVS_VSWITCHD_START
ca5792f0 5950add_of_ports br0 1 2
22bb3cbc
AW
5951
5952# Define flows
5953odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
5954br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
5955# Define options
5956generate="-generate"
5957pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5958
5959# Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
5960m4_foreach(
5961[option],
5962[[],
5963["$generate"],
5964["$pkt"]],
5965[AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
5966 [2], [], [stderr])
5967AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5968Cannot find the datapath
22bb3cbc
AW
5969ovs-appctl: ovs-vswitchd: server returned an error
5970])])
5971
5972# Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
5973m4_foreach(
5974[option],
5975[[],
5976["$generate"],
5977["$pkt"]],
5978[AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
5979 [2], [], [stderr])
5980AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5981Cannot find the datapath
22bb3cbc
AW
5982ovs-appctl: ovs-vswitchd: server returned an error
5983])])
5984
5985# Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
5986m4_foreach(
5987[option],
5988[[],
5989["$generate"],
5990["$pkt"]],
5991[AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
5992 [2], [], [stderr])
5993AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5994Cannot find the datapath
22bb3cbc
AW
5995ovs-appctl: ovs-vswitchd: server returned an error
5996])])
5997
5998# Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
5999m4_foreach(
6000[option],
6001[[],
6002["$generate"],
6003["$pkt"]],
6004[AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
6005 [2], [], [stderr])
6006AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 6007Cannot find the datapath
22bb3cbc
AW
6008ovs-appctl: ovs-vswitchd: server returned an error
6009])])
6010
6011# Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
6012m4_foreach(
6013[option],
6014[[],
6015["$generate"],
6016["$pkt"]],
6017[AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
6018 [2], [], [stderr])
6019AT_CHECK([tail -2 stderr], [0], [dnl
b490b189 6020ovs-dummy: unknown bridge
22bb3cbc
AW
6021ovs-appctl: ovs-vswitchd: server returned an error
6022])])
6023
6024# Test incorrect command: ofproto/trace br_flow [-generate|packet]
6025m4_foreach(
6026[option],
6027[[],
6028["$generate"],
6029["$pkt"]],
6030[AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
6031 [2], [], [stderr])
6032AT_CHECK([tail -2 stderr], [0], [dnl
d40533fc 6033syntax 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)
22bb3cbc
AW
6034ovs-appctl: ovs-vswitchd: server returned an error
6035])])
6036
6037# Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
6038AT_CHECK([ovs-appctl ofproto/trace \
6039 ovs-dummy "$odp_flow" garbage_option],
6040 [2], [stdout],[stderr])
6041AT_CHECK([tail -2 stderr], [0], [dnl
6042Trailing garbage in packet data
6043ovs-appctl: ovs-vswitchd: server returned an error
6044])
6045
22bb3cbc
AW
6046# Test incorrect command: ofproto/trace with 0 argument
6047AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
6048AT_CHECK([tail -2 stderr], [0], [dnl
6049"ofproto/trace" command requires at least 1 arguments
6050ovs-appctl: ovs-vswitchd: server returned an error
6051])
6052
6053OVS_VSWITCHD_STOP
6054AT_CLEANUP
6055
b6ec827f
JS
6056# The third test checks that the output of "ovs-dpctl -m" is valid to trace.
6057AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
6058OVS_VSWITCHD_START([dnl
6059 set Open_vSwitch . other_config:max-idle=10000 \
6060 -- add-port br0 p1 -- set Interface p1 type=dummy])
6061
6062AT_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)'])
6063ovs-appctl revalidator/wait
6064AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
6065
6066odp_flow=`cat dp_flows1.txt`
6067AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
b6ec827f 6068Flow: <cleared>
b6ec827f 6069
2d9b49dd
BP
6070bridge("br0")
6071-------------
6072 0. No match.
6073 drop
b6ec827f
JS
6074
6075Final flow: <cleared>
6076Megaflow: <cleared>
6077Datapath actions: drop
6078])
6079
6080dnl Now, try again without megaflows:
6081ovs-appctl upcall/disable-megaflows
6082
6083AT_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)'])
6084ovs-appctl revalidator/wait
6085AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
6086
6087odp_flow=`cat dp_flows2.txt`
6088AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
b6ec827f 6089Flow: <cleared>
b6ec827f 6090
2d9b49dd
BP
6091bridge("br0")
6092-------------
6093 0. No match.
6094 drop
b6ec827f
JS
6095
6096Final flow: <cleared>
6097Megaflow: <cleared>
6098Datapath actions: drop
6099])
6100
6101OVS_VSWITCHD_STOP
6102AT_CLEANUP
6103
aee0979b
BP
6104AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
6105OVS_VSWITCHD_START
ca5792f0 6106add_of_ports br0 1 2 3
aee0979b
BP
6107
6108AT_DATA([flows.txt], [dnl
6109in_port=1 actions=output:2
6110in_port=2 actions=output:1
6111])
6112AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6113
6114AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
6115AT_CHECK([tail -1 stdout], [0], [dnl
6116Datapath actions: push_vlan(vid=123,pcp=0),2
6117])
6118
6119OVS_VSWITCHD_STOP
6120AT_CLEANUP
6121
6122
b44a10b7
BP
6123m4_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
6134AT_SETUP([ofproto-dpif - MAC learning])
432fca23 6135OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 6136add_of_ports br0 1 2 3
b44a10b7 6137
b44a10b7
BP
6138arp='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.
6141OFPROTO_TRACE(
50aa28fd 6142 [ovs-dummy],
247527db 6143 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 6144 [-generate],
e44768b7 6145 [1,2,100])
b44a10b7
BP
6146
6147# Check for the MAC learning entry.
83664f72 6148AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 6149 port VLAN MAC Age
247527db 6150 3 0 50:54:00:00:00:05 ?
b44a10b7
BP
6151])
6152
6153# Trace a packet arrival destined for the learned MAC.
6154# (This will also learn a MAC.)
6155OFPROTO_TRACE(
50aa28fd 6156 [ovs-dummy],
247527db 6157 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
b44a10b7 6158 [-generate],
247527db 6159 [3])
b44a10b7
BP
6160
6161# Check for both MAC learning entries.
83664f72 6162AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 6163 port VLAN MAC Age
247527db
BP
6164 3 0 50:54:00:00:00:05 ?
6165 1 0 50:54:00:00:00:06 ?
b44a10b7
BP
6166])
6167
6168# Trace a packet arrival that updates the first learned MAC entry.
6169OFPROTO_TRACE(
50aa28fd 6170 [ovs-dummy],
247527db 6171 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 6172 [-generate],
e44768b7 6173 [1,3,100])
b44a10b7
BP
6174
6175# Check that the MAC learning entry was updated.
83664f72 6176AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 6177 port VLAN MAC Age
247527db
BP
6178 1 0 50:54:00:00:00:06 ?
6179 2 0 50:54:00:00:00:05 ?
b44a10b7
BP
6180])
6181
6182# Add another bridge.
6183AT_CHECK(
6184 [ovs-vsctl \
6185 -- add-br br1 \
ad28062f 6186 -- set bridge br1 datapath-type=dummy])
ca5792f0 6187add_of_ports br1 4 5
b44a10b7
BP
6188
6189# Trace some packet arrivals in br1 to create MAC learning entries there too.
6190OFPROTO_TRACE(
50aa28fd 6191 [ovs-dummy],
247527db 6192 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 6193 [-generate],
e44768b7 6194 [5,101])
b44a10b7 6195OFPROTO_TRACE(
50aa28fd 6196 [ovs-dummy],
247527db 6197 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 6198 [-generate],
e44768b7 6199 [4,101])
b44a10b7
BP
6200
6201# Check that the MAC learning entries were added.
83664f72 6202AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 6203 port VLAN MAC Age
247527db
BP
6204 4 0 50:54:00:00:00:06 ?
6205 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
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.
6210AT_CHECK([ovs-vsctl del-port p1])
83664f72 6211AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 6212 port VLAN MAC Age
247527db 6213 2 0 50:54:00:00:00:05 ?
b44a10b7 6214])
83664f72 6215AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 6216 port VLAN MAC Age
247527db 6217 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
6218])
6219
6220OVS_VSWITCHD_STOP
6221AT_CLEANUP
17f7f7e0 6222
c4069512
BP
6223AT_SETUP([ofproto-dpif - MAC table overflow])
6224OVS_VSWITCHD_START(
ad28062f 6225 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 6226add_of_ports br0 1 2 3
c4069512
BP
6227
6228arp='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
6230AT_CHECK([ovs-appctl time/stop])
6231
6232# Trace 10 ARP packets arriving on p3, to create MAC learning entries.
6233for i in 0 1 2 3 4 5 6 7 8 9; do
6234 OFPROTO_TRACE(
50aa28fd 6235 [ovs-dummy],
c4069512
BP
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
6240done
6241
6242# Check for the MAC learning entries.
6243AT_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.
6259OFPROTO_TRACE(
50aa28fd 6260 [ovs-dummy],
c4069512
BP
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.
6266AT_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])
6280OVS_VSWITCHD_STOP
6281AT_CLEANUP
6282
9d078ec2
BP
6283AT_SETUP([ofproto-dpif - MAC table overflow fairness])
6284OVS_VSWITCHD_START(
6285 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 6286add_of_ports br0 1 2 3 4 5 6
9d078ec2
BP
6287
6288arp='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
6290AT_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.
6294for 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
6298done
6299
6300# Check for the MAC learning entries.
6301AT_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.
6317for 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
6320done
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.)
6332AT_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])
6346OVS_VSWITCHD_STOP
6347AT_CLEANUP
6348
4819b3a5 6349# CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
e731d71b
AS
6350#
6351# Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
e731d71b 6352m4_define([CHECK_SFLOW_SAMPLING_PACKET],
4819b3a5 6353 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
e731d71b
AS
6354 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6355
53eb8cb8 6356 on_exit 'kill `cat test-sflow.pid`'
eadd1644 6357 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
e731d71b 6358 AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6359 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
e731d71b
AS
6360 ovs-appctl time/stop
6361
ca5792f0 6362 add_of_ports br0 1 2
e731d71b
AS
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\" \
9a9808d7 6369 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
e731d71b
AS
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
22ecc560 6392 ovs-appctl time/warp 2000 100
e731d71b 6393 OVS_VSWITCHD_STOP
d9c8c57c 6394 OVS_APP_EXIT_AND_WAIT([test-sflow])
8073dd31 6395
e731d71b 6396 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
b559c8bd 6397 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
8073dd31 6398HEADER
5a0e4aec
BP
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
8073dd31 6418HEADER
5a0e4aec
BP
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
8073dd31 6438HEADER
5a0e4aec
BP
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
8073dd31 6458HEADER
5a0e4aec
BP
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
8073dd31 6478HEADER
5a0e4aec
BP
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
8073dd31
NM
6498])
6499
934386dd 6500 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'ETHCOUNTERS|IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -24 | sed 's/ /\
b559c8bd 6501 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
934386dd 6502ETHCOUNTERS
5a0e4aec
BP
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
934386dd 6516ETHCOUNTERS
5a0e4aec
BP
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
934386dd 6530ETHCOUNTERS
5a0e4aec
BP
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
934386dd 6544ETHCOUNTERS
5a0e4aec
BP
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
934386dd 6558ETHCOUNTERS
5a0e4aec
BP
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
934386dd 6572ETHCOUNTERS
5a0e4aec
BP
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
8073dd31 6586IFCOUNTERS
5a0e4aec
BP
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
c9c8c8a1 6594 status=3
5a0e4aec
BP
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
8073dd31 6609IFCOUNTERS
5a0e4aec
BP
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
c9c8c8a1 6617 status=3
5a0e4aec
BP
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
8073dd31 6632IFCOUNTERS
5a0e4aec
BP
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
c9c8c8a1 6640 status=3
5a0e4aec
BP
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
8073dd31 6655IFCOUNTERS
5a0e4aec
BP
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
c9c8c8a1 6663 status=3
5a0e4aec
BP
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
8073dd31 6678IFCOUNTERS
5a0e4aec
BP
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
c9c8c8a1 6686 status=3
5a0e4aec
BP
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
8073dd31 6701IFCOUNTERS
5a0e4aec
BP
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
c9c8c8a1 6709 status=3
5a0e4aec
BP
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
50b9699f 6724OPENFLOWPORT
5a0e4aec
BP
6725 datapath_id=18364758544493064720
6726 port_no=1
50b9699f 6727OPENFLOWPORT
5a0e4aec
BP
6728 datapath_id=18364758544493064720
6729 port_no=1
50b9699f 6730OPENFLOWPORT
5a0e4aec
BP
6731 datapath_id=18364758544493064720
6732 port_no=2
50b9699f 6733OPENFLOWPORT
5a0e4aec
BP
6734 datapath_id=18364758544493064720
6735 port_no=2
50b9699f 6736OPENFLOWPORT
5a0e4aec
BP
6737 datapath_id=18364758544493064720
6738 port_no=65534
50b9699f 6739OPENFLOWPORT
5a0e4aec
BP
6740 datapath_id=18364758544493064720
6741 port_no=65534
50b9699f 6742PORTNAME
5a0e4aec 6743 portName=br0
50b9699f 6744PORTNAME
5a0e4aec 6745 portName=br0
50b9699f 6746PORTNAME
5a0e4aec 6747 portName=p1
50b9699f 6748PORTNAME
5a0e4aec 6749 portName=p1
50b9699f 6750PORTNAME
5a0e4aec 6751 portName=p2
50b9699f 6752PORTNAME
5a0e4aec 6753 portName=p2
4819b3a5 6754])])
17f7f7e0 6755
aaca4fe0
WT
6756AT_SETUP([ofproto-dpif - basic truncate action])
6757OVS_VSWITCHD_START
6758add_of_ports br0 1 2 3 4 5
6759
6760AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
6761AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
6762AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
6763AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
6764AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
6765
6766AT_DATA([flows.txt], [dnl
6767in_port=3,actions=drop
6768in_port=5,actions=drop
6769in_port=1,actions=output(port=2,max_len=64),output:4
6770])
6771AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6772
6773dnl Datapath actions
6774AT_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])
6775AT_CHECK([tail -1 stdout], [0],
6776[Datapath actions: trunc(64),2,4
6777])
6778
6779dnl An 170 byte packet
6780AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6781
6782AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
6783icmp,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
6786AT_CHECK([ovs-appctl revalidator/purge], [0])
6787dnl packet with truncated size
6788AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6789n_bytes=64
6790])
6791dnl packet with original size
6792AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6793n_bytes=170
6794])
6795
6796dnl More complicated case
6797AT_CHECK([ovs-ofctl del-flows br0])
6798AT_DATA([flows.txt], [dnl
6799in_port=3,actions=drop
6800in_port=5,actions=drop
6801in_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])
6803AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6804
6805dnl Datapath actions
6806AT_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])
6807AT_CHECK([tail -1 stdout], [0],
6808[Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
6809])
6810
6811dnl An 170 byte packet
6812AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6813
6814AT_CHECK([ovs-appctl revalidator/purge], [0])
6815dnl packet size: 64 + 128 + 170 = 362
6816AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6817n_bytes=362
6818])
6819dnl packet size: 60 + 170 = 230
6820AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6821n_bytes=230
6822])
6823
6824dnl syntax checking
6825AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
6826ovs-ofctl: output to unsupported truncate port: ALL
6827])
6828
6829OVS_VSWITCHD_STOP
6830AT_CLEANUP
6831
6832AT_SETUP([ofproto-dpif - truncate and output to patch port])
6833OVS_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
6838add_of_ports br0 2
6839
6840AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
6841AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
6842
6843AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6844[0], [stdout])
6845AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
6846])
6847dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
2d9b49dd 6848AT_CHECK([grep "output_trunc does not support patch port [[0-9]]*" stdout], [0], [stdout])
aaca4fe0
WT
6849
6850OVS_VSWITCHD_STOP
6851AT_CLEANUP
6852
6853AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
6854OVS_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])
6859AT_DATA([flows.txt], [dnl
6860actions=output(max_len=100, port=1)
6861])
6862OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6863AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6864
6865AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
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)
aaca4fe0
WT
6869])
6870
6871dnl Basic
6872AT_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])
6873AT_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
6877OVS_VSWITCHD_STOP
6878AT_CLEANUP
6879
4819b3a5
BP
6880AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
6881CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
6882AT_CLEANUP
6883
6884AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
6885AT_SKIP_IF([test $HAVE_IPV6 = no])
6886CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
6887AT_CLEANUP
1e04fcc8 6888
50b9699f 6889dnl Test sFlow LAG structures
7321bda3 6890AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
80ee73d3 6891AT_SKIP_IF([test "$IS_WIN32" = "yes"])
50b9699f 6892OVS_VSWITCHD_START([dnl
5a0e4aec
BP
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 ])
50b9699f 6906
53eb8cb8 6907on_exit 'kill `cat test-sflow.pid`'
50b9699f
NM
6908AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6909AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6910PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
50b9699f
NM
6911
6912ovs-appctl time/stop
6913
6914ovs-vsctl \
5a0e4aec
BP
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\" \
96657459 6918 header=128 sampling=1 polling=1 agent=127.0.0.1
50b9699f
NM
6919
6920dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
cea4a6d7
JS
6921AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
6922AT_CHECK([ovs-appctl revalidator/purge], [0])
7bb5820b 6923OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
d9c8c57c 6924OVS_APP_EXIT_AND_WAIT([test-sflow])
50b9699f 6925AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
5a0e4aec 6926 /g']], [0], [dnl
50b9699f 6927LACPCOUNTERS
5a0e4aec
BP
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
50b9699f
NM
6943])
6944
6945AT_CLEANUP
6946
7321bda3
NM
6947AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
6948AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6949OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6950
6951dnl set up sFlow logging
7321bda3
NM
6952AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6953AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6954PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
6955ovs-appctl time/stop
6956
6957OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6958AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
5a0e4aec 6959 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
7321bda3
NM
6960AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
6961
6962AT_CHECK([ovs-ofctl add-flow br0 action=3])
6963
6964dnl enable sflow
6965ovs-vsctl \
6966 set Bridge br0 sflow=@sf -- \
96657459 6967 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7321bda3
NM
6968 header=128 sampling=1 polling=0
6969
6970dnl introduce a packet that will be flooded to the tunnel
6971AT_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
6973dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6974for i in `seq 1 30`; do
6975 ovs-appctl time/warp 100
6976done
6977
d9c8c57c 6978OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
6979
6980AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5a0e4aec 6981 /g']], [0], [dnl
7321bda3 6982HEADER
5a0e4aec
BP
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
7321bda3
NM
7011])
7012
7bb5820b 7013OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
7321bda3
NM
7014AT_CLEANUP
7015
7016AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
7017AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
7018
7019OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
7020
7021dnl set up sFlow logging
7321bda3
NM
7022AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
7023AT_CAPTURE_FILE([sflow.log])
fb28ef2d 7024PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
7025ovs-appctl time/stop
7026
7027AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7028AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
7029AT_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\
d14a36f4
BP
7031 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
7032 options:ifindex=2011 ofport_request=5
7321bda3
NM
7033 ], [0])
7034
7035AT_CHECK([ovs-appctl dpif/show], [0], [dnl
7036dummy@ovs-dummy: hit:0 missed:0
7be29a47
BP
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)
7321bda3
NM
7044])
7045
7046dnl set up route to 1.1.2.92 via br0 and action=normal
7321bda3
NM
7047AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
7048])
a8704b50
PS
7049AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
7050])
7321bda3
NM
7051AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7052
7053dnl Prime ARP Cache for 1.1.2.92
283d8662 7054AT_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)'])
7321bda3
NM
7055
7056dnl configure sflow on int-br only
7057ovs-vsctl \
7058 set Bridge int-br sflow=@sf -- \
96657459 7059 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7321bda3
NM
7060 header=128 sampling=1 polling=0
7061
a8704b50
PS
7062dnl set up route to 192.168.1.2 via br0
7063AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
7064])
7065AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
7066])
7067
7321bda3
NM
7068dnl add rule for int-br to force packet onto tunnel. There is no ifindex
7069dnl for this port so the sFlow output will just report that it went to
7070dnl 1 output (out_format=2, out_ifindex=1)
7071AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
7072
7073AT_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
7075dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
7076for i in `seq 1 30`; do
7077 ovs-appctl time/warp 100
7078done
7079
d9c8c57c 7080OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
7081
7082AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5a0e4aec 7083 /g']], [0], [dnl
7321bda3 7084HEADER
5a0e4aec
BP
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
7321bda3
NM
7113])
7114
7bb5820b 7115OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
7321bda3
NM
7116AT_CLEANUP
7117
7118AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
7ad705c6 7119AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
7321bda3
NM
7120OVS_VSWITCHD_START
7121AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7122add_of_ports br0 1 2
7321bda3
NM
7123AT_DATA([flows.txt], [dnl
7124table=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
7125table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
7126])
7127AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7128
7129dnl set up sFlow logging
7321bda3
NM
7130AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
7131AT_CAPTURE_FILE([sflow.log])
fb28ef2d 7132PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
7133ovs-appctl time/stop
7134
7135dnl configure sflow
7136ovs-vsctl \
7137 set Bridge br0 sflow=@sf -- \
96657459 7138 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7321bda3
NM
7139 header=128 sampling=1 polling=0
7140
7141AT_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)'])
7142AT_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
7144dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
7145for i in `seq 1 30`; do
7146 ovs-appctl time/warp 100
7147done
7148
d9c8c57c 7149OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
7150
7151AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5a0e4aec 7152 /g']], [0], [dnl
7321bda3 7153HEADER
5a0e4aec
BP
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
7321bda3 7181HEADER
5a0e4aec
BP
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
7321bda3
NM
7205])
7206
7bb5820b 7207OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
7321bda3
NM
7208AT_CLEANUP
7209
7210
4819b3a5 7211# CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
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.
e731d71b 7218m4_define([CHECK_NETFLOW_EXPIRATION],
4819b3a5 7219 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 7220 add_of_ports br0 1 2
e731d71b
AS
7221
7222 ovs-appctl time/stop
53eb8cb8 7223 on_exit 'kill `cat test-netflow.pid`'
eadd1644 7224 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 7225 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 7226 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
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)'
5788e39f 7235 sleep 1 # ensure the order in which these two packets are processed
e731d71b
AS
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
17f7f7e0 7240
e731d71b 7241 ovs-appctl time/warp 6000
27f57736 7242 ovs-appctl revalidator/wait
e731d71b 7243 OVS_VSWITCHD_STOP
d9c8c57c 7244 OVS_APP_EXIT_AND_WAIT([test-netflow])
e79a6c83 7245
6f068379 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])
e79a6c83 7247
6f068379 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])
e79a6c83 7249
6f068379
BP
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`
4819b3a5 7252 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
17f7f7e0 7253
4819b3a5
BP
7254AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
7255CHECK_NETFLOW_EXPIRATION([127.0.0.1])
7256AT_CLEANUP
17f7f7e0 7257
4819b3a5
BP
7258AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
7259AT_SKIP_IF([test $HAVE_IPV6 = no])
7260CHECK_NETFLOW_EXPIRATION([[[::1]]])
7261AT_CLEANUP
1e04fcc8 7262
4819b3a5 7263# CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
7264#
7265# Test that basic NetFlow reports active expirations correctly.
e731d71b 7266m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
4819b3a5 7267 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 7268 add_of_ports br0 1 2
17f7f7e0 7269
53eb8cb8 7270 on_exit 'kill `cat test-netflow.pid`'
eadd1644 7271 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 7272 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 7273 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
17f7f7e0 7274
e731d71b
AS
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
17f7f7e0 7279
e731d71b
AS
7280 AT_CHECK([ovs-appctl time/stop])
7281 n=1
7282 while test $n -le 60; do
7283 n=`expr $n + 1`
17f7f7e0 7284
e731d71b
AS
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)'
17f7f7e0 7287
e731d71b
AS
7288 ovs-appctl time/warp 1000
7289 done
17f7f7e0 7290
e731d71b
AS
7291 ovs-appctl time/warp 10000
7292
27f57736 7293 ovs-appctl revalidator/wait
e731d71b 7294 OVS_VSWITCHD_STOP
d9c8c57c 7295 OVS_APP_EXIT_AND_WAIT([test-netflow])
e731d71b
AS
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
4819b3a5 7336])])
e731d71b 7337
4819b3a5
BP
7338AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
7339CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
7340AT_CLEANUP
e731d71b 7341
4819b3a5
BP
7342AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
7343AT_SKIP_IF([test $HAVE_IPV6 = no])
7344CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
7345AT_CLEANUP
f27f2134 7346
3d198ea5 7347dnl In the absence of an IPFIX collector to verify protocol correctness, simply
fb8f22c1 7348dnl configure bridge IPFIX and ensure that sample action generation works at the
3d198ea5 7349dnl datapath level.
fb8f22c1 7350AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
3d198ea5 7351OVS_VSWITCHD_START
ca5792f0 7352add_of_ports br0 1 2
3d198ea5 7353
fb8f22c1 7354dnl Sample every packet using bridge-based sampling.
3d198ea5
JS
7355AT_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
fb8f22c1 7359dnl Send some packets that should be sampled.
3d198ea5
JS
7360for 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)'])
7362done
7363AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 7364flow-dump from the main thread:
72471622 7365packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))
3d198ea5
JS
7366])
7367
31b29c2e
AZ
7368AT_CHECK([ovs-appctl revalidator/purge])
7369dnl
7370dnl Add a slowpath meter. The userspace action should be metered.
7371AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])
7372
7373dnl Send some packets that should be sampled and metered.
7374for 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)'])
7376done
7377AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 7378flow-dump from the main thread:
31b29c2e
AZ
7379packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))
7380])
7381
fb8f22c1 7382dnl Remove the IPFIX configuration.
3d198ea5
JS
7383AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7384AT_CHECK([ovs-appctl revalidator/purge])
7385
7386dnl Send some more packets, to ensure that these are not sampled.
7387for 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)'])
7389done
7390AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 7391flow-dump from the main thread:
efe179e0 7392packets:2, bytes:68, used:0.001s, actions:drop
3d198ea5
JS
7393])
7394
7395OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7396AT_CLEANUP
7397
fb8f22c1
BY
7398dnl Bridge IPFIX statistics check
7399AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
7400OVS_VSWITCHD_START
7401add_of_ports br0 1 2
7402
7403dnl Negative test check.
7404AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7405OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7406NXST_IPFIX_BRIDGE request (xid=0x2):
7407])
7408
7409dnl Sample every packet using bridge-based sampling.
7410AT_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
7414dnl Send some packets that should be sampled.
7415for 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)'])
7417done
7418
7419dnl There are 4 extra IPFIX template packets.
266f8e62 7420AT_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
fb8f22c1 7421NXST_IPFIX_BRIDGE reply (xid=0x2):
266f8e62
BY
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
fb8f22c1
BY
7424])
7425
7426dnl Remove the IPFIX configuration.
7427AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7428AT_CHECK([ovs-appctl revalidator/purge])
7429
7430dnl Send some more packets, to ensure that these are not sampled.
7431for 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)'])
7433done
7434AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7435OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7436NXST_IPFIX_BRIDGE request (xid=0x2):
7437])
7438
7439OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7440AT_CLEANUP
7441
7442dnl Flow IPFIX sanity check
7443AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
7444OVS_VSWITCHD_START
7445add_of_ports br0 1 2
7446
cbef684c
BP
7447# Check for regression against a bug where an invalid target caused an
7448# assertion failure and a crash.
7449AT_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
fb8f22c1
BY
7454AT_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
7459AT_DATA([flows.txt], [dnl
7460in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7461])
7462
7463AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7464
7465dnl Send some packets that should be sampled.
7466for 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)'])
7468done
7469AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 7470flow-dump from the main thread:
72471622 7471packets: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
fb8f22c1
BY
7472])
7473
7474dnl Remove the flow which contains sample action.
7475AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7476AT_CHECK([ovs-appctl revalidator/purge])
7477
7478dnl Send some more packets, to ensure that these are not sampled.
7479for 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)'])
7481done
7482AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 7483flow-dump from the main thread:
efe179e0 7484packets:2, bytes:68, used:0.001s, actions:drop
fb8f22c1
BY
7485])
7486
cbef684c
BP
7487OVS_VSWITCHD_STOP(["/sending to collector failed/d
7488/xyzzy/d
7489/no collectors/d"])
fb8f22c1
BY
7490AT_CLEANUP
7491
f69f713b
BY
7492dnl Flow IPFIX sanity check for tunnel set
7493AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
f69f713b
BY
7494OVS_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
7509OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
7510
7511dnl Add openflow sample action without sampling_port.
7512AT_DATA([flows.txt], [dnl
7513in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
7514])
7515AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7516
7517AT_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])
7518AT_CHECK([tail -1 stdout], [0], [dnl
72471622 7519Datapath 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
f69f713b
BY
7520])
7521
7522dnl Remove the flow which contains sample action.
7523AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7524AT_CHECK([ovs-appctl revalidator/purge])
7525
7526dnl Add openflow sample action with sampling_port which is
7527dnl equal to output port.
7528AT_DATA([flows2.txt], [dnl
7529in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
7530])
7531AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
7532
7533AT_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])
7534dnl Make sure flow sample action in datapath is behind set tunnel
7535dnl action at egress point of tunnel port.
7536AT_CHECK([tail -1 stdout], [0], [dnl
72471622 7537Datapath 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
f69f713b
BY
7538])
7539
7540dnl Remove the flow which contains sample action.
7541AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7542AT_CHECK([ovs-appctl revalidator/purge])
7543
7544dnl Add a rule with two sample actions and each sample action
7545dnl has a sampling_port
7546AT_DATA([flows3.txt], [dnl
7547in_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])
7549AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
7550
7551AT_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])
7552dnl Make sure flow sample action in datapath is behind set tunnel
7553dnl action at egress point of tunnel port.
7554AT_CHECK([tail -1 stdout], [0], [dnl
72471622 7555Datapath 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
f69f713b
BY
7556])
7557
7558dnl Remove the flow which contains sample action.
7559AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7560AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7561
7562OVS_VSWITCHD_STOP
7563AT_CLEANUP
7564
7ae62a67
WT
7565AT_SETUP([ofproto-dpif - clone action])
7566OVS_VSWITCHD_START
7567add_of_ports br0 1 2 3 4
7568
eee69393 7569dnl Reversible open flow clone actions, no datapath clone action should be generated.
7ae62a67
WT
7570AT_DATA([flows.txt], [dnl
7571in_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])
7573AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7574
7575AT_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
bef503e8 7577AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7578Datapath 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
bef503e8
AZ
7579])
7580
7581dnl Test flow xlate openflow clone action without using datapath clone action.
ce15b514 7582AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
bef503e8
AZ
7583
7584AT_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
7ae62a67 7586AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7587Datapath 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
7ae62a67
WT
7588])
7589
9c2a44dc
AZ
7590AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7591AT_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
7593AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7594Datapath 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
9c2a44dc
AZ
7595])
7596
eee69393
AZ
7597dnl Mixing reversible and irreversible open flow clone actions. Datapath clone action
7598dnl should be generated when necessary.
7599
7600dnl Restore the datapath support level.
7601AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone true], [0], [])
7602AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 10], [0], [])
7603
7604AT_DATA([flows.txt], [dnl
7605in_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])
7607AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7608
7609AT_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
7611AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7612Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),clone(ct(commit),3),4
eee69393
AZ
7613])
7614
7615AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7616
7617AT_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
7619AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7620Datapath 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
eee69393
AZ
7621])
7622
7623AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7624AT_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
7626AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7627Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),4
eee69393
AZ
7628])
7629AT_CHECK([grep "Failed to compose clone action" stdout], [0], [ignore])
7630
7ae62a67
WT
7631OVS_VSWITCHD_STOP
7632AT_CLEANUP
7633
fb8f22c1
BY
7634dnl Flow based IPFIX statistics check
7635AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
7636OVS_VSWITCHD_START
7637add_of_ports br0 1 2
7638
7639dnl Negative test check.
7640AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7641OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7642NXST_IPFIX_FLOW request (xid=0x2):
7643])
7644
7645AT_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
7650AT_DATA([flows.txt], [dnl
7651in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7652])
7653
7654AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7655
7656dnl Send some packets that should be sampled.
7657for 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)'])
7659done
7660
7661dnl There are 4 extra IPFIX template packets.
266f8e62 7662AT_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
fb8f22c1 7663NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
266f8e62
BY
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
fb8f22c1
BY
7666])
7667
7668dnl Remove the flow which contains sample action.
7669AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7670AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7671AT_CHECK([ovs-appctl revalidator/purge])
7672
7673dnl Send some more packets, to ensure that these are not sampled.
7674for 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)'])
7676done
7677AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7678OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7679NXST_IPFIX_FLOW request (xid=0x2):
7680])
7681
7682OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7683AT_CLEANUP
7684
23a7d252
JS
7685AT_SETUP([ofproto-dpif - flow stats])
7686OVS_VSWITCHD_START
7687AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7688AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7689
7690ovs-appctl time/stop
7691
7692for 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)'
7694done
7695
cea4a6d7
JS
7696AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7697AT_CHECK([ovs-appctl revalidator/purge], [0])
e96a5c24 7698AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 7699AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
e96a5c24 7700 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6f068379 7701 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
e96a5c24
JS
7702])
7703OVS_VSWITCHD_STOP
7704AT_CLEANUP
8b6987d7
JR
7705
7706AT_SETUP([ofproto-dpif - flow stats reset_counts])
7707OVS_VSWITCHD_START
7708flow="ip,actions=NORMAL"
7709
7710ovs-appctl time/stop
7711
7712AT_CHECK([ovs-ofctl add-flow br0 $flow])
7713
7714warp_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
7729warp_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
7744send_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
7749send_packet
6f068379 7750warp_and_dump_NXM 1 1 118 1
8b6987d7
JR
7751AT_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
7754warp_and_dump_NXM 1 0 0 2
7755
7756send_packet
6f068379 7757warp_and_dump_NXM 2 1 118 1
8b6987d7
JR
7758AT_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
6f068379 7761warp_and_dump_NXM 3 1 118 2 1
8b6987d7
JR
7762
7763# OpenFlow 1.1, implicit reset_counts
7764send_packet
6f068379 7765warp_and_dump_OF 11 4 2 236
8b6987d7
JR
7766AT_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
7769warp_and_dump_NXM 1 0 0 2
7770warp_and_dump_OF 11 2 0 0
7771
7772send_packet
6f068379 7773warp_and_dump_OF 11 3 1 118
8b6987d7
JR
7774AT_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
6f068379
BP
7777warp_and_dump_NXM 4 1 118 2 1
7778warp_and_dump_OF 11 5 1 118
8b6987d7
JR
7779
7780# OpenFlow 1.2, explicit reset_counts
7781send_packet
6f068379 7782warp_and_dump_OF 12 6 2 236
8b6987d7
JR
7783AT_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
6f068379
BP
7786warp_and_dump_NXM 1 2 236 2
7787warp_and_dump_OF 12 2 2 236
8b6987d7
JR
7788
7789send_packet
6f068379 7790warp_and_dump_OF 12 3 3 354
8b6987d7
JR
7791AT_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
6f068379
BP
7794warp_and_dump_NXM 4 3 354 2 1
7795warp_and_dump_OF 12 5 3 354
8b6987d7
JR
7796
7797send_packet
6f068379 7798warp_and_dump_OF 12 6 4 472
8b6987d7
JR
7799AT_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
7802warp_and_dump_NXM 1 0 0 2
7803warp_and_dump_OF 12 2 0 0
7804
7805send_packet
6f068379 7806warp_and_dump_OF 12 3 1 118
8b6987d7
JR
7807AT_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
7810warp_and_dump_NXM 4 0 0 2 1
7811warp_and_dump_OF 12 5 0 0
7812
7813# OpenFlow > 1.3, explicit reset_counts
7814flow_mods_reset_counts () {
7815 # Reset to a known state
7816 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7817
7818 send_packet
6f068379 7819 warp_and_dump_OF $1 1 1 118 reset_counts
8b6987d7
JR
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
6f068379
BP
7823 warp_and_dump_NXM 1 1 118 2
7824 warp_and_dump_OF $1 2 1 118
8b6987d7
JR
7825
7826 send_packet
6f068379 7827 warp_and_dump_OF $1 3 2 236
8b6987d7
JR
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
6f068379
BP
7831 warp_and_dump_NXM 4 2 236 2 1
7832 warp_and_dump_OF $1 5 2 236
8b6987d7
JR
7833
7834 send_packet
6f068379 7835 warp_and_dump_OF $1 6 3 354
8b6987d7
JR
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
6f068379 7843 warp_and_dump_OF $1 3 1 118 reset_counts
8b6987d7
JR
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
6f068379 7852 warp_and_dump_OF $1 6 1 118 reset_counts
8b6987d7 7853 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
6f068379
BP
7854 warp_and_dump_NXM 7 1 118 2 1
7855 warp_and_dump_OF $1 8 1 118 reset_counts
8b6987d7
JR
7856
7857 # Add flow having reset_counts flag without reset_counts
7858 send_packet
6f068379 7859 warp_and_dump_OF $1 9 2 236 reset_counts
8b6987d7 7860 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
6f068379
BP
7861 warp_and_dump_NXM 1 2 236 2
7862 warp_and_dump_OF $1 2 2 236
8b6987d7
JR
7863
7864 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7865 send_packet
6f068379 7866 warp_and_dump_OF $1 3 3 354
8b6987d7
JR
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
7873flow_mods_reset_counts 13
7874flow_mods_reset_counts 14
c7b02b80
S
7875
7876OVS_VSWITCHD_STOP
7877AT_CLEANUP
7878
7879AT_SETUP([ofproto-dpif - flow stats reset_counts OpenFlow1.5])
7880OVS_VSWITCHD_START
7881flow="ip,actions=NORMAL"
7882
7883ovs-appctl time/stop
7884
7885AT_CHECK([ovs-ofctl add-flow br0 $flow])
7886
7887warp_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
7902send_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
7907flow_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
8b6987d7
JR
7959flow_mods_reset_counts 15
7960
7961OVS_VSWITCHD_STOP
7962AT_CLEANUP
e96a5c24 7963
c7b02b80 7964
e96a5c24
JS
7965AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
7966OVS_VSWITCHD_START
7967AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7968AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7969
7970ovs-appctl time/stop
7971
7972for 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)'
7974done
7975
7976ovs-appctl time/warp 100
7977AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
7978ovs-appctl time/warp 1000
7979
23a7d252 7980AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 7981AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
23a7d252 7982 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6f068379 7983 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
23a7d252
JS
7984])
7985OVS_VSWITCHD_STOP
7986AT_CLEANUP
7987
5f5ebd4c 7988AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
f27f2134
BP
7989OVS_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.
7998get_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.
8023AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
8024get_ages duration1 hard1 idle1
8025
31ef9f51 8026ovs-appctl time/stop
f27f2134
BP
8027# Warp time forward by 10 seconds, then modify the flow's actions.
8028ovs-appctl time/warp 10000
8029get_ages duration2 hard2 idle2
8030AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
8031
8032# Warp time forward by 10 seconds.
8033ovs-appctl time/warp 10000
8034get_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.
8039ovs-appctl time/warp 10000
8040ovs-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)'
bdba1947 8041ovs-appctl time/warp 3000 1000
c0526804 8042sleep 1
f27f2134
BP
8043get_ages duration4 hard4 idle4
8044
8045printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
8046printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
8047printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
8048
8049# Duration should increase steadily over time.
8050AT_CHECK([test $duration1 -lt $duration2])
8051AT_CHECK([test $duration2 -lt $duration3])
8052AT_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.
8056AT_CHECK([test $hard1 = none])
8057AT_CHECK([test $hard2 = none])
8058AT_CHECK([test $hard3 != none])
8059AT_CHECK([test $hard4 != none])
8060AT_CHECK([test $hard3 -lt $hard4])
8061
8062# Idle age should increase from 1 to 2 to 3, then decrease.
8063AT_CHECK([test $idle1 -lt $idle2])
8064AT_CHECK([test $idle2 -lt $idle3])
8065AT_CHECK([test $idle3 -gt $idle4])
8066
8067# Check some invariant relationships.
8068AT_CHECK([test $duration1 = $idle1])
8069AT_CHECK([test $duration2 = $idle2])
8070AT_CHECK([test $duration3 = $idle3])
8071AT_CHECK([test $idle3 -gt $hard3])
8072AT_CHECK([test $idle4 -lt $hard4])
8073AT_CHECK([test $hard4 -lt $duration4])
8074
8075OVS_VSWITCHD_STOP
8076AT_CLEANUP
0e553d9c
BP
8077
8078AT_SETUP([ofproto-dpif - fin_timeout])
8079OVS_VSWITCHD_START
b5c1a5df 8080ovs-appctl time/stop
0e553d9c
BP
8081AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
8082AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
8083[NXST_FLOW reply:
8084 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
8085])
31ef9f51 8086
0e553d9c
BP
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.)
323cc924 8091AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
0e553d9c
BP
8092AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
8093warped
8094])
cea4a6d7 8095AT_CHECK([ovs-appctl revalidator/purge], [0])
0e553d9c
BP
8096AT_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.
323cc924 8101AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
0e553d9c
BP
8102AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
8103warped
8104])
8105AT_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])
8109OVS_VSWITCHD_STOP
8110AT_CLEANUP
27022416
JP
8111
8112AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
8113OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
ca5792f0
BP
8114add_of_ports br0 1 2
8115add_of_ports br1 3
27022416
JP
8116
8117AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
8118dummy@br0
8119dummy@br1
8120])
8121OVS_VSWITCHD_STOP
8122AT_CLEANUP
8123
8124AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
e539ba87
IM
8125OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
8126 [--dummy-numa="0,0,0,0,1,1,1,1"])
8127add_pmd_of_ports br0 1 2
ca5792f0 8128add_of_ports br1 3
27022416 8129
e539ba87 8130AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
dc54ef36 8131dummy@ovs-dummy: hit:0 missed:0
7be29a47
BP
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)
27022416
JP
8139])
8140OVS_VSWITCHD_STOP
8141AT_CLEANUP
8142
8143AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
054e5aa6 8144# bump max-idle to avoid the flows being reclaimed behind us
27022416 8145OVS_VSWITCHD_START([add-br br1 -- \
054e5aa6 8146 set bridge br1 datapath-type=dummy fail-mode=secure -- \
e539ba87
IM
8147 set Open_vSwitch . other_config:max-idle=10000], [], [],
8148 [--dummy-numa="0,0,0,0,1,1,1,1"])
8149add_of_ports br0 1
8150add_pmd_of_ports br0 2
ca5792f0 8151add_of_ports br1 3
27022416 8152
323cc924
BP
8153AT_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)'])
8154AT_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)'])
8155AT_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)'])
27f57736 8156ovs-appctl revalidator/wait
3a18d0c2 8157AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e
JS
8158recirc_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
8159recirc_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
27022416
JP
8160])
8161
3a18d0c2 8162AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 8163recirc_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
27022416
JP
8164])
8165
3a18d0c2 8166AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e
JS
8167skb_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
8168skb_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
04b541df
GS
8169])
8170
3a18d0c2 8171AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 8172skb_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
818650e6
JS
8173])
8174
8175OVS_VSWITCHD_STOP
8176AT_CLEANUP
8177
e539ba87
IM
8178m4_define([OFPROTO_DPIF_GET_FLOW],
8179 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
818650e6 8180
e539ba87
IM
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"])])
818650e6 8185
45a9c31d 8186 func=`printf '%s_' "$1" | cut -c 4-`
e539ba87
IM
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])
818650e6 8192
e539ba87
IM
8193 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
8194 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
3d4b2e6e 8195recirc_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
04b541df
GS
8196])
8197
e539ba87
IM
8198 OVS_VSWITCHD_STOP
8199 AT_CLEANUP])
8200
8201OFPROTO_DPIF_GET_FLOW([])
8202OFPROTO_DPIF_GET_FLOW([ - pmd])
27022416 8203
50c1efc9 8204AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
8bfd0fda
BP
8205OVS_VSWITCHD_START([dnl
8206 add-port br0 p1 -- set Interface p1 type=dummy
8207])
623540e4 8208AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 8209on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
8210
8211AT_CAPTURE_FILE([ofctl_monitor.log])
8212AT_DATA([flows.txt], [dnl
8213dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 8214dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
8215])
8216AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8217
8218dnl Packet is sent to userspace because a MPLS push or pop action is applied to
47fb7f71 8219dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
8bfd0fda 8220dnl
47fb7f71 8221dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
8bfd0fda 8222dnl 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)
8bfd0fda
BP
8223dnl (label 20, exp 0, [S], ttl 32)
8224dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
8225dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
8226
8227for dl_src in 00 01; do
47fb7f71 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"])
e3b9e3aa
YT
8229done
8230sleep 1 # wait for the datapath flow installed
2be3fe44 8231AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
74c4530d
JP
8232recirc_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))
8233recirc_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))
8bfd0fda 8234])
8bfd0fda
BP
8235
8236OVS_VSWITCHD_STOP
8237AT_CLEANUP
8238
8239
50c1efc9 8240AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
8bfd0fda
BP
8241OVS_VSWITCHD_START([dnl
8242 add-port br0 p1 -- set Interface p1 type=dummy
8243])
623540e4 8244AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 8245on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
8246
8247AT_CAPTURE_FILE([ofctl_monitor.log])
8248AT_DATA([flows.txt], [dnl
8249dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 8250dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
8251])
8252AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8253
8254dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
f2c7be23 8255dnl 4 MPLS LSEs but ovs-vswitchd can only handle up to 3 MPLS LSEs and thus
47fb7f71 8256dnl can't determine the resulting MPLS label after MPLS push/pop actions.
8bfd0fda
BP
8257dnl
8258dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
8259dnl 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)
8260dnl (label 20, exp 0, ttl 32)
8261dnl (label 20, exp 0, ttl 32)
8262dnl (label 20, exp 0, [S], ttl 32)
8263dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
8264dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
8bfd0fda 8265
47fb7f71
JS
8266for 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"])
e3b9e3aa
YT
8268done
8269sleep 1 # wait for the datapath flow installed
2be3fe44 8270AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
74c4530d
JP
8271recirc_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))
8272recirc_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))
8bfd0fda
BP
8273])
8274
8275OVS_VSWITCHD_STOP
8276AT_CLEANUP
8277
0a740f48
EJ
8278AT_SETUP([ofproto-dpif - patch ports])
8279OVS_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
ca5792f0
BP
8284add_of_ports br0 2
8285add_of_ports br1 3
0a740f48 8286
64bb477f
JS
8287AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8288], [])
aef0491b 8289AT_CHECK([ovs-appctl time/stop])
623540e4 8290AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9fc0165a 8291
0a740f48
EJ
8292AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
8293AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
8294
8295for 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)'
3b401f9b
BP
8297 if [[ $i -eq 1 ]]; then
8298 sleep 1
8299 fi
0a740f48
EJ
8300done
8301
8302for 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)'
3b401f9b
BP
8304 if [[ $i -eq 1 ]]; then
8305 sleep 1
8306 fi
0a740f48
EJ
8307done
8308
0a8763fc
EJ
8309AT_CHECK([ovs-appctl time/warp 500], [0],
8310[warped
735d7efb 8311])
732207ad 8312sleep 1 # wait for log writer
735d7efb 8313
0a740f48 8314AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dc54ef36 8315dummy@ovs-dummy: hit:13 missed:2
7be29a47
BP
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)
0a740f48
EJ
8324])
8325
2be3fe44 8326AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
8327recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
8328recirc_id(0),in_port(101),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
c2a77f33
JS
8329])
8330
2be3fe44 8331AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
6f068379 8332skb_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
c2a77f33 8333])
2be3fe44 8334AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
6f068379 8335skb_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
0a740f48
EJ
8336])
8337
8338AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
8339OFPST_PORT reply (xid=0x4): 1 ports
6f068379
BP
8340 port 1: rx pkts=5, bytes=530, drop=?, errs=?, frame=?, over=?, crc=?
8341 tx pkts=10, bytes=1060, drop=?, errs=?, coll=?
0a740f48
EJ
8342])
8343
8344AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
8345OFPST_PORT reply (xid=0x4): 1 ports
6f068379
BP
8346 port 1: rx pkts=10, bytes=1060, drop=?, errs=?, frame=?, over=?, crc=?
8347 tx pkts=5, bytes=530, drop=?, errs=?, coll=?
0a740f48
EJ
8348])
8349
8350OVS_VSWITCHD_STOP
8351AT_CLEANUP
655ab909 8352
1774d762
JR
8353AT_SETUP([ofproto-dpif - patch ports - stack])
8354OVS_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
ca5792f0
BP
8359add_of_ports br0 2
8360add_of_ports br1 3
1774d762
JR
8361
8362AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8363], [])
8364AT_CHECK([ovs-appctl time/stop])
8365AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8366
8367AT_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.
8369AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
8370
8371ovs-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
8373AT_CHECK([ovs-appctl time/warp 500], [0],
8374[warped
8375])
8376
8377OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
8378
8379AT_CHECK([ovs-appctl dpif/show], [0], [dnl
8380dummy@ovs-dummy: hit:0 missed:1
7be29a47
BP
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)
1774d762
JR
8389])
8390
2be3fe44 8391AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e 8392recirc_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
1774d762
JR
8393])
8394
2d9b49dd 8395AT_CHECK([grep -e '|ofproto_dpif_xlate|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
a4c3463d 8396stack 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
1774d762
JR
8397])
8398
2d9b49dd 8399OVS_VSWITCHD_STOP(["/stack underflow/d"])
1774d762
JR
8400AT_CLEANUP
8401
65e0be10
BP
8402AT_SETUP([ofproto-dpif - port duration])
8403OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
ca5792f0 8404add_of_ports br0 1 2
65e0be10 8405
31ef9f51 8406ovs-appctl time/stop
65e0be10
BP
8407ovs-appctl time/warp 10000
8408
8409AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
125bf01d 8410AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
65e0be10 8411[dnl
65e0be10 8412 duration=?s
65e0be10 8413 duration=?s
65e0be10
BP
8414 duration=?s
8415])
8416OVS_VSWITCHD_STOP
8417AT_CLEANUP
bcd2633a
JP
8418
8419dnl ----------------------------------------------------------------------
8420AT_BANNER([ofproto-dpif -- megaflows])
8421
bcd2633a
JP
8422AT_SETUP([ofproto-dpif megaflow - port classification])
8423OVS_VSWITCHD_START
623540e4 8424AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8425add_of_ports br0 1 2
bcd2633a
JP
8426AT_DATA([flows.txt], [dnl
8427table=0 in_port=1 actions=output(2)
8428])
8429AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8430AT_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)'])
53555f51 8431sleep 1
bcd2633a 8432AT_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)'])
ae692725 8433sleep 1
2be3fe44 8434AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e 8435recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8436])
8437OVS_VSWITCHD_STOP
8438AT_CLEANUP
8439
8440AT_SETUP([ofproto-dpif megaflow - L2 classification])
8441OVS_VSWITCHD_START
623540e4 8442AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8443add_of_ports br0 1 2
bcd2633a
JP
8444AT_DATA([flows.txt], [dnl
8445table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
8446])
8447AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8448AT_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)'])
8449AT_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)'])
ae692725 8450sleep 1
2be3fe44 8451AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8452recirc_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>
8453recirc_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>
bcd2633a
JP
8454])
8455OVS_VSWITCHD_STOP
8456AT_CLEANUP
8457
8458AT_SETUP([ofproto-dpif megaflow - L3 classification])
8459OVS_VSWITCHD_START
623540e4 8460AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8461add_of_ports br0 1 2
13751fd8 8462AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=nw_dst,nw_src], [0], [ignore], [])
bcd2633a
JP
8463AT_DATA([flows.txt], [dnl
8464table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
8465])
8466AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8467AT_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)'])
8468AT_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)'])
ae692725 8469sleep 1
2be3fe44 8470AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8471recirc_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>
8472recirc_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>
bcd2633a
JP
8473])
8474OVS_VSWITCHD_STOP
8475AT_CLEANUP
8476
13751fd8
JR
8477AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
8478OVS_VSWITCHD_START
623540e4 8479AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8480add_of_ports br0 1 2
13751fd8
JR
8481AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=ipv6_dst,ipv6_src], [0], [ignore], [])
8482AT_DATA([flows.txt], [dnl
8483table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
8484])
8485AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8486AT_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)'])
8487AT_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)'])
ae692725 8488sleep 1
2be3fe44 8489AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8490recirc_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>
8491recirc_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>
13751fd8
JR
8492])
8493OVS_VSWITCHD_STOP
8494AT_CLEANUP
8495
bcd2633a
JP
8496AT_SETUP([ofproto-dpif megaflow - L4 classification])
8497OVS_VSWITCHD_START
623540e4 8498AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8499add_of_ports br0 1 2
bcd2633a
JP
8500AT_DATA([flows.txt], [dnl
8501table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
8502])
8503AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8504AT_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)'])
53555f51 8505sleep 1
bcd2633a 8506AT_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)'])
53555f51 8507sleep 1
2be3fe44 8508AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e 8509recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=1,frag=no),icmp(type=8), actions: <del>
bcd2633a
JP
8510])
8511OVS_VSWITCHD_STOP
8512AT_CLEANUP
8513
e539ba87
IM
8514m4_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])
45a9c31d 8518 func=`printf '%s_' "$1" | cut -c 4-`
e539ba87
IM
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
3d4b2e6e
JS
8525recirc_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>
8526recirc_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>
bcd2633a 8527])
e539ba87
IM
8528 OVS_VSWITCHD_STOP
8529 AT_CLEANUP])
8530
8531OFPROTO_DPIF_MEGAFLOW_NORMAL([])
8532OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
bcd2633a
JP
8533
8534AT_SETUP([ofproto-dpif megaflow - mpls])
8535OVS_VSWITCHD_START
623540e4 8536AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8537add_of_ports br0 1 2
bcd2633a
JP
8538AT_DATA([flows.txt], [dnl
8539table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
8540table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
8541])
8542AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8543AT_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)'])
8544AT_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)'])
ae692725 8545sleep 1
3fd12197 8546AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
3d4b2e6e
JS
8547recirc_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
8548recirc_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
bcd2633a
JP
8549])
8550OVS_VSWITCHD_STOP
8551AT_CLEANUP
8552
4819b3a5 8553# CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
e731d71b 8554m4_define([CHECK_MEGAFLOW_NETFLOW],
4819b3a5 8555 [OVS_VSWITCHD_START
623540e4 8556 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8557 add_of_ports br0 1 2
e731d71b
AS
8558
8559 dnl NetFlow configuration disables wildcarding relevant fields
53eb8cb8 8560 on_exit 'kill `cat test-netflow.pid`'
eadd1644 8561 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 8562 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 8563 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
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
2be3fe44 8573 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8574recirc_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>
8575recirc_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>
bcd2633a 8576])
d9c8c57c 8577 OVS_APP_EXIT_AND_WAIT([test-netflow])
4819b3a5 8578 OVS_VSWITCHD_STOP])
e731d71b 8579
4819b3a5 8580AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
e731d71b 8581CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
4819b3a5
BP
8582AT_CLEANUP
8583
8584AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
8585AT_SKIP_IF([test $HAVE_IPV6 = no])
e731d71b 8586CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
4819b3a5 8587AT_CLEANUP
bcd2633a 8588
e539ba87
IM
8589m4_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
bcd2633a 8598])
e539ba87 8599 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a 8600
e539ba87
IM
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
3d4b2e6e
JS
8606recirc_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>
8607recirc_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>
bcd2633a 8608])
e539ba87
IM
8609 OVS_VSWITCHD_STOP
8610 AT_CLEANUP])
8611
8612OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
8613OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
bcd2633a
JP
8614
8615AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
8616OVS_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])
8621AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8622])
623540e4 8623AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a
JP
8624
8625AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8626AT_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)'])
8627AT_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)'])
ae692725 8628sleep 1
2be3fe44 8629AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8630recirc_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>
8631recirc_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>
bcd2633a
JP
8632])
8633OVS_VSWITCHD_STOP
8634AT_CLEANUP
8635
8636AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
91fc374a
BP
8637# Create bond0 on br0 with members p0 and p1
8638# and bond1 on br1 with members p2 and p3
bcd2633a
JP
8639# with p0 patched to p2 and p1 patched to p3.
8640OVS_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
8656AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8657])
623540e4 8658AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8659add_of_ports br0 7
bcd2633a
JP
8660AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8661AT_CHECK([ovs-ofctl add-flow br1 action=normal])
31ef9f51 8662ovs-appctl time/stop
bcd2633a
JP
8663ovs-appctl time/warp 5000
8664AT_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)'])
8665AT_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)'])
53555f51 8666sleep 1
2be3fe44 8667AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8668recirc_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>
8669recirc_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>
bcd2633a
JP
8670])
8671OVS_VSWITCHD_STOP
8672AT_CLEANUP
8673
8674AT_SETUP([ofproto-dpif megaflow - resubmit port action])
8675OVS_VSWITCHD_START
623540e4 8676AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8677add_of_ports br0 1 2
bcd2633a
JP
8678AT_DATA([flows.txt], [dnl
8679table=0 in_port=1,ip actions=resubmit(90)
8680table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
8681])
8682AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8683AT_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)'])
8684AT_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)'])
ae692725 8685sleep 1
2be3fe44 8686AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8687recirc_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>
8688recirc_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>
bcd2633a
JP
8689])
8690OVS_VSWITCHD_STOP
8691AT_CLEANUP
8692
8693AT_SETUP([ofproto-dpif megaflow - resubmit table action])
8694OVS_VSWITCHD_START
623540e4 8695AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8696add_of_ports br0 1 2
bcd2633a
JP
8697AT_DATA([flows.txt], [dnl
8698table=0 in_port=1,ip actions=resubmit(,1)
8699table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8700])
8701AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8702AT_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)'])
8703AT_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=
87041,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
ae692725 8705sleep 1
2be3fe44 8706AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8707recirc_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>
8708recirc_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>
bcd2633a
JP
8709])
8710OVS_VSWITCHD_STOP
8711AT_CLEANUP
8712
8713AT_SETUP([ofproto-dpif megaflow - goto_table action])
8714OVS_VSWITCHD_START
623540e4 8715AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8716add_of_ports br0 1 2
bcd2633a
JP
8717AT_DATA([flows.txt], [dnl
8718table=0 in_port=1,ip actions=goto_table(1)
8719table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8720])
8721AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
8722AT_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)'])
8723AT_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)'])
ae692725 8724sleep 1
2be3fe44 8725AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8726recirc_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>
8727recirc_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>
bcd2633a
JP
8728])
8729OVS_VSWITCHD_STOP
8730AT_CLEANUP
8731
8732AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
2d5c1a20 8733AT_KEYWORDS([mirror mirrors mirroring])
bcd2633a 8734OVS_VSWITCHD_START
623540e4 8735AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8736add_of_ports br0 1 2 3
bcd2633a
JP
8737ovs-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
8742AT_DATA([flows.txt], [dnl
8743in_port=1 actions=output:2
8744])
8745AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8746AT_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)'])
53555f51 8747sleep 1
bcd2633a 8748AT_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)'])
ae692725 8749sleep 1
2be3fe44 8750AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e 8751recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8752])
8753OVS_VSWITCHD_STOP
8754AT_CLEANUP
8755
8756AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
8757OVS_VSWITCHD_START
623540e4 8758AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8759add_of_ports br0 1 2 3
bcd2633a
JP
8760ovs-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
8765AT_DATA([flows.txt], [dnl
8766in_port=1 actions=output:2
8767])
8768AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8769AT_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))'])
8770AT_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)'])
ae692725 8771sleep 1
2be3fe44 8772AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8773recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8774recirc_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>
bcd2633a
JP
8775])
8776OVS_VSWITCHD_STOP
8777AT_CLEANUP
8778
8779AT_SETUP([ofproto-dpif megaflow - move action])
8780OVS_VSWITCHD_START
623540e4 8781AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8782add_of_ports br0 1 2
bcd2633a
JP
8783AT_DATA([flows.txt], [dnl
8784table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
8785table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
8786table=0 in_port=91 reg0=0x0a000002,actions=output(2)
8787])
8788AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8789AT_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)'])
8790AT_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)'])
ae692725 8791sleep 1
2be3fe44 8792AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8793recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
8794recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
bcd2633a
JP
8795])
8796OVS_VSWITCHD_STOP
8797AT_CLEANUP
8798
8799AT_SETUP([ofproto-dpif megaflow - push action])
8800OVS_VSWITCHD_START
623540e4 8801AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8802add_of_ports br0 1 2
bcd2633a
JP
8803AT_DATA([flows.txt], [dnl
8804table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
8805])
8806AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8807AT_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)'])
8808AT_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)'])
ae692725 8809sleep 1
2be3fe44 8810AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8811recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
8812recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
bcd2633a
JP
8813])
8814OVS_VSWITCHD_STOP
8815AT_CLEANUP
8816
8817AT_SETUP([ofproto-dpif megaflow - learning])
8818OVS_VSWITCHD_START
623540e4 8819AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8820add_of_ports br0 1 2
bcd2633a
JP
8821AT_DATA([flows.txt], [dnl
8822table=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])
8824AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
31ef9f51 8825ovs-appctl time/stop
956f2bf0
BP
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.
8830for 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
8834done
ae692725 8835sleep 1
bcd2633a 8836dnl The original flow is missing due to a revalidation.
2be3fe44 8837AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8838recirc_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>
8839recirc_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>
bcd2633a
JP
8840])
8841OVS_VSWITCHD_STOP
8842AT_CLEANUP
d4f4a9b2
JP
8843
8844AT_SETUP([ofproto-dpif megaflow - tunnels])
8845OVS_VSWITCHD_START(
2c0ea78f 8846 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
623540e4 8847AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
2c0ea78f
GS
8848AT_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])
8850AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
8851 ofport_request=3])
8852AT_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])
d4f4a9b2
JP
8855AT_DATA([flows.txt], [dnl
8856in_port=1,actions=output(2)
8857in_port=3,actions=output(4)
8858])
8859AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8860dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
8861dnl will cause the packet to be dropped.
8862AT_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)'])
53555f51 8863sleep 1
d4f4a9b2
JP
8864AT_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)'])
8865AT_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)'])
53555f51 8866sleep 1
d4f4a9b2 8867AT_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)'])
ae692725 8868sleep 1
2be3fe44 8869AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8870recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
8871recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
8872recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
1dd35f8a
JP
8873])
8874OVS_VSWITCHD_STOP
8875AT_CLEANUP
8876
8877AT_SETUP([ofproto-dpif megaflow - dec_ttl])
8878OVS_VSWITCHD_START
623540e4 8879AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8880add_of_ports br0 1 2
13751fd8 8881AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=nw_dst,nw_src], [0], [ignore], [])
1dd35f8a
JP
8882AT_DATA([flows.txt], [dnl
8883table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
8884])
8885AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8886AT_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)'])
8887AT_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)'])
ae692725 8888sleep 1
2be3fe44 8889AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8890recirc_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>
8891recirc_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>
d4f4a9b2
JP
8892])
8893OVS_VSWITCHD_STOP
8894AT_CLEANUP
74cc3969 8895
f74e7df7
JP
8896AT_SETUP([ofproto-dpif megaflow - set dl_dst])
8897OVS_VSWITCHD_START
623540e4 8898AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8899add_of_ports br0 1 2
f74e7df7
JP
8900AT_DATA([flows.txt], [dnl
8901table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
8902])
8903AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8904AT_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)'])
8905AT_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)'])
ae692725 8906sleep 1
d23df9a8
JR
8907dnl The first packet is essentially a no-op, as the new destination MAC is the
8908dnl same as the original. The second entry actually updates the destination
8909dnl MAC.
2be3fe44 8910AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
8911recirc_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
8912recirc_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
f74e7df7
JP
8913])
8914OVS_VSWITCHD_STOP
8915AT_CLEANUP
8916
e8bf7774
IM
8917AT_SETUP([ofproto-dpif megaflow - set dl_dst with match on dl_src])
8918OVS_VSWITCHD_START
8919AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8920add_of_ports br0 1 2
8921AT_DATA([flows.txt], [dnl
8922table=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])
8924AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8925AT_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)'])
8926AT_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)'])
8927AT_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)'])
8928sleep 1
8929dnl The first packet is essentially a no-op, as the new destination MAC is the
8930dnl same as the original. The second entry actually updates the destination
8931dnl MAC. The last one must be dropped as it doesn't match with dl_src.
8932AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8933recirc_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
8934recirc_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
8935recirc_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])
8937OVS_VSWITCHD_STOP
8938AT_CLEANUP
8939
e539ba87
IM
8940m4_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])
45a9c31d 8944 func=`printf '%s_' "$1" | cut -c 4-`
e539ba87
IM
8945 add_${func}of_ports br0 1 2
8946 AT_DATA([flows.txt], [dnl
8c301900
JR
8947table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
8948table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
8949])
e539ba87 8950 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8c301900 8951], [])
e539ba87 8952 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
64bb477f 8953], [])
e539ba87
IM
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
3d4b2e6e
JS
8965skb_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
8966skb_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
c2a77f33 8967])
e539ba87 8968 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
6f068379
BP
8969skb_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
8970skb_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
8c301900 8971])
e539ba87
IM
8972 OVS_VSWITCHD_STOP
8973 AT_CLEANUP])
8974
8975OFPROTO_DPIF_MEGAFLOW_DISABLED([])
8976OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
8c301900 8977
74cc3969
BP
8978AT_SETUP([ofproto-dpif - datapath port number change])
8979OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 8980add_of_ports br0 1
74cc3969
BP
8981
8982# Trace a flow that should output to p1.
8983AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8984 [0], [stdout])
8985AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
8986])
8987
8988# Change p1's port number to 5.
8989AT_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.
8992AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8993 [0], [stdout])
8994AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
8995])
8996OVS_VSWITCHD_STOP
8997AT_CLEANUP
2d344ba5
AW
8998
8999# Tests the bundling with various bfd and cfm configurations.
9000AT_SETUP([ofproto - bundle with variable bfd/cfm config])
9001OVS_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
9012ovs-appctl time/stop
9013# advance the clock to stablize everything.
bdba1947 9014ovs-appctl time/warp 5000 100
2d344ba5
AW
9015# cfm/show should show 'recv' fault.
9016AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
f6d6edc0 9017 fault: recv
2d344ba5
AW
9018])
9019# bfd/show should show 'up'.
9020AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
fc002ed3
BP
9021 Local Session State: up
9022 Remote Session State: up
9023 Local Session State: up
9024 Remote Session State: up
2d344ba5 9025])
91fc374a 9026# bond/show should show 'may-enable: true' for all members.
2d344ba5 9027AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
828519ca
BP
9028 may_enable: true
9029 may_enable: true
9030 may_enable: true
9031 may_enable: true
2d344ba5
AW
9032])
9033
9034# now disable the bfd on p1.
9035AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
9036# advance the clock to stablize everything.
bdba1947 9037ovs-appctl time/warp 5000 100
2d344ba5
AW
9038# cfm/show should show 'recv' fault.
9039AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
f6d6edc0 9040 fault: recv
2d344ba5
AW
9041])
9042# bfd/show should show 'down'.
9043AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
fc002ed3
BP
9044 Local Session State: down
9045 Remote Session State: down
2d344ba5
AW
9046])
9047# bond/show should show 'may-enable: false' for p0.
125bf01d 9048AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
828519ca
BP
9049 may_enable: false
9050 may_enable: true
2d344ba5
AW
9051])
9052
9053# now enable the bfd on p1 and disable bfd on p0.
9054AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
9055AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
9056# advance the clock to stablize everything.
bdba1947 9057ovs-appctl time/warp 5000 100
2d344ba5
AW
9058# cfm/show should show 'recv' fault.
9059AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
f6d6edc0 9060 fault: recv
2d344ba5
AW
9061])
9062# bfd/show should show 'down'.
9063AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
fc002ed3
BP
9064 Local Session State: down
9065 Remote Session State: down
2d344ba5
AW
9066])
9067# bond/show should show 'may-enable: false' for p0 and p1.
9068AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
828519ca
BP
9069 may_enable: false
9070 may_enable: true
9071 may_enable: false
9072 may_enable: true
2d344ba5
AW
9073])
9074
e441a806
AW
9075OVS_VSWITCHD_STOP
9076AT_CLEANUP
9077
9078AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
9079OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
9080
9081# enable bfd on p0.
9082AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
9083# check log.
1335a8d5 9084OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
9085# disable bfd on p0.
9086AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
9087# check log.
1335a8d5 9088OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
454ff761 9089AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && ovs-appctl vlog/close && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
e441a806
AW
9090
9091# enable cfm on p0.
9092AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
9093# check log.
1335a8d5 9094OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
9095# disable cfm on p0.
9096AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
9097# check log.
1335a8d5 9098OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
454ff761 9099AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && ovs-appctl vlog/close && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
e441a806
AW
9100
9101# enable both bfd and cfm on p0.
9102AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
9103# check log.
1335a8d5 9104OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
9105# disable bfd on p0.
9106AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
9107# check log, there should not be the log of thread terminated.
738cd849 9108AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
9109])
9110# reenable bfd on p0.
9111AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
9112# check log, should still be on log of thread created.
738cd849 9113AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
9114monitor thread created
9115])
9116# disable bfd and cfm together.
9117AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
9118# check log.
1335a8d5 9119OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
e441a806
AW
9120
9121OVS_VSWITCHD_STOP
9122AT_CLEANUP
9123
9124# this test helps avoid the deadlock between the main thread and monitor thread.
9125AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
9126OVS_VSWITCHD_START
9127
9128for i in `seq 1 199`
9129do
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])
9131done
9132
98cf638b
AW
9133OVS_VSWITCHD_STOP
9134AT_CLEANUP
98b07853
BP
9135\f
9136AT_BANNER([ofproto-dpif - flow translation resource limits])
9137
790c5d26
BP
9138dnl Resubmits to later tables do not count against the depth limit, so we
9139dnl can do 99 of them even though the maximum depth is 64.
9140AT_SETUP([ofproto-dpif - forward resubmit])
9141OVS_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
9147AT_CHECK([ovs-ofctl add-flows br0 flows])
9148AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
9149 [0], [stdout])
9150AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
9151])
9152OVS_VSWITCHD_STOP
9153AT_CLEANUP
9154
9155dnl Resubmits to the same or an earlier table count against the depth limit,
9156dnl so only 64 of them are allowed.
9157AT_SETUP([ofproto-dpif - backward resubmit])
9158OVS_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
9165AT_CHECK([ovs-ofctl add-flows br0 flows])
9166AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
9167 [0], [stdout])
9168AT_CHECK([tail -1 stdout], [0],
9169 [Translation failed (Recursion too deep), packet is dropped.
9170])
9171AT_CHECK([grep -c 'over max translation depth 64' stdout],
9172 [0], [1
9173])
9174OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
9175AT_CLEANUP
9176
98b07853
BP
9177AT_SETUP([ofproto-dpif - infinite resubmit])
9178OVS_VSWITCHD_START
9179AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
222820c6 9180AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
98b07853 9181 [0], [stdout])
fff1b9c0
JR
9182AT_CHECK([tail -1 stdout], [0],
9183 [Translation failed (Recursion too deep), packet is dropped.
98b07853 9184])
790c5d26 9185AT_CHECK([grep -c 'over max translation depth 64' stdout],
98b07853
BP
9186 [0], [1
9187])
9188OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
9189AT_CLEANUP
9190
d1ea2cc3
WT
9191dnl Without using ofproto/trace, make sure the
9192dnl ofproto trace is still logged
9193AT_SETUP([ofproto-dpif - backward resubmit without trace])
9194OVS_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
9201AT_CHECK([ovs-ofctl add-flows br0 flows])
9202
9203AT_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
29c536f5 9205OVS_WAIT_UNTIL([grep 'packet is dropped' ovs-vswitchd.log])
d1ea2cc3
WT
9206
9207dnl make sure the full ofproto trace dump is present
9208AT_CHECK([grep -c "^ *resubmit" ovs-vswitchd.log],
9209 [0], [66
9210])
9211
9212OVS_VSWITCHD_STOP(["/over max translation depth/d
9213/ofproto_dpif_upcall/d"])
9214AT_CLEANUP
9215
98b07853
BP
9216AT_SETUP([ofproto-dpif - exponential resubmit chain])
9217OVS_VSWITCHD_START
ca5792f0 9218add_of_ports br0 1
98b07853
BP
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])
222820c6 9225AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
9226AT_CHECK([tail -1 stdout], [0],
9227 [Translation failed (Too many resubmits), packet is dropped.
9228])
9229AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
98b07853
BP
9230])
9231OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
9232AT_CLEANUP
9233
9234AT_SETUP([ofproto-dpif - too many output actions])
9235OVS_VSWITCHD_START
ca5792f0 9236add_of_ports br0 1
98b07853
BP
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
542024c4 9242AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 9243AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
0f032e95
BP
9244AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
9245 [0], [1
98b07853 9246])
fff1b9c0 9247AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
542024c4 9248])
0f032e95 9249OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
98b07853
BP
9250AT_CLEANUP
9251
9252AT_SETUP([ofproto-dpif - stack too deep])
9253OVS_VSWITCHD_START
ca5792f0 9254add_of_ports br0 1
98b07853
BP
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])
222820c6 9262AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
9263AT_CHECK([tail -1 stdout], [0],
9264 [Translation failed (Stack too deep), packet is dropped.
9265])
9266AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
98b07853
BP
9267])
9268OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
9269AT_CLEANUP
d611866c
SH
9270
9271
2608616d 9272AT_SETUP([ofproto-dpif packet-out controller])
d611866c 9273OVS_VSWITCHD_START
ca5792f0 9274add_of_ports br0 1 2
d611866c
SH
9275
9276AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
9277
9278AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 9279AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
9280
9281for i in 1 2 3; do
5a0e4aec 9282 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
d611866c
SH
9283done
9284
d9c8c57c 9285OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
9286AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9287NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 9288vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9289dnl
9290NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 9291vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9292dnl
9293NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 9294vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9295])
9296
9297AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
9298 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9299NXST_FLOW reply:
9300])
9301
9d36d7d7
BP
9302AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0],
9303 [OFPST_TABLE reply (OF1.3) (xid=0x2):
3c1bb396 9304 table 0:
8811fc0a
BP
9305 active=1, lookup=0, matched=0
9306
9307 table 1:
9308 active=0, lookup=0, matched=0
9d36d7d7
BP
9309
9310 tables 2...253: ditto
9311])
d611866c
SH
9312
9313OVS_VSWITCHD_STOP
9314AT_CLEANUP
9315
2608616d 9316AT_SETUP([ofproto-dpif packet-out controller (patch port)])
d611866c
SH
9317OVS_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
9328AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 9329AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
9330
9331for i in 1 2 3; do
5a0e4aec 9332 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
d611866c
SH
9333done
9334
d9c8c57c 9335OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
9336AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9337NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 9338vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9339dnl
9340NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 9341vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9342dnl
9343NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 9344vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9345])
9346
9d36d7d7
BP
9347AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9348OFPST_TABLE reply (OF1.3) (xid=0x2):
8811fc0a
BP
9349 table 0:
9350 active=0, lookup=0, matched=0
d611866c 9351
9d36d7d7
BP
9352 tables 1...253: ditto
9353])
9354
9355AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1], [0], [dnl
9356OFPST_TABLE reply (OF1.3) (xid=0x2):
3c1bb396 9357 table 0:
8811fc0a
BP
9358 active=0, lookup=3, matched=0
9359
9360 table 1:
9361 active=0, lookup=0, matched=0
9d36d7d7
BP
9362
9363 tables 2...253: ditto
9364])
d611866c
SH
9365
9366OVS_VSWITCHD_STOP
9367AT_CLEANUP
9368
880b1458
YHW
9369AT_SETUP([ofproto-dpif packet-out pipeline match field (OpenFlow 1.5)])
9370OVS_VSWITCHD_START
9371
89d7927b
YHW
9372AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=8}->tun_metadata2"])
9373AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata3"])
880b1458
YHW
9374AT_DATA([flows.txt], [dnl
9375table=0,in_port=1 actions=controller
9376table=0,tun_id=3 actions=controller
9377table=0,metadata=5 actions=controller
9378table=0,reg0=1,reg4=2,reg8=3,reg12=5 actions=controller
9379table=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 actions=controller
89d7927b 9380table=0,tun_metadata3=0x11 actions=controller
880b1458
YHW
9381])
9382AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
9383
9384AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
9385ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
9386ovs-appctl -t ovs-ofctl ofctl/barrier
9387ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
9388AT_CAPTURE_FILE([monitor.log])
9389
9390AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=1 packet=0001020304050010203040501111 actions=table"])
9391AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tunnel_id=3 packet=0001020304050010203040502222 actions=table"])
9392AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,metadata=5 packet=0001020304050010203040503333 actions=table"])
9393AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,reg0=1,reg4=2,reg8=3,reg12=5 packet=0001020304050010203040503333 actions=table"])
9394AT_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"])
89d7927b 9395AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_metadata2=0x22,tun_metadata3=0x11 packet=0001020304050010203040503333 actions=table"])
880b1458
YHW
9396
9397ovs-appctl -t ovs-ofctl ofctl/barrier
9398OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9399
9400AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
9401OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 in_port=1 (via packet_out) data_len=14 (unbuffered)
9402vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1111
9403OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_id=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
9404vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x2222
9405OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 metadata=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
9406vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9407OFPT_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)
9408vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9409OFPT_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)
9410vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
89d7927b
YHW
9411OFPT_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)
9412vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
880b1458
YHW
9413OFPT_BARRIER_REPLY (OF1.5):
9414])
9415
9416OVS_VSWITCHD_STOP
9417AT_CLEANUP
d611866c 9418
2608616d 9419AT_SETUP([ofproto-dpif packet-out goto_table])
d611866c 9420OVS_VSWITCHD_START
ca5792f0 9421add_of_ports br0 1 2
d611866c
SH
9422
9423AT_DATA([flows.txt], [dnl
9424table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
9425table=1 dl_dst=50:54:00:00:00:0a actions=controller
9426])
9427AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
9428
9429AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 9430AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
9431
9432for 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)'
9434done
9435
9436OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 9437OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c 9438AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 9439NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9440vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9441dnl
efe179e0 9442NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9443vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9444dnl
efe179e0 9445NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9446vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9447])
9448
cea4a6d7 9449AT_CHECK([ovs-appctl revalidator/purge], [0])
d611866c 9450AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
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
d611866c
SH
9453OFPST_FLOW reply (OF1.3):
9454])
9455
9d36d7d7
BP
9456AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9457OFPST_TABLE reply (OF1.3) (xid=0x2):
3c1bb396
BP
9458 table 0:
9459 active=1, lookup=3, matched=3
9460
8811fc0a 9461 table 1: ditto
9d36d7d7 9462
8811fc0a
BP
9463 table 2:
9464 active=0, lookup=0, matched=0
9d36d7d7
BP
9465
9466 tables 3...253: ditto
9467])
d611866c
SH
9468
9469OVS_VSWITCHD_STOP
9470AT_CLEANUP
9471
9472
2608616d 9473AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
d611866c 9474OVS_VSWITCHD_START
ca5792f0 9475add_of_ports br0 1 2
d611866c 9476
3c1bb396
BP
9477AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
9478AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
d611866c
SH
9479
9480AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 9481AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
9482
9483for 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)'
9485done
9486
9487OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 9488OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c 9489AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 9490NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9491vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9492dnl
efe179e0 9493NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9494vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9495dnl
efe179e0 9496NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9497vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9498])
9499
cea4a6d7 9500AT_CHECK([ovs-appctl revalidator/purge], [0])
3c1bb396 9501AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 9502 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
3c1bb396 9503OFPST_FLOW reply (OF1.1):
d611866c
SH
9504])
9505
9d36d7d7
BP
9506AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9507OFPST_TABLE reply (OF1.3) (xid=0x2):
3c1bb396
BP
9508 table 0:
9509 active=0, lookup=3, matched=0
9510
9511 table 1:
8811fc0a
BP
9512 active=1, lookup=3, matched=3
9513
9514 table 2:
9515 active=0, lookup=0, matched=0
9d36d7d7
BP
9516
9517 tables 3...253: ditto
9518])
d611866c
SH
9519
9520OVS_VSWITCHD_STOP
9521AT_CLEANUP
b0e2ec32
JR
9522
9523AT_SETUP([ofproto-dpif - ICMPv6])
9524OVS_VSWITCHD_START
ca5792f0 9525add_of_ports br0 1
b0e2ec32
JR
9526
9527AT_CAPTURE_FILE([ofctl_monitor.log])
9528
6409e008 9529AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b0e2ec32
JR
9530
9531ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9532
d9c8c57c 9533OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
b0e2ec32
JR
9534
9535AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9536NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
e6d9ab56 9537icmp6,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
b0e2ec32
JR
9538])
9539
9540OVS_VSWITCHD_STOP
9541AT_CLEANUP
e60e935b 9542
8ecb3068
DDP
9543AT_SETUP([ofproto-dpif - ICMPv6 type match])
9544OVS_VSWITCHD_START
9545add_of_ports br0 1 2 3
9546
9547AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
9548AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
9549
9550AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9551
9552AT_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)'])
9553AT_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)'])
9554AT_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)'])
9555AT_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
9557AT_CHECK([ovs-appctl revalidator/purge], [0])
9558
9559AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
9560recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128), actions:2
9561recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129), actions:3
8ecb3068
DDP
9562])
9563
9564AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379
BP
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
8ecb3068
DDP
9567NXST_FLOW reply:
9568])
9569
9570OVS_VSWITCHD_STOP
9571AT_CLEANUP
9572
e60e935b
SRCSA
9573AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
9574OVS_VSWITCHD_START
ca5792f0 9575add_of_ports br0 1
e60e935b
SRCSA
9576AT_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
9578AT_CAPTURE_FILE([ofctl_monitor.log])
9579
6409e008 9580AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
e60e935b
SRCSA
9581
9582ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9583
d9c8c57c 9584OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
e60e935b
SRCSA
9585
9586AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9587NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
e6d9ab56 9588icmp6,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
e60e935b
SRCSA
9589])
9590
9591OVS_VSWITCHD_STOP
9592AT_CLEANUP
9593
f171fa88
AW
9594# Tests the exact match of CFI bit in installed datapath flows matching VLAN.
9595AT_SETUP([ofproto-dpif - vlan matching])
9596OVS_VSWITCHD_START(
9597 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
9598AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9599
9600AT_CHECK([ovs-ofctl del-flows br0])
9601AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
9602
9603AT_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
47567945 9605OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
9044f2c1 9606AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
3d4b2e6e 9607recirc_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>
f171fa88
AW
9608])
9609OVS_VSWITCHD_STOP
9610AT_CLEANUP
43b2f131
EJ
9611
9612# Tests in place modification of installed datapath flows.
9613AT_SETUP([ofproto-dpif - in place modification])
9614OVS_VSWITCHD_START(
9615 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9616AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9617
9618AT_CHECK([ovs-ofctl del-flows br0])
9619AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
9620
9621ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9622
9623ovs-appctl time/stop
9624
ed8ac2a0
JR
9625AT_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.
9628OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9629
9630for i in 1 2; do
43b2f131
EJ
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)'
9632done
9633
3a18d0c2 9634AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9635recirc_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
43b2f131
EJ
9636])
9637
9638AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
9639
9640ovs-appctl time/warp 500
9641ovs-appctl time/warp 500
9642
9643for 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)'
9645done
9646
3a18d0c2 9647AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9648recirc_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
43b2f131
EJ
9649])
9650
38b0b29f 9651AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
3d4b2e6e 9652dpif|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
43b2f131
EJ
9653])
9654OVS_VSWITCHD_STOP
9655AT_CLEANUP
449b8131
JR
9656
9657# Tests in place modification of installed datapath flows with vlans.
9658AT_SETUP([ofproto-dpif - in place modification (vlan)])
9659OVS_VSWITCHD_START(
9660 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9661AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9662
49a832f7
DB
9663# Always drop misses
9664AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all drop])
449b8131
JR
9665AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
9666
9667ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9668
9669ovs-appctl time/stop
9670
ed8ac2a0
JR
9671AT_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
449b8131 9673# Check that a correct datapath flow is created.
ed8ac2a0
JR
9674OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9675
9676for i in 1 2; do
449b8131
JR
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)'
9678done
9679
3a18d0c2 9680AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9681recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:100
449b8131
JR
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.
9687AT_CHECK([ovs-ofctl del-flows br0])
9688
9689ovs-appctl time/warp 500
9690ovs-appctl time/warp 500
9691
9692for 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)'
9694done
9695
3a18d0c2 9696AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9697recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:drop
449b8131
JR
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.
9702AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
9703
9704ovs-appctl time/warp 500
9705ovs-appctl time/warp 500
9706
9707for 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)'
9709done
9710
3a18d0c2 9711AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9712recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
449b8131
JR
9713])
9714
9715# Check that VLAN packets will not hit the same datapath megaflow.
ed8ac2a0
JR
9716
9717AT_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))'])
9044f2c1 9718OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
ed8ac2a0
JR
9719
9720for i in 1 2; do
449b8131
JR
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))'
9722done
9723
3a18d0c2 9724AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e
JS
9725recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9726recirc_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
449b8131
JR
9727])
9728
9729# Check that the new flow matches the CFI bit, while both vid and pcp
9730# are wildcarded.
38b0b29f 9731AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
3d4b2e6e 9732dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), actions:100
a13a0209 9733dpif|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
3d4b2e6e
JS
9734dpif|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
9735dpif_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
449b8131
JR
9736])
9737OVS_VSWITCHD_STOP
9738AT_CLEANUP
56de2148
YT
9739
9740AT_SETUP([ofproto-dpif - trace (unchanged)])
9741OVS_VSWITCHD_START
9742AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
9743AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9744])
9745AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
9746AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9747])
ed708b5d
DDP
9748
9749OVS_VSWITCHD_STOP
9750AT_CLEANUP
9751
9752AT_SETUP([ofproto-dpif - conntrack - controller])
9753OVS_VSWITCHD_START
9754
9755add_of_ports br0 1 2
9756
9757AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9758
2cd20955 9759dnl Allow new UDP connections on p1 for dst port 2, drop everything else.
ed708b5d 9760AT_DATA([flows.txt], [dnl
a103c1f4 9761dnl Table 0
2cd20955 9762dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2).
a103c1f4
DDP
9763dnl
9764table=0,priority=100,arp,action=normal
2cd20955
JR
9765table=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)
9766table=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)
a103c1f4
DDP
9767table=0,priority=1,action=drop
9768dnl
2cd20955
JR
9769dnl Pass tracked traffic through ACL, drop everything else.
9770dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers
9771dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets
9772dnl get the ACL lookup using the conntrack tuple and the inverted direction.
9773dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
f51cf36d 9774dnl of the parent connection, as storted in ct_mark.
2cd20955
JR
9775dnl
9776dnl Incoming non-related packet in the original direction (ACL IN)
9777table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5
9778dnl Incoming non-related reply packet (CT ACL OUT)
9779table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4
9780dnl Outgoing non-related packet (ACL OUT)
9781table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5
9782dnl Outgoing non-related reply packet (CT ACL IN)
9783table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
9784dnl
f51cf36d 9785dnl Related packet (CT ACL in the direction of the parent connection.)
2cd20955
JR
9786table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
9787dnl Drop everything else.
9788table=1 priority=0, action=drop
9789dnl
9790dnl "ACL table"
9791dnl
9792dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with
9793dnl UDP destination port '2'. Store rule ID (1234) in reg1, verdict
9794dnl in reg2.
9795table=3 priority=10, reg0=1, udp, udp_dst=2 action=set_field:1234->reg1,set_field:1->reg2
9796dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235)
9797table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2
9798dnl
9799dnl Re-process stateful traffic that was not accepted by a stateful rule as
9800dnl normal traffic in the current direction. This should also delete the
9801dnl now stale conntrack state, so that new state can be created in it's place.
9802dnl
9803dnl Stateful accepts go to next table.
9804table=4 priority=100 reg2=1, action=goto_table:5
9805dnl Everything else is reprocessed disregarding the CT state, using the actual
9806dnl packet direction.
9807table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5
9808dnl
9809dnl "ACL verdict processing table."
9810dnl
9811dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0)
9812dnl
9813dnl Drop all non-accepted packets.
9814table=5 reg2=0 priority=1000 action=drop
9815dnl Commit new non-related IP connections.
9816table=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
9817dnl Commit new related connections in either direction, which inherit the mark
f51cf36d 9818dnl (the direction of the original direction parent tuple) from the parent
2cd20955
JR
9819dnl connection.
9820table=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
9821dnl Forward everything else, including stateless accepts.
9822table=5 priority=0 action=goto_table:6
9823dnl
9824dnl "Forwarding table"
9825dnl
9826table=6 action=controller
ed708b5d
DDP
9827])
9828
9829AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9830
9831AT_CAPTURE_FILE([ofctl_monitor.log])
9832AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9833
9834AT_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
9836dnl OK, now start a new connection from port 1.
9837AT_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
9839dnl Now try a reply from port 2.
9840AT_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
9842OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9843OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9844
9845dnl Check this output. We only see the latter two packets, not the first.
ed708b5d 9846AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9847NXT_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)
9848udp,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
ed708b5d 9849dnl
6f068379
BP
9850NXT_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)
9851udp,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
ed708b5d
DDP
9852])
9853
9854AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9855
9856dnl OK, now start a second connection from port 1
2cd20955 9857AT_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)'])
ed708b5d
DDP
9858
9859dnl Now try a reply from port 2.
2cd20955 9860AT_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)'])
ed708b5d
DDP
9861
9862
9863OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9864OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9865
9866dnl Check this output. We should see both packets
ed708b5d 9867AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9868NXT_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)
9869udp,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
ed708b5d 9870dnl
6f068379
BP
9871NXT_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)
9872udp,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
ed708b5d
DDP
9873])
9874
9875OVS_VSWITCHD_STOP
9876AT_CLEANUP
9877
a76a37ef
JR
9878AT_SETUP([ofproto-dpif - conntrack - force commit])
9879OVS_VSWITCHD_START
9880
9881add_of_ports br0 1 2
9882
9883AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9884
9885dnl Allow new connections on p1->p2, but not on p2->p1.
9886AT_DATA([flows.txt], [dnl
9887dnl Table 0
9888dnl
9889table=0,priority=100,arp,action=normal
9890table=0,priority=10,in_port=1,udp,action=ct(commit),controller
9891table=0,priority=10,in_port=2,udp,action=ct(table=1)
9892table=0,priority=1,action=drop
9893dnl
9894dnl Table 1
9895dnl
9896table=1,priority=10,in_port=2,ct_state=+est,udp,action=ct(force,commit),controller
9897table=1,priority=1,action=drop
9898])
9899
9900AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9901
9902AT_CAPTURE_FILE([ofctl_monitor.log])
9903AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9904
9905AT_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
9907dnl OK, now start a new connection from port 1.
9908AT_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
9910dnl Now try a reply from port 2.
9911AT_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
9913OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9914OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9915
9916dnl Check this output. We only see the latter two packets, not the first.
9917dnl Note that the first packet doesn't have the ct_state bits set. This
9918dnl happens because the ct_state field is available only after recirc.
9919AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9920NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9921udp,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
a76a37ef 9922dnl
6f068379
BP
9923NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9924udp,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
a76a37ef
JR
9925])
9926
9927AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9928
9929dnl OK, now start a second connection from port 1
9930AT_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
9932dnl Now try a reply from port 2.
9933AT_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
9935OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9936OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9937
9938dnl Check this output. We should see both packets
9939dnl Note that the first packet doesn't have the ct_state bits set. This
9940dnl happens because the ct_state field is available only after recirc.
9941AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9942NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9943udp,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
a76a37ef 9944dnl
6f068379
BP
9945NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9946udp,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
a76a37ef
JR
9947])
9948
9949dnl
9950dnl Check that the directionality has been changed by force commit.
9951dnl
9952AT_CHECK([ovs-appctl dpctl/dump-conntrack | sort], [], [dnl
9953udp,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)
9954udp,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
9957OVS_VSWITCHD_STOP
9958AT_CLEANUP
9959
ed708b5d
DDP
9960AT_SETUP([ofproto-dpif - conntrack - ipv6])
9961OVS_VSWITCHD_START
9962
9963add_of_ports br0 1 2
9964
9965AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9966
9967dnl Allow new connections on p1->p2, but not on p2->p1.
9968AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9969dnl Table 0
9970dnl
9971table=0,priority=100,arp,action=normal
9972table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
9973table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
9974table=0,priority=1,action=drop
9975dnl Table 1
9976dnl
9977table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
9978table=1,priority=1,action=drop
ed708b5d
DDP
9979])
9980
9981AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9982
9983AT_CAPTURE_FILE([ofctl_monitor.log])
9984AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9985
9986AT_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
9988dnl OK, now start a new connection from port 1.
9989AT_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
9991dnl Now try a reply from port 2.
9992AT_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
9994OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9995OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9996
9997dnl Check this output. We only see the latter two packets, not the first.
9998dnl Note that the first packet doesn't have the ct_state bits set. This
9999dnl happens because the ct_state field is available only after recirc.
10000AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10001NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
10002udp6,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
10003NXT_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)
10004udp6,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
ed708b5d
DDP
10005])
10006
10007OVS_VSWITCHD_STOP
10008AT_CLEANUP
10009
10010AT_SETUP([ofproto-dpif - conntrack - output action])
10011OVS_VSWITCHD_START
10012
10013add_of_ports br0 1 2
10014
10015AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10016
10017dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10018AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10019dnl The flows are in two separate tables for two reasons:
10020dnl * To make the pipeline more clear.
10021dnl * To make megaflows more consistent (we check megaflows below). The
10022dnl unwildcarding in megaflows depends on the internal ordering of the
10023dnl subtables, which are sorted using the system qsort(). qsort()
10024dnl is provided by libc and may or may not be stable, so we can't rely
10025dnl on that. By having separate tables we have more control over which
10026dnl subtables are visited, meaning consistent megaflows.
10027dnl
10028dnl Table 0
10029dnl
10030table=0,priority=100,arp,action=normal
10031table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
10032table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10033table=0,priority=1,action=drop
10034dnl
10035dnl Table 1
10036dnl
10037table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
10038table=1,priority=1,action=drop
ed708b5d
DDP
10039])
10040
10041AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10042
10043
10044AT_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
10046dnl OK, now start a new connection from port 1.
10047AT_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
10049dnl Now try a reply from port 2.
10050AT_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
10052dnl OK, now start a second connection from port 1
10053AT_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
10055dnl Now try a reply from port 2.
10056AT_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
10059AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
3d4b2e6e
JS
10060ct_state(+new-est+trk),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:drop
10061ct_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
10062recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
10063recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct,recirc(0x1)
ed708b5d
DDP
10064])
10065
10066OVS_VSWITCHD_STOP
10067AT_CLEANUP
10068
10069AT_SETUP([ofproto-dpif - conntrack - expiration])
10070OVS_VSWITCHD_START
10071
10072add_of_ports br0 1 2
10073
10074AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10075
10076dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10077AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10078dnl Table 0
10079dnl
10080table=0,priority=100,arp,action=normal
10081table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
10082table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10083table=0,priority=1,action=drop
10084dnl
10085dnl Table 1
10086dnl
10087table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
10088table=1,priority=1,action=drop
ed708b5d
DDP
10089])
10090
10091AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10092
10093AT_CAPTURE_FILE([ofctl_monitor.log])
10094AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10095
10096AT_CHECK([ovs-appctl time/stop])
10097
10098dnl Start a new connection from port 1.
10099AT_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
10101dnl Now try a reply from port 2.
10102AT_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
10104ovs-appctl time/warp 100000
10105
10106dnl Now try another reply from port 2.
10107AT_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
10109OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
10110OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10111
10112dnl Check this output. Only one reply must be there
10113AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10114NXT_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)
10115udp,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
ed708b5d
DDP
10116dnl
10117OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
10118])
10119
10120OVS_VSWITCHD_STOP
10121AT_CLEANUP
10122
10123AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
10124OVS_VSWITCHD_START
10125
10126add_of_ports br0 1 2
10127
10128AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10129
10130AT_DATA([flows.txt], [dnl
ed26e3ea 10131ipv6,ct_state=-trk,action=ct(table=0,zone=0)
ed708b5d
DDP
10132ct_state=+trk,action=controller
10133])
10134
10135AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10136
10137AT_CAPTURE_FILE([ofctl_monitor.log])
10138AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10139
10140AT_CHECK([ovs-appctl time/stop])
10141
ed26e3ea 10142AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
ed708b5d
DDP
10143
10144OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
10145OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10146
10147AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7827edca 10148NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,ipv6,in_port=2 (via action) data_len=86 (unbuffered)
ed26e3ea 10149icmp6,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
ed708b5d
DDP
10150])
10151
10152OVS_VSWITCHD_STOP
10153AT_CLEANUP
10154
10155AT_SETUP([ofproto-dpif - conntrack - zones])
10156OVS_VSWITCHD_START
10157
10158add_of_ports br0 1 2 3 4
10159
10160AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10161
10162dnl Allow new connections on p1->p2 or p3->p4.
10163dnl Allow only established connections p2->p1 and p4->p3
10164dnl p1,p2 and p3,p4 are on different zones
10165AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10166dnl Table 0
10167dnl
10168table=0,priority=100,arp,action=normal
10169table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
10170table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10171table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
10172table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
10173table=0,priority=1,action=drop
10174dnl
10175dnl Table 1
10176dnl
10177table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
10178table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
10179table=1,priority=1,action=drop
ed708b5d
DDP
10180])
10181
10182AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10183
10184AT_CAPTURE_FILE([ofctl_monitor.log])
10185AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10186
10187dnl Basic "only established" test on ports 1,2
10188
10189AT_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)'])
10190AT_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)'])
10191AT_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
10193dnl Now use the same 5-tuples but on ports 3,4
10194
10195AT_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)'])
10196AT_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)'])
10197AT_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
10199OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
10200OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10201
10202dnl Check this output. We only see the latter two packets (for each zone), not the first.
10203AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10204NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10205udp,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
ed708b5d 10206dnl
6f068379
BP
10207NXT_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)
10208udp,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
ed708b5d 10209dnl
6f068379
BP
10210NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=3 (via action) data_len=106 (unbuffered)
10211udp,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
ed708b5d 10212dnl
6f068379
BP
10213NXT_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)
10214udp,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
ed708b5d
DDP
10215])
10216
ed708b5d
DDP
10217OVS_VSWITCHD_STOP
10218AT_CLEANUP
10219
10220AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
10221OVS_VSWITCHD_START
10222
10223add_of_ports br0 1 2
10224
10225AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10226
10227dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10228AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10229dnl Table 0
10230dnl
10231table=0,priority=100,arp,action=normal
10232table=0,priority=10,udp,action=ct(table=1,zone=0)
10233table=0,priority=1,action=drop
10234dnl
10235dnl Table 1
10236dnl
10237table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
10238table=1,priority=10,ct_state=+trk+est,udp,action=controller
10239table=1,priority=1,action=drop
ed708b5d
DDP
10240])
10241
10242AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10243
10244AT_CAPTURE_FILE([ofctl_monitor.log])
10245AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10246
10247AT_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
10249dnl OK, now start a new connection from port 1.
10250AT_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
10252dnl Now try a reply from port 2.
10253AT_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
10255OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10256OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10257
10258dnl Check this output. We only see the latter two packets, not the first.
10259AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10260NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10261udp,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
ed708b5d 10262dnl
6f068379
BP
10263NXT_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)
10264udp,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
ed708b5d
DDP
10265])
10266
10267OVS_VSWITCHD_STOP
10268AT_CLEANUP
10269
10270AT_SETUP([ofproto-dpif - conntrack - ICMP related])
10271OVS_VSWITCHD_START
10272
10273add_of_ports br0 1 2
10274
10275dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
10276AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10277dnl Table 0
10278dnl
10279table=0,priority=100,arp,action=normal
ed26e3ea
JR
10280table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
10281table=0,priority=10,ip,in_port=2,action=ct(table=1)
a103c1f4
DDP
10282table=0,priority=1,action=drop
10283dnl
10284dnl Table 1
10285dnl
10286table=1,priority=10,in_port=1,ct_state=+trk,action=controller
10287table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
10288table=1,priority=1,action=drop
ed708b5d
DDP
10289])
10290
10291AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10292
10293AT_CAPTURE_FILE([ofctl_monitor.log])
10294AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10295
10296dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
a103c1f4 10297AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
ed708b5d
DDP
10298
10299dnl 2. Send and UDP packet to port 5555
a103c1f4 10300AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
ed708b5d
DDP
10301
10302dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
a103c1f4 10303AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
ed708b5d
DDP
10304
10305OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10306OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10307
10308dnl Check this output. We only see the first and the last packet
10309AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7827edca 10310NXT_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)
ed708b5d
DDP
10311udp,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
10312dnl
7827edca 10313NXT_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)
ed708b5d
DDP
10314icmp,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
10317OVS_VSWITCHD_STOP
10318AT_CLEANUP
10319
10320AT_SETUP([ofproto-dpif - conntrack - ct_mark])
10321OVS_VSWITCHD_START
10322
10323add_of_ports br0 1 2
10324
10325AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10326
10327dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10328AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10329dnl Table 0
10330dnl
ed26e3ea
JR
10331table=0,arp,action=normal
10332table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
10333table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
10334table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
10335table=0,ip,in_port=2,actions=ct(table=1)
10336table=0,priority=0,action=drop
a103c1f4
DDP
10337dnl
10338dnl Table 1
10339dnl
10340table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
10341table=1,priority=1,action=drop
ed708b5d
DDP
10342])
10343
10344AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10345
10346AT_CAPTURE_FILE([ofctl_monitor.log])
10347AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10348
10349AT_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)'])
10350AT_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)'])
10351AT_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
10353AT_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)'])
10354AT_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)'])
10355AT_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
10357OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
10358OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10359
10360dnl Check this output.
10361AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10362NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10363udp,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
ed708b5d 10364dnl
6f068379
BP
10365NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10366udp,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
ed708b5d 10367dnl
6f068379
BP
10368NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10369udp,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
ed708b5d 10370dnl
6f068379
BP
10371NXT_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)
10372udp,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
ed708b5d 10373dnl
6f068379
BP
10374NXT_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)
10375udp,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
ed708b5d
DDP
10376])
10377
10378OVS_VSWITCHD_STOP
10379AT_CLEANUP
10380
10381AT_SETUP([ofproto-dpif - conntrack - ct_label])
10382OVS_VSWITCHD_START
10383
10384add_of_ports br0 1 2
10385
10386AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10387
10388dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10389AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10390dnl Table 0
10391dnl
ed26e3ea
JR
10392table=0,arp,action=normal
10393table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
10394table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
10395table=0,ip,in_port=2,actions=ct(table=1)
a103c1f4
DDP
10396dnl
10397dnl Table 1
10398dnl
10399table=1,priority=10,ct_state=+trk+rpl,actions=controller
10400table=1,priority=1,action=drop
ed708b5d
DDP
10401])
10402
10403AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10404
10405AT_CAPTURE_FILE([ofctl_monitor.log])
10406AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10407
10408AT_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)'])
10409AT_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
10411AT_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)'])
10412AT_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
10414OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10415OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10416
10417dnl Check this output.
10418AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10419NXT_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)
10420udp,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
ed708b5d 10421dnl
6f068379
BP
10422NXT_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)
10423udp,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
ed708b5d
DDP
10424])
10425
10426OVS_VSWITCHD_STOP
10427AT_CLEANUP
10428
10429AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
10430OVS_VSWITCHD_START
10431
10432add_of_ports br0 1 2
10433
10434AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10435
10436dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10437AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10438dnl The flows are in two separate tables for two reasons:
10439dnl * To make the pipeline more clear.
10440dnl * To make megaflows more consistent (we check megaflows below). The
10441dnl unwildcarding in megaflows depends on the internal ordering of the
10442dnl subtables, which are sorted using the system qsort(). qsort()
10443dnl is provided by libc and may or may not be stable, so we can't rely
10444dnl on that. By having separate tables we have more control over which
10445dnl subtables are visited, meaning consistent megaflows.
10446dnl
10447dnl Table 0
10448dnl
ed26e3ea
JR
10449table=0,arp,action=normal
10450table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
10451table=0,ip,in_port=2,actions=ct(table=1)
10452table=0,priority=0,action=drop
a103c1f4
DDP
10453dnl
10454dnl Table 1
10455dnl
10456table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
10457table=1,priority=1,action=drop
ed708b5d
DDP
10458])
10459
10460AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10461
10462AT_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)'])
10463AT_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
a76a37ef
JR
10465# Give time for logs to appear.
10466ovs-appctl revalidator/wait
10467
ed708b5d 10468AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
3d4b2e6e
JS
10469ct_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
10470recirc_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
10471recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
ed708b5d
DDP
10472])
10473
10474OVS_VSWITCHD_STOP
10475AT_CLEANUP
10476
10477AT_SETUP([ofproto-dpif - conntrack - no output])
10478OVS_VSWITCHD_START
10479
10480add_of_ports br0 1
10481
10482AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10483
10484dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10485AT_DATA([flows.txt], [dnl
10486in_port=1,udp,action=ct(commit,zone=0)
10487])
10488
10489AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10490
10491dnl Start a new connection from port 1.
10492AT_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
10494AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
3d4b2e6e 10495recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
ed708b5d
DDP
10496])
10497
10498OVS_VSWITCHD_STOP
10499AT_CLEANUP
10500
10501AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
10502OVS_VSWITCHD_START
10503
10504add_of_ports br0 1 2
10505
10506AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10507
10508dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10509AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10510dnl Table 0
10511dnl
10512table=0,priority=100,arp,action=normal
10513table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10514table=0,priority=10,in_port=2,ip,action=ct(table=1)
10515table=0,priority=1,action=drop
10516dnl
10517dnl Table 1
10518dnl
ed708b5d
DDP
10519dnl The following two flows are separated to explicitly count the packets
10520dnl that create a new connection
a103c1f4
DDP
10521table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10522table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
ed708b5d 10523dnl
a103c1f4
DDP
10524table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10525table=1,ip,ct_state=+trk+inv,action=drop
ed708b5d
DDP
10526])
10527
10528AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10529
10530AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10531AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10532AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10533AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
10534AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10535AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10536AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10537AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10538AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10539
10540AT_CHECK([ovs-appctl revalidator/purge])
10541AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10542dnl Only one new connection
10543n_packets=1
10544])
10545
10546AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
10547AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
10548AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
10549AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
10550AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
10551AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
10552AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
10553AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
10554AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
10555
10556AT_CHECK([ovs-appctl revalidator/purge])
10557AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10558dnl Two new connections
10559n_packets=2
10560])
10561
10562OVS_VSWITCHD_STOP
10563AT_CLEANUP
10564
10565AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
10566OVS_VSWITCHD_START
10567
10568add_of_ports br0 1 2
10569
10570AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10571
10572dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10573AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10574dnl Table 0
10575dnl
10576table=0,priority=100,arp,action=normal
10577table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
10578table=0,priority=10,in_port=2,tcp,action=ct(table=1)
10579table=0,priority=1,action=drop
10580dnl
10581dnl Table 1
10582dnl
10583table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
10584table=1,priority=1,action=drop
ed708b5d
DDP
10585])
10586
10587AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10588
10589AT_CHECK([ovs-appctl revalidator/purge])
10590AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10591dnl No dropped packets
10592n_packets=0
10593])
10594
10595AT_CAPTURE_FILE([ofctl_monitor.log])
10596AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10597
10598dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
10599dnl sure that the connection tracker is able to pick up already established
10600dnl connections that use window scaling.
10601dnl
10602dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
10603dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
10604AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
10605AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
10606AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
10607AT_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'])
10618AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
10619AT_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'])
10629AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
10630AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
10631AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
10632AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
10633AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
10634
10635AT_CHECK([ovs-appctl revalidator/purge])
10636
10637OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10638
10639AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10640])
10641
10642AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10643dnl No dropped packets
10644n_packets=0
10645])
10646
56de2148
YT
10647OVS_VSWITCHD_STOP
10648AT_CLEANUP
ae59d134 10649
64207120
DB
10650AT_SETUP([ofproto-dpif - conntrack - disable tcp sequence checking])
10651OVS_VSWITCHD_START
10652
10653add_of_ports br0 1 2
10654
10655dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10656AT_DATA([flows.txt], [dnl
10657dnl Table 0
10658dnl
10659table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10660table=0,priority=10,in_port=2,ip,action=ct(table=1)
10661table=0,priority=1,action=drop
10662dnl
10663dnl Table 1
10664dnl
10665dnl The following two flows are separated to explicitly count the packets
10666dnl that create a new connection
10667table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10668table=1,priority=100,cookie=0x2,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
10669dnl
10670table=1,priority=100,cookie=0x3,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10671table=1,cookie=0x4,ip,ct_state=+trk+inv,action=drop
10672])
10673
10674AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10675
10676dnl Send 9 packets; one packet will be marked invalid.
10677AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10678AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10679AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10680AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10681AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10682AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10683AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10684AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10685AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10686
10687AT_CHECK([ovs-appctl revalidator/purge])
10688AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10689n_packets=1
10690])
10691
10692AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10693n_packets=4
10694])
10695
10696AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10697n_packets=3
10698])
10699
10700AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10701n_packets=1
10702])
10703
10704AT_CHECK([ovs-appctl dpctl/flush-conntrack])
10705
10706AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10707TCP sequence checking: enabled
10708])
10709
10710AT_CHECK([ovs-appctl dpctl/ct-disable-tcp-seq-chk], [], [dnl
10711disabling TCP sequence checking successful
10712])
10713
10714AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10715TCP sequence checking: disabled
10716])
10717
10718dnl Send exactly the same 9 packets to confirm no additional packets are marked invalid.
10719AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10720AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10721AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10722AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10723AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10724AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10725AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10726AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10727AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10728
10729AT_CHECK([ovs-appctl revalidator/purge])
10730AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10731n_packets=2
10732])
10733
10734AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10735n_packets=8
10736])
10737
10738AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10739n_packets=7
10740])
10741
10742AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10743n_packets=1
10744])
10745
10746AT_CHECK([ovs-appctl dpctl/ct-enable-tcp-seq-chk], [], [dnl
10747enabling TCP sequence checking successful
10748])
10749
10750AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10751TCP sequence checking: enabled
10752])
10753
10754AT_CHECK([ovs-appctl dpctl/flush-conntrack])
10755
10756dnl Send exactly the same 9 packets after disabling TCP sequence checking to
10757dnl confirm one more packet is marked invalid.
10758AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10759AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10760AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10761AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10762AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10763AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10764AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10765AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10766AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10767
10768AT_CHECK([ovs-appctl revalidator/purge])
10769AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10770n_packets=3
10771])
10772
10773AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10774n_packets=12
10775])
10776
10777AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10778n_packets=10
10779])
10780
10781AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10782n_packets=2
10783])
10784
10785OVS_VSWITCHD_STOP
10786AT_CLEANUP
10787
72fe7578
BP
10788dnl This is a truncated version of "ofproto-dpif - conntrack - controller",
10789dnl with extra send-to-controller actions following ct_clear to show that
10790dnl the connection tracking data has been cleared.
10791AT_SETUP([ofproto-dpif - conntrack - ct_clear])
10792OVS_VSWITCHD_START
10793
10794add_of_ports br0 1 2
10795
10796AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10797
10798dnl Allow new connections on p1->p2, but not on p2->p1.
10799AT_DATA([flows.txt], [dnl
10800dnl Table 0
10801dnl
10802table=0,priority=100,arp,action=normal
10803table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller,ct_clear,controller
10804table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10805table=0,priority=1,action=drop
10806dnl
10807dnl Table 1
10808dnl
10809table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller,ct_clear,controller
10810table=1,priority=1,action=drop
10811])
10812
10813AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10814
10815AT_CAPTURE_FILE([ofctl_monitor.log])
10816AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10817
10818AT_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
10820dnl OK, now start a new connection from port 1.
10821AT_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
10823dnl Now try a reply from port 2.
10824AT_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
10826OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
10827OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10828
10829dnl Check this output. We only see the latter two packets, not the first.
10830dnl Note that the first packet doesn't have the ct_state bits set. This
10831dnl happens because the ct_state field is available only after recirc.
10832AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10833NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10834udp,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
72fe7578 10835dnl
6f068379
BP
10836NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10837udp,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
72fe7578 10838dnl
6f068379
BP
10839NXT_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)
10840udp,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
72fe7578 10841dnl
6f068379
BP
10842NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
10843udp,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
72fe7578
BP
10844])
10845OVS_VSWITCHD_STOP
10846AT_CLEANUP
10847
1740aaf4
YHW
10848AT_SETUP([ofproto-dpif - conntrack - match masked ct fields])
10849OVS_VSWITCHD_START
10850
10851add_of_ports br0 1 2
10852
10853AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10854
10855dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10856AT_DATA([flows.txt], [dnl
10857table=0,arp,action=normal
10858table=0,ip,in_port=1,udp,nw_src=10.1.2.1/24,action=ct(commit)
10859table=0,ip,in_port=1,udp6,ipv6_dst=2001:db8::1/64,action=ct(commit)
10860table=0,ip,in_port=1,udp,tp_src=3/0x1,action=ct(commit)
10861table=0,ip,in_port=2,actions=ct(table=1)
10862table=0,ip6,in_port=2,actions=ct(table=1)
10863table=1,priority=10,udp,ct_state=+trk+rpl,ct_nw_src=10.1.2.1/24,actions=controller
10864table=1,priority=10,udp6,ct_state=+trk+rpl,ct_ipv6_dst=2001:db8::1/64,actions=controller
10865table=1,priority=10,udp,ct_state=+trk+rpl,ct_tp_src=3/0x1,actions=controller
10866table=1,priority=1,action=drop
10867])
10868
10869AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10870
10871AT_CAPTURE_FILE([ofctl_monitor.log])
10872AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10873
10874dnl Match ct_nw_src=10.1.2.1/24
10875AT_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)'])
10876AT_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
10878dnl Match ct_ipv6_dst=2001:db8::1/64
10879AT_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)'])
10880AT_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
10882dnl Match ct_tp_src=3/0x1
10883AT_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)'])
10884AT_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
10886OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
10887OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10888
10889dnl Check this output.
10890AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10891NXT_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)
10892udp,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
10893dnl
10894NXT_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)
10895udp6,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
10896dnl
10897NXT_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)
10898udp,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
10901OVS_VSWITCHD_STOP
10902AT_CLEANUP
10903
e6bc8e74
YHW
10904AT_SETUP([ofproto-dpif - conntrack - ofproto/trace])
10905OVS_VSWITCHD_START
10906
0f2f05bb 10907add_of_ports br0 1 2 3 4
e6bc8e74
YHW
10908
10909AT_DATA([flows.txt], [dnl
10910dnl Table 0
10911dnl
10912table=0,priority=100,arp,action=normal
10913table=0,priority=10,udp,action=ct(table=1,zone=0)
0f2f05bb 10914table=0,priority=10,tcp,action=ct(table=2,zone=1)
e6bc8e74
YHW
10915table=0,priority=1,action=drop
10916dnl
10917dnl Table 1
10918dnl
5fdd80cc
YHW
10919table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+new,udp,action=ct(commit,zone=0),2
10920table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+est,udp,action=2
10921table=1,priority=10,in_port=2,ct_zone=0,ct_state=+trk+est,udp,action=1
e6bc8e74 10922table=1,priority=1,action=drop
0f2f05bb
YHW
10923dnl
10924dnl Table 2
10925dnl
5fdd80cc
YHW
10926table=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)
10927table=2,priority=10,in_port=1,tcp,ct_zone=1,ct_state=+trk+est,tcp,action=ct(table=3,zone=2)
0f2f05bb
YHW
10928table=2,priority=1,action=drop
10929dnl
10930dnl Table 3
10931dnl
5fdd80cc
YHW
10932table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+new,tcp,action=ct(commit,zone=2),4
10933table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+est,tcp,action=3
0f2f05bb 10934table=2,priority=1,action=drop
e6bc8e74
YHW
10935])
10936
10937AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10938
10939AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,udp'], [0], [stdout])
10940AT_CHECK([tail -1 stdout], [0],
10941 [Datapath actions: drop
10942])
10943
10944AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,udp'], [0], [stdout])
10945AT_CHECK([tail -1 stdout], [0],
10946 [Datapath actions: ct(commit),2
10947])
10948
0f2f05bb
YHW
10949AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp'], [0], [stdout])
10950AT_CHECK([tail -1 stdout], [0],
10951 [Datapath actions: ct(commit,zone=2),4
10952])
10953
10954AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp' --ct-next 'trk,est' --ct-next 'trk,est' ], [0], [stdout])
d072d2de
DC
10955AT_CHECK([tail -1 stdout], [0],
10956 [Datapath actions: 3
10957])
10958
10959OVS_VSWITCHD_STOP
10960AT_CLEANUP
10961
10962AT_SETUP([ofproto-dpif - nat - ofproto/trace])
10963OVS_VSWITCHD_START
10964
10965add_of_ports br0 1 2 3
10966
10967flow="in_port=1,udp,nw_src=1.1.1.1,nw_dst=1.1.1.2,udp_src=100,udp_dst=200"
10968AT_DATA([flows.txt], [dnl
10969table=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)
10970table=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)
10971table=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
10972table=0,priority=90,ip,ct_state=+trk,action=2
10973])
10974AT_CHECK([ovs-ofctl del-flows br0])
10975AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10976AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
10977AT_CHECK([tail -1 stdout], [0],
10978 [Datapath actions: 3
10979])
10980
10981flow="in_port=1,udp6,ipv6_src=1::1,ipv6_dst=1::2,udp_src=100,udp_dst=200"
10982AT_DATA([flows.txt], [dnl
10983table=0,priority=100,ip6,ipv6_src=1::1,ct_state=-trk,action=ct(commit,nat(src=[[10::1]]-[[10::42]]:1000-1042),table=0)
10984table=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)
10985table=0,priority=100,udp6,ct_state=+trk,ipv6_src=10::1,ipv6_dst=20::1,tp_src=1000,tp_dst=2000,action=3
10986table=0,priority=90,ip6,ct_state=+trk,action=2
10987])
10988AT_CHECK([ovs-ofctl del-flows br0])
10989AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10990AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
0f2f05bb
YHW
10991AT_CHECK([tail -1 stdout], [0],
10992 [Datapath actions: 3
10993])
10994
e6bc8e74
YHW
10995OVS_VSWITCHD_STOP
10996AT_CLEANUP
10997
ae59d134
DDP
10998AT_SETUP([ofproto - set mtu])
10999OVS_VSWITCHD_START
11000
11001add_of_ports br0 1
11002
11003# Check that initial MTU is 1500 for 'br0' and 'p1'.
11004AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
110051500
11006])
11007AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
110081500
11009])
11010
11011# Request new MTU for 'p1'
11012AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
11013
11014# Check that the new MTU is applied
15394e0f 11015AT_CHECK([ovs-vsctl wait-until Interface p1 mtu=1600])
ae59d134
DDP
11016# The internal port 'br0' should have the same MTU value as p1, becase it's
11017# the new bridge minimum.
15394e0f 11018AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1600])
ae59d134
DDP
11019
11020AT_CHECK([ovs-vsctl del-port br0 p1])
11021
11022# When 'p1' is deleted, the internal port should return to the default MTU
15394e0f 11023AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1500])
ae59d134 11024
7c12e200
DDP
11025# New port with 'mtu_request' in the same transaction.
11026AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
15394e0f
IM
11027AT_CHECK([ovs-vsctl wait-until Interface p2 mtu=1600])
11028AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1600])
7c12e200 11029
91fc374a 11030# Explicitly set mtu_request on the internal member. This should prevent
3a414a0a
DDP
11031# the MTU from being overriden.
11032AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
15394e0f 11033AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1700])
3a414a0a
DDP
11034
11035# The new MTU on p2 should not affect br0.
11036AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
15394e0f
IM
11037AT_CHECK([ovs-vsctl wait-until Interface p2 mtu=1400])
11038AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1700])
3a414a0a
DDP
11039
11040# Remove explicit mtu_request from br0. Now it should track the bridge
11041# minimum again.
11042AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
15394e0f 11043AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1400])
3a414a0a 11044
ae59d134
DDP
11045OVS_VSWITCHD_STOP
11046AT_CLEANUP
4a7ab326
DDP
11047
11048AT_SETUP([ofproto - fragment prerequisites])
11049OVS_VSWITCHD_START
11050
11051AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
11052
11053add_of_ports br0 1
11054
11055AT_DATA([flows.txt], [dnl
11056priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
11057priority=1,in_port=1,udp,action=drop
11058])
11059
11060AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
11061
11062AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
11063
11064ovs-appctl time/stop
11065AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
11066ovs-appctl time/warp 5000
11067
11068AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e 11069recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
4a7ab326
DDP
11070])
11071
11072dnl Change the flow table. This will trigger revalidation of all the flows.
11073AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
11074AT_CHECK([ovs-appctl revalidator/wait], [0])
11075
11076dnl We don't want revalidators to delete any flow. If the flow has been
11077dnl deleted it means that there's some inconsistency with the revalidation.
11078AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
11079
11080OVS_VSWITCHD_STOP
11081AT_CLEANUP
5b34f8fc
NS
11082
11083AT_SETUP([ofproto-dpif - check_pkt_larger action])
11084OVS_VSWITCHD_START
11085add_of_ports br0 1 2 3 4
11086
11087AT_DATA([flows.txt], [dnl
11088table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11089table=1,in_port=1,reg0=0x1/0x1 actions=output:2,resubmit(,2)
11090table=1,in_port=1,actions=output:3,resubmit(,2)
11091table=2,in_port=1,actions=mod_dl_dst:82:82:82:82:82:82,output:4
11092])
11093
11094AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11095AT_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])
11096AT_CHECK([tail -1 stdout], [0], [dnl
11097Datapath 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
11100dnl Test flow xlate check_pkt_large clone action without using datapath check_pkt_len action.
11101AT_CHECK([ovs-appctl dpif/set-dp-features br0 check_pkt_len false], [0], [ignore])
11102
11103AT_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])
11104AT_CHECK([tail -3 stdout], [0], [dnl
11105Datapath actions: 3,set(eth(dst=82:82:82:82:82:82)),4
11106This flow is handled by the userspace slow path because it:
11107 - Uses action(s) not supported by datapath.
11108])
11109
11110dnl Enable datapath check_pkt_len action
11111AT_CHECK([ovs-appctl dpif/set-dp-features br0 check_pkt_len true], [0], [ignore])
11112
11113ovs-ofctl del-flows br0
11114
11115AT_DATA([flows.txt], [dnl
11116table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11117table=1,in_port=1,priority=200,reg0=0x1/0x1 actions=output:2
11118])
11119
11120AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11121AT_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])
11122AT_CHECK([tail -1 stdout], [0], [dnl
11123Datapath actions: check_pkt_len(size=200,gt(2),le(drop))
11124])
11125
11126ovs-ofctl del-flows br0
11127AT_DATA([flows.txt], [dnl
11128table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]]
11129])
11130
11131AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11132AT_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])
11133AT_CHECK([tail -1 stdout], [0], [dnl
11134Datapath actions: check_pkt_len(size=200,gt(drop),le(drop))
11135])
11136
11137ovs-ofctl del-flows br0
11138AT_DATA([flows.txt], [dnl
11139table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11140table=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
11141table=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
11144AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11145AT_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])
11146AT_CHECK([tail -1 stdout], [0], [dnl
11147Datapath 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
11150AT_DATA([flows.txt], [dnl
11151table=0,priority=0 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11152table=1,in_port=1,priority=200,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src, resubmit(,0))
11153table=1,in_port=1,priority=0,ip actions=clone(set_field:192.168.3.4->ip_src, resubmit(,0))
11154])
11155
11156AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11157ovs-ofctl dump-flows br0
11158
11159AT_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])
11160AT_CHECK([tail -3 stdout], [0], [dnl
11161Megaflow: recirc_id=0,eth,ip,reg0=0/0x1,in_port=1,nw_src=10.10.10.2,nw_frag=no
11162Datapath actions: drop
11163Translation failed (Recursion too deep), packet is dropped.
11164])
11165
11166ovs-ofctl del-flows br0
11167AT_DATA([flows.txt], [dnl
11168table=0,priority=0 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11169table=1,ip,nw_src=192.168.3.3 actions=output:3
11170table=1,ip,nw_src=192.168.3.4 actions=output:4
11171table=1,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src, resubmit(,0))
11172table=1,ip actions=clone(set_field:192.168.3.4->ip_src, resubmit(,0))
11173])
11174
11175AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11176ovs-ofctl dump-flows br0
11177
11178AT_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])
11179AT_CHECK([tail -1 stdout], [0], [dnl
11180Datapath 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
11183ovs-ofctl del-flows br0
11184AT_DATA([flows.txt], [dnl
11185table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
11186table=1,in_port=1,reg0=0x1/0x1 actions=mod_dl_dst:82:82:82:82:82:82,controller(),resubmit(,2)
11187table=1,in_port=1 actions=resubmit(,2)
11188table=2,ip,dl_dst=82:82:82:82:82:82 actions=ct(table=3)
11189table=2,ip,dl_dst=50:54:00:00:00:0a actions=ct(table=3)
11190table=3,ip,reg0=0x1/0x1 actions=output:2
11191table=3,ip actions=output:4
11192])
11193
11194AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11195AT_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])
11196AT_CHECK([cat stdout | grep Datapath -B1], [0], [dnl
11197Megaflow: recirc_id=0,eth,ip,in_port=1,dl_dst=50:54:00:00:00:0a,nw_frag=no
11198Datapath 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--
11200Megaflow: recirc_id=0x2,eth,ip,in_port=1,nw_frag=no
11201Datapath actions: 2
11202--
11203Megaflow: recirc_id=0x3,eth,ip,in_port=1,nw_frag=no
11204Datapath actions: 4
11205])
11206
11207OVS_VSWITCHD_STOP
11208AT_CLEANUP
11209
11210AT_SETUP([ofproto-dpif - check_pkt_larger with continuation and ct])
11211OVS_VSWITCHD_START
11212add_of_ports --pcap br0 `seq 1 4`
11213
11214AT_CAPTURE_FILE([ofctl_monitor0.log])
11215AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
11216
11217AT_DATA([flows.txt], [dnl
11218table=0,in_port=1 actions=check_pkt_larger(150)->NXM_NX_REG0[[0]],resubmit(,1)
11219table=1,ip,reg0=0x1/0x1 actions=mod_dl_dst:82:82:82:82:82:82,controller(pause),resubmit(,2)
11220table=1,ip,reg0=0 actions=mod_dl_dst:83:83:83:83:83:83,controller(pause),resubmit(,2)
11221table=2,ip,dl_dst=82:82:82:82:82:82 actions=ct(table=3)
11222table=2,ip,dl_dst=83:83:83:83:83:83 actions=ct(table=3)
11223table=3,ip,reg0=0x1/0x1 actions=ct(commit),output:2
11224table=3,ip actions=ct(commit),output:4
11225])
11226
11227AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
11228
11229flow="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
11231AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
11232
11233OVS_WAIT_UNTIL([test 1 = `ovs-ofctl parse-pcap p4-tx.pcap \
11234| grep dl_dst=83:83:83:83:83:83 | wc -l`])
11235AT_CHECK([test 0 = `ovs-ofctl parse-pcap p2-tx.pcap | wc -l`])
11236
11237AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow" --len 200], [0], [stdout])
11238
11239OVS_WAIT_UNTIL([test 1 = `ovs-ofctl parse-pcap p2-tx.pcap \
11240| grep dl_dst=82:82:82:82:82:82 | wc -l`])
11241AT_CHECK([test 1 = `ovs-ofctl parse-pcap p2-tx.pcap | wc -l`])
11242
11243OVS_VSWITCHD_STOP
11244AT_CLEANUP