]> git.proxmox.com Git - ovs.git/blame - tests/ofproto-dpif.at
ofp-parse: Parse pipeline fields in OF1.5 packet-out
[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
JG
45AT_CHECK([grep 'in_port([[348]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
46recirc_id(0),in_port(3),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),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),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),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),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),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])
31a19d69 222AT_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])
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],
16194afd 254 [Megaflow: recirc_id=0,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],
ed5648b7 271 [Megaflow: recirc_id=0,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:
274 - Uses action(s) not supported by datapath.
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],
16194afd 289 [Megaflow: recirc_id=0,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],
16194afd 317 [Megaflow: recirc_id=0,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'])
340AT_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])
341AT_CHECK([tail -1 stdout], [0],
342 [Datapath actions: set(ipv4(src=192.168.3.90,dst=192.168.0.2)),10,set(ipv4(src=192.168.0.1,dst=192.168.0.2)),10
343])
344OVS_VSWITCHD_STOP
345AT_CLEANUP
346
f4fb341b
SH
347AT_SETUP([ofproto-dpif - all group in action set])
348OVS_VSWITCHD_START
ca5792f0 349add_of_ports br0 1 10 11
f4fb341b
SH
350AT_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'])
351AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
352AT_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
353# Must match on the source address to be able to restore it's value for
354# the third bucket
ce58df5b 355AT_CHECK([tail -2 stdout], [0],
16194afd 356 [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 357Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
f4fb341b
SH
358])
359OVS_VSWITCHD_STOP
360AT_CLEANUP
361
362AT_SETUP([ofproto-dpif - indirect group in action set])
363OVS_VSWITCHD_START
ca5792f0 364add_of_ports br0 1 10
f4fb341b
SH
365AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
366AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
367AT_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])
368AT_CHECK([tail -1 stdout], [0],
369 [Datapath actions: 10
370])
371OVS_VSWITCHD_STOP
372AT_CLEANUP
373
fe7e5749
SH
374AT_SETUP([ofproto-dpif - select group])
375OVS_VSWITCHD_START
ca5792f0 376add_of_ports br0 1 10 11
fe7e5749
SH
377AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
378AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
7cb279c2
SH
379
380# Try a bunch of different flows and make sure that they get distributed
381# at least somewhat.
382for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
383 AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:0$d,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])
384 tail -1 stdout >> results
385done
386sort results | uniq -c
387AT_CHECK([sort results | uniq], [0],
fe7e5749 388 [Datapath actions: 10
7cb279c2 389Datapath actions: 11
fe7e5749
SH
390])
391OVS_VSWITCHD_STOP
392AT_CLEANUP
393
394AT_SETUP([ofproto-dpif - select group with watch port])
395OVS_VSWITCHD_START
ca5792f0 396add_of_ports br0 1 10 11
fe7e5749
SH
397AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
398AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
399AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:07,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])
400AT_CHECK([tail -1 stdout], [0],
401 [Datapath actions: 11
402])
403OVS_VSWITCHD_STOP
404AT_CLEANUP
405
7cb279c2
SH
406AT_SETUP([ofproto-dpif - select group with weight])
407OVS_VSWITCHD_START
ca5792f0 408add_of_ports br0 1 10 11 12
125bf01d 409AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11,weight=2000,bucket=output:12,weight=0'])
7cb279c2
SH
410AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
411AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:07,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])
412AT_CHECK([tail -1 stdout], [0],
413 [Datapath actions: 11
414])
415OVS_VSWITCHD_STOP
416AT_CLEANUP
417
0c4b9393
SH
418AT_SETUP([ofproto-dpif - select group with hash selection method])
419OVS_VSWITCHD_START
ca5792f0 420add_of_ports br0 1 10 11
8b666728
JR
421# Check that parse failures after 'fields' parsing work
422AT_CHECK([ovs-ofctl -O OpenFlow10 add-group br0 'group_id=1,type=select,fields(eth_dst),bukket=output:10'], [1], ,[dnl
423ovs-ofctl: unknown keyword bukket
424])
362a2ebb 425AT_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'])
0c4b9393
SH
426AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
427
428# Try a bunch of different flows and make sure that they get distributed
429# at least somewhat.
430for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
431 AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:0$d,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])
432 tail -1 stdout >> results
433done
434sort results | uniq -c
435AT_CHECK([sort results | uniq], [0],
436 [Datapath actions: 10
437Datapath actions: 11
438])
439
440> results
441# Try a bunch of different flows and make sure that they are not distributed
442# as they only vary a field that is not hashed
443for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
3a6e67fa 444 AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:0$d,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])
0c4b9393
SH
445 tail -1 stdout >> results
446done
447sort results | uniq -c
3a6e67fa
BP
448AT_CHECK([sort results | uniq | sed 's/1[[01]]/1?/'], [0],
449 [Datapath actions: 1?
0c4b9393
SH
450])
451
60dfb5ed
JR
452# Check that fields are rejected without "selection_method=hash".
453AT_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
454ovs-ofctl: fields may only be specified with "selection_method=hash"
455])
456
457# Check that selection_method_param without selection_method is rejected.
458AT_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
459ovs-ofctl: selection_method_param is only allowed with "selection_method"
460])
461
0c4b9393
SH
462OVS_VSWITCHD_STOP
463AT_CLEANUP
464
53cc166a
JR
465AT_SETUP([ofproto-dpif - select group with dp_hash selection method])
466OVS_VSWITCHD_START
467add_of_ports br0 1 10 11
468AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11'])
469AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip,nw_src=192.168.0.1 actions=group:1234'])
470
471# Try a bunch of different flows and make sure that they get distributed
472# at least somewhat.
473for d in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
474 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:01),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
475 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
476done
477
478AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0x1)/dp_hash(0xXXXX\/0x1)/' | sed 's/packets.*actions:1/actions:1/' | strip_ufid | strip_used | sort], [0], [dnl
479flow-dump from non-dpdk interfaces:
480recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:630, used:0.0s, actions:hash(hash_l4(0)),recirc(0x1)
481recirc_id(0x1),dp_hash(0xXXXX/0x1),in_port(1),eth_type(0x0800),ipv4(frag=no), actions:10
482recirc_id(0x1),dp_hash(0xXXXX/0x1),in_port(1),eth_type(0x0800),ipv4(frag=no), actions:11
483])
484
485AT_CHECK([ovs-appctl revalidator/purge], [0])
486
487# Try a bunch of different flows and make sure that they are not distributed
488# as they only vary a field that is not hashed
489for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
490 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)"
491 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
492done
493
494AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0x1)/dp_hash(0xXXXX\/0x1)/' | strip_ufid | strip_used | sort], [0], [dnl
495flow-dump from non-dpdk interfaces:
496recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:630, used:0.0s, actions:hash(hash_l4(0)),recirc(0x2)
497recirc_id(0x2),dp_hash(0xXXXX/0x1),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:630, used:0.0s, actions:11
498])
499
500OVS_VSWITCHD_STOP
501AT_CLEANUP
502
dd8cd4b4
SH
503AT_SETUP([ofproto-dpif - fast failover group])
504OVS_VSWITCHD_START
ca5792f0 505add_of_ports br0 1 10 11
dd8cd4b4
SH
506AT_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'])
507AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
508AT_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])
509AT_CHECK([tail -1 stdout], [0],
510 [Datapath actions: drop
511])
512OVS_VSWITCHD_STOP
513AT_CLEANUP
514
b2af3288
AZ
515AT_SETUP([ofproto-dpif - group stats single bucket])
516OVS_VSWITCHD_START
ca5792f0 517add_of_ports br0 1 10 11
b2af3288
AZ
518AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
519AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
520(
521for i in `seq 0 2`;
522 do
523 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)"
524 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
525 done
526)
cea4a6d7 527AT_CHECK([ovs-appctl revalidator/purge], [0])
b2af3288 528AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 529AT_CHECK([strip_xids < stdout | sort], [0], [dnl
efe179e0 530 group_id=1234,ref_count=1,packet_count=3,byte_count=126,bucket0:packet_count=3,byte_count=126,bucket1:packet_count=0,byte_count=0
b2af3288
AZ
531OFPST_GROUP reply (OF1.2):
532])
533OVS_VSWITCHD_STOP
534AT_CLEANUP
535
536AT_SETUP([ofproto-dpif - group stats all buckets])
537OVS_VSWITCHD_START
ca5792f0 538add_of_ports br0 1 10 11
b2af3288
AZ
539AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
540AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
541(
542for i in `seq 0 2`;
543 do
544 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)"
545 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
546 done
547)
cea4a6d7 548AT_CHECK([ovs-appctl revalidator/purge], [0])
b2af3288 549AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 550AT_CHECK([strip_xids < stdout | sort], [0], [dnl
efe179e0 551 group_id=1234,ref_count=1,packet_count=3,byte_count=126,bucket0:packet_count=3,byte_count=126,bucket1:packet_count=3,byte_count=126
b2af3288
AZ
552OFPST_GROUP reply (OF1.2):
553])
554OVS_VSWITCHD_STOP
555AT_CLEANUP
556
58a89177 557AT_SETUP([ofproto-dpif - registers])
023e1e0a 558OVS_VSWITCHD_START
ca5792f0 559add_of_ports br0 20 21 22 33 90
58a89177
EJ
560AT_DATA([flows.txt], [dnl
561in_port=90 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
562in_port=91 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
e9358af6
EJ
563in_port=92 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
564in_port=93 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
565
58a89177
EJ
566in_port=2 actions=load:0x000db000->NXM_NX_REG0[[]]
567in_port=3 actions=load:0xdea->NXM_NX_REG0[[20..31]]
568in_port=4 actions=load:0xeef->NXM_NX_REG0[[0..11]]
569in_port=5 actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
570in_port=6 actions=load:0x22222222->NXM_NX_REG2[[]]
571in_port=7 actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
572in_port=8 actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
573in_port=9,reg0=0xdeadbeef actions=output:20
574in_port=10,reg1=0xdeadbeef actions=output:21
575in_port=11,reg2=0xeef22dea actions=output:22
e9358af6
EJ
576
577dnl Sanilty check all registers
578in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
579in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
580in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
581in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
bd85dac1 582
58a89177
EJ
583])
584AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 585AT_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 586AT_CHECK([tail -1 stdout], [0],
e9358af6 587 [Datapath actions: 20,21,22,33
58a89177 588])
023e1e0a 589OVS_VSWITCHD_STOP
58a89177 590AT_CLEANUP
f694937d 591
57fa8167
BP
592dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
593dnl in the manner documented in ovs-ofctl(8).
594AT_SETUP([ofproto-dpif - extended registers])
595OVS_VSWITCHD_START
ca5792f0 596add_of_ports br0 1 2 3
57fa8167
BP
597AT_DATA([flows.txt], [dnl
598table=0 actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
599table=1,reg2=0xfedcba98,reg3=0x76543210 actions=2
600
601# These low-priority rules shouldn't match. They're here only to make really
602# sure that the test fails if either of the above rules fails to match.
603table=0,priority=0 actions=3
604table=1,priority=0 actions=3
605])
606AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
607AT_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])
608AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
609])
610OVS_VSWITCHD_STOP
611AT_CLEANUP
612
b23ada8e
JP
613dnl Tests that the standardized xxregs are mapped onto the legacy OVS
614dnl registers in the manner documented in ovs-ofctl(8).
615AT_SETUP([ofproto-dpif - extended-extended registers])
616OVS_VSWITCHD_START
617add_of_ports br0 1 2 3
618AT_DATA([flows.txt], [dnl
619table=0 actions=load:0x0123456789abcdeffedcba9876543210->NXM_NX_XXREG1[[]],resubmit(,1)
620table=1,reg4=0x01234567,reg5=0x89abcdef,reg6=0xfedcba98,reg7=0x76543210 actions=2
621
622# These low-priority rules shouldn't match. They're here only to make really
623# sure that the test fails if either of the above rules fails to match.
624table=0,priority=0 actions=3
625table=1,priority=0 actions=3
626])
627AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
628AT_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])
629AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
630])
631OVS_VSWITCHD_STOP
632AT_CLEANUP
633
1b0ee636
TG
634AT_SETUP([ofproto-dpif - load and move order])
635OVS_VSWITCHD_START
ca5792f0 636add_of_ports br0 1 10 11
1b0ee636
TG
637AT_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'])
638AT_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)'])
639AT_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])
640AT_CHECK([tail -2 stdout], [0],
16194afd 641 [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 642Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
1b0ee636
TG
643])
644OVS_VSWITCHD_STOP
645AT_CLEANUP
646
eb1cbc6b
JT
647dnl Tests that 1.5 copy-field can copy into the standardized xregs.
648AT_SETUP([ofproto-dpif - copy-field into extended registers])
649OVS_VSWITCHD_START
ca5792f0 650add_of_ports br0 1 2 3
eb1cbc6b
JT
651AT_DATA([flows.txt], [dnl
652table=0 actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
653table=1,xreg0=0x0000505400000005 actions=2
654
655# These low-priority rules shouldn't match. They're here only to make really
656# sure that the test fails if either of the above rules fails to match.
657table=0,priority=0 actions=3
658table=1,priority=0 actions=3
659])
660AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
661AT_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])
662AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
663])
664OVS_VSWITCHD_STOP
665AT_CLEANUP
666
2bef8e07
JT
667dnl Tests that 1.5 set-field with mask in the metadata register.
668AT_SETUP([ofproto-dpif - masked set-field into metadata])
669OVS_VSWITCHD_START
ca5792f0 670add_of_ports br0 1 2 3
2bef8e07
JT
671AT_DATA([flows.txt], [dnl
672table=0 actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
673table=1 actions=set_field:0x6b/0xff->metadata,goto_table(2)
674table=2,metadata=0xfafafafa5a5a5a6b actions=2
675
676# These low-priority rules shouldn't match. They're here only to make really
677# sure that the test fails if either of the above rules fails to match.
678table=0,priority=0 actions=3
679table=1,priority=0 actions=3
680table=2,priority=0 actions=3
681])
682AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
683AT_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])
684AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
685])
686OVS_VSWITCHD_STOP
687AT_CLEANUP
688
c61f3870
BP
689
690AT_SETUP([ofproto-dpif - actset_output])
691OVS_VSWITCHD_START
ca5792f0 692add_of_ports br0 1 2 3 4 5 6 7 8 9 10 11 12 13
c61f3870 693AT_DATA([flows.txt], [dnl
3ca3ce0c 694table=0,actset_output=unset actions=write_actions(output(2)),goto_table(1)
c61f3870
BP
695table=1 actions=move:ONFOXM_ET_ACTSET_OUTPUT[[0..31]]->OXM_OF_PKT_REG0[[0..31]],goto_table(2)
696
697# Verify that actset_output got set.
698table=2,priority=20,actset_output=2 actions=4,goto_table(3)
699table=2,priority=10 actions=5,goto_table(3)
700
701# Verify that xreg0 got copied properly from actset_output.
702table=3,priority=20,xreg0=2 actions=6,goto_table(4)
703table=3,priority=10 actions=7,goto_table(4)
704
b23ada8e
JP
705# Verify that xxreg0 got copied properly from actset_output.
706table=3,priority=20,xxreg0=2 actions=6,goto_table(4)
707table=3,priority=10 actions=7,goto_table(4)
708
9055ca9a
BP
709# Verify that adding a group action unsets actset_output,
710# even if output follows group.
711table=4 actions=write_actions(group(5),output(10)),goto_table(5)
c61f3870
BP
712table=5,priority=20,actset_output=unset actions=8,goto_table(6)
713table=5,priority=10 actions=9,goto_table(6)
714
715# Verify that adding another output action doesn't change actset_output
716# (since there's still a group).
717table=6 actions=write_actions(output(3)),goto_table(7)
718table=7,priority=20,actset_output=unset actions=10,goto_table(8)
719table=7,priority=10 actions=11,goto_table(8)
720
721# Verify that clearing the action set, then writing an output action,
722# causes actset_output to be set again.
723table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
724table=9,priority=20,actset_output=2 actions=12
725table=9,priority=10 actions=13
726])
4f20179d 727AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=5,type=all,bucket=output:1'])
c61f3870
BP
728AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
729AT_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])
730AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
731])
732OVS_VSWITCHD_STOP
733AT_CLEANUP
880b1458 734
bd85dac1
AZ
735AT_SETUP([ofproto-dpif - push-pop])
736OVS_VSWITCHD_START
ca5792f0 737add_of_ports br0 20 21 22 33 90
bd85dac1
AZ
738AT_DATA([flows.txt], [dnl
739in_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
740in_port=2 actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
741in_port=3 actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
742in_port=4 actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
743in_port=5 actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
744
745])
746AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 747AT_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
748AT_CHECK([tail -1 stdout], [0],
749 [Datapath actions: 33,22,21,20
750])
751OVS_VSWITCHD_STOP
752AT_CLEANUP
753
f694937d 754AT_SETUP([ofproto-dpif - output])
023e1e0a 755OVS_VSWITCHD_START
ca5792f0 756add_of_ports br0 1 9 10 11 55 66 77 88
f694937d 757AT_DATA([flows.txt], [dnl
557323cd 758in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
f694937d
EJ
759in_port=2 actions=output:9
760in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
761in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
762in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
763in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
764in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
557323cd 765in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
f694937d
EJ
766])
767AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 768AT_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 769AT_CHECK([tail -1 stdout], [0],
557323cd 770 [Datapath actions: 9,55,10,55,66,11,77,88,9,1
f694937d 771])
023e1e0a 772OVS_VSWITCHD_STOP
f694937d 773AT_CLEANUP
8e9ce036 774
f0fd1a17
PS
775AT_SETUP([ofproto-dpif - dec_ttl])
776OVS_VSWITCHD_START
ca5792f0 777add_of_ports br0 1 2 3 4
f0fd1a17
PS
778AT_DATA([flows.txt], [dnl
779table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
780table=1 in_port=1 action=dec_ttl,output:3
781])
782AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8249a1fe 783AT_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])
ce58df5b 784AT_CHECK([tail -4 stdout], [0],
16194afd 785 [Megaflow: recirc_id=0,ip,in_port=1,nw_ttl=2,nw_frag=no
d23df9a8 786Datapath actions: set(ipv4(ttl=1)),2,4
6a7e895f
BP
787This flow is handled by the userspace slow path because it:
788 - Sends "packet-in" messages to the OpenFlow controller.
f0fd1a17 789])
8249a1fe 790AT_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 791AT_CHECK([tail -2 stdout], [0],
16194afd 792 [Megaflow: recirc_id=0,ip,in_port=1,nw_ttl=3,nw_frag=no
d23df9a8 793Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
f0fd1a17 794])
50aa28fd 795AT_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 796AT_CHECK([tail -2 stdout], [0],
16194afd 797 [Megaflow: recirc_id=0,ipv6,in_port=1,nw_ttl=128,nw_frag=no
d23df9a8 798Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
f0fd1a17
PS
799])
800
982697a4 801AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 802AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8249a1fe 803AT_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])
d9c8c57c 804OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
f0fd1a17 805AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8249a1fe 806NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
e6d9ab56 807ip,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
808])
809OVS_VSWITCHD_STOP
810AT_CLEANUP
811
65bfce4a
SH
812dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
813dnl buffer to be resized just before pushing the id of the dec_ttl action.
814dnl Thus the implementation must account for this by using the
815dnl reallocated buffer rather than the original buffer.
816dnl
817dnl A number of similar rules are added to try and exercise
818dnl xrealloc sufficiently that it returns a different base pointer
819AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
820OVS_VSWITCHD_START
ca5792f0 821add_of_ports br0 1
65bfce4a
SH
822(for i in `seq 0 255`; do
823 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
824 done) > flows.txt
825AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
826OVS_VSWITCHD_STOP
827AT_CLEANUP
828
829dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
830dnl buffer to be resized just before pushing the id of the dec_ttl action.
831dnl Thus the implementation must account for this by using the
832dnl reallocated buffer rather than the original buffer.
833dnl
834dnl A number of similar rules are added to try and exercise
835dnl xrealloc sufficiently that it returns a different base pointer
836AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
837OVS_VSWITCHD_START
ca5792f0 838add_of_ports br0 1
65bfce4a
SH
839(for i in `seq 0 255`; do
840 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
841 done) > flows.txt
842AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
843OVS_VSWITCHD_STOP
844AT_CLEANUP
845
846dnl A note action at offset 24 in ofpacts will cause the ofpacts
847dnl buffer to be resized just before pushing the id of the dec_ttl action.
848dnl Thus the implementation must account for this by using the
849dnl reallocated buffer rather than the original buffer.
850dnl
851dnl A number of similar rules are added to try and exercise
852dnl xrealloc sufficiently that it returns a different base pointer
853AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
854OVS_VSWITCHD_START
ca5792f0 855add_of_ports br0 1
65bfce4a
SH
856(for i in `seq 0 255`; do
857 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
858 done) > flows.txt
859AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
860OVS_VSWITCHD_STOP
861AT_CLEANUP
f0fd1a17 862
ace39a6f
JS
863dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
864dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
865dnl Using `make check-valgrind' here checks for use-after-free in this
866dnl codepath.
867AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
868OVS_VSWITCHD_START
869AT_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'])
870OVS_VSWITCHD_STOP
871AT_CLEANUP
872
77750738 873AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
e44768b7 874OVS_VSWITCHD_START
ca5792f0 875add_of_ports br0 1 2
77750738 876
77750738
JP
877AT_CHECK([ovs-ofctl add-flow br0 action=normal])
878
879# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 880flow="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 881AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
72d64e33
EJ
882AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
8831
8842
885100
886])
77750738
JP
887
888OVS_VSWITCHD_STOP
889AT_CLEANUP
890
8b36f51e 891AT_SETUP([ofproto-dpif - DSCP])
8b36f51e 892OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
ca5792f0 893add_of_ports br0 9
8b36f51e 894AT_DATA([flows.txt], [dnl
bdda5aca 895actions=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
896])
897AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
898AT_CHECK([ovs-vsctl -- \
899 set Port p1 qos=@newqos --\
900 --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
901 --id=@q1 create Queue dscp=1 --\
902 --id=@q2 create Queue dscp=2], [0], [ignore])
50aa28fd 903AT_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 904AT_CHECK([tail -2 stdout], [0],
d23df9a8 905 [Megaflow: recirc_id=0,skb_priority=0,ip,in_port=9,nw_tos=252,nw_frag=no
ce58df5b 906Datapath actions: dnl
e44768b7 907100,dnl
d23df9a8
JR
908set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
909set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
8b36f51e 9101,dnl
d23df9a8
JR
911set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
912set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
913set(ipv4(tos=0/0xfc)),1,100
8b36f51e
EJ
914])
915OVS_VSWITCHD_STOP
916AT_CLEANUP
917
fd19297b 918AT_SETUP([ofproto-dpif - output/flood flags])
f7b8e494 919OVS_VSWITCHD_START
ca5792f0 920add_of_ports br0 1 2 3 4 5 6 7
fd19297b
EJ
921
922AT_DATA([flows.txt], [dnl
a0fbe94a 923in_port=local actions=local,flood
fd19297b
EJ
924in_port=1 actions=flood
925in_port=2 actions=all
bdda5aca
BP
926in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
927in_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
928])
929AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
930AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
931AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
932
50aa28fd 933AT_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
934AT_CHECK([tail -1 stdout \
935| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
9361
9372
9383
9394
9407
941])
942
50aa28fd 943AT_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
944AT_CHECK([tail -1 stdout \
945| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
e44768b7 946100
fd19297b
EJ
9472
9483
9494
9507
951])
952
50aa28fd 953AT_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
954AT_CHECK([tail -1 stdout \
955| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
fd19297b 9561
e44768b7 957100
fd19297b
EJ
9583
9594
9606
9617
962])
963
50aa28fd 964AT_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 965AT_CHECK([tail -1 stdout], [0],
e44768b7 966 [Datapath actions: 100,1,2,4,6,7
fd19297b
EJ
967])
968
50aa28fd 969AT_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 970AT_CHECK([tail -1 stdout], [0],
1b567fb9 971 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
fd19297b
EJ
972])
973OVS_VSWITCHD_STOP
974AT_CLEANUP
975
6b83a3c5 976AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
6d328fa2
SH
977OVS_VSWITCHD_START([dnl
978 add-port br0 p1 -- set Interface p1 type=dummy
979])
53eb8cb8 980on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
981
982AT_CAPTURE_FILE([ofctl_monitor.log])
983
6409e008 984AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
985
986for i in 1 2 3 ; do
ea2735d3 987 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 988done
8bd16974 989OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 990OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2 991AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 992NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 993tcp,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 994dnl
efe179e0 995NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 996tcp,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 997dnl
efe179e0 998NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 999tcp,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
1000])
1001
1002AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1003AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1004NXST_FLOW reply:
1005])
1006
1007OVS_VSWITCHD_STOP
1008AT_CLEANUP
1009
6b83a3c5
SH
1010AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
1011OVS_VSWITCHD_START([dnl
1012 add-port br0 p1 -- set Interface p1 type=dummy
1013])
53eb8cb8 1014on_exit 'kill `cat ovs-ofctl.pid`'
6b83a3c5
SH
1015
1016AT_CAPTURE_FILE([ofctl_monitor.log])
1017AT_CHECK([ovs-ofctl del-flows br0])
1018
6409e008 1019AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6b83a3c5 1020
40ebbf78 1021dnl Test that missed packets are dropped
6b83a3c5 1022for i in 1 2 3 ; do
ea2735d3 1023 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 1024done
d9c8c57c 1025OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6b83a3c5
SH
1026
1027AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1028])
1029
1030AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1031AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1032OFPST_FLOW reply (OF1.3):
1033])
1034
1035OVS_VSWITCHD_STOP
1036AT_CLEANUP
1037
6d328fa2
SH
1038AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
1039OVS_VSWITCHD_START([dnl
1040 add-port br0 p1 -- set Interface p1 type=dummy
1041])
53eb8cb8 1042on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1043
1044AT_CAPTURE_FILE([ofctl_monitor.log])
1045AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1046
6409e008 1047AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1048
1049for i in 1 2 3 ; do
8e4c1621 1050 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 1051done
8bd16974 1052OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1053OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2 1054AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1055OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1056tcp,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 1057dnl
efe179e0 1058OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1059tcp,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 1060dnl
efe179e0 1061OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1062tcp,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
1063])
1064
cea4a6d7 1065AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1066AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 1067 n_packets=3, n_bytes=162, actions=goto_table:1
6d328fa2
SH
1068OFPST_FLOW reply (OF1.2):
1069])
1070
1071OVS_VSWITCHD_STOP
1072AT_CLEANUP
1073
1074AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
1075OVS_VSWITCHD_START([dnl
1076 add-port br0 p1 -- set Interface p1 type=dummy
1077])
53eb8cb8 1078on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1079
1080AT_CAPTURE_FILE([ofctl_monitor.log])
1081AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1082
6409e008 1083AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1084
1085for i in 1 2 3 ; do
1086 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)'
1087done
1088
d9c8c57c 1089OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1090AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1091])
1092
cea4a6d7 1093AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1094AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 1095 n_packets=3, n_bytes=162, actions=resubmit(1,1)
6d328fa2
SH
1096OFPST_FLOW reply (OF1.2):
1097])
1098
1099OVS_VSWITCHD_STOP
1100AT_CLEANUP
1101
1102AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1103OVS_VSWITCHD_START([dnl
1104 add-port br0 p1 -- set Interface p1 type=dummy
1105])
53eb8cb8 1106on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1107
1108AT_CAPTURE_FILE([ofctl_monitor.log])
1109AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1110AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1111
1112dnl Miss table 0, Hit table 1
6409e008 1113AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1114
1115for i in 1 2 3 ; do
1116 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)'
1117done
8bd16974 1118OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1119OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1120
1121AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1122NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1123tcp,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:2e70
6d328fa2 1124dnl
efe179e0 1125NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1126tcp,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:2e70
6d328fa2 1127dnl
efe179e0 1128NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1129tcp,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:2e70
6d328fa2
SH
1130])
1131
1132dnl Hit table 0, Miss all other tables, sent to controller
6409e008 1133AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1134
1135for i in 1 2 3 ; do
1136 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)'
1137done
8bd16974 1138OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1139OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1140
1141AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1142NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1143tcp,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:2e70
6d328fa2 1144dnl
efe179e0 1145NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1146tcp,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:2e70
6d328fa2 1147dnl
efe179e0 1148NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1149tcp,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:2e70
6d328fa2
SH
1150])
1151
cea4a6d7 1152AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1153AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 1154 table=1, n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
6d328fa2
SH
1155OFPST_FLOW reply (OF1.2):
1156])
1157
1158OVS_VSWITCHD_STOP
1159AT_CLEANUP
1160
1161AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1162OVS_VSWITCHD_START([dnl
1163 add-port br0 p1 -- set Interface p1 type=dummy
1164])
53eb8cb8 1165on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1166
1167AT_CAPTURE_FILE([ofctl_monitor.log])
1168AT_DATA([flows.txt], [dnl
1169table=0 actions=goto_table(1)
1170table=2 dl_src=10:11:11:11:11:11 actions=controller
1171])
1172AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1173AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1174
1175dnl Hit table 0, Miss table 1, Hit table 2
6409e008 1176AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1177
1178for i in 1 2 3 ; do
1179 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)'
1180done
8bd16974 1181OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1182OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1183
1184AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1185NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1186tcp,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:2e70
6d328fa2 1187dnl
efe179e0 1188NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1189tcp,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:2e70
6d328fa2 1190dnl
efe179e0 1191NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1192tcp,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:2e70
6d328fa2
SH
1193])
1194
1195dnl Hit table 1, Miss all other tables, sent to controller
6409e008 1196AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1197
1198for i in 1 2 3 ; do
1199 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)'
1200done
8bd16974 1201OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1202OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1203
1204AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1205NXT_PACKET_IN (xid=0x0): table_id=253 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=ack tcp_csum:2e70
6d328fa2 1207dnl
efe179e0 1208NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1209tcp,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:2e70
6d328fa2 1210dnl
efe179e0 1211NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1212tcp,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:2e70
6d328fa2
SH
1213])
1214
cea4a6d7 1215AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1216AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
1217 n_packets=6, n_bytes=324, actions=goto_table:1
1218 table=2, n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
6d328fa2
SH
1219OFPST_FLOW reply (OF1.2):
1220])
1221
1222OVS_VSWITCHD_STOP
1223AT_CLEANUP
1224
1225AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1226OVS_VSWITCHD_START([dnl
1227 add-port br0 p1 -- set Interface p1 type=dummy
1228])
53eb8cb8 1229on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1230
1231AT_CAPTURE_FILE([ofctl_monitor.log])
1232AT_DATA([flows.txt], [dnl
1233table=0 actions=resubmit(1,1)
1234table=2 dl_src=10:11:11:11:11:11 actions=controller
1235])
1236AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1237AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1238
1239dnl Hit table 0, Miss table 1, Dropped
6409e008 1240AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1241
1242for i in 1 2 3 ; do
1243 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)'
1244done
0c473314 1245OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1246
1247AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1248])
1249
1250dnl Hit table 1, Dropped
6409e008 1251AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1252
1253for i in 1 2 3 ; do
1254 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)'
1255done
d9c8c57c 1256OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1257
1258AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1259])
1260
cea4a6d7 1261AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1262AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 1263 n_packets=6, n_bytes=324, actions=resubmit(1,1)
6d328fa2
SH
1264 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1265OFPST_FLOW reply (OF1.2):
1266])
1267
1268OVS_VSWITCHD_STOP
1269AT_CLEANUP
1270
1271AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1272OVS_VSWITCHD_START([dnl
1273 add-port br0 p1 -- set Interface p1 type=dummy
1274])
53eb8cb8 1275on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1276
1277AT_CAPTURE_FILE([ofctl_monitor.log])
1278AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1279
6409e008 1280AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1281
40ebbf78 1282dnl Test that missed packets are dropped
6d328fa2
SH
1283for i in 1 2 3 ; do
1284 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)'
1285done
d9c8c57c 1286OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1287
1288AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1289])
1290
1291AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1292AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1293NXST_FLOW reply:
1294])
1295
1296OVS_VSWITCHD_STOP
1297AT_CLEANUP
1298
1299AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1300OVS_VSWITCHD_START([dnl
1301 add-port br0 p1 -- set Interface p1 type=dummy
1302])
53eb8cb8 1303on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1304
1305AT_CAPTURE_FILE([ofctl_monitor.log])
1306AT_CHECK([ovs-ofctl del-flows br0])
1307AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1308AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1309
6409e008 1310AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1311
40ebbf78 1312dnl Test that missed packets are dropped
6d328fa2
SH
1313for i in 1 2 3 ; do
1314 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)'
1315done
d9c8c57c 1316OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1317
1318AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1319])
1320
cea4a6d7 1321AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1322AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 1323 n_packets=3, n_bytes=162, actions=goto_table:1
6d328fa2
SH
1324OFPST_FLOW reply (OF1.2):
1325])
1326
1327OVS_VSWITCHD_STOP
1328AT_CLEANUP
1329
1330AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1331OVS_VSWITCHD_START([dnl
1332 add-port br0 p1 -- set Interface p1 type=dummy
1333])
53eb8cb8 1334on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1335
1336AT_CAPTURE_FILE([ofctl_monitor.log])
1337AT_CHECK([ovs-ofctl del-flows br0])
1338AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1339AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1340
6409e008 1341AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1342
40ebbf78 1343dnl Test that missed packets are dropped
6d328fa2
SH
1344for i in 1 2 3 ; do
1345 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)'
1346done
d9c8c57c 1347OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1348
1349AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1350])
1351
cea4a6d7 1352AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1353AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 1354 n_packets=3, n_bytes=162, actions=resubmit(1,1)
6d328fa2
SH
1355OFPST_FLOW reply (OF1.2):
1356])
1357
1358OVS_VSWITCHD_STOP
1359AT_CLEANUP
1360
15056dc8
EJ
1361AT_SETUP([ofproto-dpif - controller])
1362OVS_VSWITCHD_START([dnl
1363 add-port br0 p1 -- set Interface p1 type=dummy
1364])
53eb8cb8 1365on_exit 'kill `cat ovs-ofctl.pid`'
15056dc8
EJ
1366
1367AT_CAPTURE_FILE([ofctl_monitor.log])
1368AT_DATA([flows.txt], [dnl
1369cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
54834960 1370cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
15056dc8
EJ
1371cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1372
54834960
EJ
1373cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1374cookie=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)
1375cookie=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)
1376cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1377cookie=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)
1378cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1379cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
78cef7fd 1380cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
56d72f37 1381cookie=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
1382])
1383AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1384
1385dnl Flow miss.
6409e008 1386AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1387
1388for i in 1 2 3 ; do
dc235f7f 1389 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 1390done
57c94f35 1391OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1392OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1393
15056dc8 1394AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1395OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1396tcp,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:2e70
15056dc8 1397dnl
efe179e0 1398OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1399tcp,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:2e70
15056dc8 1400dnl
efe179e0 1401OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1402tcp,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:2e70
15056dc8
EJ
1403])
1404
1405dnl Singleton controller action.
6409e008 1406AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1407
1408for i in 1 2 3 ; do
dc235f7f 1409 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 1410done
57c94f35 1411OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1412OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1413
15056dc8 1414AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1415OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1416tcp,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 1417dnl
efe179e0 1418OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1419tcp,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 1420dnl
efe179e0 1421OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1422tcp,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
1423])
1424
1425dnl Modified controller action.
6409e008 1426AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1427
1428for i in 1 2 3 ; do
dc235f7f 1429 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 1430done
57c94f35 1431OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1432OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1433
15056dc8 1434AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1435OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1436tcp,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 1437dnl
efe179e0 1438OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1439tcp,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 1440dnl
efe179e0 1441OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1442tcp,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
1443])
1444
363dd1d9 1445dnl Modified VLAN controller action.
6409e008 1446AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
363dd1d9
JS
1447
1448for i in 1 2 3; do
8249a1fe 1449 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 1450done
57c94f35 1451OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1452OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
363dd1d9 1453
363dd1d9 1454AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1455NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1456ip,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 1457dnl
efe179e0 1458NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1459ip,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 1460dnl
efe179e0 1461NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1462ip,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
1463])
1464
349fbdc2 1465dnl Checksum TCP.
6409e008 1466AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1467
1468for i in 1 ; do
1469 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)'
1470done
1471OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1472OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1473
1474AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1475NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1476tcp,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 1477dnl
efe179e0 1478NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=58 reg0=0x1,in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1479tcp,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 1480dnl
efe179e0 1481NXT_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 1482tcp,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 1483dnl
efe179e0 1484NXT_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 1485tcp,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 1486dnl
efe179e0 1487NXT_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 1488tcp,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 1489dnl
efe179e0 1490NXT_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 1491tcp,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 1492dnl
efe179e0 1493NXT_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 1494tcp,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 1495dnl
efe179e0 1496NXT_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 1497tcp,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 1498dnl
efe179e0 1499NXT_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 1500tcp,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
1501])
1502
1503dnl Checksum UDP.
6409e008 1504AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1505
1506for i in 1 ; do
1507 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'
1508done
1509OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1510OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1511
1512AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1513NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1514udp,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 1515dnl
50dcbd8e 1516NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
f0fb825a 1517udp,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 1518dnl
50dcbd8e 1519NXT_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 1520udp,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 1521dnl
50dcbd8e 1522NXT_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 1523udp,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 1524dnl
50dcbd8e 1525NXT_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 1526udp,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 1527dnl
50dcbd8e 1528NXT_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 1529udp,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 1530dnl
50dcbd8e 1531NXT_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 1532udp,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 1533dnl
50dcbd8e 1534NXT_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 1535udp,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 1536dnl
50dcbd8e 1537NXT_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 1538udp,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
1539])
1540
1541dnl Modified ARP controller action.
6409e008 1542AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1543
1544for i in 1 2 3; do
1545 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)'
1546done
1547
368a198a 1548OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1549OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2 1550AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1551NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1552arp,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 1553NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1554arp,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 1555NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1556arp,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 1557NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1558arp,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 1559NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1560arp,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 1561NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1562arp,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 1563NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1564arp,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 1565NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1566arp,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 1567NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1568arp,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
1569])
1570
1571AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1572
1573dnl Checksum SCTP.
6409e008 1574AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1575
1576for i in 1 ; do
1577 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'
1578done
1579
f7a22c7e 1580AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
349fbdc2 1581OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1582OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1583AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1584NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
e6d9ab56 1585sctp,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 1586dnl
50dcbd8e 1587NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
f0fb825a 1588sctp,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 1589dnl
50dcbd8e 1590NXT_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 1591sctp,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 1592dnl
50dcbd8e 1593NXT_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 1594sctp,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 1595dnl
50dcbd8e 1596NXT_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 1597sctp,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 1598dnl
50dcbd8e 1599NXT_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 1600sctp,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 1601dnl
50dcbd8e 1602NXT_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 1603sctp,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 1604dnl
50dcbd8e 1605NXT_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 1606sctp,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 1607dnl
50dcbd8e 1608NXT_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 1609sctp,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
1610])
1611
1612AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
1613 cookie=0x1, n_packets=3, n_bytes=212, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1614 cookie=0x2, n_packets=3, n_bytes=162, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1615 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)
1616 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)
1617 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)
1618 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)
1619 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)
1620 cookie=0x8, table=6, n_packets=3, n_bytes=212, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1621 cookie=0x9, table=7, n_packets=3, n_bytes=212, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1622 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
1623 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
1624 n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
349fbdc2
SH
1625NXST_FLOW reply:
1626])
1627
1628OVS_VSWITCHD_STOP
1629AT_CLEANUP
1630
1dea1435 1631AT_SETUP([ofproto-dpif - controller action without megaflows])
1632OVS_VSWITCHD_START
1633add_of_ports br0 1
1634
1635AT_CHECK([ovs-ofctl add-flow br0 in_port=1,action=controller])
1636AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [dnl
1637megaflows disabled
1638])
1639
1640AT_CAPTURE_FILE([ofctl_monitor.log])
1641AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1642
1643for i in 1 2; do
1644 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)'])
1645done
1646
1647OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
1648OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1649
1650AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1651flow-dump from non-dpdk interfaces:
1652packets:1, bytes:14, used:0.001s, actions:userspace(pid=0,slow_path(controller))
1653])
1654
1655AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1656NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1657vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1658NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1659vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1660])
1661
af7535e7
AZ
1662AT_CHECK([ovs-appctl revalidator/purge])
1663AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1664
1665dnl Add a controller meter.
1666AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=controller pktps stats bands=type=drop rate=1'])
1667
1668dnl Advance time by 1 second.
1669AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1670
1671for i in `seq 1 8`; do
1672 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)'])
1673done
1674
1675AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1676flow-dump from non-dpdk interfaces:
1677packets:7, bytes:98, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,slow_path(controller))))
1678])
1679
1680AT_CHECK([ovs-appctl time/warp 1], [0], [ignore])
1681OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1682
1683dnl Out of 8 packets we sent, one executes the controller action via
1684dnl miss upcall. Another one got passed the rate limiter.
1685dnl The rest of packets are blocked by the rate limiter.
1686AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1687NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1688vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1689NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1690vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1691])
1692dnl Check meter stats to make it gives the same picture;
1693dnl 7 packets hit the meter, but 6 packets are dropped by band0.
bad98905 1694AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
af7535e7 1695OFPST_METER reply (OF1.3) (xid=0x2):
bad98905 1696meter:controller flow_count:0 packet_in_count:7 byte_in_count:98 duration:0.0s bands:
af7535e7
AZ
16970: packet_count:6 byte_count:84
1698])
1699
1dea1435 1700OVS_VSWITCHD_STOP
1701AT_CLEANUP
1702
349fbdc2
SH
1703AT_SETUP([ofproto-dpif - MPLS handling])
1704OVS_VSWITCHD_START([dnl
1705 add-port br0 p1 -- set Interface p1 type=dummy
1706])
53eb8cb8 1707on_exit 'kill `cat ovs-ofctl.pid`'
349fbdc2
SH
1708
1709AT_CAPTURE_FILE([ofctl_monitor.log])
1710AT_DATA([flows.txt], [dnl
1711cookie=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
1712cookie=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
1713cookie=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
1714cookie=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
1715cookie=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
1716cookie=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
1717cookie=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
1718cookie=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 1719cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
349fbdc2
SH
1720cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1721cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1722cookie=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
1723
1724cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1725cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1726cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1727cookie=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 1728cookie=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
1729cookie=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
1730cookie=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
1731
1732cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1733cookie=0xd table=1 arp actions=controller
1734
e672ff9b
JR
1735cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1736cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1ffd16af
SH
1737cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1738cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1739
1740cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1741cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1742cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1743
1744cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
e672ff9b
JR
1745cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1746cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1ffd16af 1747
e672ff9b
JR
1748cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1749cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1750cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 1751
e672ff9b
JR
1752cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1753cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1754cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 1755
e672ff9b
JR
1756cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1757cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1758cookie=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
1759])
1760AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1761
b02475c5 1762dnl Modified MPLS controller action.
6409e008 1763AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1764
1765for i in 1 2 3; do
791a09be 1766 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 1767done
57c94f35 1768OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1769OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1770
b02475c5 1771AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1772NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
e6d9ab56 1773mpls,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 1774dnl
efe179e0 1775NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
e6d9ab56 1776mpls,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 1777dnl
efe179e0 1778NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
e6d9ab56 1779mpls,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
1780])
1781
1782dnl Modified MPLS controller action.
6409e008 1783AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5 1784
b0a17866 1785for i in 1 2 3; do
8249a1fe 1786 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
1787done
1788OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1789OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b0a17866
SH
1790
1791AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1792NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 1793ip,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 1794dnl
efe179e0 1795NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 1796ip,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 1797dnl
efe179e0 1798NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 1799ip,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
1800])
1801
1802dnl Modified MPLS controller action.
6409e008 1803AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b0a17866 1804
b02475c5
SH
1805dnl 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)
1806
1807for i in 1 2 3; do
1808 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)'
1809done
bece9ea7 1810OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1811OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
bece9ea7 1812
b02475c5 1813AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1814NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 1815mpls,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 1816dnl
efe179e0 1817NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 1818mpls,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 1819dnl
efe179e0 1820NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 1821mpls,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
1822])
1823
1824dnl Modified MPLS controller action.
6409e008 1825AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1826
1827for i in 1 2 3; do
8249a1fe 1828 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 1829done
57c94f35 1830OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1831OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1832
b02475c5 1833AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1834NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 1835mpls,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 1836dnl
efe179e0 1837NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 1838mpls,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 1839dnl
efe179e0 1840NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 1841mpls,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
1842])
1843
b676167a 1844dnl Modified MPLS controller action.
6409e008 1845AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b676167a
SH
1846
1847for i in 1 2 3; do
8249a1fe 1848 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 1849done
57c94f35 1850OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1851OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b676167a 1852
b676167a 1853AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1854NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1855mpls,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 1856dnl
efe179e0 1857NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1858mpls,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 1859dnl
efe179e0 1860NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1861mpls,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
1862])
1863
0f3f3c3d 1864dnl Modified MPLS controller action.
6409e008 1865AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
1866
1867for i in 1 2 3; do
8249a1fe 1868 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 1869done
57c94f35 1870OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1871OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 1872
0f3f3c3d 1873AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1874NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1875mpls,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 1876dnl
efe179e0 1877NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1878mpls,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 1879dnl
efe179e0 1880NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1881mpls,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
1882])
1883
1884dnl Modified MPLS controller action.
6409e008 1885AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
1886
1887for i in 1 2 3; do
8249a1fe 1888 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 1889done
57c94f35 1890OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1891OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 1892
0f3f3c3d 1893AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1894NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1895mpls,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 1896dnl
efe179e0 1897NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1898mpls,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 1899dnl
efe179e0 1900NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1901mpls,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
1902])
1903
1ffd16af
SH
1904AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1905
1906dnl Modified MPLS controller action.
6409e008 1907AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1908
1909for i in 1 2 3; do
1910 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)'
1911done
1912OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1913OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1ffd16af
SH
1914
1915AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1916NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 1917mplsm,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 1918dnl
efe179e0 1919NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 1920mplsm,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 1921dnl
efe179e0 1922NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 1923mplsm,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
1924])
1925
1926AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1927
0f3f3c3d 1928dnl Modified MPLS controller action.
6409e008 1929AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
1930
1931for i in 1 2 3; do
8249a1fe 1932 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 1933done
57c94f35 1934OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1935OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 1936
0f3f3c3d 1937AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1938NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1939mpls,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 1940dnl
efe179e0 1941NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1942mpls,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 1943dnl
efe179e0 1944NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 1945mpls,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
1946])
1947
b02475c5 1948dnl Modified MPLS actions.
6409e008 1949AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1950
1951for i in 1 2 3; do
02830175 1952 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 1953done
57c94f35 1954OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1955OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1956
b02475c5 1957AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1958NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 1959mpls,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 1960dnl
efe179e0 1961NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 1962mpls,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 1963dnl
efe179e0 1964NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 1965mpls,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
1966])
1967
1968dnl Modified MPLS ipv6 controller action.
6409e008 1969AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1970
1971for i in 1 2 3; do
1972 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)'
1973done
57c94f35 1974OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1975OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1976
b02475c5 1977AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1978NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1979mplsm,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 1980dnl
efe179e0 1981NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1982mplsm,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 1983dnl
efe179e0 1984NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1985mplsm,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
1986])
1987
1988
1989dnl Modified MPLS pop action.
cff78c88
SH
1990dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
1991dnl 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)
1992dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
1993
6409e008 1994AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1995
1996for i in 1 2 3; do
cff78c88 1997 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 1998done
cff78c88
SH
1999#for i in 2 3; do
2000# 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)'
2001#done
57c94f35 2002OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2003OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2004
b02475c5 2005AT_CHECK([cat ofctl_monitor.log], [0], [dnl
cff78c88 2006NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2007tcp,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 2008dnl
cff78c88 2009NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2010tcp,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 2011dnl
cff78c88 2012NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2013tcp,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
2014])
2015
5c0243a9 2016AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
0d56eaf2 2017
1ffd16af
SH
2018dnl Modified MPLS pop action.
2019dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2020dnl 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)
2021dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2022dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2023AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2024
2025for i in 1 2 3; do
2026 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'
2027done
2028OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2029OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2030
2be3fe44 2031AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2032NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2033tcp,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 2034dnl
e672ff9b 2035NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2036tcp,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 2037dnl
e672ff9b 2038NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2039tcp,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
2040])
2041
2042AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2043
2044dnl Modified MPLS pop action.
2045dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2046dnl 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)
2047dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2048dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2049AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2050
2051for i in 1 2 3; do
2052 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'
2053done
2054OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2055OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2056
2be3fe44 2057AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2058NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2059tcp,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 2060dnl
e672ff9b 2061NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2062tcp,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 2063dnl
e672ff9b 2064NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2065tcp,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
2066])
2067
2068AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2069
2070dnl Modified MPLS pop action.
2071dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2072dnl 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)
2073dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2074dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2075AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2076
2077for i in 1 2 3; do
2078 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'
2079done
2080OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2081OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2082
2be3fe44 2083AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2084NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2085tcp,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 2086dnl
e672ff9b 2087NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2088tcp,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 2089dnl
e672ff9b 2090NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2091tcp,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
2092])
2093
2094AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2095
2096dnl Modified MPLS pop action.
2097dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2098dnl 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)
2099dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2100dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2101AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2102
2103for i in 1 2 3; do
2104 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'
2105done
2106OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2107OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2108
2be3fe44 2109AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2110NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2111tcp,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 2112dnl
e672ff9b 2113NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2114tcp,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 2115dnl
e672ff9b 2116NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2117tcp,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
2118])
2119
2120AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2121
2122dnl Modified MPLS pop action.
2123dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2124dnl 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)
2125dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2126dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2127AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2128
2129for i in 1 2 3; do
2130 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'
2131done
2132OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2133OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2134
2be3fe44 2135AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2136NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2137tcp,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 2138dnl
e672ff9b 2139NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2140tcp,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 2141dnl
e672ff9b 2142NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2143tcp,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
2144])
2145
2146AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2147
2148dnl Modified MPLS pop action.
2149dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2150dnl 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)
2151dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2152dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2153AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2154
2155for i in 1 2 3; do
2156 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'
2157done
2158OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2159OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2160
2be3fe44 2161AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2162NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2163tcp,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 2164dnl
e672ff9b 2165NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2166tcp,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 2167dnl
e672ff9b 2168NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2169tcp,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
2170])
2171
2172AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2173
2174dnl Modified MPLS pop action.
2175dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2176dnl 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)
2177dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2178dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2179AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2180
2181for i in 1 2 3; do
2182 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'
2183done
2184OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2185OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2186
2be3fe44 2187AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2188NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2189tcp,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 2190dnl
e672ff9b 2191NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2192tcp,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 2193dnl
e672ff9b 2194NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2195tcp,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
2196])
2197
2198AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2199
2200dnl Modified MPLS pop action.
2201dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2202dnl 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 2203AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2204
2205for i in 1 2 3; do
2206 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'
2207done
2208OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2209OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2210
2be3fe44 2211AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
efe179e0 2212NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2213arp,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 2214dnl
efe179e0 2215NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2216arp,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 2217dnl
efe179e0 2218NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2219arp,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
2220])
2221
2222AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2223
2224dnl Modified MPLS pop action.
2225dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2226dnl 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)
2227dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2228dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2229AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2230
2231for i in 1 2 3; do
2232 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'
2233done
2234OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2235OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2236
2be3fe44 2237AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2238NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2239tcp,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 2240dnl
e672ff9b 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: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 2243dnl
e672ff9b 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: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
2246])
2247
2248AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2249
2250dnl Modified MPLS pop action.
2251dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2252dnl 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)
2253dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2254dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2255AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2256
2257for i in 1 2 3; do
2258 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'
2259done
2260OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2261OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2262
2be3fe44 2263AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2264NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2265tcp,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 2266dnl
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: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 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: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
2272])
2273
2274AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2275
2276dnl Modified MPLS pop action.
2277dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2278dnl 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)
2279dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2280dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2281AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2282
2283for i in 1 2 3; do
2284 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'
2285done
2286OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2287OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2288
2be3fe44 2289AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2290NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2291tcp,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 2292dnl
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: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 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: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
2298])
2299
2300AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2301
2302dnl Modified MPLS pop action.
2303dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2304dnl 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)
2305dnl (label 20, exp 0, [S], ttl 31)
2306dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2307dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2308AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2309
2310for i in 1 2 3; do
2311 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'
2312done
2313OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2314OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2315
2316AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2317NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2318mplsm,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
2319dnl
2320NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2321mplsm,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
2322dnl
2323NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2324mplsm,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
2325])
2326
2327AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2328
2329dnl Modified MPLS pop action.
2330dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2331dnl 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)
2332dnl (label 20, exp 0, [S], ttl 31)
2333dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2334dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2335AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2336
2337for i in 1 2 3; do
2338 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'
2339done
2340OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2341OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2342
2343AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2344NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2345mpls,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 2346dnl
e672ff9b 2347NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2348mpls,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 2349dnl
e672ff9b 2350NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2351mpls,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
2352])
2353
2354AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2355
2356dnl Modified MPLS pop action.
2357dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2358dnl 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)
2359dnl (label 20, exp 0, [S], ttl 31)
2360dnl (tos 0x0, ttl 254, 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 0x7744 (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 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'
2366done
2367OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2368OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2369
2370AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2371NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2372mplsm,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
2373dnl
2374NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2375mplsm,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
2376dnl
2377NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2378mplsm,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
2379])
2380
2381AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2382
2383dnl Modified MPLS pop action.
2384dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2385dnl 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)
2386dnl (label 20, exp 0, [S], ttl 31)
2387dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2388dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2389AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2390
2391for i in 1 2 3; do
2392 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'
2393done
2394OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2395OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2396
2397AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2398NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2399tcp,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 2400dnl
e672ff9b 2401NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2402tcp,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 2403dnl
e672ff9b 2404NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2405tcp,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
2406])
2407
2408AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2409
2410dnl Modified MPLS pop action.
2411dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2412dnl 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)
2413dnl (label 20, exp 0, [S], ttl 31)
2414dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2415dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2416AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2417
2418for i in 1 2 3; do
2419 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'
2420done
e672ff9b 2421
1ffd16af
SH
2422OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2423OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2424
2be3fe44 2425AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2426NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2427tcp,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 2428dnl
e672ff9b 2429NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2430tcp,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 2431dnl
e672ff9b 2432NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2433tcp,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
2434])
2435
2436AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2437
2438dnl Modified MPLS pop action.
2439dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2440dnl 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)
1ffd16af
SH
2441dnl (label 20, exp 0, [S], ttl 31)
2442dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2443dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2444AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2445
2446for i in 1 2 3; do
2447 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'
2448done
2449OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2450OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2451
2be3fe44 2452AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2453NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2454tcp,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 2455dnl
e672ff9b 2456NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2457tcp,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 2458dnl
e672ff9b 2459NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2460tcp,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
2461])
2462
2463AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2464
2465dnl Modified MPLS pop action.
2466dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2467dnl 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)
1ffd16af
SH
2468dnl (label 20, exp 0, ttl 31)
2469dnl (label 20, exp 0, [S], ttl 30)
2470dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2471dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2472AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2473
2474for i in 1 2 3; do
2475 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'
2476done
2477OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2478OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2479
2480AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2481NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2482mplsm,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 2483dnl
e672ff9b 2484NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2485mplsm,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 2486dnl
e672ff9b 2487NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2488mplsm,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
2489])
2490
2491AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2492
2493dnl Modified MPLS pop action.
2494dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2495dnl 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)
2496dnl (label 20, exp 0, ttl 31)
2497dnl (label 20, exp 0, [S], ttl 30)
2498dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2499dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2500AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2501
2502for i in 1 2 3; do
2503 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'
2504done
2505OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2506OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2507
2508AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2509NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2510mpls,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 2511dnl
e672ff9b 2512NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2513mpls,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 2514dnl
e672ff9b 2515NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2516mpls,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
2517])
2518
2519AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2520
2521dnl Modified MPLS pop action.
2522dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2523dnl 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)
2524dnl (label 20, exp 0, ttl 31)
2525dnl (label 20, exp 0, [S], ttl 30)
2526dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2527dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2528AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2529
2530for i in 1 2 3; do
2531 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'
2532done
2533OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2534OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2535
2536AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2537NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2538mplsm,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 2539dnl
e672ff9b 2540NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2541mplsm,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 2542dnl
e672ff9b 2543NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2544mplsm,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
2545])
2546
2547AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2548
2549dnl Modified MPLS pop action.
2550dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2551dnl 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)
2552dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2553dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2554AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2555
2556for i in 1 2 3; do
2557 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'
2558done
2559OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2560OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2561
2be3fe44 2562AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2563NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2564mpls,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 2565dnl
e672ff9b 2566NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2567mpls,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 2568dnl
e672ff9b 2569NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2570mpls,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
2571])
2572
2573AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2574
2575dnl Modified MPLS pop action.
2576dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2577dnl 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)
2578dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2579dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2580AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2581
2582for i in 1 2 3; do
2583 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'
2584done
2585OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2586OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2587
2be3fe44 2588AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2589NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2590mplsm,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 2591dnl
e672ff9b 2592NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2593mplsm,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 2594dnl
e672ff9b 2595NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2596mplsm,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
2597])
2598
2599AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2600
2601dnl Modified MPLS pop action.
2602dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2603dnl 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)
2604dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2605dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2606AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2607
2608for i in 1 2 3; do
2609 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'
2610done
2611OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2612OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2613
2be3fe44 2614AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2615NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2616mplsm,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 2617dnl
e672ff9b 2618NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2619mplsm,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 2620dnl
e672ff9b 2621NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2622mplsm,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
2623])
2624
2625AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2626
2627dnl Modified MPLS pop action.
2628dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2629dnl 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)
2630dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2631dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2632AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2633
2634for i in 1 2 3; do
2635 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'
2636done
e672ff9b 2637
1ffd16af
SH
2638OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2639OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2640
2641AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2642NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2643mpls,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 2644dnl
e672ff9b 2645NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2646mpls,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 2647dnl
e672ff9b 2648NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2649mpls,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
2650])
2651
2652AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2653
2654dnl Modified MPLS pop action.
2655dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2656dnl 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)
2657dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2658dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2659AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2660
2661for i in 1 2 3; do
2662 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'
2663done
2664OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2665OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2666
2667AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2668NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2669mplsm,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 2670dnl
e672ff9b 2671NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2672mplsm,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 2673dnl
e672ff9b 2674NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2675mplsm,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
2676])
2677
2678AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2679
2680dnl Modified MPLS pop action.
2681dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2682dnl 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)
2683dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2684dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2685AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2686
2687for i in 1 2 3; do
2688 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'
2689done
e672ff9b 2690
1ffd16af
SH
2691OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2692OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2693
2694AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2695NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2696mpls,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 2697dnl
e672ff9b 2698NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2699mpls,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 2700dnl
e672ff9b 2701NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2702mpls,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
2703])
2704
cea4a6d7 2705AT_CHECK([ovs-appctl revalidator/purge], [0])
ef0ce8ae 2706AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
e672ff9b
JR
2707 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
2708 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
2709 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
2710 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
2711 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
2712 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
2713 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
2714 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
2715 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
2716 cookie=0xa, n_packets=3, n_bytes=126, 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
2717 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
2718 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
2719 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
2720 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
2721 cookie=0xd, n_packets=3, n_bytes=138, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
c2d936a4 2722 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
2723 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
2724 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
2725 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 2726 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
2727 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
2728 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 2729 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
1ffd16af
SH
2730 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
2731 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 2732 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
1ffd16af
SH
2733 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2734 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
2735 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
2736 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 2737 cookie=0xd, table=1, n_packets=3, n_bytes=126, arp actions=CONTROLLER:65535
e672ff9b
JR
2738 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
2739 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
2740 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
2741 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
2742 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
2743 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
2744 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
2745 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
2746 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 2747NXST_FLOW reply:
15056dc8
EJ
2748])
2749
2750OVS_VSWITCHD_STOP
8e9ce036 2751AT_CLEANUP
04c956fc 2752
1ffd16af
SH
2753AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2754OVS_VSWITCHD_START([dnl
2755 add-port br0 p1 -- set Interface p1 type=dummy
2756])
53eb8cb8 2757on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
2758
2759AT_CAPTURE_FILE([ofctl_monitor.log])
2760AT_DATA([flows.txt], [dnl
2761table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2762table=1 ip,ip_dscp=8 actions=controller
2763])
2764AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2765
2766
2767dnl Modified MPLS pop action.
2768dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2769dnl 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)
2770dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2771dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2772AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2773
2774for i in 1 2 3; do
2775 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'
2776done
2777OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2778OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2779
2be3fe44 2780AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1ffd16af 2781OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2782tcp,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
2783dnl
2784OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2785tcp,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
2786dnl
2787OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2788tcp,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
2789])
2790
cea4a6d7 2791AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
2792AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2793 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
2794 table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
2795OFPST_FLOW reply (OF1.2):
2796])
2797
2798OVS_VSWITCHD_STOP
2799AT_CLEANUP
2800
2801AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
2802OVS_VSWITCHD_START([dnl
2803 add-port br0 p1 -- set Interface p1 type=dummy
2804])
53eb8cb8 2805on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
2806
2807dnl N.B: The first (and only) action that accesses L3 data after the
2808dnl pop_mpls action is present in write_actions. This exercises recirculation
2809dnl triggered in write_actions due to a previous action not in write actions.
2810AT_CAPTURE_FILE([ofctl_monitor.log])
2811AT_DATA([flows.txt], [dnl
2812mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
2813])
2814AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2815
2816dnl Modified MPLS pop action.
2817dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2818dnl 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)
2819dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2820dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2821AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2822
2823for i in 1 2 3; do
2824 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 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'
2825done
2826OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2827OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2828
2be3fe44 2829AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2830OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2831tcp,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 2832dnl
e672ff9b 2833OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2834tcp,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 2835dnl
e672ff9b 2836OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2837tcp,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
2838])
2839
cea4a6d7 2840AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
2841AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2842 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
2843OFPST_FLOW reply (OF1.2):
2844])
2845
2846OVS_VSWITCHD_STOP
2847AT_CLEANUP
527ae97e
SH
2848
2849AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
2850OVS_VSWITCHD_START([dnl
2851 add-port br0 p1 -- set Interface p1 type=dummy
2852])
53eb8cb8 2853on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
2854
2855AT_CAPTURE_FILE([ofctl_monitor.log])
2856# A table-miss flow has priority 0 and no match
2857AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2858
2859dnl Singleton controller action.
6409e008 2860AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
2861
2862for i in 1 2 3 ; do
2863 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)'
2864done
2865OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2866OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
527ae97e
SH
2867
2868AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2869OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 2870tcp,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 2871dnl
efe179e0 2872OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 2873tcp,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 2874dnl
efe179e0 2875OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 2876tcp,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
2877])
2878
cea4a6d7 2879AT_CHECK([ovs-appctl revalidator/purge], [0])
527ae97e 2880AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 2881 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
527ae97e
SH
2882NXST_FLOW reply:
2883])
2884
2885OVS_VSWITCHD_STOP
2886AT_CLEANUP
2887
2888
2889AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
2890OVS_VSWITCHD_START([dnl
2891 add-port br0 p1 -- set Interface p1 type=dummy
2892])
53eb8cb8 2893on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
2894
2895AT_CAPTURE_FILE([ofctl_monitor.log])
2896# A table-miss flow has priority 0 and no match
2897AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2898
2899dnl Singleton controller action.
6409e008 2900AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
2901
2902for i in 1 2 3 ; do
2903 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)'
2904done
2905OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2906OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
527ae97e
SH
2907
2908AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2909
2910AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2911OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 2912tcp,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 2913dnl
efe179e0 2914OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 2915tcp,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 2916dnl
efe179e0 2917OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 2918tcp,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
2919])
2920
cea4a6d7 2921AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a 2922AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 2923 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
ba96552a
SS
2924OFPST_FLOW reply (OF1.3):
2925])
2926
2927OVS_VSWITCHD_STOP
2928AT_CLEANUP
2929
2930AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
2931OVS_VSWITCHD_START([dnl
2932 add-port br0 p1 -- set Interface p1 type=dummy
2933])
53eb8cb8 2934on_exit 'kill `cat ovs-ofctl.pid`'
ba96552a 2935
5b7278a1
JS
2936ovs-appctl time/stop
2937
ba96552a
SS
2938AT_CAPTURE_FILE([ofctl_monitor.log])
2939# A table-miss flow has priority 0 and no match
2940AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2941
2942dnl Singleton controller action.
6409e008 2943AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
ba96552a
SS
2944
2945# Become slave (OF 1.3), which should disable everything except port status.
2946ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2947
5b7278a1
JS
2948# Ensure that ovs-vswitchd gets a chance to reply before sending another command.
2949ovs-appctl time/warp 500 100
2950
ba96552a
SS
2951# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
2952ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
2953
5b7278a1 2954ovs-appctl time/warp 500 100
ba96552a
SS
2955for i in 1 2 3 ; do
2956 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)'
2957done
2958OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2959OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
ba96552a 2960
cea4a6d7 2961AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a
SS
2962AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2963send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
2964OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
2965dnl
2966send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
2967 master:
2968 PACKET_IN: (off)
2969 PORT_STATUS: (off)
2970 FLOW_REMOVED: (off)
904e5202
BP
2971 ROLE_STATUS: (off)
2972 TABLE_STATUS: (off)
2973 REQUESTFORWARD: (off)
ba96552a
SS
2974
2975 slave:
2976 PACKET_IN: no_match
2977 PORT_STATUS: (off)
2978 FLOW_REMOVED: (off)
904e5202
BP
2979 ROLE_STATUS: (off)
2980 TABLE_STATUS: (off)
2981 REQUESTFORWARD: (off)
ba96552a 2982dnl
efe179e0 2983OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 2984tcp,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 2985dnl
efe179e0 2986OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 2987tcp,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 2988dnl
efe179e0 2989OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 2990tcp,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
2991])
2992
2993AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2994
2995AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 2996 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
527ae97e
SH
2997OFPST_FLOW reply (OF1.3):
2998])
2999
3000OVS_VSWITCHD_STOP
3001AT_CLEANUP
3002
807c7989
SS
3003
3004AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
3005OVS_VSWITCHD_START([dnl
3006 add-port br0 p1 -- set Interface p1 type=dummy
3007])
53eb8cb8 3008on_exit 'kill `cat ovs-ofctl.pid`'
807c7989
SS
3009
3010AT_CAPTURE_FILE([ofctl_monitor.log])
3011# A table-miss flow has priority 0 and no match
3012AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3013
3014dnl Singleton controller action.
6409e008 3015AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
807c7989
SS
3016
3017for i in 1 2 3 ; do
3018 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)'
3019done
3020OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3021OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
807c7989 3022
cea4a6d7 3023AT_CHECK([ovs-appctl revalidator/purge], [0])
807c7989 3024AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3025OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3026tcp,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 3027dnl
efe179e0 3028OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3029tcp,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 3030dnl
efe179e0 3031OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3032tcp,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
3033])
3034
3035AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3036
3037AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3038 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
807c7989
SS
3039OFPST_FLOW reply (OF1.4):
3040])
3041
3042OVS_VSWITCHD_STOP
3043AT_CLEANUP
3044
3045
029ca940 3046AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3a11fd5b
SS
3047OVS_VSWITCHD_START([dnl
3048 add-port br0 p1 -- set Interface p1 type=dummy
3049])
53eb8cb8 3050on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
3051
3052AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
3053AT_DATA([flows.txt], [dnl
3054table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3055table=1 actions=output(CONTROLLER),goto_table(2)
3056table=2 actions=group:1234
3057])
3a11fd5b 3058AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 3059AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3a11fd5b
SS
3060
3061dnl Singleton controller action.
6409e008 3062AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
3063
3064for i in 1 2 3 ; do
3065 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)'
3066done
331c07ac
YHW
3067AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3068OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
d9c8c57c 3069OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3a11fd5b
SS
3070
3071AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3072
3073AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3074OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3075tcp,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 3076dnl
efe179e0 3077OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3078tcp,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 3079dnl
efe179e0 3080OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3081tcp,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 3082dnl
efe179e0 3083OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3084tcp,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 3085dnl
efe179e0 3086OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3087tcp,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 3088dnl
efe179e0 3089OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3090tcp,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 3091dnl
efe179e0 3092OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3093tcp,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 3094dnl
efe179e0 3095OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3096tcp,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 3097dnl
efe179e0 3098OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3099tcp,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
3100dnl
3101OFPT_PACKET_IN (OF1.3) (xid=0x0): total_len=54 in_port=ANY (via action) data_len=54 (unbuffered)
3102tcp,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
3103])
3104
3105AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3106
3107AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
3108 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3109 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3110 table=2, n_packets=3, n_bytes=162, actions=group:1234
3a11fd5b
SS
3111OFPST_FLOW reply (OF1.3):
3112])
3113
3114OVS_VSWITCHD_STOP
3115AT_CLEANUP
3116
3117
029ca940 3118AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3a11fd5b
SS
3119OVS_VSWITCHD_START([dnl
3120 add-port br0 p1 -- set Interface p1 type=dummy
3121])
53eb8cb8 3122on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
3123
3124AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
3125AT_DATA([flows.txt], [dnl
3126table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3127table=1 actions=output(CONTROLLER),goto_table(2)
3128table=2 actions=group:1234
3129])
3a11fd5b 3130AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 3131AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3a11fd5b
SS
3132
3133dnl Singleton controller action.
6409e008 3134AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
3135
3136for i in 1 2 3 ; do
3137 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)'
3138done
331c07ac
YHW
3139AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3140OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
d9c8c57c 3141OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3a11fd5b
SS
3142
3143AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3144
3145AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3146OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) 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
029ca940 3148dnl
efe179e0 3149OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) 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
029ca940 3151dnl
efe179e0 3152OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) 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
029ca940 3154dnl
efe179e0 3155OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3156tcp,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 3157dnl
efe179e0 3158OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3159tcp,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 3160dnl
efe179e0 3161OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3162tcp,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 3163dnl
efe179e0 3164OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3165tcp,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 3166dnl
efe179e0 3167OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3168tcp,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 3169dnl
efe179e0 3170OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3171tcp,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
3172dnl
3173OFPT_PACKET_IN (OF1.4) (xid=0x0): total_len=54 in_port=ANY (via packet_out) data_len=54 (unbuffered)
3174tcp,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
3175])
3176
3177AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3178
3179AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
3180 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3181 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3182 table=2, n_packets=3, n_bytes=162, actions=group:1234
3a11fd5b
SS
3183OFPST_FLOW reply (OF1.4):
3184])
3185
3186OVS_VSWITCHD_STOP
3187AT_CLEANUP
3188
029ca940 3189
f6c8a6b1
BP
3190AT_SETUP([ofproto-dpif - ARP modification slow-path])
3191OVS_VSWITCHD_START
ca5792f0 3192add_of_ports br0 1 2
f6c8a6b1
BP
3193
3194ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3195ovs-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'
3196
3197# Input some packets that should follow the arp modification slow-path.
3198for i in 1 2 3; do
3199 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)'
3200done
3201AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3202
3203# Check the packets that were output.
3204AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
78c9486d
JR
3205arp,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
3206arp,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
3207arp,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
3208arp,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
3209arp,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
3210arp,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
3211arp,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
3212arp,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
3213arp,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
3214])
3215
f6c8a6b1
BP
3216OVS_VSWITCHD_STOP
3217AT_CLEANUP
3218
ecac4ebf 3219AT_SETUP([ofproto-dpif - VLAN handling])
04c956fc 3220OVS_VSWITCHD_START(
023e1e0a
BP
3221 [set Bridge br0 fail-mode=standalone -- \
3222 add-port br0 p1 trunks=10,12 -- \
ecac4ebf 3223 add-port br0 p2 tag=10 -- \
5e9ceccd
BP
3224 add-port br0 p3 tag=12 \
3225 other-config:priority-tags=true -- \
ecac4ebf
BP
3226 add-port br0 p4 tag=12 -- \
3227 add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
3228 add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
3229 add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
5e9ceccd
BP
3230 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
3231 other-config:priority-tags=true -- \
fed8962a
EG
3232 add-port br0 p9 vlan_mode=dot1q-tunnel tag=10 other-config:qinq-ethtype=802.1q -- \
3233 add-port br0 p10 vlan_mode=dot1q-tunnel tag=10 cvlans=10,12 other-config:qinq-ethtype=802.1q -- \
3234 add-port br0 p11 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q -- \
3235 add-port br0 p12 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q \
3236 other-config:priority-tags=true -- \
ecac4ebf
BP
3237 set Interface p1 type=dummy -- \
3238 set Interface p2 type=dummy -- \
3239 set Interface p3 type=dummy -- \
3240 set Interface p4 type=dummy -- \
3241 set Interface p5 type=dummy -- \
3242 set Interface p6 type=dummy -- \
3243 set Interface p7 type=dummy -- \
fed8962a
EG
3244 set Interface p8 type=dummy -- \
3245 set Interface p9 type=dummy -- \
3246 set Interface p10 type=dummy -- \
3247 set Interface p11 type=dummy -- \
3248 set Interface p12 type=dummy --])
04c956fc 3249
247527db
BP
3250dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3251dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
ecac4ebf 3252dnl actions.
04c956fc 3253for tuple in \
e44768b7
JP
3254 "100 none 0 drop" \
3255 "100 0 0 drop" \
3256 "100 0 1 drop" \
fed8962a
EG
3257 "100 10 0 1,5,6,7,8,pop_vlan,2,9" \
3258 "100 10 1 1,5,6,7,8,pop_vlan,2,9" \
e44768b7
JP
3259 "100 11 0 5,7" \
3260 "100 11 1 5,7" \
fed8962a
EG
3261 "100 12 0 1,5,6,pop_vlan,3,4,7,8,11,12" \
3262 "100 12 1 1,5,6,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
247527db
BP
3263 "1 none 0 drop" \
3264 "1 0 0 drop" \
3265 "1 0 1 drop" \
fed8962a
EG
3266 "1 10 0 5,6,7,8,100,pop_vlan,2,9" \
3267 "1 10 1 5,6,7,8,100,pop_vlan,2,9" \
247527db
BP
3268 "1 11 0 drop" \
3269 "1 11 1 drop" \
fed8962a
EG
3270 "1 12 0 5,6,100,pop_vlan,3,4,7,8,11,12" \
3271 "1 12 1 5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3272 "2 none 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3273 "2 0 0 pop_vlan,9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3274 "2 0 1 pop_vlan,9,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
247527db
BP
3275 "2 10 0 drop" \
3276 "2 10 1 drop" \
3277 "2 11 0 drop" \
3278 "2 11 1 drop" \
3279 "2 12 0 drop" \
3280 "2 12 1 drop" \
fed8962a
EG
3281 "3 none 0 4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3282 "3 0 0 pop_vlan,4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3283 "3 0 1 8,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
247527db
BP
3284 "3 10 0 drop" \
3285 "3 10 1 drop" \
3286 "3 11 0 drop" \
3287 "3 11 1 drop" \
3288 "3 12 0 drop" \
3289 "3 12 1 drop" \
fed8962a
EG
3290 "4 none 0 3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3291 "4 0 0 pop_vlan,3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3292 "4 0 1 3,8,12,pop_vlan,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
247527db
BP
3293 "4 10 0 drop" \
3294 "4 10 1 drop" \
3295 "4 11 0 drop" \
3296 "4 11 1 drop" \
3297 "4 12 0 drop" \
3298 "4 12 1 drop" \
fed8962a
EG
3299 "5 none 0 2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3300 "5 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3301 "5 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3302 "5 10 0 1,6,7,8,100,pop_vlan,2,9" \
3303 "5 10 1 1,6,7,8,100,pop_vlan,2,9" \
e44768b7
JP
3304 "5 11 0 7,100" \
3305 "5 11 1 7,100" \
fed8962a
EG
3306 "5 12 0 1,6,100,pop_vlan,3,4,7,8,11,12" \
3307 "5 12 1 1,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3308 "6 none 0 2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3309 "6 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3310 "6 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3311 "6 10 0 1,5,7,8,100,pop_vlan,2,9" \
3312 "6 10 1 1,5,7,8,100,pop_vlan,2,9" \
247527db
BP
3313 "6 11 0 drop" \
3314 "6 11 1 drop" \
fed8962a
EG
3315 "6 12 0 1,5,100,pop_vlan,3,4,7,8,11,12" \
3316 "6 12 1 1,5,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3317 "7 none 0 3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3318 "7 0 0 pop_vlan,3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3319 "7 0 1 3,8,12,pop_vlan,4,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3320 "7 10 0 1,5,6,8,100,pop_vlan,2,9" \
3321 "7 10 1 1,5,6,8,100,pop_vlan,2,9" \
e44768b7
JP
3322 "7 11 0 5,100" \
3323 "7 11 1 5,100" \
fed8962a
EG
3324 "7 12 0 1,5,6,100,pop_vlan,3,4,8,11,12" \
3325 "7 12 1 1,5,6,100,pop_vlan,4,11,push_vlan(vid=0,pcp=1),3,8,12" \
3326 "8 none 0 3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3327 "8 0 0 pop_vlan,3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3328 "8 0 1 3,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3329 "8 10 0 1,5,6,7,100,pop_vlan,2,9" \
3330 "8 10 1 1,5,6,7,100,pop_vlan,2,9" \
247527db
BP
3331 "8 11 0 drop" \
3332 "8 11 1 drop" \
fed8962a
EG
3333 "8 12 0 1,5,6,100,pop_vlan,3,4,7,11,12" \
3334 "8 12 1 1,5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,12" \
3335 "9 none 0 2,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3336 "9 10 0 10,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3337 "9 11 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3338 "10 none 0 drop" \
3339 "10 0 0 drop" \
3340 "10 11 0 drop" \
3341 "10 12 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3342 "11 10 0 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3343 "11 10 1 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100"
04c956fc
BP
3344do
3345 set $tuple
3346 in_port=$1
3347 vlan=$2
ecac4ebf
BP
3348 pcp=$3
3349 expected=$4
04c956fc
BP
3350
3351 if test $vlan = none; then
247527db 3352 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
04c956fc 3353 else
247527db 3354 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
3355 fi
3356
395e68ce
BP
3357 echo "----------------------------------------------------------------------"
3358 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3359
50aa28fd 3360 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
ecac4ebf 3361 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
04c956fc 3362
247527db 3363 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
becffb86 3364 mv stdout expout
247527db 3365 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
04c956fc
BP
3366done
3367
3368OVS_VSWITCHD_STOP
3369AT_CLEANUP
7257b535 3370
f0fb825a
EG
3371AT_SETUP([ofproto-dpif - VLAN depth limit])
3372OVS_VSWITCHD_START([dnl
3373 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3374 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
3375 add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3
3376])
3377
3378AT_DATA([flows.txt], [dnl
3379table=0 in_port=1,eth_type=0x8100,vlan_tci=0x0010/0x01ff actions=output:2
3380table=0 in_port=1,eth_type=0xabcd,vlan_tci=0x0010/0x01ff actions=output:3
3381])
3382AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3383flow="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), \
3384 encap(eth_type(0x8100),vlan(vid=17,pcp=0),encap(eth_type(0xabcd)))"
3385
3386AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3387AT_CHECK([tail -1 stdout], [0],
3388 [Datapath actions: 2
3389])
3390
3391AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3392AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3393AT_CHECK([tail -1 stdout], [0],
3394 [Datapath actions: 3
3395])
3396
3397OVS_VSWITCHD_STOP
3398AT_CLEANUP
3399
3400AT_SETUP([ofproto-dpif - Multi-VLAN actions])
3401OVS_VSWITCHD_START([dnl
3402 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3403 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2
3404])
3405AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3406
3407AT_DATA([flows.txt], [dnl
3408table=0 in_port=1,vlan_tci=0x1100/0x1fff actions=pop_vlan,output:2
3409table=0 in_port=1,vlan_tci=0x1101/0x1fff actions=push_vlan:0x8100,set_field:0x1201/0x1fff->vlan_tci,output:2
3410table=0 in_port=1,vlan_tci=0x1102/0x1fff actions=push_vlan:0x88a8,set_field:0x1202/0x1fff->vlan_tci,output:2
3411table=0 in_port=1,vlan_tci=0x1103/0x1fff actions=set_field:0x1203/0x1fff->vlan_tci,output:2
3412table=0 in_port=1,vlan_tci=0x1104/0x1fff actions=pop_vlan,goto_table:1
3413table=1 vlan_tci=0 actions=output:2
3414table=1 vlan_tci=0x1300/0x1fff actions=pop_vlan,output:2
3415table=1 vlan_tci=0x1301/0x1fff actions=push_vlan:0x88a8,set_field:0x1401/0x1fff->vlan_tci,output:2
3416table=1 vlan_tci=0x1302/0x1fff actions=set_field:0x1402/0x1fff->vlan_tci,output:2
3417])
3418
3419AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3420
3421check_act() {
3422 psd_hdr="in_port(1),eth(src=00:11:22:33:44:55,dst=00:22:44:66:88:00),"
3423 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$psd_hdr$1"], [0], [stdout])
3424 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $2
3425])
3426}
3427
3428check_act "eth_type(0x8100),vlan(vid=0x0100,pcp=0),encap(eth_type(0xabcd))" \
3429 "pop_vlan,2"
3430
3431check_act "eth_type(0x8100),vlan(vid=0x0101,pcp=0),encap(eth_type(0xabcd))" \
3432 "push_vlan(vid=513,pcp=0),2"
3433
3434check_act "eth_type(0x8100),vlan(vid=0x0102,pcp=0),encap(eth_type(0xabcd))" \
3435 "push_vlan(tpid=0x88a8,vid=514,pcp=0),2"
3436
3437check_act "eth_type(0x8100),vlan(vid=0x0103,pcp=0),encap(eth_type(0xabcd))" \
3438 "pop_vlan,push_vlan(vid=515,pcp=0),2"
3439
3440check_act "eth_type(0x8100),vlan(vid=0x0104,pcp=0),encap(eth_type(0xabcd))" \
3441 "pop_vlan,2"
3442
3443check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3444vlan(vid=0x0300,pcp=0),encap(eth_type(0xabcd)))" "pop_vlan,pop_vlan,2"
3445
3446check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3447vlan(vid=0x0301,pcp=0),encap(eth_type(0xabcd)))" \
3448 "pop_vlan,push_vlan(tpid=0x88a8,vid=1025,pcp=0),2"
3449
3450check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3451vlan(vid=0x0302,pcp=0),encap(eth_type(0xabcd)))" \
3452 "pop_vlan,pop_vlan,push_vlan(vid=1026,pcp=0),2"
3453
3454OVS_VSWITCHD_STOP
3455AT_CLEANUP
3456
56879058
JS
3457AT_SETUP([ofproto-dpif - MPLS handling])
3458OVS_VSWITCHD_START([dnl
3459 add-port br0 p1 -- set Interface p1 type=dummy
3460])
53eb8cb8 3461on_exit 'kill `cat ovs-ofctl.pid`'
56879058
JS
3462
3463AT_CAPTURE_FILE([ofctl_monitor.log])
3464AT_DATA([flows.txt], [dnl
3465dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
63636ee8 3466dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
0c1625e8 3467dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
56879058
JS
3468])
3469AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3470
3471dnl In this test, we push an MPLS tag to an ethernet packet.
6409e008 3472AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
56879058
JS
3473
3474for i in 1 2 3; do
3475 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)'
3476done
62022172 3477OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3478OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
56879058 3479
38b0b29f 3480AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3481OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3482mpls,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
JS
348300000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
348400000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
348500000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
efe179e0 348600000030 00 00 50 00 00 00 2e 91-00 00
56879058 3487dnl
efe179e0 3488OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3489mpls,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
JS
349000000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
349100000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
349200000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
efe179e0 349300000030 00 00 50 00 00 00 2e 91-00 00
56879058 3494dnl
efe179e0 3495OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3496mpls,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
JS
349700000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
349800000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
349900000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
efe179e0 350000000030 00 00 50 00 00 00 2e 91-00 00
56879058
JS
3501])
3502
63636ee8
JS
3503dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3504dnl copied exactly, except for the BOS bit.
6409e008 3505AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
63636ee8
JS
3506
3507for i in 1 2 3; do
3508 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)'
3509done
62022172 3510OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3511OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
63636ee8 3512
38b0b29f 3513AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3514OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3515mpls,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 351600000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 351700000010 a0 40 00 00 a1 40
63636ee8 3518dnl
efe179e0 3519OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3520mpls,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 352100000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 352200000010 a0 40 00 00 a1 40
63636ee8 3523dnl
efe179e0 3524OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3525mpls,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 352600000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 352700000010 a0 40 00 00 a1 40
0c1625e8
SH
3528])
3529
3530dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3531dnl copied exactly, except for the BOS bit. The ethertype should be updated
3532dnl to the MPLS ethertype of the MPLS push action which differs to that
3533dnl of the input packet.
6409e008 3534AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
0c1625e8
SH
3535
3536for i in 1 2 3; do
3537 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)'
3538done
62022172 3539OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
d9c8c57c 3540OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
0c1625e8 3541
38b0b29f 3542AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3543OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3544mplsm,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 354500000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 354600000010 a0 40 00 00 a1 40
0c1625e8 3547dnl
efe179e0 3548OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3549mplsm,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 355000000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 355100000010 a0 40 00 00 a1 40
0c1625e8 3552dnl
efe179e0 3553OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3554mplsm,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 355500000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 355600000010 a0 40 00 00 a1 40
63636ee8
JS
3557])
3558
56879058
JS
3559OVS_VSWITCHD_STOP
3560AT_CLEANUP
3561
846e159a
SH
3562AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3563OVS_VSWITCHD_START([dnl
3564 add-port br0 p1 -- set Interface p1 type=dummy
3565])
53eb8cb8 3566on_exit 'kill `cat ovs-ofctl.pid`'
846e159a
SH
3567
3568AT_CAPTURE_FILE([ofctl_monitor.log])
3569AT_DATA([flows.txt], [dnl
3570cookie=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
3571cookie=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
3572cookie=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
3573cookie=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
3574cookie=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
3575cookie=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
3576cookie=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
3577cookie=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
3578cookie=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
3579cookie=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
3580])
3581AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3582
3583dnl Modified MPLS controller action.
3584dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3585dnl both of these in the final flow
6409e008 3586AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3587
3588for i in 1 2 3; do
3589 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)'
3590done
62022172 3591OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3592OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3593
38b0b29f 3594AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3595OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3596mpls,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
SH
359700000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
359800000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
359900000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 360000000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3601dnl
efe179e0 3602OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3603mpls,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
SH
360400000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
360500000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
360600000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 360700000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3608dnl
efe179e0 3609OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3610mpls,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
SH
361100000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
361200000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
361300000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 361400000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a
SH
3615])
3616
3617dnl Modified MPLS controller action.
f0fb825a
EG
3618dnl In this test, the input packet is vlan-tagged, which should be kept as
3619dnl inner vlan.
6409e008 3620AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3621
3622for i in 1 2 3; do
3623 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))'
3624done
62022172 3625OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3626OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3627
38b0b29f 3628AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
f0fb825a
EG
3629OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3630mpls,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 363100000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
f0fb825a
EG
363200000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
363300000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
363400000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
363500000040 00 00
846e159a 3636dnl
f0fb825a
EG
3637OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3638mpls,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 363900000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
f0fb825a
EG
364000000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
364100000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
364200000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
364300000040 00 00
846e159a 3644dnl
f0fb825a
EG
3645OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3646mpls,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 364700000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
f0fb825a
EG
364800000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
364900000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
365000000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
365100000040 00 00
846e159a
SH
3652])
3653
3654dnl Modified MPLS controller action.
3655dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3656dnl both of these in the final flow
6409e008 3657AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3658
3659for i in 1 2 3; do
3660 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)'
3661done
62022172 3662OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3663OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3664
38b0b29f 3665AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3666OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3667mpls,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
SH
366800000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
366900000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
367000000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 367100000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3672dnl
efe179e0 3673OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3674mpls,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
SH
367500000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
367600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
367700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 367800000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3679dnl
efe179e0 3680OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3681mpls,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
SH
368200000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
368300000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
368400000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 368500000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a
SH
3686])
3687
3688dnl Modified MPLS controller action.
f0fb825a
EG
3689dnl In this test, the input packet is vlan-tagged, which should be kept as
3690dnl inner vlan.
6409e008 3691AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3692
3693for i in 1 2 3; do
3694 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))'
3695done
62022172 3696OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3697OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3698
38b0b29f 3699AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
f0fb825a
EG
3700OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3701mpls,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 370200000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
f0fb825a
EG
370300000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
370400000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
370500000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
370600000040 00 00
846e159a 3707dnl
f0fb825a
EG
3708OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3709mpls,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 371000000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
f0fb825a
EG
371100000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
371200000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
371300000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
371400000040 00 00
846e159a 3715dnl
f0fb825a
EG
3716OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3717mpls,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 371800000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
f0fb825a
EG
371900000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
372000000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
372100000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
372200000040 00 00
846e159a
SH
3723])
3724
3725dnl Modified MPLS controller action.
3726dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3727dnl actions are reordered, so we see both of these in the final flow.
6409e008 3728AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3729
3730for i in 1 2 3; do
3731 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)'
3732done
62022172 3733OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3734OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3735
38b0b29f 3736AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3737OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3738mpls,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
SH
373900000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
374000000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
374100000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 374200000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3743dnl
efe179e0 3744OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3745mpls,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
SH
374600000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
374700000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
374800000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 374900000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3750dnl
efe179e0 3751OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3752mpls,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
SH
375300000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
375400000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
375500000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 375600000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a
SH
3757])
3758
3759dnl Modified MPLS controller action.
f0fb825a
EG
3760dnl In this test, the input packet is vlan-tagged, which should be kept as
3761dnl inner vlan.
6409e008 3762AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3763
3764for i in 1 2 3; do
3765 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))'
3766done
62022172 3767OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
28ae2f37 3768OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 3769
38b0b29f 3770AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
f0fb825a
EG
3771OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3772mpls,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 377300000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
f0fb825a
EG
377400000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
377500000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
377600000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
377700000040 00 00
846e159a 3778dnl
f0fb825a
EG
3779OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3780mpls,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 378100000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
f0fb825a
EG
378200000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
378300000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
378400000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
378500000040 00 00
846e159a 3786dnl
f0fb825a
EG
3787OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3788mpls,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 378900000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
f0fb825a
EG
379000000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
379100000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
379200000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
379300000040 00 00
846e159a
SH
3794])
3795
3796dnl Modified MPLS controller action.
3797dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3798dnl actions are reordered, so we see both of these in the final flow.
6409e008 3799AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3800
3801for i in 1 2 3; do
3802 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)'
3803done
62022172 3804OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3805OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3806
38b0b29f 3807AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3808OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3809mpls,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
SH
381000000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
381100000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
381200000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 381300000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3814dnl
efe179e0 3815OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3816mpls,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
SH
381700000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
381800000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
381900000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 382000000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3821dnl
efe179e0 3822OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3823mpls,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
SH
382400000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
382500000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
382600000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 382700000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a
SH
3828])
3829
3830dnl Modified MPLS controller action.
f0fb825a
EG
3831dnl In this test, the input packet is vlan-tagged, which should be kept as
3832dnl inner vlan.
6409e008 3833AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3834
3835for i in 1 2 3; do
3836 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))'
3837done
62022172 3838OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3839OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3840
38b0b29f 3841AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
f0fb825a
EG
3842OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3843mpls,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 384400000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
f0fb825a
EG
384500000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
384600000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
384700000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
384800000040 00 00
846e159a 3849dnl
f0fb825a
EG
3850OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3851mpls,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 385200000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
f0fb825a
EG
385300000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
385400000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
385500000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
385600000040 00 00
846e159a 3857dnl
f0fb825a
EG
3858OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3859mpls,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 386000000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
f0fb825a
EG
386100000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
386200000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
386300000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
386400000040 00 00
846e159a
SH
3865])
3866
3867dnl Modified MPLS controller action.
f0fb825a
EG
3868dnl In this test, the input packet is vlan-tagged, which should be kept as
3869dnl inner vlan.
6409e008 3870AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3871
3872for i in 1 2 3; do
3873 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))'
3874done
62022172 3875OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3876OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3877
38b0b29f 3878AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3879OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3880mpls,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
SH
388100000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
388200000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
388300000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 388400000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3885dnl
efe179e0 3886OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3887mpls,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
SH
388800000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
388900000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
389000000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 389100000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3892dnl
efe179e0 3893OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3894mpls,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
SH
389500000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
389600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
389700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 389800000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a
SH
3899])
3900
3901dnl Modified MPLS controller action.
4dc94d7e 3902dnl In this test, the input packet is vlan-tagged, which should be modified
846e159a 3903dnl before we push MPLS and VLAN tags.
6409e008 3904AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3905
3906for i in 1 2 3; do
3907 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))'
3908done
62022172 3909OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
d9c8c57c 3910OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 3911
38b0b29f 3912AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3913OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3914mpls,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
SH
391500000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
391600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
391700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 391800000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3919dnl
efe179e0 3920OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3921mpls,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
SH
392200000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
392300000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
392400000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 392500000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a 3926dnl
efe179e0 3927OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
f0fb825a 3928mpls,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
SH
392900000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
393000000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
393100000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
efe179e0 393200000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
846e159a
SH
3933])
3934
cea4a6d7 3935AT_CHECK([ovs-appctl revalidator/purge], [0])
846e159a 3936AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
3937 cookie=0xa, n_packets=3, n_bytes=162, 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
3938 cookie=0xa, n_packets=3, n_bytes=162, 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
3939 cookie=0xa, n_packets=3, n_bytes=162, 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
3940 cookie=0xa, n_packets=3, n_bytes=162, 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
3941 cookie=0xa, n_packets=3, n_bytes=174, 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
3942 cookie=0xa, n_packets=3, n_bytes=174, 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
3943 cookie=0xa, n_packets=3, n_bytes=174, 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
3944 cookie=0xa, n_packets=3, n_bytes=174, 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
3945 cookie=0xa, n_packets=3, n_bytes=174, 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
3946 cookie=0xa, n_packets=3, n_bytes=174, 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
3947OFPST_FLOW reply (OF1.2):
3948])
3949
3950OVS_VSWITCHD_STOP
3951AT_CLEANUP
3952
b8778a0d 3953AT_SETUP([ofproto-dpif - fragment handling - trace])
023e1e0a 3954OVS_VSWITCHD_START
ca5792f0 3955add_of_ports br0 1 2 3 4 5 6 90
7257b535 3956AT_DATA([flows.txt], [dnl
12e4681c
JR
3957priority=75 tcp ip_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
3958priority=75 tcp ip_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
12e4681c
JR
3959priority=50 tcp ip_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
3960priority=50 tcp ip_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
b8778a0d 3961priority=50 tcp ip_frag=later actions=output:6
7257b535
BP
3962])
3963AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3964
a61680c6 3965base_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
3966no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3967first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3968later_flow="$base_flow,frag=later)"
3969
3970 # mode no first later
3971for tuple in \
3972 'normal 1 5 6' \
3973 'drop 1 drop drop' \
3974 'nx-match 1 2 6'
3975do
3976 set $tuple
3977 mode=$1
3978 no=$2
3979 first=$3
3980 later=$4
3981
3982 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3983 for type in no first later; do
3984 eval flow=\$${type}_flow exp_output=\$$type
7fd51d39 3985 printf "\n%s\n" "----$mode $type-----"
50aa28fd 3986 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
7fd51d39
BP
3987 : > expout
3988 if test $mode = drop && test $type != no; then
2d9b49dd 3989 echo ' 0. Packets are IP fragments and the fragment handling mode is "drop".' >> expout
12e4681c 3990 echo "Datapath actions: $exp_output" >> expout
b8778a0d 3991 elif test $type = later; then
12e4681c
JR
3992 echo "Datapath actions: $exp_output" >> expout
3993 else
3994 echo "Datapath actions: set(tcp(src=80,dst=80)),$exp_output" >> expout
7fd51d39 3995 fi
7fd51d39 3996 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
7257b535
BP
3997 done
3998done
023e1e0a 3999OVS_VSWITCHD_STOP
7257b535 4000AT_CLEANUP
848e8809 4001
b8778a0d
JR
4002AT_SETUP([ofproto-dpif - fragment handling - upcall])
4003OVS_VSWITCHD_START
ca5792f0 4004add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
4005AT_DATA([flows.txt], [dnl
4006priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
4007priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
4008priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
4009priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
4010priority=50 tcp ip_frag=later actions=output:6
4011])
4012AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4013
4014base_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"
4015no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4016first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4017later_flow="$base_flow,frag=later)"
4018
4019AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4020
4021mode=normal
4022
4023AT_CHECK([ovs-ofctl set-frags br0 $mode])
4024for type in no first later; do
4025 eval flow=\$${type}_flow
4026 printf "\n%s\n" "----$mode $type-----"
4027
4028 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4029done
4030
4031AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 4032flow-dump from non-dpdk interfaces:
b8778a0d
JR
4033recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4034recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),5
4035recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4036])
4037
4038mode=drop
4039
98bb4286 4040AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4041AT_CHECK([ovs-ofctl set-frags br0 $mode])
4042for type in no first later; do
4043 eval flow=\$${type}_flow
4044 printf "\n%s\n" "----$mode $type-----"
4045
4046 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4047done
4048
4049AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 4050flow-dump from non-dpdk interfaces:
b8778a0d
JR
4051recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4052recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
4053recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
4054])
4055
4056mode=nx-match
4057
98bb4286 4058AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4059AT_CHECK([ovs-ofctl set-frags br0 $mode])
4060for type in no first later; do
4061 eval flow=\$${type}_flow
4062 printf "\n%s\n" "----$mode $type-----"
4063
4064 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4065done
4066
4067AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 4068flow-dump from non-dpdk interfaces:
b8778a0d
JR
4069recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4070recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),2
4071recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4072])
4073
4074OVS_VSWITCHD_STOP
4075AT_CLEANUP
4076
4077AT_SETUP([ofproto-dpif - fragment handling - actions])
4078OVS_VSWITCHD_START
ca5792f0 4079add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
4080
4081AT_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])
4082AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4083source field tcp_dst lacks correct prerequisites
4084ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4085])
4086
4087AT_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])
4088AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4089destination field tcp_src lacks correct prerequisites
4090ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4091])
4092
4093AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
4094AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4095set_field udp_src lacks correct prerequisities
4096ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4097])
4098
4099AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
4100AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4101set_field udp_dst lacks correct prerequisities
4102ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4103])
4104
4105AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
4106AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4107set_field sctp_src lacks correct prerequisities
4108ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4109])
4110
4111AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
4112AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4113set_field sctp_dst lacks correct prerequisities
4114ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4115])
4116
4117AT_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])
4118AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4119source field tcp_dst lacks correct prerequisites
4120ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4121])
4122
4123AT_DATA([flows.txt], [dnl
4124priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
4125])
4126AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
4127
4128AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4129
4130mode=normal
4131
4132AT_CHECK([ovs-ofctl set-frags br0 $mode])
4133for frag in 4000 6000 6008 4010; do
4134 printf "\n%s\n" "----$mode $frag-----"
4135
4136 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"])
4137done
4138
4d182934
JS
4139dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
4140dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
4141dnl OVS-2.5, the wildcards and set_field mask are shared internally.
b8778a0d 4142AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 4143flow-dump from non-dpdk interfaces:
4d182934
JS
4144recirc_id(0),in_port(90),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
4145recirc_id(0),in_port(90),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
b8778a0d
JR
4146recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
4147])
4148
98bb4286 4149AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4150AT_CHECK([ovs-ofctl set-frags br0 $mode])
4151for frag in 4000 6000 6008 4010; do
4152 printf "\n%s\n" "----$mode $frag truncated transport header -----"
4153
4154 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
4155done
4156
4157AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 4158flow-dump from non-dpdk interfaces:
4d182934
JS
4159recirc_id(0),in_port(90),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
4160recirc_id(0),in_port(90),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
efe179e0 4161recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:38, used:0.001s, actions:1
b8778a0d
JR
4162])
4163
98bb4286 4164AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4165AT_CHECK([ovs-ofctl set-frags br0 $mode])
4166for frag in 4000 6000 6001 4002; do
4167 printf "\n%s\n" "----$mode $frag missing transport header-----"
4168
4169 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
4170done
4171
4172AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 4173flow-dump from non-dpdk interfaces:
4d182934
JS
4174recirc_id(0),in_port(90),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
4175recirc_id(0),in_port(90),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
efe179e0 4176recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:34, used:0.001s, actions:1
b8778a0d
JR
4177])
4178
4179OVS_VSWITCHD_STOP
4180AT_CLEANUP
4181
848e8809
EJ
4182AT_SETUP([ofproto-dpif - exit])
4183OVS_VSWITCHD_START
ca5792f0 4184add_of_ports br0 1 2 3 10 11 12 13 14
848e8809
EJ
4185AT_DATA([flows.txt], [dnl
4186in_port=1 actions=output:10,exit,output:11
4187in_port=2 actions=output:12,resubmit:1,output:12
4188in_port=3 actions=output:13,resubmit:2,output:14
4189])
4190AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 4191AT_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
4192AT_CHECK([tail -1 stdout], [0],
4193 [Datapath actions: 10
4194])
50aa28fd 4195AT_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
4196AT_CHECK([tail -1 stdout], [0],
4197 [Datapath actions: 12,10
4198])
50aa28fd 4199AT_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
4200AT_CHECK([tail -1 stdout], [0],
4201 [Datapath actions: 13,12,10
4202])
4203OVS_VSWITCHD_STOP
4204AT_CLEANUP
c06bba01
JP
4205
4206
4207AT_SETUP([ofproto-dpif - mirroring, select_all])
2d5c1a20 4208AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4209OVS_VSWITCHD_START
ca5792f0 4210add_of_ports br0 1 2 3
432fca23 4211ovs-vsctl \
c06bba01
JP
4212 set Bridge br0 mirrors=@m --\
4213 --id=@p3 get Port p3 --\
432fca23 4214 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 4215
c06bba01
JP
4216AT_DATA([flows.txt], [dnl
4217in_port=1 actions=output:2
4218in_port=2 actions=output:1
4219])
4220AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4221
247527db 4222flow="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 4223AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4224AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4225 [Datapath actions: 3,2
c06bba01
JP
4226])
4227
247527db 4228flow="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 4229AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4230AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4231 [Datapath actions: 3,1
c06bba01
JP
4232])
4233
4234OVS_VSWITCHD_STOP
4235AT_CLEANUP
4236
4237
4238AT_SETUP([ofproto-dpif - mirroring, select_src])
2d5c1a20 4239AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4240OVS_VSWITCHD_START
ca5792f0 4241add_of_ports br0 1 2 3
432fca23 4242ovs-vsctl \
c06bba01
JP
4243 set Bridge br0 mirrors=@m --\
4244 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
432fca23 4245 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
c06bba01 4246
c06bba01
JP
4247AT_DATA([flows.txt], [dnl
4248in_port=1 actions=output:2
4249in_port=2 actions=output:1
4250])
4251AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4252
247527db 4253flow="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 4254AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4255AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4256 [Datapath actions: 3,2
c06bba01
JP
4257])
4258
247527db 4259flow="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 4260AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4261AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4262 [Datapath actions: 1
c06bba01
JP
4263])
4264OVS_VSWITCHD_STOP
4265AT_CLEANUP
4266
33158a18 4267AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
2d5c1a20 4268AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4269OVS_VSWITCHD_START
ca5792f0 4270add_of_ports br0 1 2
432fca23 4271ovs-vsctl \
33158a18
JP
4272 set Bridge br0 mirrors=@m --\
4273 --id=@p2 get Port p2 --\
432fca23 4274 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
33158a18 4275
33158a18
JP
4276AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4277
4278# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 4279flow="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
4280AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4281AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4282 [Datapath actions: 1,2
33158a18
JP
4283])
4284
4285OVS_VSWITCHD_STOP
4286AT_CLEANUP
4287
c06bba01
JP
4288
4289AT_SETUP([ofproto-dpif - mirroring, select_dst])
2d5c1a20 4290AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4291OVS_VSWITCHD_START
ca5792f0 4292add_of_ports br0 1 2 3
432fca23 4293ovs-vsctl \
c06bba01
JP
4294 set Bridge br0 mirrors=@m --\
4295 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4296 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
c06bba01 4297
c06bba01
JP
4298AT_DATA([flows.txt], [dnl
4299in_port=1 actions=output:2
4300in_port=2 actions=output:1
4301])
4302AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4303
247527db 4304flow="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 4305AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4306AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4307 [Datapath actions: 2,3
c06bba01
JP
4308])
4309
247527db 4310flow="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 4311AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4312AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4313 [Datapath actions: 1
c06bba01
JP
4314])
4315
4316OVS_VSWITCHD_STOP
4317AT_CLEANUP
4318
4319
4320AT_SETUP([ofproto-dpif - mirroring, select_vlan])
2d5c1a20 4321AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4322OVS_VSWITCHD_START
ca5792f0 4323add_of_ports br0 1 2 3
432fca23 4324ovs-vsctl \
c06bba01
JP
4325 set Bridge br0 mirrors=@m --\
4326 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4327 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
c06bba01 4328
c06bba01
JP
4329AT_DATA([flows.txt], [dnl
4330in_port=1, actions=output:2
4331])
4332AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4333
247527db 4334flow="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 4335AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4336AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4337 [Datapath actions: 2
c06bba01
JP
4338])
4339
247527db 4340flow="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 4341AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4342AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4343 [Datapath actions: 2
c06bba01
JP
4344])
4345
247527db 4346flow="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 4347AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4348AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4349 [Datapath actions: 3,2
c06bba01
JP
4350])
4351
4352OVS_VSWITCHD_STOP
4353AT_CLEANUP
4354
4355
4356AT_SETUP([ofproto-dpif - mirroring, output_port])
2d5c1a20 4357AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4358OVS_VSWITCHD_START
ca5792f0 4359add_of_ports br0 1 2 3
432fca23 4360ovs-vsctl \
c06bba01
JP
4361 set Bridge br0 mirrors=@m --\
4362 --id=@p3 get Port p3 --\
432fca23 4363 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 4364
c06bba01
JP
4365AT_DATA([flows.txt], [dnl
4366in_port=1 actions=mod_vlan_vid:17,output:2
4367in_port=2 actions=output:1
4368])
4369AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4370
247527db 4371flow="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 4372AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4373AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4374 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
c06bba01
JP
4375])
4376
247527db 4377flow="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 4378AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4379AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4380 [Datapath actions: 3,1
c06bba01
JP
4381])
4382
4383OVS_VSWITCHD_STOP
4384AT_CLEANUP
4385
c06bba01 4386AT_SETUP([ofproto-dpif - mirroring, output_vlan])
2d5c1a20 4387AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4388OVS_VSWITCHD_START
ca5792f0 4389add_of_ports br0 1 2
432fca23 4390ovs-vsctl \
c06bba01 4391 set Bridge br0 mirrors=@m --\
432fca23 4392 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
c06bba01 4393
c06bba01
JP
4394AT_DATA([flows.txt], [dnl
4395in_port=1 actions=output:2
4396in_port=2 actions=mod_vlan_vid:17,output:1
4397])
4398AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4399
247527db 4400flow="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 4401AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
4402actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4403
e44768b7 4404expected="2,push_vlan(vid=12,pcp=0),1,2,100"
247527db 4405AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 4406mv stdout expout
247527db 4407AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01 4408
247527db 4409flow="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 4410AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
4411actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4412
e44768b7 4413expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
247527db 4414AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 4415mv stdout expout
247527db 4416AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01
JP
4417
4418OVS_VSWITCHD_STOP
4419AT_CLEANUP
b44a10b7 4420
faa624b4
BP
4421# This verifies that we don't get duplicate mirroring when mirror_packet()
4422# might be invoked recursively, as a check against regression.
4423AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
2d5c1a20 4424AT_KEYWORDS([mirror mirrors mirroring])
faa624b4
BP
4425OVS_VSWITCHD_START
4426add_of_ports br0 1 2 3
4427ovs-vsctl \
4428 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4429 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
4430 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
4431 -- set Port br0 tag=0 \
4432 -- set Port p1 tag=0 \
4433 -- set Port p2 tag=500 \
4434 -- set Port p3 tag=501
4435
4436flow='in_port=1'
4437AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4438AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4439s/,/\
4440/g' | sort], [0], [100
44412
44423
4443])
4444
4445OVS_VSWITCHD_STOP
4446AT_CLEANUP
4447
29bae541
BP
4448# This test verifies that mirror state is preserved across recirculation.
4449#
4450# Otherwise, post-recirculation the ingress and the output to port 4
4451# would cause the packet to be mirrored to port 3 a second time.
4452AT_SETUP([ofproto-dpif - mirroring with recirculation])
2d5c1a20 4453AT_KEYWORDS([mirror mirrors mirroring])
29bae541 4454OVS_VSWITCHD_START
ca5792f0 4455add_of_ports br0 1 2 3 4
29bae541
BP
4456ovs-vsctl \
4457 set Bridge br0 mirrors=@m --\
4458 --id=@p3 get Port p3 --\
4459 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4460
4461AT_DATA([flows.txt], [dnl
4462in_port=1 actions=2,debug_recirc,4
4463])
4464AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4465
4466flow="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)"
4467AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4468AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4469])
4470AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4471AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4472])
4473
4474OVS_VSWITCHD_STOP
4475AT_CLEANUP
4476
1356dbd1
WT
4477# Tests below verify the snaplen support for mirroring
4478AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen])
4479AT_KEYWORDS([mirror mirrors mirroring])
4480OVS_VSWITCHD_START
4481add_of_ports br0 1 2 3
4482ovs-vsctl \
4483 set Bridge br0 mirrors=@m --\
4484 --id=@p3 get Port p3 --\
4485 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4486
4487AT_DATA([flows.txt], [dnl
4488in_port=1 actions=output:2
4489in_port=2 actions=output:1
4490])
4491AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4492
4493flow="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)"
4494AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4495AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4496 [Datapath actions: trunc(100),3,2
4497])
4498
4499flow="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)"
4500AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4501AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4502 [Datapath actions: trunc(100),3,1
4503])
4504
4505OVS_VSWITCHD_STOP
4506AT_CLEANUP
4507
091d64c4
ZG
4508AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen and reset snaplen])
4509AT_KEYWORDS([mirror mirrors mirroring])
4510OVS_VSWITCHD_START
4511add_of_ports br0 1 2 3
4512ovs-vsctl \
4513 set Bridge br0 mirrors=@m --\
4514 --id=@p3 get Port p3 --\
4515 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4516
4517AT_DATA([flows.txt], [dnl
4518in_port=1 actions=output:2
4519in_port=2 actions=output:1
4520])
4521AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4522
4523flow="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)"
4524AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4525AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4526 [Datapath actions: trunc(100),3,2
4527])
4528
4529ovs-vsctl set mirror mymirror snaplen=77
4530
4531flow="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)"
4532AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4533AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4534 [Datapath actions: trunc(77),3,1
4535])
4536
4537ovs-vsctl set mirror mymirror snaplen=65535
4538
4539flow="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)"
4540AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4541AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4542 [Datapath actions: 3,1
4543])
4544
4545OVS_VSWITCHD_STOP
4546AT_CLEANUP
4547
1356dbd1
WT
4548AT_SETUP([ofproto-dpif - mirroring, select_src with snaplen])
4549AT_KEYWORDS([mirror mirrors mirroring])
4550OVS_VSWITCHD_START
4551add_of_ports br0 1 2 3
4552ovs-vsctl \
4553 set Bridge br0 mirrors=@m --\
4554 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4555 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3 snaplen=100
4556
4557AT_DATA([flows.txt], [dnl
4558in_port=1 actions=output:2
4559in_port=2 actions=output:1
4560])
4561AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4562
4563flow="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)"
4564AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4565AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4566 [Datapath actions: trunc(100),3,2
4567])
4568
4569flow="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)"
4570AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4571AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4572 [Datapath actions: 1
4573])
4574OVS_VSWITCHD_STOP
4575AT_CLEANUP
4576
4577AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port with snaplen])
4578AT_KEYWORDS([mirror mirrors mirroring])
4579OVS_VSWITCHD_START
4580add_of_ports br0 1 2
4581ovs-vsctl \
4582 set Bridge br0 mirrors=@m --\
4583 --id=@p2 get Port p2 --\
4584 --id=@m create Mirror name=mymirror select_all=true output_port=@p2 snaplen=100
4585
4586AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4587
4588# "in_port" defaults to OFPP_NONE if it's not specified.
4589flow="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"
4590AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4591AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4592 [Datapath actions: 1,trunc(100),2
4593])
4594
4595OVS_VSWITCHD_STOP
4596AT_CLEANUP
4597
4598AT_SETUP([ofproto-dpif - mirroring, select_dst with snaplen])
4599AT_KEYWORDS([mirror mirrors mirroring])
4600OVS_VSWITCHD_START
4601add_of_ports br0 1 2 3
4602ovs-vsctl \
4603 set Bridge br0 mirrors=@m --\
4604 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4605 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3 snaplen=100
4606
4607AT_DATA([flows.txt], [dnl
4608in_port=1 actions=output:2
4609in_port=2 actions=output:1
4610])
4611AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4612
4613flow="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)"
4614AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4615AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4616 [Datapath actions: 2,trunc(100),3
4617])
4618
4619flow="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)"
4620AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4621AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4622 [Datapath actions: 1
4623])
4624
4625OVS_VSWITCHD_STOP
4626AT_CLEANUP
4627
4628AT_SETUP([ofproto-dpif - mirroring, select_vlan with snaplen])
4629AT_KEYWORDS([mirror mirrors mirroring])
4630OVS_VSWITCHD_START
4631add_of_ports br0 1 2 3
4632ovs-vsctl \
4633 set Bridge br0 mirrors=@m --\
4634 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4635 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3 snaplen=100
4636
4637AT_DATA([flows.txt], [dnl
4638in_port=1, actions=output:2
4639])
4640AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4641
4642flow="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)"
4643AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4644AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4645 [Datapath actions: 2
4646])
4647
4648flow="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))"
4649AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4650AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4651 [Datapath actions: 2
4652])
4653
4654flow="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))"
4655AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4656AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4657 [Datapath actions: trunc(100),3,2
4658])
4659
4660OVS_VSWITCHD_STOP
4661AT_CLEANUP
4662
4663AT_SETUP([ofproto-dpif - mirroring, output_port with snaplen])
4664AT_KEYWORDS([mirror mirrors mirroring])
4665OVS_VSWITCHD_START
4666add_of_ports br0 1 2 3
4667ovs-vsctl \
4668 set Bridge br0 mirrors=@m --\
4669 --id=@p3 get Port p3 --\
4670 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4671
4672AT_DATA([flows.txt], [dnl
4673in_port=1 actions=mod_vlan_vid:17,output:2
4674in_port=2 actions=output:1
4675])
4676AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4677
4678flow="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)"
4679AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4680AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4681 [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2
4682])
4683
4684flow="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)"
4685AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4686AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4687 [Datapath actions: trunc(100),3,1
4688])
4689
4690OVS_VSWITCHD_STOP
4691AT_CLEANUP
4692
4693AT_SETUP([ofproto-dpif - mirroring, output_vlan with snaplen])
4694AT_KEYWORDS([mirror mirrors mirroring])
4695OVS_VSWITCHD_START
4696add_of_ports br0 1 2
4697ovs-vsctl \
4698 set Bridge br0 mirrors=@m --\
4699 --id=@m create Mirror name=mymirror select_all=true output_vlan=12 snaplen=100
4700
4701AT_DATA([flows.txt], [dnl
4702in_port=1 actions=output:2
4703in_port=2 actions=mod_vlan_vid:17,output:1
4704])
4705AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4706
4707flow="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)"
4708AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4709actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4710dnl Expect: "trunc(100),100,trunc(100),2,trunc(100),1", with different order
4711AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
4712
4713flow="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)"
4714AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4715actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4716AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
4717
4718OVS_VSWITCHD_STOP
4719AT_CLEANUP
4720
4721AT_SETUP([ofproto-dpif - multiple VLAN output mirrors with snaplen])
4722AT_KEYWORDS([mirror mirrors mirroring])
4723OVS_VSWITCHD_START
4724add_of_ports br0 1 2 3
4725ovs-vsctl \
4726 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4727 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 snaplen=200 \
4728 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 snaplen=300 \
4729 -- set Port br0 tag=0 \
4730 -- set Port p1 tag=0 \
4731 -- set Port p2 tag=500 \
4732 -- set Port p3 tag=501
4733
4734flow="in_port=1"
4735AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4736AT_CHECK([tail -1 stdout | egrep "trunc\(200\),2,trunc\(300\),3,100|trunc\(300\),3,trunc\(200\),2,100"], [0], [stdout])
4737
4738OVS_VSWITCHD_STOP
4739AT_CLEANUP
4740
83a31283
BP
4741# This test verifies that the table ID is preserved across recirculation
4742# when a resubmit action requires it (because the action is relative to
4743# the current table rather than specifying a table).
4744AT_SETUP([ofproto-dpif - resubmit with recirculation])
4745OVS_VSWITCHD_START
ca5792f0 4746add_of_ports br0 1 2 3
83a31283
BP
4747
4748AT_DATA([flows.txt], [dnl
4749table=0 in_port=1 actions=2,resubmit(,1)
4750table=1 in_port=1 actions=debug_recirc,resubmit:55
4751table=1 in_port=55 actions=3
4752])
4753AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4754
4755flow="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)"
4756AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4757AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
4758])
4759AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4760AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
4761])
4762
4763OVS_VSWITCHD_STOP
4764AT_CLEANUP
4765
6b1c5734
BP
4766# This test verifies that "resubmit", when it triggers recirculation
4767# indirectly through the flow that it recursively invokes, is not
4768# re-executed when execution continues later post-recirculation.
4769AT_SETUP([ofproto-dpif - recirculation after resubmit])
4770OVS_VSWITCHD_START
ca5792f0 4771add_of_ports br0 1 2
6b1c5734
BP
4772
4773AT_DATA([flows.txt], [dnl
4774table=0 in_port=1 actions=resubmit(,1),2
4775table=1 in_port=1 actions=debug_recirc
4776])
4777AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4778
4779flow="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)"
4780AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4781AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
4782])
4783AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4784AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
4785])
4786
4787OVS_VSWITCHD_STOP
4788AT_CLEANUP
4789
77ab5fd2
BP
4790dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
4791dnl
4792dnl Checks the implementation of the continuation mechanism that allows the
4793dnl packet processing pipeline to be paused and resumed. Starts by creating
4794dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
4795dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
4796dnl in the bridge, resuming each time the pipeline pauses, and expects a single
4797dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
4798dnl ACTIONS0 still contains at least one "pause" action, removes one of them
4799dnl and repeats the process.
4800dnl
4801dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
4802dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
4803dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
4804dnl into port 1 on br0, so br1 only comes into action if a patch port (added
4805dnl by EXTRA_SETUP) jumps from one bridge to another.
4806dnl
4807dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
4808dnl both bridges, e.g. to configure mirrors or patch ports.
4809m4_define([CHECK_CONTINUATION], [dnl
4810 AT_SETUP([ofproto-dpif - continuation - $1])
4811 AT_KEYWORDS([continuations pause resume])
4812 OVS_VSWITCHD_START
4813
4814 # count_matches STRING
4815 #
4816 # Prints on stdout the number of occurrences of STRING in stdin.
4817 count_matches () {
4818 sed -n ":start
4819 s/$[1]//p
4820 t start" | wc -l
4821 }
4822
4823 add_of_ports --pcap br0 `seq 1 $2`
4824 m4_if([$3], [0], [],
4825 [add_of_br 1
4826 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
4827
4828 AT_CAPTURE_FILE([ofctl_monitor0.log])
4829 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
4830 m4_if([$3], [0], [],
4831 [AT_CAPTURE_FILE([ofctl_monitor1.log])
4832 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
4833
4834 actions0='$4'
4835 actions1='$5'
4836 $6
4837 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)"
4838 n_packets=0
4839 n_resumes=0
4840 while true; do
4841 printf "\n\nactions for br0:\n%s\n" "$actions0"
4842 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
4843
4844 # Add flows.
4845 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
4846 m4_if([$3], [0], [],
4847 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
4848
70d0cd06
JR
4849 # Make sure the datapath is up-to-date before sending the packet.
4850 ovs-appctl revalidator/wait
4851
77ab5fd2
BP
4852 # Run a packet through the switch.
4853 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
4854
4855 # Wait for the expected number of packets to show up.
4856 n_packets=`expr $n_packets + $2 - 1 + $3`
4857 echo "waiting for $n_packets packets..."
4858 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
4859
4860 # Wait for the expected number of NXT_RESUMEs to be logged.
4861 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
4862 echo "waiting for $n_resumes NXT_RESUMEs..."
4863 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
4864
4865 # Eliminate one "pause" from the actions.
4866 #
4867 # If there were none left, then we're done.
4868 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
4869 if test X"$actions0" = X"$next_actions0"; then
4870 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
4871 if test X"$actions1" = X"$next_actions1"; then
4872 break
4873 else
4874 actions1=$next_actions1
4875 fi
4876 else
4877 actions0=$next_actions0
4878 fi
4879
4880 # Delete all the flows and verify that there are none, so that we
4881 # can be sure that our updated flow tables is actually in use
4882 # later.
4883 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
4884 [NXST_FLOW reply:
4885])
4886 m4_if([$3], [0], [],
4887 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
4888 [NXST_FLOW reply:
4889])])
4890 done
4891 OVS_VSWITCHD_STOP
4892 AT_CLEANUP
4893])
4894
4895# Check that pause at the end of the pipeline works OK.
4896#
4897# (xlate_continuation() has a special case for no-op actions; this
4898# fails without that special case.)
4899CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
4900
4901# Check that remaining actions are preserved following resume.
4902CHECK_CONTINUATION([actions], [7], [0],
4903 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
4904
4905# Check that multiple levels of resubmit continue following resume.
4906#
4907# The "resubmit:55", which is relative to the current table, is
4908# particularly interesting because it checks that the notion of the
4909# current table is correctly preserved.
4910CHECK_CONTINUATION([resubmit], [10], [0],
4911 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
4912 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
4913 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
4914 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
4915 table=3 in_port=55 actions=pause 6 pause])
4916
4917# Check that the action set is preserved across pause/resume.
4918CHECK_CONTINUATION([action set], [3], [0],
4919 [in_port=1 actions=1 pause resubmit(,1) pause 2
4920 table=1 actions=write_actions(3)])
4921
4922# Check that metadata and the stack used by push and pop is preserved
4923# across pause/resume.
4924CHECK_CONTINUATION([data stack], [3], [0],
4925 [in_port=1 actions=pause dnl
4926 set_field:1->reg0 dnl
4927 pause dnl
4928 set_field:2->reg1 dnl
4929 pause dnl
4930 output:NXM_NX_REG0[[]] dnl
4931 pause dnl
4932 push:NXM_NX_REG1[[]] dnl
4933 dnl
4934 pop:NXM_NX_REG2[[]] dnl
4935 pause dnl
4936 output:NXM_NX_REG2[[]] dnl
4937 pause dnl
4938 3])
4939
4940# Check that mirror output occurs once and once only, even if
4941# separated by pause/resume.
4942CHECK_CONTINUATION([mirroring], [5], [0],
4943 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
4944 [ovs-vsctl \
4945 set Bridge br0 mirrors=@m --\
4946 --id=@p2 get Port p2 --\
4947 --id=@p3 get Port p3 --\
4948 --id=@p4 get Port p4 --\
4949 --id=@p5 get Port p5 --\
4950 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
4951
4952# Check that pause works in the presence of patch ports.
4953CHECK_CONTINUATION([patch ports], [4], [1],
4954 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
4955 table=1 in_port=1 actions=pause 3 pause 10 pause],
4956 [table=0 in_port=11 actions=pause 5 pause],
4957 [ovs-vsctl \
4958 -- add-port br0 patch10 \
4959 -- set interface patch10 type=patch options:peer=patch11 \
4960 ofport_request=10 \
4961 -- add-port br1 patch11 \
4962 -- set interface patch11 type=patch options:peer=patch10 \
4963 ofport_request=11])
4964
22bb3cbc
AW
4965# Two testcases below are for the ofproto/trace command
4966# The first one tests all correct syntax:
4967# ofproto/trace [dp_name] odp_flow [-generate|packet]
4968# ofproto/trace br_name br_flow [-generate|packet]
4969AT_SETUP([ofproto-dpif - ofproto/trace command 1])
4970OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 4971add_of_ports br0 1 2 3
22bb3cbc
AW
4972
4973AT_DATA([flows.txt], [dnl
4974in_port=1 actions=output:2
4975in_port=2 actions=output:1
4976])
4977AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4978
e063a73a 4979odp_flow="in_port(p1)"
22bb3cbc 4980br_flow="in_port=1"
0a37839c
GS
4981# Test command: ofproto/trace odp_flow with in_port as a name.
4982AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4983AT_CHECK([tail -1 stdout], [0], [dnl
4984Datapath actions: 2
4985])
4986
4987odp_flow="in_port(1)"
22bb3cbc
AW
4988# Test command: ofproto/trace odp_flow
4989AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4990AT_CHECK([tail -1 stdout], [0], [dnl
4991Datapath actions: 2
4992])
4993
4994# Test command: ofproto/trace dp_name odp_flow
4995AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
4996AT_CHECK([tail -1 stdout], [0], [dnl
4997Datapath actions: 2
4998])
4999# Test commmand: ofproto/trace br_name br_flow
5000AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5001AT_CHECK([tail -1 stdout], [0], [dnl
5002Datapath actions: 2
5003])
5004
5005# Delete the inserted flows
5006AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
5007AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
5008
78c9486d 5009# This section below tests the [-generate] option
22bb3cbc 5010odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
78c9486d 5011br_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
5012
5013# Test command: ofproto/trace odp_flow
5014AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5015# Check for no MAC learning entry
5016AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5017 port VLAN MAC Age
5018])
5019
5020# Test command: ofproto/trace br_name br_flow
5021AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5022# Check for no MAC learning entry
5023AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5024 port VLAN MAC Age
5025])
5026
5027# Test command: ofproto/trace odp_flow -generate
5028AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
5029# Check for the MAC learning entry
5030AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5031 port VLAN MAC Age
5032 3 0 50:54:00:00:00:05 ?
5033])
5034
5035# Test command: ofproto/trace dp_name odp_flow -generate
5036AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5037 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
5038 -generate], [0], [stdout])
5039# Check for both MAC learning entries
5040AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5041 port VLAN MAC Age
5042 3 0 50:54:00:00:00:05 ?
5043 1 0 50:54:00:00:00:06 ?
5044])
5045
5046# Test command: ofproto/trace br_name br_flow -generate
5047AT_CHECK([ovs-appctl ofproto/trace br0 \
5048 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
5049 -generate], [0], [stdout])
5050# Check for both MAC learning entries.
5051AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5052 port VLAN MAC Age
5053 3 0 50:54:00:00:00:05 ?
5054 1 0 50:54:00:00:00:06 ?
5055 2 0 50:54:00:00:00:07 ?
5056])
5057
5058# This section beflow tests the [packet] option
5059# The ovs-tcpundump of packets between port1 and port2
5060pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5061pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
5062
5063# Construct the MAC learning table
5064AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5065 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
5066 -generate], [0], [stdout])
5067
5068# Construct the MAC learning table
5069AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5070 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
5071 -generate], [0], [stdout])
5072
5073# Test command: ofproto/trace odp_flow packet
5074AT_CHECK([ovs-appctl ofproto/trace \
5075 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5076AT_CHECK([tail -1 stdout], [0], [dnl
5077Datapath actions: 2
5078])
2d9b49dd 5079AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5080Flow: 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
5081
5082bridge("br0")
22bb3cbc
AW
5083])
5084
5085# Test command: ofproto/trace dp_name odp_flow packet
5086AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5087 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5088AT_CHECK([tail -1 stdout], [0], [dnl
5089Datapath actions: 2
5090])
2d9b49dd 5091AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5092Flow: 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
5093
5094bridge("br0")
22bb3cbc
AW
5095])
5096
5097# Test command: ofproto/trace br_name br_flow packet
5098AT_CHECK([ovs-appctl ofproto/trace br0 \
1362e248 5099 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
22bb3cbc 5100AT_CHECK([tail -1 stdout], [0], [dnl
ed2e7245 5101Datapath actions: 1
22bb3cbc 5102])
2d9b49dd 5103AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5104Flow: 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
5105
5106bridge("br0")
22bb3cbc
AW
5107])
5108
5109OVS_VSWITCHD_STOP
5110AT_CLEANUP
5111
5112# The second test tests the corner cases
5113AT_SETUP([ofproto-dpif - ofproto/trace command 2])
5114OVS_VSWITCHD_START
ca5792f0 5115add_of_ports br0 1 2
22bb3cbc
AW
5116
5117# Define flows
5118odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
5119br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
5120# Define options
5121generate="-generate"
5122pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5123
5124# Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
5125m4_foreach(
5126[option],
5127[[],
5128["$generate"],
5129["$pkt"]],
5130[AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
5131 [2], [], [stderr])
5132AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5133Cannot find the datapath
22bb3cbc
AW
5134ovs-appctl: ovs-vswitchd: server returned an error
5135])])
5136
5137# Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
5138m4_foreach(
5139[option],
5140[[],
5141["$generate"],
5142["$pkt"]],
5143[AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
5144 [2], [], [stderr])
5145AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5146Cannot find the datapath
22bb3cbc
AW
5147ovs-appctl: ovs-vswitchd: server returned an error
5148])])
5149
5150# Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
5151m4_foreach(
5152[option],
5153[[],
5154["$generate"],
5155["$pkt"]],
5156[AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
5157 [2], [], [stderr])
5158AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5159Cannot find the datapath
22bb3cbc
AW
5160ovs-appctl: ovs-vswitchd: server returned an error
5161])])
5162
5163# Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
5164m4_foreach(
5165[option],
5166[[],
5167["$generate"],
5168["$pkt"]],
5169[AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
5170 [2], [], [stderr])
5171AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5172Cannot find the datapath
22bb3cbc
AW
5173ovs-appctl: ovs-vswitchd: server returned an error
5174])])
5175
5176# Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
5177m4_foreach(
5178[option],
5179[[],
5180["$generate"],
5181["$pkt"]],
5182[AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
5183 [2], [], [stderr])
5184AT_CHECK([tail -2 stderr], [0], [dnl
5185Unknown bridge name
5186ovs-appctl: ovs-vswitchd: server returned an error
5187])])
5188
5189# Test incorrect command: ofproto/trace br_flow [-generate|packet]
5190m4_foreach(
5191[option],
5192[[],
5193["$generate"],
5194["$pkt"]],
5195[AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
5196 [2], [], [stderr])
5197AT_CHECK([tail -2 stderr], [0], [dnl
5198Must specify bridge name
5199ovs-appctl: ovs-vswitchd: server returned an error
5200])])
5201
5202# Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
5203AT_CHECK([ovs-appctl ofproto/trace \
5204 ovs-dummy "$odp_flow" garbage_option],
5205 [2], [stdout],[stderr])
5206AT_CHECK([tail -2 stderr], [0], [dnl
5207Trailing garbage in packet data
5208ovs-appctl: ovs-vswitchd: server returned an error
5209])
5210
5211# Test incorrect command: ofproto/trace with 4 arguments
5212AT_CHECK([ovs-appctl ofproto/trace \
5213 arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
5214AT_CHECK([tail -2 stderr], [0], [dnl
5215"ofproto/trace" command takes at most 3 arguments
5216ovs-appctl: ovs-vswitchd: server returned an error
5217])
5218
5219# Test incorrect command: ofproto/trace with 0 argument
5220AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
5221AT_CHECK([tail -2 stderr], [0], [dnl
5222"ofproto/trace" command requires at least 1 arguments
5223ovs-appctl: ovs-vswitchd: server returned an error
5224])
5225
5226OVS_VSWITCHD_STOP
5227AT_CLEANUP
5228
b6ec827f
JS
5229# The third test checks that the output of "ovs-dpctl -m" is valid to trace.
5230AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
5231OVS_VSWITCHD_START([dnl
5232 set Open_vSwitch . other_config:max-idle=10000 \
5233 -- add-port br0 p1 -- set Interface p1 type=dummy])
5234
5235AT_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)'])
5236ovs-appctl revalidator/wait
5237AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
5238
5239odp_flow=`cat dp_flows1.txt`
5240AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
b6ec827f 5241Flow: <cleared>
b6ec827f 5242
2d9b49dd
BP
5243bridge("br0")
5244-------------
5245 0. No match.
5246 drop
b6ec827f
JS
5247
5248Final flow: <cleared>
5249Megaflow: <cleared>
5250Datapath actions: drop
5251])
5252
5253dnl Now, try again without megaflows:
5254ovs-appctl upcall/disable-megaflows
5255
5256AT_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)'])
5257ovs-appctl revalidator/wait
5258AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
5259
5260odp_flow=`cat dp_flows2.txt`
5261AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
b6ec827f 5262Flow: <cleared>
b6ec827f 5263
2d9b49dd
BP
5264bridge("br0")
5265-------------
5266 0. No match.
5267 drop
b6ec827f
JS
5268
5269Final flow: <cleared>
5270Megaflow: <cleared>
5271Datapath actions: drop
5272])
5273
5274OVS_VSWITCHD_STOP
5275AT_CLEANUP
5276
aee0979b
BP
5277AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
5278OVS_VSWITCHD_START
ca5792f0 5279add_of_ports br0 1 2 3
aee0979b
BP
5280
5281AT_DATA([flows.txt], [dnl
5282in_port=1 actions=output:2
5283in_port=2 actions=output:1
5284])
5285AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5286
5287AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
5288AT_CHECK([tail -1 stdout], [0], [dnl
5289Datapath actions: push_vlan(vid=123,pcp=0),2
5290])
5291
5292OVS_VSWITCHD_STOP
5293AT_CLEANUP
5294
5295
b44a10b7
BP
5296m4_define([OFPROTO_TRACE],
5297 [flow="$2"
5298 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
5299 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5300 expected="$4"
5301 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
5302 [0], [stdout])
5303 mv stdout expout
5304 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
5305 [0], [expout])])
5306
5307AT_SETUP([ofproto-dpif - MAC learning])
432fca23 5308OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 5309add_of_ports br0 1 2 3
b44a10b7 5310
b44a10b7
BP
5311arp='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)'
5312
5313# Trace an ARP packet arriving on p3, to create a MAC learning entry.
5314OFPROTO_TRACE(
50aa28fd 5315 [ovs-dummy],
247527db 5316 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5317 [-generate],
e44768b7 5318 [1,2,100])
b44a10b7
BP
5319
5320# Check for the MAC learning entry.
83664f72 5321AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5322 port VLAN MAC Age
247527db 5323 3 0 50:54:00:00:00:05 ?
b44a10b7
BP
5324])
5325
5326# Trace a packet arrival destined for the learned MAC.
5327# (This will also learn a MAC.)
5328OFPROTO_TRACE(
50aa28fd 5329 [ovs-dummy],
247527db 5330 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
b44a10b7 5331 [-generate],
247527db 5332 [3])
b44a10b7
BP
5333
5334# Check for both MAC learning entries.
83664f72 5335AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5336 port VLAN MAC Age
247527db
BP
5337 3 0 50:54:00:00:00:05 ?
5338 1 0 50:54:00:00:00:06 ?
b44a10b7
BP
5339])
5340
5341# Trace a packet arrival that updates the first learned MAC entry.
5342OFPROTO_TRACE(
50aa28fd 5343 [ovs-dummy],
247527db 5344 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5345 [-generate],
e44768b7 5346 [1,3,100])
b44a10b7
BP
5347
5348# Check that the MAC learning entry was updated.
83664f72 5349AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5350 port VLAN MAC Age
247527db
BP
5351 1 0 50:54:00:00:00:06 ?
5352 2 0 50:54:00:00:00:05 ?
b44a10b7
BP
5353])
5354
5355# Add another bridge.
5356AT_CHECK(
5357 [ovs-vsctl \
5358 -- add-br br1 \
ad28062f 5359 -- set bridge br1 datapath-type=dummy])
ca5792f0 5360add_of_ports br1 4 5
b44a10b7
BP
5361
5362# Trace some packet arrivals in br1 to create MAC learning entries there too.
5363OFPROTO_TRACE(
50aa28fd 5364 [ovs-dummy],
247527db 5365 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5366 [-generate],
e44768b7 5367 [5,101])
b44a10b7 5368OFPROTO_TRACE(
50aa28fd 5369 [ovs-dummy],
247527db 5370 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5371 [-generate],
e44768b7 5372 [4,101])
b44a10b7
BP
5373
5374# Check that the MAC learning entries were added.
83664f72 5375AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5376 port VLAN MAC Age
247527db
BP
5377 4 0 50:54:00:00:00:06 ?
5378 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
5379])
5380
5381# Delete port p1 and see that its MAC learning entry disappeared, and
5382# that the MAC learning entry for the same MAC was also deleted from br1.
5383AT_CHECK([ovs-vsctl del-port p1])
83664f72 5384AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5385 port VLAN MAC Age
247527db 5386 2 0 50:54:00:00:00:05 ?
b44a10b7 5387])
83664f72 5388AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5389 port VLAN MAC Age
247527db 5390 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
5391])
5392
5393OVS_VSWITCHD_STOP
5394AT_CLEANUP
17f7f7e0 5395
c4069512
BP
5396AT_SETUP([ofproto-dpif - MAC table overflow])
5397OVS_VSWITCHD_START(
ad28062f 5398 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 5399add_of_ports br0 1 2 3
c4069512
BP
5400
5401arp='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)'
5402
5403AT_CHECK([ovs-appctl time/stop])
5404
5405# Trace 10 ARP packets arriving on p3, to create MAC learning entries.
5406for i in 0 1 2 3 4 5 6 7 8 9; do
5407 OFPROTO_TRACE(
50aa28fd 5408 [ovs-dummy],
c4069512
BP
5409 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
5410 [-generate],
5411 [1,2,100])
5412 ovs-appctl time/warp 1000
5413done
5414
5415# Check for the MAC learning entries.
5416AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5417 [0], [dnl
5418 3 0 50:54:00:00:00:00
5419 3 0 50:54:00:00:00:01
5420 3 0 50:54:00:00:00:02
5421 3 0 50:54:00:00:00:03
5422 3 0 50:54:00:00:00:04
5423 3 0 50:54:00:00:00:05
5424 3 0 50:54:00:00:00:06
5425 3 0 50:54:00:00:00:07
5426 3 0 50:54:00:00:00:08
5427 3 0 50:54:00:00:00:09
5428 port VLAN MAC Age
5429])
5430
5431# Trace another ARP packet on another MAC.
5432OFPROTO_TRACE(
50aa28fd 5433 [ovs-dummy],
c4069512
BP
5434 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
5435 [-generate],
5436 [1,2,100])
5437
5438# Check that the new one chased the oldest one out of the table.
5439AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
5440 [0], [dnl
5441 3 0 50:54:00:00:00:01 ?
5442 3 0 50:54:00:00:00:02 ?
5443 3 0 50:54:00:00:00:03 ?
5444 3 0 50:54:00:00:00:04 ?
5445 3 0 50:54:00:00:00:05 ?
5446 3 0 50:54:00:00:00:06 ?
5447 3 0 50:54:00:00:00:07 ?
5448 3 0 50:54:00:00:00:08 ?
5449 3 0 50:54:00:00:00:09 ?
5450 3 0 50:54:00:00:00:10 ?
5451 port VLAN MAC Age
5452])
5453OVS_VSWITCHD_STOP
5454AT_CLEANUP
5455
9d078ec2
BP
5456AT_SETUP([ofproto-dpif - MAC table overflow fairness])
5457OVS_VSWITCHD_START(
5458 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 5459add_of_ports br0 1 2 3 4 5 6
9d078ec2
BP
5460
5461arp='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)'
5462
5463AT_CHECK([ovs-appctl time/stop])
5464
5465# Trace packets with 2 different source MACs arriving on each of the 5
5466# ports, filling up the 10-entry learning table.
5467for i in 0 1 2 3 4 5 6 7 8 9; do
5468 p=`expr $i / 2 + 1`
5469 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
5470 ovs-appctl time/warp 1000
5471done
5472
5473# Check for the MAC learning entries.
5474AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5475 [0], [dnl
5476 1 0 50:54:00:00:00:00
5477 1 0 50:54:00:00:00:01
5478 2 0 50:54:00:00:00:02
5479 2 0 50:54:00:00:00:03
5480 3 0 50:54:00:00:00:04
5481 3 0 50:54:00:00:00:05
5482 4 0 50:54:00:00:00:06
5483 4 0 50:54:00:00:00:07
5484 5 0 50:54:00:00:00:08
5485 5 0 50:54:00:00:00:09
5486 port VLAN MAC Age
5487])
5488
5489# Now trace 16 new MACs on another port.
5490for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
5491 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
5492 ovs-appctl time/warp 1000
5493done
5494
5495# Check the results.
5496#
5497# Our eviction algorithm on overflow is that an arbitrary (but deterministic)
5498# one of the ports with the most learned MACs loses the least recently used
5499# one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
5500# MAC each, and the other 2 of the old ports with 2 MACs each.
5501#
5502# (If someone changes lib/heap.c to do something different with equal-priority
5503# nodes, then the output below could change, but it would still follow the
5504# rules explained above.)
5505AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5506 [0], [dnl
5507 1 0 50:54:00:00:00:01
5508 2 0 50:54:00:00:00:03
5509 3 0 50:54:00:00:00:04
5510 3 0 50:54:00:00:00:05
5511 4 0 50:54:00:00:00:07
5512 5 0 50:54:00:00:00:08
5513 5 0 50:54:00:00:00:09
5514 6 0 50:54:00:00:0d:ff
5515 6 0 50:54:00:00:0e:ff
5516 6 0 50:54:00:00:0f:ff
5517 port VLAN MAC Age
5518])
5519OVS_VSWITCHD_STOP
5520AT_CLEANUP
5521
4819b3a5 5522# CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
e731d71b
AS
5523#
5524# Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
e731d71b 5525m4_define([CHECK_SFLOW_SAMPLING_PACKET],
4819b3a5 5526 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
e731d71b
AS
5527 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5528
53eb8cb8 5529 on_exit 'kill `cat test-sflow.pid`'
eadd1644 5530 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
e731d71b 5531 AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5532 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
e731d71b
AS
5533 ovs-appctl time/stop
5534
ca5792f0 5535 add_of_ports br0 1 2
e731d71b
AS
5536 ovs-vsctl \
5537 set Interface br0 options:ifindex=1002 -- \
5538 set Interface p1 options:ifindex=1004 -- \
5539 set Interface p2 options:ifindex=1003 -- \
5540 set Bridge br0 sflow=@sf -- \
5541 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
9a9808d7 5542 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
e731d71b
AS
5543
5544 dnl open with ARP packets to seed the bridge-learning. The output
5545 dnl ifIndex numbers should be reported predictably after that.
5546 dnl Since we set sampling=1 we should see all of these packets
5547 dnl reported. Sorting the output by data-source and seqNo makes
5548 dnl it deterministic. Ensuring that we send at least two packets
5549 dnl into each port means we get to check the seq nos are
5550 dnl incrementing correctly.
5551 dnl because packets from different ports can be handled by separate
5552 dnl threads, put some sleeps
5553
5554 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)'
5555 sleep 1
5556 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)'
5557 sleep 1
5558 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)'
5559 sleep 1
5560 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)'
5561 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)'
5562
5563 dnl sleep long enough to get more than one counter sample
5564 dnl from each datasource so we can check sequence numbers
22ecc560 5565 ovs-appctl time/warp 2000 100
e731d71b 5566 OVS_VSWITCHD_STOP
d9c8c57c 5567 OVS_APP_EXIT_AND_WAIT([test-sflow])
8073dd31 5568
e731d71b 5569 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
8073dd31
NM
5570 /g']], [0], [dnl
5571HEADER
5572 dgramSeqNo=1
743cea45 5573 ds=127.0.0.1>2:1000
8073dd31
NM
5574 fsSeqNo=1
5575 in_vlan=0
5576 in_priority=0
5577 out_vlan=0
5578 out_priority=0
5579 meanSkip=1
5580 samplePool=1
5581 dropEvents=0
743cea45 5582 in_ifindex=1004
8073dd31
NM
5583 in_format=0
5584 out_ifindex=2
5585 out_format=2
5586 hdr_prot=1
efe179e0 5587 pkt_len=46
8073dd31 5588 stripped=4
efe179e0
DDP
5589 hdr_len=42
5590 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
NM
5591HEADER
5592 dgramSeqNo=1
743cea45 5593 ds=127.0.0.1>2:1000
8073dd31
NM
5594 fsSeqNo=2
5595 in_vlan=0
5596 in_priority=0
5597 out_vlan=0
5598 out_priority=0
5599 meanSkip=1
5600 samplePool=2
5601 dropEvents=0
5602 in_ifindex=1003
5603 in_format=0
743cea45
NM
5604 out_ifindex=2
5605 out_format=2
8073dd31 5606 hdr_prot=1
efe179e0 5607 pkt_len=46
8073dd31 5608 stripped=4
efe179e0
DDP
5609 hdr_len=42
5610 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
NM
5611HEADER
5612 dgramSeqNo=1
743cea45 5613 ds=127.0.0.1>2:1000
8073dd31
NM
5614 fsSeqNo=3
5615 in_vlan=0
5616 in_priority=0
5617 out_vlan=0
5618 out_priority=0
5619 meanSkip=1
5620 samplePool=3
5621 dropEvents=0
743cea45 5622 in_ifindex=1004
8073dd31 5623 in_format=0
743cea45 5624 out_ifindex=1003
8073dd31
NM
5625 out_format=0
5626 hdr_prot=1
efe179e0 5627 pkt_len=46
8073dd31 5628 stripped=4
efe179e0
DDP
5629 hdr_len=42
5630 hdr=50-54-00-00-00-07-50-54-00-00-00-05-08-00-45-00-00-1C-00-00-00-00-40-01-F9-8D-C0-A8-00-01-C0-A8-00-02-08-00-F7-FF-00-00-00-00
8073dd31
NM
5631HEADER
5632 dgramSeqNo=1
743cea45
NM
5633 ds=127.0.0.1>2:1000
5634 fsSeqNo=4
8073dd31
NM
5635 in_vlan=0
5636 in_priority=0
5637 out_vlan=0
5638 out_priority=0
5639 meanSkip=1
743cea45 5640 samplePool=4
8073dd31 5641 dropEvents=0
743cea45 5642 in_ifindex=1003
8073dd31 5643 in_format=0
743cea45
NM
5644 out_ifindex=1004
5645 out_format=0
8073dd31 5646 hdr_prot=1
efe179e0 5647 pkt_len=46
8073dd31 5648 stripped=4
efe179e0
DDP
5649 hdr_len=42
5650 hdr=50-54-00-00-00-05-50-54-00-00-00-07-08-00-45-00-00-1C-00-00-00-00-40-01-F9-8D-C0-A8-00-02-C0-A8-00-01-00-00-FF-FF-00-00-00-00
8073dd31
NM
5651HEADER
5652 dgramSeqNo=1
743cea45
NM
5653 ds=127.0.0.1>2:1000
5654 fsSeqNo=5
8073dd31
NM
5655 in_vlan=0
5656 in_priority=0
5657 out_vlan=0
5658 out_priority=0
5659 meanSkip=1
743cea45 5660 samplePool=5
8073dd31 5661 dropEvents=0
743cea45 5662 in_ifindex=1003
8073dd31 5663 in_format=0
743cea45 5664 out_ifindex=1004
8073dd31
NM
5665 out_format=0
5666 hdr_prot=1
efe179e0 5667 pkt_len=58
8073dd31 5668 stripped=4
efe179e0
DDP
5669 hdr_len=54
5670 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
5671])
5672
934386dd 5673 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'ETHCOUNTERS|IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -24 | sed 's/ /\
8073dd31 5674 /g']], [0], [dnl
934386dd
RW
5675ETHCOUNTERS
5676 dot3StatsAlignmentErrors=4294967295
5677 dot3StatsFCSErrors=4294967295
5678 dot3StatsSingleCollisionFrames=4294967295
5679 dot3StatsMultipleCollisionFrames=4294967295
5680 dot3StatsSQETestErrors=4294967295
5681 dot3StatsDeferredTransmissions=4294967295
5682 dot3StatsLateCollisions=4294967295
5683 dot3StatsExcessiveCollisions=4294967295
5684 dot3StatsInternalMacTransmitErrors=4294967295
5685 dot3StatsCarrierSenseErrors=4294967295
5686 dot3StatsFrameTooLongs=4294967295
5687 dot3StatsInternalMacReceiveErrors=4294967295
5688 dot3StatsSymbolErrors=4294967295
5689ETHCOUNTERS
5690 dot3StatsAlignmentErrors=4294967295
5691 dot3StatsFCSErrors=4294967295
5692 dot3StatsSingleCollisionFrames=4294967295
5693 dot3StatsMultipleCollisionFrames=4294967295
5694 dot3StatsSQETestErrors=4294967295
5695 dot3StatsDeferredTransmissions=4294967295
5696 dot3StatsLateCollisions=4294967295
5697 dot3StatsExcessiveCollisions=4294967295
5698 dot3StatsInternalMacTransmitErrors=4294967295
5699 dot3StatsCarrierSenseErrors=4294967295
5700 dot3StatsFrameTooLongs=4294967295
5701 dot3StatsInternalMacReceiveErrors=4294967295
5702 dot3StatsSymbolErrors=4294967295
5703ETHCOUNTERS
5704 dot3StatsAlignmentErrors=4294967295
5705 dot3StatsFCSErrors=4294967295
5706 dot3StatsSingleCollisionFrames=4294967295
5707 dot3StatsMultipleCollisionFrames=4294967295
5708 dot3StatsSQETestErrors=4294967295
5709 dot3StatsDeferredTransmissions=4294967295
5710 dot3StatsLateCollisions=4294967295
5711 dot3StatsExcessiveCollisions=4294967295
5712 dot3StatsInternalMacTransmitErrors=4294967295
5713 dot3StatsCarrierSenseErrors=4294967295
5714 dot3StatsFrameTooLongs=4294967295
5715 dot3StatsInternalMacReceiveErrors=4294967295
5716 dot3StatsSymbolErrors=4294967295
5717ETHCOUNTERS
5718 dot3StatsAlignmentErrors=4294967295
5719 dot3StatsFCSErrors=4294967295
5720 dot3StatsSingleCollisionFrames=4294967295
5721 dot3StatsMultipleCollisionFrames=4294967295
5722 dot3StatsSQETestErrors=4294967295
5723 dot3StatsDeferredTransmissions=4294967295
5724 dot3StatsLateCollisions=4294967295
5725 dot3StatsExcessiveCollisions=4294967295
5726 dot3StatsInternalMacTransmitErrors=4294967295
5727 dot3StatsCarrierSenseErrors=4294967295
5728 dot3StatsFrameTooLongs=4294967295
5729 dot3StatsInternalMacReceiveErrors=4294967295
5730 dot3StatsSymbolErrors=4294967295
5731ETHCOUNTERS
5732 dot3StatsAlignmentErrors=4294967295
5733 dot3StatsFCSErrors=4294967295
5734 dot3StatsSingleCollisionFrames=4294967295
5735 dot3StatsMultipleCollisionFrames=4294967295
5736 dot3StatsSQETestErrors=4294967295
5737 dot3StatsDeferredTransmissions=4294967295
5738 dot3StatsLateCollisions=4294967295
5739 dot3StatsExcessiveCollisions=4294967295
5740 dot3StatsInternalMacTransmitErrors=4294967295
5741 dot3StatsCarrierSenseErrors=4294967295
5742 dot3StatsFrameTooLongs=4294967295
5743 dot3StatsInternalMacReceiveErrors=4294967295
5744 dot3StatsSymbolErrors=4294967295
5745ETHCOUNTERS
5746 dot3StatsAlignmentErrors=4294967295
5747 dot3StatsFCSErrors=4294967295
5748 dot3StatsSingleCollisionFrames=4294967295
5749 dot3StatsMultipleCollisionFrames=4294967295
5750 dot3StatsSQETestErrors=4294967295
5751 dot3StatsDeferredTransmissions=4294967295
5752 dot3StatsLateCollisions=4294967295
5753 dot3StatsExcessiveCollisions=4294967295
5754 dot3StatsInternalMacTransmitErrors=4294967295
5755 dot3StatsCarrierSenseErrors=4294967295
5756 dot3StatsFrameTooLongs=4294967295
5757 dot3StatsInternalMacReceiveErrors=4294967295
5758 dot3StatsSymbolErrors=4294967295
8073dd31 5759IFCOUNTERS
22ecc560 5760 dgramSeqNo=1
934386dd 5761 ds=127.0.0.1>0:1003
8073dd31 5762 csSeqNo=1
934386dd 5763 ifindex=1003
8073dd31
NM
5764 type=6
5765 ifspeed=100000000
5766 direction=0
1839c356 5767 status=0
934386dd
RW
5768 in_octets=138
5769 in_unicasts=3
d6e3feb5 5770 in_multicasts=4294967295
8073dd31 5771 in_broadcasts=4294967295
d6e3feb5 5772 in_discards=4294967295
5773 in_errors=4294967295
8073dd31 5774 in_unknownprotos=4294967295
efe179e0 5775 out_octets=84
8073dd31
NM
5776 out_unicasts=2
5777 out_multicasts=4294967295
5778 out_broadcasts=4294967295
d6e3feb5 5779 out_discards=4294967295
5780 out_errors=4294967295
8073dd31
NM
5781 promiscuous=0
5782IFCOUNTERS
22ecc560 5783 dgramSeqNo=1
934386dd 5784 ds=127.0.0.1>0:1004
8073dd31 5785 csSeqNo=1
934386dd 5786 ifindex=1004
8073dd31
NM
5787 type=6
5788 ifspeed=100000000
5789 direction=0
5790 status=0
934386dd
RW
5791 in_octets=84
5792 in_unicasts=2
d6e3feb5 5793 in_multicasts=4294967295
8073dd31 5794 in_broadcasts=4294967295
d6e3feb5 5795 in_discards=4294967295
5796 in_errors=4294967295
8073dd31 5797 in_unknownprotos=4294967295
934386dd
RW
5798 out_octets=138
5799 out_unicasts=3
8073dd31
NM
5800 out_multicasts=4294967295
5801 out_broadcasts=4294967295
d6e3feb5 5802 out_discards=4294967295
5803 out_errors=4294967295
8073dd31
NM
5804 promiscuous=0
5805IFCOUNTERS
934386dd
RW
5806 dgramSeqNo=2
5807 ds=127.0.0.1>0:1002
8073dd31 5808 csSeqNo=1
934386dd 5809 ifindex=1002
8073dd31
NM
5810 type=6
5811 ifspeed=100000000
5812 direction=0
5813 status=0
934386dd
RW
5814 in_octets=0
5815 in_unicasts=0
d6e3feb5 5816 in_multicasts=4294967295
8073dd31 5817 in_broadcasts=4294967295
d6e3feb5 5818 in_discards=4294967295
5819 in_errors=4294967295
8073dd31 5820 in_unknownprotos=4294967295
934386dd
RW
5821 out_octets=84
5822 out_unicasts=2
8073dd31
NM
5823 out_multicasts=4294967295
5824 out_broadcasts=4294967295
d6e3feb5 5825 out_discards=4294967295
5826 out_errors=4294967295
8073dd31
NM
5827 promiscuous=0
5828IFCOUNTERS
934386dd 5829 dgramSeqNo=3
8073dd31
NM
5830 ds=127.0.0.1>0:1002
5831 csSeqNo=2
5832 ifindex=1002
5833 type=6
5834 ifspeed=100000000
5835 direction=0
1839c356 5836 status=0
8073dd31
NM
5837 in_octets=0
5838 in_unicasts=0
d6e3feb5 5839 in_multicasts=4294967295
8073dd31 5840 in_broadcasts=4294967295
d6e3feb5 5841 in_discards=4294967295
5842 in_errors=4294967295
8073dd31 5843 in_unknownprotos=4294967295
efe179e0 5844 out_octets=84
8073dd31
NM
5845 out_unicasts=2
5846 out_multicasts=4294967295
5847 out_broadcasts=4294967295
d6e3feb5 5848 out_discards=4294967295
5849 out_errors=4294967295
8073dd31
NM
5850 promiscuous=0
5851IFCOUNTERS
934386dd 5852 dgramSeqNo=3
8073dd31
NM
5853 ds=127.0.0.1>0:1003
5854 csSeqNo=2
5855 ifindex=1003
5856 type=6
5857 ifspeed=100000000
5858 direction=0
5859 status=0
52105b67 5860 in_octets=138
8073dd31 5861 in_unicasts=3
d6e3feb5 5862 in_multicasts=4294967295
8073dd31 5863 in_broadcasts=4294967295
d6e3feb5 5864 in_discards=4294967295
5865 in_errors=4294967295
8073dd31 5866 in_unknownprotos=4294967295
efe179e0 5867 out_octets=84
8073dd31
NM
5868 out_unicasts=2
5869 out_multicasts=4294967295
5870 out_broadcasts=4294967295
d6e3feb5 5871 out_discards=4294967295
5872 out_errors=4294967295
8073dd31
NM
5873 promiscuous=0
5874IFCOUNTERS
934386dd 5875 dgramSeqNo=3
8073dd31
NM
5876 ds=127.0.0.1>0:1004
5877 csSeqNo=2
5878 ifindex=1004
5879 type=6
5880 ifspeed=100000000
5881 direction=0
5882 status=0
5883 in_octets=84
5884 in_unicasts=2
d6e3feb5 5885 in_multicasts=4294967295
8073dd31 5886 in_broadcasts=4294967295
d6e3feb5 5887 in_discards=4294967295
5888 in_errors=4294967295
8073dd31 5889 in_unknownprotos=4294967295
efe179e0 5890 out_octets=138
8073dd31
NM
5891 out_unicasts=3
5892 out_multicasts=4294967295
5893 out_broadcasts=4294967295
d6e3feb5 5894 out_discards=4294967295
5895 out_errors=4294967295
8073dd31 5896 promiscuous=0
50b9699f
NM
5897OPENFLOWPORT
5898 datapath_id=18364758544493064720
5899 port_no=1
5900OPENFLOWPORT
5901 datapath_id=18364758544493064720
5902 port_no=1
5903OPENFLOWPORT
5904 datapath_id=18364758544493064720
5905 port_no=2
5906OPENFLOWPORT
5907 datapath_id=18364758544493064720
5908 port_no=2
5909OPENFLOWPORT
5910 datapath_id=18364758544493064720
5911 port_no=65534
5912OPENFLOWPORT
5913 datapath_id=18364758544493064720
5914 port_no=65534
5915PORTNAME
5916 portName=br0
5917PORTNAME
5918 portName=br0
5919PORTNAME
5920 portName=p1
5921PORTNAME
5922 portName=p1
5923PORTNAME
5924 portName=p2
5925PORTNAME
5926 portName=p2
4819b3a5 5927])])
17f7f7e0 5928
aaca4fe0
WT
5929AT_SETUP([ofproto-dpif - basic truncate action])
5930OVS_VSWITCHD_START
5931add_of_ports br0 1 2 3 4 5
5932
5933AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
5934AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
5935AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
5936AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
5937AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
5938
5939AT_DATA([flows.txt], [dnl
5940in_port=3,actions=drop
5941in_port=5,actions=drop
5942in_port=1,actions=output(port=2,max_len=64),output:4
5943])
5944AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5945
5946dnl Datapath actions
5947AT_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])
5948AT_CHECK([tail -1 stdout], [0],
5949[Datapath actions: trunc(64),2,4
5950])
5951
5952dnl An 170 byte packet
5953AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
5954
5955AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
5956icmp,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
5957])
5958
5959AT_CHECK([ovs-appctl revalidator/purge], [0])
5960dnl packet with truncated size
5961AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5962n_bytes=64
5963])
5964dnl packet with original size
5965AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5966n_bytes=170
5967])
5968
5969dnl More complicated case
5970AT_CHECK([ovs-ofctl del-flows br0])
5971AT_DATA([flows.txt], [dnl
5972in_port=3,actions=drop
5973in_port=5,actions=drop
5974in_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
5975])
5976AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5977
5978dnl Datapath actions
5979AT_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])
5980AT_CHECK([tail -1 stdout], [0],
5981[Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
5982])
5983
5984dnl An 170 byte packet
5985AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
5986
5987AT_CHECK([ovs-appctl revalidator/purge], [0])
5988dnl packet size: 64 + 128 + 170 = 362
5989AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5990n_bytes=362
5991])
5992dnl packet size: 60 + 170 = 230
5993AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5994n_bytes=230
5995])
5996
5997dnl syntax checking
5998AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
5999ovs-ofctl: output to unsupported truncate port: ALL
6000])
6001
6002OVS_VSWITCHD_STOP
6003AT_CLEANUP
6004
6005AT_SETUP([ofproto-dpif - truncate and output to patch port])
6006OVS_VSWITCHD_START([add-br br1 \
6007-- set bridge br1 datapath-type=dummy fail-mode=secure \
6008-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 ofport_request=1 \
6009-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6010
6011add_of_ports br0 2
6012
6013AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
6014AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
6015
6016AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6017[0], [stdout])
6018AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
6019])
6020dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
2d9b49dd 6021AT_CHECK([grep "output_trunc does not support patch port [[0-9]]*" stdout], [0], [stdout])
aaca4fe0
WT
6022
6023OVS_VSWITCHD_STOP
6024AT_CLEANUP
6025
6026AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
6027OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6028 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6029 options:key=5 ofport_request=1\
6030 -- add-port br0 p2 -- set Interface p2 type=dummy \
6031 ofport_request=2])
6032AT_DATA([flows.txt], [dnl
6033actions=output(max_len=100, port=1)
6034])
6035OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6036AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6037
6038AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
e98d0cb3 6039 br0 65534/100: (dummy-internal)
aaca4fe0
WT
6040 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
6041 p2 2/2: (dummy)
6042])
6043
6044dnl Basic
6045AT_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])
6046AT_CHECK([tail -1 stdout], [0],
6047 [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
6048])
6049
6050OVS_VSWITCHD_STOP
6051AT_CLEANUP
6052
4819b3a5
BP
6053AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
6054CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
6055AT_CLEANUP
6056
6057AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
6058AT_SKIP_IF([test $HAVE_IPV6 = no])
6059CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
6060AT_CLEANUP
1e04fcc8 6061
50b9699f 6062dnl Test sFlow LAG structures
7321bda3 6063AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
80ee73d3 6064AT_SKIP_IF([test "$IS_WIN32" = "yes"])
50b9699f
NM
6065OVS_VSWITCHD_START([dnl
6066 add-bond br0 bond p1 p2 -- \
6067 set Port bond lacp=active bond-mode=active-backup \
6068 other_config:lacp-time="fast" \
6069 other_config:lacp-system-id=11:22:33:44:55:66 \
6070 other_config:lacp-system-priority=54321 -- \
6071 set Interface p1 type=dummy \
6072 other_config:lacp-port-id=11 \
6073 other_config:lacp-port-priority=111 \
6074 other_config:lacp-aggregation-key=3333 -- \
6075 set Interface p2 type=dummy \
6076 other_config:lacp-port-id=22 \
6077 other_config:lacp-port-priority=222 \
6078 other_config:lacp-aggregation-key=3333 ])
6079
53eb8cb8 6080on_exit 'kill `cat test-sflow.pid`'
50b9699f
NM
6081AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6082AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6083PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
50b9699f
NM
6084
6085ovs-appctl time/stop
6086
6087ovs-vsctl \
6088 set Interface p1 options:ifindex=1003 -- \
6089 set Bridge br0 sflow=@sf -- \
6090 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6091 header=128 sampling=1 polling=1
6092
6093dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
cea4a6d7
JS
6094AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
6095AT_CHECK([ovs-appctl revalidator/purge], [0])
50b9699f 6096OVS_VSWITCHD_STOP
d9c8c57c 6097OVS_APP_EXIT_AND_WAIT([test-sflow])
50b9699f
NM
6098AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
6099 /g']], [0], [dnl
6100LACPCOUNTERS
6101 sysID=11:22:33:44:55:66
6102 partnerID=00:00:00:00:00:00
6103 aggID=3333
6104 actorAdmin=0x7
6105 actorOper=0xbf
6106 partnerAdmin=0x0
6107 partnerOper=0x2
f7aa71fb 6108 LACPDUsRx=0
50b9699f
NM
6109 markerPDUsRx=4294967295
6110 markerRespPDUsRx=4294967295
6111 unknownRx=4294967295
6112 illegalRx=0
f7aa71fb 6113 LACPDUsTx=1
50b9699f
NM
6114 markerPDUsTx=4294967295
6115 markerRespPDUsTx=4294967295
6116])
6117
6118AT_CLEANUP
6119
7321bda3
NM
6120AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
6121AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6122OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6123
6124dnl set up sFlow logging
7321bda3
NM
6125AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6126AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6127PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
6128ovs-appctl time/stop
6129
6130OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6131AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
6132 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
6133AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
6134
6135AT_CHECK([ovs-ofctl add-flow br0 action=3])
6136
6137dnl enable sflow
6138ovs-vsctl \
6139 set Bridge br0 sflow=@sf -- \
6140 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6141 header=128 sampling=1 polling=0
6142
6143dnl introduce a packet that will be flooded to the tunnel
6144AT_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)'])
6145
6146dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6147for i in `seq 1 30`; do
6148 ovs-appctl time/warp 100
6149done
6150
d9c8c57c 6151OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
6152
6153AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6154 /g']], [0], [dnl
6155HEADER
6156 dgramSeqNo=1
6157 ds=127.0.0.1>2:1000
6158 fsSeqNo=1
6159 tunnel4_out_length=0
6160 tunnel4_out_protocol=47
6161 tunnel4_out_src=0.0.0.0
6162 tunnel4_out_dst=1.1.1.1
6163 tunnel4_out_src_port=0
6164 tunnel4_out_dst_port=0
6165 tunnel4_out_tcp_flags=0
6166 tunnel4_out_tos=1
6167 tunnel_out_vni=456
6168 in_vlan=0
6169 in_priority=0
6170 out_vlan=0
6171 out_priority=0
6172 meanSkip=1
6173 samplePool=1
6174 dropEvents=0
6175 in_ifindex=0
6176 in_format=0
6177 out_ifindex=1
6178 out_format=2
6179 hdr_prot=1
efe179e0 6180 pkt_len=46
7321bda3 6181 stripped=4
efe179e0
DDP
6182 hdr_len=42
6183 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-08-00-45-01-00-1C-00-00-00-00-80-01-12-CA-0A-0A-0A-02-0A-0A-0A-01-08-00-F7-FF-00-00-00-00
7321bda3
NM
6184])
6185
6186OVS_VSWITCHD_STOP
6187AT_CLEANUP
6188
6189AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
6190AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6191
6192OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
6193
6194dnl set up sFlow logging
7321bda3
NM
6195AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6196AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6197PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
6198ovs-appctl time/stop
6199
6200AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6201AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
6202AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
6203 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
6204 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
6205 options:ifindex=2011 ofport_request=5
6206 ], [0])
6207
6208AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6209dummy@ovs-dummy: hit:0 missed:0
6210 br0:
e98d0cb3 6211 br0 65534/100: (dummy-internal)
7321bda3
NM
6212 p0 1/1: (dummy: ifindex=1010)
6213 int-br:
e98d0cb3 6214 int-br 65534/2: (dummy-internal)
7321bda3
NM
6215 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
6216 vm1 5/3: (dummy: ifindex=2011)
6217])
6218
6219dnl set up route to 1.1.2.92 via br0 and action=normal
7321bda3
NM
6220AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
6221])
a8704b50
PS
6222AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
6223])
7321bda3
NM
6224AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6225
6226dnl Prime ARP Cache for 1.1.2.92
b23ddcc5 6227AT_CHECK([ovs-appctl netdev-dummy/receive br0 'recirc_id(0),in_port(100),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
6228
6229dnl configure sflow on int-br only
6230ovs-vsctl \
6231 set Bridge int-br sflow=@sf -- \
6232 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6233 header=128 sampling=1 polling=0
6234
a8704b50
PS
6235dnl set up route to 192.168.1.2 via br0
6236AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
6237])
6238AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
6239])
6240
7321bda3
NM
6241dnl add rule for int-br to force packet onto tunnel. There is no ifindex
6242dnl for this port so the sFlow output will just report that it went to
6243dnl 1 output (out_format=2, out_ifindex=1)
6244AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
6245
6246AT_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)'])
6247
6248dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6249for i in `seq 1 30`; do
6250 ovs-appctl time/warp 100
6251done
6252
d9c8c57c 6253OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
6254
6255AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6256 /g']], [0], [dnl
6257HEADER
6258 dgramSeqNo=1
6259 ds=127.0.0.1>2:1000
6260 fsSeqNo=1
f5f64552
JS
6261 tunnel4_out_length=0
6262 tunnel4_out_protocol=47
6263 tunnel4_out_src=1.1.2.88
6264 tunnel4_out_dst=1.1.2.92
6265 tunnel4_out_src_port=0
6266 tunnel4_out_dst_port=0
6267 tunnel4_out_tcp_flags=0
6268 tunnel4_out_tos=0
6269 tunnel_out_vni=456
7321bda3
NM
6270 in_vlan=0
6271 in_priority=0
6272 out_vlan=0
6273 out_priority=0
6274 meanSkip=1
6275 samplePool=1
6276 dropEvents=0
6277 in_ifindex=2011
6278 in_format=0
f5f64552 6279 out_ifindex=1
7321bda3
NM
6280 out_format=2
6281 hdr_prot=1
efe179e0 6282 pkt_len=46
7321bda3 6283 stripped=4
efe179e0
DDP
6284 hdr_len=42
6285 hdr=50-54-00-00-00-0A-50-54-00-00-00-05-08-00-45-00-00-1C-00-00-00-00-80-01-B6-8D-C0-A8-01-01-C0-A8-02-02-08-00-F7-FF-00-00-00-00
7321bda3
NM
6286])
6287
6288OVS_VSWITCHD_STOP
6289AT_CLEANUP
6290
6291AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
7ad705c6 6292AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
7321bda3
NM
6293OVS_VSWITCHD_START
6294AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6295add_of_ports br0 1 2
7321bda3
NM
6296AT_DATA([flows.txt], [dnl
6297table=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
6298table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6299])
6300AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6301
6302dnl set up sFlow logging
7321bda3
NM
6303AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6304AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6305PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
6306ovs-appctl time/stop
6307
6308dnl configure sflow
6309ovs-vsctl \
6310 set Bridge br0 sflow=@sf -- \
6311 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6312 header=128 sampling=1 polling=0
6313
6314AT_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)'])
6315AT_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)'])
6316
6317dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6318for i in `seq 1 30`; do
6319 ovs-appctl time/warp 100
6320done
6321
d9c8c57c 6322OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
6323
6324AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6325 /g']], [0], [dnl
6326HEADER
6327 dgramSeqNo=1
6328 ds=127.0.0.1>2:1000
6329 fsSeqNo=1
6330 mpls_label_0=789
6331 mpls_tc_0=4
6332 mpls_ttl_0=32
6333 mpls_bos_0=0
6334 mpls_label_1=11
6335 mpls_tc_1=3
6336 mpls_ttl_1=64
6337 mpls_bos_1=1
6338 in_vlan=0
6339 in_priority=0
6340 out_vlan=0
6341 out_priority=0
6342 meanSkip=1
6343 samplePool=1
6344 dropEvents=0
6345 in_ifindex=0
6346 in_format=0
6347 out_ifindex=1
6348 out_format=2
6349 hdr_prot=1
efe179e0 6350 pkt_len=22
7321bda3 6351 stripped=4
efe179e0
DDP
6352 hdr_len=18
6353 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40
7321bda3
NM
6354HEADER
6355 dgramSeqNo=1
6356 ds=127.0.0.1>2:1000
6357 fsSeqNo=2
6358 mpls_label_0=789
6359 mpls_tc_0=4
6360 mpls_ttl_0=32
6361 mpls_bos_0=1
6362 in_vlan=0
6363 in_priority=0
6364 out_vlan=0
6365 out_priority=0
6366 meanSkip=1
6367 samplePool=2
6368 dropEvents=0
6369 in_ifindex=0
6370 in_format=0
6371 out_ifindex=1
6372 out_format=2
6373 hdr_prot=1
efe179e0 6374 pkt_len=38
7321bda3 6375 stripped=4
efe179e0
DDP
6376 hdr_len=34
6377 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
6378])
6379
6380OVS_VSWITCHD_STOP
6381AT_CLEANUP
6382
6383
4819b3a5 6384# CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
6385#
6386# Test that basic NetFlow reports flow statistics correctly:
6387# The initial packet of a flow are correctly accounted.
6388# Later packets within a flow are correctly accounted.
6389# Flow actions changing (in this case, due to MAC learning)
6390# cause a record to be sent.
e731d71b 6391m4_define([CHECK_NETFLOW_EXPIRATION],
4819b3a5 6392 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 6393 add_of_ports br0 1 2
e731d71b
AS
6394
6395 ovs-appctl time/stop
53eb8cb8 6396 on_exit 'kill `cat test-netflow.pid`'
eadd1644 6397 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 6398 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 6399 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
6400
6401 ovs-vsctl \
6402 set Bridge br0 netflow=@nf -- \
6403 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6404 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6405
6406 for delay in 1000 30000; do
6407 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 6408 sleep 1 # ensure the order in which these two packets are processed
e731d71b
AS
6409 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)'
6410
6411 ovs-appctl time/warp $delay
6412 done
17f7f7e0 6413
e731d71b 6414 ovs-appctl time/warp 6000
27f57736 6415 ovs-appctl revalidator/wait
e731d71b 6416 OVS_VSWITCHD_STOP
d9c8c57c 6417 OVS_APP_EXIT_AND_WAIT([test-netflow])
e79a6c83 6418
efe179e0 6419 AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 42 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
e79a6c83 6420
efe179e0 6421 AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 2, 1 pkts, 42 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
e79a6c83 6422
efe179e0
DDP
6423 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 84 bytes, ICMP 0:0" netflow.log | wc -l`
6424 separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 42 bytes, ICMP 0:0" netflow.log | wc -l`
4819b3a5 6425 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
17f7f7e0 6426
4819b3a5
BP
6427AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
6428CHECK_NETFLOW_EXPIRATION([127.0.0.1])
6429AT_CLEANUP
17f7f7e0 6430
4819b3a5
BP
6431AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
6432AT_SKIP_IF([test $HAVE_IPV6 = no])
6433CHECK_NETFLOW_EXPIRATION([[[::1]]])
6434AT_CLEANUP
1e04fcc8 6435
4819b3a5 6436# CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
6437#
6438# Test that basic NetFlow reports active expirations correctly.
e731d71b 6439m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
4819b3a5 6440 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 6441 add_of_ports br0 1 2
17f7f7e0 6442
53eb8cb8 6443 on_exit 'kill `cat test-netflow.pid`'
eadd1644 6444 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 6445 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 6446 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
17f7f7e0 6447
e731d71b
AS
6448 ovs-vsctl \
6449 set Bridge br0 netflow=@nf -- \
6450 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6451 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
17f7f7e0 6452
e731d71b
AS
6453 AT_CHECK([ovs-appctl time/stop])
6454 n=1
6455 while test $n -le 60; do
6456 n=`expr $n + 1`
17f7f7e0 6457
e731d71b
AS
6458 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)'
6459 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 6460
e731d71b
AS
6461 ovs-appctl time/warp 1000
6462 done
17f7f7e0 6463
e731d71b
AS
6464 ovs-appctl time/warp 10000
6465
27f57736 6466 ovs-appctl revalidator/wait
e731d71b 6467 OVS_VSWITCHD_STOP
d9c8c57c 6468 OVS_APP_EXIT_AND_WAIT([test-netflow])
e731d71b
AS
6469
6470 # Count the number of reported packets:
6471 # - From source to destination before MAC learning kicks in (just one).
6472 # - From source to destination after that.
6473 # - From destination to source.
6474 n_learn=0
6475 n_in=0
6476 n_out=0
6477 n_other=0
6478 n_recs=0
6479 none=0
6480 while read line; do
6481 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
6482 case $pkts in
6483 [[0-9]]*) ;;
6484 *) continue ;;
6485 esac
6486
6487 case $line in
6488 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6489 counter=n_learn
6490 ;;
6491 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6492 counter=n_in
6493 ;;
6494 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
6495 counter=n_out
6496 ;;
6497 *)
6498 counter=n_other
6499 ;;
6500 esac
6501 eval $counter=\`expr \$$counter + \$pkts\`
6502 n_recs=`expr $n_recs + 1`
6503 done < netflow.log
6504
6505 # There should be exactly 1 MAC learning packet,
6506 # exactly 59 other packets in that direction,
6507 # and exactly 60 packets in the other direction.
6508 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
4819b3a5 6509])])
e731d71b 6510
4819b3a5
BP
6511AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
6512CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
6513AT_CLEANUP
e731d71b 6514
4819b3a5
BP
6515AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
6516AT_SKIP_IF([test $HAVE_IPV6 = no])
6517CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
6518AT_CLEANUP
f27f2134 6519
3d198ea5 6520dnl In the absence of an IPFIX collector to verify protocol correctness, simply
fb8f22c1 6521dnl configure bridge IPFIX and ensure that sample action generation works at the
3d198ea5 6522dnl datapath level.
fb8f22c1 6523AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
3d198ea5 6524OVS_VSWITCHD_START
ca5792f0 6525add_of_ports br0 1 2
3d198ea5 6526
fb8f22c1 6527dnl Sample every packet using bridge-based sampling.
3d198ea5
JS
6528AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
6529 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
6530 sampling=1], [0], [ignore])
6531
fb8f22c1 6532dnl Send some packets that should be sampled.
3d198ea5
JS
6533for i in `seq 1 3`; do
6534 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)'])
6535done
6536AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6537flow-dump from non-dpdk interfaces:
72471622 6538packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))
3d198ea5
JS
6539])
6540
31b29c2e
AZ
6541AT_CHECK([ovs-appctl revalidator/purge])
6542dnl
6543dnl Add a slowpath meter. The userspace action should be metered.
6544AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])
6545
6546dnl Send some packets that should be sampled and metered.
6547for i in `seq 1 3`; do
6548 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)'])
6549done
6550AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6551flow-dump from non-dpdk interfaces:
6552packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))
6553])
6554
fb8f22c1 6555dnl Remove the IPFIX configuration.
3d198ea5
JS
6556AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
6557AT_CHECK([ovs-appctl revalidator/purge])
6558
6559dnl Send some more packets, to ensure that these are not sampled.
6560for i in `seq 1 3`; do
6561 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)'])
6562done
6563AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6564flow-dump from non-dpdk interfaces:
efe179e0 6565packets:2, bytes:68, used:0.001s, actions:drop
3d198ea5
JS
6566])
6567
6568OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6569AT_CLEANUP
6570
fb8f22c1
BY
6571dnl Bridge IPFIX statistics check
6572AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
6573OVS_VSWITCHD_START
6574add_of_ports br0 1 2
6575
6576dnl Negative test check.
6577AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
6578OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6579NXST_IPFIX_BRIDGE request (xid=0x2):
6580])
6581
6582dnl Sample every packet using bridge-based sampling.
6583AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
6584 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
6585 sampling=1], [0], [ignore])
6586
6587dnl Send some packets that should be sampled.
6588for i in `seq 1 20`; do
6589 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)'])
6590done
6591
6592dnl There are 4 extra IPFIX template packets.
266f8e62 6593AT_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 6594NXST_IPFIX_BRIDGE reply (xid=0x2):
266f8e62
BY
6595 bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
6596 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
fb8f22c1
BY
6597])
6598
6599dnl Remove the IPFIX configuration.
6600AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
6601AT_CHECK([ovs-appctl revalidator/purge])
6602
6603dnl Send some more packets, to ensure that these are not sampled.
6604for i in `seq 1 2`; do
6605 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)'])
6606done
6607AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
6608OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6609NXST_IPFIX_BRIDGE request (xid=0x2):
6610])
6611
6612OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6613AT_CLEANUP
6614
6615dnl Flow IPFIX sanity check
6616AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
6617OVS_VSWITCHD_START
6618add_of_ports br0 1 2
6619
cbef684c
BP
6620# Check for regression against a bug where an invalid target caused an
6621# assertion failure and a crash.
6622AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6623 -- --id=@ipfix create IPFIX targets=\"xyzzy\" \
6624 -- --id=@cs create Flow_Sample_Collector_Set id=0 bridge=@br0 ipfix=@ipfix],
6625 [0], [ignore])
6626
fb8f22c1
BY
6627AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6628 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6629 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6630 [0], [ignore])
6631
6632AT_DATA([flows.txt], [dnl
6633in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
6634])
6635
6636AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6637
6638dnl Send some packets that should be sampled.
6639for i in `seq 1 3`; do
6640 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)'])
6641done
6642AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6643flow-dump from non-dpdk interfaces:
72471622 6644packets: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
6645])
6646
6647dnl Remove the flow which contains sample action.
6648AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
6649AT_CHECK([ovs-appctl revalidator/purge])
6650
6651dnl Send some more packets, to ensure that these are not sampled.
6652for i in `seq 1 3`; do
6653 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)'])
6654done
6655AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6656flow-dump from non-dpdk interfaces:
efe179e0 6657packets:2, bytes:68, used:0.001s, actions:drop
fb8f22c1
BY
6658])
6659
cbef684c
BP
6660OVS_VSWITCHD_STOP(["/sending to collector failed/d
6661/xyzzy/d
6662/no collectors/d"])
fb8f22c1
BY
6663AT_CLEANUP
6664
f69f713b
BY
6665dnl Flow IPFIX sanity check for tunnel set
6666AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
f69f713b
BY
6667OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6668 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6669 options:key=5 ofport_request=1\
6670 -- add-port br0 p2 -- set Interface p2 type=stt \
6671 options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
6672 options:key=6 ofport_request=2\
6673 -- add-port br0 p3 -- set Interface p3 type=dummy \
6674 ofport_request=3 \
6675 -- --id=@br0 get Bridge br0 \
6676 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6677 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6678 [<0>
6679<1>
6680])
6681
6682OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6683
6684dnl Add openflow sample action without sampling_port.
6685AT_DATA([flows.txt], [dnl
6686in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
6687])
6688AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6689
6690AT_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])
6691AT_CHECK([tail -1 stdout], [0], [dnl
72471622 6692Datapath 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
6693])
6694
6695dnl Remove the flow which contains sample action.
6696AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6697AT_CHECK([ovs-appctl revalidator/purge])
6698
6699dnl Add openflow sample action with sampling_port which is
6700dnl equal to output port.
6701AT_DATA([flows2.txt], [dnl
6702in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
6703])
6704AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
6705
6706AT_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])
6707dnl Make sure flow sample action in datapath is behind set tunnel
6708dnl action at egress point of tunnel port.
6709AT_CHECK([tail -1 stdout], [0], [dnl
72471622 6710Datapath 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
6711])
6712
6713dnl Remove the flow which contains sample action.
6714AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6715AT_CHECK([ovs-appctl revalidator/purge])
6716
6717dnl Add a rule with two sample actions and each sample action
6718dnl has a sampling_port
6719AT_DATA([flows3.txt], [dnl
6720in_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
6721])
6722AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
6723
6724AT_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])
6725dnl Make sure flow sample action in datapath is behind set tunnel
6726dnl action at egress point of tunnel port.
6727AT_CHECK([tail -1 stdout], [0], [dnl
72471622 6728Datapath 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
6729])
6730
6731dnl Remove the flow which contains sample action.
6732AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6733AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
6734
6735OVS_VSWITCHD_STOP
6736AT_CLEANUP
6737
7ae62a67
WT
6738AT_SETUP([ofproto-dpif - clone action])
6739OVS_VSWITCHD_START
6740add_of_ports br0 1 2 3 4
6741
6742AT_DATA([flows.txt], [dnl
6743in_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
6744])
6745AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6746
6747AT_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])
6748
bef503e8
AZ
6749AT_CHECK([tail -1 stdout], [0], [dnl
6750Datapath actions: clone(set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2),clone(set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3),4
6751])
6752
6753dnl Test flow xlate openflow clone action without using datapath clone action.
6754AT_CHECK([ovs-appctl dpif/disable-dp-clone br0], [0],
6755[Datapath clone action disabled for bridge br0
6756])
6757
6758AT_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])
6759
7ae62a67 6760AT_CHECK([tail -1 stdout], [0], [dnl
456024cb 6761Datapath actions: sample(sample=100.0%,actions(set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2)),sample(sample=100.0%,actions(set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3)),4
7ae62a67
WT
6762])
6763
6764OVS_VSWITCHD_STOP
6765AT_CLEANUP
6766
fb8f22c1
BY
6767dnl Flow based IPFIX statistics check
6768AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
6769OVS_VSWITCHD_START
6770add_of_ports br0 1 2
6771
6772dnl Negative test check.
6773AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
6774OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6775NXST_IPFIX_FLOW request (xid=0x2):
6776])
6777
6778AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6779 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6780 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6781 [0], [ignore])
6782
6783AT_DATA([flows.txt], [dnl
6784in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
6785])
6786
6787AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6788
6789dnl Send some packets that should be sampled.
6790for i in `seq 1 20`; do
6791 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)'])
6792done
6793
6794dnl There are 4 extra IPFIX template packets.
266f8e62 6795AT_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 6796NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
266f8e62
BY
6797 id 1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
6798 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
fb8f22c1
BY
6799])
6800
6801dnl Remove the flow which contains sample action.
6802AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
6803AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
6804AT_CHECK([ovs-appctl revalidator/purge])
6805
6806dnl Send some more packets, to ensure that these are not sampled.
6807for i in `seq 1 3`; do
6808 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)'])
6809done
6810AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
6811OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6812NXST_IPFIX_FLOW request (xid=0x2):
6813])
6814
6815OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6816AT_CLEANUP
6817
23a7d252
JS
6818AT_SETUP([ofproto-dpif - flow stats])
6819OVS_VSWITCHD_START
6820AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
6821AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
6822
6823ovs-appctl time/stop
6824
6825for i in `seq 1 10`; do
6826 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)'
6827done
6828
cea4a6d7
JS
6829AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6830AT_CHECK([ovs-appctl revalidator/purge], [0])
e96a5c24 6831AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 6832AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
e96a5c24 6833 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
efe179e0 6834 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=540, idle_age=1, ip actions=NORMAL
e96a5c24
JS
6835])
6836OVS_VSWITCHD_STOP
6837AT_CLEANUP
8b6987d7
JR
6838
6839AT_SETUP([ofproto-dpif - flow stats reset_counts])
6840OVS_VSWITCHD_START
6841flow="ip,actions=NORMAL"
6842
6843ovs-appctl time/stop
6844
6845AT_CHECK([ovs-ofctl add-flow br0 $flow])
6846
6847warp_and_dump_NXM () {
6848 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6849 AT_CHECK([ovs-appctl revalidator/purge], [0])
6850
6851 AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0], [0], [stdout])
6852 if [[ $5 -gt 0 ]]; then
6853 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, hard_age=$5, ip actions=NORMAL"
6854 else
6855 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, ip actions=NORMAL"
6856 fi
6857 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
6858$expected
6859])
6860}
6861
6862warp_and_dump_OF () {
6863 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6864 AT_CHECK([ovs-appctl revalidator/purge], [0])
6865
6866 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0], [0], [stdout])
6867 if [[ $1 -lt 13 -o "$5X" = "X" ]]; then
6868 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, ip actions=NORMAL"
6869 else
6870 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $5 ip actions=NORMAL"
6871 fi
6872 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
6873$expected
6874])
6875}
6876
6877send_packet () {
6878 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)'
6879}
6880
6881# OpenFlow 1.0, implicit reset_counts
6882send_packet
6883warp_and_dump_NXM 1 1 54 1
6884AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 add-flow br0 $flow])
6885# add-flow resets duration and counts,
6886# but idle age is inherited from the old flow
6887warp_and_dump_NXM 1 0 0 2
6888
6889send_packet
6890warp_and_dump_NXM 2 1 54 1
6891AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 mod-flows br0 $flow])
6892# mod-flows resets hard_age, but not counts
6893# but duration and idle_age is inherited from the old flow
6894warp_and_dump_NXM 3 1 54 2 1
6895
6896# OpenFlow 1.1, implicit reset_counts
6897send_packet
6898warp_and_dump_OF 11 4 2 108
6899AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 add-flow br0 $flow])
6900# add-flow resets duration and counts,
6901# but idle age is inherited from the old flow
6902warp_and_dump_NXM 1 0 0 2
6903warp_and_dump_OF 11 2 0 0
6904
6905send_packet
6906warp_and_dump_OF 11 3 1 54
6907AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 mod-flows br0 $flow])
6908# mod-flows resets hard_age, but not counts
6909# but duration and idle_age is inherited from the old flow
6910warp_and_dump_NXM 4 1 54 2 1
6911warp_and_dump_OF 11 5 1 54
6912
6913# OpenFlow 1.2, explicit reset_counts
6914send_packet
6915warp_and_dump_OF 12 6 2 108
6916AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 $flow])
6917# add-flow without flags resets duration, but not counts,
6918# idle age is inherited from the old flow
6919warp_and_dump_NXM 1 2 108 2
6920warp_and_dump_OF 12 2 2 108
6921
6922send_packet
6923warp_and_dump_OF 12 3 3 162
6924AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 $flow])
6925# mod-flows without flags does not reset duration nor counts,
6926# idle age is inherited from the old flow
6927warp_and_dump_NXM 4 3 162 2 1
6928warp_and_dump_OF 12 5 3 162
6929
6930send_packet
6931warp_and_dump_OF 12 6 4 216
6932AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 reset_counts,$flow])
6933# add-flow with reset_counts resets both duration and counts,
6934# idle age is inherited from the old flow
6935warp_and_dump_NXM 1 0 0 2
6936warp_and_dump_OF 12 2 0 0
6937
6938send_packet
6939warp_and_dump_OF 12 3 1 54
6940AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 reset_counts,$flow])
6941# mod-flows with reset_counts resets counts, but not duration,
6942# idle age is inherited from the old flow
6943warp_and_dump_NXM 4 0 0 2 1
6944warp_and_dump_OF 12 5 0 0
6945
6946# OpenFlow > 1.3, explicit reset_counts
6947flow_mods_reset_counts () {
6948 # Reset to a known state
6949 AT_CHECK([ovs-ofctl add-flow br0 $flow])
6950
6951 send_packet
6952 warp_and_dump_OF $1 1 1 54 reset_counts
6953 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
6954 # add-flow without flags resets duration, but not counts,
6955 # idle age is inherited from the old flow
6956 warp_and_dump_NXM 1 1 54 2
6957 warp_and_dump_OF $1 2 1 54
6958
6959 send_packet
6960 warp_and_dump_OF $1 3 2 108
6961 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
6962 # mod-flows without flags does not reset duration nor counts,
6963 # idle age is inherited from the old flow
6964 warp_and_dump_NXM 4 2 108 2 1
6965 warp_and_dump_OF $1 5 2 108
6966
6967 send_packet
6968 warp_and_dump_OF $1 6 3 162
6969 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
6970 # add-flow with reset_counts resets both duration and counts,
6971 # idle age is inherited from the old flow
6972 warp_and_dump_NXM 1 0 0 2
6973 warp_and_dump_OF $1 2 0 0 reset_counts
6974
6975 send_packet
6976 warp_and_dump_OF $1 3 1 54 reset_counts
6977 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
6978 # mod-flows with reset_counts resets counts, but not duration,
6979 # idle age is inherited from the old flow
6980 warp_and_dump_NXM 4 0 0 2 1
6981 warp_and_dump_OF $1 5 0 0 reset_counts
6982
6983 # Modify flow having reset_counts flag without reset_counts
6984 send_packet
6985 warp_and_dump_OF $1 6 1 54 reset_counts
6986 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
6987 warp_and_dump_NXM 7 1 54 2 1
6988 warp_and_dump_OF $1 8 1 54 reset_counts
6989
6990 # Add flow having reset_counts flag without reset_counts
6991 send_packet
6992 warp_and_dump_OF $1 9 2 108 reset_counts
6993 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
6994 warp_and_dump_NXM 1 2 108 2
6995 warp_and_dump_OF $1 2 2 108
6996
6997 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
6998 send_packet
6999 warp_and_dump_OF $1 3 3 162
7000 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7001 warp_and_dump_NXM 4 0 0 2 1
7002 warp_and_dump_OF $1 5 0 0
7003}
7004
7005# OpenFlow versions >= 1.3 should behave the same way
7006flow_mods_reset_counts 13
7007flow_mods_reset_counts 14
7008flow_mods_reset_counts 15
7009
7010OVS_VSWITCHD_STOP
7011AT_CLEANUP
e96a5c24
JS
7012
7013AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
7014OVS_VSWITCHD_START
7015AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7016AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7017
7018ovs-appctl time/stop
7019
7020for i in `seq 1 10`; do
7021 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)'
7022done
7023
7024ovs-appctl time/warp 100
7025AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
7026ovs-appctl time/warp 1000
7027
23a7d252 7028AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 7029AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
23a7d252 7030 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
efe179e0 7031 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=540, idle_age=1, ip actions=NORMAL
23a7d252
JS
7032])
7033OVS_VSWITCHD_STOP
7034AT_CLEANUP
7035
5f5ebd4c 7036AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
f27f2134
BP
7037OVS_VSWITCHD_START
7038
7039# get_ages DURATION HARD IDLE
7040#
7041# Fetch the flow duration, hard age, and idle age into the variables
7042# whose names are given as arguments. Rounds DURATION down to the
7043# nearest integer. If hard_age doesn't appear in the output, sets
7044# HARD to "none". If idle_age doesn't appear in the output, sets IDLE
7045# to 0.
7046get_ages () {
7047 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7048
7049 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
7050 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
7051 AS_VAR_COPY([$1], [duration])
7052
7053 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
7054 if test X"$hard" = X; then
7055 hard=none
7056 else
7057 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
7058 fi
7059 AS_VAR_COPY([$2], [hard])
7060
7061 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
7062 if test X"$idle" = X; then
7063 idle=0
7064 else
7065 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
7066 fi
7067 AS_VAR_COPY([$3], [idle])
7068}
7069
7070# Add a flow and get its initial hard and idle age.
7071AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
7072get_ages duration1 hard1 idle1
7073
31ef9f51 7074ovs-appctl time/stop
f27f2134
BP
7075# Warp time forward by 10 seconds, then modify the flow's actions.
7076ovs-appctl time/warp 10000
7077get_ages duration2 hard2 idle2
7078AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
7079
7080# Warp time forward by 10 seconds.
7081ovs-appctl time/warp 10000
7082get_ages duration3 hard3 idle3
7083
7084# Warp time forward 10 more seconds, then pass some packets through the flow,
7085# then warp forward a few more times because idle times are only updated
7086# occasionally.
7087ovs-appctl time/warp 10000
7088ovs-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 7089ovs-appctl time/warp 3000 1000
c0526804 7090sleep 1
f27f2134
BP
7091get_ages duration4 hard4 idle4
7092
7093printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
7094printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
7095printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
7096
7097# Duration should increase steadily over time.
7098AT_CHECK([test $duration1 -lt $duration2])
7099AT_CHECK([test $duration2 -lt $duration3])
7100AT_CHECK([test $duration3 -lt $duration4])
7101
7102# Hard age should be "none" initially because it's the same as flow_duration,
7103# then it should increase.
7104AT_CHECK([test $hard1 = none])
7105AT_CHECK([test $hard2 = none])
7106AT_CHECK([test $hard3 != none])
7107AT_CHECK([test $hard4 != none])
7108AT_CHECK([test $hard3 -lt $hard4])
7109
7110# Idle age should increase from 1 to 2 to 3, then decrease.
7111AT_CHECK([test $idle1 -lt $idle2])
7112AT_CHECK([test $idle2 -lt $idle3])
7113AT_CHECK([test $idle3 -gt $idle4])
7114
7115# Check some invariant relationships.
7116AT_CHECK([test $duration1 = $idle1])
7117AT_CHECK([test $duration2 = $idle2])
7118AT_CHECK([test $duration3 = $idle3])
7119AT_CHECK([test $idle3 -gt $hard3])
7120AT_CHECK([test $idle4 -lt $hard4])
7121AT_CHECK([test $hard4 -lt $duration4])
7122
7123OVS_VSWITCHD_STOP
7124AT_CLEANUP
0e553d9c
BP
7125
7126AT_SETUP([ofproto-dpif - fin_timeout])
7127OVS_VSWITCHD_START
b5c1a5df 7128ovs-appctl time/stop
0e553d9c
BP
7129AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
7130AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7131[NXST_FLOW reply:
7132 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7133])
31ef9f51 7134
0e553d9c
BP
7135# Check that a TCP SYN packet does not change the timeout. (Because
7136# flow stats updates are mainly what implements the fin_timeout
7137# feature, we warp forward a couple of times to ensure that flow stats
7138# run before re-checking the flow table.)
323cc924 7139AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
0e553d9c
BP
7140AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7141warped
7142])
cea4a6d7 7143AT_CHECK([ovs-appctl revalidator/purge], [0])
0e553d9c
BP
7144AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7145[NXST_FLOW reply:
7146 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7147])
7148# Check that a TCP FIN packet does change the timeout.
323cc924 7149AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
0e553d9c
BP
7150AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7151warped
7152])
7153AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7154[NXST_FLOW reply:
7155 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
7156])
7157OVS_VSWITCHD_STOP
7158AT_CLEANUP
27022416
JP
7159
7160AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
7161OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
ca5792f0
BP
7162add_of_ports br0 1 2
7163add_of_ports br1 3
27022416
JP
7164
7165AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
7166dummy@br0
7167dummy@br1
7168])
7169OVS_VSWITCHD_STOP
7170AT_CLEANUP
7171
7172AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
e539ba87
IM
7173OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
7174 [--dummy-numa="0,0,0,0,1,1,1,1"])
7175add_pmd_of_ports br0 1 2
ca5792f0 7176add_of_ports br1 3
27022416 7177
e539ba87 7178AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
dc54ef36 7179dummy@ovs-dummy: hit:0 missed:0
e79a6c83 7180 br0:
e98d0cb3 7181 br0 65534/100: (dummy-internal)
e539ba87
IM
7182 p1 1/1: (dummy-pmd: <cleared>)
7183 p2 2/2: (dummy-pmd: <cleared>)
e79a6c83 7184 br1:
e98d0cb3 7185 br1 65534/101: (dummy-internal)
dc54ef36 7186 p3 3/3: (dummy)
27022416
JP
7187])
7188OVS_VSWITCHD_STOP
7189AT_CLEANUP
7190
7191AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
054e5aa6 7192# bump max-idle to avoid the flows being reclaimed behind us
27022416 7193OVS_VSWITCHD_START([add-br br1 -- \
054e5aa6 7194 set bridge br1 datapath-type=dummy fail-mode=secure -- \
e539ba87
IM
7195 set Open_vSwitch . other_config:max-idle=10000], [], [],
7196 [--dummy-numa="0,0,0,0,1,1,1,1"])
7197add_of_ports br0 1
7198add_pmd_of_ports br0 2
ca5792f0 7199add_of_ports br1 3
27022416 7200
323cc924
BP
7201AT_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)'])
7202AT_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)'])
7203AT_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 7204ovs-appctl revalidator/wait
3a18d0c2 7205AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
16194afd
DDP
7206recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7207recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
27022416
JP
7208])
7209
3a18d0c2 7210AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
16194afd 7211recirc_id(0),in_port(3),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
27022416
JP
7212])
7213
3a18d0c2 7214AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
5cf3edb3
DDP
7215skb_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),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
7216skb_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),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
7217])
7218
3a18d0c2 7219AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
5cf3edb3 7220skb_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),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
7221])
7222
7223OVS_VSWITCHD_STOP
7224AT_CLEANUP
7225
e539ba87
IM
7226m4_define([OFPROTO_DPIF_GET_FLOW],
7227 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
818650e6 7228
e539ba87
IM
7229 OVS_VSWITCHD_START([add-br br1 -- \
7230 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7231 set Open_vSwitch . other_config:max-idle=10000], [], [],
7232 [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
818650e6 7233
e539ba87
IM
7234 func=`echo -n "$1_" | cut -c 4-`
7235 add_${func}of_ports br0 1 2
7236
7237 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)'])
7238 ovs-appctl revalidator/wait
7239 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
818650e6 7240
e539ba87
IM
7241 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
7242 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
818650e6 7243recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
04b541df
GS
7244])
7245
e539ba87
IM
7246 OVS_VSWITCHD_STOP
7247 AT_CLEANUP])
7248
7249OFPROTO_DPIF_GET_FLOW([])
7250OFPROTO_DPIF_GET_FLOW([ - pmd])
27022416 7251
50c1efc9 7252AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
8bfd0fda
BP
7253OVS_VSWITCHD_START([dnl
7254 add-port br0 p1 -- set Interface p1 type=dummy
7255])
623540e4 7256AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 7257on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
7258
7259AT_CAPTURE_FILE([ofctl_monitor.log])
7260AT_DATA([flows.txt], [dnl
7261dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 7262dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
7263])
7264AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7265
7266dnl Packet is sent to userspace because a MPLS push or pop action is applied to
47fb7f71 7267dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
8bfd0fda 7268dnl
47fb7f71 7269dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
8bfd0fda 7270dnl 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
7271dnl (label 20, exp 0, [S], ttl 32)
7272dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7273dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7274
7275for dl_src in 00 01; do
47fb7f71 7276 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
7277done
7278sleep 1 # wait for the datapath flow installed
2be3fe44 7279AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9044f2c1
JG
7280recirc_id(0),in_port(1),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:userspace(pid=0,slow_path(controller))
7281recirc_id(0),in_port(1),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:userspace(pid=0,slow_path(controller))
8bfd0fda 7282])
8bfd0fda
BP
7283
7284OVS_VSWITCHD_STOP
7285AT_CLEANUP
7286
7287
50c1efc9 7288AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
8bfd0fda
BP
7289OVS_VSWITCHD_START([dnl
7290 add-port br0 p1 -- set Interface p1 type=dummy
7291])
623540e4 7292AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 7293on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
7294
7295AT_CAPTURE_FILE([ofctl_monitor.log])
7296AT_DATA([flows.txt], [dnl
7297dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 7298dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
7299])
7300AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7301
7302dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
7303dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
47fb7f71 7304dnl can't determine the resulting MPLS label after MPLS push/pop actions.
8bfd0fda
BP
7305dnl
7306dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
7307dnl 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)
7308dnl (label 20, exp 0, ttl 32)
7309dnl (label 20, exp 0, ttl 32)
7310dnl (label 20, exp 0, [S], ttl 32)
7311dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7312dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
8bfd0fda 7313
47fb7f71
JS
7314for dl_src in 00 01; do
7315 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
7316done
7317sleep 1 # wait for the datapath flow installed
2be3fe44 7318AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9044f2c1
JG
7319recirc_id(0),in_port(1),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:userspace(pid=0,slow_path(controller))
7320recirc_id(0),in_port(1),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:userspace(pid=0,slow_path(controller))
8bfd0fda
BP
7321])
7322
7323OVS_VSWITCHD_STOP
7324AT_CLEANUP
7325
0a740f48
EJ
7326AT_SETUP([ofproto-dpif - patch ports])
7327OVS_VSWITCHD_START([add-br br1 \
7328-- set bridge br1 datapath-type=dummy fail-mode=secure \
7329-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
7330-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
7331
ca5792f0
BP
7332add_of_ports br0 2
7333add_of_ports br1 3
0a740f48 7334
64bb477f
JS
7335AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7336], [])
aef0491b 7337AT_CHECK([ovs-appctl time/stop])
623540e4 7338AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9fc0165a 7339
0a740f48
EJ
7340AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
7341AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
7342
7343for i in $(seq 1 10); do
7344 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
7345 if [[ $i -eq 1 ]]; then
7346 sleep 1
7347 fi
0a740f48
EJ
7348done
7349
7350for i in $(seq 1 5); do
7351 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
7352 if [[ $i -eq 1 ]]; then
7353 sleep 1
7354 fi
0a740f48
EJ
7355done
7356
0a8763fc
EJ
7357AT_CHECK([ovs-appctl time/warp 500], [0],
7358[warped
735d7efb 7359])
732207ad 7360sleep 1 # wait for log writer
735d7efb 7361
0a740f48 7362AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dc54ef36 7363dummy@ovs-dummy: hit:13 missed:2
e79a6c83 7364 br0:
e98d0cb3 7365 br0 65534/100: (dummy-internal)
dc54ef36
EJ
7366 p2 2/2: (dummy)
7367 pbr0 1/none: (patch: peer=pbr1)
e79a6c83 7368 br1:
e98d0cb3 7369 br1 65534/101: (dummy-internal)
dc54ef36
EJ
7370 p3 3/3: (dummy)
7371 pbr1 1/none: (patch: peer=pbr0)
0a740f48
EJ
7372])
7373
2be3fe44 7374AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9044f2c1
JG
7375recirc_id(0),in_port(100),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
7376recirc_id(0),in_port(101),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
c2a77f33
JS
7377])
7378
2be3fe44 7379AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
efe179e0 7380skb_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),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:378, used:0.0s, actions:101,3,2
c2a77f33 7381])
2be3fe44 7382AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
efe179e0 7383skb_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),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:168, used:0.0s, actions:100,2,3
0a740f48
EJ
7384])
7385
7386AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
7387OFPST_PORT reply (xid=0x4): 1 ports
efe179e0
DDP
7388 port 1: rx pkts=5, bytes=210, drop=?, errs=?, frame=?, over=?, crc=?
7389 tx pkts=10, bytes=420, drop=?, errs=?, coll=?
0a740f48
EJ
7390])
7391
7392AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
7393OFPST_PORT reply (xid=0x4): 1 ports
efe179e0
DDP
7394 port 1: rx pkts=10, bytes=420, drop=?, errs=?, frame=?, over=?, crc=?
7395 tx pkts=5, bytes=210, drop=?, errs=?, coll=?
0a740f48
EJ
7396])
7397
7398OVS_VSWITCHD_STOP
7399AT_CLEANUP
655ab909 7400
1774d762
JR
7401AT_SETUP([ofproto-dpif - patch ports - stack])
7402OVS_VSWITCHD_START([add-br br1 \
7403-- set bridge br1 datapath-type=dummy fail-mode=secure \
7404-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
7405-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
7406
ca5792f0
BP
7407add_of_ports br0 2
7408add_of_ports br1 3
1774d762
JR
7409
7410AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7411], [])
7412AT_CHECK([ovs-appctl time/stop])
7413AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7414
7415AT_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"])
7416# Try to pop from empty stack, and push and leave data to stack.
7417AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
7418
7419ovs-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)'
7420
7421AT_CHECK([ovs-appctl time/warp 500], [0],
7422[warped
7423])
7424
7425OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
7426
7427AT_CHECK([ovs-appctl dpif/show], [0], [dnl
7428dummy@ovs-dummy: hit:0 missed:1
7429 br0:
e98d0cb3 7430 br0 65534/100: (dummy-internal)
1774d762
JR
7431 p2 2/2: (dummy)
7432 pbr0 1/none: (patch: peer=pbr1)
7433 br1:
e98d0cb3 7434 br1 65534/101: (dummy-internal)
1774d762
JR
7435 p3 3/3: (dummy)
7436 pbr1 1/none: (patch: peer=pbr0)
7437])
7438
2be3fe44 7439AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9044f2c1 7440recirc_id(0),in_port(100),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:101,set(ipv4(src=255.255.255.254)),2
1774d762
JR
7441])
7442
2d9b49dd
BP
7443AT_CHECK([grep -e '|ofproto_dpif_xlate|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
7444stack underflow 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 on bridge br1
1774d762
JR
7445])
7446
2d9b49dd 7447OVS_VSWITCHD_STOP(["/stack underflow/d"])
1774d762
JR
7448AT_CLEANUP
7449
65e0be10
BP
7450AT_SETUP([ofproto-dpif - port duration])
7451OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
ca5792f0 7452add_of_ports br0 1 2
65e0be10 7453
31ef9f51 7454ovs-appctl time/stop
65e0be10
BP
7455ovs-appctl time/warp 10000
7456
7457AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
125bf01d 7458AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
65e0be10 7459[dnl
65e0be10 7460 duration=?s
65e0be10 7461 duration=?s
65e0be10
BP
7462 duration=?s
7463])
7464OVS_VSWITCHD_STOP
7465AT_CLEANUP
bcd2633a
JP
7466
7467dnl ----------------------------------------------------------------------
7468AT_BANNER([ofproto-dpif -- megaflows])
7469
bcd2633a
JP
7470AT_SETUP([ofproto-dpif megaflow - port classification])
7471OVS_VSWITCHD_START
623540e4 7472AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7473add_of_ports br0 1 2
bcd2633a
JP
7474AT_DATA([flows.txt], [dnl
7475table=0 in_port=1 actions=output(2)
7476])
7477AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7478AT_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 7479sleep 1
bcd2633a 7480AT_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 7481sleep 1
2be3fe44 7482AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1 7483recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
7484])
7485OVS_VSWITCHD_STOP
7486AT_CLEANUP
7487
7488AT_SETUP([ofproto-dpif megaflow - L2 classification])
7489OVS_VSWITCHD_START
623540e4 7490AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7491add_of_ports br0 1 2
bcd2633a
JP
7492AT_DATA([flows.txt], [dnl
7493table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
7494])
7495AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7496AT_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)'])
7497AT_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 7498sleep 1
2be3fe44 7499AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7500recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7501recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
7502])
7503OVS_VSWITCHD_STOP
7504AT_CLEANUP
7505
7506AT_SETUP([ofproto-dpif megaflow - L3 classification])
7507OVS_VSWITCHD_START
623540e4 7508AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7509add_of_ports br0 1 2
13751fd8 7510AT_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
7511AT_DATA([flows.txt], [dnl
7512table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
7513])
7514AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7515AT_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)'])
7516AT_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 7517sleep 1
2be3fe44 7518AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7519recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
7520recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,frag=no), actions: <del>
bcd2633a
JP
7521])
7522OVS_VSWITCHD_STOP
7523AT_CLEANUP
7524
13751fd8
JR
7525AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
7526OVS_VSWITCHD_START
623540e4 7527AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7528add_of_ports br0 1 2
13751fd8
JR
7529AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=ipv6_dst,ipv6_src], [0], [ignore], [])
7530AT_DATA([flows.txt], [dnl
7531table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
7532])
7533AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7534AT_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)'])
7535AT_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 7536sleep 1
2be3fe44 7537AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7538recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5,frag=no), actions: <del>
7539recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:5:4:3:2:1/ffff:ffff:ffff:fffc::,frag=no), actions: <del>
13751fd8
JR
7540])
7541OVS_VSWITCHD_STOP
7542AT_CLEANUP
7543
bcd2633a
JP
7544AT_SETUP([ofproto-dpif megaflow - L4 classification])
7545OVS_VSWITCHD_START
623540e4 7546AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7547add_of_ports br0 1 2
bcd2633a
JP
7548AT_DATA([flows.txt], [dnl
7549table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
7550])
7551AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7552AT_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 7553sleep 1
bcd2633a 7554AT_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 7555sleep 1
2be3fe44 7556AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1 7557recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=1,frag=no),icmp(type=8), actions: <del>
bcd2633a
JP
7558])
7559OVS_VSWITCHD_STOP
7560AT_CLEANUP
7561
e539ba87
IM
7562m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
7563 [AT_SETUP([ofproto-dpif megaflow - normal$1])
7564 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7565 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7566 func=`echo -n "$1_" | cut -c 4-`
7567 add_${func}of_ports br0 1 2
7568 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7569 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)'])
7570 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)'])
7571 sleep 1
7572 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7573recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
7574recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a 7575])
e539ba87
IM
7576 OVS_VSWITCHD_STOP
7577 AT_CLEANUP])
7578
7579OFPROTO_DPIF_MEGAFLOW_NORMAL([])
7580OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
bcd2633a
JP
7581
7582AT_SETUP([ofproto-dpif megaflow - mpls])
7583OVS_VSWITCHD_START
623540e4 7584AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7585add_of_ports br0 1 2
bcd2633a
JP
7586AT_DATA([flows.txt], [dnl
7587table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
7588table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
7589])
7590AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7591AT_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)'])
7592AT_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 7593sleep 1
3fd12197 7594AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
9044f2c1
JG
7595recirc_id(0),in_port(1),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
7596recirc_id(0),in_port(1),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
7597])
7598OVS_VSWITCHD_STOP
7599AT_CLEANUP
7600
4819b3a5 7601# CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
e731d71b 7602m4_define([CHECK_MEGAFLOW_NETFLOW],
4819b3a5 7603 [OVS_VSWITCHD_START
623540e4 7604 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7605 add_of_ports br0 1 2
e731d71b
AS
7606
7607 dnl NetFlow configuration disables wildcarding relevant fields
53eb8cb8 7608 on_exit 'kill `cat test-netflow.pid`'
eadd1644 7609 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 7610 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 7611 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
7612 ovs-vsctl \
7613 set Bridge br0 netflow=@nf -- \
7614 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
7615 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
7616
7617 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7618 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)'])
7619 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)'])
7620 sleep 1
2be3fe44 7621 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7622recirc_id(0),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/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
7623recirc_id(0),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/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
bcd2633a 7624])
d9c8c57c 7625 OVS_APP_EXIT_AND_WAIT([test-netflow])
4819b3a5 7626 OVS_VSWITCHD_STOP])
e731d71b 7627
4819b3a5 7628AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
e731d71b 7629CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
4819b3a5
BP
7630AT_CLEANUP
7631
7632AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
7633AT_SKIP_IF([test $HAVE_IPV6 = no])
e731d71b 7634CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
4819b3a5 7635AT_CLEANUP
bcd2633a 7636
e539ba87
IM
7637m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
7638 [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
7639 OVS_VSWITCHD_START(
7640 [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
7641 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
7642 set interface p2 type=$1 ofport_request=2 -- \
7643 set interface p3 type=$1 ofport_request=3], [], [],
7644 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
7645 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
bcd2633a 7646])
e539ba87 7647 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a 7648
e539ba87
IM
7649 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7650 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)'])
7651 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)'])
7652 sleep 1
7653 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7654recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
7655recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a 7656])
e539ba87
IM
7657 OVS_VSWITCHD_STOP
7658 AT_CLEANUP])
7659
7660OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
7661OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
bcd2633a
JP
7662
7663AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
7664OVS_VSWITCHD_START(
7665 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
7666 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
7667 set interface p2 type=dummy ofport_request=2 -- \
7668 set interface p3 type=dummy ofport_request=3])
7669AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7670])
623540e4 7671AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a
JP
7672
7673AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7674AT_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)'])
7675AT_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 7676sleep 1
2be3fe44 7677AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7678recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
7679recirc_id(0),in_port(1),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
7680])
7681OVS_VSWITCHD_STOP
7682AT_CLEANUP
7683
7684AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
7685# Create bond0 on br0 with interfaces p0 and p1
7686# and bond1 on br1 with interfaces p2 and p3
7687# with p0 patched to p2 and p1 patched to p3.
7688OVS_VSWITCHD_START(
7689 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
7690 other-config:lacp-time=fast \
7691 other-config:bond-rebalance-interval=0 -- \
7692 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
7693 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
7694 add-br br1 -- \
7695 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
7696 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
7697 fail-mode=secure -- \
7698 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
7699 other-config:lacp-time=fast \
7700 other-config:bond-rebalance-interval=0 -- \
7701 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
7702 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
7703
7704AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7705])
623540e4 7706AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7707add_of_ports br0 7
bcd2633a
JP
7708AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7709AT_CHECK([ovs-ofctl add-flow br1 action=normal])
31ef9f51 7710ovs-appctl time/stop
bcd2633a
JP
7711ovs-appctl time/warp 5000
7712AT_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)'])
7713AT_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 7714sleep 1
2be3fe44 7715AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7716recirc_id(0),in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
7717recirc_id(0),in_port(7),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
7718])
7719OVS_VSWITCHD_STOP
7720AT_CLEANUP
7721
7722AT_SETUP([ofproto-dpif megaflow - resubmit port action])
7723OVS_VSWITCHD_START
623540e4 7724AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7725add_of_ports br0 1 2
bcd2633a
JP
7726AT_DATA([flows.txt], [dnl
7727table=0 in_port=1,ip actions=resubmit(90)
7728table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
7729])
7730AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7731AT_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)'])
7732AT_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 7733sleep 1
2be3fe44 7734AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7735recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7736recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
7737])
7738OVS_VSWITCHD_STOP
7739AT_CLEANUP
7740
7741AT_SETUP([ofproto-dpif megaflow - resubmit table action])
7742OVS_VSWITCHD_START
623540e4 7743AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7744add_of_ports br0 1 2
bcd2633a
JP
7745AT_DATA([flows.txt], [dnl
7746table=0 in_port=1,ip actions=resubmit(,1)
7747table=1 dl_src=50:54:00:00:00:09 actions=output(2)
7748])
7749AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7750AT_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)'])
7751AT_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=
77521,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
ae692725 7753sleep 1
2be3fe44 7754AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7755recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7756recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
7757])
7758OVS_VSWITCHD_STOP
7759AT_CLEANUP
7760
7761AT_SETUP([ofproto-dpif megaflow - goto_table action])
7762OVS_VSWITCHD_START
623540e4 7763AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7764add_of_ports br0 1 2
bcd2633a
JP
7765AT_DATA([flows.txt], [dnl
7766table=0 in_port=1,ip actions=goto_table(1)
7767table=1 dl_src=50:54:00:00:00:09 actions=output(2)
7768])
7769AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
7770AT_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)'])
7771AT_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 7772sleep 1
2be3fe44 7773AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7774recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7775recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
7776])
7777OVS_VSWITCHD_STOP
7778AT_CLEANUP
7779
7780AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
2d5c1a20 7781AT_KEYWORDS([mirror mirrors mirroring])
bcd2633a 7782OVS_VSWITCHD_START
623540e4 7783AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7784add_of_ports br0 1 2 3
bcd2633a
JP
7785ovs-vsctl \
7786 set Bridge br0 mirrors=@m --\
7787 --id=@p3 get Port p3 --\
7788 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
7789
7790AT_DATA([flows.txt], [dnl
7791in_port=1 actions=output:2
7792])
7793AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7794AT_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 7795sleep 1
bcd2633a 7796AT_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 7797sleep 1
2be3fe44 7798AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1 7799recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
7800])
7801OVS_VSWITCHD_STOP
7802AT_CLEANUP
7803
7804AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
7805OVS_VSWITCHD_START
623540e4 7806AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7807add_of_ports br0 1 2 3
bcd2633a
JP
7808ovs-vsctl \
7809 set Bridge br0 mirrors=@m --\
7810 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
7811 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
7812
7813AT_DATA([flows.txt], [dnl
7814in_port=1 actions=output:2
7815])
7816AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7817AT_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))'])
7818AT_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 7819sleep 1
2be3fe44 7820AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7821recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
7822recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=11,pcp=7/0x0),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
bcd2633a
JP
7823])
7824OVS_VSWITCHD_STOP
7825AT_CLEANUP
7826
7827AT_SETUP([ofproto-dpif megaflow - move action])
7828OVS_VSWITCHD_START
623540e4 7829AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7830add_of_ports br0 1 2
bcd2633a
JP
7831AT_DATA([flows.txt], [dnl
7832table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
7833table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
7834table=0 in_port=91 reg0=0x0a000002,actions=output(2)
7835])
7836AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7837AT_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)'])
7838AT_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 7839sleep 1
2be3fe44 7840AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7841recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
7842recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
bcd2633a
JP
7843])
7844OVS_VSWITCHD_STOP
7845AT_CLEANUP
7846
7847AT_SETUP([ofproto-dpif megaflow - push action])
7848OVS_VSWITCHD_START
623540e4 7849AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7850add_of_ports br0 1 2
bcd2633a
JP
7851AT_DATA([flows.txt], [dnl
7852table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
7853])
7854AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7855AT_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)'])
7856AT_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 7857sleep 1
2be3fe44 7858AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7859recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
7860recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
bcd2633a
JP
7861])
7862OVS_VSWITCHD_STOP
7863AT_CLEANUP
7864
7865AT_SETUP([ofproto-dpif megaflow - learning])
7866OVS_VSWITCHD_START
623540e4 7867AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7868add_of_ports br0 1 2
bcd2633a
JP
7869AT_DATA([flows.txt], [dnl
7870table=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
7871])
7872AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
31ef9f51 7873ovs-appctl time/stop
956f2bf0
BP
7874# We send each packet twice because the first packet in each flow causes the
7875# flow table to change and thus revalidations, which (depending on timing)
7876# can keep a megaflow from being installed. The revalidations are done by
7877# the second iteration, allowing the flows to be installed.
7878for i in 1 2; do
7879 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)'])
7880 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)'])
7881 ovs-appctl time/warp 100
7882done
ae692725 7883sleep 1
bcd2633a 7884dnl The original flow is missing due to a revalidation.
2be3fe44 7885AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7886recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7887recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
7888])
7889OVS_VSWITCHD_STOP
7890AT_CLEANUP
d4f4a9b2
JP
7891
7892AT_SETUP([ofproto-dpif megaflow - tunnels])
7893OVS_VSWITCHD_START(
2c0ea78f 7894 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
623540e4 7895AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
2c0ea78f
GS
7896AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
7897 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
7898AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
7899 ofport_request=3])
7900AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
7901 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
7902 ofport_request=4 options:key=flow])
d4f4a9b2
JP
7903AT_DATA([flows.txt], [dnl
7904in_port=1,actions=output(2)
7905in_port=3,actions=output(4)
7906])
7907AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7908dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
7909dnl will cause the packet to be dropped.
7910AT_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 7911sleep 1
d4f4a9b2
JP
7912AT_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)'])
7913AT_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 7914sleep 1
d4f4a9b2 7915AT_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 7916sleep 1
2be3fe44 7917AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7918recirc_id(0),in_port(1),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
7919recirc_id(0),in_port(3),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
7920recirc_id(0),in_port(3),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
1dd35f8a
JP
7921])
7922OVS_VSWITCHD_STOP
7923AT_CLEANUP
7924
7925AT_SETUP([ofproto-dpif megaflow - dec_ttl])
7926OVS_VSWITCHD_START
623540e4 7927AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7928add_of_ports br0 1 2
13751fd8 7929AT_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
7930AT_DATA([flows.txt], [dnl
7931table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
7932])
7933AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7934AT_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)'])
7935AT_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 7936sleep 1
2be3fe44 7937AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
9044f2c1
JG
7938recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
7939recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,ttl=64,frag=no), actions: <del>
d4f4a9b2
JP
7940])
7941OVS_VSWITCHD_STOP
7942AT_CLEANUP
74cc3969 7943
f74e7df7
JP
7944AT_SETUP([ofproto-dpif megaflow - set dl_dst])
7945OVS_VSWITCHD_START
623540e4 7946AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 7947add_of_ports br0 1 2
f74e7df7
JP
7948AT_DATA([flows.txt], [dnl
7949table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
7950])
7951AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7952AT_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)'])
7953AT_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 7954sleep 1
d23df9a8
JR
7955dnl The first packet is essentially a no-op, as the new destination MAC is the
7956dnl same as the original. The second entry actually updates the destination
7957dnl MAC.
2be3fe44 7958AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9044f2c1
JG
7959recirc_id(0),in_port(1),eth(dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions:2
7960recirc_id(0),in_port(1),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
7961])
7962OVS_VSWITCHD_STOP
7963AT_CLEANUP
7964
e539ba87
IM
7965m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
7966 [AT_SETUP([ofproto-dpif megaflow - disabled$1])
7967 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7968 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7969 func=`echo -n "$1_" | cut -c 4-`
7970 add_${func}of_ports br0 1 2
7971 AT_DATA([flows.txt], [dnl
8c301900
JR
7972table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
7973table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
7974])
e539ba87 7975 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8c301900 7976], [])
e539ba87 7977 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
64bb477f 7978], [])
e539ba87
IM
7979 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
7980 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7981 for i in 1 2 3 4; do
7982 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)'])
7983 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)'])
7984 if [[ $i -eq 1 ]]; then
7985 sleep 1
7986 fi
7987 done
7988 sleep 1
7989 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
5cf3edb3
DDP
7990skb_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),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
7991skb_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),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 7992])
e539ba87 7993 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
efe179e0
DDP
7994skb_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),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:126, used:0.0s, actions:2
7995skb_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),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:126, used:0.0s, actions:drop
8c301900 7996])
e539ba87
IM
7997 OVS_VSWITCHD_STOP
7998 AT_CLEANUP])
7999
8000OFPROTO_DPIF_MEGAFLOW_DISABLED([])
8001OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
8c301900 8002
74cc3969
BP
8003AT_SETUP([ofproto-dpif - datapath port number change])
8004OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 8005add_of_ports br0 1
74cc3969
BP
8006
8007# Trace a flow that should output to p1.
8008AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8009 [0], [stdout])
8010AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
8011])
8012
8013# Change p1's port number to 5.
8014AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
8015
8016# Trace a flow that should output to p1 in its new location.
8017AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8018 [0], [stdout])
8019AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
8020])
8021OVS_VSWITCHD_STOP
8022AT_CLEANUP
2d344ba5
AW
8023
8024# Tests the bundling with various bfd and cfm configurations.
8025AT_SETUP([ofproto - bundle with variable bfd/cfm config])
8026OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
8027 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
8028 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
8029 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
8030 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
8031 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
8032 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
8033 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
8034 set Interface p0 cfm_mpid=1 -- \
8035 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
8036
8037ovs-appctl time/stop
8038# advance the clock to stablize everything.
bdba1947 8039ovs-appctl time/warp 5000 100
2d344ba5
AW
8040# cfm/show should show 'recv' fault.
8041AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8042 fault: recv
8043])
8044# bfd/show should show 'up'.
8045AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8046 Local Session State: up
8047 Remote Session State: up
8048 Local Session State: up
8049 Remote Session State: up
8050])
8051# bond/show should show 'may-enable: true' for all slaves.
8052AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8053 may_enable: true
8054 may_enable: true
8055 may_enable: true
8056 may_enable: true
8057])
8058
8059# now disable the bfd on p1.
8060AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
8061# advance the clock to stablize everything.
bdba1947 8062ovs-appctl time/warp 5000 100
2d344ba5
AW
8063# cfm/show should show 'recv' fault.
8064AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8065 fault: recv
8066])
8067# bfd/show should show 'down'.
8068AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8069 Local Session State: down
8070 Remote Session State: down
8071])
8072# bond/show should show 'may-enable: false' for p0.
125bf01d 8073AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
2d344ba5
AW
8074 may_enable: false
8075 may_enable: true
2d344ba5
AW
8076])
8077
8078# now enable the bfd on p1 and disable bfd on p0.
8079AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
8080AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
8081# advance the clock to stablize everything.
bdba1947 8082ovs-appctl time/warp 5000 100
2d344ba5
AW
8083# cfm/show should show 'recv' fault.
8084AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8085 fault: recv
8086])
8087# bfd/show should show 'down'.
8088AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8089 Local Session State: down
8090 Remote Session State: down
8091])
8092# bond/show should show 'may-enable: false' for p0 and p1.
8093AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8094 may_enable: false
8095 may_enable: true
8096 may_enable: false
8097 may_enable: true
8098])
8099
e441a806
AW
8100OVS_VSWITCHD_STOP
8101AT_CLEANUP
8102
8103AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
8104OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
8105
8106# enable bfd on p0.
8107AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8108# check log.
1335a8d5 8109OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
8110# disable bfd on p0.
8111AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8112# check log.
1335a8d5 8113OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
454ff761 8114AT_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
8115
8116# enable cfm on p0.
8117AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
8118# check log.
1335a8d5 8119OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
8120# disable cfm on p0.
8121AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
8122# check log.
1335a8d5 8123OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
454ff761 8124AT_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
8125
8126# enable both bfd and cfm on p0.
8127AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
8128# check log.
1335a8d5 8129OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
8130# disable bfd on p0.
8131AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8132# check log, there should not be the log of thread terminated.
738cd849 8133AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
8134])
8135# reenable bfd on p0.
8136AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8137# check log, should still be on log of thread created.
738cd849 8138AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
8139monitor thread created
8140])
8141# disable bfd and cfm together.
8142AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
8143# check log.
1335a8d5 8144OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
e441a806
AW
8145
8146OVS_VSWITCHD_STOP
8147AT_CLEANUP
8148
8149# this test helps avoid the deadlock between the main thread and monitor thread.
8150AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
8151OVS_VSWITCHD_START
8152
8153for i in `seq 1 199`
8154do
8155 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])
8156done
8157
98cf638b
AW
8158OVS_VSWITCHD_STOP
8159AT_CLEANUP
98b07853
BP
8160\f
8161AT_BANNER([ofproto-dpif - flow translation resource limits])
8162
790c5d26
BP
8163dnl Resubmits to later tables do not count against the depth limit, so we
8164dnl can do 99 of them even though the maximum depth is 64.
8165AT_SETUP([ofproto-dpif - forward resubmit])
8166OVS_VSWITCHD_START
8167(for i in `seq 0 99`; do
8168 j=`expr $i + 1`
8169 echo "table=$i, actions=resubmit(,$j)"
8170 done
8171 echo "table=100, actions=local") > flows
8172AT_CHECK([ovs-ofctl add-flows br0 flows])
8173AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8174 [0], [stdout])
8175AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
8176])
8177OVS_VSWITCHD_STOP
8178AT_CLEANUP
8179
8180dnl Resubmits to the same or an earlier table count against the depth limit,
8181dnl so only 64 of them are allowed.
8182AT_SETUP([ofproto-dpif - backward resubmit])
8183OVS_VSWITCHD_START
8184(echo "table=0, actions=resubmit(,66)"
8185 for i in `seq 2 66`; do
8186 j=`expr $i - 1`
8187 echo "table=$i, actions=resubmit(,$j)"
8188 done
8189 echo "table=1, actions=local") > flows
8190AT_CHECK([ovs-ofctl add-flows br0 flows])
8191AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8192 [0], [stdout])
8193AT_CHECK([tail -1 stdout], [0],
8194 [Translation failed (Recursion too deep), packet is dropped.
8195])
8196AT_CHECK([grep -c 'over max translation depth 64' stdout],
8197 [0], [1
8198])
8199OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8200AT_CLEANUP
8201
98b07853
BP
8202AT_SETUP([ofproto-dpif - infinite resubmit])
8203OVS_VSWITCHD_START
8204AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
222820c6 8205AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
98b07853 8206 [0], [stdout])
fff1b9c0
JR
8207AT_CHECK([tail -1 stdout], [0],
8208 [Translation failed (Recursion too deep), packet is dropped.
98b07853 8209])
790c5d26 8210AT_CHECK([grep -c 'over max translation depth 64' stdout],
98b07853
BP
8211 [0], [1
8212])
8213OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8214AT_CLEANUP
8215
8216AT_SETUP([ofproto-dpif - exponential resubmit chain])
8217OVS_VSWITCHD_START
ca5792f0 8218add_of_ports br0 1
98b07853
BP
8219(for i in `seq 1 64`; do
8220 j=`expr $i + 1`
8221 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8222 done
8223 echo "in_port=65, actions=local") > flows
8224 AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 8225AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
8226AT_CHECK([tail -1 stdout], [0],
8227 [Translation failed (Too many resubmits), packet is dropped.
8228])
8229AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
98b07853
BP
8230])
8231OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
8232AT_CLEANUP
8233
8234AT_SETUP([ofproto-dpif - too many output actions])
8235OVS_VSWITCHD_START
ca5792f0 8236add_of_ports br0 1
98b07853
BP
8237(for i in `seq 1 12`; do
8238 j=`expr $i + 1`
8239 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8240 done
8241 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
542024c4 8242AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 8243AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
0f032e95
BP
8244AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
8245 [0], [1
98b07853 8246])
fff1b9c0 8247AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
542024c4 8248])
0f032e95 8249OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
98b07853
BP
8250AT_CLEANUP
8251
8252AT_SETUP([ofproto-dpif - stack too deep])
8253OVS_VSWITCHD_START
ca5792f0 8254add_of_ports br0 1
98b07853
BP
8255(for i in `seq 1 12`; do
8256 j=`expr $i + 1`
8257 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8258 done
8259 push="push:NXM_NX_REG0[[]]"
8260 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
8261 AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 8262AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
8263AT_CHECK([tail -1 stdout], [0],
8264 [Translation failed (Stack too deep), packet is dropped.
8265])
8266AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
98b07853
BP
8267])
8268OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
8269AT_CLEANUP
d611866c
SH
8270
8271
2608616d 8272AT_SETUP([ofproto-dpif packet-out controller])
d611866c 8273OVS_VSWITCHD_START
ca5792f0 8274add_of_ports br0 1 2
d611866c
SH
8275
8276AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
8277
8278AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 8279AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
8280
8281for i in 1 2 3; do
8282 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
8283done
8284
d9c8c57c 8285OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
8286AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8287NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 8288vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8289dnl
8290NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 8291vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8292dnl
8293NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 8294vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8295])
8296
8297AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
8298 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8299NXST_FLOW reply:
8300])
8301
3c1bb396
BP
8302(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8303 table 0:
8811fc0a
BP
8304 active=1, lookup=0, matched=0
8305
8306 table 1:
8307 active=0, lookup=0, matched=0
8308"
8309 for i in `seq 2 253`; do
8310 printf ' table %d: ditto\n' $i
d611866c
SH
8311 done) > expout
8312AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8313
8314OVS_VSWITCHD_STOP
8315AT_CLEANUP
8316
2608616d 8317AT_SETUP([ofproto-dpif packet-out controller (patch port)])
d611866c
SH
8318OVS_VSWITCHD_START(
8319 [-- \
8320 add-port br0 p1 -- \
8321 set interface p1 type=patch options:peer=p2 -- \
8322 add-br br1 -- \
8323 set bridge br1 datapath-type=dummy -- \
8324 set bridge br1 fail-mode=secure -- \
8325 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
8326 add-port br1 p2 -- \
8327 set interface p2 type=patch options:peer=p1 --])
8328
8329AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 8330AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
8331
8332for i in 1 2 3; do
8333 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
8334done
8335
d9c8c57c 8336OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
8337AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8338NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 8339vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8340dnl
8341NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 8342vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8343dnl
8344NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 8345vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8346])
8347
8811fc0a
BP
8348(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8349 table 0:
8350 active=0, lookup=0, matched=0
8351"
8352 for i in `seq 1 253`; do
8353 printf ' table %d: ditto\n' $i
d611866c
SH
8354 done) > expout
8355AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8356
3c1bb396
BP
8357(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8358 table 0:
8811fc0a
BP
8359 active=0, lookup=3, matched=0
8360
8361 table 1:
8362 active=0, lookup=0, matched=0
8363"
8364 for i in `seq 2 253`; do
8365 printf ' table %d: ditto\n' $i
d611866c
SH
8366 done) > expout
8367AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
8368
8369OVS_VSWITCHD_STOP
8370AT_CLEANUP
8371
880b1458
YHW
8372AT_SETUP([ofproto-dpif packet-out pipeline match field (OpenFlow 1.5)])
8373OVS_VSWITCHD_START
8374
8375AT_DATA([flows.txt], [dnl
8376table=0,in_port=1 actions=controller
8377table=0,tun_id=3 actions=controller
8378table=0,metadata=5 actions=controller
8379table=0,reg0=1,reg4=2,reg8=3,reg12=5 actions=controller
8380table=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 actions=controller
8381])
8382AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
8383
8384AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
8385ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
8386ovs-appctl -t ovs-ofctl ofctl/barrier
8387ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
8388AT_CAPTURE_FILE([monitor.log])
8389
8390AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=1 packet=0001020304050010203040501111 actions=table"])
8391AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tunnel_id=3 packet=0001020304050010203040502222 actions=table"])
8392AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,metadata=5 packet=0001020304050010203040503333 actions=table"])
8393AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,reg0=1,reg4=2,reg8=3,reg12=5 packet=0001020304050010203040503333 actions=table"])
8394AT_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"])
8395AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_metadata33=3 packet=0001020304050010203040503333 actions=table"])
8396
8397ovs-appctl -t ovs-ofctl ofctl/barrier
8398OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8399
8400AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
8401OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 in_port=1 (via packet_out) data_len=14 (unbuffered)
8402vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1111
8403OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_id=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
8404vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x2222
8405OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 metadata=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
8406vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
8407OFPT_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)
8408vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
8409OFPT_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)
8410vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
8411OFPT_BARRIER_REPLY (OF1.5):
8412])
8413
8414OVS_VSWITCHD_STOP
8415AT_CLEANUP
d611866c 8416
2608616d 8417AT_SETUP([ofproto-dpif packet-out goto_table])
d611866c 8418OVS_VSWITCHD_START
ca5792f0 8419add_of_ports br0 1 2
d611866c
SH
8420
8421AT_DATA([flows.txt], [dnl
8422table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
8423table=1 dl_dst=50:54:00:00:00:0a actions=controller
8424])
8425AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
8426
8427AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 8428AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
8429
8430for i in 1 2 3; do
8431 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)'
8432done
8433
8434OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 8435OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c 8436AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 8437NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 8438vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 8439dnl
efe179e0 8440NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 8441vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 8442dnl
efe179e0 8443NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 8444vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8445])
8446
cea4a6d7 8447AT_CHECK([ovs-appctl revalidator/purge], [0])
d611866c 8448AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
8449 n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=goto_table:1
8450 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
d611866c
SH
8451OFPST_FLOW reply (OF1.3):
8452])
8453
3c1bb396
BP
8454(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8455 table 0:
8456 active=1, lookup=3, matched=3
8457
8811fc0a
BP
8458 table 1: ditto
8459 table 2:
8460 active=0, lookup=0, matched=0
8461"
8462 for i in `seq 3 253`; do
8463 printf ' table %d: ditto\n' $i
d611866c
SH
8464 done) > expout
8465AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8466
8467OVS_VSWITCHD_STOP
8468AT_CLEANUP
8469
8470
2608616d 8471AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
d611866c 8472OVS_VSWITCHD_START
ca5792f0 8473add_of_ports br0 1 2
d611866c 8474
3c1bb396
BP
8475AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
8476AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
d611866c
SH
8477
8478AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 8479AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
8480
8481for i in 1 2 3; do
8482 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)'
8483done
8484
8485OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 8486OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c 8487AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 8488NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 8489vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 8490dnl
efe179e0 8491NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 8492vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 8493dnl
efe179e0 8494NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 8495vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
8496])
8497
cea4a6d7 8498AT_CHECK([ovs-appctl revalidator/purge], [0])
3c1bb396 8499AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 8500 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
3c1bb396 8501OFPST_FLOW reply (OF1.1):
d611866c
SH
8502])
8503
3c1bb396
BP
8504(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8505 table 0:
8506 active=0, lookup=3, matched=0
8507
8508 table 1:
8811fc0a
BP
8509 active=1, lookup=3, matched=3
8510
8511 table 2:
8512 active=0, lookup=0, matched=0
8513"
8514 for i in `seq 3 253`; do
8515 printf ' table %d: ditto\n' $i
d611866c
SH
8516 done) > expout
8517AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8518
8519OVS_VSWITCHD_STOP
8520AT_CLEANUP
b0e2ec32
JR
8521
8522AT_SETUP([ofproto-dpif - ICMPv6])
8523OVS_VSWITCHD_START
ca5792f0 8524add_of_ports br0 1
b0e2ec32
JR
8525
8526AT_CAPTURE_FILE([ofctl_monitor.log])
8527
6409e008 8528AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b0e2ec32
JR
8529
8530ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
8531
d9c8c57c 8532OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
b0e2ec32
JR
8533
8534AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8535NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
e6d9ab56 8536icmp6,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
8537])
8538
8539OVS_VSWITCHD_STOP
8540AT_CLEANUP
e60e935b 8541
8ecb3068
DDP
8542AT_SETUP([ofproto-dpif - ICMPv6 type match])
8543OVS_VSWITCHD_START
8544add_of_ports br0 1 2 3
8545
8546AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
8547AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
8548
8549AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8550
8551AT_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)'])
8552AT_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)'])
8553AT_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)'])
8554AT_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)'])
8555
8556AT_CHECK([ovs-appctl revalidator/purge], [0])
8557
8558AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9044f2c1
JG
8559recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128), actions:2
8560recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129), actions:3
8ecb3068
DDP
8561])
8562
8563AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
8564 n_packets=2, n_bytes=124, icmp6,icmp_type=128 actions=output:2
8565 n_packets=2, n_bytes=124, icmp6,icmp_type=129 actions=output:3
8566NXST_FLOW reply:
8567])
8568
8569OVS_VSWITCHD_STOP
8570AT_CLEANUP
8571
e60e935b
SRCSA
8572AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
8573OVS_VSWITCHD_START
ca5792f0 8574add_of_ports br0 1
e60e935b
SRCSA
8575AT_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])
8576
8577AT_CAPTURE_FILE([ofctl_monitor.log])
8578
6409e008 8579AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
e60e935b
SRCSA
8580
8581ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
8582
d9c8c57c 8583OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
e60e935b
SRCSA
8584
8585AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8586NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
e6d9ab56 8587icmp6,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
8588])
8589
8590OVS_VSWITCHD_STOP
8591AT_CLEANUP
8592
f171fa88
AW
8593# Tests the exact match of CFI bit in installed datapath flows matching VLAN.
8594AT_SETUP([ofproto-dpif - vlan matching])
8595OVS_VSWITCHD_START(
8596 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
8597AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8598
8599AT_CHECK([ovs-ofctl del-flows br0])
8600AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
8601
8602AT_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))'])
8603
47567945 8604OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
9044f2c1
JG
8605AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
8606recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=10),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
f171fa88
AW
8607])
8608OVS_VSWITCHD_STOP
8609AT_CLEANUP
43b2f131
EJ
8610
8611# Tests in place modification of installed datapath flows.
8612AT_SETUP([ofproto-dpif - in place modification])
8613OVS_VSWITCHD_START(
8614 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8615AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8616
8617AT_CHECK([ovs-ofctl del-flows br0])
8618AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
8619
8620ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
8621
8622ovs-appctl time/stop
8623
ed8ac2a0
JR
8624AT_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)'])
8625
8626# Wait for the flow setup to be done.
8627OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
8628
8629for i in 1 2; do
43b2f131
EJ
8630 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)'
8631done
8632
3a18d0c2 8633AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
efe179e0 8634recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
43b2f131
EJ
8635])
8636
8637AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
8638
8639ovs-appctl time/warp 500
8640ovs-appctl time/warp 500
8641
8642for i in 1 2 3; do
8643 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)'
8644done
8645
3a18d0c2 8646AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
efe179e0 8647recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
43b2f131
EJ
8648])
8649
38b0b29f 8650AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
5cf3edb3 8651dpif|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),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
8652])
8653OVS_VSWITCHD_STOP
8654AT_CLEANUP
449b8131
JR
8655
8656# Tests in place modification of installed datapath flows with vlans.
8657AT_SETUP([ofproto-dpif - in place modification (vlan)])
8658OVS_VSWITCHD_START(
8659 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8660AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8661
8662AT_CHECK([ovs-ofctl del-flows br0])
8663AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
8664
8665ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
8666
8667ovs-appctl time/stop
8668
ed8ac2a0
JR
8669AT_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)'])
8670
449b8131 8671# Check that a correct datapath flow is created.
ed8ac2a0
JR
8672OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
8673
8674for i in 1 2; do
449b8131
JR
8675 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)'
8676done
8677
3a18d0c2 8678AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
efe179e0 8679recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:100
449b8131
JR
8680])
8681
8682# Delete the flow. Then check that the datapath flow is modified to
8683# drop the packets. A modified flow inherits the stats, a new
8684# datapath flow would start from sero.
8685AT_CHECK([ovs-ofctl del-flows br0])
8686
8687ovs-appctl time/warp 500
8688ovs-appctl time/warp 500
8689
8690for i in 1 2 3; do
8691 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)'
8692done
8693
3a18d0c2 8694AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
efe179e0 8695recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:drop
449b8131
JR
8696])
8697
8698# Add a flow that matches the non-presence of a vlan tag, and check
8699# that the datapath flow is modified accordingly.
8700AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
8701
8702ovs-appctl time/warp 500
8703ovs-appctl time/warp 500
8704
8705for i in 1 2 3; do
8706 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)'
8707done
8708
3a18d0c2 8709AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
efe179e0 8710recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
449b8131
JR
8711])
8712
8713# Check that VLAN packets will not hit the same datapath megaflow.
ed8ac2a0
JR
8714
8715AT_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 8716OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
ed8ac2a0
JR
8717
8718for i in 1 2; do
449b8131
JR
8719 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))'
8720done
8721
3a18d0c2 8722AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
efe179e0
DDP
8723recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
8724recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:36, used:0.0s, actions:drop
449b8131
JR
8725])
8726
8727# Check that the new flow matches the CFI bit, while both vid and pcp
8728# are wildcarded.
38b0b29f 8729AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
9044f2c1 8730dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),eth_type(0x1234), actions:100
5cf3edb3
DDP
8731dpif|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),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)
8732dpif|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),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
9044f2c1 8733dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), actions:drop
449b8131
JR
8734])
8735OVS_VSWITCHD_STOP
8736AT_CLEANUP
56de2148
YT
8737
8738AT_SETUP([ofproto-dpif - trace (unchanged)])
8739OVS_VSWITCHD_START
8740AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
8741AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
8742])
8743AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
8744AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
8745])
ed708b5d
DDP
8746
8747OVS_VSWITCHD_STOP
8748AT_CLEANUP
8749
8750AT_SETUP([ofproto-dpif - conntrack - controller])
8751OVS_VSWITCHD_START
8752
8753add_of_ports br0 1 2
8754
8755AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8756
2cd20955 8757dnl Allow new UDP connections on p1 for dst port 2, drop everything else.
ed708b5d 8758AT_DATA([flows.txt], [dnl
a103c1f4 8759dnl Table 0
2cd20955 8760dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2).
a103c1f4
DDP
8761dnl
8762table=0,priority=100,arp,action=normal
2cd20955
JR
8763table=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)
8764table=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
8765table=0,priority=1,action=drop
8766dnl
2cd20955
JR
8767dnl Pass tracked traffic through ACL, drop everything else.
8768dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers
8769dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets
8770dnl get the ACL lookup using the conntrack tuple and the inverted direction.
8771dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
8772dnl of the master connection, as storted in ct_mark.
8773dnl
8774dnl Incoming non-related packet in the original direction (ACL IN)
8775table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5
8776dnl Incoming non-related reply packet (CT ACL OUT)
8777table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4
8778dnl Outgoing non-related packet (ACL OUT)
8779table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5
8780dnl Outgoing non-related reply packet (CT ACL IN)
8781table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
8782dnl
8783dnl Related packet (CT ACL in the direction of the master connection.)
8784table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
8785dnl Drop everything else.
8786table=1 priority=0, action=drop
8787dnl
8788dnl "ACL table"
8789dnl
8790dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with
8791dnl UDP destination port '2'. Store rule ID (1234) in reg1, verdict
8792dnl in reg2.
8793table=3 priority=10, reg0=1, udp, udp_dst=2 action=set_field:1234->reg1,set_field:1->reg2
8794dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235)
8795table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2
8796dnl
8797dnl Re-process stateful traffic that was not accepted by a stateful rule as
8798dnl normal traffic in the current direction. This should also delete the
8799dnl now stale conntrack state, so that new state can be created in it's place.
8800dnl
8801dnl Stateful accepts go to next table.
8802table=4 priority=100 reg2=1, action=goto_table:5
8803dnl Everything else is reprocessed disregarding the CT state, using the actual
8804dnl packet direction.
8805table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5
8806dnl
8807dnl "ACL verdict processing table."
8808dnl
8809dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0)
8810dnl
8811dnl Drop all non-accepted packets.
8812table=5 reg2=0 priority=1000 action=drop
8813dnl Commit new non-related IP connections.
8814table=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
8815dnl Commit new related connections in either direction, which inherit the mark
8816dnl (the direction of the original direction master tuple) from the master
8817dnl connection.
8818table=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
8819dnl Forward everything else, including stateless accepts.
8820table=5 priority=0 action=goto_table:6
8821dnl
8822dnl "Forwarding table"
8823dnl
8824table=6 action=controller
ed708b5d
DDP
8825])
8826
8827AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8828
8829AT_CAPTURE_FILE([ofctl_monitor.log])
8830AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8831
8832AT_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)'])
8833
8834dnl OK, now start a new connection from port 1.
8835AT_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)'])
8836
8837dnl Now try a reply from port 2.
8838AT_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)'])
8839
8840OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8841OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8842
8843dnl Check this output. We only see the latter two packets, not the first.
ed708b5d 8844AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2cd20955 8845NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=42 ct_state=new|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,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
8846udp,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:e9d6
8847dnl
2cd20955 8848NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=42 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,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x2,reg4=0x1,in_port=2 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
8849udp,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:e9d6
8850])
8851
8852AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8853
8854dnl OK, now start a second connection from port 1
2cd20955 8855AT_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
8856
8857dnl Now try a reply from port 2.
2cd20955 8858AT_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
8859
8860
8861OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8862OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8863
8864dnl Check this output. We should see both packets
ed708b5d 8865AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2cd20955
JR
8866NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=42 ct_state=new|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,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=42 (unbuffered)
8867udp,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:e9d4
ed708b5d 8868dnl
2cd20955
JR
8869NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=42 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,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x2,reg4=0x1,in_port=2 (via action) data_len=42 (unbuffered)
8870udp,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:e9d4
ed708b5d
DDP
8871])
8872
8873OVS_VSWITCHD_STOP
8874AT_CLEANUP
8875
a76a37ef
JR
8876AT_SETUP([ofproto-dpif - conntrack - force commit])
8877OVS_VSWITCHD_START
8878
8879add_of_ports br0 1 2
8880
8881AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8882
8883dnl Allow new connections on p1->p2, but not on p2->p1.
8884AT_DATA([flows.txt], [dnl
8885dnl Table 0
8886dnl
8887table=0,priority=100,arp,action=normal
8888table=0,priority=10,in_port=1,udp,action=ct(commit),controller
8889table=0,priority=10,in_port=2,udp,action=ct(table=1)
8890table=0,priority=1,action=drop
8891dnl
8892dnl Table 1
8893dnl
8894table=1,priority=10,in_port=2,ct_state=+est,udp,action=ct(force,commit),controller
8895table=1,priority=1,action=drop
8896])
8897
8898AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8899
8900AT_CAPTURE_FILE([ofctl_monitor.log])
8901AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8902
8903AT_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)'])
8904
8905dnl OK, now start a new connection from port 1.
8906AT_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)'])
8907
8908dnl Now try a reply from port 2.
8909AT_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)'])
8910
8911OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8912OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8913
8914dnl Check this output. We only see the latter two packets, not the first.
8915dnl Note that the first packet doesn't have the ct_state bits set. This
8916dnl happens because the ct_state field is available only after recirc.
8917AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8918NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
8919udp,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:e9d6
8920dnl
8921NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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,in_port=2 (via action) data_len=42 (unbuffered)
8922udp,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:e9d6
8923])
8924
8925AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8926
8927dnl OK, now start a second connection from port 1
8928AT_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)'])
8929
8930dnl Now try a reply from port 2.
8931AT_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)'])
8932
8933OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8934OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8935
8936dnl Check this output. We should see both packets
8937dnl Note that the first packet doesn't have the ct_state bits set. This
8938dnl happens because the ct_state field is available only after recirc.
8939AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8940NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
8941udp,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:e9d2
8942dnl
8943NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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=3,ct_tp_dst=4,in_port=2 (via action) data_len=42 (unbuffered)
8944udp,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:e9d2
8945])
8946
8947dnl
8948dnl Check that the directionality has been changed by force commit.
8949dnl
8950AT_CHECK([ovs-appctl dpctl/dump-conntrack | sort], [], [dnl
8951udp,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)
8952udp,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)
8953])
8954
8955OVS_VSWITCHD_STOP
8956AT_CLEANUP
8957
ed708b5d
DDP
8958AT_SETUP([ofproto-dpif - conntrack - ipv6])
8959OVS_VSWITCHD_START
8960
8961add_of_ports br0 1 2
8962
8963AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8964
8965dnl Allow new connections on p1->p2, but not on p2->p1.
8966AT_DATA([flows.txt], [dnl
a103c1f4
DDP
8967dnl Table 0
8968dnl
8969table=0,priority=100,arp,action=normal
8970table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
8971table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
8972table=0,priority=1,action=drop
8973dnl Table 1
8974dnl
8975table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
8976table=1,priority=1,action=drop
ed708b5d
DDP
8977])
8978
8979AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8980
8981AT_CAPTURE_FILE([ofctl_monitor.log])
8982AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8983
8984AT_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)'])
8985
8986dnl OK, now start a new connection from port 1.
8987AT_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)'])
8988
8989dnl Now try a reply from port 2.
8990AT_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)'])
8991
8992OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8993OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8994
8995dnl Check this output. We only see the latter two packets, not the first.
8996dnl Note that the first packet doesn't have the ct_state bits set. This
8997dnl happens because the ct_state field is available only after recirc.
8998AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8999NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
9000udp6,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:a466
daf4d3c1 9001NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=62 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,in_port=2 (via action) data_len=62 (unbuffered)
ed708b5d
DDP
9002udp6,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:a466
9003])
9004
9005OVS_VSWITCHD_STOP
9006AT_CLEANUP
9007
9008AT_SETUP([ofproto-dpif - conntrack - output action])
9009OVS_VSWITCHD_START
9010
9011add_of_ports br0 1 2
9012
9013AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9014
9015dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9016AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9017dnl The flows are in two separate tables for two reasons:
9018dnl * To make the pipeline more clear.
9019dnl * To make megaflows more consistent (we check megaflows below). The
9020dnl unwildcarding in megaflows depends on the internal ordering of the
9021dnl subtables, which are sorted using the system qsort(). qsort()
9022dnl is provided by libc and may or may not be stable, so we can't rely
9023dnl on that. By having separate tables we have more control over which
9024dnl subtables are visited, meaning consistent megaflows.
9025dnl
9026dnl Table 0
9027dnl
9028table=0,priority=100,arp,action=normal
9029table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
9030table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9031table=0,priority=1,action=drop
9032dnl
9033dnl Table 1
9034dnl
9035table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
9036table=1,priority=1,action=drop
ed708b5d
DDP
9037])
9038
9039AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9040
9041
9042AT_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)'])
9043
9044dnl OK, now start a new connection from port 1.
9045AT_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)'])
9046
9047dnl Now try a reply from port 2.
9048AT_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)'])
9049
9050dnl OK, now start a second connection from port 1
9051AT_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)'])
9052
9053dnl Now try a reply from port 2.
9054AT_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)'])
9055
9056
9057AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9058ct_state(+new-est+trk),recirc_id(0x1),in_port(2),eth_type(0x0800),ipv4(frag=no), actions:drop
9059ct_state(-new+est+trk),recirc_id(0x1),in_port(2),eth_type(0x0800),ipv4(proto=17,frag=no), actions:1
ed708b5d 9060recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
a103c1f4 9061recirc_id(0),in_port(2),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct,recirc(0x1)
ed708b5d
DDP
9062])
9063
9064OVS_VSWITCHD_STOP
9065AT_CLEANUP
9066
9067AT_SETUP([ofproto-dpif - conntrack - expiration])
9068OVS_VSWITCHD_START
9069
9070add_of_ports br0 1 2
9071
9072AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9073
9074dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9075AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9076dnl Table 0
9077dnl
9078table=0,priority=100,arp,action=normal
9079table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
9080table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9081table=0,priority=1,action=drop
9082dnl
9083dnl Table 1
9084dnl
9085table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9086table=1,priority=1,action=drop
ed708b5d
DDP
9087])
9088
9089AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9090
9091AT_CAPTURE_FILE([ofctl_monitor.log])
9092AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9093
9094AT_CHECK([ovs-appctl time/stop])
9095
9096dnl Start a new connection from port 1.
9097AT_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)'])
9098
9099dnl Now try a reply from port 2.
9100AT_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)'])
9101
9102ovs-appctl time/warp 100000
9103
9104dnl Now try another reply from port 2.
9105AT_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)'])
9106
9107OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
9108OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9109
9110dnl Check this output. Only one reply must be there
9111AT_CHECK([cat ofctl_monitor.log], [0], [dnl
daf4d3c1 9112NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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,in_port=2 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9113udp,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:e9d6
9114dnl
9115OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
9116])
9117
9118OVS_VSWITCHD_STOP
9119AT_CLEANUP
9120
9121AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
9122OVS_VSWITCHD_START
9123
9124add_of_ports br0 1 2
9125
9126AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9127
9128AT_DATA([flows.txt], [dnl
ed26e3ea 9129ipv6,ct_state=-trk,action=ct(table=0,zone=0)
ed708b5d
DDP
9130ct_state=+trk,action=controller
9131])
9132
9133AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9134
9135AT_CAPTURE_FILE([ofctl_monitor.log])
9136AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9137
9138AT_CHECK([ovs-appctl time/stop])
9139
ed26e3ea 9140AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
ed708b5d
DDP
9141
9142OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
9143OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9144
9145AT_CHECK([cat ofctl_monitor.log], [0], [dnl
ed26e3ea
JR
9146NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,in_port=2 (via action) data_len=86 (unbuffered)
9147icmp6,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
9148])
9149
9150OVS_VSWITCHD_STOP
9151AT_CLEANUP
9152
9153AT_SETUP([ofproto-dpif - conntrack - zones])
9154OVS_VSWITCHD_START
9155
9156add_of_ports br0 1 2 3 4
9157
9158AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9159
9160dnl Allow new connections on p1->p2 or p3->p4.
9161dnl Allow only established connections p2->p1 and p4->p3
9162dnl p1,p2 and p3,p4 are on different zones
9163AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9164dnl Table 0
9165dnl
9166table=0,priority=100,arp,action=normal
9167table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
9168table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9169table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
9170table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
9171table=0,priority=1,action=drop
9172dnl
9173dnl Table 1
9174dnl
9175table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9176table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
9177table=1,priority=1,action=drop
ed708b5d
DDP
9178])
9179
9180AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9181
9182AT_CAPTURE_FILE([ofctl_monitor.log])
9183AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9184
9185dnl Basic "only established" test on ports 1,2
9186
9187AT_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)'])
9188AT_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)'])
9189AT_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)'])
9190
9191dnl Now use the same 5-tuples but on ports 3,4
9192
9193AT_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)'])
9194AT_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)'])
9195AT_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)'])
9196
9197OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9198OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9199
9200dnl Check this output. We only see the latter two packets (for each zone), not the first.
9201AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 9202NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9203udp,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:e9d6
9204dnl
daf4d3c1 9205NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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,in_port=2 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9206udp,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:e9d6
9207dnl
efe179e0 9208NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=3 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9209udp,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:e9d6
9210dnl
daf4d3c1 9211NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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,in_port=4 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9212udp,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:e9d6
9213])
9214
ed708b5d
DDP
9215OVS_VSWITCHD_STOP
9216AT_CLEANUP
9217
9218AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
9219OVS_VSWITCHD_START
9220
9221add_of_ports br0 1 2
9222
9223AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9224
9225dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9226AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9227dnl Table 0
9228dnl
9229table=0,priority=100,arp,action=normal
9230table=0,priority=10,udp,action=ct(table=1,zone=0)
9231table=0,priority=1,action=drop
9232dnl
9233dnl Table 1
9234dnl
9235table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
9236table=1,priority=10,ct_state=+trk+est,udp,action=controller
9237table=1,priority=1,action=drop
ed708b5d
DDP
9238])
9239
9240AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9241
9242AT_CAPTURE_FILE([ofctl_monitor.log])
9243AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9244
9245AT_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)'])
9246
9247dnl OK, now start a new connection from port 1.
9248AT_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)'])
9249
9250dnl Now try a reply from port 2.
9251AT_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)'])
9252
9253OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9254OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9255
9256dnl Check this output. We only see the latter two packets, not the first.
9257AT_CHECK([cat ofctl_monitor.log], [0], [dnl
daf4d3c1 9258NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=new|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,in_port=1 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9259udp,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:e9d6
9260dnl
daf4d3c1 9261NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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,in_port=2 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9262udp,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:e9d6
9263])
9264
9265OVS_VSWITCHD_STOP
9266AT_CLEANUP
9267
9268AT_SETUP([ofproto-dpif - conntrack - ICMP related])
9269OVS_VSWITCHD_START
9270
9271add_of_ports br0 1 2
9272
9273dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
9274AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9275dnl Table 0
9276dnl
9277table=0,priority=100,arp,action=normal
ed26e3ea
JR
9278table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
9279table=0,priority=10,ip,in_port=2,action=ct(table=1)
a103c1f4
DDP
9280table=0,priority=1,action=drop
9281dnl
9282dnl Table 1
9283dnl
9284table=1,priority=10,in_port=1,ct_state=+trk,action=controller
9285table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
9286table=1,priority=1,action=drop
ed708b5d
DDP
9287])
9288
9289AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9290
9291AT_CAPTURE_FILE([ofctl_monitor.log])
9292AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9293
9294dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
a103c1f4 9295AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
ed708b5d
DDP
9296
9297dnl 2. Send and UDP packet to port 5555
a103c1f4 9298AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
ed708b5d
DDP
9299
9300dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
a103c1f4 9301AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
ed708b5d
DDP
9302
9303OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9304OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9305
9306dnl Check this output. We only see the first and the last packet
9307AT_CHECK([cat ofctl_monitor.log], [0], [dnl
daf4d3c1 9308NXT_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,in_port=1 (via action) data_len=47 (unbuffered)
ed708b5d
DDP
9309udp,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
9310dnl
daf4d3c1 9311NXT_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,in_port=2 (via action) data_len=75 (unbuffered)
ed708b5d
DDP
9312icmp,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
9313])
9314
9315OVS_VSWITCHD_STOP
9316AT_CLEANUP
9317
9318AT_SETUP([ofproto-dpif - conntrack - ct_mark])
9319OVS_VSWITCHD_START
9320
9321add_of_ports br0 1 2
9322
9323AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9324
9325dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9326AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9327dnl Table 0
9328dnl
ed26e3ea
JR
9329table=0,arp,action=normal
9330table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
9331table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
9332table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
9333table=0,ip,in_port=2,actions=ct(table=1)
9334table=0,priority=0,action=drop
a103c1f4
DDP
9335dnl
9336dnl Table 1
9337dnl
9338table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
9339table=1,priority=1,action=drop
ed708b5d
DDP
9340])
9341
9342AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9343
9344AT_CAPTURE_FILE([ofctl_monitor.log])
9345AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9346
9347AT_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)'])
9348AT_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)'])
9349AT_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)'])
9350
9351AT_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)'])
9352AT_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)'])
9353AT_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)'])
9354
9355OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
9356OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9357
9358dnl Check this output.
9359AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 9360NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 ct_mark=0x1,in_port=1 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9361udp,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:e9d6
9362dnl
efe179e0 9363NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 ct_mark=0x3,in_port=1 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9364udp,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:e9d2
9365dnl
efe179e0 9366NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 ct_mark=0x5,in_port=1 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9367udp,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:e9ce
9368dnl
daf4d3c1 9369NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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,in_port=2 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9370udp,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:e9d6
9371dnl
daf4d3c1 9372NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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,in_port=2 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9373udp,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:e9d2
9374])
9375
9376OVS_VSWITCHD_STOP
9377AT_CLEANUP
9378
9379AT_SETUP([ofproto-dpif - conntrack - ct_label])
9380OVS_VSWITCHD_START
9381
9382add_of_ports br0 1 2
9383
9384AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9385
9386dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9387AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9388dnl Table 0
9389dnl
ed26e3ea
JR
9390table=0,arp,action=normal
9391table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
9392table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
9393table=0,ip,in_port=2,actions=ct(table=1)
a103c1f4
DDP
9394dnl
9395dnl Table 1
9396dnl
9397table=1,priority=10,ct_state=+trk+rpl,actions=controller
9398table=1,priority=1,action=drop
ed708b5d
DDP
9399])
9400
9401AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9402
9403AT_CAPTURE_FILE([ofctl_monitor.log])
9404AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9405
9406AT_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)'])
9407AT_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)'])
9408
9409AT_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)'])
9410AT_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)'])
9411
9412OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9413OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9414
9415dnl Check this output.
9416AT_CHECK([cat ofctl_monitor.log], [0], [dnl
daf4d3c1 9417NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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,in_port=2 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9418udp,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:e9d6
9419dnl
daf4d3c1 9420NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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,in_port=2 (via action) data_len=42 (unbuffered)
ed708b5d
DDP
9421udp,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:e9d2
9422])
9423
9424OVS_VSWITCHD_STOP
9425AT_CLEANUP
9426
9427AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
9428OVS_VSWITCHD_START
9429
9430add_of_ports br0 1 2
9431
9432AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9433
9434dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9435AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9436dnl The flows are in two separate tables for two reasons:
9437dnl * To make the pipeline more clear.
9438dnl * To make megaflows more consistent (we check megaflows below). The
9439dnl unwildcarding in megaflows depends on the internal ordering of the
9440dnl subtables, which are sorted using the system qsort(). qsort()
9441dnl is provided by libc and may or may not be stable, so we can't rely
9442dnl on that. By having separate tables we have more control over which
9443dnl subtables are visited, meaning consistent megaflows.
9444dnl
9445dnl Table 0
9446dnl
ed26e3ea
JR
9447table=0,arp,action=normal
9448table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
9449table=0,ip,in_port=2,actions=ct(table=1)
9450table=0,priority=0,action=drop
a103c1f4
DDP
9451dnl
9452dnl Table 1
9453dnl
9454table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
9455table=1,priority=1,action=drop
ed708b5d
DDP
9456])
9457
9458AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9459
9460AT_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)'])
9461AT_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)'])
9462
a76a37ef
JR
9463# Give time for logs to appear.
9464ovs-appctl revalidator/wait
9465
ed708b5d
DDP
9466AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9467ct_state(+rpl+trk),ct_label(0x1),recirc_id(0x1),in_port(2),eth_type(0x0800),ipv4(frag=no), actions:1
a103c1f4
DDP
9468recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=no),udp(src=1), actions:ct(commit,label=0x1),2
9469recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
ed708b5d
DDP
9470])
9471
9472OVS_VSWITCHD_STOP
9473AT_CLEANUP
9474
9475AT_SETUP([ofproto-dpif - conntrack - no output])
9476OVS_VSWITCHD_START
9477
9478add_of_ports br0 1
9479
9480AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9481
9482dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9483AT_DATA([flows.txt], [dnl
9484in_port=1,udp,action=ct(commit,zone=0)
9485])
9486
9487AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9488
9489dnl Start a new connection from port 1.
9490AT_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)'])
9491
9492AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9493recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
9494])
9495
9496OVS_VSWITCHD_STOP
9497AT_CLEANUP
9498
9499AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
9500OVS_VSWITCHD_START
9501
9502add_of_ports br0 1 2
9503
9504AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9505
9506dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9507AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9508dnl Table 0
9509dnl
9510table=0,priority=100,arp,action=normal
9511table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
9512table=0,priority=10,in_port=2,ip,action=ct(table=1)
9513table=0,priority=1,action=drop
9514dnl
9515dnl Table 1
9516dnl
ed708b5d
DDP
9517dnl The following two flows are separated to explicitly count the packets
9518dnl that create a new connection
a103c1f4
DDP
9519table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
9520table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
ed708b5d 9521dnl
a103c1f4
DDP
9522table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
9523table=1,ip,ct_state=+trk+inv,action=drop
ed708b5d
DDP
9524])
9525
9526AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9527
9528AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
9529AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
9530AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
9531AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
9532AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
9533AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
9534AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
9535AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
9536AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
9537
9538AT_CHECK([ovs-appctl revalidator/purge])
9539AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9540dnl Only one new connection
9541n_packets=1
9542])
9543
9544AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
9545AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
9546AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
9547AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
9548AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
9549AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
9550AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
9551AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
9552AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
9553
9554AT_CHECK([ovs-appctl revalidator/purge])
9555AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9556dnl Two new connections
9557n_packets=2
9558])
9559
9560OVS_VSWITCHD_STOP
9561AT_CLEANUP
9562
9563AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
9564OVS_VSWITCHD_START
9565
9566add_of_ports br0 1 2
9567
9568AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9569
9570dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9571AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9572dnl Table 0
9573dnl
9574table=0,priority=100,arp,action=normal
9575table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
9576table=0,priority=10,in_port=2,tcp,action=ct(table=1)
9577table=0,priority=1,action=drop
9578dnl
9579dnl Table 1
9580dnl
9581table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
9582table=1,priority=1,action=drop
ed708b5d
DDP
9583])
9584
9585AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9586
9587AT_CHECK([ovs-appctl revalidator/purge])
9588AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9589dnl No dropped packets
9590n_packets=0
9591])
9592
9593AT_CAPTURE_FILE([ofctl_monitor.log])
9594AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9595
9596dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
9597dnl sure that the connection tracker is able to pick up already established
9598dnl connections that use window scaling.
9599dnl
9600dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
9601dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
9602AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
9603AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
9604AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
9605AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a08004500022afc284000400626a10a0101020a01010100020001396bb35b8cadbdb45018000a941f0000 dnl
9606 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9607 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9608 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9609 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9610 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9611 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9612 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9613 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9614 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9615 6666666666666666666666666666666666666666666666666666660a'])
9616AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
9617AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a5054000000090800450001fdf2ca40004006302c0a0101010a010102000100028cadbdb4396bb55d5018000aa60c0000 dnl
9618 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9619 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9620 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9621 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9622 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9623 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9624 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9625 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9626 6565656565656565656565656565656565656565656565656565656565656565656565650a'])
9627AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
9628AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
9629AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
9630AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
9631AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
9632
9633AT_CHECK([ovs-appctl revalidator/purge])
9634
9635OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9636
9637AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9638])
9639
9640AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9641dnl No dropped packets
9642n_packets=0
9643])
9644
56de2148
YT
9645OVS_VSWITCHD_STOP
9646AT_CLEANUP
ae59d134 9647
72fe7578
BP
9648dnl This is a truncated version of "ofproto-dpif - conntrack - controller",
9649dnl with extra send-to-controller actions following ct_clear to show that
9650dnl the connection tracking data has been cleared.
9651AT_SETUP([ofproto-dpif - conntrack - ct_clear])
9652OVS_VSWITCHD_START
9653
9654add_of_ports br0 1 2
9655
9656AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9657
9658dnl Allow new connections on p1->p2, but not on p2->p1.
9659AT_DATA([flows.txt], [dnl
9660dnl Table 0
9661dnl
9662table=0,priority=100,arp,action=normal
9663table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller,ct_clear,controller
9664table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9665table=0,priority=1,action=drop
9666dnl
9667dnl Table 1
9668dnl
9669table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller,ct_clear,controller
9670table=1,priority=1,action=drop
9671])
9672
9673AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9674
9675AT_CAPTURE_FILE([ofctl_monitor.log])
9676AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9677
9678AT_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)'])
9679
9680dnl OK, now start a new connection from port 1.
9681AT_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)'])
9682
9683dnl Now try a reply from port 2.
9684AT_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)'])
9685
9686OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9687OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9688
9689dnl Check this output. We only see the latter two packets, not the first.
9690dnl Note that the first packet doesn't have the ct_state bits set. This
9691dnl happens because the ct_state field is available only after recirc.
9692AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9693NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9694udp,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:e9d6
9695dnl
9696NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9697udp,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:e9d6
9698dnl
daf4d3c1 9699NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 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,in_port=2 (via action) data_len=42 (unbuffered)
72fe7578
BP
9700udp,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:e9d6
9701dnl
9702NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 in_port=2 (via action) data_len=42 (unbuffered)
9703udp,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:e9d6
9704])
9705OVS_VSWITCHD_STOP
9706AT_CLEANUP
9707
ae59d134
DDP
9708AT_SETUP([ofproto - set mtu])
9709OVS_VSWITCHD_START
9710
9711add_of_ports br0 1
9712
9713# Check that initial MTU is 1500 for 'br0' and 'p1'.
9714AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
97151500
9716])
9717AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
97181500
9719])
9720
9721# Request new MTU for 'p1'
9722AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
9723
9724# Check that the new MTU is applied
9725AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p1 mtu=1600])
9726# The internal port 'br0' should have the same MTU value as p1, becase it's
9727# the new bridge minimum.
9728AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
9729
9730AT_CHECK([ovs-vsctl del-port br0 p1])
9731
9732# When 'p1' is deleted, the internal port should return to the default MTU
9733AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1500])
9734
7c12e200
DDP
9735# New port with 'mtu_request' in the same transaction.
9736AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
9737AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1600])
9738AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
9739
3a414a0a
DDP
9740# Explicitly set mtu_request on the internal interface. This should prevent
9741# the MTU from being overriden.
9742AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
9743AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
9744
9745# The new MTU on p2 should not affect br0.
9746AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
9747AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1400])
9748AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
9749
9750# Remove explicit mtu_request from br0. Now it should track the bridge
9751# minimum again.
9752AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
9753AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1400])
9754
ae59d134
DDP
9755OVS_VSWITCHD_STOP
9756AT_CLEANUP
4a7ab326
DDP
9757
9758AT_SETUP([ofproto - fragment prerequisites])
9759OVS_VSWITCHD_START
9760
9761AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9762
9763add_of_ports br0 1
9764
9765AT_DATA([flows.txt], [dnl
9766priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
9767priority=1,in_port=1,udp,action=drop
9768])
9769
9770AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9771
9772AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
9773
9774ovs-appctl time/stop
9775AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
9776ovs-appctl time/warp 5000
9777
9778AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9779recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
9780])
9781
9782dnl Change the flow table. This will trigger revalidation of all the flows.
9783AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
9784AT_CHECK([ovs-appctl revalidator/wait], [0])
9785
9786dnl We don't want revalidators to delete any flow. If the flow has been
9787dnl deleted it means that there's some inconsistency with the revalidation.
9788AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
9789
9790OVS_VSWITCHD_STOP
9791AT_CLEANUP