]> git.proxmox.com Git - mirror_ovs.git/blame - tests/ofproto-dpif.at
meta-flow: Make "nw_frag" a synonym for "ip_frag".
[mirror_ovs.git] / tests / ofproto-dpif.at
CommitLineData
29901626
BP
1AT_BANNER([ofproto-dpif])
2
27f57736
JS
3AT_SETUP([ofproto-dpif - revalidator/wait])
4OVS_VSWITCHD_START
5AT_CHECK([ovs-appctl revalidator/wait])
6OVS_VSWITCHD_STOP
7AT_CLEANUP
8
5f5ebd4c 9AT_SETUP([ofproto-dpif - active-backup bonding])
adcf00ba
AZ
10# Create br0 with interfaces p1, p2 and p7, creating bond0 with p1 and p2
11# and br1 with interfaces p3, p4 and p8.
12# toggle p1,p2 of bond0 up and down to test bonding in active-backup mode.
13OVS_VSWITCHD_START(
14 [add-bond br0 bond0 p1 p2 bond_mode=active-backup --\
15 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
16 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
17 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
18 add-br br1 -- \
19 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
20 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
21 fail-mode=secure -- \
22 add-port br1 p3 -- set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
23 add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
24 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
55466d72 25WAIT_FOR_DUMMY_PORTS([p3], [p4])
623540e4 26AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
adcf00ba
AZ
27
28AT_CHECK([ovs-ofctl add-flow br0 action=normal])
29AT_CHECK([ovs-ofctl add-flow br1 action=normal])
30ovs-appctl netdev-dummy/set-admin-state up
31ovs-appctl time/warp 100
32ovs-appctl netdev-dummy/set-admin-state p2 down
33ovs-appctl time/stop
34ovs-appctl time/warp 100
35AT_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)'])
36AT_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)'])
37ovs-appctl time/warp 100
38ovs-appctl netdev-dummy/set-admin-state p2 up
39ovs-appctl netdev-dummy/set-admin-state p1 down
40ovs-appctl time/warp 100
41AT_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)'])
42AT_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)'])
bdba1947 43ovs-appctl time/warp 200 100
53555f51 44sleep 1
9044f2c1 45AT_CHECK([grep 'in_port([[348]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
3d4b2e6e
JS
46recirc_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), actions: <del>
47recirc_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), actions: <del>
48recirc_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), actions: <del>
49recirc_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), actions: <del>
50recirc_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), actions: <del>
51recirc_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), actions: <del>
adcf00ba
AZ
52])
53OVS_VSWITCHD_STOP
54AT_CLEANUP
55
5f5ebd4c 56AT_SETUP([ofproto-dpif - balance-slb bonding])
adcf00ba
AZ
57# Create br0 with interfaces bond0(p1, p2, p3) and p7,
58# and br1 with interfaces p4, p5, p6 and p8.
59# p1 <-> p4, p2 <-> p5, p3 <-> p6
60# Send some traffic, make sure the traffic are spread based on source mac.
61OVS_VSWITCHD_START(
62 [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-slb --\
63 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
64 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
65 set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
66 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
67 add-br br1 -- \
68 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
69 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
70 fail-mode=secure -- \
71 add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
72 add-port br1 p5 -- set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
73 add-port br1 p6 -- set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
74 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
55466d72 75WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
adcf00ba
AZ
76AT_CHECK([ovs-ofctl add-flow br0 action=normal])
77AT_CHECK([ovs-ofctl add-flow br1 action=normal])
78AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
79])
adcf00ba
AZ
80ovs-appctl time/stop
81ovs-appctl time/warp 100
82(
83for i in `seq 0 100 |xargs printf '%02x\n'`;
84 do
85 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)"
86 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
87 done
88)
89ovs-appctl time/warp 100
90AT_CHECK([ovs-appctl dpif/dump-flows br1 > br1_flows.txt])
91# Make sure there is resonable distribution to all three ports.
92# We don't want to make this check precise, in case hash function changes.
93AT_CHECK([test `egrep 'in_port\(4\)' br1_flows.txt |wc -l` -gt 3])
94AT_CHECK([test `egrep 'in_port\(5\)' br1_flows.txt |wc -l` -gt 3])
95AT_CHECK([test `egrep 'in_port\(6\)' br1_flows.txt |wc -l` -gt 3])
96OVS_VSWITCHD_STOP
97AT_CLEANUP
98
5f5ebd4c 99AT_SETUP([ofproto-dpif - balance-tcp bonding])
adcf00ba
AZ
100# Create br0 with interfaces bond0(p1, p2, p3) and p7,
101# and br1 with interfaces bond1(p4, p5, p6) and p8.
102# bond0 <-> bond1
103# Send some traffic, make sure the traffic are spread based on L4 headers.
104OVS_VSWITCHD_START(
105 [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-tcp lacp=active \
106 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
107 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
108 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
109 set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
110 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
111 add-br br1 -- \
112 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
113 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
114 fail-mode=secure -- \
115 add-bond br1 bond1 p4 p5 p6 bond_mode=balance-tcp lacp=active \
116 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
117 set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
118 set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
119 set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
120 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
121AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
122])
123AT_CHECK([ovs-ofctl add-flow br0 action=normal])
124AT_CHECK([ovs-ofctl add-flow br1 action=normal])
125AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
126], [])
48105e85 127OVS_WAIT_WHILE([ovs-appctl bond/show | grep "may_enable: false"])
adcf00ba
AZ
128ovs-appctl time/stop
129ovs-appctl time/warp 100
130ovs-appctl lacp/show > lacp.txt
131ovs-appctl bond/show > bond.txt
132(
25d6a6a8 133for i in `seq 0 255` ;
adcf00ba 134 do
ea2735d3 135 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
136 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
137 done
138)
bdba1947 139ovs-appctl time/warp 300 100
adcf00ba
AZ
140AT_CHECK([ovs-appctl dpif/dump-flows br0 |grep tcp > br0_flows.txt])
141AT_CHECK([ovs-appctl dpif/dump-flows br1 |grep tcp > br1_flows.txt])
142# Make sure there is resonable distribution to all three ports.
143# We don't want to make this check precise, in case hash function changes.
fd184489
AZ
144AT_CHECK([test `grep in_port.4 br1_flows.txt |wc -l` -gt 24])
145AT_CHECK([test `grep in_port.5 br1_flows.txt |wc -l` -gt 24])
146AT_CHECK([test `grep in_port.6 br1_flows.txt |wc -l` -gt 24])
f9038ef6
AW
147
148OVS_VSWITCHD_STOP()
149AT_CLEANUP
150
151# Makes sure recirculation does not change the way packet is handled.
5f5ebd4c 152AT_SETUP([ofproto-dpif - balance-tcp bonding, different recirc flow ])
f9038ef6
AW
153OVS_VSWITCHD_START(
154 [add-bond br0 bond0 p1 p2 bond_mode=balance-tcp lacp=active \
155 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 -- \
156 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
157 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
158 add-br br1 -- \
159 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
160 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
161 fail-mode=standalone -- \
162 add-bond br1 bond1 p3 p4 bond_mode=balance-tcp lacp=active \
163 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 -- \
164 set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
165 set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
166 add-port br1 br1- -- set interface br1- type=patch options:peer=br1+ ofport_request=100 -- \
167 add-br br-int -- \
168 set bridge br-int other-config:hwaddr=aa:77:aa:77:00:00 -- \
169 set bridge br-int datapath-type=dummy other-config:datapath-id=1235 \
170 fail-mode=secure -- \
171 add-port br-int br1+ -- set interface br1+ type=patch options:peer=br1- ofport_request=101 -- \
172 add-port br-int p5 -- set interface p5 ofport_request=5 type=dummy
173])
174AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
175])
176
f12bfd04
AW
177# Waits for all ifaces enabled.
178OVS_WAIT_UNTIL([test `ovs-appctl bond/show | grep -- "may_enable: true" | wc -l` -ge 4])
179
f9038ef6
AW
180# The dl_vlan flow should not be ever matched,
181# since recirculation should not change the flow handling.
182AT_DATA([flows.txt], [dnl
183table=0 priority=1 in_port=5 actions=mod_vlan_vid:1,output(101)
184table=0 priority=2 in_port=5 dl_vlan=1 actions=drop
185])
186AT_CHECK([ovs-ofctl add-flows br-int flows.txt])
187
188# Sends a packet to trigger recirculation.
f9038ef6
AW
189AT_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)"])
190
191# Collects flow stats.
192AT_CHECK([ovs-appctl revalidator/purge], [0])
193
194# Checks the flow stats in br1, should only be one flow with non-zero
195# 'n_packets' from internal table.
e2167cb7 196AT_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 197table_id=254, n_packets=1, n_bytes=38, priority=20,recirc_id=0x0,dp_hash=0x0/0xff,actions=output
f9038ef6
AW
198])
199
200# Checks the flow stats in br-int, should be only one match.
201AT_CHECK([ovs-ofctl dump-flows br-int | ofctl_strip | sort], [0], [dnl
efe179e0 202 n_packets=1, n_bytes=34, priority=1,in_port=5 actions=mod_vlan_vid:1,output:101
f9038ef6
AW
203 priority=2,in_port=5,dl_vlan=1 actions=drop
204NXST_FLOW reply:
205])
206
adcf00ba
AZ
207OVS_VSWITCHD_STOP()
208AT_CLEANUP
209
29901626 210AT_SETUP([ofproto-dpif - resubmit])
023e1e0a 211OVS_VSWITCHD_START
ca5792f0 212add_of_ports br0 1 10 11 12 13 14 15 16 17 18 19 20 21
29901626
BP
213AT_DATA([flows.txt], [dnl
214table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21)
215table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18)
216table=0 in_port=3 priority=2000 icmp actions=output(20)
217table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15)
218table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2)
219table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2)
220])
221AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50f96b10 222AT_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
223AT_CHECK([tail -1 stdout], [0],
224 [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
225])
023e1e0a 226OVS_VSWITCHD_STOP
29901626 227AT_CLEANUP
58a89177 228
55599423
JR
229AT_SETUP([ofproto-dpif - goto table])
230OVS_VSWITCHD_START
ca5792f0 231add_of_ports br0 1 10 11
55599423 232echo "table=0 in_port=1 actions=output(10),goto_table(1)" > flows.txt
4468099e
EJ
233for i in `seq 1 63`; do echo "table=$i actions=goto_table($(($i+1)))"; done >> flows.txt
234echo "table=64 actions=output(11)" >> flows.txt
55599423
JR
235AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
236AT_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])
237AT_CHECK([tail -1 stdout], [0],
238 [Datapath actions: 10,11
239])
240OVS_VSWITCHD_STOP
241AT_CLEANUP
242
7fdb60a7
SH
243AT_SETUP([ofproto-dpif - write actions])
244OVS_VSWITCHD_START
ca5792f0 245add_of_ports br0 1 10 11 12 13
7fdb60a7
SH
246AT_DATA([flows.txt], [dnl
247table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
248table=1 ip actions=write_actions(output(13)),goto_table(2)
249table=2 ip actions=set_field:192.168.3.91->ip_src,output(11)
250])
251AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
252AT_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 253AT_CHECK([tail -2 stdout], [0],
e3981271 254 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 255Datapath actions: 10,set(ipv4(src=192.168.3.91)),11,set(ipv4(src=192.168.3.90)),13
7fdb60a7
SH
256])
257OVS_VSWITCHD_STOP
258AT_CLEANUP
259
e60e935b
SRCSA
260AT_SETUP([ofproto-dpif - modify IPv6 Neighbor Solitication (ND)])
261OVS_VSWITCHD_START
ca5792f0 262add_of_ports br0 1 10 11 12 13
e60e935b
SRCSA
263AT_DATA([flows.txt], [dnl
264table=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)
265table=1 icmp6 actions=write_actions(output(13)),goto_table(2)
266table=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)
267])
268AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
269AT_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])
270AT_CHECK([tail -4 stdout], [0],
e3981271 271 [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
272Datapath 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
273This flow is handled by the userspace slow path because it:
393e9f7c 274 - Uses action(s) not supported by datapath.
e60e935b
SRCSA
275])
276OVS_VSWITCHD_STOP
277AT_CLEANUP
278
7fdb60a7
SH
279AT_SETUP([ofproto-dpif - clear actions])
280OVS_VSWITCHD_START
ca5792f0 281add_of_ports br0 1 10 11 12
7fdb60a7
SH
282AT_DATA([flows.txt], [dnl
283table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
ce58df5b 284table=1 tcp actions=set_field:91->tp_src,output(11),clear_actions
7fdb60a7
SH
285])
286AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
ce58df5b
JR
287AT_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])
288AT_CHECK([tail -2 stdout], [0],
e3981271 289 [Megaflow: recirc_id=0,eth,tcp,in_port=1,nw_frag=no,tp_src=8
d23df9a8 290Datapath actions: 10,set(tcp(src=91)),11
7fdb60a7
SH
291])
292OVS_VSWITCHD_STOP
293AT_CLEANUP
294
0eb48fe1 295AT_SETUP([ofproto-dpif - group chaining])
5a070238 296OVS_VSWITCHD_START
ca5792f0 297add_of_ports br0 1 10 11
0eb48fe1
BP
298AT_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'])
299AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=123,type=all,bucket=output:10'])
300AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
301AT_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])
302AT_CHECK([tail -1 stdout], [0],
303 [Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
5a070238
BP
304])
305OVS_VSWITCHD_STOP
306AT_CLEANUP
307
f4fb341b
SH
308AT_SETUP([ofproto-dpif - all group in action list])
309OVS_VSWITCHD_START
ca5792f0 310add_of_ports br0 1 10 11
f4fb341b
SH
311AT_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'])
312AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
313AT_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
314# Must match on the source address to be able to restore it's value for
315# the second bucket
ce58df5b 316AT_CHECK([tail -2 stdout], [0],
e3981271 317 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 318Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
f4fb341b
SH
319])
320OVS_VSWITCHD_STOP
321AT_CLEANUP
322
323AT_SETUP([ofproto-dpif - indirect group in action list])
324OVS_VSWITCHD_START
ca5792f0 325add_of_ports br0 1 10
f4fb341b
SH
326AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
327AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
328AT_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])
329AT_CHECK([tail -1 stdout], [0],
330 [Datapath actions: 10
331])
332OVS_VSWITCHD_STOP
333AT_CLEANUP
334
5b09e569
JR
335AT_SETUP([ofproto-dpif - group actions have no effect afterwards])
336OVS_VSWITCHD_START
ca5792f0 337add_of_ports br0 1 10
5b09e569
JR
338AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=set_field:192.168.3.90->ip_src,output:10'])
339AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234,output:10'])
06db81cc
JS
340
341for d in 0 1 2 3; do
342 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)"
343 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
344done
345
346AT_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
347flow-dump from non-dpdk interfaces:
348recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:hash(sym_l4(0)),recirc(0x1)
349recirc_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 350])
06db81cc 351
5b09e569
JR
352OVS_VSWITCHD_STOP
353AT_CLEANUP
354
f4fb341b
SH
355AT_SETUP([ofproto-dpif - all group in action set])
356OVS_VSWITCHD_START
ca5792f0 357add_of_ports br0 1 10 11
f4fb341b
SH
358AT_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'])
359AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
360AT_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
361# Must match on the source address to be able to restore it's value for
362# the third bucket
ce58df5b 363AT_CHECK([tail -2 stdout], [0],
e3981271 364 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 365Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
f4fb341b
SH
366])
367OVS_VSWITCHD_STOP
368AT_CLEANUP
369
370AT_SETUP([ofproto-dpif - indirect group in action set])
371OVS_VSWITCHD_START
ca5792f0 372add_of_ports br0 1 10
f4fb341b
SH
373AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
374AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
375AT_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])
376AT_CHECK([tail -1 stdout], [0],
377 [Datapath actions: 10
378])
379OVS_VSWITCHD_STOP
380AT_CLEANUP
381
14ebc6c1
EG
382AT_SETUP([ofproto-dpif - patch port with action set])
383OVS_VSWITCHD_START([ \
384 add-br br1 -- \
385 set bridge br1 datapath-type=dummy fail-mode=secure -- \
386 add-port br0 patch10 -- \
387 set interface patch10 type=patch options:peer=patch20 ofport_request=10 -- \
388 add-port br1 patch20 -- \
389 set interface patch20 type=patch options:peer=patch10 ofport_request=20
390 ])
391add_of_ports br0 1
392add_of_ports br1 2
393AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br1 'ip actions=write_actions(pop_vlan,output:2)'])
394AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=output:10'])
395AT_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])
396AT_CHECK([tail -1 stdout], [0],
397 [Datapath actions: pop_vlan,2
398])
399AT_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])
400AT_CHECK([tail -1 stdout], [0],
401 [Datapath actions: pop_vlan,2
402])
403OVS_VSWITCHD_STOP
404AT_CLEANUP
405
406
fe7e5749 407AT_SETUP([ofproto-dpif - select group])
06db81cc
JS
408
409# Helper function to check the spread of dp_hash flows over buckets in the datapath
410check_dpflow_stats () {
411 min_flows=$1
412 min_buckets=$2
413 read -d '' dpflows
414 hash_flow=`echo "$dpflows" | grep "actions:hash"`
415 n_flows=`echo "$dpflows" | grep -c dp_hash`
416 n_buckets=`echo "$dpflows" | grep dp_hash | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l`
417 if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi
418 if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi
419 echo $hash_flow
420 echo "n_flows=$flows n_buckets=$buckets"
421}
422
fe7e5749 423OVS_VSWITCHD_START
ca5792f0 424add_of_ports br0 1 10 11
06db81cc
JS
425
426ovs-appctl vlog/set ofproto_dpif:file:dbg
fe7e5749 427AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
06db81cc
JS
428AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
429ofproto_dpif|DBG|Constructing select group 1234
430ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
431ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
432ofproto_dpif|DBG| Using 16 hash values:
433ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
434ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
435ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 1.
436])
fe7e5749 437AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
7cb279c2
SH
438
439# Try a bunch of different flows and make sure that they get distributed
06db81cc
JS
440# # at least somewhat.
441for d in 0 1 2 3; do
442 for s in 1 2 3 4 ; do
443 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)"
444 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
445 done
7cb279c2 446done
06db81cc
JS
447
448AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 5 2], [0], [dnl
449recirc_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)
450n_flows=ok n_buckets=ok
fe7e5749 451])
06db81cc 452
fe7e5749
SH
453OVS_VSWITCHD_STOP
454AT_CLEANUP
455
456AT_SETUP([ofproto-dpif - select group with watch port])
06db81cc 457
fe7e5749 458OVS_VSWITCHD_START
ca5792f0 459add_of_ports br0 1 10 11
fe7e5749
SH
460AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
461AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
06db81cc
JS
462
463for d in 0 1 2 3; do
464 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)"
465 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
466done
467
468AT_CHECK([ovs-appctl dpctl/dump-flows | sort| sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | strip_ufid | strip_used], [0], [dnl
469flow-dump from non-dpdk interfaces:
470recirc_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)
471recirc_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 472])
06db81cc 473
fe7e5749
SH
474OVS_VSWITCHD_STOP
475AT_CLEANUP
476
06db81cc
JS
477AT_SETUP([ofproto-dpif - select group with weights])
478
479# Helper function to check the spread of dp_hash flows over buckets in the datapath
480check_dpflow_stats () {
481 min_flows=$1
482 min_buckets=$2
483 read -d '' dpflows
484 hash_flow=`echo "$dpflows" | grep "actions:hash"`
485 n_flows=`echo "$dpflows" | grep -c dp_hash`
486 n_buckets=`echo "$dpflows" | grep dp_hash | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l`
487 if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi
488 if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi
489 echo $hash_flow
490 echo "n_flows=$flows n_buckets=$buckets"
491}
492
493# Helper function to check the accuracy of distribution of packets over buckets
494check_group_stats () {
495 min=($1 $2 $3 $4)
496 buckets=`grep -o 'packet_count=[[0-9]]*' | cut -d'=' -f2 | tail -n +2`
497 i=0
498 for bucket in $buckets; do
499 if [[ $bucket -ge ${min[i]} ]]; then
500 echo "bucket$i >= ${min[[$i]]}"
501 else
502 echo "bucket$i < ${min[[$i]]}"
503 fi
504 (( i++ ))
505 if [[ $i -ge 4 ]]; then break; fi
506 done
507}
508
7cb279c2 509OVS_VSWITCHD_START
06db81cc
JS
510add_of_ports br0 1 10 11 12 13 14
511
512ovs-appctl vlog/set ofproto_dpif:file:dbg
513AT_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'])
514AT_CHECK([grep -A9 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
515ofproto_dpif|DBG|Constructing select group 1234
516ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
517ofproto_dpif|DBG| Minimum weight: 5, total weight: 100
518ofproto_dpif|DBG| Using 32 hash values:
519ofproto_dpif|DBG| Bucket 0: weight=5, target=1.60 hits=2
520ofproto_dpif|DBG| Bucket 1: weight=10, target=3.20 hits=3
521ofproto_dpif|DBG| Bucket 2: weight=25, target=8.00 hits=8
522ofproto_dpif|DBG| Bucket 3: weight=60, target=19.20 hits=19
523ofproto_dpif|DBG| Bucket 4: weight=0, target=0.00 hits=0
524ofproto_dpif|DBG|Use dp_hash with 32 hash values using algorithm 1.
525])
7cb279c2 526AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
06db81cc
JS
527
528# Try 1000 different flows and make sure that they get distributed according to weights
529for d1 in 0 1 2 3 4 5 6 7 8 9 ; do
530 for d2 in 0 1 2 3 4 5 6 7 8 9 ; do
531 for s in 0 1 2 3 4 5 6 7 8 9 ; do
532 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)"
533 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
534 done
535 done
536done
537
538# Check balanced distribution over 32 dp_hash values
539AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 32 4 ], [0], [dnl
540recirc_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)
541n_flows=ok n_buckets=ok
7cb279c2 542])
06db81cc
JS
543
544# Check that actual distribution over the buckets is reasonably accurate:
545 ideal weights dp_hash values
546# bucket0: 5%*1000 = 50 2/32*1000 = 63
547# bucket1: 10%*1000 = 100 3/32*1000 = 94
548# bucket2: 25%*1000 = 250 8/32*1000 = 250
549# bucket3: 60%*1000 = 600 19/32*1000 = 594
550# bucket4: 0 0
551
552ovs-appctl time/warp 1000
553AT_CHECK([ovs-ofctl -O OpenFlow13 dump-group-stats br0 | sed 's/duration=[[0-9]]\.[[0-9]]*s,//' | check_group_stats 40 80 200 500],
554[0], [dnl
555bucket0 >= 40
556bucket1 >= 80
557bucket2 >= 200
558bucket3 >= 500
559])
560
7cb279c2
SH
561OVS_VSWITCHD_STOP
562AT_CLEANUP
563
06db81cc
JS
564AT_SETUP([ofproto-dpif - select group with explicit dp_hash selection method])
565
0c4b9393 566OVS_VSWITCHD_START
ca5792f0 567add_of_ports br0 1 10 11
06db81cc
JS
568
569ovs-appctl vlog/set ofproto_dpif:file:dbg
570AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11'])
571AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
572ofproto_dpif|DBG|Constructing select group 1234
573ofproto_dpif|DBG|Selection method specified: dp_hash.
574ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
575ofproto_dpif|DBG| Using 16 hash values:
576ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
577ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
578ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 0.
579])
580
581# Fall back to legacy hash with zero buckets
582AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method=dp_hash'])
583AT_CHECK([grep -A3 "Constructing select group 1235" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
584ofproto_dpif|DBG|Constructing select group 1235
585ofproto_dpif|DBG|Selection method specified: dp_hash.
586ofproto_dpif|DBG| Don't apply dp_hash method without buckets.
587ofproto_dpif|DBG|Falling back to default hash method.
588])
589
590# Fall back to legacy hash with zero buckets
591AT_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'])
592AT_CHECK([grep -A4 "Constructing select group 1236" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
593ofproto_dpif|DBG|Constructing select group 1236
594ofproto_dpif|DBG|Selection method specified: dp_hash.
595ofproto_dpif|DBG| Minimum weight: 1, total weight: 1001
596ofproto_dpif|DBG| Too many hash values required: 1024
597ofproto_dpif|DBG|Falling back to default hash method.
8b666728 598])
06db81cc
JS
599
600OVS_VSWITCHD_STOP
601AT_CLEANUP
602
603AT_SETUP([ofproto-dpif - select group with legacy hash selection method])
604
605# Helper function to check the spread of dp_hash flows over buckets in the datapath
606check_dpflow_stats () {
607 min_flows=$1
608 min_buckets=$2
609 read -d '' dpflows
610 n_flows=`echo "$dpflows" | wc -l`
611 n_buckets=`echo "$dpflows" | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l`
612 if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi
613 if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi
614 echo "n_flows=$flows n_buckets=$buckets"
615}
616
617OVS_VSWITCHD_START
618add_of_ports br0 1 10 11
619
620ovs-appctl vlog/set ofproto_dpif:file:dbg
621AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,bucket=output:10,bucket=output:11'])
622AT_CHECK([grep -A2 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
623ofproto_dpif|DBG|Constructing select group 1234
624ofproto_dpif|DBG|Selection method specified: hash.
625ofproto_dpif|DBG|No hash fields. Falling back to default hash method.
626])
627
0c4b9393
SH
628AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
629
06db81cc
JS
630# Try 16 flows with differing default hash values.
631for d in 0 1 2 3; do
632 for s in 1 2 3 4 ; do
633 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)"
634 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
635 done
0c4b9393 636done
06db81cc
JS
637
638# Check that the packets installed 16 data path flows and each of the two
639# buckets is hit at least once.
640AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
641n_flows=ok n_buckets=ok
0c4b9393
SH
642])
643
06db81cc
JS
644OVS_VSWITCHD_STOP
645AT_CLEANUP
646
647AT_SETUP([ofproto-dpif - select group with custom hash selection method])
648
649# Helper function to check the spread of dp_hash flows over buckets in the datapath
650check_dpflow_stats () {
651 min_flows=$1
652 min_buckets=$2
653 read -d '' dpflows
654 n_flows=`echo "$dpflows" | wc -l`
655 n_buckets=`echo "$dpflows" | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l`
656 if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi
657 if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi
658 echo "n_flows=$flows n_buckets=$buckets"
659}
660
661OVS_VSWITCHD_START
662add_of_ports br0 1 10 11
663
664# Check that parse failures after 'fields' parsing work
665AT_CHECK([ovs-ofctl -O OpenFlow10 add-group br0 'group_id=1,type=select,fields(eth_dst),bukket=output:10'], [1], ,[dnl
666ovs-ofctl: unknown keyword bukket
0c4b9393
SH
667])
668
60dfb5ed
JR
669# Check that fields are rejected without "selection_method=hash".
670AT_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
671ovs-ofctl: fields may only be specified with "selection_method=hash"
672])
673
674# Check that selection_method_param without selection_method is rejected.
675AT_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
676ovs-ofctl: selection_method_param is only allowed with "selection_method"
677])
678
06db81cc
JS
679AT_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'])
680AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
53cc166a 681
06db81cc
JS
682# Try 16 flows with differing custom hash and check that they give rise to
683# 16 data path flows and each of the two buckets is hit at least once
684for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
685 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
686 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
687done
688
06db81cc
JS
689AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
690n_flows=ok n_buckets=ok
53cc166a
JR
691])
692
693AT_CHECK([ovs-appctl revalidator/purge], [0])
694
06db81cc
JS
695# Try 16 flows that differ only in fields that are not part of the custom
696# hash and check that there is only a single datapath flow
53cc166a
JR
697for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
698 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)"
699 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
700done
701
06db81cc
JS
702AT_CHECK([ovs-appctl dpctl/dump-flows | grep -c recirc_id], [0], [dnl
7031
53cc166a
JR
704])
705
706OVS_VSWITCHD_STOP
707AT_CLEANUP
708
dd8cd4b4
SH
709AT_SETUP([ofproto-dpif - fast failover group])
710OVS_VSWITCHD_START
ca5792f0 711add_of_ports br0 1 10 11
dd8cd4b4
SH
712AT_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'])
713AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
714AT_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])
715AT_CHECK([tail -1 stdout], [0],
716 [Datapath actions: drop
717])
718OVS_VSWITCHD_STOP
719AT_CLEANUP
720
b2af3288
AZ
721AT_SETUP([ofproto-dpif - group stats single bucket])
722OVS_VSWITCHD_START
ca5792f0 723add_of_ports br0 1 10 11
b2af3288
AZ
724AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
725AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
726(
727for i in `seq 0 2`;
728 do
729 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)"
730 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
731 done
732)
cea4a6d7 733AT_CHECK([ovs-appctl revalidator/purge], [0])
b2af3288 734AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 735AT_CHECK([strip_xids < stdout | sort], [0], [dnl
6f068379 736 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
737OFPST_GROUP reply (OF1.2):
738])
739OVS_VSWITCHD_STOP
740AT_CLEANUP
741
742AT_SETUP([ofproto-dpif - group stats all buckets])
743OVS_VSWITCHD_START
ca5792f0 744add_of_ports br0 1 10 11
b2af3288
AZ
745AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
746AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
747(
748for i in `seq 0 2`;
749 do
750 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)"
751 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
752 done
753)
cea4a6d7 754AT_CHECK([ovs-appctl revalidator/purge], [0])
b2af3288 755AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 756AT_CHECK([strip_xids < stdout | sort], [0], [dnl
6f068379 757 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
758OFPST_GROUP reply (OF1.2):
759])
760OVS_VSWITCHD_STOP
761AT_CLEANUP
762
58a89177 763AT_SETUP([ofproto-dpif - registers])
023e1e0a 764OVS_VSWITCHD_START
ca5792f0 765add_of_ports br0 20 21 22 33 90
58a89177
EJ
766AT_DATA([flows.txt], [dnl
767in_port=90 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
768in_port=91 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
e9358af6
EJ
769in_port=92 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
770in_port=93 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
771
58a89177
EJ
772in_port=2 actions=load:0x000db000->NXM_NX_REG0[[]]
773in_port=3 actions=load:0xdea->NXM_NX_REG0[[20..31]]
774in_port=4 actions=load:0xeef->NXM_NX_REG0[[0..11]]
775in_port=5 actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
776in_port=6 actions=load:0x22222222->NXM_NX_REG2[[]]
777in_port=7 actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
778in_port=8 actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
779in_port=9,reg0=0xdeadbeef actions=output:20
780in_port=10,reg1=0xdeadbeef actions=output:21
781in_port=11,reg2=0xeef22dea actions=output:22
e9358af6
EJ
782
783dnl Sanilty check all registers
784in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
785in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
786in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
787in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
bd85dac1 788
58a89177
EJ
789])
790AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 791AT_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 792AT_CHECK([tail -1 stdout], [0],
e9358af6 793 [Datapath actions: 20,21,22,33
58a89177 794])
023e1e0a 795OVS_VSWITCHD_STOP
58a89177 796AT_CLEANUP
f694937d 797
57fa8167
BP
798dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
799dnl in the manner documented in ovs-ofctl(8).
800AT_SETUP([ofproto-dpif - extended registers])
801OVS_VSWITCHD_START
ca5792f0 802add_of_ports br0 1 2 3
57fa8167
BP
803AT_DATA([flows.txt], [dnl
804table=0 actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
805table=1,reg2=0xfedcba98,reg3=0x76543210 actions=2
806
807# These low-priority rules shouldn't match. They're here only to make really
808# sure that the test fails if either of the above rules fails to match.
809table=0,priority=0 actions=3
810table=1,priority=0 actions=3
811])
812AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
813AT_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])
814AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
815])
816OVS_VSWITCHD_STOP
817AT_CLEANUP
818
b23ada8e
JP
819dnl Tests that the standardized xxregs are mapped onto the legacy OVS
820dnl registers in the manner documented in ovs-ofctl(8).
821AT_SETUP([ofproto-dpif - extended-extended registers])
822OVS_VSWITCHD_START
823add_of_ports br0 1 2 3
824AT_DATA([flows.txt], [dnl
825table=0 actions=load:0x0123456789abcdeffedcba9876543210->NXM_NX_XXREG1[[]],resubmit(,1)
826table=1,reg4=0x01234567,reg5=0x89abcdef,reg6=0xfedcba98,reg7=0x76543210 actions=2
827
828# These low-priority rules shouldn't match. They're here only to make really
829# sure that the test fails if either of the above rules fails to match.
830table=0,priority=0 actions=3
831table=1,priority=0 actions=3
832])
833AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
834AT_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])
835AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
836])
837OVS_VSWITCHD_STOP
838AT_CLEANUP
839
1b0ee636
TG
840AT_SETUP([ofproto-dpif - load and move order])
841OVS_VSWITCHD_START
ca5792f0 842add_of_ports br0 1 10 11
1b0ee636
TG
843AT_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'])
844AT_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)'])
845AT_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])
846AT_CHECK([tail -2 stdout], [0],
e3981271 847 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 848Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
1b0ee636
TG
849])
850OVS_VSWITCHD_STOP
851AT_CLEANUP
852
eb1cbc6b
JT
853dnl Tests that 1.5 copy-field can copy into the standardized xregs.
854AT_SETUP([ofproto-dpif - copy-field into extended registers])
855OVS_VSWITCHD_START
ca5792f0 856add_of_ports br0 1 2 3
eb1cbc6b
JT
857AT_DATA([flows.txt], [dnl
858table=0 actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
859table=1,xreg0=0x0000505400000005 actions=2
860
861# These low-priority rules shouldn't match. They're here only to make really
862# sure that the test fails if either of the above rules fails to match.
863table=0,priority=0 actions=3
864table=1,priority=0 actions=3
865])
866AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
867AT_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])
868AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
869])
870OVS_VSWITCHD_STOP
871AT_CLEANUP
872
2bef8e07
JT
873dnl Tests that 1.5 set-field with mask in the metadata register.
874AT_SETUP([ofproto-dpif - masked set-field into metadata])
875OVS_VSWITCHD_START
ca5792f0 876add_of_ports br0 1 2 3
2bef8e07
JT
877AT_DATA([flows.txt], [dnl
878table=0 actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
879table=1 actions=set_field:0x6b/0xff->metadata,goto_table(2)
880table=2,metadata=0xfafafafa5a5a5a6b actions=2
881
882# These low-priority rules shouldn't match. They're here only to make really
883# sure that the test fails if either of the above rules fails to match.
884table=0,priority=0 actions=3
885table=1,priority=0 actions=3
886table=2,priority=0 actions=3
887])
888AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
889AT_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])
890AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
891])
892OVS_VSWITCHD_STOP
893AT_CLEANUP
894
c61f3870
BP
895
896AT_SETUP([ofproto-dpif - actset_output])
897OVS_VSWITCHD_START
ca5792f0 898add_of_ports br0 1 2 3 4 5 6 7 8 9 10 11 12 13
c61f3870 899AT_DATA([flows.txt], [dnl
3ca3ce0c 900table=0,actset_output=unset actions=write_actions(output(2)),goto_table(1)
c61f3870
BP
901table=1 actions=move:ONFOXM_ET_ACTSET_OUTPUT[[0..31]]->OXM_OF_PKT_REG0[[0..31]],goto_table(2)
902
903# Verify that actset_output got set.
904table=2,priority=20,actset_output=2 actions=4,goto_table(3)
905table=2,priority=10 actions=5,goto_table(3)
906
907# Verify that xreg0 got copied properly from actset_output.
908table=3,priority=20,xreg0=2 actions=6,goto_table(4)
909table=3,priority=10 actions=7,goto_table(4)
910
b23ada8e
JP
911# Verify that xxreg0 got copied properly from actset_output.
912table=3,priority=20,xxreg0=2 actions=6,goto_table(4)
913table=3,priority=10 actions=7,goto_table(4)
914
9055ca9a
BP
915# Verify that adding a group action unsets actset_output,
916# even if output follows group.
917table=4 actions=write_actions(group(5),output(10)),goto_table(5)
c61f3870
BP
918table=5,priority=20,actset_output=unset actions=8,goto_table(6)
919table=5,priority=10 actions=9,goto_table(6)
920
921# Verify that adding another output action doesn't change actset_output
922# (since there's still a group).
923table=6 actions=write_actions(output(3)),goto_table(7)
924table=7,priority=20,actset_output=unset actions=10,goto_table(8)
925table=7,priority=10 actions=11,goto_table(8)
926
927# Verify that clearing the action set, then writing an output action,
928# causes actset_output to be set again.
929table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
930table=9,priority=20,actset_output=2 actions=12
931table=9,priority=10 actions=13
932])
4f20179d 933AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=5,type=all,bucket=output:1'])
c61f3870
BP
934AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
935AT_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])
936AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
937])
938OVS_VSWITCHD_STOP
939AT_CLEANUP
880b1458 940
bd85dac1
AZ
941AT_SETUP([ofproto-dpif - push-pop])
942OVS_VSWITCHD_START
ca5792f0 943add_of_ports br0 20 21 22 33 90
bd85dac1
AZ
944AT_DATA([flows.txt], [dnl
945in_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
946in_port=2 actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
947in_port=3 actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
948in_port=4 actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
949in_port=5 actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
950
951])
952AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 953AT_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
954AT_CHECK([tail -1 stdout], [0],
955 [Datapath actions: 33,22,21,20
956])
957OVS_VSWITCHD_STOP
958AT_CLEANUP
959
f694937d 960AT_SETUP([ofproto-dpif - output])
023e1e0a 961OVS_VSWITCHD_START
ca5792f0 962add_of_ports br0 1 9 10 11 55 66 77 88
f694937d 963AT_DATA([flows.txt], [dnl
557323cd 964in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
f694937d
EJ
965in_port=2 actions=output:9
966in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
967in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
968in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
969in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
970in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
557323cd 971in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
f694937d
EJ
972])
973AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 974AT_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 975AT_CHECK([tail -1 stdout], [0],
557323cd 976 [Datapath actions: 9,55,10,55,66,11,77,88,9,1
f694937d 977])
023e1e0a 978OVS_VSWITCHD_STOP
f694937d 979AT_CLEANUP
8e9ce036 980
f0fd1a17
PS
981AT_SETUP([ofproto-dpif - dec_ttl])
982OVS_VSWITCHD_START
ca5792f0 983add_of_ports br0 1 2 3 4
f0fd1a17
PS
984AT_DATA([flows.txt], [dnl
985table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
986table=1 in_port=1 action=dec_ttl,output:3
987])
988AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8249a1fe 989AT_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
990AT_CHECK([tail -4 stdout], [0], [
991Final 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
992Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=2,nw_frag=no
74c4530d 993Datapath 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 994])
8249a1fe 995AT_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 996AT_CHECK([tail -2 stdout], [0],
e3981271 997 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=3,nw_frag=no
d23df9a8 998Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
f0fd1a17 999])
50aa28fd 1000AT_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 1001AT_CHECK([tail -2 stdout], [0],
e3981271 1002 [Megaflow: recirc_id=0,eth,ipv6,in_port=1,nw_ttl=128,nw_frag=no
d23df9a8 1003Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
f0fd1a17
PS
1004])
1005
982697a4 1006AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 1007AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d39ec23d
JP
1008
1009ovs-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)'
1010
d9c8c57c 1011OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
f0fd1a17 1012AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8249a1fe 1013NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
e6d9ab56 1014ip,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
1015])
1016OVS_VSWITCHD_STOP
1017AT_CLEANUP
1018
65bfce4a
SH
1019dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
1020dnl buffer to be resized just before pushing the id of the dec_ttl action.
1021dnl Thus the implementation must account for this by using the
1022dnl reallocated buffer rather than the original buffer.
1023dnl
1024dnl A number of similar rules are added to try and exercise
1025dnl xrealloc sufficiently that it returns a different base pointer
1026AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
1027OVS_VSWITCHD_START
ca5792f0 1028add_of_ports br0 1
65bfce4a
SH
1029(for i in `seq 0 255`; do
1030 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
1031 done) > flows.txt
1032AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1033OVS_VSWITCHD_STOP
1034AT_CLEANUP
1035
1036dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
1037dnl buffer to be resized just before pushing the id of the dec_ttl action.
1038dnl Thus the implementation must account for this by using the
1039dnl reallocated buffer rather than the original buffer.
1040dnl
1041dnl A number of similar rules are added to try and exercise
1042dnl xrealloc sufficiently that it returns a different base pointer
1043AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
1044OVS_VSWITCHD_START
ca5792f0 1045add_of_ports br0 1
65bfce4a
SH
1046(for i in `seq 0 255`; do
1047 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
1048 done) > flows.txt
1049AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1050OVS_VSWITCHD_STOP
1051AT_CLEANUP
1052
1053dnl A note action at offset 24 in ofpacts will cause the ofpacts
1054dnl buffer to be resized just before pushing the id of the dec_ttl action.
1055dnl Thus the implementation must account for this by using the
1056dnl reallocated buffer rather than the original buffer.
1057dnl
1058dnl A number of similar rules are added to try and exercise
1059dnl xrealloc sufficiently that it returns a different base pointer
1060AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
1061OVS_VSWITCHD_START
ca5792f0 1062add_of_ports br0 1
65bfce4a
SH
1063(for i in `seq 0 255`; do
1064 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
1065 done) > flows.txt
1066AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1067OVS_VSWITCHD_STOP
1068AT_CLEANUP
f0fd1a17 1069
ace39a6f
JS
1070dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
1071dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
1072dnl Using `make check-valgrind' here checks for use-after-free in this
1073dnl codepath.
1074AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
1075OVS_VSWITCHD_START
1076AT_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'])
1077OVS_VSWITCHD_STOP
1078AT_CLEANUP
1079
77750738 1080AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
e44768b7 1081OVS_VSWITCHD_START
ca5792f0 1082add_of_ports br0 1 2
77750738 1083
77750738
JP
1084AT_CHECK([ovs-ofctl add-flow br0 action=normal])
1085
1086# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 1087flow="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 1088AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
72d64e33
EJ
1089AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
10901
10912
1092100
1093])
77750738
JP
1094
1095OVS_VSWITCHD_STOP
1096AT_CLEANUP
1097
8b36f51e 1098AT_SETUP([ofproto-dpif - DSCP])
8b36f51e 1099OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
ca5792f0 1100add_of_ports br0 9
8b36f51e 1101AT_DATA([flows.txt], [dnl
bdda5aca 1102actions=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
1103])
1104AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1105AT_CHECK([ovs-vsctl -- \
1106 set Port p1 qos=@newqos --\
1107 --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
1108 --id=@q1 create Queue dscp=1 --\
1109 --id=@q2 create Queue dscp=2], [0], [ignore])
50aa28fd 1110AT_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 1111AT_CHECK([tail -2 stdout], [0],
e3981271 1112 [Megaflow: recirc_id=0,skb_priority=0,eth,ip,in_port=9,nw_tos=252,nw_frag=no
ce58df5b 1113Datapath actions: dnl
e44768b7 1114100,dnl
d23df9a8
JR
1115set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1116set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
8b36f51e 11171,dnl
d23df9a8
JR
1118set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1119set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
1120set(ipv4(tos=0/0xfc)),1,100
8b36f51e
EJ
1121])
1122OVS_VSWITCHD_STOP
1123AT_CLEANUP
1124
fd19297b 1125AT_SETUP([ofproto-dpif - output/flood flags])
f7b8e494 1126OVS_VSWITCHD_START
ca5792f0 1127add_of_ports br0 1 2 3 4 5 6 7
fd19297b
EJ
1128
1129AT_DATA([flows.txt], [dnl
a0fbe94a 1130in_port=local actions=local,flood
fd19297b
EJ
1131in_port=1 actions=flood
1132in_port=2 actions=all
bdda5aca
BP
1133in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
1134in_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
1135])
1136AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1137AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
1138AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
1139
50aa28fd 1140AT_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
1141AT_CHECK([tail -1 stdout \
1142| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
11431
11442
11453
11464
11477
1148])
1149
50aa28fd 1150AT_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
1151AT_CHECK([tail -1 stdout \
1152| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
e44768b7 1153100
fd19297b
EJ
11542
11553
11564
11577
1158])
1159
50aa28fd 1160AT_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
1161AT_CHECK([tail -1 stdout \
1162| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
fd19297b 11631
e44768b7 1164100
fd19297b
EJ
11653
11664
11676
11687
1169])
1170
50aa28fd 1171AT_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 1172AT_CHECK([tail -1 stdout], [0],
e44768b7 1173 [Datapath actions: 100,1,2,4,6,7
fd19297b
EJ
1174])
1175
50aa28fd 1176AT_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 1177AT_CHECK([tail -1 stdout], [0],
1b567fb9 1178 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
fd19297b
EJ
1179])
1180OVS_VSWITCHD_STOP
1181AT_CLEANUP
1182
6b83a3c5 1183AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
6d328fa2
SH
1184OVS_VSWITCHD_START([dnl
1185 add-port br0 p1 -- set Interface p1 type=dummy
1186])
53eb8cb8 1187on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1188
1189AT_CAPTURE_FILE([ofctl_monitor.log])
1190
6409e008 1191AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1192
1193for i in 1 2 3 ; do
ea2735d3 1194 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 1195done
8bd16974 1196OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1197OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2 1198AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1199NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1200tcp,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 1201dnl
efe179e0 1202NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1203tcp,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 1204dnl
efe179e0 1205NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1206tcp,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
1207])
1208
1209AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1210AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1211NXST_FLOW reply:
1212])
1213
1214OVS_VSWITCHD_STOP
1215AT_CLEANUP
1216
6b83a3c5
SH
1217AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
1218OVS_VSWITCHD_START([dnl
1219 add-port br0 p1 -- set Interface p1 type=dummy
1220])
53eb8cb8 1221on_exit 'kill `cat ovs-ofctl.pid`'
6b83a3c5
SH
1222
1223AT_CAPTURE_FILE([ofctl_monitor.log])
1224AT_CHECK([ovs-ofctl del-flows br0])
1225
6409e008 1226AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6b83a3c5 1227
40ebbf78 1228dnl Test that missed packets are dropped
6b83a3c5 1229for i in 1 2 3 ; do
ea2735d3 1230 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 1231done
d9c8c57c 1232OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6b83a3c5
SH
1233
1234AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1235])
1236
1237AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1238AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1239OFPST_FLOW reply (OF1.3):
1240])
1241
1242OVS_VSWITCHD_STOP
1243AT_CLEANUP
1244
6d328fa2
SH
1245AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
1246OVS_VSWITCHD_START([dnl
1247 add-port br0 p1 -- set Interface p1 type=dummy
1248])
53eb8cb8 1249on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1250
1251AT_CAPTURE_FILE([ofctl_monitor.log])
1252AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1253
6409e008 1254AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1255
1256for i in 1 2 3 ; do
8e4c1621 1257 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 1258done
8bd16974 1259OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1260OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2 1261AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1262OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1263tcp,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 1264dnl
efe179e0 1265OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1266tcp,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 1267dnl
efe179e0 1268OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1269tcp,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
1270])
1271
cea4a6d7 1272AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1273AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 1274 n_packets=3, n_bytes=162, actions=goto_table:1
6d328fa2
SH
1275OFPST_FLOW reply (OF1.2):
1276])
1277
1278OVS_VSWITCHD_STOP
1279AT_CLEANUP
1280
1281AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
1282OVS_VSWITCHD_START([dnl
1283 add-port br0 p1 -- set Interface p1 type=dummy
1284])
53eb8cb8 1285on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1286
1287AT_CAPTURE_FILE([ofctl_monitor.log])
1288AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1289
6409e008 1290AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1291
1292for i in 1 2 3 ; do
1293 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)'
1294done
1295
d9c8c57c 1296OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1297AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1298])
1299
cea4a6d7 1300AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1301AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1302 n_packets=3, n_bytes=354, actions=resubmit(1,1)
6d328fa2
SH
1303OFPST_FLOW reply (OF1.2):
1304])
1305
1306OVS_VSWITCHD_STOP
1307AT_CLEANUP
1308
1309AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1310OVS_VSWITCHD_START([dnl
1311 add-port br0 p1 -- set Interface p1 type=dummy
1312])
53eb8cb8 1313on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1314
1315AT_CAPTURE_FILE([ofctl_monitor.log])
1316AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1317AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1318
1319dnl Miss table 0, Hit table 1
6409e008 1320AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1321
1322for i in 1 2 3 ; do
1323 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)'
1324done
8bd16974 1325OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1326OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1327
1328AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1329NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1330tcp,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 1331dnl
6f068379
BP
1332NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1333tcp,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 1334dnl
6f068379
BP
1335NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1336tcp,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
1337])
1338
1339dnl Hit table 0, Miss all other tables, sent to controller
6409e008 1340AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1341
1342for i in 1 2 3 ; do
1343 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)'
1344done
8bd16974 1345OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1346OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1347
1348AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1349NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1350tcp,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 1351dnl
6f068379
BP
1352NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1353tcp,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 1354dnl
6f068379
BP
1355NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1356tcp,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
1357])
1358
cea4a6d7 1359AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1360AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1361 table=1, n_packets=3, n_bytes=354, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
6d328fa2
SH
1362OFPST_FLOW reply (OF1.2):
1363])
1364
1365OVS_VSWITCHD_STOP
1366AT_CLEANUP
1367
1368AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1369OVS_VSWITCHD_START([dnl
1370 add-port br0 p1 -- set Interface p1 type=dummy
1371])
53eb8cb8 1372on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1373
1374AT_CAPTURE_FILE([ofctl_monitor.log])
1375AT_DATA([flows.txt], [dnl
1376table=0 actions=goto_table(1)
1377table=2 dl_src=10:11:11:11:11:11 actions=controller
1378])
1379AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1380AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1381
1382dnl Hit table 0, Miss table 1, Hit table 2
6409e008 1383AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1384
1385for i in 1 2 3 ; do
1386 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)'
1387done
8bd16974 1388OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1389OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1390
1391AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1392NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1393tcp,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 1394dnl
6f068379
BP
1395NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1396tcp,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 1397dnl
6f068379
BP
1398NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1399tcp,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
1400])
1401
1402dnl Hit table 1, Miss all other tables, sent to controller
6409e008 1403AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1404
1405for i in 1 2 3 ; do
1406 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)'
1407done
8bd16974 1408OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1409OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1410
1411AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1412NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1413tcp,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 1414dnl
6f068379
BP
1415NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1416tcp,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 1417dnl
6f068379
BP
1418NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1419tcp,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
1420])
1421
cea4a6d7 1422AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1423AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379
BP
1424 n_packets=6, n_bytes=708, actions=goto_table:1
1425 table=2, n_packets=3, n_bytes=354, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
6d328fa2
SH
1426OFPST_FLOW reply (OF1.2):
1427])
1428
1429OVS_VSWITCHD_STOP
1430AT_CLEANUP
1431
1432AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1433OVS_VSWITCHD_START([dnl
1434 add-port br0 p1 -- set Interface p1 type=dummy
1435])
53eb8cb8 1436on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1437
1438AT_CAPTURE_FILE([ofctl_monitor.log])
1439AT_DATA([flows.txt], [dnl
1440table=0 actions=resubmit(1,1)
1441table=2 dl_src=10:11:11:11:11:11 actions=controller
1442])
1443AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1444AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1445
1446dnl Hit table 0, Miss table 1, Dropped
6409e008 1447AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1448
1449for i in 1 2 3 ; do
1450 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)'
1451done
0c473314 1452OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1453
1454AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1455])
1456
1457dnl Hit table 1, Dropped
6409e008 1458AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1459
1460for i in 1 2 3 ; do
1461 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)'
1462done
d9c8c57c 1463OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1464
1465AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1466])
1467
cea4a6d7 1468AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1469AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1470 n_packets=6, n_bytes=708, actions=resubmit(1,1)
6d328fa2
SH
1471 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1472OFPST_FLOW reply (OF1.2):
1473])
1474
1475OVS_VSWITCHD_STOP
1476AT_CLEANUP
1477
1478AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1479OVS_VSWITCHD_START([dnl
1480 add-port br0 p1 -- set Interface p1 type=dummy
1481])
53eb8cb8 1482on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1483
1484AT_CAPTURE_FILE([ofctl_monitor.log])
1485AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1486
6409e008 1487AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1488
40ebbf78 1489dnl Test that missed packets are dropped
6d328fa2
SH
1490for i in 1 2 3 ; do
1491 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)'
1492done
d9c8c57c 1493OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1494
1495AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1496])
1497
1498AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1499AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1500NXST_FLOW reply:
1501])
1502
1503OVS_VSWITCHD_STOP
1504AT_CLEANUP
1505
1506AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1507OVS_VSWITCHD_START([dnl
1508 add-port br0 p1 -- set Interface p1 type=dummy
1509])
53eb8cb8 1510on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1511
1512AT_CAPTURE_FILE([ofctl_monitor.log])
1513AT_CHECK([ovs-ofctl del-flows br0])
1514AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1515AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1516
6409e008 1517AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1518
40ebbf78 1519dnl Test that missed packets are dropped
6d328fa2
SH
1520for i in 1 2 3 ; do
1521 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)'
1522done
d9c8c57c 1523OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1524
1525AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1526])
1527
cea4a6d7 1528AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1529AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1530 n_packets=3, n_bytes=354, actions=goto_table:1
6d328fa2
SH
1531OFPST_FLOW reply (OF1.2):
1532])
1533
1534OVS_VSWITCHD_STOP
1535AT_CLEANUP
1536
1537AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1538OVS_VSWITCHD_START([dnl
1539 add-port br0 p1 -- set Interface p1 type=dummy
1540])
53eb8cb8 1541on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1542
1543AT_CAPTURE_FILE([ofctl_monitor.log])
1544AT_CHECK([ovs-ofctl del-flows br0])
1545AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1546AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1547
6409e008 1548AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1549
40ebbf78 1550dnl Test that missed packets are dropped
6d328fa2
SH
1551for i in 1 2 3 ; do
1552 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)'
1553done
d9c8c57c 1554OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1555
1556AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1557])
1558
cea4a6d7 1559AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1560AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1561 n_packets=3, n_bytes=354, actions=resubmit(1,1)
6d328fa2
SH
1562OFPST_FLOW reply (OF1.2):
1563])
1564
1565OVS_VSWITCHD_STOP
1566AT_CLEANUP
1567
15056dc8
EJ
1568AT_SETUP([ofproto-dpif - controller])
1569OVS_VSWITCHD_START([dnl
1570 add-port br0 p1 -- set Interface p1 type=dummy
1571])
53eb8cb8 1572on_exit 'kill `cat ovs-ofctl.pid`'
15056dc8
EJ
1573
1574AT_CAPTURE_FILE([ofctl_monitor.log])
1575AT_DATA([flows.txt], [dnl
1576cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
54834960 1577cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
15056dc8
EJ
1578cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1579
54834960
EJ
1580cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1581cookie=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)
1582cookie=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)
1583cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1584cookie=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)
1585cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1586cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
78cef7fd 1587cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
56d72f37 1588cookie=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
1589])
1590AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1591
1592dnl Flow miss.
6409e008 1593AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1594
1595for i in 1 2 3 ; do
dc235f7f 1596 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 1597done
57c94f35 1598OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1599OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1600
15056dc8 1601AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1602OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1603tcp,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 1604dnl
6f068379
BP
1605OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1606tcp,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 1607dnl
6f068379
BP
1608OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1609tcp,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
1610])
1611
1612dnl Singleton controller action.
6409e008 1613AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1614
1615for i in 1 2 3 ; do
dc235f7f 1616 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 1617done
57c94f35 1618OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1619OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1620
15056dc8 1621AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1622OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 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=10,tcp_flags=syn tcp_csum:2e7d
efe179e0 1624OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1625tcp,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 1626OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1627tcp,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
1628])
1629
1630dnl Modified controller action.
6409e008 1631AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1632
1633for i in 1 2 3 ; do
dc235f7f 1634 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 1635done
57c94f35 1636OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1637OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1638
15056dc8 1639AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1640OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1641tcp,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 1642dnl
efe179e0 1643OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1644tcp,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 1645dnl
efe179e0 1646OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1647tcp,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
1648])
1649
363dd1d9 1650dnl Modified VLAN controller action.
6409e008 1651AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
363dd1d9
JS
1652
1653for i in 1 2 3; do
8249a1fe 1654 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 1655done
57c94f35 1656OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1657OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
363dd1d9 1658
363dd1d9 1659AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1660NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1661ip,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 1662dnl
efe179e0 1663NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1664ip,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 1665dnl
efe179e0 1666NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1667ip,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
1668])
1669
349fbdc2 1670dnl Checksum TCP.
6409e008 1671AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1672
1673for i in 1 ; do
1674 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)'
1675done
1676OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1677OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1678
1679AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1680NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1681tcp,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 1682dnl
efe179e0 1683NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=58 reg0=0x1,in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1684tcp,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 1685dnl
efe179e0 1686NXT_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 1687tcp,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 1688dnl
efe179e0 1689NXT_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 1690tcp,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 1691dnl
efe179e0 1692NXT_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 1693tcp,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 1694dnl
efe179e0 1695NXT_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 1696tcp,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 1697dnl
efe179e0 1698NXT_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 1699tcp,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 1700dnl
efe179e0 1701NXT_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 1702tcp,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 1703dnl
efe179e0 1704NXT_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 1705tcp,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
1706])
1707
1708dnl Checksum UDP.
6409e008 1709AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1710
1711for i in 1 ; do
1712 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'
1713done
1714OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1715OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1716
1717AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1718NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1719udp,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 1720dnl
50dcbd8e 1721NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
f0fb825a 1722udp,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 1723dnl
50dcbd8e 1724NXT_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 1725udp,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 1726dnl
50dcbd8e 1727NXT_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 1728udp,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 1729dnl
50dcbd8e 1730NXT_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 1731udp,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 1732dnl
50dcbd8e 1733NXT_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 1734udp,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 1735dnl
50dcbd8e 1736NXT_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 1737udp,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 1738dnl
50dcbd8e 1739NXT_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 1740udp,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 1741dnl
50dcbd8e 1742NXT_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 1743udp,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
1744])
1745
1746dnl Modified ARP controller action.
6409e008 1747AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1748
1749for i in 1 2 3; do
1750 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)'
1751done
1752
368a198a 1753OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1754OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2 1755AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1756NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1757arp,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 1758NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1759arp,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 1760NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1761arp,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 1762NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1763arp,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 1764NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1765arp,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 1766NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1767arp,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 1768NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1769arp,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 1770NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1771arp,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 1772NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1773arp,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
1774])
1775
1776AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1777
1778dnl Checksum SCTP.
6409e008 1779AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1780
1781for i in 1 ; do
1782 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'
1783done
1784
f7a22c7e 1785AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
349fbdc2 1786OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1787OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1788AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1789NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
e6d9ab56 1790sctp,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 1791dnl
50dcbd8e 1792NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
f0fb825a 1793sctp,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 1794dnl
50dcbd8e 1795NXT_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 1796sctp,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 1797dnl
50dcbd8e 1798NXT_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 1799sctp,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 1800dnl
50dcbd8e 1801NXT_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 1802sctp,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 1803dnl
50dcbd8e 1804NXT_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 1805sctp,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 1806dnl
50dcbd8e 1807NXT_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 1808sctp,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 1809dnl
50dcbd8e 1810NXT_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 1811sctp,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 1812dnl
50dcbd8e 1813NXT_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 1814sctp,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
1815])
1816
1817AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
1818 cookie=0x1, n_packets=3, n_bytes=212, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1819 cookie=0x2, n_packets=3, n_bytes=162, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1820 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)
1821 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)
1822 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)
1823 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)
1824 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)
1825 cookie=0x8, table=6, n_packets=3, n_bytes=212, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1826 cookie=0x9, table=7, n_packets=3, n_bytes=212, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1827 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
1828 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
1829 n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
349fbdc2
SH
1830NXST_FLOW reply:
1831])
1832
1833OVS_VSWITCHD_STOP
1834AT_CLEANUP
1835
d39ec23d
JP
1836
1837AT_SETUP([ofproto-dpif - controller with slow-path action])
1838OVS_VSWITCHD_START
1839add_of_ports br0 1 2
1840
1841AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,controller"])
1842
1843AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1844
1845for i in 1 2 3 ; do
1846 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)'
1847done
1848
1849OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
1850OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1851
1852AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1853OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1854tcp,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 1855dnl
6f068379
BP
1856OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1857tcp,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 1858dnl
6f068379
BP
1859OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1860tcp,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
1861])
1862
1863OVS_VSWITCHD_STOP
1864AT_CLEANUP
1865
1866
1dea1435 1867AT_SETUP([ofproto-dpif - controller action without megaflows])
1868OVS_VSWITCHD_START
1869add_of_ports br0 1
1870
1871AT_CHECK([ovs-ofctl add-flow br0 in_port=1,action=controller])
1872AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [dnl
1873megaflows disabled
1874])
1875
1876AT_CAPTURE_FILE([ofctl_monitor.log])
1877AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1878
1879for i in 1 2; do
1880 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)'])
1881done
1882
1883OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
1884OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1885
1886AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1887flow-dump from non-dpdk interfaces:
74c4530d 1888packets: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 1889])
1890
1891AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1892NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1893vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1894NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1895vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1896])
1897
af7535e7
AZ
1898AT_CHECK([ovs-appctl revalidator/purge])
1899AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1900
1901dnl Add a controller meter.
d39ec23d 1902AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=controller pktps stats bands=type=drop rate=2'])
af7535e7
AZ
1903
1904dnl Advance time by 1 second.
1905AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1906
1907for i in `seq 1 8`; do
1908 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)'])
1909done
1910
1911AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1912flow-dump from non-dpdk interfaces:
74c4530d 1913packets: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
1914])
1915
1916AT_CHECK([ovs-appctl time/warp 1], [0], [ignore])
1917OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1918
d39ec23d
JP
1919dnl Out of 8 packets we sent, two were passed by the rate limiter, and
1920dnl the rest of packets were blocked.
af7535e7
AZ
1921AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1922NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1923vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1924NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1925vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1926])
1927dnl Check meter stats to make it gives the same picture;
1928dnl 7 packets hit the meter, but 6 packets are dropped by band0.
bad98905 1929AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
af7535e7 1930OFPST_METER reply (OF1.3) (xid=0x2):
d39ec23d 1931meter:controller flow_count:0 packet_in_count:8 byte_in_count:112 duration:0.0s bands:
af7535e7
AZ
19320: packet_count:6 byte_count:84
1933])
1934
1dea1435 1935OVS_VSWITCHD_STOP
1936AT_CLEANUP
1937
349fbdc2
SH
1938AT_SETUP([ofproto-dpif - MPLS handling])
1939OVS_VSWITCHD_START([dnl
1940 add-port br0 p1 -- set Interface p1 type=dummy
1941])
53eb8cb8 1942on_exit 'kill `cat ovs-ofctl.pid`'
349fbdc2
SH
1943
1944AT_CAPTURE_FILE([ofctl_monitor.log])
1945AT_DATA([flows.txt], [dnl
1946cookie=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
1947cookie=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
1948cookie=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
1949cookie=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
1950cookie=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
1951cookie=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
1952cookie=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
1953cookie=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 1954cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
349fbdc2
SH
1955cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1956cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1957cookie=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
1958
1959cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1960cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1961cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1962cookie=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 1963cookie=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
1ffd16af
SH
1964cookie=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]],slaves:1,2),controller
1965cookie=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
1966
1967cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1968cookie=0xd table=1 arp actions=controller
1969
e672ff9b
JR
1970cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1971cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1ffd16af
SH
1972cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1973cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1974
1975cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1976cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1977cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1978
1979cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
e672ff9b
JR
1980cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1981cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1ffd16af 1982
e672ff9b
JR
1983cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1984cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1985cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 1986
e672ff9b
JR
1987cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1988cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1989cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 1990
e672ff9b
JR
1991cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1992cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1993cookie=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
1994])
1995AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1996
b02475c5 1997dnl Modified MPLS controller action.
6409e008 1998AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1999
2000for i in 1 2 3; do
791a09be 2001 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 2002done
57c94f35 2003OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2004OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2005
b02475c5 2006AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379 2007NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
e6d9ab56 2008mpls,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 2009dnl
6f068379 2010NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
e6d9ab56 2011mpls,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 2012dnl
6f068379 2013NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
e6d9ab56 2014mpls,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
2015])
2016
2017dnl Modified MPLS controller action.
6409e008 2018AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5 2019
b0a17866 2020for i in 1 2 3; do
8249a1fe 2021 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
2022done
2023OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2024OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b0a17866
SH
2025
2026AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2027NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 2028ip,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 2029dnl
efe179e0 2030NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 2031ip,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 2032dnl
efe179e0 2033NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 2034ip,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
2035])
2036
2037dnl Modified MPLS controller action.
6409e008 2038AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b0a17866 2039
b02475c5
SH
2040dnl 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)
2041
2042for i in 1 2 3; do
2043 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)'
2044done
bece9ea7 2045OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2046OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
bece9ea7 2047
b02475c5 2048AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2049NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2050mpls,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 2051dnl
efe179e0 2052NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2053mpls,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 2054dnl
efe179e0 2055NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2056mpls,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
2057])
2058
2059dnl Modified MPLS controller action.
6409e008 2060AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2061
2062for i in 1 2 3; do
8249a1fe 2063 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 2064done
57c94f35 2065OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2066OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2067
b02475c5 2068AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2069NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 2070mpls,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 2071dnl
efe179e0 2072NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 2073mpls,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 2074dnl
efe179e0 2075NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 2076mpls,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
2077])
2078
b676167a 2079dnl Modified MPLS controller action.
6409e008 2080AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b676167a
SH
2081
2082for i in 1 2 3; do
8249a1fe 2083 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 2084done
57c94f35 2085OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2086OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b676167a 2087
b676167a 2088AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2089NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2090mpls,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 2091dnl
efe179e0 2092NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2093mpls,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 2094dnl
efe179e0 2095NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2096mpls,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
2097])
2098
0f3f3c3d 2099dnl Modified MPLS controller action.
6409e008 2100AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
2101
2102for i in 1 2 3; do
8249a1fe 2103 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 2104done
57c94f35 2105OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2106OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 2107
0f3f3c3d 2108AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2109NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2110mpls,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 2111dnl
efe179e0 2112NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2113mpls,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 2114dnl
efe179e0 2115NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2116mpls,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
2117])
2118
2119dnl Modified MPLS controller action.
6409e008 2120AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
2121
2122for i in 1 2 3; do
8249a1fe 2123 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 2124done
57c94f35 2125OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2126OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 2127
0f3f3c3d 2128AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2129NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2130mpls,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 2131dnl
efe179e0 2132NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2133mpls,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 2134dnl
efe179e0 2135NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2136mpls,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
2137])
2138
1ffd16af
SH
2139AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2140
2141dnl Modified MPLS controller action.
6409e008 2142AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2143
2144for i in 1 2 3; do
2145 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)'
2146done
2147OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2148OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1ffd16af
SH
2149
2150AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2151NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2152mplsm,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 2153dnl
efe179e0 2154NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2155mplsm,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 2156dnl
efe179e0 2157NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2158mplsm,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
2159])
2160
2161AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2162
0f3f3c3d 2163dnl Modified MPLS controller action.
6409e008 2164AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
2165
2166for i in 1 2 3; do
8249a1fe 2167 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 2168done
57c94f35 2169OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2170OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 2171
0f3f3c3d 2172AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2173NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2174mpls,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 2175dnl
efe179e0 2176NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2177mpls,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 2178dnl
efe179e0 2179NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2180mpls,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
2181])
2182
b02475c5 2183dnl Modified MPLS actions.
6409e008 2184AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2185
2186for i in 1 2 3; do
02830175 2187 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 2188done
57c94f35 2189OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2190OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2191
b02475c5 2192AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2193NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 2194mpls,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 2195dnl
efe179e0 2196NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 2197mpls,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 2198dnl
efe179e0 2199NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 2200mpls,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
2201])
2202
2203dnl Modified MPLS ipv6 controller action.
6409e008 2204AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2205
2206for i in 1 2 3; do
2207 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)'
2208done
57c94f35 2209OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2210OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2211
b02475c5 2212AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2213NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2214mplsm,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 2215dnl
efe179e0 2216NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2217mplsm,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 2218dnl
efe179e0 2219NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2220mplsm,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
2221])
2222
2223
2224dnl Modified MPLS pop action.
cff78c88
SH
2225dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
2226dnl 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)
2227dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
2228
6409e008 2229AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2230
2231for i in 1 2 3; do
cff78c88 2232 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 2233done
cff78c88
SH
2234#for i in 2 3; do
2235# 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)'
2236#done
57c94f35 2237OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2238OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2239
b02475c5 2240AT_CHECK([cat ofctl_monitor.log], [0], [dnl
cff78c88 2241NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2242tcp,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 2243dnl
cff78c88 2244NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2245tcp,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 2246dnl
cff78c88 2247NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2248tcp,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
2249])
2250
5c0243a9 2251AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
0d56eaf2 2252
1ffd16af
SH
2253dnl Modified MPLS pop action.
2254dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2255dnl 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)
2256dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2257dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2258AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2259
2260for i in 1 2 3; do
2261 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'
2262done
2263OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2264OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2265
2be3fe44 2266AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2267NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2268tcp,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 2269dnl
e672ff9b 2270NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2271tcp,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 2272dnl
e672ff9b 2273NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2274tcp,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
2275])
2276
2277AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2278
2279dnl Modified MPLS pop action.
2280dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2281dnl 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)
2282dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2283dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2284AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2285
2286for i in 1 2 3; do
2287 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'
2288done
2289OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2290OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2291
2be3fe44 2292AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2293NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2294tcp,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 2295dnl
e672ff9b 2296NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2297tcp,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 2298dnl
e672ff9b 2299NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2300tcp,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
2301])
2302
2303AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2304
2305dnl Modified MPLS pop action.
2306dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2307dnl 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)
2308dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2309dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2310AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2311
2312for i in 1 2 3; do
2313 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'
2314done
2315OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2316OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2317
2be3fe44 2318AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2319NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2320tcp,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 2321dnl
e672ff9b 2322NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2323tcp,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 2324dnl
e672ff9b 2325NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2326tcp,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
2327])
2328
2329AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2330
2331dnl Modified MPLS pop action.
2332dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2333dnl 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)
2334dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2335dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2336AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2337
2338for i in 1 2 3; do
2339 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'
2340done
2341OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2342OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2343
2be3fe44 2344AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2345NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2346tcp,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 2347dnl
e672ff9b 2348NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2349tcp,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 2350dnl
e672ff9b 2351NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2352tcp,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
2353])
2354
2355AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2356
2357dnl Modified MPLS pop action.
2358dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2359dnl 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)
2360dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2361dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2362AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2363
2364for i in 1 2 3; do
2365 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'
2366done
2367OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2368OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2369
2be3fe44 2370AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2371NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2372tcp,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 2373dnl
e672ff9b 2374NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2375tcp,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 2376dnl
e672ff9b 2377NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2378tcp,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
2379])
2380
2381AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2382
2383dnl Modified MPLS pop action.
2384dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2385dnl 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)
2386dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2387dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2388AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2389
2390for i in 1 2 3; do
2391 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'
2392done
2393OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2394OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2395
2be3fe44 2396AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2397NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2398tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,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 2399dnl
e672ff9b 2400NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2401tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,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 2402dnl
e672ff9b 2403NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2404tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,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
2405])
2406
2407AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2408
2409dnl Modified MPLS pop action.
2410dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2411dnl 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)
2412dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2413dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2414AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2415
2416for i in 1 2 3; do
2417 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'
2418done
2419OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2420OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2421
2be3fe44 2422AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2423NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2424tcp,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 2425dnl
e672ff9b 2426NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2427tcp,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 2428dnl
e672ff9b 2429NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2430tcp,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
2431])
2432
2433AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2434
2435dnl Modified MPLS pop action.
2436dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2437dnl 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)
6409e008 2438AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2439
2440for i in 1 2 3; do
2441 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'
2442done
2443OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2444OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2445
2be3fe44 2446AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
efe179e0 2447NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2448arp,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 2449dnl
efe179e0 2450NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2451arp,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 2452dnl
efe179e0 2453NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2454arp,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
2455])
2456
2457AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2458
2459dnl Modified MPLS pop action.
2460dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2461dnl 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)
2462dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2463dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2464AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2465
2466for i in 1 2 3; do
2467 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'
2468done
2469OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2470OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2471
2be3fe44 2472AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2473NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2474tcp,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 2475dnl
e672ff9b 2476NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2477tcp,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 2478dnl
e672ff9b 2479NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2480tcp,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
2481])
2482
2483AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2484
2485dnl Modified MPLS pop action.
2486dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2487dnl 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)
2488dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2489dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2490AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2491
2492for i in 1 2 3; do
2493 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'
2494done
2495OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2496OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2497
2be3fe44 2498AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2499NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2500tcp,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 2501dnl
e672ff9b 2502NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2503tcp,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 2504dnl
e672ff9b 2505NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2506tcp,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
2507])
2508
2509AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2510
2511dnl Modified MPLS pop action.
2512dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2513dnl 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)
2514dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2515dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2516AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2517
2518for i in 1 2 3; do
2519 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'
2520done
2521OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2522OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2523
2be3fe44 2524AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2525NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2526tcp,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 2527dnl
e672ff9b 2528NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2529tcp,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 2530dnl
e672ff9b 2531NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2532tcp,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
2533])
2534
2535AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2536
2537dnl Modified MPLS pop action.
2538dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2539dnl 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
2540dnl (label 20, exp 0, [S], ttl 31)
2541dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2542dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2543AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2544
2545for i in 1 2 3; do
2546 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'
2547done
2548OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2549OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2550
2551AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2552NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2553mplsm,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
2554dnl
2555NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2556mplsm,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
2557dnl
2558NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2559mplsm,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
2560])
2561
2562AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2563
2564dnl Modified MPLS pop action.
2565dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2566dnl 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
2567dnl (label 20, exp 0, [S], ttl 31)
2568dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2569dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2570AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2571
2572for i in 1 2 3; do
2573 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'
2574done
2575OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2576OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2577
2578AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2579NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2580mpls,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 2581dnl
e672ff9b 2582NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2583mpls,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 2584dnl
e672ff9b 2585NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2586mpls,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
2587])
2588
2589AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2590
2591dnl Modified MPLS pop action.
2592dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2593dnl 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
2594dnl (label 20, exp 0, [S], ttl 31)
2595dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2596dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2597AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2598
2599for i in 1 2 3; do
2600 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'
2601done
2602OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2603OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2604
2605AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2606NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2607mplsm,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
2608dnl
2609NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2610mplsm,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
2611dnl
2612NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2613mplsm,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
2614])
2615
2616AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2617
2618dnl Modified MPLS pop action.
2619dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2620dnl 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
2621dnl (label 20, exp 0, [S], ttl 31)
2622dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2623dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2624AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2625
2626for i in 1 2 3; do
2627 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'
2628done
2629OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2630OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2631
2632AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2633NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2634tcp,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 2635dnl
e672ff9b 2636NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2637tcp,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 2638dnl
e672ff9b 2639NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2640tcp,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
2641])
2642
2643AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2644
2645dnl Modified MPLS pop action.
2646dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2647dnl 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
2648dnl (label 20, exp 0, [S], ttl 31)
2649dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2650dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2651AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2652
2653for i in 1 2 3; do
2654 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'
2655done
e672ff9b 2656
1ffd16af
SH
2657OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2658OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2659
2be3fe44 2660AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2661NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2662tcp,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 2663dnl
e672ff9b 2664NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2665tcp,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 2666dnl
e672ff9b 2667NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2668tcp,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
2669])
2670
2671AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2672
2673dnl Modified MPLS pop action.
2674dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2675dnl 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
2676dnl (label 20, exp 0, [S], ttl 31)
2677dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2678dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2679AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2680
2681for i in 1 2 3; do
2682 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'
2683done
2684OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2685OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2686
2be3fe44 2687AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2688NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2689tcp,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 2690dnl
e672ff9b 2691NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2692tcp,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 2693dnl
e672ff9b 2694NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2695tcp,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
2696])
2697
2698AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2699
2700dnl Modified MPLS pop action.
2701dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2702dnl 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
2703dnl (label 20, exp 0, ttl 31)
2704dnl (label 20, exp 0, [S], ttl 30)
2705dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2706dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2707AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2708
2709for i in 1 2 3; do
2710 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'
2711done
2712OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2713OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2714
2715AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2716NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2717mplsm,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 2718dnl
e672ff9b 2719NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2720mplsm,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 2721dnl
e672ff9b 2722NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2723mplsm,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
2724])
2725
2726AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2727
2728dnl Modified MPLS pop action.
2729dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2730dnl 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
2731dnl (label 20, exp 0, ttl 31)
2732dnl (label 20, exp 0, [S], ttl 30)
2733dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2734dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2735AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2736
2737for i in 1 2 3; do
2738 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'
2739done
2740OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2741OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2742
2743AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2744NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2745mpls,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 2746dnl
e672ff9b 2747NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2748mpls,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 2749dnl
e672ff9b 2750NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2751mpls,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
2752])
2753
2754AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2755
2756dnl Modified MPLS pop action.
2757dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2758dnl 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
2759dnl (label 20, exp 0, ttl 31)
2760dnl (label 20, exp 0, [S], ttl 30)
2761dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2762dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2763AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2764
2765for i in 1 2 3; do
2766 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'
2767done
2768OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2769OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2770
2771AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2772NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2773mplsm,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 2774dnl
e672ff9b 2775NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2776mplsm,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 2777dnl
e672ff9b 2778NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2779mplsm,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
2780])
2781
2782AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2783
2784dnl Modified MPLS pop action.
2785dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2786dnl 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)
2787dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2788dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2789AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2790
2791for i in 1 2 3; do
2792 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'
2793done
2794OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2795OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2796
2be3fe44 2797AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2798NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2799mpls,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 2800dnl
e672ff9b 2801NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2802mpls,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 2803dnl
e672ff9b 2804NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2805mpls,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
2806])
2807
2808AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2809
2810dnl Modified MPLS pop action.
2811dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2812dnl 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)
2813dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2814dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2815AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2816
2817for i in 1 2 3; do
2818 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'
2819done
2820OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2821OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2822
2be3fe44 2823AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2824NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2825mplsm,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 2826dnl
e672ff9b 2827NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2828mplsm,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 2829dnl
e672ff9b 2830NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2831mplsm,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
2832])
2833
2834AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2835
2836dnl Modified MPLS pop action.
2837dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2838dnl 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)
2839dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2840dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2841AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2842
2843for i in 1 2 3; do
2844 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'
2845done
2846OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2847OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2848
2be3fe44 2849AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2850NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2851mplsm,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 2852dnl
e672ff9b 2853NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2854mplsm,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 2855dnl
e672ff9b 2856NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2857mplsm,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
2858])
2859
2860AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2861
2862dnl Modified MPLS pop action.
2863dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2864dnl 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)
2865dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2866dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2867AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2868
2869for i in 1 2 3; do
2870 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'
2871done
e672ff9b 2872
1ffd16af
SH
2873OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2874OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2875
2876AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2877NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2878mpls,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 2879dnl
e672ff9b 2880NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2881mpls,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 2882dnl
e672ff9b 2883NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2884mpls,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
2885])
2886
2887AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2888
2889dnl Modified MPLS pop action.
2890dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2891dnl 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)
2892dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2893dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2894AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2895
2896for i in 1 2 3; do
2897 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'
2898done
2899OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2900OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2901
2902AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2903NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2904mplsm,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 2905dnl
e672ff9b 2906NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2907mplsm,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 2908dnl
e672ff9b 2909NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2910mplsm,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
2911])
2912
2913AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2914
2915dnl Modified MPLS pop action.
2916dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2917dnl 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)
2918dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2919dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2920AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2921
2922for i in 1 2 3; do
2923 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'
2924done
e672ff9b 2925
1ffd16af
SH
2926OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2927OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2928
2929AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2930NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2931mpls,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 2932dnl
e672ff9b 2933NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2934mpls,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 2935dnl
e672ff9b 2936NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2937mpls,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
2938])
2939
cea4a6d7 2940AT_CHECK([ovs-appctl revalidator/purge], [0])
ef0ce8ae 2941AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
e672ff9b
JR
2942 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
2943 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
2944 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
2945 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
2946 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
2947 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
2948 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
2949 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
2950 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 2951 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
2952 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
2953 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
2954 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
2955 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
2956 cookie=0xd, n_packets=3, n_bytes=138, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
c2d936a4 2957 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
2958 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
2959 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
2960 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 2961 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
1ffd16af
SH
2962 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]],slaves:1,2),CONTROLLER:65535
2963 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 2964 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
1ffd16af
SH
2965 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
2966 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 2967 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
1ffd16af
SH
2968 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2969 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
2970 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
2971 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 2972 cookie=0xd, table=1, n_packets=3, n_bytes=126, arp actions=CONTROLLER:65535
e672ff9b
JR
2973 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
2974 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
2975 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
2976 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
2977 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
2978 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
2979 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
2980 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
2981 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 2982NXST_FLOW reply:
15056dc8
EJ
2983])
2984
2985OVS_VSWITCHD_STOP
8e9ce036 2986AT_CLEANUP
04c956fc 2987
1ffd16af
SH
2988AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2989OVS_VSWITCHD_START([dnl
2990 add-port br0 p1 -- set Interface p1 type=dummy
2991])
53eb8cb8 2992on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
2993
2994AT_CAPTURE_FILE([ofctl_monitor.log])
2995AT_DATA([flows.txt], [dnl
2996table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2997table=1 ip,ip_dscp=8 actions=controller
2998])
2999AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
3000
3001
3002dnl Modified MPLS pop action.
3003dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3004dnl 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)
3005dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3006dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 3007AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3008
3009for i in 1 2 3; do
3010 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'
3011done
3012OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3013OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3014
2be3fe44 3015AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1ffd16af 3016OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3017tcp,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
3018dnl
3019OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3020tcp,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
3021dnl
3022OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3023tcp,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
3024])
3025
cea4a6d7 3026AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
3027AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3028 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
3029 table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
3030OFPST_FLOW reply (OF1.2):
3031])
3032
3033OVS_VSWITCHD_STOP
3034AT_CLEANUP
3035
3036AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
3037OVS_VSWITCHD_START([dnl
3038 add-port br0 p1 -- set Interface p1 type=dummy
3039])
53eb8cb8 3040on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
3041
3042dnl N.B: The first (and only) action that accesses L3 data after the
3043dnl pop_mpls action is present in write_actions. This exercises recirculation
3044dnl triggered in write_actions due to a previous action not in write actions.
3045AT_CAPTURE_FILE([ofctl_monitor.log])
3046AT_DATA([flows.txt], [dnl
3047mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
3048])
3049AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
3050
3051dnl Modified MPLS pop action.
3052dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3053dnl 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)
3054dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3055dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 3056AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3057
3058for i in 1 2 3; do
3059 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'
3060done
3061OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3062OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3063
2be3fe44 3064AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 3065OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3066tcp,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 3067dnl
e672ff9b 3068OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3069tcp,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 3070dnl
e672ff9b 3071OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3072tcp,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
3073])
3074
cea4a6d7 3075AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
3076AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3077 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
3078OFPST_FLOW reply (OF1.2):
3079])
3080
3081OVS_VSWITCHD_STOP
3082AT_CLEANUP
527ae97e
SH
3083
3084AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
3085OVS_VSWITCHD_START([dnl
3086 add-port br0 p1 -- set Interface p1 type=dummy
3087])
53eb8cb8 3088on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
3089
3090AT_CAPTURE_FILE([ofctl_monitor.log])
3091# A table-miss flow has priority 0 and no match
3092AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3093
3094dnl Singleton controller action.
6409e008 3095AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
3096
3097for i in 1 2 3 ; do
3098 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)'
3099done
3100OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3101OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
527ae97e
SH
3102
3103AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3104OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3105tcp,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 3106dnl
efe179e0 3107OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3108tcp,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 3109dnl
efe179e0 3110OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3111tcp,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
3112])
3113
cea4a6d7 3114AT_CHECK([ovs-appctl revalidator/purge], [0])
527ae97e 3115AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3116 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
527ae97e
SH
3117NXST_FLOW reply:
3118])
3119
3120OVS_VSWITCHD_STOP
3121AT_CLEANUP
3122
3123
3124AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
3125OVS_VSWITCHD_START([dnl
3126 add-port br0 p1 -- set Interface p1 type=dummy
3127])
53eb8cb8 3128on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
3129
3130AT_CAPTURE_FILE([ofctl_monitor.log])
3131# A table-miss flow has priority 0 and no match
3132AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3133
3134dnl Singleton controller action.
6409e008 3135AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
3136
3137for i in 1 2 3 ; do
3138 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)'
3139done
3140OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3141OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
527ae97e
SH
3142
3143AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3144
3145AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3146OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3147tcp,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 3148dnl
efe179e0 3149OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3150tcp,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 3151dnl
efe179e0 3152OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3153tcp,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
3154])
3155
cea4a6d7 3156AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a 3157AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3158 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
ba96552a
SS
3159OFPST_FLOW reply (OF1.3):
3160])
3161
3162OVS_VSWITCHD_STOP
3163AT_CLEANUP
3164
3165AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
3166OVS_VSWITCHD_START([dnl
3167 add-port br0 p1 -- set Interface p1 type=dummy
3168])
53eb8cb8 3169on_exit 'kill `cat ovs-ofctl.pid`'
ba96552a 3170
5b7278a1
JS
3171ovs-appctl time/stop
3172
ba96552a
SS
3173AT_CAPTURE_FILE([ofctl_monitor.log])
3174# A table-miss flow has priority 0 and no match
3175AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3176
3177dnl Singleton controller action.
6409e008 3178AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
ba96552a
SS
3179
3180# Become slave (OF 1.3), which should disable everything except port status.
3181ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3182
5b7278a1
JS
3183# Ensure that ovs-vswitchd gets a chance to reply before sending another command.
3184ovs-appctl time/warp 500 100
3185
ba96552a
SS
3186# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
3187ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
3188
5b7278a1 3189ovs-appctl time/warp 500 100
ba96552a
SS
3190for i in 1 2 3 ; do
3191 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)'
3192done
3193OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3194OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
ba96552a 3195
cea4a6d7 3196AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a
SS
3197AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3198send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
3199OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
3200dnl
3201send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
3202 master:
3203 PACKET_IN: (off)
3204 PORT_STATUS: (off)
3205 FLOW_REMOVED: (off)
904e5202
BP
3206 ROLE_STATUS: (off)
3207 TABLE_STATUS: (off)
3208 REQUESTFORWARD: (off)
ba96552a
SS
3209
3210 slave:
3211 PACKET_IN: no_match
3212 PORT_STATUS: (off)
3213 FLOW_REMOVED: (off)
904e5202
BP
3214 ROLE_STATUS: (off)
3215 TABLE_STATUS: (off)
3216 REQUESTFORWARD: (off)
ba96552a 3217dnl
efe179e0 3218OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3219tcp,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 3220dnl
efe179e0 3221OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3222tcp,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 3223dnl
efe179e0 3224OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3225tcp,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
3226])
3227
3228AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3229
3230AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3231 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
527ae97e
SH
3232OFPST_FLOW reply (OF1.3):
3233])
3234
3235OVS_VSWITCHD_STOP
3236AT_CLEANUP
3237
807c7989
SS
3238
3239AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
3240OVS_VSWITCHD_START([dnl
3241 add-port br0 p1 -- set Interface p1 type=dummy
3242])
53eb8cb8 3243on_exit 'kill `cat ovs-ofctl.pid`'
807c7989
SS
3244
3245AT_CAPTURE_FILE([ofctl_monitor.log])
3246# A table-miss flow has priority 0 and no match
3247AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3248
3249dnl Singleton controller action.
6409e008 3250AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
807c7989
SS
3251
3252for i in 1 2 3 ; do
3253 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)'
3254done
3255OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3256OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
807c7989 3257
cea4a6d7 3258AT_CHECK([ovs-appctl revalidator/purge], [0])
807c7989 3259AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3260OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3261tcp,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 3262dnl
efe179e0 3263OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3264tcp,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 3265dnl
efe179e0 3266OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3267tcp,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
3268])
3269
3270AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3271
3272AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3273 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
807c7989
SS
3274OFPST_FLOW reply (OF1.4):
3275])
3276
3277OVS_VSWITCHD_STOP
3278AT_CLEANUP
3279
3280
029ca940 3281AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3a11fd5b
SS
3282OVS_VSWITCHD_START([dnl
3283 add-port br0 p1 -- set Interface p1 type=dummy
3284])
53eb8cb8 3285on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
3286
3287AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
3288AT_DATA([flows.txt], [dnl
3289table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3290table=1 actions=output(CONTROLLER),goto_table(2)
3291table=2 actions=group:1234
3292])
3a11fd5b 3293AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 3294AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3a11fd5b
SS
3295
3296dnl Singleton controller action.
6409e008 3297AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
3298
3299for i in 1 2 3 ; do
3300 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)'
3301done
331c07ac
YHW
3302AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3303OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
d9c8c57c 3304OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3a11fd5b
SS
3305
3306AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3307
3308AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3309OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3310tcp,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 3311dnl
efe179e0 3312OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3313tcp,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 3314dnl
efe179e0 3315OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3316tcp,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 3317dnl
efe179e0 3318OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3319tcp,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 3320dnl
efe179e0 3321OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3322tcp,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 3323dnl
efe179e0 3324OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3325tcp,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 3326dnl
efe179e0 3327OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3328tcp,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 3329dnl
efe179e0 3330OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3331tcp,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 3332dnl
efe179e0 3333OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3334tcp,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
3335dnl
3336OFPT_PACKET_IN (OF1.3) (xid=0x0): total_len=54 in_port=ANY (via action) data_len=54 (unbuffered)
3337tcp,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
3338])
3339
3340AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3341
3342AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
3343 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3344 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3345 table=2, n_packets=3, n_bytes=162, actions=group:1234
3a11fd5b
SS
3346OFPST_FLOW reply (OF1.3):
3347])
3348
3349OVS_VSWITCHD_STOP
3350AT_CLEANUP
3351
3352
029ca940 3353AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3a11fd5b
SS
3354OVS_VSWITCHD_START([dnl
3355 add-port br0 p1 -- set Interface p1 type=dummy
3356])
53eb8cb8 3357on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
3358
3359AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
3360AT_DATA([flows.txt], [dnl
3361table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3362table=1 actions=output(CONTROLLER),goto_table(2)
3363table=2 actions=group:1234
3364])
3a11fd5b 3365AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 3366AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3a11fd5b
SS
3367
3368dnl Singleton controller action.
6409e008 3369AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
3370
3371for i in 1 2 3 ; do
3372 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)'
3373done
331c07ac
YHW
3374AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3375OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
d9c8c57c 3376OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3a11fd5b
SS
3377
3378AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3379
3380AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3381OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3382tcp,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 3383dnl
efe179e0 3384OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3385tcp,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 3386dnl
efe179e0 3387OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3388tcp,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 3389dnl
efe179e0 3390OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3391tcp,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 3392dnl
efe179e0 3393OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3394tcp,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 3395dnl
efe179e0 3396OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3397tcp,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 3398dnl
efe179e0 3399OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3400tcp,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 3401dnl
efe179e0 3402OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3403tcp,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 3404dnl
efe179e0 3405OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3406tcp,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
3407dnl
3408OFPT_PACKET_IN (OF1.4) (xid=0x0): total_len=54 in_port=ANY (via packet_out) data_len=54 (unbuffered)
3409tcp,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
3410])
3411
3412AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3413
3414AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
3415 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3416 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3417 table=2, n_packets=3, n_bytes=162, actions=group:1234
3a11fd5b
SS
3418OFPST_FLOW reply (OF1.4):
3419])
3420
3421OVS_VSWITCHD_STOP
3422AT_CLEANUP
3423
f5634764
KG
3424AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3425
3426OVS_VSWITCHD_START([dnl
3427 set bridge br0 datapath_type=dummy \
3428 protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
3429 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
3430
3431AT_CHECK([
3432 ovs-ofctl -OOpenFlow13 del-flows br0
3433 ovs-ofctl -OOpenFlow13 add-group br0 "group_id=6000,type=all,bucket=actions=controller,bucket=actions=resubmit(,48),bucket=actions=resubmit(,81)"
3434 ovs-ofctl -OOpenFlow13 add-flow br0 "table=0, in_port=1, vlan_tci=0x0000/0x1fff actions=write_metadata:0x67870000000000/0xffffff0000000001,goto_table:17"
3435 ovs-ofctl -OOpenFlow13 add-flow br0 "table=17, priority=10,metadata=0x67870000000000/0xffffff0000000000 actions=write_metadata:0xe067870000000000/0xfffffffffffffffe,goto_table:60"
3436 ovs-ofctl -OOpenFlow13 add-flow br0 "table=60, priority=0 actions=resubmit(,17)"
3437 ovs-ofctl -OOpenFlow13 add-flow br0 "table=17, priority=10,metadata=0xe067870000000000/0xffffff0000000000 actions=write_metadata:0x67871d4d000000/0xfffffffffffffffe,goto_table:43"
3438 ovs-ofctl -OOpenFlow13 add-flow br0 "table=43, priority=100,icmp actions=group:6000"
3439 ovs-ofctl -OOpenFlow13 add-flow br0 "table=48, priority=0 actions=resubmit(,49),resubmit(,50)"
3440 ovs-ofctl -OOpenFlow13 add-flow br0 "table=50, priority=0 actions=controller"
3441], [0], [ignore])
3442
3443AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3444
3445AT_CHECK([
3446 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
3447], [0], [ignore])
3448
3449OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
3450OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3451
3452AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3453OFPT_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)
3454icmp,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
3455dnl
3456OFPT_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)
3457icmp,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
3458])
3459
3460OVS_VSWITCHD_STOP
3461AT_CLEANUP
029ca940 3462
f6c8a6b1
BP
3463AT_SETUP([ofproto-dpif - ARP modification slow-path])
3464OVS_VSWITCHD_START
ca5792f0 3465add_of_ports br0 1 2
f6c8a6b1
BP
3466
3467ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3468ovs-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'
3469
3470# Input some packets that should follow the arp modification slow-path.
3471for i in 1 2 3; do
3472 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)'
3473done
3474AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3475
3476# Check the packets that were output.
3477AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
78c9486d
JR
3478arp,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
3479arp,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
3480arp,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
3481arp,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
3482arp,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
3483arp,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
3484arp,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
3485arp,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
3486arp,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
3487])
3488
f6c8a6b1
BP
3489OVS_VSWITCHD_STOP
3490AT_CLEANUP
3491
ecac4ebf 3492AT_SETUP([ofproto-dpif - VLAN handling])
04c956fc 3493OVS_VSWITCHD_START(
023e1e0a
BP
3494 [set Bridge br0 fail-mode=standalone -- \
3495 add-port br0 p1 trunks=10,12 -- \
ecac4ebf 3496 add-port br0 p2 tag=10 -- \
5e9ceccd
BP
3497 add-port br0 p3 tag=12 \
3498 other-config:priority-tags=true -- \
ecac4ebf
BP
3499 add-port br0 p4 tag=12 -- \
3500 add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
3501 add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
3502 add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
5e9ceccd
BP
3503 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
3504 other-config:priority-tags=true -- \
fed8962a
EG
3505 add-port br0 p9 vlan_mode=dot1q-tunnel tag=10 other-config:qinq-ethtype=802.1q -- \
3506 add-port br0 p10 vlan_mode=dot1q-tunnel tag=10 cvlans=10,12 other-config:qinq-ethtype=802.1q -- \
3507 add-port br0 p11 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q -- \
3508 add-port br0 p12 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q \
3509 other-config:priority-tags=true -- \
ecac4ebf
BP
3510 set Interface p1 type=dummy -- \
3511 set Interface p2 type=dummy -- \
3512 set Interface p3 type=dummy -- \
3513 set Interface p4 type=dummy -- \
3514 set Interface p5 type=dummy -- \
3515 set Interface p6 type=dummy -- \
3516 set Interface p7 type=dummy -- \
fed8962a
EG
3517 set Interface p8 type=dummy -- \
3518 set Interface p9 type=dummy -- \
3519 set Interface p10 type=dummy -- \
3520 set Interface p11 type=dummy -- \
3521 set Interface p12 type=dummy --])
04c956fc 3522
247527db
BP
3523dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3524dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
ecac4ebf 3525dnl actions.
04c956fc 3526for tuple in \
e44768b7
JP
3527 "100 none 0 drop" \
3528 "100 0 0 drop" \
3529 "100 0 1 drop" \
fed8962a
EG
3530 "100 10 0 1,5,6,7,8,pop_vlan,2,9" \
3531 "100 10 1 1,5,6,7,8,pop_vlan,2,9" \
e44768b7
JP
3532 "100 11 0 5,7" \
3533 "100 11 1 5,7" \
fed8962a
EG
3534 "100 12 0 1,5,6,pop_vlan,3,4,7,8,11,12" \
3535 "100 12 1 1,5,6,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
247527db
BP
3536 "1 none 0 drop" \
3537 "1 0 0 drop" \
3538 "1 0 1 drop" \
fed8962a
EG
3539 "1 10 0 5,6,7,8,100,pop_vlan,2,9" \
3540 "1 10 1 5,6,7,8,100,pop_vlan,2,9" \
247527db
BP
3541 "1 11 0 drop" \
3542 "1 11 1 drop" \
fed8962a
EG
3543 "1 12 0 5,6,100,pop_vlan,3,4,7,8,11,12" \
3544 "1 12 1 5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3545 "2 none 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3546 "2 0 0 pop_vlan,9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3547 "2 0 1 pop_vlan,9,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
247527db
BP
3548 "2 10 0 drop" \
3549 "2 10 1 drop" \
3550 "2 11 0 drop" \
3551 "2 11 1 drop" \
3552 "2 12 0 drop" \
3553 "2 12 1 drop" \
fed8962a
EG
3554 "3 none 0 4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3555 "3 0 0 pop_vlan,4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3556 "3 0 1 8,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
247527db
BP
3557 "3 10 0 drop" \
3558 "3 10 1 drop" \
3559 "3 11 0 drop" \
3560 "3 11 1 drop" \
3561 "3 12 0 drop" \
3562 "3 12 1 drop" \
fed8962a
EG
3563 "4 none 0 3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3564 "4 0 0 pop_vlan,3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3565 "4 0 1 3,8,12,pop_vlan,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
247527db
BP
3566 "4 10 0 drop" \
3567 "4 10 1 drop" \
3568 "4 11 0 drop" \
3569 "4 11 1 drop" \
3570 "4 12 0 drop" \
3571 "4 12 1 drop" \
fed8962a
EG
3572 "5 none 0 2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3573 "5 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3574 "5 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3575 "5 10 0 1,6,7,8,100,pop_vlan,2,9" \
3576 "5 10 1 1,6,7,8,100,pop_vlan,2,9" \
e44768b7
JP
3577 "5 11 0 7,100" \
3578 "5 11 1 7,100" \
fed8962a
EG
3579 "5 12 0 1,6,100,pop_vlan,3,4,7,8,11,12" \
3580 "5 12 1 1,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3581 "6 none 0 2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3582 "6 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3583 "6 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3584 "6 10 0 1,5,7,8,100,pop_vlan,2,9" \
3585 "6 10 1 1,5,7,8,100,pop_vlan,2,9" \
247527db
BP
3586 "6 11 0 drop" \
3587 "6 11 1 drop" \
fed8962a
EG
3588 "6 12 0 1,5,100,pop_vlan,3,4,7,8,11,12" \
3589 "6 12 1 1,5,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3590 "7 none 0 3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3591 "7 0 0 pop_vlan,3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3592 "7 0 1 3,8,12,pop_vlan,4,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3593 "7 10 0 1,5,6,8,100,pop_vlan,2,9" \
3594 "7 10 1 1,5,6,8,100,pop_vlan,2,9" \
e44768b7
JP
3595 "7 11 0 5,100" \
3596 "7 11 1 5,100" \
fed8962a
EG
3597 "7 12 0 1,5,6,100,pop_vlan,3,4,8,11,12" \
3598 "7 12 1 1,5,6,100,pop_vlan,4,11,push_vlan(vid=0,pcp=1),3,8,12" \
3599 "8 none 0 3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3600 "8 0 0 pop_vlan,3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3601 "8 0 1 3,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3602 "8 10 0 1,5,6,7,100,pop_vlan,2,9" \
3603 "8 10 1 1,5,6,7,100,pop_vlan,2,9" \
247527db
BP
3604 "8 11 0 drop" \
3605 "8 11 1 drop" \
fed8962a
EG
3606 "8 12 0 1,5,6,100,pop_vlan,3,4,7,11,12" \
3607 "8 12 1 1,5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,12" \
3608 "9 none 0 2,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3609 "9 10 0 10,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3610 "9 11 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3611 "10 none 0 drop" \
3612 "10 0 0 drop" \
3613 "10 11 0 drop" \
3614 "10 12 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3615 "11 10 0 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3616 "11 10 1 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100"
04c956fc
BP
3617do
3618 set $tuple
3619 in_port=$1
3620 vlan=$2
ecac4ebf
BP
3621 pcp=$3
3622 expected=$4
04c956fc
BP
3623
3624 if test $vlan = none; then
247527db 3625 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
04c956fc 3626 else
247527db 3627 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
3628 fi
3629
395e68ce
BP
3630 echo "----------------------------------------------------------------------"
3631 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3632
50aa28fd 3633 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
ecac4ebf 3634 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
04c956fc 3635
247527db 3636 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
becffb86 3637 mv stdout expout
247527db 3638 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
04c956fc
BP
3639done
3640
3641OVS_VSWITCHD_STOP
3642AT_CLEANUP
7257b535 3643
f0fb825a
EG
3644AT_SETUP([ofproto-dpif - VLAN depth limit])
3645OVS_VSWITCHD_START([dnl
3646 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3647 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
3648 add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3
3649])
3650
3651AT_DATA([flows.txt], [dnl
3652table=0 in_port=1,eth_type=0x8100,vlan_tci=0x0010/0x01ff actions=output:2
3653table=0 in_port=1,eth_type=0xabcd,vlan_tci=0x0010/0x01ff actions=output:3
3654])
3655AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3656flow="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), \
3657 encap(eth_type(0x8100),vlan(vid=17,pcp=0),encap(eth_type(0xabcd)))"
3658
3659AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3660AT_CHECK([tail -1 stdout], [0],
3661 [Datapath actions: 2
3662])
3663
3664AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3665AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3666AT_CHECK([tail -1 stdout], [0],
3667 [Datapath actions: 3
3668])
3669
3670OVS_VSWITCHD_STOP
3671AT_CLEANUP
3672
3673AT_SETUP([ofproto-dpif - Multi-VLAN actions])
3674OVS_VSWITCHD_START([dnl
3675 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3676 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2
3677])
3678AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3679
3680AT_DATA([flows.txt], [dnl
3681table=0 in_port=1,vlan_tci=0x1100/0x1fff actions=pop_vlan,output:2
3682table=0 in_port=1,vlan_tci=0x1101/0x1fff actions=push_vlan:0x8100,set_field:0x1201/0x1fff->vlan_tci,output:2
3683table=0 in_port=1,vlan_tci=0x1102/0x1fff actions=push_vlan:0x88a8,set_field:0x1202/0x1fff->vlan_tci,output:2
3684table=0 in_port=1,vlan_tci=0x1103/0x1fff actions=set_field:0x1203/0x1fff->vlan_tci,output:2
3685table=0 in_port=1,vlan_tci=0x1104/0x1fff actions=pop_vlan,goto_table:1
3686table=1 vlan_tci=0 actions=output:2
3687table=1 vlan_tci=0x1300/0x1fff actions=pop_vlan,output:2
3688table=1 vlan_tci=0x1301/0x1fff actions=push_vlan:0x88a8,set_field:0x1401/0x1fff->vlan_tci,output:2
3689table=1 vlan_tci=0x1302/0x1fff actions=set_field:0x1402/0x1fff->vlan_tci,output:2
3690])
3691
3692AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3693
3694check_act() {
3695 psd_hdr="in_port(1),eth(src=00:11:22:33:44:55,dst=00:22:44:66:88:00),"
3696 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$psd_hdr$1"], [0], [stdout])
3697 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $2
3698])
3699}
3700
3701check_act "eth_type(0x8100),vlan(vid=0x0100,pcp=0),encap(eth_type(0xabcd))" \
3702 "pop_vlan,2"
3703
3704check_act "eth_type(0x8100),vlan(vid=0x0101,pcp=0),encap(eth_type(0xabcd))" \
3705 "push_vlan(vid=513,pcp=0),2"
3706
3707check_act "eth_type(0x8100),vlan(vid=0x0102,pcp=0),encap(eth_type(0xabcd))" \
3708 "push_vlan(tpid=0x88a8,vid=514,pcp=0),2"
3709
3710check_act "eth_type(0x8100),vlan(vid=0x0103,pcp=0),encap(eth_type(0xabcd))" \
3711 "pop_vlan,push_vlan(vid=515,pcp=0),2"
3712
3713check_act "eth_type(0x8100),vlan(vid=0x0104,pcp=0),encap(eth_type(0xabcd))" \
3714 "pop_vlan,2"
3715
3716check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3717vlan(vid=0x0300,pcp=0),encap(eth_type(0xabcd)))" "pop_vlan,pop_vlan,2"
3718
3719check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3720vlan(vid=0x0301,pcp=0),encap(eth_type(0xabcd)))" \
3721 "pop_vlan,push_vlan(tpid=0x88a8,vid=1025,pcp=0),2"
3722
3723check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3724vlan(vid=0x0302,pcp=0),encap(eth_type(0xabcd)))" \
3725 "pop_vlan,pop_vlan,push_vlan(vid=1026,pcp=0),2"
3726
3727OVS_VSWITCHD_STOP
3728AT_CLEANUP
3729
56879058
JS
3730AT_SETUP([ofproto-dpif - MPLS handling])
3731OVS_VSWITCHD_START([dnl
3732 add-port br0 p1 -- set Interface p1 type=dummy
3733])
53eb8cb8 3734on_exit 'kill `cat ovs-ofctl.pid`'
56879058
JS
3735
3736AT_CAPTURE_FILE([ofctl_monitor.log])
3737AT_DATA([flows.txt], [dnl
3738dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
63636ee8 3739dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
0c1625e8 3740dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
56879058
JS
3741])
3742AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3743
3744dnl In this test, we push an MPLS tag to an ethernet packet.
6409e008 3745AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
56879058
JS
3746
3747for i in 1 2 3; do
3748 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)'
3749done
62022172 3750OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3751OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
56879058 3752
38b0b29f 3753AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 3754OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
e6d9ab56 3755mpls,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 375600000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
6f068379 375700000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
56879058 375800000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
6f068379
BP
375900000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
376000000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
376100000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
376200000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
376300000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3764OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
e6d9ab56 3765mpls,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 376600000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
6f068379 376700000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
56879058 376800000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
6f068379
BP
376900000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
377000000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
377100000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
377200000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
377300000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3774OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
e6d9ab56 3775mpls,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 377600000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
6f068379 377700000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
56879058 377800000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
6f068379
BP
377900000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
378000000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
378100000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
378200000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
378300000070 36 37 38 39 3a 3b 3c 3d-3e 3f
56879058
JS
3784])
3785
63636ee8
JS
3786dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3787dnl copied exactly, except for the BOS bit.
6409e008 3788AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
63636ee8
JS
3789
3790for i in 1 2 3; do
3791 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)'
3792done
62022172 3793OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3794OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
63636ee8 3795
38b0b29f 3796AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3797OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3798mpls,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 379900000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 380000000010 a0 40 00 00 a1 40
63636ee8 3801dnl
efe179e0 3802OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3803mpls,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 380400000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 380500000010 a0 40 00 00 a1 40
63636ee8 3806dnl
efe179e0 3807OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3808mpls,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 380900000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 381000000010 a0 40 00 00 a1 40
0c1625e8
SH
3811])
3812
3813dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3814dnl copied exactly, except for the BOS bit. The ethertype should be updated
3815dnl to the MPLS ethertype of the MPLS push action which differs to that
3816dnl of the input packet.
6409e008 3817AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
0c1625e8
SH
3818
3819for i in 1 2 3; do
3820 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)'
3821done
62022172 3822OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
d9c8c57c 3823OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
0c1625e8 3824
38b0b29f 3825AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3826OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3827mplsm,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 382800000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 382900000010 a0 40 00 00 a1 40
0c1625e8 3830dnl
efe179e0 3831OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3832mplsm,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 383300000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 383400000010 a0 40 00 00 a1 40
0c1625e8 3835dnl
efe179e0 3836OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3837mplsm,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 383800000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 383900000010 a0 40 00 00 a1 40
63636ee8
JS
3840])
3841
56879058
JS
3842OVS_VSWITCHD_STOP
3843AT_CLEANUP
3844
846e159a
SH
3845AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3846OVS_VSWITCHD_START([dnl
3847 add-port br0 p1 -- set Interface p1 type=dummy
3848])
53eb8cb8 3849on_exit 'kill `cat ovs-ofctl.pid`'
846e159a
SH
3850
3851AT_CAPTURE_FILE([ofctl_monitor.log])
3852AT_DATA([flows.txt], [dnl
3853cookie=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
3854cookie=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
3855cookie=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
3856cookie=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
3857cookie=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
3858cookie=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
3859cookie=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
3860cookie=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
3861cookie=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
3862cookie=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
3863])
3864AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3865
3866dnl Modified MPLS controller action.
3867dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3868dnl both of these in the final flow
6409e008 3869AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3870
3871for i in 1 2 3; do
3872 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)'
3873done
62022172 3874OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3875OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3876
38b0b29f 3877AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 3878OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3879mpls,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 388000000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
6f068379
BP
388100000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
388200000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
388300000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
388400000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
388500000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
388600000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
388700000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3888OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3889mpls,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 389000000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
6f068379
BP
389100000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
389200000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
389300000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
389400000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
389500000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
389600000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
389700000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3898OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3899mpls,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 390000000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
6f068379
BP
390100000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
390200000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
390300000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
390400000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
390500000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
390600000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
390700000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
3908])
3909
3910dnl Modified MPLS controller action.
f0fb825a
EG
3911dnl In this test, the input packet is vlan-tagged, which should be kept as
3912dnl inner vlan.
6409e008 3913AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3914
3915for i in 1 2 3; do
3916 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))'
3917done
62022172 3918OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3919OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3920
38b0b29f 3921AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 3922OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 3923mpls,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 392400000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
6f068379
BP
392500000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
392600000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
392700000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
392800000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
392900000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
393000000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
393100000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
393200000080 3e 3f
3933OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 3934mpls,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 393500000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
6f068379
BP
393600000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
393700000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
393800000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
393900000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
394000000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
394100000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
394200000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
394300000080 3e 3f
3944OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 3945mpls,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 394600000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
6f068379
BP
394700000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
394800000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
394900000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
395000000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
395100000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
395200000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
395300000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
395400000080 3e 3f
846e159a
SH
3955])
3956
3957dnl Modified MPLS controller action.
3958dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3959dnl both of these in the final flow
6409e008 3960AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3961
3962for i in 1 2 3; do
3963 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)'
3964done
62022172 3965OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3966OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3967
38b0b29f 3968AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 3969OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3970mpls,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 397100000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
6f068379
BP
397200000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
397300000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
397400000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
397500000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
397600000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
397700000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
397800000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3979OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3980mpls,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 398100000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
6f068379
BP
398200000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
398300000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
398400000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
398500000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
398600000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
398700000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
398800000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3989OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3990mpls,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 399100000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
6f068379
BP
399200000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
399300000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
399400000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
399500000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
399600000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
399700000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
399800000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
3999])
4000
4001dnl Modified MPLS controller action.
f0fb825a
EG
4002dnl In this test, the input packet is vlan-tagged, which should be kept as
4003dnl inner vlan.
6409e008 4004AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
4005
4006for i in 1 2 3; do
4007 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))'
4008done
62022172 4009OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4010OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4011
38b0b29f 4012AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4013OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4014mpls,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 401500000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
6f068379
BP
401600000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
401700000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
401800000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
401900000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
402000000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
402100000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
402200000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
402300000080 3e 3f
4024OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4025mpls,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 402600000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
6f068379
BP
402700000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
402800000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
402900000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
403000000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
403100000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
403200000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
403300000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
403400000080 3e 3f
4035OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4036mpls,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 403700000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
6f068379
BP
403800000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
403900000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
404000000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
404100000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
404200000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
404300000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
404400000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
404500000080 3e 3f
846e159a
SH
4046])
4047
4048dnl Modified MPLS controller action.
4049dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
4050dnl actions are reordered, so we see both of these in the final flow.
6409e008 4051AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
4052
4053for i in 1 2 3; do
4054 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)'
4055done
62022172 4056OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4057OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4058
38b0b29f 4059AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4060OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4061mpls,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 406200000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
6f068379
BP
406300000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
406400000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
406500000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
406600000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
406700000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
406800000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
406900000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4070OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4071mpls,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 407200000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
6f068379
BP
407300000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
407400000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
407500000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
407600000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
407700000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
407800000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
407900000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4080OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4081mpls,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 408200000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
6f068379
BP
408300000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
408400000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
408500000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
408600000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
408700000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
408800000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
408900000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4090])
4091
4092dnl Modified MPLS controller action.
f0fb825a
EG
4093dnl In this test, the input packet is vlan-tagged, which should be kept as
4094dnl inner vlan.
6409e008 4095AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
4096
4097for i in 1 2 3; do
4098 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))'
4099done
62022172 4100OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
28ae2f37 4101OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 4102
38b0b29f 4103AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4104OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4105mpls,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 410600000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
6f068379
BP
410700000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
410800000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
410900000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
411000000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
411100000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
411200000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
411300000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
411400000080 3e 3f
4115OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4116mpls,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 411700000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
6f068379
BP
411800000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
411900000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
412000000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
412100000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
412200000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
412300000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
412400000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
412500000080 3e 3f
4126OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4127mpls,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 412800000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
6f068379
BP
412900000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
413000000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
413100000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
413200000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
413300000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
413400000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
413500000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
413600000080 3e 3f
846e159a
SH
4137])
4138
4139dnl Modified MPLS controller action.
4140dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
4141dnl actions are reordered, so we see both of these in the final flow.
6409e008 4142AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
4143
4144for i in 1 2 3; do
4145 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)'
4146done
62022172 4147OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4148OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4149
38b0b29f 4150AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4151OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4152mpls,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 415300000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
6f068379
BP
415400000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
415500000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
415600000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
415700000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
415800000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
415900000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
416000000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4161OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4162mpls,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 416300000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
6f068379
BP
416400000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
416500000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
416600000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
416700000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
416800000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
416900000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
417000000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4171OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4172mpls,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 417300000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
6f068379
BP
417400000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
417500000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
417600000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
417700000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
417800000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
417900000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
418000000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4181])
4182
4183dnl Modified MPLS controller action.
f0fb825a
EG
4184dnl In this test, the input packet is vlan-tagged, which should be kept as
4185dnl inner vlan.
6409e008 4186AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
4187
4188for i in 1 2 3; do
4189 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))'
4190done
62022172 4191OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4192OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4193
38b0b29f 4194AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4195OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4196mpls,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 419700000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
6f068379
BP
419800000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
419900000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
420000000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
420100000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
420200000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
420300000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
420400000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
420500000080 3e 3f
4206OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4207mpls,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 420800000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
6f068379
BP
420900000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
421000000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
421100000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
421200000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
421300000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
421400000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
421500000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
421600000080 3e 3f
4217OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4218mpls,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 421900000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
6f068379
BP
422000000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
422100000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
422200000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
422300000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
422400000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
422500000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
422600000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
422700000080 3e 3f
846e159a
SH
4228])
4229
4230dnl Modified MPLS controller action.
f0fb825a
EG
4231dnl In this test, the input packet is vlan-tagged, which should be kept as
4232dnl inner vlan.
6409e008 4233AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
4234
4235for i in 1 2 3; do
4236 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))'
4237done
62022172 4238OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4239OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4240
38b0b29f 4241AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4242OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4243mpls,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 424400000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
6f068379
BP
424500000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
424600000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
424700000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
424800000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
424900000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
425000000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
425100000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4252OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4253mpls,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 425400000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
6f068379
BP
425500000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
425600000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
425700000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
425800000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
425900000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
426000000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
426100000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4262OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4263mpls,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 426400000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
6f068379
BP
426500000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
426600000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
426700000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
426800000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
426900000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
427000000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
427100000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4272])
4273
4274dnl Modified MPLS controller action.
4dc94d7e 4275dnl In this test, the input packet is vlan-tagged, which should be modified
846e159a 4276dnl before we push MPLS and VLAN tags.
6409e008 4277AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
4278
4279for i in 1 2 3; do
4280 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))'
4281done
62022172 4282OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
d9c8c57c 4283OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 4284
38b0b29f 4285AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4286OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4287mpls,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 428800000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
6f068379
BP
428900000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
429000000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
429100000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
429200000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
429300000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
429400000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
429500000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4296OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4297mpls,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 429800000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
6f068379
BP
429900000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
430000000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
430100000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
430200000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
430300000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
430400000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
430500000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4306OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4307mpls,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 430800000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
6f068379
BP
430900000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
431000000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
431100000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
431200000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
431300000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
431400000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
431500000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4316])
4317
cea4a6d7 4318AT_CHECK([ovs-appctl revalidator/purge], [0])
846e159a 4319AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379
BP
4320 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
4321 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
4322 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
4323 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
4324 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
4325 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
4326 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
4327 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
4328 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
4329 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
4330OFPST_FLOW reply (OF1.2):
4331])
4332
4333OVS_VSWITCHD_STOP
4334AT_CLEANUP
4335
b8778a0d 4336AT_SETUP([ofproto-dpif - fragment handling - trace])
023e1e0a 4337OVS_VSWITCHD_START
ca5792f0 4338add_of_ports br0 1 2 3 4 5 6 90
7257b535 4339AT_DATA([flows.txt], [dnl
586ebdec
BP
4340priority=75 tcp nw_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
4341priority=75 tcp nw_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
4342priority=50 tcp nw_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
4343priority=50 tcp nw_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
4344priority=50 tcp nw_frag=later actions=output:6
7257b535
BP
4345])
4346AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4347
a61680c6 4348base_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
4349no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4350first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4351later_flow="$base_flow,frag=later)"
4352
4353 # mode no first later
4354for tuple in \
4355 'normal 1 5 6' \
4356 'drop 1 drop drop' \
4357 'nx-match 1 2 6'
4358do
4359 set $tuple
4360 mode=$1
4361 no=$2
4362 first=$3
4363 later=$4
4364
4365 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4366 for type in no first later; do
4367 eval flow=\$${type}_flow exp_output=\$$type
7fd51d39 4368 printf "\n%s\n" "----$mode $type-----"
50aa28fd 4369 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
7fd51d39
BP
4370 : > expout
4371 if test $mode = drop && test $type != no; then
2d9b49dd 4372 echo ' 0. Packets are IP fragments and the fragment handling mode is "drop".' >> expout
12e4681c 4373 echo "Datapath actions: $exp_output" >> expout
b8778a0d 4374 elif test $type = later; then
12e4681c
JR
4375 echo "Datapath actions: $exp_output" >> expout
4376 else
4377 echo "Datapath actions: set(tcp(src=80,dst=80)),$exp_output" >> expout
7fd51d39 4378 fi
7fd51d39 4379 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
7257b535
BP
4380 done
4381done
023e1e0a 4382OVS_VSWITCHD_STOP
7257b535 4383AT_CLEANUP
848e8809 4384
b8778a0d
JR
4385AT_SETUP([ofproto-dpif - fragment handling - upcall])
4386OVS_VSWITCHD_START
ca5792f0 4387add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
4388AT_DATA([flows.txt], [dnl
4389priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
4390priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
4391priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
4392priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
4393priority=50 tcp ip_frag=later actions=output:6
4394])
4395AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4396
4397base_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"
4398no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4399first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4400later_flow="$base_flow,frag=later)"
4401
4402AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4403
4404mode=normal
4405
4406AT_CHECK([ovs-ofctl set-frags br0 $mode])
4407for type in no first later; do
4408 eval flow=\$${type}_flow
4409 printf "\n%s\n" "----$mode $type-----"
4410
4411 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4412done
4413
4414AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 4415flow-dump from non-dpdk interfaces:
3d4b2e6e
JS
4416recirc_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
4417recirc_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
4418recirc_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
4419])
4420
4421mode=drop
4422
98bb4286 4423AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4424AT_CHECK([ovs-ofctl set-frags br0 $mode])
4425for type in no first later; do
4426 eval flow=\$${type}_flow
4427 printf "\n%s\n" "----$mode $type-----"
4428
4429 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4430done
4431
4432AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 4433flow-dump from non-dpdk interfaces:
3d4b2e6e
JS
4434recirc_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
4435recirc_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
4436recirc_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
4437])
4438
4439mode=nx-match
4440
98bb4286 4441AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4442AT_CHECK([ovs-ofctl set-frags br0 $mode])
4443for type in no first later; do
4444 eval flow=\$${type}_flow
4445 printf "\n%s\n" "----$mode $type-----"
4446
4447 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4448done
4449
4450AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 4451flow-dump from non-dpdk interfaces:
3d4b2e6e
JS
4452recirc_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
4453recirc_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
4454recirc_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
4455])
4456
4457OVS_VSWITCHD_STOP
4458AT_CLEANUP
4459
4460AT_SETUP([ofproto-dpif - fragment handling - actions])
4461OVS_VSWITCHD_START
ca5792f0 4462add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
4463
4464AT_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])
4465AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4466source field tcp_dst lacks correct prerequisites
4467ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4468])
4469
4470AT_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])
4471AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4472destination field tcp_src lacks correct prerequisites
4473ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4474])
4475
4476AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
4477AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4478set_field udp_src lacks correct prerequisites
b8778a0d
JR
4479ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4480])
4481
4482AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
4483AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4484set_field udp_dst lacks correct prerequisites
b8778a0d
JR
4485ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4486])
4487
4488AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
4489AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4490set_field sctp_src lacks correct prerequisites
b8778a0d
JR
4491ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4492])
4493
4494AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
4495AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4496set_field sctp_dst lacks correct prerequisites
b8778a0d
JR
4497ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4498])
4499
4500AT_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])
4501AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4502source field tcp_dst lacks correct prerequisites
4503ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4504])
4505
4506AT_DATA([flows.txt], [dnl
4507priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
4508])
4509AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
4510
4511AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4512
4513mode=normal
4514
4515AT_CHECK([ovs-ofctl set-frags br0 $mode])
4516for frag in 4000 6000 6008 4010; do
4517 printf "\n%s\n" "----$mode $frag-----"
4518
4519 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"])
4520done
4521
4d182934
JS
4522dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
4523dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
4524dnl OVS-2.5, the wildcards and set_field mask are shared internally.
b8778a0d 4525AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 4526flow-dump from non-dpdk interfaces:
3d4b2e6e
JS
4527recirc_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
4528recirc_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
4529recirc_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
4530])
4531
98bb4286 4532AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4533AT_CHECK([ovs-ofctl set-frags br0 $mode])
4534for frag in 4000 6000 6008 4010; do
4535 printf "\n%s\n" "----$mode $frag truncated transport header -----"
4536
4537 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
4538done
4539
4540AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 4541flow-dump from non-dpdk interfaces:
3d4b2e6e
JS
4542recirc_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
4543recirc_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
4544recirc_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
4545])
4546
98bb4286 4547AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4548AT_CHECK([ovs-ofctl set-frags br0 $mode])
4549for frag in 4000 6000 6001 4002; do
4550 printf "\n%s\n" "----$mode $frag missing transport header-----"
4551
4552 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
4553done
4554
4555AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 4556flow-dump from non-dpdk interfaces:
3d4b2e6e
JS
4557recirc_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
4558recirc_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
4559recirc_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
4560])
4561
4562OVS_VSWITCHD_STOP
4563AT_CLEANUP
4564
848e8809
EJ
4565AT_SETUP([ofproto-dpif - exit])
4566OVS_VSWITCHD_START
ca5792f0 4567add_of_ports br0 1 2 3 10 11 12 13 14
848e8809
EJ
4568AT_DATA([flows.txt], [dnl
4569in_port=1 actions=output:10,exit,output:11
4570in_port=2 actions=output:12,resubmit:1,output:12
4571in_port=3 actions=output:13,resubmit:2,output:14
4572])
4573AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 4574AT_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
4575AT_CHECK([tail -1 stdout], [0],
4576 [Datapath actions: 10
4577])
50aa28fd 4578AT_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
4579AT_CHECK([tail -1 stdout], [0],
4580 [Datapath actions: 12,10
4581])
50aa28fd 4582AT_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
4583AT_CHECK([tail -1 stdout], [0],
4584 [Datapath actions: 13,12,10
4585])
4586OVS_VSWITCHD_STOP
4587AT_CLEANUP
c06bba01
JP
4588
4589
4590AT_SETUP([ofproto-dpif - mirroring, select_all])
2d5c1a20 4591AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4592OVS_VSWITCHD_START
ca5792f0 4593add_of_ports br0 1 2 3
432fca23 4594ovs-vsctl \
c06bba01
JP
4595 set Bridge br0 mirrors=@m --\
4596 --id=@p3 get Port p3 --\
432fca23 4597 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 4598
c06bba01
JP
4599AT_DATA([flows.txt], [dnl
4600in_port=1 actions=output:2
4601in_port=2 actions=output:1
4602])
4603AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4604
247527db 4605flow="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 4606AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4607AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4608 [Datapath actions: 3,2
c06bba01
JP
4609])
4610
247527db 4611flow="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 4612AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4613AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4614 [Datapath actions: 3,1
c06bba01
JP
4615])
4616
4617OVS_VSWITCHD_STOP
4618AT_CLEANUP
4619
4620
4621AT_SETUP([ofproto-dpif - mirroring, select_src])
2d5c1a20 4622AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4623OVS_VSWITCHD_START
ca5792f0 4624add_of_ports br0 1 2 3
432fca23 4625ovs-vsctl \
c06bba01
JP
4626 set Bridge br0 mirrors=@m --\
4627 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
432fca23 4628 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
c06bba01 4629
c06bba01
JP
4630AT_DATA([flows.txt], [dnl
4631in_port=1 actions=output:2
4632in_port=2 actions=output:1
4633])
4634AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4635
247527db 4636flow="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 4637AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4638AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4639 [Datapath actions: 3,2
c06bba01
JP
4640])
4641
247527db 4642flow="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 4643AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4644AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4645 [Datapath actions: 1
c06bba01
JP
4646])
4647OVS_VSWITCHD_STOP
4648AT_CLEANUP
4649
33158a18 4650AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
2d5c1a20 4651AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4652OVS_VSWITCHD_START
ca5792f0 4653add_of_ports br0 1 2
432fca23 4654ovs-vsctl \
33158a18
JP
4655 set Bridge br0 mirrors=@m --\
4656 --id=@p2 get Port p2 --\
432fca23 4657 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
33158a18 4658
33158a18
JP
4659AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4660
4661# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 4662flow="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
4663AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4664AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4665 [Datapath actions: 1,2
33158a18
JP
4666])
4667
4668OVS_VSWITCHD_STOP
4669AT_CLEANUP
4670
c06bba01
JP
4671
4672AT_SETUP([ofproto-dpif - mirroring, select_dst])
2d5c1a20 4673AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4674OVS_VSWITCHD_START
ca5792f0 4675add_of_ports br0 1 2 3
432fca23 4676ovs-vsctl \
c06bba01
JP
4677 set Bridge br0 mirrors=@m --\
4678 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4679 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
c06bba01 4680
c06bba01
JP
4681AT_DATA([flows.txt], [dnl
4682in_port=1 actions=output:2
4683in_port=2 actions=output:1
4684])
4685AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4686
247527db 4687flow="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 4688AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4689AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4690 [Datapath actions: 2,3
c06bba01
JP
4691])
4692
247527db 4693flow="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 4694AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4695AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4696 [Datapath actions: 1
c06bba01
JP
4697])
4698
4699OVS_VSWITCHD_STOP
4700AT_CLEANUP
4701
4702
4703AT_SETUP([ofproto-dpif - mirroring, select_vlan])
2d5c1a20 4704AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4705OVS_VSWITCHD_START
ca5792f0 4706add_of_ports br0 1 2 3
432fca23 4707ovs-vsctl \
c06bba01
JP
4708 set Bridge br0 mirrors=@m --\
4709 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4710 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
c06bba01 4711
c06bba01
JP
4712AT_DATA([flows.txt], [dnl
4713in_port=1, actions=output:2
4714])
4715AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4716
247527db 4717flow="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 4718AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4719AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4720 [Datapath actions: 2
c06bba01
JP
4721])
4722
247527db 4723flow="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 4724AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4725AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4726 [Datapath actions: 2
c06bba01
JP
4727])
4728
247527db 4729flow="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 4730AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4731AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4732 [Datapath actions: 3,2
c06bba01
JP
4733])
4734
4735OVS_VSWITCHD_STOP
4736AT_CLEANUP
4737
4738
4739AT_SETUP([ofproto-dpif - mirroring, output_port])
2d5c1a20 4740AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4741OVS_VSWITCHD_START
ca5792f0 4742add_of_ports br0 1 2 3
432fca23 4743ovs-vsctl \
c06bba01
JP
4744 set Bridge br0 mirrors=@m --\
4745 --id=@p3 get Port p3 --\
432fca23 4746 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 4747
c06bba01
JP
4748AT_DATA([flows.txt], [dnl
4749in_port=1 actions=mod_vlan_vid:17,output:2
4750in_port=2 actions=output:1
4751])
4752AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4753
247527db 4754flow="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 4755AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4756AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4757 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
c06bba01
JP
4758])
4759
247527db 4760flow="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 4761AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4762AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4763 [Datapath actions: 3,1
c06bba01
JP
4764])
4765
4766OVS_VSWITCHD_STOP
4767AT_CLEANUP
4768
c06bba01 4769AT_SETUP([ofproto-dpif - mirroring, output_vlan])
2d5c1a20 4770AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4771OVS_VSWITCHD_START
ca5792f0 4772add_of_ports br0 1 2
432fca23 4773ovs-vsctl \
c06bba01 4774 set Bridge br0 mirrors=@m --\
432fca23 4775 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
c06bba01 4776
c06bba01
JP
4777AT_DATA([flows.txt], [dnl
4778in_port=1 actions=output:2
4779in_port=2 actions=mod_vlan_vid:17,output:1
4780])
4781AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4782
247527db 4783flow="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 4784AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
4785actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4786
e44768b7 4787expected="2,push_vlan(vid=12,pcp=0),1,2,100"
247527db 4788AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 4789mv stdout expout
247527db 4790AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01 4791
247527db 4792flow="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 4793AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
4794actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4795
e44768b7 4796expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
247527db 4797AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 4798mv stdout expout
247527db 4799AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01
JP
4800
4801OVS_VSWITCHD_STOP
4802AT_CLEANUP
b44a10b7 4803
faa624b4
BP
4804# This verifies that we don't get duplicate mirroring when mirror_packet()
4805# might be invoked recursively, as a check against regression.
4806AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
2d5c1a20 4807AT_KEYWORDS([mirror mirrors mirroring])
faa624b4
BP
4808OVS_VSWITCHD_START
4809add_of_ports br0 1 2 3
4810ovs-vsctl \
4811 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
5a0e4aec
BP
4812 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
4813 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
4814 -- set Port br0 tag=0 \
4815 -- set Port p1 tag=0 \
4816 -- set Port p2 tag=500 \
4817 -- set Port p3 tag=501
faa624b4
BP
4818
4819flow='in_port=1'
4820AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4821AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4822s/,/\
4823/g' | sort], [0], [100
48242
48253
4826])
4827
4828OVS_VSWITCHD_STOP
4829AT_CLEANUP
4830
29bae541
BP
4831# This test verifies that mirror state is preserved across recirculation.
4832#
4833# Otherwise, post-recirculation the ingress and the output to port 4
4834# would cause the packet to be mirrored to port 3 a second time.
4835AT_SETUP([ofproto-dpif - mirroring with recirculation])
2d5c1a20 4836AT_KEYWORDS([mirror mirrors mirroring])
29bae541 4837OVS_VSWITCHD_START
ca5792f0 4838add_of_ports br0 1 2 3 4
29bae541
BP
4839ovs-vsctl \
4840 set Bridge br0 mirrors=@m --\
4841 --id=@p3 get Port p3 --\
4842 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4843
4844AT_DATA([flows.txt], [dnl
4845in_port=1 actions=2,debug_recirc,4
4846])
4847AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4848
4849flow="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)"
4850AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4851AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4852])
4853AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4854AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4855])
4856
4857OVS_VSWITCHD_STOP
4858AT_CLEANUP
4859
1356dbd1
WT
4860# Tests below verify the snaplen support for mirroring
4861AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen])
4862AT_KEYWORDS([mirror mirrors mirroring])
4863OVS_VSWITCHD_START
4864add_of_ports br0 1 2 3
4865ovs-vsctl \
4866 set Bridge br0 mirrors=@m --\
4867 --id=@p3 get Port p3 --\
4868 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4869
4870AT_DATA([flows.txt], [dnl
4871in_port=1 actions=output:2
4872in_port=2 actions=output:1
4873])
4874AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4875
4876flow="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)"
4877AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4878AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4879 [Datapath actions: trunc(100),3,2
4880])
4881
4882flow="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)"
4883AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4884AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4885 [Datapath actions: trunc(100),3,1
4886])
4887
4888OVS_VSWITCHD_STOP
4889AT_CLEANUP
4890
091d64c4
ZG
4891AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen and reset snaplen])
4892AT_KEYWORDS([mirror mirrors mirroring])
4893OVS_VSWITCHD_START
4894add_of_ports br0 1 2 3
4895ovs-vsctl \
4896 set Bridge br0 mirrors=@m --\
4897 --id=@p3 get Port p3 --\
4898 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4899
4900AT_DATA([flows.txt], [dnl
4901in_port=1 actions=output:2
4902in_port=2 actions=output:1
4903])
4904AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4905
4906flow="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)"
4907AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4908AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4909 [Datapath actions: trunc(100),3,2
4910])
4911
4912ovs-vsctl set mirror mymirror snaplen=77
4913
4914flow="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)"
4915AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4916AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4917 [Datapath actions: trunc(77),3,1
4918])
4919
4920ovs-vsctl set mirror mymirror snaplen=65535
4921
4922flow="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)"
4923AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4924AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4925 [Datapath actions: 3,1
4926])
4927
4928OVS_VSWITCHD_STOP
4929AT_CLEANUP
4930
1356dbd1
WT
4931AT_SETUP([ofproto-dpif - mirroring, select_src with snaplen])
4932AT_KEYWORDS([mirror mirrors mirroring])
4933OVS_VSWITCHD_START
4934add_of_ports br0 1 2 3
4935ovs-vsctl \
4936 set Bridge br0 mirrors=@m --\
4937 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4938 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3 snaplen=100
4939
4940AT_DATA([flows.txt], [dnl
4941in_port=1 actions=output:2
4942in_port=2 actions=output:1
4943])
4944AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4945
4946flow="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)"
4947AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4948AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4949 [Datapath actions: trunc(100),3,2
4950])
4951
4952flow="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)"
4953AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4954AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4955 [Datapath actions: 1
4956])
4957OVS_VSWITCHD_STOP
4958AT_CLEANUP
4959
4960AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port with snaplen])
4961AT_KEYWORDS([mirror mirrors mirroring])
4962OVS_VSWITCHD_START
4963add_of_ports br0 1 2
4964ovs-vsctl \
4965 set Bridge br0 mirrors=@m --\
4966 --id=@p2 get Port p2 --\
4967 --id=@m create Mirror name=mymirror select_all=true output_port=@p2 snaplen=100
4968
4969AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4970
4971# "in_port" defaults to OFPP_NONE if it's not specified.
4972flow="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"
4973AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4974AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4975 [Datapath actions: 1,trunc(100),2
4976])
4977
4978OVS_VSWITCHD_STOP
4979AT_CLEANUP
4980
4981AT_SETUP([ofproto-dpif - mirroring, select_dst with snaplen])
4982AT_KEYWORDS([mirror mirrors mirroring])
4983OVS_VSWITCHD_START
4984add_of_ports br0 1 2 3
4985ovs-vsctl \
4986 set Bridge br0 mirrors=@m --\
4987 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4988 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3 snaplen=100
4989
4990AT_DATA([flows.txt], [dnl
4991in_port=1 actions=output:2
4992in_port=2 actions=output:1
4993])
4994AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4995
4996flow="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)"
4997AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4998AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4999 [Datapath actions: 2,trunc(100),3
5000])
5001
5002flow="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)"
5003AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5004AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5005 [Datapath actions: 1
5006])
5007
5008OVS_VSWITCHD_STOP
5009AT_CLEANUP
5010
5011AT_SETUP([ofproto-dpif - mirroring, select_vlan with snaplen])
5012AT_KEYWORDS([mirror mirrors mirroring])
5013OVS_VSWITCHD_START
5014add_of_ports br0 1 2 3
5015ovs-vsctl \
5016 set Bridge br0 mirrors=@m --\
5017 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
5018 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3 snaplen=100
5019
5020AT_DATA([flows.txt], [dnl
5021in_port=1, actions=output:2
5022])
5023AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5024
5025flow="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)"
5026AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5027AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5028 [Datapath actions: 2
5029])
5030
5031flow="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))"
5032AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5033AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5034 [Datapath actions: 2
5035])
5036
5037flow="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))"
5038AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5039AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5040 [Datapath actions: trunc(100),3,2
5041])
5042
5043OVS_VSWITCHD_STOP
5044AT_CLEANUP
5045
5046AT_SETUP([ofproto-dpif - mirroring, output_port with snaplen])
5047AT_KEYWORDS([mirror mirrors mirroring])
5048OVS_VSWITCHD_START
5049add_of_ports br0 1 2 3
5050ovs-vsctl \
5051 set Bridge br0 mirrors=@m --\
5052 --id=@p3 get Port p3 --\
5053 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
5054
5055AT_DATA([flows.txt], [dnl
5056in_port=1 actions=mod_vlan_vid:17,output:2
5057in_port=2 actions=output:1
5058])
5059AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5060
5061flow="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)"
5062AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5063AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5064 [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2
5065])
5066
5067flow="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)"
5068AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5069AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5070 [Datapath actions: trunc(100),3,1
5071])
5072
5073OVS_VSWITCHD_STOP
5074AT_CLEANUP
5075
5076AT_SETUP([ofproto-dpif - mirroring, output_vlan with snaplen])
5077AT_KEYWORDS([mirror mirrors mirroring])
5078OVS_VSWITCHD_START
5079add_of_ports br0 1 2
5080ovs-vsctl \
5081 set Bridge br0 mirrors=@m --\
5082 --id=@m create Mirror name=mymirror select_all=true output_vlan=12 snaplen=100
5083
5084AT_DATA([flows.txt], [dnl
5085in_port=1 actions=output:2
5086in_port=2 actions=mod_vlan_vid:17,output:1
5087])
5088AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5089
5090flow="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)"
5091AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5092actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5093dnl Expect: "trunc(100),100,trunc(100),2,trunc(100),1", with different order
5094AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
5095
5096flow="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)"
5097AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5098actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5099AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
5100
5101OVS_VSWITCHD_STOP
5102AT_CLEANUP
5103
5104AT_SETUP([ofproto-dpif - multiple VLAN output mirrors with snaplen])
5105AT_KEYWORDS([mirror mirrors mirroring])
5106OVS_VSWITCHD_START
5107add_of_ports br0 1 2 3
5108ovs-vsctl \
5109 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
5110 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 snaplen=200 \
5111 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 snaplen=300 \
5112 -- set Port br0 tag=0 \
5113 -- set Port p1 tag=0 \
5114 -- set Port p2 tag=500 \
5115 -- set Port p3 tag=501
5116
5117flow="in_port=1"
5118AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
5119AT_CHECK([tail -1 stdout | egrep "trunc\(200\),2,trunc\(300\),3,100|trunc\(300\),3,trunc\(200\),2,100"], [0], [stdout])
5120
5121OVS_VSWITCHD_STOP
5122AT_CLEANUP
5123
83a31283
BP
5124# This test verifies that the table ID is preserved across recirculation
5125# when a resubmit action requires it (because the action is relative to
5126# the current table rather than specifying a table).
5127AT_SETUP([ofproto-dpif - resubmit with recirculation])
5128OVS_VSWITCHD_START
ca5792f0 5129add_of_ports br0 1 2 3
83a31283
BP
5130
5131AT_DATA([flows.txt], [dnl
5132table=0 in_port=1 actions=2,resubmit(,1)
5133table=1 in_port=1 actions=debug_recirc,resubmit:55
5134table=1 in_port=55 actions=3
5135])
5136AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5137
5138flow="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)"
5139AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5140AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
5141])
5142AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5143AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
5144])
5145
5146OVS_VSWITCHD_STOP
5147AT_CLEANUP
5148
8014f465
JP
5149
5150# This test verifies that tunnel metadata is preserved across
5151# recirculation. At the time of recirculation, fields such as "tun_id"
5152# may be set before the tunnel is "valid" (ie, has a destination
5153# address), but the field should still be available after recirculation.
5154AT_SETUP([ofproto-dpif - resubmit with tun_id])
5155OVS_VSWITCHD_START
5156add_of_ports br0 1 2 3
5157
5158AT_DATA([flows.txt], [dnl
5159table=0 in_port=1 actions=2,load:6->NXM_NX_TUN_ID[[]],resubmit(,1)
5160table=1 in_port=1 actions=debug_recirc,resubmit:55
5161table=1 in_port=55 actions=3
5162])
5163AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5164
5165flow="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)"
5166AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5167AT_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
5168])
5169
5170AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
e3981271 5171AT_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
5172])
5173
5174OVS_VSWITCHD_STOP
5175AT_CLEANUP
5176
5177
6b1c5734
BP
5178# This test verifies that "resubmit", when it triggers recirculation
5179# indirectly through the flow that it recursively invokes, is not
5180# re-executed when execution continues later post-recirculation.
5181AT_SETUP([ofproto-dpif - recirculation after resubmit])
5182OVS_VSWITCHD_START
ca5792f0 5183add_of_ports br0 1 2
6b1c5734
BP
5184
5185AT_DATA([flows.txt], [dnl
5186table=0 in_port=1 actions=resubmit(,1),2
5187table=1 in_port=1 actions=debug_recirc
5188])
5189AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5190
5191flow="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)"
5192AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5193AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
5194])
5195AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5196AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
5197])
5198
5199OVS_VSWITCHD_STOP
5200AT_CLEANUP
5201
a934a3dd
JP
5202
5203AT_SETUP([ofproto-dpif - debug_slow action])
5204OVS_VSWITCHD_START
5205add_of_ports br0 1 2 3
5206
5207AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,2"])
5208
5209flow="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)"
5210
5211AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5212AT_CHECK_UNQUOTED([tail -3 stdout], [0], [Datapath actions: 2
5213This flow is handled by the userspace slow path because it:
393e9f7c 5214 - Uses action(s) not supported by datapath.
a934a3dd
JP
5215])
5216
5217OVS_VSWITCHD_STOP
5218AT_CLEANUP
5219
5220
77ab5fd2
BP
5221dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
5222dnl
5223dnl Checks the implementation of the continuation mechanism that allows the
5224dnl packet processing pipeline to be paused and resumed. Starts by creating
5225dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
5226dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
5227dnl in the bridge, resuming each time the pipeline pauses, and expects a single
5228dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
5229dnl ACTIONS0 still contains at least one "pause" action, removes one of them
5230dnl and repeats the process.
5231dnl
5232dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
5233dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
5234dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
5235dnl into port 1 on br0, so br1 only comes into action if a patch port (added
5236dnl by EXTRA_SETUP) jumps from one bridge to another.
5237dnl
5238dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
5239dnl both bridges, e.g. to configure mirrors or patch ports.
5240m4_define([CHECK_CONTINUATION], [dnl
5241 AT_SETUP([ofproto-dpif - continuation - $1])
5242 AT_KEYWORDS([continuations pause resume])
5243 OVS_VSWITCHD_START
5244
5245 # count_matches STRING
5246 #
5247 # Prints on stdout the number of occurrences of STRING in stdin.
5248 count_matches () {
5249 sed -n ":start
5250 s/$[1]//p
5251 t start" | wc -l
5252 }
5253
5254 add_of_ports --pcap br0 `seq 1 $2`
5255 m4_if([$3], [0], [],
5256 [add_of_br 1
5257 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
5258
5259 AT_CAPTURE_FILE([ofctl_monitor0.log])
5260 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
5261 m4_if([$3], [0], [],
5262 [AT_CAPTURE_FILE([ofctl_monitor1.log])
5263 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
5264
5265 actions0='$4'
5266 actions1='$5'
5267 $6
5268 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)"
5269 n_packets=0
5270 n_resumes=0
5271 while true; do
5272 printf "\n\nactions for br0:\n%s\n" "$actions0"
5273 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
5274
5275 # Add flows.
5276 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
5277 m4_if([$3], [0], [],
5278 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
5279
70d0cd06
JR
5280 # Make sure the datapath is up-to-date before sending the packet.
5281 ovs-appctl revalidator/wait
5282
77ab5fd2
BP
5283 # Run a packet through the switch.
5284 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5285
5286 # Wait for the expected number of packets to show up.
5287 n_packets=`expr $n_packets + $2 - 1 + $3`
5288 echo "waiting for $n_packets packets..."
5289 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
5290
5291 # Wait for the expected number of NXT_RESUMEs to be logged.
5292 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
5293 echo "waiting for $n_resumes NXT_RESUMEs..."
5294 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
5295
5296 # Eliminate one "pause" from the actions.
5297 #
5298 # If there were none left, then we're done.
5299 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
5300 if test X"$actions0" = X"$next_actions0"; then
5301 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
5302 if test X"$actions1" = X"$next_actions1"; then
5303 break
5304 else
5305 actions1=$next_actions1
5306 fi
5307 else
5308 actions0=$next_actions0
5309 fi
5310
5311 # Delete all the flows and verify that there are none, so that we
5312 # can be sure that our updated flow tables is actually in use
5313 # later.
5314 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
5315 [NXST_FLOW reply:
5316])
5317 m4_if([$3], [0], [],
5318 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
5319 [NXST_FLOW reply:
5320])])
5321 done
5322 OVS_VSWITCHD_STOP
5323 AT_CLEANUP
5324])
5325
5326# Check that pause at the end of the pipeline works OK.
5327#
5328# (xlate_continuation() has a special case for no-op actions; this
5329# fails without that special case.)
5330CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
5331
5332# Check that remaining actions are preserved following resume.
5333CHECK_CONTINUATION([actions], [7], [0],
5334 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
5335
5336# Check that multiple levels of resubmit continue following resume.
5337#
5338# The "resubmit:55", which is relative to the current table, is
5339# particularly interesting because it checks that the notion of the
5340# current table is correctly preserved.
5341CHECK_CONTINUATION([resubmit], [10], [0],
5342 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
5343 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
5344 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
5345 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
5346 table=3 in_port=55 actions=pause 6 pause])
5347
5348# Check that the action set is preserved across pause/resume.
5349CHECK_CONTINUATION([action set], [3], [0],
5350 [in_port=1 actions=1 pause resubmit(,1) pause 2
5351 table=1 actions=write_actions(3)])
5352
5353# Check that metadata and the stack used by push and pop is preserved
5354# across pause/resume.
5355CHECK_CONTINUATION([data stack], [3], [0],
5356 [in_port=1 actions=pause dnl
5357 set_field:1->reg0 dnl
5358 pause dnl
5359 set_field:2->reg1 dnl
5360 pause dnl
5361 output:NXM_NX_REG0[[]] dnl
5362 pause dnl
5363 push:NXM_NX_REG1[[]] dnl
5364 dnl
5365 pop:NXM_NX_REG2[[]] dnl
5366 pause dnl
5367 output:NXM_NX_REG2[[]] dnl
5368 pause dnl
5369 3])
5370
5371# Check that mirror output occurs once and once only, even if
5372# separated by pause/resume.
5373CHECK_CONTINUATION([mirroring], [5], [0],
5374 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
5375 [ovs-vsctl \
5376 set Bridge br0 mirrors=@m --\
5377 --id=@p2 get Port p2 --\
5378 --id=@p3 get Port p3 --\
5379 --id=@p4 get Port p4 --\
5380 --id=@p5 get Port p5 --\
5381 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
5382
5383# Check that pause works in the presence of patch ports.
5384CHECK_CONTINUATION([patch ports], [4], [1],
5385 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
5386 table=1 in_port=1 actions=pause 3 pause 10 pause],
5387 [table=0 in_port=11 actions=pause 5 pause],
5388 [ovs-vsctl \
5389 -- add-port br0 patch10 \
5390 -- set interface patch10 type=patch options:peer=patch11 \
5391 ofport_request=10 \
5392 -- add-port br1 patch11 \
5393 -- set interface patch11 type=patch options:peer=patch10 \
5394 ofport_request=11])
5395
0d3239e8
NS
5396
5397# Check that pause works after the packet is cloned.
5398AT_SETUP([ofproto-dpif - continuation after clone])
5399AT_KEYWORDS([continuations clone pause resume])
5400OVS_VSWITCHD_START
5401
5402add_of_ports --pcap br0 `seq 1 3`
5403
5404flow="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)"
5405
5406AT_DATA([flows.txt], [dnl
5407table=0 in_port=1 actions=set_field:1->reg1 resubmit(,2)
5408table=1 reg1=0x5 actions=controller(pause) resubmit(,3)
5409table=1 reg1=0x1 actions=2
5410table=2 in_port=1 actions=clone(set_field:5->reg1, resubmit(,1))
5411table=3 reg1=0x1 actions=3
5412table=3 reg1=0x5 actions=2
5413])
5414
5415AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5416
5417AT_CAPTURE_FILE([ofctl_monitor0.log])
5418ovs-ofctl monitor br0 resume --detach --no-chdir \
5419--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5420
5421# Run a packet through the switch.
5422AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5423
5424ovs-vsctl show
5425ovs-ofctl dump-flows br0
5426
5427# The packet should be recieved by port 2 and not port 3
5428AT_CHECK([test 1 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5429AT_CHECK([test 0 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p3-tx.pcap | wc -l`])
5430
5431# NXT_RESUMEs should be 1 and reg1 should be set to 0x5.
5432OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor*.log | grep NXT_RESUME | grep -c reg1=0x5`])
5433
5434OVS_VSWITCHD_STOP
5435AT_CLEANUP
5436
22bb3cbc
AW
5437# Two testcases below are for the ofproto/trace command
5438# The first one tests all correct syntax:
5439# ofproto/trace [dp_name] odp_flow [-generate|packet]
5440# ofproto/trace br_name br_flow [-generate|packet]
5441AT_SETUP([ofproto-dpif - ofproto/trace command 1])
5442OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 5443add_of_ports br0 1 2 3
22bb3cbc
AW
5444
5445AT_DATA([flows.txt], [dnl
5446in_port=1 actions=output:2
5447in_port=2 actions=output:1
5448])
5449AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5450
e063a73a 5451odp_flow="in_port(p1)"
22bb3cbc 5452br_flow="in_port=1"
0a37839c
GS
5453# Test command: ofproto/trace odp_flow with in_port as a name.
5454AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5455AT_CHECK([tail -1 stdout], [0], [dnl
5456Datapath actions: 2
5457])
5458
5459odp_flow="in_port(1)"
22bb3cbc
AW
5460# Test command: ofproto/trace odp_flow
5461AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5462AT_CHECK([tail -1 stdout], [0], [dnl
5463Datapath actions: 2
5464])
5465
5466# Test command: ofproto/trace dp_name odp_flow
5467AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
5468AT_CHECK([tail -1 stdout], [0], [dnl
5469Datapath actions: 2
5470])
5471# Test commmand: ofproto/trace br_name br_flow
5472AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5473AT_CHECK([tail -1 stdout], [0], [dnl
5474Datapath actions: 2
5475])
5476
5477# Delete the inserted flows
5478AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
5479AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
5480
78c9486d 5481# This section below tests the [-generate] option
22bb3cbc 5482odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
78c9486d 5483br_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
5484
5485# Test command: ofproto/trace odp_flow
5486AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5487# Check for no MAC learning entry
5488AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5489 port VLAN MAC Age
5490])
5491
5492# Test command: ofproto/trace br_name br_flow
5493AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5494# Check for no MAC learning entry
5495AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5496 port VLAN MAC Age
5497])
5498
5499# Test command: ofproto/trace odp_flow -generate
5500AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
5501# Check for the MAC learning entry
5502AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5503 port VLAN MAC Age
5504 3 0 50:54:00:00:00:05 ?
5505])
5506
5507# Test command: ofproto/trace dp_name odp_flow -generate
5508AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5509 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
5510 -generate], [0], [stdout])
5511# Check for both MAC learning entries
5512AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5513 port VLAN MAC Age
5514 3 0 50:54:00:00:00:05 ?
5515 1 0 50:54:00:00:00:06 ?
5516])
5517
5518# Test command: ofproto/trace br_name br_flow -generate
5519AT_CHECK([ovs-appctl ofproto/trace br0 \
5520 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
5521 -generate], [0], [stdout])
5522# Check for both MAC learning entries.
5523AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5524 port VLAN MAC Age
5525 3 0 50:54:00:00:00:05 ?
5526 1 0 50:54:00:00:00:06 ?
5527 2 0 50:54:00:00:00:07 ?
5528])
5529
5530# This section beflow tests the [packet] option
5531# The ovs-tcpundump of packets between port1 and port2
5532pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5533pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
5534
5535# Construct the MAC learning table
5536AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5537 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
5538 -generate], [0], [stdout])
5539
5540# Construct the MAC learning table
5541AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5542 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
5543 -generate], [0], [stdout])
5544
5545# Test command: ofproto/trace odp_flow packet
5546AT_CHECK([ovs-appctl ofproto/trace \
5547 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5548AT_CHECK([tail -1 stdout], [0], [dnl
5549Datapath actions: 2
5550])
2d9b49dd 5551AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5552Flow: 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
5553
5554bridge("br0")
22bb3cbc
AW
5555])
5556
5557# Test command: ofproto/trace dp_name odp_flow packet
5558AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5559 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5560AT_CHECK([tail -1 stdout], [0], [dnl
5561Datapath actions: 2
5562])
2d9b49dd 5563AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5564Flow: 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
5565
5566bridge("br0")
22bb3cbc
AW
5567])
5568
5569# Test command: ofproto/trace br_name br_flow packet
5570AT_CHECK([ovs-appctl ofproto/trace br0 \
1362e248 5571 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
22bb3cbc 5572AT_CHECK([tail -1 stdout], [0], [dnl
ed2e7245 5573Datapath actions: 1
22bb3cbc 5574])
2d9b49dd 5575AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5576Flow: 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
5577
5578bridge("br0")
22bb3cbc
AW
5579])
5580
5581OVS_VSWITCHD_STOP
5582AT_CLEANUP
5583
5584# The second test tests the corner cases
5585AT_SETUP([ofproto-dpif - ofproto/trace command 2])
5586OVS_VSWITCHD_START
ca5792f0 5587add_of_ports br0 1 2
22bb3cbc
AW
5588
5589# Define flows
5590odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
5591br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
5592# Define options
5593generate="-generate"
5594pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5595
5596# Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
5597m4_foreach(
5598[option],
5599[[],
5600["$generate"],
5601["$pkt"]],
5602[AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
5603 [2], [], [stderr])
5604AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5605Cannot find the datapath
22bb3cbc
AW
5606ovs-appctl: ovs-vswitchd: server returned an error
5607])])
5608
5609# Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
5610m4_foreach(
5611[option],
5612[[],
5613["$generate"],
5614["$pkt"]],
5615[AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
5616 [2], [], [stderr])
5617AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5618Cannot find the datapath
22bb3cbc
AW
5619ovs-appctl: ovs-vswitchd: server returned an error
5620])])
5621
5622# Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
5623m4_foreach(
5624[option],
5625[[],
5626["$generate"],
5627["$pkt"]],
5628[AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
5629 [2], [], [stderr])
5630AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5631Cannot find the datapath
22bb3cbc
AW
5632ovs-appctl: ovs-vswitchd: server returned an error
5633])])
5634
5635# Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
5636m4_foreach(
5637[option],
5638[[],
5639["$generate"],
5640["$pkt"]],
5641[AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
5642 [2], [], [stderr])
5643AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5644Cannot find the datapath
22bb3cbc
AW
5645ovs-appctl: ovs-vswitchd: server returned an error
5646])])
5647
5648# Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
5649m4_foreach(
5650[option],
5651[[],
5652["$generate"],
5653["$pkt"]],
5654[AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
5655 [2], [], [stderr])
5656AT_CHECK([tail -2 stderr], [0], [dnl
b490b189 5657ovs-dummy: unknown bridge
22bb3cbc
AW
5658ovs-appctl: ovs-vswitchd: server returned an error
5659])])
5660
5661# Test incorrect command: ofproto/trace br_flow [-generate|packet]
5662m4_foreach(
5663[option],
5664[[],
5665["$generate"],
5666["$pkt"]],
5667[AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
5668 [2], [], [stderr])
5669AT_CHECK([tail -2 stderr], [0], [dnl
5670Must specify bridge name
5671ovs-appctl: ovs-vswitchd: server returned an error
5672])])
5673
5674# Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
5675AT_CHECK([ovs-appctl ofproto/trace \
5676 ovs-dummy "$odp_flow" garbage_option],
5677 [2], [stdout],[stderr])
5678AT_CHECK([tail -2 stderr], [0], [dnl
5679Trailing garbage in packet data
5680ovs-appctl: ovs-vswitchd: server returned an error
5681])
5682
22bb3cbc
AW
5683# Test incorrect command: ofproto/trace with 0 argument
5684AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
5685AT_CHECK([tail -2 stderr], [0], [dnl
5686"ofproto/trace" command requires at least 1 arguments
5687ovs-appctl: ovs-vswitchd: server returned an error
5688])
5689
5690OVS_VSWITCHD_STOP
5691AT_CLEANUP
5692
b6ec827f
JS
5693# The third test checks that the output of "ovs-dpctl -m" is valid to trace.
5694AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
5695OVS_VSWITCHD_START([dnl
5696 set Open_vSwitch . other_config:max-idle=10000 \
5697 -- add-port br0 p1 -- set Interface p1 type=dummy])
5698
5699AT_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)'])
5700ovs-appctl revalidator/wait
5701AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
5702
5703odp_flow=`cat dp_flows1.txt`
5704AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
b6ec827f 5705Flow: <cleared>
b6ec827f 5706
2d9b49dd
BP
5707bridge("br0")
5708-------------
5709 0. No match.
5710 drop
b6ec827f
JS
5711
5712Final flow: <cleared>
5713Megaflow: <cleared>
5714Datapath actions: drop
5715])
5716
5717dnl Now, try again without megaflows:
5718ovs-appctl upcall/disable-megaflows
5719
5720AT_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)'])
5721ovs-appctl revalidator/wait
5722AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
5723
5724odp_flow=`cat dp_flows2.txt`
5725AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
b6ec827f 5726Flow: <cleared>
b6ec827f 5727
2d9b49dd
BP
5728bridge("br0")
5729-------------
5730 0. No match.
5731 drop
b6ec827f
JS
5732
5733Final flow: <cleared>
5734Megaflow: <cleared>
5735Datapath actions: drop
5736])
5737
5738OVS_VSWITCHD_STOP
5739AT_CLEANUP
5740
aee0979b
BP
5741AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
5742OVS_VSWITCHD_START
ca5792f0 5743add_of_ports br0 1 2 3
aee0979b
BP
5744
5745AT_DATA([flows.txt], [dnl
5746in_port=1 actions=output:2
5747in_port=2 actions=output:1
5748])
5749AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5750
5751AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
5752AT_CHECK([tail -1 stdout], [0], [dnl
5753Datapath actions: push_vlan(vid=123,pcp=0),2
5754])
5755
5756OVS_VSWITCHD_STOP
5757AT_CLEANUP
5758
5759
b44a10b7
BP
5760m4_define([OFPROTO_TRACE],
5761 [flow="$2"
5762 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
5763 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5764 expected="$4"
5765 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
5766 [0], [stdout])
5767 mv stdout expout
5768 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
5769 [0], [expout])])
5770
5771AT_SETUP([ofproto-dpif - MAC learning])
432fca23 5772OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 5773add_of_ports br0 1 2 3
b44a10b7 5774
b44a10b7
BP
5775arp='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)'
5776
5777# Trace an ARP packet arriving on p3, to create a MAC learning entry.
5778OFPROTO_TRACE(
50aa28fd 5779 [ovs-dummy],
247527db 5780 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5781 [-generate],
e44768b7 5782 [1,2,100])
b44a10b7
BP
5783
5784# Check for the MAC learning entry.
83664f72 5785AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5786 port VLAN MAC Age
247527db 5787 3 0 50:54:00:00:00:05 ?
b44a10b7
BP
5788])
5789
5790# Trace a packet arrival destined for the learned MAC.
5791# (This will also learn a MAC.)
5792OFPROTO_TRACE(
50aa28fd 5793 [ovs-dummy],
247527db 5794 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
b44a10b7 5795 [-generate],
247527db 5796 [3])
b44a10b7
BP
5797
5798# Check for both MAC learning entries.
83664f72 5799AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5800 port VLAN MAC Age
247527db
BP
5801 3 0 50:54:00:00:00:05 ?
5802 1 0 50:54:00:00:00:06 ?
b44a10b7
BP
5803])
5804
5805# Trace a packet arrival that updates the first learned MAC entry.
5806OFPROTO_TRACE(
50aa28fd 5807 [ovs-dummy],
247527db 5808 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5809 [-generate],
e44768b7 5810 [1,3,100])
b44a10b7
BP
5811
5812# Check that the MAC learning entry was updated.
83664f72 5813AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5814 port VLAN MAC Age
247527db
BP
5815 1 0 50:54:00:00:00:06 ?
5816 2 0 50:54:00:00:00:05 ?
b44a10b7
BP
5817])
5818
5819# Add another bridge.
5820AT_CHECK(
5821 [ovs-vsctl \
5822 -- add-br br1 \
ad28062f 5823 -- set bridge br1 datapath-type=dummy])
ca5792f0 5824add_of_ports br1 4 5
b44a10b7
BP
5825
5826# Trace some packet arrivals in br1 to create MAC learning entries there too.
5827OFPROTO_TRACE(
50aa28fd 5828 [ovs-dummy],
247527db 5829 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5830 [-generate],
e44768b7 5831 [5,101])
b44a10b7 5832OFPROTO_TRACE(
50aa28fd 5833 [ovs-dummy],
247527db 5834 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5835 [-generate],
e44768b7 5836 [4,101])
b44a10b7
BP
5837
5838# Check that the MAC learning entries were added.
83664f72 5839AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5840 port VLAN MAC Age
247527db
BP
5841 4 0 50:54:00:00:00:06 ?
5842 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
5843])
5844
5845# Delete port p1 and see that its MAC learning entry disappeared, and
5846# that the MAC learning entry for the same MAC was also deleted from br1.
5847AT_CHECK([ovs-vsctl del-port p1])
83664f72 5848AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5849 port VLAN MAC Age
247527db 5850 2 0 50:54:00:00:00:05 ?
b44a10b7 5851])
83664f72 5852AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5853 port VLAN MAC Age
247527db 5854 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
5855])
5856
5857OVS_VSWITCHD_STOP
5858AT_CLEANUP
17f7f7e0 5859
c4069512
BP
5860AT_SETUP([ofproto-dpif - MAC table overflow])
5861OVS_VSWITCHD_START(
ad28062f 5862 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 5863add_of_ports br0 1 2 3
c4069512
BP
5864
5865arp='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)'
5866
5867AT_CHECK([ovs-appctl time/stop])
5868
5869# Trace 10 ARP packets arriving on p3, to create MAC learning entries.
5870for i in 0 1 2 3 4 5 6 7 8 9; do
5871 OFPROTO_TRACE(
50aa28fd 5872 [ovs-dummy],
c4069512
BP
5873 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
5874 [-generate],
5875 [1,2,100])
5876 ovs-appctl time/warp 1000
5877done
5878
5879# Check for the MAC learning entries.
5880AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5881 [0], [dnl
5882 3 0 50:54:00:00:00:00
5883 3 0 50:54:00:00:00:01
5884 3 0 50:54:00:00:00:02
5885 3 0 50:54:00:00:00:03
5886 3 0 50:54:00:00:00:04
5887 3 0 50:54:00:00:00:05
5888 3 0 50:54:00:00:00:06
5889 3 0 50:54:00:00:00:07
5890 3 0 50:54:00:00:00:08
5891 3 0 50:54:00:00:00:09
5892 port VLAN MAC Age
5893])
5894
5895# Trace another ARP packet on another MAC.
5896OFPROTO_TRACE(
50aa28fd 5897 [ovs-dummy],
c4069512
BP
5898 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
5899 [-generate],
5900 [1,2,100])
5901
5902# Check that the new one chased the oldest one out of the table.
5903AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
5904 [0], [dnl
5905 3 0 50:54:00:00:00:01 ?
5906 3 0 50:54:00:00:00:02 ?
5907 3 0 50:54:00:00:00:03 ?
5908 3 0 50:54:00:00:00:04 ?
5909 3 0 50:54:00:00:00:05 ?
5910 3 0 50:54:00:00:00:06 ?
5911 3 0 50:54:00:00:00:07 ?
5912 3 0 50:54:00:00:00:08 ?
5913 3 0 50:54:00:00:00:09 ?
5914 3 0 50:54:00:00:00:10 ?
5915 port VLAN MAC Age
5916])
5917OVS_VSWITCHD_STOP
5918AT_CLEANUP
5919
9d078ec2
BP
5920AT_SETUP([ofproto-dpif - MAC table overflow fairness])
5921OVS_VSWITCHD_START(
5922 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 5923add_of_ports br0 1 2 3 4 5 6
9d078ec2
BP
5924
5925arp='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)'
5926
5927AT_CHECK([ovs-appctl time/stop])
5928
5929# Trace packets with 2 different source MACs arriving on each of the 5
5930# ports, filling up the 10-entry learning table.
5931for i in 0 1 2 3 4 5 6 7 8 9; do
5932 p=`expr $i / 2 + 1`
5933 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
5934 ovs-appctl time/warp 1000
5935done
5936
5937# Check for the MAC learning entries.
5938AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5939 [0], [dnl
5940 1 0 50:54:00:00:00:00
5941 1 0 50:54:00:00:00:01
5942 2 0 50:54:00:00:00:02
5943 2 0 50:54:00:00:00:03
5944 3 0 50:54:00:00:00:04
5945 3 0 50:54:00:00:00:05
5946 4 0 50:54:00:00:00:06
5947 4 0 50:54:00:00:00:07
5948 5 0 50:54:00:00:00:08
5949 5 0 50:54:00:00:00:09
5950 port VLAN MAC Age
5951])
5952
5953# Now trace 16 new MACs on another port.
5954for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
5955 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
5956 ovs-appctl time/warp 1000
5957done
5958
5959# Check the results.
5960#
5961# Our eviction algorithm on overflow is that an arbitrary (but deterministic)
5962# one of the ports with the most learned MACs loses the least recently used
5963# one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
5964# MAC each, and the other 2 of the old ports with 2 MACs each.
5965#
5966# (If someone changes lib/heap.c to do something different with equal-priority
5967# nodes, then the output below could change, but it would still follow the
5968# rules explained above.)
5969AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5970 [0], [dnl
5971 1 0 50:54:00:00:00:01
5972 2 0 50:54:00:00:00:03
5973 3 0 50:54:00:00:00:04
5974 3 0 50:54:00:00:00:05
5975 4 0 50:54:00:00:00:07
5976 5 0 50:54:00:00:00:08
5977 5 0 50:54:00:00:00:09
5978 6 0 50:54:00:00:0d:ff
5979 6 0 50:54:00:00:0e:ff
5980 6 0 50:54:00:00:0f:ff
5981 port VLAN MAC Age
5982])
5983OVS_VSWITCHD_STOP
5984AT_CLEANUP
5985
4819b3a5 5986# CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
e731d71b
AS
5987#
5988# Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
e731d71b 5989m4_define([CHECK_SFLOW_SAMPLING_PACKET],
4819b3a5 5990 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
e731d71b
AS
5991 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5992
53eb8cb8 5993 on_exit 'kill `cat test-sflow.pid`'
eadd1644 5994 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
e731d71b 5995 AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5996 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
e731d71b
AS
5997 ovs-appctl time/stop
5998
ca5792f0 5999 add_of_ports br0 1 2
e731d71b
AS
6000 ovs-vsctl \
6001 set Interface br0 options:ifindex=1002 -- \
6002 set Interface p1 options:ifindex=1004 -- \
6003 set Interface p2 options:ifindex=1003 -- \
6004 set Bridge br0 sflow=@sf -- \
6005 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
9a9808d7 6006 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
e731d71b
AS
6007
6008 dnl open with ARP packets to seed the bridge-learning. The output
6009 dnl ifIndex numbers should be reported predictably after that.
6010 dnl Since we set sampling=1 we should see all of these packets
6011 dnl reported. Sorting the output by data-source and seqNo makes
6012 dnl it deterministic. Ensuring that we send at least two packets
6013 dnl into each port means we get to check the seq nos are
6014 dnl incrementing correctly.
6015 dnl because packets from different ports can be handled by separate
6016 dnl threads, put some sleeps
6017
6018 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)'
6019 sleep 1
6020 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)'
6021 sleep 1
6022 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)'
6023 sleep 1
6024 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)'
6025 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)'
6026
6027 dnl sleep long enough to get more than one counter sample
6028 dnl from each datasource so we can check sequence numbers
22ecc560 6029 ovs-appctl time/warp 2000 100
e731d71b 6030 OVS_VSWITCHD_STOP
d9c8c57c 6031 OVS_APP_EXIT_AND_WAIT([test-sflow])
8073dd31 6032
e731d71b 6033 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5a0e4aec 6034 /g']], [0], [dnl
8073dd31 6035HEADER
5a0e4aec
BP
6036 dgramSeqNo=1
6037 ds=127.0.0.1>2:1000
6038 fsSeqNo=1
6039 in_vlan=0
6040 in_priority=0
6041 out_vlan=0
6042 out_priority=0
6043 meanSkip=1
6044 samplePool=1
6045 dropEvents=0
6046 in_ifindex=1004
6047 in_format=0
6048 out_ifindex=2
6049 out_format=2
6050 hdr_prot=1
6051 pkt_len=46
6052 stripped=4
6053 hdr_len=42
6054 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 6055HEADER
5a0e4aec
BP
6056 dgramSeqNo=1
6057 ds=127.0.0.1>2:1000
6058 fsSeqNo=2
6059 in_vlan=0
6060 in_priority=0
6061 out_vlan=0
6062 out_priority=0
6063 meanSkip=1
6064 samplePool=2
6065 dropEvents=0
6066 in_ifindex=1003
6067 in_format=0
6068 out_ifindex=2
6069 out_format=2
6070 hdr_prot=1
6071 pkt_len=46
6072 stripped=4
6073 hdr_len=42
6074 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 6075HEADER
5a0e4aec
BP
6076 dgramSeqNo=1
6077 ds=127.0.0.1>2:1000
6078 fsSeqNo=3
6079 in_vlan=0
6080 in_priority=0
6081 out_vlan=0
6082 out_priority=0
6083 meanSkip=1
6084 samplePool=3
6085 dropEvents=0
6086 in_ifindex=1004
6087 in_format=0
6088 out_ifindex=1003
6089 out_format=0
6090 hdr_prot=1
6091 pkt_len=110
6092 stripped=4
6093 hdr_len=106
6094 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 6095HEADER
5a0e4aec
BP
6096 dgramSeqNo=1
6097 ds=127.0.0.1>2:1000
6098 fsSeqNo=4
6099 in_vlan=0
6100 in_priority=0
6101 out_vlan=0
6102 out_priority=0
6103 meanSkip=1
6104 samplePool=4
6105 dropEvents=0
6106 in_ifindex=1003
6107 in_format=0
6108 out_ifindex=1004
6109 out_format=0
6110 hdr_prot=1
6111 pkt_len=110
6112 stripped=4
6113 hdr_len=106
6114 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 6115HEADER
5a0e4aec
BP
6116 dgramSeqNo=1
6117 ds=127.0.0.1>2:1000
6118 fsSeqNo=5
6119 in_vlan=0
6120 in_priority=0
6121 out_vlan=0
6122 out_priority=0
6123 meanSkip=1
6124 samplePool=5
6125 dropEvents=0
6126 in_ifindex=1003
6127 in_format=0
6128 out_ifindex=1004
6129 out_format=0
6130 hdr_prot=1
6131 pkt_len=58
6132 stripped=4
6133 hdr_len=54
6134 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
6135])
6136
934386dd 6137 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'ETHCOUNTERS|IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -24 | sed 's/ /\
5a0e4aec 6138 /g']], [0], [dnl
934386dd 6139ETHCOUNTERS
5a0e4aec
BP
6140 dot3StatsAlignmentErrors=4294967295
6141 dot3StatsFCSErrors=4294967295
6142 dot3StatsSingleCollisionFrames=4294967295
6143 dot3StatsMultipleCollisionFrames=4294967295
6144 dot3StatsSQETestErrors=4294967295
6145 dot3StatsDeferredTransmissions=4294967295
6146 dot3StatsLateCollisions=4294967295
6147 dot3StatsExcessiveCollisions=4294967295
6148 dot3StatsInternalMacTransmitErrors=4294967295
6149 dot3StatsCarrierSenseErrors=4294967295
6150 dot3StatsFrameTooLongs=4294967295
6151 dot3StatsInternalMacReceiveErrors=4294967295
6152 dot3StatsSymbolErrors=4294967295
934386dd 6153ETHCOUNTERS
5a0e4aec
BP
6154 dot3StatsAlignmentErrors=4294967295
6155 dot3StatsFCSErrors=4294967295
6156 dot3StatsSingleCollisionFrames=4294967295
6157 dot3StatsMultipleCollisionFrames=4294967295
6158 dot3StatsSQETestErrors=4294967295
6159 dot3StatsDeferredTransmissions=4294967295
6160 dot3StatsLateCollisions=4294967295
6161 dot3StatsExcessiveCollisions=4294967295
6162 dot3StatsInternalMacTransmitErrors=4294967295
6163 dot3StatsCarrierSenseErrors=4294967295
6164 dot3StatsFrameTooLongs=4294967295
6165 dot3StatsInternalMacReceiveErrors=4294967295
6166 dot3StatsSymbolErrors=4294967295
934386dd 6167ETHCOUNTERS
5a0e4aec
BP
6168 dot3StatsAlignmentErrors=4294967295
6169 dot3StatsFCSErrors=4294967295
6170 dot3StatsSingleCollisionFrames=4294967295
6171 dot3StatsMultipleCollisionFrames=4294967295
6172 dot3StatsSQETestErrors=4294967295
6173 dot3StatsDeferredTransmissions=4294967295
6174 dot3StatsLateCollisions=4294967295
6175 dot3StatsExcessiveCollisions=4294967295
6176 dot3StatsInternalMacTransmitErrors=4294967295
6177 dot3StatsCarrierSenseErrors=4294967295
6178 dot3StatsFrameTooLongs=4294967295
6179 dot3StatsInternalMacReceiveErrors=4294967295
6180 dot3StatsSymbolErrors=4294967295
934386dd 6181ETHCOUNTERS
5a0e4aec
BP
6182 dot3StatsAlignmentErrors=4294967295
6183 dot3StatsFCSErrors=4294967295
6184 dot3StatsSingleCollisionFrames=4294967295
6185 dot3StatsMultipleCollisionFrames=4294967295
6186 dot3StatsSQETestErrors=4294967295
6187 dot3StatsDeferredTransmissions=4294967295
6188 dot3StatsLateCollisions=4294967295
6189 dot3StatsExcessiveCollisions=4294967295
6190 dot3StatsInternalMacTransmitErrors=4294967295
6191 dot3StatsCarrierSenseErrors=4294967295
6192 dot3StatsFrameTooLongs=4294967295
6193 dot3StatsInternalMacReceiveErrors=4294967295
6194 dot3StatsSymbolErrors=4294967295
934386dd 6195ETHCOUNTERS
5a0e4aec
BP
6196 dot3StatsAlignmentErrors=4294967295
6197 dot3StatsFCSErrors=4294967295
6198 dot3StatsSingleCollisionFrames=4294967295
6199 dot3StatsMultipleCollisionFrames=4294967295
6200 dot3StatsSQETestErrors=4294967295
6201 dot3StatsDeferredTransmissions=4294967295
6202 dot3StatsLateCollisions=4294967295
6203 dot3StatsExcessiveCollisions=4294967295
6204 dot3StatsInternalMacTransmitErrors=4294967295
6205 dot3StatsCarrierSenseErrors=4294967295
6206 dot3StatsFrameTooLongs=4294967295
6207 dot3StatsInternalMacReceiveErrors=4294967295
6208 dot3StatsSymbolErrors=4294967295
934386dd 6209ETHCOUNTERS
5a0e4aec
BP
6210 dot3StatsAlignmentErrors=4294967295
6211 dot3StatsFCSErrors=4294967295
6212 dot3StatsSingleCollisionFrames=4294967295
6213 dot3StatsMultipleCollisionFrames=4294967295
6214 dot3StatsSQETestErrors=4294967295
6215 dot3StatsDeferredTransmissions=4294967295
6216 dot3StatsLateCollisions=4294967295
6217 dot3StatsExcessiveCollisions=4294967295
6218 dot3StatsInternalMacTransmitErrors=4294967295
6219 dot3StatsCarrierSenseErrors=4294967295
6220 dot3StatsFrameTooLongs=4294967295
6221 dot3StatsInternalMacReceiveErrors=4294967295
6222 dot3StatsSymbolErrors=4294967295
8073dd31 6223IFCOUNTERS
5a0e4aec
BP
6224 dgramSeqNo=1
6225 ds=127.0.0.1>0:1003
6226 csSeqNo=1
6227 ifindex=1003
6228 type=6
6229 ifspeed=100000000
6230 direction=0
6231 status=0
6232 in_octets=202
6233 in_unicasts=3
6234 in_multicasts=4294967295
6235 in_broadcasts=4294967295
6236 in_discards=4294967295
6237 in_errors=4294967295
6238 in_unknownprotos=4294967295
6239 out_octets=148
6240 out_unicasts=2
6241 out_multicasts=4294967295
6242 out_broadcasts=4294967295
6243 out_discards=4294967295
6244 out_errors=4294967295
6245 promiscuous=0
8073dd31 6246IFCOUNTERS
5a0e4aec
BP
6247 dgramSeqNo=1
6248 ds=127.0.0.1>0:1004
6249 csSeqNo=1
6250 ifindex=1004
6251 type=6
6252 ifspeed=100000000
6253 direction=0
6254 status=0
6255 in_octets=148
6256 in_unicasts=2
6257 in_multicasts=4294967295
6258 in_broadcasts=4294967295
6259 in_discards=4294967295
6260 in_errors=4294967295
6261 in_unknownprotos=4294967295
6262 out_octets=202
6263 out_unicasts=3
6264 out_multicasts=4294967295
6265 out_broadcasts=4294967295
6266 out_discards=4294967295
6267 out_errors=4294967295
6268 promiscuous=0
8073dd31 6269IFCOUNTERS
5a0e4aec
BP
6270 dgramSeqNo=2
6271 ds=127.0.0.1>0:1002
6272 csSeqNo=1
6273 ifindex=1002
6274 type=6
6275 ifspeed=100000000
6276 direction=0
6277 status=0
6278 in_octets=0
6279 in_unicasts=0
6280 in_multicasts=4294967295
6281 in_broadcasts=4294967295
6282 in_discards=4294967295
6283 in_errors=4294967295
6284 in_unknownprotos=4294967295
6285 out_octets=84
6286 out_unicasts=2
6287 out_multicasts=4294967295
6288 out_broadcasts=4294967295
6289 out_discards=4294967295
6290 out_errors=4294967295
6291 promiscuous=0
8073dd31 6292IFCOUNTERS
5a0e4aec
BP
6293 dgramSeqNo=3
6294 ds=127.0.0.1>0:1002
6295 csSeqNo=2
6296 ifindex=1002
6297 type=6
6298 ifspeed=100000000
6299 direction=0
6300 status=0
6301 in_octets=0
6302 in_unicasts=0
6303 in_multicasts=4294967295
6304 in_broadcasts=4294967295
6305 in_discards=4294967295
6306 in_errors=4294967295
6307 in_unknownprotos=4294967295
6308 out_octets=84
6309 out_unicasts=2
6310 out_multicasts=4294967295
6311 out_broadcasts=4294967295
6312 out_discards=4294967295
6313 out_errors=4294967295
6314 promiscuous=0
8073dd31 6315IFCOUNTERS
5a0e4aec
BP
6316 dgramSeqNo=3
6317 ds=127.0.0.1>0:1003
6318 csSeqNo=2
6319 ifindex=1003
6320 type=6
6321 ifspeed=100000000
6322 direction=0
6323 status=0
6324 in_octets=202
6325 in_unicasts=3
6326 in_multicasts=4294967295
6327 in_broadcasts=4294967295
6328 in_discards=4294967295
6329 in_errors=4294967295
6330 in_unknownprotos=4294967295
6331 out_octets=148
6332 out_unicasts=2
6333 out_multicasts=4294967295
6334 out_broadcasts=4294967295
6335 out_discards=4294967295
6336 out_errors=4294967295
6337 promiscuous=0
8073dd31 6338IFCOUNTERS
5a0e4aec
BP
6339 dgramSeqNo=3
6340 ds=127.0.0.1>0:1004
6341 csSeqNo=2
6342 ifindex=1004
6343 type=6
6344 ifspeed=100000000
6345 direction=0
6346 status=0
6347 in_octets=148
6348 in_unicasts=2
6349 in_multicasts=4294967295
6350 in_broadcasts=4294967295
6351 in_discards=4294967295
6352 in_errors=4294967295
6353 in_unknownprotos=4294967295
6354 out_octets=202
6355 out_unicasts=3
6356 out_multicasts=4294967295
6357 out_broadcasts=4294967295
6358 out_discards=4294967295
6359 out_errors=4294967295
6360 promiscuous=0
50b9699f 6361OPENFLOWPORT
5a0e4aec
BP
6362 datapath_id=18364758544493064720
6363 port_no=1
50b9699f 6364OPENFLOWPORT
5a0e4aec
BP
6365 datapath_id=18364758544493064720
6366 port_no=1
50b9699f 6367OPENFLOWPORT
5a0e4aec
BP
6368 datapath_id=18364758544493064720
6369 port_no=2
50b9699f 6370OPENFLOWPORT
5a0e4aec
BP
6371 datapath_id=18364758544493064720
6372 port_no=2
50b9699f 6373OPENFLOWPORT
5a0e4aec
BP
6374 datapath_id=18364758544493064720
6375 port_no=65534
50b9699f 6376OPENFLOWPORT
5a0e4aec
BP
6377 datapath_id=18364758544493064720
6378 port_no=65534
50b9699f 6379PORTNAME
5a0e4aec 6380 portName=br0
50b9699f 6381PORTNAME
5a0e4aec 6382 portName=br0
50b9699f 6383PORTNAME
5a0e4aec 6384 portName=p1
50b9699f 6385PORTNAME
5a0e4aec 6386 portName=p1
50b9699f 6387PORTNAME
5a0e4aec 6388 portName=p2
50b9699f 6389PORTNAME
5a0e4aec 6390 portName=p2
4819b3a5 6391])])
17f7f7e0 6392
aaca4fe0
WT
6393AT_SETUP([ofproto-dpif - basic truncate action])
6394OVS_VSWITCHD_START
6395add_of_ports br0 1 2 3 4 5
6396
6397AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
6398AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
6399AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
6400AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
6401AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
6402
6403AT_DATA([flows.txt], [dnl
6404in_port=3,actions=drop
6405in_port=5,actions=drop
6406in_port=1,actions=output(port=2,max_len=64),output:4
6407])
6408AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6409
6410dnl Datapath actions
6411AT_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])
6412AT_CHECK([tail -1 stdout], [0],
6413[Datapath actions: trunc(64),2,4
6414])
6415
6416dnl An 170 byte packet
6417AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6418
6419AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
6420icmp,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
6421])
6422
6423AT_CHECK([ovs-appctl revalidator/purge], [0])
6424dnl packet with truncated size
6425AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6426n_bytes=64
6427])
6428dnl packet with original size
6429AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6430n_bytes=170
6431])
6432
6433dnl More complicated case
6434AT_CHECK([ovs-ofctl del-flows br0])
6435AT_DATA([flows.txt], [dnl
6436in_port=3,actions=drop
6437in_port=5,actions=drop
6438in_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
6439])
6440AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6441
6442dnl Datapath actions
6443AT_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])
6444AT_CHECK([tail -1 stdout], [0],
6445[Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
6446])
6447
6448dnl An 170 byte packet
6449AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6450
6451AT_CHECK([ovs-appctl revalidator/purge], [0])
6452dnl packet size: 64 + 128 + 170 = 362
6453AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6454n_bytes=362
6455])
6456dnl packet size: 60 + 170 = 230
6457AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6458n_bytes=230
6459])
6460
6461dnl syntax checking
6462AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
6463ovs-ofctl: output to unsupported truncate port: ALL
6464])
6465
6466OVS_VSWITCHD_STOP
6467AT_CLEANUP
6468
6469AT_SETUP([ofproto-dpif - truncate and output to patch port])
6470OVS_VSWITCHD_START([add-br br1 \
6471-- set bridge br1 datapath-type=dummy fail-mode=secure \
6472-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 ofport_request=1 \
6473-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6474
6475add_of_ports br0 2
6476
6477AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
6478AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
6479
6480AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6481[0], [stdout])
6482AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
6483])
6484dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
2d9b49dd 6485AT_CHECK([grep "output_trunc does not support patch port [[0-9]]*" stdout], [0], [stdout])
aaca4fe0
WT
6486
6487OVS_VSWITCHD_STOP
6488AT_CLEANUP
6489
6490AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
6491OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6492 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6493 options:key=5 ofport_request=1\
6494 -- add-port br0 p2 -- set Interface p2 type=dummy \
6495 ofport_request=2])
6496AT_DATA([flows.txt], [dnl
6497actions=output(max_len=100, port=1)
6498])
6499OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6500AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6501
6502AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
6503 br0 65534/100: (dummy-internal)
6504 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
6505 p2 2/2: (dummy)
aaca4fe0
WT
6506])
6507
6508dnl Basic
6509AT_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])
6510AT_CHECK([tail -1 stdout], [0],
6511 [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
6512])
6513
6514OVS_VSWITCHD_STOP
6515AT_CLEANUP
6516
4819b3a5
BP
6517AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
6518CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
6519AT_CLEANUP
6520
6521AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
6522AT_SKIP_IF([test $HAVE_IPV6 = no])
6523CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
6524AT_CLEANUP
1e04fcc8 6525
50b9699f 6526dnl Test sFlow LAG structures
7321bda3 6527AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
80ee73d3 6528AT_SKIP_IF([test "$IS_WIN32" = "yes"])
50b9699f 6529OVS_VSWITCHD_START([dnl
5a0e4aec
BP
6530 add-bond br0 bond p1 p2 -- \
6531 set Port bond lacp=active bond-mode=active-backup \
6532 other_config:lacp-time="fast" \
6533 other_config:lacp-system-id=11:22:33:44:55:66 \
6534 other_config:lacp-system-priority=54321 -- \
6535 set Interface p1 type=dummy \
6536 other_config:lacp-port-id=11 \
6537 other_config:lacp-port-priority=111 \
6538 other_config:lacp-aggregation-key=3333 -- \
6539 set Interface p2 type=dummy \
6540 other_config:lacp-port-id=22 \
6541 other_config:lacp-port-priority=222 \
6542 other_config:lacp-aggregation-key=3333 ])
50b9699f 6543
53eb8cb8 6544on_exit 'kill `cat test-sflow.pid`'
50b9699f
NM
6545AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6546AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6547PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
50b9699f
NM
6548
6549ovs-appctl time/stop
6550
6551ovs-vsctl \
5a0e4aec
BP
6552 set Interface p1 options:ifindex=1003 -- \
6553 set Bridge br0 sflow=@sf -- \
6554 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
96657459 6555 header=128 sampling=1 polling=1 agent=127.0.0.1
50b9699f
NM
6556
6557dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
cea4a6d7
JS
6558AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
6559AT_CHECK([ovs-appctl revalidator/purge], [0])
50b9699f 6560OVS_VSWITCHD_STOP
d9c8c57c 6561OVS_APP_EXIT_AND_WAIT([test-sflow])
50b9699f 6562AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
5a0e4aec 6563 /g']], [0], [dnl
50b9699f 6564LACPCOUNTERS
5a0e4aec
BP
6565 sysID=11:22:33:44:55:66
6566 partnerID=00:00:00:00:00:00
6567 aggID=3333
6568 actorAdmin=0x7
6569 actorOper=0xbf
6570 partnerAdmin=0x0
6571 partnerOper=0x2
6572 LACPDUsRx=0
6573 markerPDUsRx=4294967295
6574 markerRespPDUsRx=4294967295
6575 unknownRx=4294967295
6576 illegalRx=0
6577 LACPDUsTx=1
6578 markerPDUsTx=4294967295
6579 markerRespPDUsTx=4294967295
50b9699f
NM
6580])
6581
6582AT_CLEANUP
6583
7321bda3
NM
6584AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
6585AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6586OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6587
6588dnl set up sFlow logging
7321bda3
NM
6589AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6590AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6591PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
6592ovs-appctl time/stop
6593
6594OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6595AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
5a0e4aec 6596 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
7321bda3
NM
6597AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
6598
6599AT_CHECK([ovs-ofctl add-flow br0 action=3])
6600
6601dnl enable sflow
6602ovs-vsctl \
6603 set Bridge br0 sflow=@sf -- \
96657459 6604 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7321bda3
NM
6605 header=128 sampling=1 polling=0
6606
6607dnl introduce a packet that will be flooded to the tunnel
6608AT_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)'])
6609
6610dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6611for i in `seq 1 30`; do
6612 ovs-appctl time/warp 100
6613done
6614
d9c8c57c 6615OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
6616
6617AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5a0e4aec 6618 /g']], [0], [dnl
7321bda3 6619HEADER
5a0e4aec
BP
6620 dgramSeqNo=1
6621 ds=127.0.0.1>2:1000
6622 fsSeqNo=1
6623 tunnel4_out_length=0
6624 tunnel4_out_protocol=47
6625 tunnel4_out_src=0.0.0.0
6626 tunnel4_out_dst=1.1.1.1
6627 tunnel4_out_src_port=0
6628 tunnel4_out_dst_port=0
6629 tunnel4_out_tcp_flags=0
6630 tunnel4_out_tos=1
6631 tunnel_out_vni=456
6632 in_vlan=0
6633 in_priority=0
6634 out_vlan=0
6635 out_priority=0
6636 meanSkip=1
6637 samplePool=1
6638 dropEvents=0
6639 in_ifindex=0
6640 in_format=0
6641 out_ifindex=1
6642 out_format=2
6643 hdr_prot=1
6644 pkt_len=110
6645 stripped=4
6646 hdr_len=106
6647 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
6648])
6649
6650OVS_VSWITCHD_STOP
6651AT_CLEANUP
6652
6653AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
6654AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6655
6656OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
6657
6658dnl set up sFlow logging
7321bda3
NM
6659AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6660AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6661PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
6662ovs-appctl time/stop
6663
6664AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6665AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
6666AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
6667 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
d14a36f4
BP
6668 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
6669 options:ifindex=2011 ofport_request=5
7321bda3
NM
6670 ], [0])
6671
6672AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6673dummy@ovs-dummy: hit:0 missed:0
7be29a47
BP
6674 br0:
6675 br0 65534/100: (dummy-internal)
6676 p0 1/1: (dummy: ifindex=1010)
6677 int-br:
6678 int-br 65534/2: (dummy-internal)
6679 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
6680 vm1 5/3: (dummy: ifindex=2011)
7321bda3
NM
6681])
6682
6683dnl set up route to 1.1.2.92 via br0 and action=normal
7321bda3
NM
6684AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
6685])
a8704b50
PS
6686AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
6687])
7321bda3
NM
6688AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6689
6690dnl Prime ARP Cache for 1.1.2.92
283d8662 6691AT_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
6692
6693dnl configure sflow on int-br only
6694ovs-vsctl \
6695 set Bridge int-br sflow=@sf -- \
96657459 6696 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7321bda3
NM
6697 header=128 sampling=1 polling=0
6698
a8704b50
PS
6699dnl set up route to 192.168.1.2 via br0
6700AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
6701])
6702AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
6703])
6704
7321bda3
NM
6705dnl add rule for int-br to force packet onto tunnel. There is no ifindex
6706dnl for this port so the sFlow output will just report that it went to
6707dnl 1 output (out_format=2, out_ifindex=1)
6708AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
6709
6710AT_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)'])
6711
6712dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6713for i in `seq 1 30`; do
6714 ovs-appctl time/warp 100
6715done
6716
d9c8c57c 6717OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
6718
6719AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5a0e4aec 6720 /g']], [0], [dnl
7321bda3 6721HEADER
5a0e4aec
BP
6722 dgramSeqNo=1
6723 ds=127.0.0.1>2:1000
6724 fsSeqNo=1
6725 tunnel4_out_length=0
6726 tunnel4_out_protocol=47
6727 tunnel4_out_src=1.1.2.88
6728 tunnel4_out_dst=1.1.2.92
6729 tunnel4_out_src_port=0
6730 tunnel4_out_dst_port=0
6731 tunnel4_out_tcp_flags=0
6732 tunnel4_out_tos=0
6733 tunnel_out_vni=456
6734 in_vlan=0
6735 in_priority=0
6736 out_vlan=0
6737 out_priority=0
6738 meanSkip=1
6739 samplePool=1
6740 dropEvents=0
6741 in_ifindex=2011
6742 in_format=0
6743 out_ifindex=1
6744 out_format=2
6745 hdr_prot=1
6746 pkt_len=110
6747 stripped=4
6748 hdr_len=106
6749 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
6750])
6751
6752OVS_VSWITCHD_STOP
6753AT_CLEANUP
6754
6755AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
7ad705c6 6756AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
7321bda3
NM
6757OVS_VSWITCHD_START
6758AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6759add_of_ports br0 1 2
7321bda3
NM
6760AT_DATA([flows.txt], [dnl
6761table=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
6762table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6763])
6764AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6765
6766dnl set up sFlow logging
7321bda3
NM
6767AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6768AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6769PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
6770ovs-appctl time/stop
6771
6772dnl configure sflow
6773ovs-vsctl \
6774 set Bridge br0 sflow=@sf -- \
96657459 6775 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7321bda3
NM
6776 header=128 sampling=1 polling=0
6777
6778AT_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)'])
6779AT_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)'])
6780
6781dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6782for i in `seq 1 30`; do
6783 ovs-appctl time/warp 100
6784done
6785
d9c8c57c 6786OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
6787
6788AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5a0e4aec 6789 /g']], [0], [dnl
7321bda3 6790HEADER
5a0e4aec
BP
6791 dgramSeqNo=1
6792 ds=127.0.0.1>2:1000
6793 fsSeqNo=1
6794 mpls_label_0=789
6795 mpls_tc_0=4
6796 mpls_ttl_0=32
6797 mpls_bos_0=0
6798 mpls_label_1=11
6799 mpls_tc_1=3
6800 mpls_ttl_1=64
6801 mpls_bos_1=1
6802 in_vlan=0
6803 in_priority=0
6804 out_vlan=0
6805 out_priority=0
6806 meanSkip=1
6807 samplePool=1
6808 dropEvents=0
6809 in_ifindex=0
6810 in_format=0
6811 out_ifindex=1
6812 out_format=2
6813 hdr_prot=1
6814 pkt_len=22
6815 stripped=4
6816 hdr_len=18
6817 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40
7321bda3 6818HEADER
5a0e4aec
BP
6819 dgramSeqNo=1
6820 ds=127.0.0.1>2:1000
6821 fsSeqNo=2
6822 mpls_label_0=789
6823 mpls_tc_0=4
6824 mpls_ttl_0=32
6825 mpls_bos_0=1
6826 in_vlan=0
6827 in_priority=0
6828 out_vlan=0
6829 out_priority=0
6830 meanSkip=1
6831 samplePool=2
6832 dropEvents=0
6833 in_ifindex=0
6834 in_format=0
6835 out_ifindex=1
6836 out_format=2
6837 hdr_prot=1
6838 pkt_len=38
6839 stripped=4
6840 hdr_len=34
6841 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
6842])
6843
6844OVS_VSWITCHD_STOP
6845AT_CLEANUP
6846
6847
4819b3a5 6848# CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
6849#
6850# Test that basic NetFlow reports flow statistics correctly:
6851# The initial packet of a flow are correctly accounted.
6852# Later packets within a flow are correctly accounted.
6853# Flow actions changing (in this case, due to MAC learning)
6854# cause a record to be sent.
e731d71b 6855m4_define([CHECK_NETFLOW_EXPIRATION],
4819b3a5 6856 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 6857 add_of_ports br0 1 2
e731d71b
AS
6858
6859 ovs-appctl time/stop
53eb8cb8 6860 on_exit 'kill `cat test-netflow.pid`'
eadd1644 6861 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 6862 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 6863 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
6864
6865 ovs-vsctl \
6866 set Bridge br0 netflow=@nf -- \
6867 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6868 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6869
6870 for delay in 1000 30000; do
6871 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 6872 sleep 1 # ensure the order in which these two packets are processed
e731d71b
AS
6873 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)'
6874
6875 ovs-appctl time/warp $delay
6876 done
17f7f7e0 6877
e731d71b 6878 ovs-appctl time/warp 6000
27f57736 6879 ovs-appctl revalidator/wait
e731d71b 6880 OVS_VSWITCHD_STOP
d9c8c57c 6881 OVS_APP_EXIT_AND_WAIT([test-netflow])
e79a6c83 6882
6f068379 6883 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 6884
6f068379 6885 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 6886
6f068379
BP
6887 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 212 bytes, ICMP 0:0" netflow.log | wc -l`
6888 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 6889 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
17f7f7e0 6890
4819b3a5
BP
6891AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
6892CHECK_NETFLOW_EXPIRATION([127.0.0.1])
6893AT_CLEANUP
17f7f7e0 6894
4819b3a5
BP
6895AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
6896AT_SKIP_IF([test $HAVE_IPV6 = no])
6897CHECK_NETFLOW_EXPIRATION([[[::1]]])
6898AT_CLEANUP
1e04fcc8 6899
4819b3a5 6900# CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
6901#
6902# Test that basic NetFlow reports active expirations correctly.
e731d71b 6903m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
4819b3a5 6904 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 6905 add_of_ports br0 1 2
17f7f7e0 6906
53eb8cb8 6907 on_exit 'kill `cat test-netflow.pid`'
eadd1644 6908 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 6909 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 6910 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
17f7f7e0 6911
e731d71b
AS
6912 ovs-vsctl \
6913 set Bridge br0 netflow=@nf -- \
6914 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6915 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
17f7f7e0 6916
e731d71b
AS
6917 AT_CHECK([ovs-appctl time/stop])
6918 n=1
6919 while test $n -le 60; do
6920 n=`expr $n + 1`
17f7f7e0 6921
e731d71b
AS
6922 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)'
6923 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 6924
e731d71b
AS
6925 ovs-appctl time/warp 1000
6926 done
17f7f7e0 6927
e731d71b
AS
6928 ovs-appctl time/warp 10000
6929
27f57736 6930 ovs-appctl revalidator/wait
e731d71b 6931 OVS_VSWITCHD_STOP
d9c8c57c 6932 OVS_APP_EXIT_AND_WAIT([test-netflow])
e731d71b
AS
6933
6934 # Count the number of reported packets:
6935 # - From source to destination before MAC learning kicks in (just one).
6936 # - From source to destination after that.
6937 # - From destination to source.
6938 n_learn=0
6939 n_in=0
6940 n_out=0
6941 n_other=0
6942 n_recs=0
6943 none=0
6944 while read line; do
6945 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
6946 case $pkts in
6947 [[0-9]]*) ;;
6948 *) continue ;;
6949 esac
6950
6951 case $line in
6952 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6953 counter=n_learn
6954 ;;
6955 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6956 counter=n_in
6957 ;;
6958 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
6959 counter=n_out
6960 ;;
6961 *)
6962 counter=n_other
6963 ;;
6964 esac
6965 eval $counter=\`expr \$$counter + \$pkts\`
6966 n_recs=`expr $n_recs + 1`
6967 done < netflow.log
6968
6969 # There should be exactly 1 MAC learning packet,
6970 # exactly 59 other packets in that direction,
6971 # and exactly 60 packets in the other direction.
6972 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
4819b3a5 6973])])
e731d71b 6974
4819b3a5
BP
6975AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
6976CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
6977AT_CLEANUP
e731d71b 6978
4819b3a5
BP
6979AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
6980AT_SKIP_IF([test $HAVE_IPV6 = no])
6981CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
6982AT_CLEANUP
f27f2134 6983
3d198ea5 6984dnl In the absence of an IPFIX collector to verify protocol correctness, simply
fb8f22c1 6985dnl configure bridge IPFIX and ensure that sample action generation works at the
3d198ea5 6986dnl datapath level.
fb8f22c1 6987AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
3d198ea5 6988OVS_VSWITCHD_START
ca5792f0 6989add_of_ports br0 1 2
3d198ea5 6990
fb8f22c1 6991dnl Sample every packet using bridge-based sampling.
3d198ea5
JS
6992AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
6993 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
6994 sampling=1], [0], [ignore])
6995
fb8f22c1 6996dnl Send some packets that should be sampled.
3d198ea5
JS
6997for i in `seq 1 3`; do
6998 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)'])
6999done
7000AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7001flow-dump from non-dpdk interfaces:
72471622 7002packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))
3d198ea5
JS
7003])
7004
31b29c2e
AZ
7005AT_CHECK([ovs-appctl revalidator/purge])
7006dnl
7007dnl Add a slowpath meter. The userspace action should be metered.
7008AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])
7009
7010dnl Send some packets that should be sampled and metered.
7011for i in `seq 1 3`; do
7012 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)'])
7013done
7014AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7015flow-dump from non-dpdk interfaces:
7016packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))
7017])
7018
fb8f22c1 7019dnl Remove the IPFIX configuration.
3d198ea5
JS
7020AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7021AT_CHECK([ovs-appctl revalidator/purge])
7022
7023dnl Send some more packets, to ensure that these are not sampled.
7024for i in `seq 1 3`; do
7025 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)'])
7026done
7027AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7028flow-dump from non-dpdk interfaces:
efe179e0 7029packets:2, bytes:68, used:0.001s, actions:drop
3d198ea5
JS
7030])
7031
7032OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7033AT_CLEANUP
7034
fb8f22c1
BY
7035dnl Bridge IPFIX statistics check
7036AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
7037OVS_VSWITCHD_START
7038add_of_ports br0 1 2
7039
7040dnl Negative test check.
7041AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7042OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7043NXST_IPFIX_BRIDGE request (xid=0x2):
7044])
7045
7046dnl Sample every packet using bridge-based sampling.
7047AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7048 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7049 sampling=1], [0], [ignore])
7050
7051dnl Send some packets that should be sampled.
7052for i in `seq 1 20`; do
7053 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)'])
7054done
7055
7056dnl There are 4 extra IPFIX template packets.
266f8e62 7057AT_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 7058NXST_IPFIX_BRIDGE reply (xid=0x2):
266f8e62
BY
7059 bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7060 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
fb8f22c1
BY
7061])
7062
7063dnl Remove the IPFIX configuration.
7064AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7065AT_CHECK([ovs-appctl revalidator/purge])
7066
7067dnl Send some more packets, to ensure that these are not sampled.
7068for i in `seq 1 2`; do
7069 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)'])
7070done
7071AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7072OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7073NXST_IPFIX_BRIDGE request (xid=0x2):
7074])
7075
7076OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7077AT_CLEANUP
7078
7079dnl Flow IPFIX sanity check
7080AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
7081OVS_VSWITCHD_START
7082add_of_ports br0 1 2
7083
cbef684c
BP
7084# Check for regression against a bug where an invalid target caused an
7085# assertion failure and a crash.
7086AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7087 -- --id=@ipfix create IPFIX targets=\"xyzzy\" \
7088 -- --id=@cs create Flow_Sample_Collector_Set id=0 bridge=@br0 ipfix=@ipfix],
7089 [0], [ignore])
7090
fb8f22c1
BY
7091AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7092 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7093 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7094 [0], [ignore])
7095
7096AT_DATA([flows.txt], [dnl
7097in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7098])
7099
7100AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7101
7102dnl Send some packets that should be sampled.
7103for i in `seq 1 3`; do
7104 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)'])
7105done
7106AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7107flow-dump from non-dpdk interfaces:
72471622 7108packets: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
7109])
7110
7111dnl Remove the flow which contains sample action.
7112AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7113AT_CHECK([ovs-appctl revalidator/purge])
7114
7115dnl Send some more packets, to ensure that these are not sampled.
7116for i in `seq 1 3`; do
7117 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)'])
7118done
7119AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7120flow-dump from non-dpdk interfaces:
efe179e0 7121packets:2, bytes:68, used:0.001s, actions:drop
fb8f22c1
BY
7122])
7123
cbef684c
BP
7124OVS_VSWITCHD_STOP(["/sending to collector failed/d
7125/xyzzy/d
7126/no collectors/d"])
fb8f22c1
BY
7127AT_CLEANUP
7128
f69f713b
BY
7129dnl Flow IPFIX sanity check for tunnel set
7130AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
f69f713b
BY
7131OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
7132 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
7133 options:key=5 ofport_request=1\
7134 -- add-port br0 p2 -- set Interface p2 type=stt \
7135 options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
7136 options:key=6 ofport_request=2\
7137 -- add-port br0 p3 -- set Interface p3 type=dummy \
7138 ofport_request=3 \
7139 -- --id=@br0 get Bridge br0 \
7140 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7141 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7142 [<0>
7143<1>
7144])
7145
7146OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
7147
7148dnl Add openflow sample action without sampling_port.
7149AT_DATA([flows.txt], [dnl
7150in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
7151])
7152AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7153
7154AT_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])
7155AT_CHECK([tail -1 stdout], [0], [dnl
72471622 7156Datapath 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
7157])
7158
7159dnl Remove the flow which contains sample action.
7160AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7161AT_CHECK([ovs-appctl revalidator/purge])
7162
7163dnl Add openflow sample action with sampling_port which is
7164dnl equal to output port.
7165AT_DATA([flows2.txt], [dnl
7166in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
7167])
7168AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
7169
7170AT_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])
7171dnl Make sure flow sample action in datapath is behind set tunnel
7172dnl action at egress point of tunnel port.
7173AT_CHECK([tail -1 stdout], [0], [dnl
72471622 7174Datapath 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
7175])
7176
7177dnl Remove the flow which contains sample action.
7178AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7179AT_CHECK([ovs-appctl revalidator/purge])
7180
7181dnl Add a rule with two sample actions and each sample action
7182dnl has a sampling_port
7183AT_DATA([flows3.txt], [dnl
7184in_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
7185])
7186AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
7187
7188AT_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])
7189dnl Make sure flow sample action in datapath is behind set tunnel
7190dnl action at egress point of tunnel port.
7191AT_CHECK([tail -1 stdout], [0], [dnl
72471622 7192Datapath 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
7193])
7194
7195dnl Remove the flow which contains sample action.
7196AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7197AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7198
7199OVS_VSWITCHD_STOP
7200AT_CLEANUP
7201
7ae62a67
WT
7202AT_SETUP([ofproto-dpif - clone action])
7203OVS_VSWITCHD_START
7204add_of_ports br0 1 2 3 4
7205
eee69393 7206dnl Reversible open flow clone actions, no datapath clone action should be generated.
7ae62a67
WT
7207AT_DATA([flows.txt], [dnl
7208in_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
7209])
7210AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7211
7212AT_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])
7213
bef503e8 7214AT_CHECK([tail -1 stdout], [0], [dnl
eee69393 7215Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
bef503e8
AZ
7216])
7217
7218dnl Test flow xlate openflow clone action without using datapath clone action.
ce15b514 7219AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
bef503e8
AZ
7220
7221AT_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])
7222
7ae62a67 7223AT_CHECK([tail -1 stdout], [0], [dnl
eee69393 7224Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
7ae62a67
WT
7225])
7226
9c2a44dc
AZ
7227AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7228AT_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])
7229
7230AT_CHECK([tail -1 stdout], [0], [dnl
7231Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
7232])
7233
eee69393
AZ
7234dnl Mixing reversible and irreversible open flow clone actions. Datapath clone action
7235dnl should be generated when necessary.
7236
7237dnl Restore the datapath support level.
7238AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone true], [0], [])
7239AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 10], [0], [])
7240
7241AT_DATA([flows.txt], [dnl
7242in_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
7243])
7244AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7245
7246AT_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])
7247
7248AT_CHECK([tail -1 stdout], [0], [dnl
7249Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(ipv4(src=10.10.10.2,dst=10.10.10.1)),clone(ct(commit),3),4
7250])
7251
7252AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7253
7254AT_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])
7255
7256AT_CHECK([tail -1 stdout], [0], [dnl
7257Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(ipv4(src=10.10.10.2,dst=10.10.10.1)),sample(sample=100.0%,actions(ct(commit),3)),4
7258])
7259
7260AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7261AT_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])
7262
7263AT_CHECK([tail -1 stdout], [0], [dnl
7264Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
7265])
7266AT_CHECK([grep "Failed to compose clone action" stdout], [0], [ignore])
7267
7ae62a67
WT
7268OVS_VSWITCHD_STOP
7269AT_CLEANUP
7270
fb8f22c1
BY
7271dnl Flow based IPFIX statistics check
7272AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
7273OVS_VSWITCHD_START
7274add_of_ports br0 1 2
7275
7276dnl Negative test check.
7277AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7278OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7279NXST_IPFIX_FLOW request (xid=0x2):
7280])
7281
7282AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7283 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7284 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7285 [0], [ignore])
7286
7287AT_DATA([flows.txt], [dnl
7288in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7289])
7290
7291AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7292
7293dnl Send some packets that should be sampled.
7294for i in `seq 1 20`; do
7295 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)'])
7296done
7297
7298dnl There are 4 extra IPFIX template packets.
266f8e62 7299AT_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 7300NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
266f8e62
BY
7301 id 1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7302 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
fb8f22c1
BY
7303])
7304
7305dnl Remove the flow which contains sample action.
7306AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7307AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7308AT_CHECK([ovs-appctl revalidator/purge])
7309
7310dnl Send some more packets, to ensure that these are not sampled.
7311for i in `seq 1 3`; do
7312 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)'])
7313done
7314AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7315OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7316NXST_IPFIX_FLOW request (xid=0x2):
7317])
7318
7319OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7320AT_CLEANUP
7321
23a7d252
JS
7322AT_SETUP([ofproto-dpif - flow stats])
7323OVS_VSWITCHD_START
7324AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7325AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7326
7327ovs-appctl time/stop
7328
7329for i in `seq 1 10`; do
7330 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)'
7331done
7332
cea4a6d7
JS
7333AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7334AT_CHECK([ovs-appctl revalidator/purge], [0])
e96a5c24 7335AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 7336AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
e96a5c24 7337 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6f068379 7338 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
e96a5c24
JS
7339])
7340OVS_VSWITCHD_STOP
7341AT_CLEANUP
8b6987d7
JR
7342
7343AT_SETUP([ofproto-dpif - flow stats reset_counts])
7344OVS_VSWITCHD_START
7345flow="ip,actions=NORMAL"
7346
7347ovs-appctl time/stop
7348
7349AT_CHECK([ovs-ofctl add-flow br0 $flow])
7350
7351warp_and_dump_NXM () {
7352 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7353 AT_CHECK([ovs-appctl revalidator/purge], [0])
7354
7355 AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0], [0], [stdout])
7356 if [[ $5 -gt 0 ]]; then
7357 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, hard_age=$5, ip actions=NORMAL"
7358 else
7359 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, ip actions=NORMAL"
7360 fi
7361 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7362$expected
7363])
7364}
7365
7366warp_and_dump_OF () {
7367 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7368 AT_CHECK([ovs-appctl revalidator/purge], [0])
7369
7370 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0], [0], [stdout])
7371 if [[ $1 -lt 13 -o "$5X" = "X" ]]; then
7372 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, ip actions=NORMAL"
7373 else
7374 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $5 ip actions=NORMAL"
7375 fi
7376 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7377$expected
7378])
7379}
7380
7381send_packet () {
7382 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)'
7383}
7384
7385# OpenFlow 1.0, implicit reset_counts
7386send_packet
6f068379 7387warp_and_dump_NXM 1 1 118 1
8b6987d7
JR
7388AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 add-flow br0 $flow])
7389# add-flow resets duration and counts,
7390# but idle age is inherited from the old flow
7391warp_and_dump_NXM 1 0 0 2
7392
7393send_packet
6f068379 7394warp_and_dump_NXM 2 1 118 1
8b6987d7
JR
7395AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 mod-flows br0 $flow])
7396# mod-flows resets hard_age, but not counts
7397# but duration and idle_age is inherited from the old flow
6f068379 7398warp_and_dump_NXM 3 1 118 2 1
8b6987d7
JR
7399
7400# OpenFlow 1.1, implicit reset_counts
7401send_packet
6f068379 7402warp_and_dump_OF 11 4 2 236
8b6987d7
JR
7403AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 add-flow br0 $flow])
7404# add-flow resets duration and counts,
7405# but idle age is inherited from the old flow
7406warp_and_dump_NXM 1 0 0 2
7407warp_and_dump_OF 11 2 0 0
7408
7409send_packet
6f068379 7410warp_and_dump_OF 11 3 1 118
8b6987d7
JR
7411AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 mod-flows br0 $flow])
7412# mod-flows resets hard_age, but not counts
7413# but duration and idle_age is inherited from the old flow
6f068379
BP
7414warp_and_dump_NXM 4 1 118 2 1
7415warp_and_dump_OF 11 5 1 118
8b6987d7
JR
7416
7417# OpenFlow 1.2, explicit reset_counts
7418send_packet
6f068379 7419warp_and_dump_OF 12 6 2 236
8b6987d7
JR
7420AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 $flow])
7421# add-flow without flags resets duration, but not counts,
7422# idle age is inherited from the old flow
6f068379
BP
7423warp_and_dump_NXM 1 2 236 2
7424warp_and_dump_OF 12 2 2 236
8b6987d7
JR
7425
7426send_packet
6f068379 7427warp_and_dump_OF 12 3 3 354
8b6987d7
JR
7428AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 $flow])
7429# mod-flows without flags does not reset duration nor counts,
7430# idle age is inherited from the old flow
6f068379
BP
7431warp_and_dump_NXM 4 3 354 2 1
7432warp_and_dump_OF 12 5 3 354
8b6987d7
JR
7433
7434send_packet
6f068379 7435warp_and_dump_OF 12 6 4 472
8b6987d7
JR
7436AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 reset_counts,$flow])
7437# add-flow with reset_counts resets both duration and counts,
7438# idle age is inherited from the old flow
7439warp_and_dump_NXM 1 0 0 2
7440warp_and_dump_OF 12 2 0 0
7441
7442send_packet
6f068379 7443warp_and_dump_OF 12 3 1 118
8b6987d7
JR
7444AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 reset_counts,$flow])
7445# mod-flows with reset_counts resets counts, but not duration,
7446# idle age is inherited from the old flow
7447warp_and_dump_NXM 4 0 0 2 1
7448warp_and_dump_OF 12 5 0 0
7449
7450# OpenFlow > 1.3, explicit reset_counts
7451flow_mods_reset_counts () {
7452 # Reset to a known state
7453 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7454
7455 send_packet
6f068379 7456 warp_and_dump_OF $1 1 1 118 reset_counts
8b6987d7
JR
7457 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7458 # add-flow without flags resets duration, but not counts,
7459 # idle age is inherited from the old flow
6f068379
BP
7460 warp_and_dump_NXM 1 1 118 2
7461 warp_and_dump_OF $1 2 1 118
8b6987d7
JR
7462
7463 send_packet
6f068379 7464 warp_and_dump_OF $1 3 2 236
8b6987d7
JR
7465 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7466 # mod-flows without flags does not reset duration nor counts,
7467 # idle age is inherited from the old flow
6f068379
BP
7468 warp_and_dump_NXM 4 2 236 2 1
7469 warp_and_dump_OF $1 5 2 236
8b6987d7
JR
7470
7471 send_packet
6f068379 7472 warp_and_dump_OF $1 6 3 354
8b6987d7
JR
7473 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7474 # add-flow with reset_counts resets both duration and counts,
7475 # idle age is inherited from the old flow
7476 warp_and_dump_NXM 1 0 0 2
7477 warp_and_dump_OF $1 2 0 0 reset_counts
7478
7479 send_packet
6f068379 7480 warp_and_dump_OF $1 3 1 118 reset_counts
8b6987d7
JR
7481 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7482 # mod-flows with reset_counts resets counts, but not duration,
7483 # idle age is inherited from the old flow
7484 warp_and_dump_NXM 4 0 0 2 1
7485 warp_and_dump_OF $1 5 0 0 reset_counts
7486
7487 # Modify flow having reset_counts flag without reset_counts
7488 send_packet
6f068379 7489 warp_and_dump_OF $1 6 1 118 reset_counts
8b6987d7 7490 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
6f068379
BP
7491 warp_and_dump_NXM 7 1 118 2 1
7492 warp_and_dump_OF $1 8 1 118 reset_counts
8b6987d7
JR
7493
7494 # Add flow having reset_counts flag without reset_counts
7495 send_packet
6f068379 7496 warp_and_dump_OF $1 9 2 236 reset_counts
8b6987d7 7497 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
6f068379
BP
7498 warp_and_dump_NXM 1 2 236 2
7499 warp_and_dump_OF $1 2 2 236
8b6987d7
JR
7500
7501 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7502 send_packet
6f068379 7503 warp_and_dump_OF $1 3 3 354
8b6987d7
JR
7504 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7505 warp_and_dump_NXM 4 0 0 2 1
7506 warp_and_dump_OF $1 5 0 0
7507}
7508
7509# OpenFlow versions >= 1.3 should behave the same way
7510flow_mods_reset_counts 13
7511flow_mods_reset_counts 14
c7b02b80
S
7512
7513OVS_VSWITCHD_STOP
7514AT_CLEANUP
7515
7516AT_SETUP([ofproto-dpif - flow stats reset_counts OpenFlow1.5])
7517OVS_VSWITCHD_START
7518flow="ip,actions=NORMAL"
7519
7520ovs-appctl time/stop
7521
7522AT_CHECK([ovs-ofctl add-flow br0 $flow])
7523
7524warp_and_dump_OF () {
7525 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7526 AT_CHECK([ovs-appctl revalidator/purge], [0])
7527
7528 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0 ], [0], [stdout])
7529 if [[ "$6X" = "X" ]]; then
7530 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, idle_age=$5, ip actions=NORMAL"
7531 else
7532 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $6 idle_age=$5, ip actions=NORMAL"
7533 fi
7534 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7535$expected
7536])
7537}
7538
7539send_packet () {
7540 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)'
7541}
7542
7543# OpenFlow 1.5, explicit reset_counts
7544flow_mods_reset_counts () {
7545 # Reset to a known state
7546 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7547
7548 send_packet
7549 warp_and_dump_OF $1 1 1 118 1 reset_counts
7550 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7551 # add-flow without flags resets duration, but not counts,
7552 # idle age is inherited from the old flow
7553 warp_and_dump_OF $1 1 1 118 2
7554
7555 send_packet
7556 warp_and_dump_OF $1 2 2 236 1
7557 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7558 # mod-flows without flags does not reset duration nor counts,
7559 # idle age is inherited from the old flow
7560 warp_and_dump_OF $1 3 2 236 2
7561
7562 send_packet
7563 warp_and_dump_OF $1 4 3 354 1
7564 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7565 # add-flow with reset_counts resets both duration and counts,
7566 # idle age is inherited from the old flow
7567 warp_and_dump_OF $1 1 0 0 2 reset_counts
7568
7569 send_packet
7570 warp_and_dump_OF $1 2 1 118 1 reset_counts
7571 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7572 # mod-flows with reset_counts resets counts, but not duration,
7573 # idle age is inherited from the old flow
7574 warp_and_dump_OF $1 3 0 0 2 reset_counts
7575
7576 # Modify flow having reset_counts flag without reset_counts
7577 send_packet
7578 warp_and_dump_OF $1 4 1 118 1 reset_counts
7579 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7580 warp_and_dump_OF $1 5 1 118 2 reset_counts
7581
7582 # Add flow having reset_counts flag without reset_counts
7583 send_packet
7584 warp_and_dump_OF $1 6 2 236 1 reset_counts
7585 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7586 warp_and_dump_OF $1 1 2 236 2
7587
7588 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7589 send_packet
7590 warp_and_dump_OF $1 2 3 354 1
7591 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7592 warp_and_dump_OF $1 3 0 0 2
7593}
7594
7595# OpenFlow versions >= 1.3 should behave the same way
8b6987d7
JR
7596flow_mods_reset_counts 15
7597
7598OVS_VSWITCHD_STOP
7599AT_CLEANUP
e96a5c24 7600
c7b02b80 7601
e96a5c24
JS
7602AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
7603OVS_VSWITCHD_START
7604AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7605AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7606
7607ovs-appctl time/stop
7608
7609for i in `seq 1 10`; do
7610 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)'
7611done
7612
7613ovs-appctl time/warp 100
7614AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
7615ovs-appctl time/warp 1000
7616
23a7d252 7617AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 7618AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
23a7d252 7619 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6f068379 7620 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
23a7d252
JS
7621])
7622OVS_VSWITCHD_STOP
7623AT_CLEANUP
7624
5f5ebd4c 7625AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
f27f2134
BP
7626OVS_VSWITCHD_START
7627
7628# get_ages DURATION HARD IDLE
7629#
7630# Fetch the flow duration, hard age, and idle age into the variables
7631# whose names are given as arguments. Rounds DURATION down to the
7632# nearest integer. If hard_age doesn't appear in the output, sets
7633# HARD to "none". If idle_age doesn't appear in the output, sets IDLE
7634# to 0.
7635get_ages () {
7636 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7637
7638 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
7639 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
7640 AS_VAR_COPY([$1], [duration])
7641
7642 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
7643 if test X"$hard" = X; then
7644 hard=none
7645 else
7646 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
7647 fi
7648 AS_VAR_COPY([$2], [hard])
7649
7650 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
7651 if test X"$idle" = X; then
7652 idle=0
7653 else
7654 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
7655 fi
7656 AS_VAR_COPY([$3], [idle])
7657}
7658
7659# Add a flow and get its initial hard and idle age.
7660AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
7661get_ages duration1 hard1 idle1
7662
31ef9f51 7663ovs-appctl time/stop
f27f2134
BP
7664# Warp time forward by 10 seconds, then modify the flow's actions.
7665ovs-appctl time/warp 10000
7666get_ages duration2 hard2 idle2
7667AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
7668
7669# Warp time forward by 10 seconds.
7670ovs-appctl time/warp 10000
7671get_ages duration3 hard3 idle3
7672
7673# Warp time forward 10 more seconds, then pass some packets through the flow,
7674# then warp forward a few more times because idle times are only updated
7675# occasionally.
7676ovs-appctl time/warp 10000
7677ovs-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 7678ovs-appctl time/warp 3000 1000
c0526804 7679sleep 1
f27f2134
BP
7680get_ages duration4 hard4 idle4
7681
7682printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
7683printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
7684printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
7685
7686# Duration should increase steadily over time.
7687AT_CHECK([test $duration1 -lt $duration2])
7688AT_CHECK([test $duration2 -lt $duration3])
7689AT_CHECK([test $duration3 -lt $duration4])
7690
7691# Hard age should be "none" initially because it's the same as flow_duration,
7692# then it should increase.
7693AT_CHECK([test $hard1 = none])
7694AT_CHECK([test $hard2 = none])
7695AT_CHECK([test $hard3 != none])
7696AT_CHECK([test $hard4 != none])
7697AT_CHECK([test $hard3 -lt $hard4])
7698
7699# Idle age should increase from 1 to 2 to 3, then decrease.
7700AT_CHECK([test $idle1 -lt $idle2])
7701AT_CHECK([test $idle2 -lt $idle3])
7702AT_CHECK([test $idle3 -gt $idle4])
7703
7704# Check some invariant relationships.
7705AT_CHECK([test $duration1 = $idle1])
7706AT_CHECK([test $duration2 = $idle2])
7707AT_CHECK([test $duration3 = $idle3])
7708AT_CHECK([test $idle3 -gt $hard3])
7709AT_CHECK([test $idle4 -lt $hard4])
7710AT_CHECK([test $hard4 -lt $duration4])
7711
7712OVS_VSWITCHD_STOP
7713AT_CLEANUP
0e553d9c
BP
7714
7715AT_SETUP([ofproto-dpif - fin_timeout])
7716OVS_VSWITCHD_START
b5c1a5df 7717ovs-appctl time/stop
0e553d9c
BP
7718AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
7719AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7720[NXST_FLOW reply:
7721 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7722])
31ef9f51 7723
0e553d9c
BP
7724# Check that a TCP SYN packet does not change the timeout. (Because
7725# flow stats updates are mainly what implements the fin_timeout
7726# feature, we warp forward a couple of times to ensure that flow stats
7727# run before re-checking the flow table.)
323cc924 7728AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
0e553d9c
BP
7729AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7730warped
7731])
cea4a6d7 7732AT_CHECK([ovs-appctl revalidator/purge], [0])
0e553d9c
BP
7733AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7734[NXST_FLOW reply:
7735 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7736])
7737# Check that a TCP FIN packet does change the timeout.
323cc924 7738AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
0e553d9c
BP
7739AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7740warped
7741])
7742AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7743[NXST_FLOW reply:
7744 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
7745])
7746OVS_VSWITCHD_STOP
7747AT_CLEANUP
27022416
JP
7748
7749AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
7750OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
ca5792f0
BP
7751add_of_ports br0 1 2
7752add_of_ports br1 3
27022416
JP
7753
7754AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
7755dummy@br0
7756dummy@br1
7757])
7758OVS_VSWITCHD_STOP
7759AT_CLEANUP
7760
7761AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
e539ba87
IM
7762OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
7763 [--dummy-numa="0,0,0,0,1,1,1,1"])
7764add_pmd_of_ports br0 1 2
ca5792f0 7765add_of_ports br1 3
27022416 7766
e539ba87 7767AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
dc54ef36 7768dummy@ovs-dummy: hit:0 missed:0
7be29a47
BP
7769 br0:
7770 br0 65534/100: (dummy-internal)
7771 p1 1/1: (dummy-pmd: <cleared>)
7772 p2 2/2: (dummy-pmd: <cleared>)
7773 br1:
7774 br1 65534/101: (dummy-internal)
7775 p3 3/3: (dummy)
27022416
JP
7776])
7777OVS_VSWITCHD_STOP
7778AT_CLEANUP
7779
7780AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
054e5aa6 7781# bump max-idle to avoid the flows being reclaimed behind us
27022416 7782OVS_VSWITCHD_START([add-br br1 -- \
054e5aa6 7783 set bridge br1 datapath-type=dummy fail-mode=secure -- \
e539ba87
IM
7784 set Open_vSwitch . other_config:max-idle=10000], [], [],
7785 [--dummy-numa="0,0,0,0,1,1,1,1"])
7786add_of_ports br0 1
7787add_pmd_of_ports br0 2
ca5792f0 7788add_of_ports br1 3
27022416 7789
323cc924
BP
7790AT_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)'])
7791AT_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)'])
7792AT_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 7793ovs-appctl revalidator/wait
3a18d0c2 7794AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e
JS
7795recirc_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
7796recirc_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
7797])
7798
3a18d0c2 7799AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 7800recirc_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
7801])
7802
3a18d0c2 7803AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e
JS
7804skb_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
7805skb_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
7806])
7807
3a18d0c2 7808AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 7809skb_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
7810])
7811
7812OVS_VSWITCHD_STOP
7813AT_CLEANUP
7814
e539ba87
IM
7815m4_define([OFPROTO_DPIF_GET_FLOW],
7816 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
818650e6 7817
e539ba87
IM
7818 OVS_VSWITCHD_START([add-br br1 -- \
7819 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7820 set Open_vSwitch . other_config:max-idle=10000], [], [],
7821 [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
818650e6 7822
45a9c31d 7823 func=`printf '%s_' "$1" | cut -c 4-`
e539ba87
IM
7824 add_${func}of_ports br0 1 2
7825
7826 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)'])
7827 ovs-appctl revalidator/wait
7828 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
818650e6 7829
e539ba87
IM
7830 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
7831 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
3d4b2e6e 7832recirc_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
7833])
7834
e539ba87
IM
7835 OVS_VSWITCHD_STOP
7836 AT_CLEANUP])
7837
7838OFPROTO_DPIF_GET_FLOW([])
7839OFPROTO_DPIF_GET_FLOW([ - pmd])
27022416 7840
50c1efc9 7841AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
8bfd0fda
BP
7842OVS_VSWITCHD_START([dnl
7843 add-port br0 p1 -- set Interface p1 type=dummy
7844])
623540e4 7845AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 7846on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
7847
7848AT_CAPTURE_FILE([ofctl_monitor.log])
7849AT_DATA([flows.txt], [dnl
7850dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 7851dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
7852])
7853AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7854
7855dnl Packet is sent to userspace because a MPLS push or pop action is applied to
47fb7f71 7856dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
8bfd0fda 7857dnl
47fb7f71 7858dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
8bfd0fda 7859dnl 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
7860dnl (label 20, exp 0, [S], ttl 32)
7861dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7862dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7863
7864for dl_src in 00 01; do
47fb7f71 7865 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
7866done
7867sleep 1 # wait for the datapath flow installed
2be3fe44 7868AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
74c4530d
JP
7869recirc_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))
7870recirc_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 7871])
8bfd0fda
BP
7872
7873OVS_VSWITCHD_STOP
7874AT_CLEANUP
7875
7876
50c1efc9 7877AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
8bfd0fda
BP
7878OVS_VSWITCHD_START([dnl
7879 add-port br0 p1 -- set Interface p1 type=dummy
7880])
623540e4 7881AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 7882on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
7883
7884AT_CAPTURE_FILE([ofctl_monitor.log])
7885AT_DATA([flows.txt], [dnl
7886dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 7887dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
7888])
7889AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7890
7891dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
7892dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
47fb7f71 7893dnl can't determine the resulting MPLS label after MPLS push/pop actions.
8bfd0fda
BP
7894dnl
7895dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
7896dnl 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)
7897dnl (label 20, exp 0, ttl 32)
7898dnl (label 20, exp 0, ttl 32)
7899dnl (label 20, exp 0, [S], ttl 32)
7900dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7901dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
8bfd0fda 7902
47fb7f71
JS
7903for dl_src in 00 01; do
7904 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
7905done
7906sleep 1 # wait for the datapath flow installed
2be3fe44 7907AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
74c4530d
JP
7908recirc_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))
7909recirc_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
7910])
7911
7912OVS_VSWITCHD_STOP
7913AT_CLEANUP
7914
0a740f48
EJ
7915AT_SETUP([ofproto-dpif - patch ports])
7916OVS_VSWITCHD_START([add-br br1 \
7917-- set bridge br1 datapath-type=dummy fail-mode=secure \
7918-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
7919-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
7920
ca5792f0
BP
7921add_of_ports br0 2
7922add_of_ports br1 3
0a740f48 7923
64bb477f
JS
7924AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7925], [])
aef0491b 7926AT_CHECK([ovs-appctl time/stop])
623540e4 7927AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9fc0165a 7928
0a740f48
EJ
7929AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
7930AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
7931
7932for i in $(seq 1 10); do
7933 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
7934 if [[ $i -eq 1 ]]; then
7935 sleep 1
7936 fi
0a740f48
EJ
7937done
7938
7939for i in $(seq 1 5); do
7940 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
7941 if [[ $i -eq 1 ]]; then
7942 sleep 1
7943 fi
0a740f48
EJ
7944done
7945
0a8763fc
EJ
7946AT_CHECK([ovs-appctl time/warp 500], [0],
7947[warped
735d7efb 7948])
732207ad 7949sleep 1 # wait for log writer
735d7efb 7950
0a740f48 7951AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dc54ef36 7952dummy@ovs-dummy: hit:13 missed:2
7be29a47
BP
7953 br0:
7954 br0 65534/100: (dummy-internal)
7955 p2 2/2: (dummy)
7956 pbr0 1/none: (patch: peer=pbr1)
7957 br1:
7958 br1 65534/101: (dummy-internal)
7959 p3 3/3: (dummy)
7960 pbr1 1/none: (patch: peer=pbr0)
0a740f48
EJ
7961])
7962
2be3fe44 7963AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
7964recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
7965recirc_id(0),in_port(101),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
c2a77f33
JS
7966])
7967
2be3fe44 7968AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
6f068379 7969skb_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 7970])
2be3fe44 7971AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
6f068379 7972skb_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
7973])
7974
7975AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
7976OFPST_PORT reply (xid=0x4): 1 ports
6f068379
BP
7977 port 1: rx pkts=5, bytes=530, drop=?, errs=?, frame=?, over=?, crc=?
7978 tx pkts=10, bytes=1060, drop=?, errs=?, coll=?
0a740f48
EJ
7979])
7980
7981AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
7982OFPST_PORT reply (xid=0x4): 1 ports
6f068379
BP
7983 port 1: rx pkts=10, bytes=1060, drop=?, errs=?, frame=?, over=?, crc=?
7984 tx pkts=5, bytes=530, drop=?, errs=?, coll=?
0a740f48
EJ
7985])
7986
7987OVS_VSWITCHD_STOP
7988AT_CLEANUP
655ab909 7989
1774d762
JR
7990AT_SETUP([ofproto-dpif - patch ports - stack])
7991OVS_VSWITCHD_START([add-br br1 \
7992-- set bridge br1 datapath-type=dummy fail-mode=secure \
7993-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
7994-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
7995
ca5792f0
BP
7996add_of_ports br0 2
7997add_of_ports br1 3
1774d762
JR
7998
7999AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8000], [])
8001AT_CHECK([ovs-appctl time/stop])
8002AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8003
8004AT_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"])
8005# Try to pop from empty stack, and push and leave data to stack.
8006AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
8007
8008ovs-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)'
8009
8010AT_CHECK([ovs-appctl time/warp 500], [0],
8011[warped
8012])
8013
8014OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
8015
8016AT_CHECK([ovs-appctl dpif/show], [0], [dnl
8017dummy@ovs-dummy: hit:0 missed:1
7be29a47
BP
8018 br0:
8019 br0 65534/100: (dummy-internal)
8020 p2 2/2: (dummy)
8021 pbr0 1/none: (patch: peer=pbr1)
8022 br1:
8023 br1 65534/101: (dummy-internal)
8024 p3 3/3: (dummy)
8025 pbr1 1/none: (patch: peer=pbr0)
1774d762
JR
8026])
8027
2be3fe44 8028AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e 8029recirc_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
8030])
8031
2d9b49dd 8032AT_CHECK([grep -e '|ofproto_dpif_xlate|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
a4c3463d 8033stack 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
8034])
8035
2d9b49dd 8036OVS_VSWITCHD_STOP(["/stack underflow/d"])
1774d762
JR
8037AT_CLEANUP
8038
65e0be10
BP
8039AT_SETUP([ofproto-dpif - port duration])
8040OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
ca5792f0 8041add_of_ports br0 1 2
65e0be10 8042
31ef9f51 8043ovs-appctl time/stop
65e0be10
BP
8044ovs-appctl time/warp 10000
8045
8046AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
125bf01d 8047AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
65e0be10 8048[dnl
65e0be10 8049 duration=?s
65e0be10 8050 duration=?s
65e0be10
BP
8051 duration=?s
8052])
8053OVS_VSWITCHD_STOP
8054AT_CLEANUP
bcd2633a
JP
8055
8056dnl ----------------------------------------------------------------------
8057AT_BANNER([ofproto-dpif -- megaflows])
8058
bcd2633a
JP
8059AT_SETUP([ofproto-dpif megaflow - port classification])
8060OVS_VSWITCHD_START
623540e4 8061AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8062add_of_ports br0 1 2
bcd2633a
JP
8063AT_DATA([flows.txt], [dnl
8064table=0 in_port=1 actions=output(2)
8065])
8066AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8067AT_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 8068sleep 1
bcd2633a 8069AT_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 8070sleep 1
2be3fe44 8071AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e 8072recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8073])
8074OVS_VSWITCHD_STOP
8075AT_CLEANUP
8076
8077AT_SETUP([ofproto-dpif megaflow - L2 classification])
8078OVS_VSWITCHD_START
623540e4 8079AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8080add_of_ports br0 1 2
bcd2633a
JP
8081AT_DATA([flows.txt], [dnl
8082table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
8083])
8084AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8085AT_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)'])
8086AT_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 8087sleep 1
2be3fe44 8088AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8089recirc_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>
8090recirc_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
8091])
8092OVS_VSWITCHD_STOP
8093AT_CLEANUP
8094
8095AT_SETUP([ofproto-dpif megaflow - L3 classification])
8096OVS_VSWITCHD_START
623540e4 8097AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8098add_of_ports br0 1 2
13751fd8 8099AT_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
8100AT_DATA([flows.txt], [dnl
8101table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
8102])
8103AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8104AT_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)'])
8105AT_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 8106sleep 1
2be3fe44 8107AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8108recirc_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>
8109recirc_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
8110])
8111OVS_VSWITCHD_STOP
8112AT_CLEANUP
8113
13751fd8
JR
8114AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
8115OVS_VSWITCHD_START
623540e4 8116AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8117add_of_ports br0 1 2
13751fd8
JR
8118AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=ipv6_dst,ipv6_src], [0], [ignore], [])
8119AT_DATA([flows.txt], [dnl
8120table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
8121])
8122AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8123AT_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)'])
8124AT_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 8125sleep 1
2be3fe44 8126AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8127recirc_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>
8128recirc_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
8129])
8130OVS_VSWITCHD_STOP
8131AT_CLEANUP
8132
bcd2633a
JP
8133AT_SETUP([ofproto-dpif megaflow - L4 classification])
8134OVS_VSWITCHD_START
623540e4 8135AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8136add_of_ports br0 1 2
bcd2633a
JP
8137AT_DATA([flows.txt], [dnl
8138table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
8139])
8140AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8141AT_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 8142sleep 1
bcd2633a 8143AT_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 8144sleep 1
2be3fe44 8145AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e 8146recirc_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
8147])
8148OVS_VSWITCHD_STOP
8149AT_CLEANUP
8150
e539ba87
IM
8151m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
8152 [AT_SETUP([ofproto-dpif megaflow - normal$1])
8153 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8154 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
45a9c31d 8155 func=`printf '%s_' "$1" | cut -c 4-`
e539ba87
IM
8156 add_${func}of_ports br0 1 2
8157 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8158 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)'])
8159 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)'])
8160 sleep 1
8161 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8162recirc_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>
8163recirc_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 8164])
e539ba87
IM
8165 OVS_VSWITCHD_STOP
8166 AT_CLEANUP])
8167
8168OFPROTO_DPIF_MEGAFLOW_NORMAL([])
8169OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
bcd2633a
JP
8170
8171AT_SETUP([ofproto-dpif megaflow - mpls])
8172OVS_VSWITCHD_START
623540e4 8173AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8174add_of_ports br0 1 2
bcd2633a
JP
8175AT_DATA([flows.txt], [dnl
8176table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
8177table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
8178])
8179AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8180AT_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)'])
8181AT_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 8182sleep 1
3fd12197 8183AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
3d4b2e6e
JS
8184recirc_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
8185recirc_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
8186])
8187OVS_VSWITCHD_STOP
8188AT_CLEANUP
8189
4819b3a5 8190# CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
e731d71b 8191m4_define([CHECK_MEGAFLOW_NETFLOW],
4819b3a5 8192 [OVS_VSWITCHD_START
623540e4 8193 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8194 add_of_ports br0 1 2
e731d71b
AS
8195
8196 dnl NetFlow configuration disables wildcarding relevant fields
53eb8cb8 8197 on_exit 'kill `cat test-netflow.pid`'
eadd1644 8198 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 8199 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 8200 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
8201 ovs-vsctl \
8202 set Bridge br0 netflow=@nf -- \
8203 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
8204 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
8205
8206 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8207 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)'])
8208 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)'])
8209 sleep 1
2be3fe44 8210 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8211recirc_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>
8212recirc_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 8213])
d9c8c57c 8214 OVS_APP_EXIT_AND_WAIT([test-netflow])
4819b3a5 8215 OVS_VSWITCHD_STOP])
e731d71b 8216
4819b3a5 8217AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
e731d71b 8218CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
4819b3a5
BP
8219AT_CLEANUP
8220
8221AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
8222AT_SKIP_IF([test $HAVE_IPV6 = no])
e731d71b 8223CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
4819b3a5 8224AT_CLEANUP
bcd2633a 8225
e539ba87
IM
8226m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
8227 [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
8228 OVS_VSWITCHD_START(
8229 [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
8230 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
8231 set interface p2 type=$1 ofport_request=2 -- \
8232 set interface p3 type=$1 ofport_request=3], [], [],
8233 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
8234 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
bcd2633a 8235])
e539ba87 8236 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a 8237
e539ba87
IM
8238 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8239 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)'])
8240 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)'])
8241 sleep 1
8242 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8243recirc_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>
8244recirc_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 8245])
e539ba87
IM
8246 OVS_VSWITCHD_STOP
8247 AT_CLEANUP])
8248
8249OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
8250OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
bcd2633a
JP
8251
8252AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
8253OVS_VSWITCHD_START(
8254 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
8255 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
8256 set interface p2 type=dummy ofport_request=2 -- \
8257 set interface p3 type=dummy ofport_request=3])
8258AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8259])
623540e4 8260AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a
JP
8261
8262AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8263AT_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)'])
8264AT_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 8265sleep 1
2be3fe44 8266AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8267recirc_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>
8268recirc_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
8269])
8270OVS_VSWITCHD_STOP
8271AT_CLEANUP
8272
8273AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
8274# Create bond0 on br0 with interfaces p0 and p1
8275# and bond1 on br1 with interfaces p2 and p3
8276# with p0 patched to p2 and p1 patched to p3.
8277OVS_VSWITCHD_START(
8278 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
8279 other-config:lacp-time=fast \
8280 other-config:bond-rebalance-interval=0 -- \
8281 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
8282 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
8283 add-br br1 -- \
8284 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
8285 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
8286 fail-mode=secure -- \
8287 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
8288 other-config:lacp-time=fast \
8289 other-config:bond-rebalance-interval=0 -- \
8290 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
8291 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
8292
8293AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8294])
623540e4 8295AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8296add_of_ports br0 7
bcd2633a
JP
8297AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8298AT_CHECK([ovs-ofctl add-flow br1 action=normal])
31ef9f51 8299ovs-appctl time/stop
bcd2633a
JP
8300ovs-appctl time/warp 5000
8301AT_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)'])
8302AT_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 8303sleep 1
2be3fe44 8304AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8305recirc_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>
8306recirc_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
8307])
8308OVS_VSWITCHD_STOP
8309AT_CLEANUP
8310
8311AT_SETUP([ofproto-dpif megaflow - resubmit port action])
8312OVS_VSWITCHD_START
623540e4 8313AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8314add_of_ports br0 1 2
bcd2633a
JP
8315AT_DATA([flows.txt], [dnl
8316table=0 in_port=1,ip actions=resubmit(90)
8317table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
8318])
8319AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8320AT_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)'])
8321AT_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 8322sleep 1
2be3fe44 8323AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8324recirc_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>
8325recirc_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
8326])
8327OVS_VSWITCHD_STOP
8328AT_CLEANUP
8329
8330AT_SETUP([ofproto-dpif megaflow - resubmit table action])
8331OVS_VSWITCHD_START
623540e4 8332AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8333add_of_ports br0 1 2
bcd2633a
JP
8334AT_DATA([flows.txt], [dnl
8335table=0 in_port=1,ip actions=resubmit(,1)
8336table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8337])
8338AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8339AT_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)'])
8340AT_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=
83411,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
ae692725 8342sleep 1
2be3fe44 8343AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8344recirc_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>
8345recirc_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
8346])
8347OVS_VSWITCHD_STOP
8348AT_CLEANUP
8349
8350AT_SETUP([ofproto-dpif megaflow - goto_table action])
8351OVS_VSWITCHD_START
623540e4 8352AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8353add_of_ports br0 1 2
bcd2633a
JP
8354AT_DATA([flows.txt], [dnl
8355table=0 in_port=1,ip actions=goto_table(1)
8356table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8357])
8358AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
8359AT_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)'])
8360AT_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 8361sleep 1
2be3fe44 8362AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8363recirc_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>
8364recirc_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
8365])
8366OVS_VSWITCHD_STOP
8367AT_CLEANUP
8368
8369AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
2d5c1a20 8370AT_KEYWORDS([mirror mirrors mirroring])
bcd2633a 8371OVS_VSWITCHD_START
623540e4 8372AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8373add_of_ports br0 1 2 3
bcd2633a
JP
8374ovs-vsctl \
8375 set Bridge br0 mirrors=@m --\
8376 --id=@p3 get Port p3 --\
8377 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
8378
8379AT_DATA([flows.txt], [dnl
8380in_port=1 actions=output:2
8381])
8382AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8383AT_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 8384sleep 1
bcd2633a 8385AT_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 8386sleep 1
2be3fe44 8387AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e 8388recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8389])
8390OVS_VSWITCHD_STOP
8391AT_CLEANUP
8392
8393AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
8394OVS_VSWITCHD_START
623540e4 8395AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8396add_of_ports br0 1 2 3
bcd2633a
JP
8397ovs-vsctl \
8398 set Bridge br0 mirrors=@m --\
8399 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
8400 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
8401
8402AT_DATA([flows.txt], [dnl
8403in_port=1 actions=output:2
8404])
8405AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8406AT_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))'])
8407AT_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 8408sleep 1
2be3fe44 8409AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8410recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8411recirc_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
8412])
8413OVS_VSWITCHD_STOP
8414AT_CLEANUP
8415
8416AT_SETUP([ofproto-dpif megaflow - move action])
8417OVS_VSWITCHD_START
623540e4 8418AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8419add_of_ports br0 1 2
bcd2633a
JP
8420AT_DATA([flows.txt], [dnl
8421table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
8422table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
8423table=0 in_port=91 reg0=0x0a000002,actions=output(2)
8424])
8425AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8426AT_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)'])
8427AT_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 8428sleep 1
2be3fe44 8429AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8430recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
8431recirc_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
8432])
8433OVS_VSWITCHD_STOP
8434AT_CLEANUP
8435
8436AT_SETUP([ofproto-dpif megaflow - push action])
8437OVS_VSWITCHD_START
623540e4 8438AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8439add_of_ports br0 1 2
bcd2633a
JP
8440AT_DATA([flows.txt], [dnl
8441table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
8442])
8443AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8444AT_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)'])
8445AT_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 8446sleep 1
2be3fe44 8447AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8448recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
8449recirc_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
8450])
8451OVS_VSWITCHD_STOP
8452AT_CLEANUP
8453
8454AT_SETUP([ofproto-dpif megaflow - learning])
8455OVS_VSWITCHD_START
623540e4 8456AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8457add_of_ports br0 1 2
bcd2633a
JP
8458AT_DATA([flows.txt], [dnl
8459table=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
8460])
8461AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
31ef9f51 8462ovs-appctl time/stop
956f2bf0
BP
8463# We send each packet twice because the first packet in each flow causes the
8464# flow table to change and thus revalidations, which (depending on timing)
8465# can keep a megaflow from being installed. The revalidations are done by
8466# the second iteration, allowing the flows to be installed.
8467for i in 1 2; do
8468 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)'])
8469 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)'])
8470 ovs-appctl time/warp 100
8471done
ae692725 8472sleep 1
bcd2633a 8473dnl The original flow is missing due to a revalidation.
2be3fe44 8474AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8475recirc_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>
8476recirc_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
8477])
8478OVS_VSWITCHD_STOP
8479AT_CLEANUP
d4f4a9b2
JP
8480
8481AT_SETUP([ofproto-dpif megaflow - tunnels])
8482OVS_VSWITCHD_START(
2c0ea78f 8483 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
623540e4 8484AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
2c0ea78f
GS
8485AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
8486 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
8487AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
8488 ofport_request=3])
8489AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
8490 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
8491 ofport_request=4 options:key=flow])
d4f4a9b2
JP
8492AT_DATA([flows.txt], [dnl
8493in_port=1,actions=output(2)
8494in_port=3,actions=output(4)
8495])
8496AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8497dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
8498dnl will cause the packet to be dropped.
8499AT_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 8500sleep 1
d4f4a9b2
JP
8501AT_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)'])
8502AT_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 8503sleep 1
d4f4a9b2 8504AT_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 8505sleep 1
2be3fe44 8506AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8507recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
8508recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
8509recirc_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
8510])
8511OVS_VSWITCHD_STOP
8512AT_CLEANUP
8513
8514AT_SETUP([ofproto-dpif megaflow - dec_ttl])
8515OVS_VSWITCHD_START
623540e4 8516AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8517add_of_ports br0 1 2
13751fd8 8518AT_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
8519AT_DATA([flows.txt], [dnl
8520table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
8521])
8522AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8523AT_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)'])
8524AT_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 8525sleep 1
2be3fe44 8526AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8527recirc_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>
8528recirc_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
8529])
8530OVS_VSWITCHD_STOP
8531AT_CLEANUP
74cc3969 8532
f74e7df7
JP
8533AT_SETUP([ofproto-dpif megaflow - set dl_dst])
8534OVS_VSWITCHD_START
623540e4 8535AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8536add_of_ports br0 1 2
f74e7df7
JP
8537AT_DATA([flows.txt], [dnl
8538table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
8539])
8540AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8541AT_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)'])
8542AT_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 8543sleep 1
d23df9a8
JR
8544dnl The first packet is essentially a no-op, as the new destination MAC is the
8545dnl same as the original. The second entry actually updates the destination
8546dnl MAC.
2be3fe44 8547AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
8548recirc_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
8549recirc_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
8550])
8551OVS_VSWITCHD_STOP
8552AT_CLEANUP
8553
e539ba87
IM
8554m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
8555 [AT_SETUP([ofproto-dpif megaflow - disabled$1])
8556 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8557 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
45a9c31d 8558 func=`printf '%s_' "$1" | cut -c 4-`
e539ba87
IM
8559 add_${func}of_ports br0 1 2
8560 AT_DATA([flows.txt], [dnl
8c301900
JR
8561table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
8562table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
8563])
e539ba87 8564 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8c301900 8565], [])
e539ba87 8566 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
64bb477f 8567], [])
e539ba87
IM
8568 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
8569 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8570 for i in 1 2 3 4; do
8571 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)'])
8572 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)'])
8573 if [[ $i -eq 1 ]]; then
8574 sleep 1
8575 fi
8576 done
8577 sleep 1
8578 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
8579skb_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
8580skb_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 8581])
e539ba87 8582 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
6f068379
BP
8583skb_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
8584skb_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 8585])
e539ba87
IM
8586 OVS_VSWITCHD_STOP
8587 AT_CLEANUP])
8588
8589OFPROTO_DPIF_MEGAFLOW_DISABLED([])
8590OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
8c301900 8591
74cc3969
BP
8592AT_SETUP([ofproto-dpif - datapath port number change])
8593OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 8594add_of_ports br0 1
74cc3969
BP
8595
8596# Trace a flow that should output to p1.
8597AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8598 [0], [stdout])
8599AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
8600])
8601
8602# Change p1's port number to 5.
8603AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
8604
8605# Trace a flow that should output to p1 in its new location.
8606AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8607 [0], [stdout])
8608AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
8609])
8610OVS_VSWITCHD_STOP
8611AT_CLEANUP
2d344ba5
AW
8612
8613# Tests the bundling with various bfd and cfm configurations.
8614AT_SETUP([ofproto - bundle with variable bfd/cfm config])
8615OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
8616 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
8617 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
8618 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
8619 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
8620 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
8621 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
8622 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
8623 set Interface p0 cfm_mpid=1 -- \
8624 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
8625
8626ovs-appctl time/stop
8627# advance the clock to stablize everything.
bdba1947 8628ovs-appctl time/warp 5000 100
2d344ba5
AW
8629# cfm/show should show 'recv' fault.
8630AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
f6d6edc0 8631 fault: recv
2d344ba5
AW
8632])
8633# bfd/show should show 'up'.
8634AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
fc002ed3
BP
8635 Local Session State: up
8636 Remote Session State: up
8637 Local Session State: up
8638 Remote Session State: up
2d344ba5
AW
8639])
8640# bond/show should show 'may-enable: true' for all slaves.
8641AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
828519ca
BP
8642 may_enable: true
8643 may_enable: true
8644 may_enable: true
8645 may_enable: true
2d344ba5
AW
8646])
8647
8648# now disable the bfd on p1.
8649AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
8650# advance the clock to stablize everything.
bdba1947 8651ovs-appctl time/warp 5000 100
2d344ba5
AW
8652# cfm/show should show 'recv' fault.
8653AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
f6d6edc0 8654 fault: recv
2d344ba5
AW
8655])
8656# bfd/show should show 'down'.
8657AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
fc002ed3
BP
8658 Local Session State: down
8659 Remote Session State: down
2d344ba5
AW
8660])
8661# bond/show should show 'may-enable: false' for p0.
125bf01d 8662AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
828519ca
BP
8663 may_enable: false
8664 may_enable: true
2d344ba5
AW
8665])
8666
8667# now enable the bfd on p1 and disable bfd on p0.
8668AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
8669AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
8670# advance the clock to stablize everything.
bdba1947 8671ovs-appctl time/warp 5000 100
2d344ba5
AW
8672# cfm/show should show 'recv' fault.
8673AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
f6d6edc0 8674 fault: recv
2d344ba5
AW
8675])
8676# bfd/show should show 'down'.
8677AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
fc002ed3
BP
8678 Local Session State: down
8679 Remote Session State: down
2d344ba5
AW
8680])
8681# bond/show should show 'may-enable: false' for p0 and p1.
8682AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
828519ca
BP
8683 may_enable: false
8684 may_enable: true
8685 may_enable: false
8686 may_enable: true
2d344ba5
AW
8687])
8688
e441a806
AW
8689OVS_VSWITCHD_STOP
8690AT_CLEANUP
8691
8692AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
8693OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
8694
8695# enable bfd on p0.
8696AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8697# check log.
1335a8d5 8698OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
8699# disable bfd on p0.
8700AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8701# check log.
1335a8d5 8702OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
454ff761 8703AT_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
8704
8705# enable cfm on p0.
8706AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
8707# check log.
1335a8d5 8708OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
8709# disable cfm on p0.
8710AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
8711# check log.
1335a8d5 8712OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
454ff761 8713AT_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
8714
8715# enable both bfd and cfm on p0.
8716AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
8717# check log.
1335a8d5 8718OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
8719# disable bfd on p0.
8720AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8721# check log, there should not be the log of thread terminated.
738cd849 8722AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
8723])
8724# reenable bfd on p0.
8725AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8726# check log, should still be on log of thread created.
738cd849 8727AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
8728monitor thread created
8729])
8730# disable bfd and cfm together.
8731AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
8732# check log.
1335a8d5 8733OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
e441a806
AW
8734
8735OVS_VSWITCHD_STOP
8736AT_CLEANUP
8737
8738# this test helps avoid the deadlock between the main thread and monitor thread.
8739AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
8740OVS_VSWITCHD_START
8741
8742for i in `seq 1 199`
8743do
8744 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])
8745done
8746
98cf638b
AW
8747OVS_VSWITCHD_STOP
8748AT_CLEANUP
98b07853
BP
8749\f
8750AT_BANNER([ofproto-dpif - flow translation resource limits])
8751
790c5d26
BP
8752dnl Resubmits to later tables do not count against the depth limit, so we
8753dnl can do 99 of them even though the maximum depth is 64.
8754AT_SETUP([ofproto-dpif - forward resubmit])
8755OVS_VSWITCHD_START
8756(for i in `seq 0 99`; do
8757 j=`expr $i + 1`
8758 echo "table=$i, actions=resubmit(,$j)"
8759 done
8760 echo "table=100, actions=local") > flows
8761AT_CHECK([ovs-ofctl add-flows br0 flows])
8762AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8763 [0], [stdout])
8764AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
8765])
8766OVS_VSWITCHD_STOP
8767AT_CLEANUP
8768
8769dnl Resubmits to the same or an earlier table count against the depth limit,
8770dnl so only 64 of them are allowed.
8771AT_SETUP([ofproto-dpif - backward resubmit])
8772OVS_VSWITCHD_START
8773(echo "table=0, actions=resubmit(,66)"
8774 for i in `seq 2 66`; do
8775 j=`expr $i - 1`
8776 echo "table=$i, actions=resubmit(,$j)"
8777 done
8778 echo "table=1, actions=local") > flows
8779AT_CHECK([ovs-ofctl add-flows br0 flows])
8780AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8781 [0], [stdout])
8782AT_CHECK([tail -1 stdout], [0],
8783 [Translation failed (Recursion too deep), packet is dropped.
8784])
8785AT_CHECK([grep -c 'over max translation depth 64' stdout],
8786 [0], [1
8787])
8788OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8789AT_CLEANUP
8790
98b07853
BP
8791AT_SETUP([ofproto-dpif - infinite resubmit])
8792OVS_VSWITCHD_START
8793AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
222820c6 8794AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
98b07853 8795 [0], [stdout])
fff1b9c0
JR
8796AT_CHECK([tail -1 stdout], [0],
8797 [Translation failed (Recursion too deep), packet is dropped.
98b07853 8798])
790c5d26 8799AT_CHECK([grep -c 'over max translation depth 64' stdout],
98b07853
BP
8800 [0], [1
8801])
8802OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8803AT_CLEANUP
8804
d1ea2cc3
WT
8805dnl Without using ofproto/trace, make sure the
8806dnl ofproto trace is still logged
8807AT_SETUP([ofproto-dpif - backward resubmit without trace])
8808OVS_VSWITCHD_START
8809(echo "table=0, actions=resubmit(,66)"
8810 for i in `seq 2 66`; do
8811 j=`expr $i - 1`
8812 echo "table=$i, actions=resubmit(,$j)"
8813 done
8814 echo "table=1, actions=local") > flows
8815AT_CHECK([ovs-ofctl add-flows br0 flows])
8816
8817AT_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])
8818
29c536f5 8819OVS_WAIT_UNTIL([grep 'packet is dropped' ovs-vswitchd.log])
d1ea2cc3
WT
8820
8821dnl make sure the full ofproto trace dump is present
8822AT_CHECK([grep -c "^ *resubmit" ovs-vswitchd.log],
8823 [0], [66
8824])
8825
8826OVS_VSWITCHD_STOP(["/over max translation depth/d
8827/ofproto_dpif_upcall/d"])
8828AT_CLEANUP
8829
98b07853
BP
8830AT_SETUP([ofproto-dpif - exponential resubmit chain])
8831OVS_VSWITCHD_START
ca5792f0 8832add_of_ports br0 1
98b07853
BP
8833(for i in `seq 1 64`; do
8834 j=`expr $i + 1`
8835 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8836 done
8837 echo "in_port=65, actions=local") > flows
8838 AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 8839AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
8840AT_CHECK([tail -1 stdout], [0],
8841 [Translation failed (Too many resubmits), packet is dropped.
8842])
8843AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
98b07853
BP
8844])
8845OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
8846AT_CLEANUP
8847
8848AT_SETUP([ofproto-dpif - too many output actions])
8849OVS_VSWITCHD_START
ca5792f0 8850add_of_ports br0 1
98b07853
BP
8851(for i in `seq 1 12`; do
8852 j=`expr $i + 1`
8853 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8854 done
8855 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
542024c4 8856AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 8857AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
0f032e95
BP
8858AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
8859 [0], [1
98b07853 8860])
fff1b9c0 8861AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
542024c4 8862])
0f032e95 8863OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
98b07853
BP
8864AT_CLEANUP
8865
8866AT_SETUP([ofproto-dpif - stack too deep])
8867OVS_VSWITCHD_START
ca5792f0 8868add_of_ports br0 1
98b07853
BP
8869(for i in `seq 1 12`; do
8870 j=`expr $i + 1`
8871 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8872 done
8873 push="push:NXM_NX_REG0[[]]"
8874 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
8875 AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 8876AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
8877AT_CHECK([tail -1 stdout], [0],
8878 [Translation failed (Stack too deep), packet is dropped.
8879])
8880AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
98b07853
BP
8881])
8882OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
8883AT_CLEANUP
d611866c
SH
8884
8885
2608616d 8886AT_SETUP([ofproto-dpif packet-out controller])
d611866c 8887OVS_VSWITCHD_START
ca5792f0 8888add_of_ports br0 1 2
d611866c
SH
8889
8890AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
8891
8892AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 8893AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
8894
8895for i in 1 2 3; do
5a0e4aec 8896 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
d611866c
SH
8897done
8898
d9c8c57c 8899OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
8900AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8901NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 8902vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8903dnl
8904NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 8905vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8906dnl
8907NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 8908vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8909])
8910
8911AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
8912 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8913NXST_FLOW reply:
8914])
8915
3c1bb396
BP
8916(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8917 table 0:
8811fc0a
BP
8918 active=1, lookup=0, matched=0
8919
8920 table 1:
8921 active=0, lookup=0, matched=0
8922"
8923 for i in `seq 2 253`; do
8924 printf ' table %d: ditto\n' $i
d611866c
SH
8925 done) > expout
8926AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8927
8928OVS_VSWITCHD_STOP
8929AT_CLEANUP
8930
2608616d 8931AT_SETUP([ofproto-dpif packet-out controller (patch port)])
d611866c
SH
8932OVS_VSWITCHD_START(
8933 [-- \
8934 add-port br0 p1 -- \
8935 set interface p1 type=patch options:peer=p2 -- \
8936 add-br br1 -- \
8937 set bridge br1 datapath-type=dummy -- \
8938 set bridge br1 fail-mode=secure -- \
8939 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
8940 add-port br1 p2 -- \
8941 set interface p2 type=patch options:peer=p1 --])
8942
8943AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 8944AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
8945
8946for i in 1 2 3; do
5a0e4aec 8947 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
d611866c
SH
8948done
8949
d9c8c57c 8950OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
8951AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8952NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 8953vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8954dnl
8955NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 8956vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8957dnl
8958NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 8959vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8960])
8961
8811fc0a
BP
8962(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8963 table 0:
8964 active=0, lookup=0, matched=0
8965"
8966 for i in `seq 1 253`; do
8967 printf ' table %d: ditto\n' $i
d611866c
SH
8968 done) > expout
8969AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8970
3c1bb396
BP
8971(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8972 table 0:
8811fc0a
BP
8973 active=0, lookup=3, matched=0
8974
8975 table 1:
8976 active=0, lookup=0, matched=0
8977"
8978 for i in `seq 2 253`; do
8979 printf ' table %d: ditto\n' $i
d611866c
SH
8980 done) > expout
8981AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
8982
8983OVS_VSWITCHD_STOP
8984AT_CLEANUP
8985
880b1458
YHW
8986AT_SETUP([ofproto-dpif packet-out pipeline match field (OpenFlow 1.5)])
8987OVS_VSWITCHD_START
8988
89d7927b
YHW
8989AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=8}->tun_metadata2"])
8990AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata3"])
880b1458
YHW
8991AT_DATA([flows.txt], [dnl
8992table=0,in_port=1 actions=controller
8993table=0,tun_id=3 actions=controller
8994table=0,metadata=5 actions=controller
8995table=0,reg0=1,reg4=2,reg8=3,reg12=5 actions=controller
8996table=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 actions=controller
89d7927b 8997table=0,tun_metadata3=0x11 actions=controller
880b1458
YHW
8998])
8999AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
9000
9001AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
9002ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
9003ovs-appctl -t ovs-ofctl ofctl/barrier
9004ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
9005AT_CAPTURE_FILE([monitor.log])
9006
9007AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=1 packet=0001020304050010203040501111 actions=table"])
9008AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tunnel_id=3 packet=0001020304050010203040502222 actions=table"])
9009AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,metadata=5 packet=0001020304050010203040503333 actions=table"])
9010AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,reg0=1,reg4=2,reg8=3,reg12=5 packet=0001020304050010203040503333 actions=table"])
9011AT_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 9012AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_metadata2=0x22,tun_metadata3=0x11 packet=0001020304050010203040503333 actions=table"])
880b1458
YHW
9013
9014ovs-appctl -t ovs-ofctl ofctl/barrier
9015OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9016
9017AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
9018OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 in_port=1 (via packet_out) data_len=14 (unbuffered)
9019vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1111
9020OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_id=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
9021vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x2222
9022OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 metadata=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
9023vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9024OFPT_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)
9025vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9026OFPT_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)
9027vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
89d7927b
YHW
9028OFPT_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)
9029vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
880b1458
YHW
9030OFPT_BARRIER_REPLY (OF1.5):
9031])
9032
9033OVS_VSWITCHD_STOP
9034AT_CLEANUP
d611866c 9035
2608616d 9036AT_SETUP([ofproto-dpif packet-out goto_table])
d611866c 9037OVS_VSWITCHD_START
ca5792f0 9038add_of_ports br0 1 2
d611866c
SH
9039
9040AT_DATA([flows.txt], [dnl
9041table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
9042table=1 dl_dst=50:54:00:00:00:0a actions=controller
9043])
9044AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
9045
9046AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 9047AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
9048
9049for i in 1 2 3; do
9050 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)'
9051done
9052
9053OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 9054OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c 9055AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 9056NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9057vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9058dnl
efe179e0 9059NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9060vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9061dnl
efe179e0 9062NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9063vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9064])
9065
cea4a6d7 9066AT_CHECK([ovs-appctl revalidator/purge], [0])
d611866c 9067AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
9068 n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=goto_table:1
9069 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
d611866c
SH
9070OFPST_FLOW reply (OF1.3):
9071])
9072
3c1bb396
BP
9073(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
9074 table 0:
9075 active=1, lookup=3, matched=3
9076
8811fc0a
BP
9077 table 1: ditto
9078 table 2:
9079 active=0, lookup=0, matched=0
9080"
9081 for i in `seq 3 253`; do
9082 printf ' table %d: ditto\n' $i
d611866c
SH
9083 done) > expout
9084AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
9085
9086OVS_VSWITCHD_STOP
9087AT_CLEANUP
9088
9089
2608616d 9090AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
d611866c 9091OVS_VSWITCHD_START
ca5792f0 9092add_of_ports br0 1 2
d611866c 9093
3c1bb396
BP
9094AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
9095AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
d611866c
SH
9096
9097AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 9098AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
9099
9100for i in 1 2 3; do
9101 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)'
9102done
9103
9104OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 9105OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c 9106AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 9107NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9108vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9109dnl
efe179e0 9110NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9111vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9112dnl
efe179e0 9113NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9114vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9115])
9116
cea4a6d7 9117AT_CHECK([ovs-appctl revalidator/purge], [0])
3c1bb396 9118AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 9119 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
3c1bb396 9120OFPST_FLOW reply (OF1.1):
d611866c
SH
9121])
9122
3c1bb396
BP
9123(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
9124 table 0:
9125 active=0, lookup=3, matched=0
9126
9127 table 1:
8811fc0a
BP
9128 active=1, lookup=3, matched=3
9129
9130 table 2:
9131 active=0, lookup=0, matched=0
9132"
9133 for i in `seq 3 253`; do
9134 printf ' table %d: ditto\n' $i
d611866c
SH
9135 done) > expout
9136AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
9137
9138OVS_VSWITCHD_STOP
9139AT_CLEANUP
b0e2ec32
JR
9140
9141AT_SETUP([ofproto-dpif - ICMPv6])
9142OVS_VSWITCHD_START
ca5792f0 9143add_of_ports br0 1
b0e2ec32
JR
9144
9145AT_CAPTURE_FILE([ofctl_monitor.log])
9146
6409e008 9147AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b0e2ec32
JR
9148
9149ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9150
d9c8c57c 9151OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
b0e2ec32
JR
9152
9153AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9154NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
e6d9ab56 9155icmp6,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
9156])
9157
9158OVS_VSWITCHD_STOP
9159AT_CLEANUP
e60e935b 9160
8ecb3068
DDP
9161AT_SETUP([ofproto-dpif - ICMPv6 type match])
9162OVS_VSWITCHD_START
9163add_of_ports br0 1 2 3
9164
9165AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
9166AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
9167
9168AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9169
9170AT_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)'])
9171AT_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)'])
9172AT_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)'])
9173AT_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)'])
9174
9175AT_CHECK([ovs-appctl revalidator/purge], [0])
9176
9177AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
9178recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128), actions:2
9179recirc_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
9180])
9181
9182AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379
BP
9183 n_packets=2, n_bytes=252, icmp6,icmp_type=128 actions=output:2
9184 n_packets=2, n_bytes=252, icmp6,icmp_type=129 actions=output:3
8ecb3068
DDP
9185NXST_FLOW reply:
9186])
9187
9188OVS_VSWITCHD_STOP
9189AT_CLEANUP
9190
e60e935b
SRCSA
9191AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
9192OVS_VSWITCHD_START
ca5792f0 9193add_of_ports br0 1
e60e935b
SRCSA
9194AT_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])
9195
9196AT_CAPTURE_FILE([ofctl_monitor.log])
9197
6409e008 9198AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
e60e935b
SRCSA
9199
9200ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9201
d9c8c57c 9202OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
e60e935b
SRCSA
9203
9204AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9205NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
e6d9ab56 9206icmp6,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
9207])
9208
9209OVS_VSWITCHD_STOP
9210AT_CLEANUP
9211
f171fa88
AW
9212# Tests the exact match of CFI bit in installed datapath flows matching VLAN.
9213AT_SETUP([ofproto-dpif - vlan matching])
9214OVS_VSWITCHD_START(
9215 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
9216AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9217
9218AT_CHECK([ovs-ofctl del-flows br0])
9219AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
9220
9221AT_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))'])
9222
47567945 9223OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
9044f2c1 9224AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
3d4b2e6e 9225recirc_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
9226])
9227OVS_VSWITCHD_STOP
9228AT_CLEANUP
43b2f131
EJ
9229
9230# Tests in place modification of installed datapath flows.
9231AT_SETUP([ofproto-dpif - in place modification])
9232OVS_VSWITCHD_START(
9233 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9234AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9235
9236AT_CHECK([ovs-ofctl del-flows br0])
9237AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
9238
9239ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9240
9241ovs-appctl time/stop
9242
ed8ac2a0
JR
9243AT_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)'])
9244
9245# Wait for the flow setup to be done.
9246OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9247
9248for i in 1 2; do
43b2f131
EJ
9249 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)'
9250done
9251
3a18d0c2 9252AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9253recirc_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
9254])
9255
9256AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
9257
9258ovs-appctl time/warp 500
9259ovs-appctl time/warp 500
9260
9261for i in 1 2 3; do
9262 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)'
9263done
9264
3a18d0c2 9265AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9266recirc_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
9267])
9268
38b0b29f 9269AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
3d4b2e6e 9270dpif|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
9271])
9272OVS_VSWITCHD_STOP
9273AT_CLEANUP
449b8131
JR
9274
9275# Tests in place modification of installed datapath flows with vlans.
9276AT_SETUP([ofproto-dpif - in place modification (vlan)])
9277OVS_VSWITCHD_START(
9278 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9279AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9280
49a832f7
DB
9281# Always drop misses
9282AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all drop])
449b8131
JR
9283AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
9284
9285ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9286
9287ovs-appctl time/stop
9288
ed8ac2a0
JR
9289AT_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)'])
9290
449b8131 9291# Check that a correct datapath flow is created.
ed8ac2a0
JR
9292OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9293
9294for i in 1 2; do
449b8131
JR
9295 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)'
9296done
9297
3a18d0c2 9298AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9299recirc_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
9300])
9301
9302# Delete the flow. Then check that the datapath flow is modified to
9303# drop the packets. A modified flow inherits the stats, a new
9304# datapath flow would start from sero.
9305AT_CHECK([ovs-ofctl del-flows br0])
9306
9307ovs-appctl time/warp 500
9308ovs-appctl time/warp 500
9309
9310for i in 1 2 3; do
9311 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)'
9312done
9313
3a18d0c2 9314AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9315recirc_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
9316])
9317
9318# Add a flow that matches the non-presence of a vlan tag, and check
9319# that the datapath flow is modified accordingly.
9320AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
9321
9322ovs-appctl time/warp 500
9323ovs-appctl time/warp 500
9324
9325for i in 1 2 3; do
9326 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)'
9327done
9328
3a18d0c2 9329AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9330recirc_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
9331])
9332
9333# Check that VLAN packets will not hit the same datapath megaflow.
ed8ac2a0
JR
9334
9335AT_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 9336OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
ed8ac2a0
JR
9337
9338for i in 1 2; do
449b8131
JR
9339 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))'
9340done
9341
3a18d0c2 9342AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e
JS
9343recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9344recirc_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
9345])
9346
9347# Check that the new flow matches the CFI bit, while both vid and pcp
9348# are wildcarded.
38b0b29f 9349AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
3d4b2e6e
JS
9350dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), actions:100
9351dpif|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)
9352dpif|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
9353dpif_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
9354])
9355OVS_VSWITCHD_STOP
9356AT_CLEANUP
56de2148
YT
9357
9358AT_SETUP([ofproto-dpif - trace (unchanged)])
9359OVS_VSWITCHD_START
9360AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
9361AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9362])
9363AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
9364AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9365])
ed708b5d
DDP
9366
9367OVS_VSWITCHD_STOP
9368AT_CLEANUP
9369
9370AT_SETUP([ofproto-dpif - conntrack - controller])
9371OVS_VSWITCHD_START
9372
9373add_of_ports br0 1 2
9374
9375AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9376
2cd20955 9377dnl Allow new UDP connections on p1 for dst port 2, drop everything else.
ed708b5d 9378AT_DATA([flows.txt], [dnl
a103c1f4 9379dnl Table 0
2cd20955 9380dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2).
a103c1f4
DDP
9381dnl
9382table=0,priority=100,arp,action=normal
2cd20955
JR
9383table=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)
9384table=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
9385table=0,priority=1,action=drop
9386dnl
2cd20955
JR
9387dnl Pass tracked traffic through ACL, drop everything else.
9388dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers
9389dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets
9390dnl get the ACL lookup using the conntrack tuple and the inverted direction.
9391dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
9392dnl of the master connection, as storted in ct_mark.
9393dnl
9394dnl Incoming non-related packet in the original direction (ACL IN)
9395table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5
9396dnl Incoming non-related reply packet (CT ACL OUT)
9397table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4
9398dnl Outgoing non-related packet (ACL OUT)
9399table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5
9400dnl Outgoing non-related reply packet (CT ACL IN)
9401table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
9402dnl
9403dnl Related packet (CT ACL in the direction of the master connection.)
9404table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
9405dnl Drop everything else.
9406table=1 priority=0, action=drop
9407dnl
9408dnl "ACL table"
9409dnl
9410dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with
9411dnl UDP destination port '2'. Store rule ID (1234) in reg1, verdict
9412dnl in reg2.
9413table=3 priority=10, reg0=1, udp, udp_dst=2 action=set_field:1234->reg1,set_field:1->reg2
9414dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235)
9415table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2
9416dnl
9417dnl Re-process stateful traffic that was not accepted by a stateful rule as
9418dnl normal traffic in the current direction. This should also delete the
9419dnl now stale conntrack state, so that new state can be created in it's place.
9420dnl
9421dnl Stateful accepts go to next table.
9422table=4 priority=100 reg2=1, action=goto_table:5
9423dnl Everything else is reprocessed disregarding the CT state, using the actual
9424dnl packet direction.
9425table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5
9426dnl
9427dnl "ACL verdict processing table."
9428dnl
9429dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0)
9430dnl
9431dnl Drop all non-accepted packets.
9432table=5 reg2=0 priority=1000 action=drop
9433dnl Commit new non-related IP connections.
9434table=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
9435dnl Commit new related connections in either direction, which inherit the mark
9436dnl (the direction of the original direction master tuple) from the master
9437dnl connection.
9438table=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
9439dnl Forward everything else, including stateless accepts.
9440table=5 priority=0 action=goto_table:6
9441dnl
9442dnl "Forwarding table"
9443dnl
9444table=6 action=controller
ed708b5d
DDP
9445])
9446
9447AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9448
9449AT_CAPTURE_FILE([ofctl_monitor.log])
9450AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9451
9452AT_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)'])
9453
9454dnl OK, now start a new connection from port 1.
9455AT_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)'])
9456
9457dnl Now try a reply from port 2.
9458AT_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)'])
9459
9460OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9461OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9462
9463dnl Check this output. We only see the latter two packets, not the first.
ed708b5d 9464AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9465NXT_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)
9466udp,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 9467dnl
6f068379
BP
9468NXT_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)
9469udp,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
9470])
9471
9472AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9473
9474dnl OK, now start a second connection from port 1
2cd20955 9475AT_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
9476
9477dnl Now try a reply from port 2.
2cd20955 9478AT_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
9479
9480
9481OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9482OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9483
9484dnl Check this output. We should see both packets
ed708b5d 9485AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9486NXT_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)
9487udp,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 9488dnl
6f068379
BP
9489NXT_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)
9490udp,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
9491])
9492
9493OVS_VSWITCHD_STOP
9494AT_CLEANUP
9495
a76a37ef
JR
9496AT_SETUP([ofproto-dpif - conntrack - force commit])
9497OVS_VSWITCHD_START
9498
9499add_of_ports br0 1 2
9500
9501AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9502
9503dnl Allow new connections on p1->p2, but not on p2->p1.
9504AT_DATA([flows.txt], [dnl
9505dnl Table 0
9506dnl
9507table=0,priority=100,arp,action=normal
9508table=0,priority=10,in_port=1,udp,action=ct(commit),controller
9509table=0,priority=10,in_port=2,udp,action=ct(table=1)
9510table=0,priority=1,action=drop
9511dnl
9512dnl Table 1
9513dnl
9514table=1,priority=10,in_port=2,ct_state=+est,udp,action=ct(force,commit),controller
9515table=1,priority=1,action=drop
9516])
9517
9518AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9519
9520AT_CAPTURE_FILE([ofctl_monitor.log])
9521AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9522
9523AT_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)'])
9524
9525dnl OK, now start a new connection from port 1.
9526AT_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)'])
9527
9528dnl Now try a reply from port 2.
9529AT_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)'])
9530
9531OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9532OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9533
9534dnl Check this output. We only see the latter two packets, not the first.
9535dnl Note that the first packet doesn't have the ct_state bits set. This
9536dnl happens because the ct_state field is available only after recirc.
9537AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9538NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9539udp,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 9540dnl
6f068379
BP
9541NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9542udp,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
9543])
9544
9545AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9546
9547dnl OK, now start a second connection from port 1
9548AT_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)'])
9549
9550dnl Now try a reply from port 2.
9551AT_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)'])
9552
9553OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9554OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9555
9556dnl Check this output. We should see both packets
9557dnl Note that the first packet doesn't have the ct_state bits set. This
9558dnl happens because the ct_state field is available only after recirc.
9559AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9560NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9561udp,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 9562dnl
6f068379
BP
9563NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9564udp,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
9565])
9566
9567dnl
9568dnl Check that the directionality has been changed by force commit.
9569dnl
9570AT_CHECK([ovs-appctl dpctl/dump-conntrack | sort], [], [dnl
9571udp,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)
9572udp,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)
9573])
9574
9575OVS_VSWITCHD_STOP
9576AT_CLEANUP
9577
ed708b5d
DDP
9578AT_SETUP([ofproto-dpif - conntrack - ipv6])
9579OVS_VSWITCHD_START
9580
9581add_of_ports br0 1 2
9582
9583AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9584
9585dnl Allow new connections on p1->p2, but not on p2->p1.
9586AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9587dnl Table 0
9588dnl
9589table=0,priority=100,arp,action=normal
9590table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
9591table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
9592table=0,priority=1,action=drop
9593dnl Table 1
9594dnl
9595table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
9596table=1,priority=1,action=drop
ed708b5d
DDP
9597])
9598
9599AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9600
9601AT_CAPTURE_FILE([ofctl_monitor.log])
9602AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9603
9604AT_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)'])
9605
9606dnl OK, now start a new connection from port 1.
9607AT_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)'])
9608
9609dnl Now try a reply from port 2.
9610AT_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)'])
9611
9612OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9613OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9614
9615dnl Check this output. We only see the latter two packets, not the first.
9616dnl Note that the first packet doesn't have the ct_state bits set. This
9617dnl happens because the ct_state field is available only after recirc.
9618AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9619NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
9620udp6,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
9621NXT_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)
9622udp6,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
9623])
9624
9625OVS_VSWITCHD_STOP
9626AT_CLEANUP
9627
9628AT_SETUP([ofproto-dpif - conntrack - output action])
9629OVS_VSWITCHD_START
9630
9631add_of_ports br0 1 2
9632
9633AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9634
9635dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9636AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9637dnl The flows are in two separate tables for two reasons:
9638dnl * To make the pipeline more clear.
9639dnl * To make megaflows more consistent (we check megaflows below). The
9640dnl unwildcarding in megaflows depends on the internal ordering of the
9641dnl subtables, which are sorted using the system qsort(). qsort()
9642dnl is provided by libc and may or may not be stable, so we can't rely
9643dnl on that. By having separate tables we have more control over which
9644dnl subtables are visited, meaning consistent megaflows.
9645dnl
9646dnl Table 0
9647dnl
9648table=0,priority=100,arp,action=normal
9649table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
9650table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9651table=0,priority=1,action=drop
9652dnl
9653dnl Table 1
9654dnl
9655table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
9656table=1,priority=1,action=drop
ed708b5d
DDP
9657])
9658
9659AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9660
9661
9662AT_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)'])
9663
9664dnl OK, now start a new connection from port 1.
9665AT_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)'])
9666
9667dnl Now try a reply from port 2.
9668AT_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)'])
9669
9670dnl OK, now start a second connection from port 1
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(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)'])
9672
9673dnl Now try a reply from port 2.
9674AT_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)'])
9675
9676
9677AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
3d4b2e6e
JS
9678ct_state(+new-est+trk),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:drop
9679ct_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
9680recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
9681recirc_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
9682])
9683
9684OVS_VSWITCHD_STOP
9685AT_CLEANUP
9686
9687AT_SETUP([ofproto-dpif - conntrack - expiration])
9688OVS_VSWITCHD_START
9689
9690add_of_ports br0 1 2
9691
9692AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9693
9694dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9695AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9696dnl Table 0
9697dnl
9698table=0,priority=100,arp,action=normal
9699table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
9700table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9701table=0,priority=1,action=drop
9702dnl
9703dnl Table 1
9704dnl
9705table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9706table=1,priority=1,action=drop
ed708b5d
DDP
9707])
9708
9709AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9710
9711AT_CAPTURE_FILE([ofctl_monitor.log])
9712AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9713
9714AT_CHECK([ovs-appctl time/stop])
9715
9716dnl Start a new connection from port 1.
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(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)'])
9718
9719dnl Now try a reply from port 2.
9720AT_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)'])
9721
9722ovs-appctl time/warp 100000
9723
9724dnl Now try another reply from port 2.
9725AT_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)'])
9726
9727OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
9728OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9729
9730dnl Check this output. Only one reply must be there
9731AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9732NXT_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)
9733udp,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
9734dnl
9735OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
9736])
9737
9738OVS_VSWITCHD_STOP
9739AT_CLEANUP
9740
9741AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
9742OVS_VSWITCHD_START
9743
9744add_of_ports br0 1 2
9745
9746AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9747
9748AT_DATA([flows.txt], [dnl
ed26e3ea 9749ipv6,ct_state=-trk,action=ct(table=0,zone=0)
ed708b5d
DDP
9750ct_state=+trk,action=controller
9751])
9752
9753AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9754
9755AT_CAPTURE_FILE([ofctl_monitor.log])
9756AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9757
9758AT_CHECK([ovs-appctl time/stop])
9759
ed26e3ea 9760AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
ed708b5d
DDP
9761
9762OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
9763OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9764
9765AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7827edca 9766NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,ipv6,in_port=2 (via action) data_len=86 (unbuffered)
ed26e3ea 9767icmp6,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
9768])
9769
9770OVS_VSWITCHD_STOP
9771AT_CLEANUP
9772
9773AT_SETUP([ofproto-dpif - conntrack - zones])
9774OVS_VSWITCHD_START
9775
9776add_of_ports br0 1 2 3 4
9777
9778AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9779
9780dnl Allow new connections on p1->p2 or p3->p4.
9781dnl Allow only established connections p2->p1 and p4->p3
9782dnl p1,p2 and p3,p4 are on different zones
9783AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9784dnl Table 0
9785dnl
9786table=0,priority=100,arp,action=normal
9787table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
9788table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9789table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
9790table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
9791table=0,priority=1,action=drop
9792dnl
9793dnl Table 1
9794dnl
9795table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9796table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
9797table=1,priority=1,action=drop
ed708b5d
DDP
9798])
9799
9800AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9801
9802AT_CAPTURE_FILE([ofctl_monitor.log])
9803AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9804
9805dnl Basic "only established" test on ports 1,2
9806
9807AT_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)'])
9808AT_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)'])
9809AT_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)'])
9810
9811dnl Now use the same 5-tuples but on ports 3,4
9812
9813AT_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)'])
9814AT_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)'])
9815AT_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)'])
9816
9817OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9818OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9819
9820dnl Check this output. We only see the latter two packets (for each zone), not the first.
9821AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9822NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9823udp,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 9824dnl
6f068379
BP
9825NXT_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)
9826udp,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 9827dnl
6f068379
BP
9828NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=3 (via action) data_len=106 (unbuffered)
9829udp,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 9830dnl
6f068379
BP
9831NXT_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)
9832udp,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
9833])
9834
ed708b5d
DDP
9835OVS_VSWITCHD_STOP
9836AT_CLEANUP
9837
9838AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
9839OVS_VSWITCHD_START
9840
9841add_of_ports br0 1 2
9842
9843AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9844
9845dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9846AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9847dnl Table 0
9848dnl
9849table=0,priority=100,arp,action=normal
9850table=0,priority=10,udp,action=ct(table=1,zone=0)
9851table=0,priority=1,action=drop
9852dnl
9853dnl Table 1
9854dnl
9855table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
9856table=1,priority=10,ct_state=+trk+est,udp,action=controller
9857table=1,priority=1,action=drop
ed708b5d
DDP
9858])
9859
9860AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9861
9862AT_CAPTURE_FILE([ofctl_monitor.log])
9863AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9864
9865AT_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)'])
9866
9867dnl OK, now start a new connection from port 1.
9868AT_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)'])
9869
9870dnl Now try a reply from port 2.
9871AT_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)'])
9872
9873OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9874OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9875
9876dnl Check this output. We only see the latter two packets, not the first.
9877AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9878NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9879udp,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 9880dnl
6f068379
BP
9881NXT_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)
9882udp,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
9883])
9884
9885OVS_VSWITCHD_STOP
9886AT_CLEANUP
9887
9888AT_SETUP([ofproto-dpif - conntrack - ICMP related])
9889OVS_VSWITCHD_START
9890
9891add_of_ports br0 1 2
9892
9893dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
9894AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9895dnl Table 0
9896dnl
9897table=0,priority=100,arp,action=normal
ed26e3ea
JR
9898table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
9899table=0,priority=10,ip,in_port=2,action=ct(table=1)
a103c1f4
DDP
9900table=0,priority=1,action=drop
9901dnl
9902dnl Table 1
9903dnl
9904table=1,priority=10,in_port=1,ct_state=+trk,action=controller
9905table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
9906table=1,priority=1,action=drop
ed708b5d
DDP
9907])
9908
9909AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9910
9911AT_CAPTURE_FILE([ofctl_monitor.log])
9912AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9913
9914dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
a103c1f4 9915AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
ed708b5d
DDP
9916
9917dnl 2. Send and UDP packet to port 5555
a103c1f4 9918AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
ed708b5d
DDP
9919
9920dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
a103c1f4 9921AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
ed708b5d
DDP
9922
9923OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9924OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9925
9926dnl Check this output. We only see the first and the last packet
9927AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7827edca 9928NXT_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
9929udp,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
9930dnl
7827edca 9931NXT_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
9932icmp,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
9933])
9934
9935OVS_VSWITCHD_STOP
9936AT_CLEANUP
9937
9938AT_SETUP([ofproto-dpif - conntrack - ct_mark])
9939OVS_VSWITCHD_START
9940
9941add_of_ports br0 1 2
9942
9943AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9944
9945dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9946AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9947dnl Table 0
9948dnl
ed26e3ea
JR
9949table=0,arp,action=normal
9950table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
9951table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
9952table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
9953table=0,ip,in_port=2,actions=ct(table=1)
9954table=0,priority=0,action=drop
a103c1f4
DDP
9955dnl
9956dnl Table 1
9957dnl
9958table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
9959table=1,priority=1,action=drop
ed708b5d
DDP
9960])
9961
9962AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9963
9964AT_CAPTURE_FILE([ofctl_monitor.log])
9965AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9966
9967AT_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)'])
9968AT_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)'])
9969AT_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)'])
9970
9971AT_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)'])
9972AT_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)'])
9973AT_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)'])
9974
9975OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
9976OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9977
9978dnl Check this output.
9979AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9980NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9981udp,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 9982dnl
6f068379
BP
9983NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9984udp,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 9985dnl
6f068379
BP
9986NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9987udp,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 9988dnl
6f068379
BP
9989NXT_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)
9990udp,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 9991dnl
6f068379
BP
9992NXT_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)
9993udp,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
9994])
9995
9996OVS_VSWITCHD_STOP
9997AT_CLEANUP
9998
9999AT_SETUP([ofproto-dpif - conntrack - ct_label])
10000OVS_VSWITCHD_START
10001
10002add_of_ports br0 1 2
10003
10004AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10005
10006dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10007AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10008dnl Table 0
10009dnl
ed26e3ea
JR
10010table=0,arp,action=normal
10011table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
10012table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
10013table=0,ip,in_port=2,actions=ct(table=1)
a103c1f4
DDP
10014dnl
10015dnl Table 1
10016dnl
10017table=1,priority=10,ct_state=+trk+rpl,actions=controller
10018table=1,priority=1,action=drop
ed708b5d
DDP
10019])
10020
10021AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10022
10023AT_CAPTURE_FILE([ofctl_monitor.log])
10024AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10025
10026AT_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)'])
10027AT_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)'])
10028
10029AT_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)'])
10030AT_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)'])
10031
10032OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10033OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10034
10035dnl Check this output.
10036AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10037NXT_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)
10038udp,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 10039dnl
6f068379
BP
10040NXT_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)
10041udp,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
10042])
10043
10044OVS_VSWITCHD_STOP
10045AT_CLEANUP
10046
10047AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
10048OVS_VSWITCHD_START
10049
10050add_of_ports br0 1 2
10051
10052AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10053
10054dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10055AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10056dnl The flows are in two separate tables for two reasons:
10057dnl * To make the pipeline more clear.
10058dnl * To make megaflows more consistent (we check megaflows below). The
10059dnl unwildcarding in megaflows depends on the internal ordering of the
10060dnl subtables, which are sorted using the system qsort(). qsort()
10061dnl is provided by libc and may or may not be stable, so we can't rely
10062dnl on that. By having separate tables we have more control over which
10063dnl subtables are visited, meaning consistent megaflows.
10064dnl
10065dnl Table 0
10066dnl
ed26e3ea
JR
10067table=0,arp,action=normal
10068table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
10069table=0,ip,in_port=2,actions=ct(table=1)
10070table=0,priority=0,action=drop
a103c1f4
DDP
10071dnl
10072dnl Table 1
10073dnl
10074table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
10075table=1,priority=1,action=drop
ed708b5d
DDP
10076])
10077
10078AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10079
10080AT_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)'])
10081AT_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)'])
10082
a76a37ef
JR
10083# Give time for logs to appear.
10084ovs-appctl revalidator/wait
10085
ed708b5d 10086AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
3d4b2e6e
JS
10087ct_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
10088recirc_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
10089recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
ed708b5d
DDP
10090])
10091
10092OVS_VSWITCHD_STOP
10093AT_CLEANUP
10094
10095AT_SETUP([ofproto-dpif - conntrack - no output])
10096OVS_VSWITCHD_START
10097
10098add_of_ports br0 1
10099
10100AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10101
10102dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10103AT_DATA([flows.txt], [dnl
10104in_port=1,udp,action=ct(commit,zone=0)
10105])
10106
10107AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10108
10109dnl Start a new connection from port 1.
10110AT_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)'])
10111
10112AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
3d4b2e6e 10113recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
ed708b5d
DDP
10114])
10115
10116OVS_VSWITCHD_STOP
10117AT_CLEANUP
10118
10119AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
10120OVS_VSWITCHD_START
10121
10122add_of_ports br0 1 2
10123
10124AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10125
10126dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10127AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10128dnl Table 0
10129dnl
10130table=0,priority=100,arp,action=normal
10131table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10132table=0,priority=10,in_port=2,ip,action=ct(table=1)
10133table=0,priority=1,action=drop
10134dnl
10135dnl Table 1
10136dnl
ed708b5d
DDP
10137dnl The following two flows are separated to explicitly count the packets
10138dnl that create a new connection
a103c1f4
DDP
10139table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10140table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
ed708b5d 10141dnl
a103c1f4
DDP
10142table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10143table=1,ip,ct_state=+trk+inv,action=drop
ed708b5d
DDP
10144])
10145
10146AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10147
10148AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10149AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10150AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10151AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
10152AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10153AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10154AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10155AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10156AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10157
10158AT_CHECK([ovs-appctl revalidator/purge])
10159AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10160dnl Only one new connection
10161n_packets=1
10162])
10163
10164AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
10165AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
10166AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
10167AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
10168AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
10169AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
10170AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
10171AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
10172AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
10173
10174AT_CHECK([ovs-appctl revalidator/purge])
10175AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10176dnl Two new connections
10177n_packets=2
10178])
10179
10180OVS_VSWITCHD_STOP
10181AT_CLEANUP
10182
10183AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
10184OVS_VSWITCHD_START
10185
10186add_of_ports br0 1 2
10187
10188AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10189
10190dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10191AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10192dnl Table 0
10193dnl
10194table=0,priority=100,arp,action=normal
10195table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
10196table=0,priority=10,in_port=2,tcp,action=ct(table=1)
10197table=0,priority=1,action=drop
10198dnl
10199dnl Table 1
10200dnl
10201table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
10202table=1,priority=1,action=drop
ed708b5d
DDP
10203])
10204
10205AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10206
10207AT_CHECK([ovs-appctl revalidator/purge])
10208AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10209dnl No dropped packets
10210n_packets=0
10211])
10212
10213AT_CAPTURE_FILE([ofctl_monitor.log])
10214AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10215
10216dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
10217dnl sure that the connection tracker is able to pick up already established
10218dnl connections that use window scaling.
10219dnl
10220dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
10221dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
10222AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
10223AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
10224AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
10225AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a08004500022afc284000400626a10a0101020a01010100020001396bb35b8cadbdb45018000a941f0000 dnl
10226 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10227 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10228 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10229 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10230 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10231 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10232 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10233 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10234 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10235 6666666666666666666666666666666666666666666666666666660a'])
10236AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
10237AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a5054000000090800450001fdf2ca40004006302c0a0101010a010102000100028cadbdb4396bb55d5018000aa60c0000 dnl
10238 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10239 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10240 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10241 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10242 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10243 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10244 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10245 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10246 6565656565656565656565656565656565656565656565656565656565656565656565650a'])
10247AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
10248AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
10249AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
10250AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
10251AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
10252
10253AT_CHECK([ovs-appctl revalidator/purge])
10254
10255OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10256
10257AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10258])
10259
10260AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10261dnl No dropped packets
10262n_packets=0
10263])
10264
56de2148
YT
10265OVS_VSWITCHD_STOP
10266AT_CLEANUP
ae59d134 10267
72fe7578
BP
10268dnl This is a truncated version of "ofproto-dpif - conntrack - controller",
10269dnl with extra send-to-controller actions following ct_clear to show that
10270dnl the connection tracking data has been cleared.
10271AT_SETUP([ofproto-dpif - conntrack - ct_clear])
10272OVS_VSWITCHD_START
10273
10274add_of_ports br0 1 2
10275
10276AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10277
10278dnl Allow new connections on p1->p2, but not on p2->p1.
10279AT_DATA([flows.txt], [dnl
10280dnl Table 0
10281dnl
10282table=0,priority=100,arp,action=normal
10283table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller,ct_clear,controller
10284table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10285table=0,priority=1,action=drop
10286dnl
10287dnl Table 1
10288dnl
10289table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller,ct_clear,controller
10290table=1,priority=1,action=drop
10291])
10292
10293AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10294
10295AT_CAPTURE_FILE([ofctl_monitor.log])
10296AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10297
10298AT_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)'])
10299
10300dnl OK, now start a new connection from port 1.
10301AT_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)'])
10302
10303dnl Now try a reply from port 2.
10304AT_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)'])
10305
10306OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
10307OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10308
10309dnl Check this output. We only see the latter two packets, not the first.
10310dnl Note that the first packet doesn't have the ct_state bits set. This
10311dnl happens because the ct_state field is available only after recirc.
10312AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10313NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10314udp,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 10315dnl
6f068379
BP
10316NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10317udp,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 10318dnl
6f068379
BP
10319NXT_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)
10320udp,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 10321dnl
6f068379
BP
10322NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
10323udp,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
10324])
10325OVS_VSWITCHD_STOP
10326AT_CLEANUP
10327
e6bc8e74
YHW
10328AT_SETUP([ofproto-dpif - conntrack - ofproto/trace])
10329OVS_VSWITCHD_START
10330
0f2f05bb 10331add_of_ports br0 1 2 3 4
e6bc8e74
YHW
10332
10333AT_DATA([flows.txt], [dnl
10334dnl Table 0
10335dnl
10336table=0,priority=100,arp,action=normal
10337table=0,priority=10,udp,action=ct(table=1,zone=0)
0f2f05bb 10338table=0,priority=10,tcp,action=ct(table=2,zone=1)
e6bc8e74
YHW
10339table=0,priority=1,action=drop
10340dnl
10341dnl Table 1
10342dnl
5fdd80cc
YHW
10343table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+new,udp,action=ct(commit,zone=0),2
10344table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+est,udp,action=2
10345table=1,priority=10,in_port=2,ct_zone=0,ct_state=+trk+est,udp,action=1
e6bc8e74 10346table=1,priority=1,action=drop
0f2f05bb
YHW
10347dnl
10348dnl Table 2
10349dnl
5fdd80cc
YHW
10350table=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)
10351table=2,priority=10,in_port=1,tcp,ct_zone=1,ct_state=+trk+est,tcp,action=ct(table=3,zone=2)
0f2f05bb
YHW
10352table=2,priority=1,action=drop
10353dnl
10354dnl Table 3
10355dnl
5fdd80cc
YHW
10356table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+new,tcp,action=ct(commit,zone=2),4
10357table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+est,tcp,action=3
0f2f05bb 10358table=2,priority=1,action=drop
e6bc8e74
YHW
10359])
10360
10361AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10362
10363AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,udp'], [0], [stdout])
10364AT_CHECK([tail -1 stdout], [0],
10365 [Datapath actions: drop
10366])
10367
10368AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,udp'], [0], [stdout])
10369AT_CHECK([tail -1 stdout], [0],
10370 [Datapath actions: ct(commit),2
10371])
10372
0f2f05bb
YHW
10373AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp'], [0], [stdout])
10374AT_CHECK([tail -1 stdout], [0],
10375 [Datapath actions: ct(commit,zone=2),4
10376])
10377
10378AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp' --ct-next 'trk,est' --ct-next 'trk,est' ], [0], [stdout])
10379AT_CHECK([tail -1 stdout], [0],
10380 [Datapath actions: 3
10381])
10382
e6bc8e74
YHW
10383OVS_VSWITCHD_STOP
10384AT_CLEANUP
10385
ae59d134
DDP
10386AT_SETUP([ofproto - set mtu])
10387OVS_VSWITCHD_START
10388
10389add_of_ports br0 1
10390
10391# Check that initial MTU is 1500 for 'br0' and 'p1'.
10392AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
103931500
10394])
10395AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
103961500
10397])
10398
10399# Request new MTU for 'p1'
10400AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
10401
10402# Check that the new MTU is applied
10403AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p1 mtu=1600])
10404# The internal port 'br0' should have the same MTU value as p1, becase it's
10405# the new bridge minimum.
10406AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
10407
10408AT_CHECK([ovs-vsctl del-port br0 p1])
10409
10410# When 'p1' is deleted, the internal port should return to the default MTU
10411AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1500])
10412
7c12e200
DDP
10413# New port with 'mtu_request' in the same transaction.
10414AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
10415AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1600])
10416AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
10417
3a414a0a
DDP
10418# Explicitly set mtu_request on the internal interface. This should prevent
10419# the MTU from being overriden.
10420AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
10421AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
10422
10423# The new MTU on p2 should not affect br0.
10424AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
10425AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1400])
10426AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
10427
10428# Remove explicit mtu_request from br0. Now it should track the bridge
10429# minimum again.
10430AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
10431AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1400])
10432
ae59d134
DDP
10433OVS_VSWITCHD_STOP
10434AT_CLEANUP
4a7ab326
DDP
10435
10436AT_SETUP([ofproto - fragment prerequisites])
10437OVS_VSWITCHD_START
10438
10439AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
10440
10441add_of_ports br0 1
10442
10443AT_DATA([flows.txt], [dnl
10444priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
10445priority=1,in_port=1,udp,action=drop
10446])
10447
10448AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10449
10450AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
10451
10452ovs-appctl time/stop
10453AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
10454ovs-appctl time/warp 5000
10455
10456AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e 10457recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
4a7ab326
DDP
10458])
10459
10460dnl Change the flow table. This will trigger revalidation of all the flows.
10461AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
10462AT_CHECK([ovs-appctl revalidator/wait], [0])
10463
10464dnl We don't want revalidators to delete any flow. If the flow has been
10465dnl deleted it means that there's some inconsistency with the revalidation.
10466AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
10467
10468OVS_VSWITCHD_STOP
10469AT_CLEANUP