]> git.proxmox.com Git - mirror_ovs.git/blame - tests/ofproto-dpif.at
netdev-afxdp: Add interrupt mode netdev class.
[mirror_ovs.git] / tests / ofproto-dpif.at
CommitLineData
29901626
BP
1AT_BANNER([ofproto-dpif])
2
fe07df80
IM
3m4_divert_push([PREPARE_TESTS])
4
5# Helper function to check the spread of dp_hash flows over buckets in the datapath
6check_dpflow_stats () {
7 min_flows=$1
8 min_buckets=$2
9 dpflows=`cat`
10 if [[ $# -eq 3 ]]; then
11 echo "$dpflows" | grep "actions:hash"
12 n_flows=`echo "$dpflows" | grep -c dp_hash`
13 n_buckets=`echo "$dpflows" | grep dp_hash | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l`
14 else
15 n_flows=`echo "$dpflows" | wc -l`
16 n_buckets=`echo "$dpflows" | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l`
17 fi
18 if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi
19 if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi
20 echo "n_flows=$flows n_buckets=$buckets"
21}
22
23m4_divert_pop([PREPARE_TESTS])
24
25
27f57736
JS
26AT_SETUP([ofproto-dpif - revalidator/wait])
27OVS_VSWITCHD_START
28AT_CHECK([ovs-appctl revalidator/wait])
29OVS_VSWITCHD_STOP
30AT_CLEANUP
31
5f5ebd4c 32AT_SETUP([ofproto-dpif - active-backup bonding])
adcf00ba
AZ
33# Create br0 with interfaces p1, p2 and p7, creating bond0 with p1 and p2
34# and br1 with interfaces p3, p4 and p8.
35# toggle p1,p2 of bond0 up and down to test bonding in active-backup mode.
36OVS_VSWITCHD_START(
37 [add-bond br0 bond0 p1 p2 bond_mode=active-backup --\
38 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
39 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
40 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
41 add-br br1 -- \
42 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
43 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
44 fail-mode=secure -- \
45 add-port br1 p3 -- set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
46 add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
47 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
55466d72 48WAIT_FOR_DUMMY_PORTS([p3], [p4])
623540e4 49AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
adcf00ba
AZ
50
51AT_CHECK([ovs-ofctl add-flow br0 action=normal])
52AT_CHECK([ovs-ofctl add-flow br1 action=normal])
53ovs-appctl netdev-dummy/set-admin-state up
54ovs-appctl time/warp 100
55ovs-appctl netdev-dummy/set-admin-state p2 down
56ovs-appctl time/stop
57ovs-appctl time/warp 100
58AT_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)'])
59AT_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)'])
60ovs-appctl time/warp 100
61ovs-appctl netdev-dummy/set-admin-state p2 up
62ovs-appctl netdev-dummy/set-admin-state p1 down
63ovs-appctl time/warp 100
64AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00: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)'])
65AT_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 66ovs-appctl time/warp 200 100
53555f51 67sleep 1
9044f2c1 68AT_CHECK([grep 'in_port([[348]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
3d4b2e6e
JS
69recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
70recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
71recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0d),eth_type(0x0800),ipv4(frag=no), actions: <del>
72recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(frag=no), actions: <del>
73recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), actions: <del>
74recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), actions: <del>
adcf00ba
AZ
75])
76OVS_VSWITCHD_STOP
77AT_CLEANUP
78
5f5ebd4c 79AT_SETUP([ofproto-dpif - balance-slb bonding])
adcf00ba
AZ
80# Create br0 with interfaces bond0(p1, p2, p3) and p7,
81# and br1 with interfaces p4, p5, p6 and p8.
82# p1 <-> p4, p2 <-> p5, p3 <-> p6
83# Send some traffic, make sure the traffic are spread based on source mac.
84OVS_VSWITCHD_START(
85 [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-slb --\
86 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
87 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
88 set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
89 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
90 add-br br1 -- \
91 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
92 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
93 fail-mode=secure -- \
94 add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
95 add-port br1 p5 -- set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
96 add-port br1 p6 -- set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
97 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
55466d72 98WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
adcf00ba
AZ
99AT_CHECK([ovs-ofctl add-flow br0 action=normal])
100AT_CHECK([ovs-ofctl add-flow br1 action=normal])
101AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
102])
adcf00ba
AZ
103ovs-appctl time/stop
104ovs-appctl time/warp 100
105(
106for i in `seq 0 100 |xargs printf '%02x\n'`;
107 do
108 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)"
109 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
110 done
111)
112ovs-appctl time/warp 100
113AT_CHECK([ovs-appctl dpif/dump-flows br1 > br1_flows.txt])
114# Make sure there is resonable distribution to all three ports.
115# We don't want to make this check precise, in case hash function changes.
116AT_CHECK([test `egrep 'in_port\(4\)' br1_flows.txt |wc -l` -gt 3])
117AT_CHECK([test `egrep 'in_port\(5\)' br1_flows.txt |wc -l` -gt 3])
118AT_CHECK([test `egrep 'in_port\(6\)' br1_flows.txt |wc -l` -gt 3])
119OVS_VSWITCHD_STOP
120AT_CLEANUP
121
5f5ebd4c 122AT_SETUP([ofproto-dpif - balance-tcp bonding])
adcf00ba
AZ
123# Create br0 with interfaces bond0(p1, p2, p3) and p7,
124# and br1 with interfaces bond1(p4, p5, p6) and p8.
125# bond0 <-> bond1
126# Send some traffic, make sure the traffic are spread based on L4 headers.
127OVS_VSWITCHD_START(
128 [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-tcp lacp=active \
129 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
130 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
131 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
132 set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
133 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
134 add-br br1 -- \
135 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
136 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
137 fail-mode=secure -- \
138 add-bond br1 bond1 p4 p5 p6 bond_mode=balance-tcp lacp=active \
139 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
140 set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
141 set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
142 set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
143 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
144AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
145])
146AT_CHECK([ovs-ofctl add-flow br0 action=normal])
147AT_CHECK([ovs-ofctl add-flow br1 action=normal])
148AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
149], [])
48105e85 150OVS_WAIT_WHILE([ovs-appctl bond/show | grep "may_enable: false"])
adcf00ba
AZ
151ovs-appctl time/stop
152ovs-appctl time/warp 100
153ovs-appctl lacp/show > lacp.txt
154ovs-appctl bond/show > bond.txt
155(
25d6a6a8 156for i in `seq 0 255` ;
adcf00ba 157 do
ea2735d3 158 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
159 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
160 done
161)
bdba1947 162ovs-appctl time/warp 300 100
adcf00ba
AZ
163AT_CHECK([ovs-appctl dpif/dump-flows br0 |grep tcp > br0_flows.txt])
164AT_CHECK([ovs-appctl dpif/dump-flows br1 |grep tcp > br1_flows.txt])
165# Make sure there is resonable distribution to all three ports.
166# We don't want to make this check precise, in case hash function changes.
fd184489
AZ
167AT_CHECK([test `grep in_port.4 br1_flows.txt |wc -l` -gt 24])
168AT_CHECK([test `grep in_port.5 br1_flows.txt |wc -l` -gt 24])
169AT_CHECK([test `grep in_port.6 br1_flows.txt |wc -l` -gt 24])
f9038ef6
AW
170
171OVS_VSWITCHD_STOP()
172AT_CLEANUP
173
174# Makes sure recirculation does not change the way packet is handled.
5f5ebd4c 175AT_SETUP([ofproto-dpif - balance-tcp bonding, different recirc flow ])
f9038ef6
AW
176OVS_VSWITCHD_START(
177 [add-bond br0 bond0 p1 p2 bond_mode=balance-tcp lacp=active \
178 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 -- \
179 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
180 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
181 add-br br1 -- \
182 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
183 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
184 fail-mode=standalone -- \
185 add-bond br1 bond1 p3 p4 bond_mode=balance-tcp lacp=active \
186 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 -- \
187 set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
188 set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
189 add-port br1 br1- -- set interface br1- type=patch options:peer=br1+ ofport_request=100 -- \
190 add-br br-int -- \
191 set bridge br-int other-config:hwaddr=aa:77:aa:77:00:00 -- \
192 set bridge br-int datapath-type=dummy other-config:datapath-id=1235 \
193 fail-mode=secure -- \
194 add-port br-int br1+ -- set interface br1+ type=patch options:peer=br1- ofport_request=101 -- \
195 add-port br-int p5 -- set interface p5 ofport_request=5 type=dummy
196])
197AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
198])
199
f12bfd04
AW
200# Waits for all ifaces enabled.
201OVS_WAIT_UNTIL([test `ovs-appctl bond/show | grep -- "may_enable: true" | wc -l` -ge 4])
202
f9038ef6
AW
203# The dl_vlan flow should not be ever matched,
204# since recirculation should not change the flow handling.
205AT_DATA([flows.txt], [dnl
206table=0 priority=1 in_port=5 actions=mod_vlan_vid:1,output(101)
207table=0 priority=2 in_port=5 dl_vlan=1 actions=drop
208])
209AT_CHECK([ovs-ofctl add-flows br-int flows.txt])
210
211# Sends a packet to trigger recirculation.
f9038ef6
AW
212AT_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)"])
213
214# Collects flow stats.
215AT_CHECK([ovs-appctl revalidator/purge], [0])
216
217# Checks the flow stats in br1, should only be one flow with non-zero
218# 'n_packets' from internal table.
e2167cb7 219AT_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 220table_id=254, n_packets=1, n_bytes=38, priority=20,recirc_id=0x0,dp_hash=0x0/0xff,actions=output
f9038ef6
AW
221])
222
223# Checks the flow stats in br-int, should be only one match.
224AT_CHECK([ovs-ofctl dump-flows br-int | ofctl_strip | sort], [0], [dnl
efe179e0 225 n_packets=1, n_bytes=34, priority=1,in_port=5 actions=mod_vlan_vid:1,output:101
f9038ef6
AW
226 priority=2,in_port=5,dl_vlan=1 actions=drop
227NXST_FLOW reply:
228])
229
adcf00ba
AZ
230OVS_VSWITCHD_STOP()
231AT_CLEANUP
232
29901626 233AT_SETUP([ofproto-dpif - resubmit])
023e1e0a 234OVS_VSWITCHD_START
ca5792f0 235add_of_ports br0 1 10 11 12 13 14 15 16 17 18 19 20 21
29901626
BP
236AT_DATA([flows.txt], [dnl
237table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21)
238table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18)
239table=0 in_port=3 priority=2000 icmp actions=output(20)
240table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15)
241table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2)
242table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2)
243])
244AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50f96b10 245AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=p1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
29901626
BP
246AT_CHECK([tail -1 stdout], [0],
247 [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
248])
023e1e0a 249OVS_VSWITCHD_STOP
29901626 250AT_CLEANUP
58a89177 251
55599423
JR
252AT_SETUP([ofproto-dpif - goto table])
253OVS_VSWITCHD_START
ca5792f0 254add_of_ports br0 1 10 11
55599423 255echo "table=0 in_port=1 actions=output(10),goto_table(1)" > flows.txt
4468099e
EJ
256for i in `seq 1 63`; do echo "table=$i actions=goto_table($(($i+1)))"; done >> flows.txt
257echo "table=64 actions=output(11)" >> flows.txt
55599423
JR
258AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
259AT_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])
260AT_CHECK([tail -1 stdout], [0],
261 [Datapath actions: 10,11
262])
263OVS_VSWITCHD_STOP
264AT_CLEANUP
265
7fdb60a7
SH
266AT_SETUP([ofproto-dpif - write actions])
267OVS_VSWITCHD_START
ca5792f0 268add_of_ports br0 1 10 11 12 13
7fdb60a7
SH
269AT_DATA([flows.txt], [dnl
270table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
271table=1 ip actions=write_actions(output(13)),goto_table(2)
272table=2 ip actions=set_field:192.168.3.91->ip_src,output(11)
273])
274AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
275AT_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 276AT_CHECK([tail -2 stdout], [0],
e3981271 277 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 278Datapath actions: 10,set(ipv4(src=192.168.3.91)),11,set(ipv4(src=192.168.3.90)),13
7fdb60a7
SH
279])
280OVS_VSWITCHD_STOP
281AT_CLEANUP
282
e60e935b
SRCSA
283AT_SETUP([ofproto-dpif - modify IPv6 Neighbor Solitication (ND)])
284OVS_VSWITCHD_START
ca5792f0 285add_of_ports br0 1 10 11 12 13
e60e935b
SRCSA
286AT_DATA([flows.txt], [dnl
287table=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)
288table=1 icmp6 actions=write_actions(output(13)),goto_table(2)
289table=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)
290])
291AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
292AT_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])
293AT_CHECK([tail -4 stdout], [0],
e3981271 294 [Megaflow: recirc_id=0,eth,icmp6,in_port=1,nw_frag=no,icmp_type=0x87/0xff,icmp_code=0x0/0xff,nd_target=fe80::2020,nd_sll=66:55:44:33:22:11
e60e935b
SRCSA
295Datapath 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
296This flow is handled by the userspace slow path because it:
393e9f7c 297 - Uses action(s) not supported by datapath.
e60e935b
SRCSA
298])
299OVS_VSWITCHD_STOP
300AT_CLEANUP
301
7fdb60a7
SH
302AT_SETUP([ofproto-dpif - clear actions])
303OVS_VSWITCHD_START
ca5792f0 304add_of_ports br0 1 10 11 12
7fdb60a7
SH
305AT_DATA([flows.txt], [dnl
306table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
ce58df5b 307table=1 tcp actions=set_field:91->tp_src,output(11),clear_actions
7fdb60a7
SH
308])
309AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
ce58df5b
JR
310AT_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])
311AT_CHECK([tail -2 stdout], [0],
e3981271 312 [Megaflow: recirc_id=0,eth,tcp,in_port=1,nw_frag=no,tp_src=8
d23df9a8 313Datapath actions: 10,set(tcp(src=91)),11
7fdb60a7
SH
314])
315OVS_VSWITCHD_STOP
316AT_CLEANUP
317
0eb48fe1 318AT_SETUP([ofproto-dpif - group chaining])
5a070238 319OVS_VSWITCHD_START
ca5792f0 320add_of_ports br0 1 10 11
0eb48fe1
BP
321AT_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'])
322AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=123,type=all,bucket=output:10'])
323AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
324AT_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])
325AT_CHECK([tail -1 stdout], [0],
326 [Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
5a070238
BP
327])
328OVS_VSWITCHD_STOP
329AT_CLEANUP
330
f4fb341b
SH
331AT_SETUP([ofproto-dpif - all group in action list])
332OVS_VSWITCHD_START
ca5792f0 333add_of_ports br0 1 10 11
f4fb341b
SH
334AT_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'])
335AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
336AT_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
337# Must match on the source address to be able to restore it's value for
338# the second bucket
ce58df5b 339AT_CHECK([tail -2 stdout], [0],
e3981271 340 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 341Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
f4fb341b
SH
342])
343OVS_VSWITCHD_STOP
344AT_CLEANUP
345
346AT_SETUP([ofproto-dpif - indirect group in action list])
347OVS_VSWITCHD_START
ca5792f0 348add_of_ports br0 1 10
f4fb341b
SH
349AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
350AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
351AT_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])
352AT_CHECK([tail -1 stdout], [0],
353 [Datapath actions: 10
354])
355OVS_VSWITCHD_STOP
356AT_CLEANUP
357
5b09e569
JR
358AT_SETUP([ofproto-dpif - group actions have no effect afterwards])
359OVS_VSWITCHD_START
ca5792f0 360add_of_ports br0 1 10
5b09e569
JR
361AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=set_field:192.168.3.90->ip_src,output:10'])
362AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234,output:10'])
06db81cc
JS
363
364for d in 0 1 2 3; do
365 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.1.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
366 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
367done
368
369AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | sed 's/packets.*actions:/actions:/' | strip_ufid | strip_used | sort], [0], [dnl
138d30a9 370flow-dump from the main thread:
06db81cc
JS
371recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:hash(sym_l4(0)),recirc(0x1)
372recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),10
5b09e569 373])
06db81cc 374
5b09e569
JR
375OVS_VSWITCHD_STOP
376AT_CLEANUP
377
f4fb341b
SH
378AT_SETUP([ofproto-dpif - all group in action set])
379OVS_VSWITCHD_START
ca5792f0 380add_of_ports br0 1 10 11
f4fb341b
SH
381AT_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'])
382AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
383AT_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
384# Must match on the source address to be able to restore it's value for
385# the third bucket
ce58df5b 386AT_CHECK([tail -2 stdout], [0],
e3981271 387 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 388Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
f4fb341b
SH
389])
390OVS_VSWITCHD_STOP
391AT_CLEANUP
392
393AT_SETUP([ofproto-dpif - indirect group in action set])
394OVS_VSWITCHD_START
ca5792f0 395add_of_ports br0 1 10
f4fb341b
SH
396AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
397AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
398AT_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])
399AT_CHECK([tail -1 stdout], [0],
400 [Datapath actions: 10
401])
402OVS_VSWITCHD_STOP
403AT_CLEANUP
404
14ebc6c1
EG
405AT_SETUP([ofproto-dpif - patch port with action set])
406OVS_VSWITCHD_START([ \
407 add-br br1 -- \
408 set bridge br1 datapath-type=dummy fail-mode=secure -- \
409 add-port br0 patch10 -- \
410 set interface patch10 type=patch options:peer=patch20 ofport_request=10 -- \
411 add-port br1 patch20 -- \
412 set interface patch20 type=patch options:peer=patch10 ofport_request=20
413 ])
414add_of_ports br0 1
415add_of_ports br1 2
416AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br1 'ip actions=write_actions(pop_vlan,output:2)'])
417AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=output:10'])
418AT_CHECK([ovs-appctl ofproto/trace br1 'in_port=20,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_vlan=100,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
419AT_CHECK([tail -1 stdout], [0],
420 [Datapath actions: pop_vlan,2
421])
422AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_vlan=100,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
423AT_CHECK([tail -1 stdout], [0],
424 [Datapath actions: pop_vlan,2
425])
426OVS_VSWITCHD_STOP
427AT_CLEANUP
428
429
fe7e5749 430AT_SETUP([ofproto-dpif - select group])
06db81cc 431
fe7e5749 432OVS_VSWITCHD_START
ca5792f0 433add_of_ports br0 1 10 11
06db81cc
JS
434
435ovs-appctl vlog/set ofproto_dpif:file:dbg
fe7e5749 436AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
06db81cc
JS
437AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
438ofproto_dpif|DBG|Constructing select group 1234
439ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
440ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
441ofproto_dpif|DBG| Using 16 hash values:
442ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
443ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
444ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 1.
445])
fe7e5749 446AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
7cb279c2
SH
447
448# Try a bunch of different flows and make sure that they get distributed
06db81cc
JS
449# # at least somewhat.
450for d in 0 1 2 3; do
451 for s in 1 2 3 4 ; do
452 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.$s,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
453 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
454 done
7cb279c2 455done
06db81cc 456
fe07df80 457AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 5 2 dp_hash], [0], [dnl
06db81cc
JS
458recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
459n_flows=ok n_buckets=ok
fe7e5749 460])
06db81cc 461
fe7e5749
SH
462OVS_VSWITCHD_STOP
463AT_CLEANUP
464
465AT_SETUP([ofproto-dpif - select group with watch port])
06db81cc 466
fe7e5749 467OVS_VSWITCHD_START
ca5792f0 468add_of_ports br0 1 10 11
fe7e5749
SH
469AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
470AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
06db81cc
JS
471
472for d in 0 1 2 3; do
473 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
474 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
475done
476
477AT_CHECK([ovs-appctl dpctl/dump-flows | sort| sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | strip_ufid | strip_used], [0], [dnl
138d30a9 478flow-dump from the main thread:
06db81cc
JS
479recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:3, bytes:318, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
480recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:3, bytes:318, used:0.0s, actions:11
fe7e5749 481])
06db81cc 482
fe7e5749
SH
483OVS_VSWITCHD_STOP
484AT_CLEANUP
485
06db81cc
JS
486AT_SETUP([ofproto-dpif - select group with weights])
487
06db81cc
JS
488# Helper function to check the accuracy of distribution of packets over buckets
489check_group_stats () {
06db81cc
JS
490 buckets=`grep -o 'packet_count=[[0-9]]*' | cut -d'=' -f2 | tail -n +2`
491 i=0
492 for bucket in $buckets; do
99c3ae0b
IM
493 min=$1
494 shift
495 if [[ $bucket -ge $min ]]; then
496 echo "bucket$i >= $min"
06db81cc 497 else
99c3ae0b 498 echo "bucket$i < $min"
06db81cc 499 fi
99c3ae0b 500 i=`expr $i + 1`
06db81cc
JS
501 if [[ $i -ge 4 ]]; then break; fi
502 done
503}
504
7cb279c2 505OVS_VSWITCHD_START
06db81cc
JS
506add_of_ports br0 1 10 11 12 13 14
507
508ovs-appctl vlog/set ofproto_dpif:file:dbg
509AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=1234,type=select,bucket=weight:5,output:10,bucket=weight:10,output:11,bucket=weight:25,output:12,bucket=weight:60,output:13,bucket=weight:0,output:14'])
510AT_CHECK([grep -A9 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
511ofproto_dpif|DBG|Constructing select group 1234
512ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
513ofproto_dpif|DBG| Minimum weight: 5, total weight: 100
514ofproto_dpif|DBG| Using 32 hash values:
515ofproto_dpif|DBG| Bucket 0: weight=5, target=1.60 hits=2
516ofproto_dpif|DBG| Bucket 1: weight=10, target=3.20 hits=3
517ofproto_dpif|DBG| Bucket 2: weight=25, target=8.00 hits=8
518ofproto_dpif|DBG| Bucket 3: weight=60, target=19.20 hits=19
519ofproto_dpif|DBG| Bucket 4: weight=0, target=0.00 hits=0
520ofproto_dpif|DBG|Use dp_hash with 32 hash values using algorithm 1.
521])
7cb279c2 522AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
06db81cc
JS
523
524# Try 1000 different flows and make sure that they get distributed according to weights
525for d1 in 0 1 2 3 4 5 6 7 8 9 ; do
526 for d2 in 0 1 2 3 4 5 6 7 8 9 ; do
527 for s in 0 1 2 3 4 5 6 7 8 9 ; do
528 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.1.$s,dst=192.168.$d1.$d2,proto=6,tos=0,ttl=128,frag=no),tcp(src=1000$s,dst=1000)"
529 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
530 done
531 done
532done
533
534# Check balanced distribution over 32 dp_hash values
fe07df80 535AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 32 4 dp_hash], [0], [dnl
06db81cc
JS
536recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:999, bytes:117882, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
537n_flows=ok n_buckets=ok
7cb279c2 538])
06db81cc
JS
539
540# Check that actual distribution over the buckets is reasonably accurate:
541 ideal weights dp_hash values
542# bucket0: 5%*1000 = 50 2/32*1000 = 63
543# bucket1: 10%*1000 = 100 3/32*1000 = 94
544# bucket2: 25%*1000 = 250 8/32*1000 = 250
545# bucket3: 60%*1000 = 600 19/32*1000 = 594
546# bucket4: 0 0
547
548ovs-appctl time/warp 1000
549AT_CHECK([ovs-ofctl -O OpenFlow13 dump-group-stats br0 | sed 's/duration=[[0-9]]\.[[0-9]]*s,//' | check_group_stats 40 80 200 500],
550[0], [dnl
551bucket0 >= 40
552bucket1 >= 80
553bucket2 >= 200
554bucket3 >= 500
555])
556
7cb279c2
SH
557OVS_VSWITCHD_STOP
558AT_CLEANUP
559
06db81cc
JS
560AT_SETUP([ofproto-dpif - select group with explicit dp_hash selection method])
561
0c4b9393 562OVS_VSWITCHD_START
ca5792f0 563add_of_ports br0 1 10 11
06db81cc
JS
564
565ovs-appctl vlog/set ofproto_dpif:file:dbg
566AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11'])
567AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
568ofproto_dpif|DBG|Constructing select group 1234
569ofproto_dpif|DBG|Selection method specified: dp_hash.
570ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
571ofproto_dpif|DBG| Using 16 hash values:
572ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
573ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
574ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 0.
575])
576
577# Fall back to legacy hash with zero buckets
578AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method=dp_hash'])
579AT_CHECK([grep -A3 "Constructing select group 1235" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
580ofproto_dpif|DBG|Constructing select group 1235
581ofproto_dpif|DBG|Selection method specified: dp_hash.
582ofproto_dpif|DBG| Don't apply dp_hash method without buckets.
583ofproto_dpif|DBG|Falling back to default hash method.
584])
585
586# Fall back to legacy hash with zero buckets
587AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1236,type=select,selection_method=dp_hash,bucket=weight=1,output:10,bucket=weight=1000,output:11'])
588AT_CHECK([grep -A4 "Constructing select group 1236" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
589ofproto_dpif|DBG|Constructing select group 1236
590ofproto_dpif|DBG|Selection method specified: dp_hash.
591ofproto_dpif|DBG| Minimum weight: 1, total weight: 1001
592ofproto_dpif|DBG| Too many hash values required: 1024
593ofproto_dpif|DBG|Falling back to default hash method.
8b666728 594])
06db81cc
JS
595
596OVS_VSWITCHD_STOP
597AT_CLEANUP
598
599AT_SETUP([ofproto-dpif - select group with legacy hash selection method])
600
06db81cc
JS
601OVS_VSWITCHD_START
602add_of_ports br0 1 10 11
603
604ovs-appctl vlog/set ofproto_dpif:file:dbg
605AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,bucket=output:10,bucket=output:11'])
606AT_CHECK([grep -A2 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
607ofproto_dpif|DBG|Constructing select group 1234
608ofproto_dpif|DBG|Selection method specified: hash.
609ofproto_dpif|DBG|No hash fields. Falling back to default hash method.
610])
611
0c4b9393
SH
612AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
613
06db81cc
JS
614# Try 16 flows with differing default hash values.
615for d in 0 1 2 3; do
616 for s in 1 2 3 4 ; do
617 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.$s,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
618 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
619 done
0c4b9393 620done
06db81cc
JS
621
622# Check that the packets installed 16 data path flows and each of the two
623# buckets is hit at least once.
624AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
625n_flows=ok n_buckets=ok
0c4b9393
SH
626])
627
06db81cc
JS
628OVS_VSWITCHD_STOP
629AT_CLEANUP
630
631AT_SETUP([ofproto-dpif - select group with custom hash selection method])
632
06db81cc
JS
633OVS_VSWITCHD_START
634add_of_ports br0 1 10 11
635
636# Check that parse failures after 'fields' parsing work
637AT_CHECK([ovs-ofctl -O OpenFlow10 add-group br0 'group_id=1,type=select,fields(eth_dst),bukket=output:10'], [1], ,[dnl
638ovs-ofctl: unknown keyword bukket
0c4b9393
SH
639])
640
60dfb5ed
JR
641# Check that fields are rejected without "selection_method=hash".
642AT_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
643ovs-ofctl: fields may only be specified with "selection_method=hash"
644])
645
646# Check that selection_method_param without selection_method is rejected.
647AT_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
648ovs-ofctl: selection_method_param is only allowed with "selection_method"
649])
650
06db81cc
JS
651AT_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'])
652AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
53cc166a 653
06db81cc
JS
654# Try 16 flows with differing custom hash and check that they give rise to
655# 16 data path flows and each of the two buckets is hit at least once
656for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
657 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:$d),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
53cc166a
JR
658 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
659done
660
06db81cc
JS
661AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
662n_flows=ok n_buckets=ok
53cc166a
JR
663])
664
665AT_CHECK([ovs-appctl revalidator/purge], [0])
666
06db81cc
JS
667# Try 16 flows that differ only in fields that are not part of the custom
668# hash and check that there is only a single datapath flow
53cc166a
JR
669for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
670 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)"
671 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
672done
673
06db81cc
JS
674AT_CHECK([ovs-appctl dpctl/dump-flows | grep -c recirc_id], [0], [dnl
6751
53cc166a
JR
676])
677
678OVS_VSWITCHD_STOP
679AT_CLEANUP
680
dd8cd4b4
SH
681AT_SETUP([ofproto-dpif - fast failover group])
682OVS_VSWITCHD_START
ca5792f0 683add_of_ports br0 1 10 11
dd8cd4b4
SH
684AT_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'])
685AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
686AT_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])
687AT_CHECK([tail -1 stdout], [0],
c9c8c8a1 688 [Datapath actions: 10
dd8cd4b4
SH
689])
690OVS_VSWITCHD_STOP
691AT_CLEANUP
692
b2af3288
AZ
693AT_SETUP([ofproto-dpif - group stats single bucket])
694OVS_VSWITCHD_START
ca5792f0 695add_of_ports br0 1 10 11
b2af3288
AZ
696AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
697AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
698(
699for i in `seq 0 2`;
700 do
701 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)"
702 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
703 done
704)
cea4a6d7 705AT_CHECK([ovs-appctl revalidator/purge], [0])
b2af3288 706AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 707AT_CHECK([strip_xids < stdout | sort], [0], [dnl
6f068379 708 group_id=1234,ref_count=1,packet_count=3,byte_count=318,bucket0:packet_count=3,byte_count=318,bucket1:packet_count=0,byte_count=0
b2af3288
AZ
709OFPST_GROUP reply (OF1.2):
710])
711OVS_VSWITCHD_STOP
712AT_CLEANUP
713
714AT_SETUP([ofproto-dpif - group stats all buckets])
715OVS_VSWITCHD_START
ca5792f0 716add_of_ports br0 1 10 11
b2af3288
AZ
717AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
718AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
719(
720for i in `seq 0 2`;
721 do
722 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)"
723 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
724 done
725)
cea4a6d7 726AT_CHECK([ovs-appctl revalidator/purge], [0])
b2af3288 727AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 728AT_CHECK([strip_xids < stdout | sort], [0], [dnl
6f068379 729 group_id=1234,ref_count=1,packet_count=3,byte_count=318,bucket0:packet_count=3,byte_count=318,bucket1:packet_count=3,byte_count=318
b2af3288
AZ
730OFPST_GROUP reply (OF1.2):
731])
732OVS_VSWITCHD_STOP
733AT_CLEANUP
734
58a89177 735AT_SETUP([ofproto-dpif - registers])
023e1e0a 736OVS_VSWITCHD_START
ca5792f0 737add_of_ports br0 20 21 22 33 90
58a89177
EJ
738AT_DATA([flows.txt], [dnl
739in_port=90 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
740in_port=91 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
e9358af6
EJ
741in_port=92 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
742in_port=93 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
743
58a89177
EJ
744in_port=2 actions=load:0x000db000->NXM_NX_REG0[[]]
745in_port=3 actions=load:0xdea->NXM_NX_REG0[[20..31]]
746in_port=4 actions=load:0xeef->NXM_NX_REG0[[0..11]]
747in_port=5 actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
748in_port=6 actions=load:0x22222222->NXM_NX_REG2[[]]
749in_port=7 actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
750in_port=8 actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
751in_port=9,reg0=0xdeadbeef actions=output:20
752in_port=10,reg1=0xdeadbeef actions=output:21
753in_port=11,reg2=0xeef22dea actions=output:22
e9358af6
EJ
754
755dnl Sanilty check all registers
756in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
757in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
758in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
759in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
bd85dac1 760
58a89177
EJ
761])
762AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 763AT_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 764AT_CHECK([tail -1 stdout], [0],
e9358af6 765 [Datapath actions: 20,21,22,33
58a89177 766])
023e1e0a 767OVS_VSWITCHD_STOP
58a89177 768AT_CLEANUP
f694937d 769
57fa8167
BP
770dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
771dnl in the manner documented in ovs-ofctl(8).
772AT_SETUP([ofproto-dpif - extended registers])
773OVS_VSWITCHD_START
ca5792f0 774add_of_ports br0 1 2 3
57fa8167
BP
775AT_DATA([flows.txt], [dnl
776table=0 actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
777table=1,reg2=0xfedcba98,reg3=0x76543210 actions=2
778
779# These low-priority rules shouldn't match. They're here only to make really
780# sure that the test fails if either of the above rules fails to match.
781table=0,priority=0 actions=3
782table=1,priority=0 actions=3
783])
784AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
785AT_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])
786AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
787])
788OVS_VSWITCHD_STOP
789AT_CLEANUP
790
b23ada8e
JP
791dnl Tests that the standardized xxregs are mapped onto the legacy OVS
792dnl registers in the manner documented in ovs-ofctl(8).
793AT_SETUP([ofproto-dpif - extended-extended registers])
794OVS_VSWITCHD_START
795add_of_ports br0 1 2 3
796AT_DATA([flows.txt], [dnl
797table=0 actions=load:0x0123456789abcdeffedcba9876543210->NXM_NX_XXREG1[[]],resubmit(,1)
798table=1,reg4=0x01234567,reg5=0x89abcdef,reg6=0xfedcba98,reg7=0x76543210 actions=2
799
800# These low-priority rules shouldn't match. They're here only to make really
801# sure that the test fails if either of the above rules fails to match.
802table=0,priority=0 actions=3
803table=1,priority=0 actions=3
804])
805AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
806AT_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])
807AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
808])
809OVS_VSWITCHD_STOP
810AT_CLEANUP
811
1b0ee636
TG
812AT_SETUP([ofproto-dpif - load and move order])
813OVS_VSWITCHD_START
ca5792f0 814add_of_ports br0 1 10 11
1b0ee636
TG
815AT_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'])
816AT_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)'])
817AT_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])
818AT_CHECK([tail -2 stdout], [0],
e3981271 819 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 820Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
1b0ee636
TG
821])
822OVS_VSWITCHD_STOP
823AT_CLEANUP
824
eb1cbc6b
JT
825dnl Tests that 1.5 copy-field can copy into the standardized xregs.
826AT_SETUP([ofproto-dpif - copy-field into extended registers])
827OVS_VSWITCHD_START
ca5792f0 828add_of_ports br0 1 2 3
eb1cbc6b
JT
829AT_DATA([flows.txt], [dnl
830table=0 actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
831table=1,xreg0=0x0000505400000005 actions=2
832
833# These low-priority rules shouldn't match. They're here only to make really
834# sure that the test fails if either of the above rules fails to match.
835table=0,priority=0 actions=3
836table=1,priority=0 actions=3
837])
838AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
839AT_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])
840AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
841])
842OVS_VSWITCHD_STOP
843AT_CLEANUP
844
2bef8e07
JT
845dnl Tests that 1.5 set-field with mask in the metadata register.
846AT_SETUP([ofproto-dpif - masked set-field into metadata])
847OVS_VSWITCHD_START
ca5792f0 848add_of_ports br0 1 2 3
2bef8e07
JT
849AT_DATA([flows.txt], [dnl
850table=0 actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
851table=1 actions=set_field:0x6b/0xff->metadata,goto_table(2)
852table=2,metadata=0xfafafafa5a5a5a6b actions=2
853
854# These low-priority rules shouldn't match. They're here only to make really
855# sure that the test fails if either of the above rules fails to match.
856table=0,priority=0 actions=3
857table=1,priority=0 actions=3
858table=2,priority=0 actions=3
859])
860AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
861AT_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])
862AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
863])
864OVS_VSWITCHD_STOP
865AT_CLEANUP
866
c61f3870
BP
867
868AT_SETUP([ofproto-dpif - actset_output])
869OVS_VSWITCHD_START
ca5792f0 870add_of_ports br0 1 2 3 4 5 6 7 8 9 10 11 12 13
c61f3870 871AT_DATA([flows.txt], [dnl
3ca3ce0c 872table=0,actset_output=unset actions=write_actions(output(2)),goto_table(1)
c61f3870
BP
873table=1 actions=move:ONFOXM_ET_ACTSET_OUTPUT[[0..31]]->OXM_OF_PKT_REG0[[0..31]],goto_table(2)
874
875# Verify that actset_output got set.
876table=2,priority=20,actset_output=2 actions=4,goto_table(3)
877table=2,priority=10 actions=5,goto_table(3)
878
879# Verify that xreg0 got copied properly from actset_output.
880table=3,priority=20,xreg0=2 actions=6,goto_table(4)
881table=3,priority=10 actions=7,goto_table(4)
882
b23ada8e
JP
883# Verify that xxreg0 got copied properly from actset_output.
884table=3,priority=20,xxreg0=2 actions=6,goto_table(4)
885table=3,priority=10 actions=7,goto_table(4)
886
9055ca9a
BP
887# Verify that adding a group action unsets actset_output,
888# even if output follows group.
889table=4 actions=write_actions(group(5),output(10)),goto_table(5)
c61f3870
BP
890table=5,priority=20,actset_output=unset actions=8,goto_table(6)
891table=5,priority=10 actions=9,goto_table(6)
892
893# Verify that adding another output action doesn't change actset_output
894# (since there's still a group).
895table=6 actions=write_actions(output(3)),goto_table(7)
896table=7,priority=20,actset_output=unset actions=10,goto_table(8)
897table=7,priority=10 actions=11,goto_table(8)
898
899# Verify that clearing the action set, then writing an output action,
900# causes actset_output to be set again.
901table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
902table=9,priority=20,actset_output=2 actions=12
903table=9,priority=10 actions=13
904])
4f20179d 905AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=5,type=all,bucket=output:1'])
c61f3870
BP
906AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
907AT_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])
908AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
909])
910OVS_VSWITCHD_STOP
911AT_CLEANUP
880b1458 912
bd85dac1
AZ
913AT_SETUP([ofproto-dpif - push-pop])
914OVS_VSWITCHD_START
ca5792f0 915add_of_ports br0 20 21 22 33 90
bd85dac1
AZ
916AT_DATA([flows.txt], [dnl
917in_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
918in_port=2 actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
919in_port=3 actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
920in_port=4 actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
921in_port=5 actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
922
923])
924AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 925AT_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
926AT_CHECK([tail -1 stdout], [0],
927 [Datapath actions: 33,22,21,20
928])
929OVS_VSWITCHD_STOP
930AT_CLEANUP
931
f694937d 932AT_SETUP([ofproto-dpif - output])
023e1e0a 933OVS_VSWITCHD_START
ca5792f0 934add_of_ports br0 1 9 10 11 55 66 77 88
f694937d 935AT_DATA([flows.txt], [dnl
557323cd 936in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
f694937d
EJ
937in_port=2 actions=output:9
938in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
939in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
940in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
941in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
942in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
557323cd 943in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
f694937d
EJ
944])
945AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 946AT_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 947AT_CHECK([tail -1 stdout], [0],
557323cd 948 [Datapath actions: 9,55,10,55,66,11,77,88,9,1
f694937d 949])
023e1e0a 950OVS_VSWITCHD_STOP
f694937d 951AT_CLEANUP
8e9ce036 952
f0fd1a17
PS
953AT_SETUP([ofproto-dpif - dec_ttl])
954OVS_VSWITCHD_START
ca5792f0 955add_of_ports br0 1 2 3 4
f0fd1a17
PS
956AT_DATA([flows.txt], [dnl
957table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
958table=1 in_port=1 action=dec_ttl,output:3
959])
960AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8249a1fe 961AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=2,frag=no)' -generate], [0], [stdout])
d39ec23d
JP
962AT_CHECK([tail -4 stdout], [0], [
963Final flow: ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=111,nw_tos=0,nw_ecn=0,nw_ttl=1
964Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=2,nw_frag=no
74c4530d 965Datapath actions: set(ipv4(ttl=1)),2,userspace(pid=0,controller(reason=2,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535)),4
f0fd1a17 966])
8249a1fe 967AT_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 968AT_CHECK([tail -2 stdout], [0],
e3981271 969 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=3,nw_frag=no
d23df9a8 970Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
f0fd1a17 971])
50aa28fd 972AT_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 973AT_CHECK([tail -2 stdout], [0],
e3981271 974 [Megaflow: recirc_id=0,eth,ipv6,in_port=1,nw_ttl=128,nw_frag=no
d23df9a8 975Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
f0fd1a17
PS
976])
977
982697a4 978AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 979AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d39ec23d
JP
980
981ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=2,frag=no)'
982
d9c8c57c 983OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
f0fd1a17 984AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8249a1fe 985NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
e6d9ab56 986ip,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
987])
988OVS_VSWITCHD_STOP
989AT_CLEANUP
990
65bfce4a
SH
991dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
992dnl buffer to be resized just before pushing the id of the dec_ttl action.
993dnl Thus the implementation must account for this by using the
994dnl reallocated buffer rather than the original buffer.
995dnl
996dnl A number of similar rules are added to try and exercise
997dnl xrealloc sufficiently that it returns a different base pointer
998AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
999OVS_VSWITCHD_START
ca5792f0 1000add_of_ports br0 1
65bfce4a
SH
1001(for i in `seq 0 255`; do
1002 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
1003 done) > flows.txt
1004AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1005OVS_VSWITCHD_STOP
1006AT_CLEANUP
1007
1008dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
1009dnl buffer to be resized just before pushing the id of the dec_ttl action.
1010dnl Thus the implementation must account for this by using the
1011dnl reallocated buffer rather than the original buffer.
1012dnl
1013dnl A number of similar rules are added to try and exercise
1014dnl xrealloc sufficiently that it returns a different base pointer
1015AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
1016OVS_VSWITCHD_START
ca5792f0 1017add_of_ports br0 1
65bfce4a
SH
1018(for i in `seq 0 255`; do
1019 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
1020 done) > flows.txt
1021AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1022OVS_VSWITCHD_STOP
1023AT_CLEANUP
1024
1025dnl A note action at offset 24 in ofpacts will cause the ofpacts
1026dnl buffer to be resized just before pushing the id of the dec_ttl action.
1027dnl Thus the implementation must account for this by using the
1028dnl reallocated buffer rather than the original buffer.
1029dnl
1030dnl A number of similar rules are added to try and exercise
1031dnl xrealloc sufficiently that it returns a different base pointer
1032AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
1033OVS_VSWITCHD_START
ca5792f0 1034add_of_ports br0 1
65bfce4a
SH
1035(for i in `seq 0 255`; do
1036 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
1037 done) > flows.txt
1038AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1039OVS_VSWITCHD_STOP
1040AT_CLEANUP
f0fd1a17 1041
ace39a6f
JS
1042dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
1043dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
1044dnl Using `make check-valgrind' here checks for use-after-free in this
1045dnl codepath.
1046AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
1047OVS_VSWITCHD_START
1048AT_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'])
1049OVS_VSWITCHD_STOP
1050AT_CLEANUP
1051
77750738 1052AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
e44768b7 1053OVS_VSWITCHD_START
ca5792f0 1054add_of_ports br0 1 2
77750738 1055
77750738
JP
1056AT_CHECK([ovs-ofctl add-flow br0 action=normal])
1057
1058# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 1059flow="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 1060AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
72d64e33
EJ
1061AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
10621
10632
1064100
1065])
77750738
JP
1066
1067OVS_VSWITCHD_STOP
1068AT_CLEANUP
1069
8b36f51e 1070AT_SETUP([ofproto-dpif - DSCP])
8b36f51e 1071OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
ca5792f0 1072add_of_ports br0 9
8b36f51e 1073AT_DATA([flows.txt], [dnl
bdda5aca 1074actions=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
1075])
1076AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1077AT_CHECK([ovs-vsctl -- \
1078 set Port p1 qos=@newqos --\
1079 --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
1080 --id=@q1 create Queue dscp=1 --\
1081 --id=@q2 create Queue dscp=2], [0], [ignore])
50aa28fd 1082AT_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 1083AT_CHECK([tail -2 stdout], [0],
e3981271 1084 [Megaflow: recirc_id=0,skb_priority=0,eth,ip,in_port=9,nw_tos=252,nw_frag=no
ce58df5b 1085Datapath actions: dnl
e44768b7 1086100,dnl
d23df9a8
JR
1087set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1088set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
8b36f51e 10891,dnl
d23df9a8
JR
1090set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1091set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
1092set(ipv4(tos=0/0xfc)),1,100
8b36f51e
EJ
1093])
1094OVS_VSWITCHD_STOP
1095AT_CLEANUP
1096
fd19297b 1097AT_SETUP([ofproto-dpif - output/flood flags])
f7b8e494 1098OVS_VSWITCHD_START
ca5792f0 1099add_of_ports br0 1 2 3 4 5 6 7
fd19297b
EJ
1100
1101AT_DATA([flows.txt], [dnl
a0fbe94a 1102in_port=local actions=local,flood
fd19297b
EJ
1103in_port=1 actions=flood
1104in_port=2 actions=all
bdda5aca
BP
1105in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
1106in_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
1107])
1108AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1109AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
1110AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
1111
50aa28fd 1112AT_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
1113AT_CHECK([tail -1 stdout \
1114| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
11151
11162
11173
11184
11197
1120])
1121
50aa28fd 1122AT_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
1123AT_CHECK([tail -1 stdout \
1124| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
e44768b7 1125100
fd19297b
EJ
11262
11273
11284
11297
1130])
1131
50aa28fd 1132AT_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
1133AT_CHECK([tail -1 stdout \
1134| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
fd19297b 11351
e44768b7 1136100
fd19297b
EJ
11373
11384
11396
11407
1141])
1142
50aa28fd 1143AT_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 1144AT_CHECK([tail -1 stdout], [0],
e44768b7 1145 [Datapath actions: 100,1,2,4,6,7
fd19297b
EJ
1146])
1147
50aa28fd 1148AT_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 1149AT_CHECK([tail -1 stdout], [0],
1b567fb9 1150 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
fd19297b
EJ
1151])
1152OVS_VSWITCHD_STOP
1153AT_CLEANUP
1154
6b83a3c5 1155AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
6d328fa2
SH
1156OVS_VSWITCHD_START([dnl
1157 add-port br0 p1 -- set Interface p1 type=dummy
1158])
53eb8cb8 1159on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1160
1161AT_CAPTURE_FILE([ofctl_monitor.log])
1162
6409e008 1163AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1164
1165for i in 1 2 3 ; do
ea2735d3 1166 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 1167done
8bd16974 1168OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1169OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2 1170AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1171NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1172tcp,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 1173dnl
efe179e0 1174NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1175tcp,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 1176dnl
efe179e0 1177NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1178tcp,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
1179])
1180
1181AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1182AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1183NXST_FLOW reply:
1184])
1185
1186OVS_VSWITCHD_STOP
1187AT_CLEANUP
1188
6b83a3c5
SH
1189AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
1190OVS_VSWITCHD_START([dnl
1191 add-port br0 p1 -- set Interface p1 type=dummy
1192])
53eb8cb8 1193on_exit 'kill `cat ovs-ofctl.pid`'
6b83a3c5
SH
1194
1195AT_CAPTURE_FILE([ofctl_monitor.log])
1196AT_CHECK([ovs-ofctl del-flows br0])
1197
6409e008 1198AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6b83a3c5 1199
40ebbf78 1200dnl Test that missed packets are dropped
6b83a3c5 1201for i in 1 2 3 ; do
ea2735d3 1202 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 1203done
d9c8c57c 1204OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6b83a3c5
SH
1205
1206AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1207])
1208
1209AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1210AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1211OFPST_FLOW reply (OF1.3):
1212])
1213
1214OVS_VSWITCHD_STOP
1215AT_CLEANUP
1216
6d328fa2
SH
1217AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
1218OVS_VSWITCHD_START([dnl
1219 add-port br0 p1 -- set Interface p1 type=dummy
1220])
53eb8cb8 1221on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1222
1223AT_CAPTURE_FILE([ofctl_monitor.log])
1224AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1225
6409e008 1226AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1227
1228for i in 1 2 3 ; do
8e4c1621 1229 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 1230done
8bd16974 1231OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1232OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2 1233AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1234OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1235tcp,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 1236dnl
efe179e0 1237OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1238tcp,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 1239dnl
efe179e0 1240OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 1241tcp,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
1242])
1243
cea4a6d7 1244AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1245AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 1246 n_packets=3, n_bytes=162, actions=goto_table:1
6d328fa2
SH
1247OFPST_FLOW reply (OF1.2):
1248])
1249
1250OVS_VSWITCHD_STOP
1251AT_CLEANUP
1252
1253AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
1254OVS_VSWITCHD_START([dnl
1255 add-port br0 p1 -- set Interface p1 type=dummy
1256])
53eb8cb8 1257on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1258
1259AT_CAPTURE_FILE([ofctl_monitor.log])
1260AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1261
6409e008 1262AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1263
1264for i in 1 2 3 ; do
1265 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)'
1266done
1267
d9c8c57c 1268OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1269AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1270])
1271
cea4a6d7 1272AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1273AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1274 n_packets=3, n_bytes=354, actions=resubmit(1,1)
6d328fa2
SH
1275OFPST_FLOW reply (OF1.2):
1276])
1277
1278OVS_VSWITCHD_STOP
1279AT_CLEANUP
1280
1281AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1282OVS_VSWITCHD_START([dnl
1283 add-port br0 p1 -- set Interface p1 type=dummy
1284])
53eb8cb8 1285on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1286
1287AT_CAPTURE_FILE([ofctl_monitor.log])
1288AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1289AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1290
1291dnl Miss table 0, Hit table 1
6409e008 1292AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1293
1294for i in 1 2 3 ; do
1295 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)'
1296done
8bd16974 1297OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1298OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1299
1300AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1301NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1302tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2 1303dnl
6f068379
BP
1304NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1305tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2 1306dnl
6f068379
BP
1307NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1308tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2
SH
1309])
1310
1311dnl Hit table 0, Miss all other tables, sent to controller
6409e008 1312AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1313
1314for i in 1 2 3 ; do
1315 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)'
1316done
8bd16974 1317OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1318OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1319
1320AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1321NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1322tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2 1323dnl
6f068379
BP
1324NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1325tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2 1326dnl
6f068379
BP
1327NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1328tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2
SH
1329])
1330
cea4a6d7 1331AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1332AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1333 table=1, n_packets=3, n_bytes=354, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
6d328fa2
SH
1334OFPST_FLOW reply (OF1.2):
1335])
1336
1337OVS_VSWITCHD_STOP
1338AT_CLEANUP
1339
1340AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1341OVS_VSWITCHD_START([dnl
1342 add-port br0 p1 -- set Interface p1 type=dummy
1343])
53eb8cb8 1344on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1345
1346AT_CAPTURE_FILE([ofctl_monitor.log])
1347AT_DATA([flows.txt], [dnl
1348table=0 actions=goto_table(1)
1349table=2 dl_src=10:11:11:11:11:11 actions=controller
1350])
1351AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1352AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1353
1354dnl Hit table 0, Miss table 1, Hit table 2
6409e008 1355AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1356
1357for i in 1 2 3 ; do
1358 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)'
1359done
8bd16974 1360OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1361OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1362
1363AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1364NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1365tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2 1366dnl
6f068379
BP
1367NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1368tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2 1369dnl
6f068379
BP
1370NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1371tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2
SH
1372])
1373
1374dnl Hit table 1, Miss all other tables, sent to controller
6409e008 1375AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1376
1377for i in 1 2 3 ; do
1378 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)'
1379done
8bd16974 1380OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1381OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1382
1383AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1384NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1385tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2 1386dnl
6f068379
BP
1387NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1388tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2 1389dnl
6f068379
BP
1390NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1391tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
6d328fa2
SH
1392])
1393
cea4a6d7 1394AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1395AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379
BP
1396 n_packets=6, n_bytes=708, actions=goto_table:1
1397 table=2, n_packets=3, n_bytes=354, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
6d328fa2
SH
1398OFPST_FLOW reply (OF1.2):
1399])
1400
1401OVS_VSWITCHD_STOP
1402AT_CLEANUP
1403
1404AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1405OVS_VSWITCHD_START([dnl
1406 add-port br0 p1 -- set Interface p1 type=dummy
1407])
53eb8cb8 1408on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1409
1410AT_CAPTURE_FILE([ofctl_monitor.log])
1411AT_DATA([flows.txt], [dnl
1412table=0 actions=resubmit(1,1)
1413table=2 dl_src=10:11:11:11:11:11 actions=controller
1414])
1415AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1416AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1417
1418dnl Hit table 0, Miss table 1, Dropped
6409e008 1419AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1420
1421for i in 1 2 3 ; do
1422 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)'
1423done
0c473314 1424OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1425
1426AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1427])
1428
1429dnl Hit table 1, Dropped
6409e008 1430AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1431
1432for i in 1 2 3 ; do
1433 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)'
1434done
d9c8c57c 1435OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1436
1437AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1438])
1439
cea4a6d7 1440AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1441AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1442 n_packets=6, n_bytes=708, actions=resubmit(1,1)
6d328fa2
SH
1443 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1444OFPST_FLOW reply (OF1.2):
1445])
1446
1447OVS_VSWITCHD_STOP
1448AT_CLEANUP
1449
1450AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1451OVS_VSWITCHD_START([dnl
1452 add-port br0 p1 -- set Interface p1 type=dummy
1453])
53eb8cb8 1454on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1455
1456AT_CAPTURE_FILE([ofctl_monitor.log])
1457AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1458
6409e008 1459AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1460
40ebbf78 1461dnl Test that missed packets are dropped
6d328fa2
SH
1462for i in 1 2 3 ; do
1463 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)'
1464done
d9c8c57c 1465OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1466
1467AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1468])
1469
1470AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1471AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1472NXST_FLOW reply:
1473])
1474
1475OVS_VSWITCHD_STOP
1476AT_CLEANUP
1477
1478AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1479OVS_VSWITCHD_START([dnl
1480 add-port br0 p1 -- set Interface p1 type=dummy
1481])
53eb8cb8 1482on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1483
1484AT_CAPTURE_FILE([ofctl_monitor.log])
1485AT_CHECK([ovs-ofctl del-flows br0])
1486AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1487AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1488
6409e008 1489AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1490
40ebbf78 1491dnl Test that missed packets are dropped
6d328fa2
SH
1492for i in 1 2 3 ; do
1493 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)'
1494done
d9c8c57c 1495OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1496
1497AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1498])
1499
cea4a6d7 1500AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1501AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1502 n_packets=3, n_bytes=354, actions=goto_table:1
6d328fa2
SH
1503OFPST_FLOW reply (OF1.2):
1504])
1505
1506OVS_VSWITCHD_STOP
1507AT_CLEANUP
1508
1509AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1510OVS_VSWITCHD_START([dnl
1511 add-port br0 p1 -- set Interface p1 type=dummy
1512])
53eb8cb8 1513on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1514
1515AT_CAPTURE_FILE([ofctl_monitor.log])
1516AT_CHECK([ovs-ofctl del-flows br0])
1517AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1518AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1519
6409e008 1520AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2 1521
40ebbf78 1522dnl Test that missed packets are dropped
6d328fa2
SH
1523for i in 1 2 3 ; do
1524 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)'
1525done
d9c8c57c 1526OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1527
1528AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1529])
1530
cea4a6d7 1531AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2 1532AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379 1533 n_packets=3, n_bytes=354, actions=resubmit(1,1)
6d328fa2
SH
1534OFPST_FLOW reply (OF1.2):
1535])
1536
1537OVS_VSWITCHD_STOP
1538AT_CLEANUP
1539
15056dc8
EJ
1540AT_SETUP([ofproto-dpif - controller])
1541OVS_VSWITCHD_START([dnl
1542 add-port br0 p1 -- set Interface p1 type=dummy
1543])
53eb8cb8 1544on_exit 'kill `cat ovs-ofctl.pid`'
15056dc8
EJ
1545
1546AT_CAPTURE_FILE([ofctl_monitor.log])
1547AT_DATA([flows.txt], [dnl
1548cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
54834960 1549cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
15056dc8
EJ
1550cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1551
54834960
EJ
1552cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1553cookie=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)
1554cookie=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)
1555cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1556cookie=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)
1557cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1558cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
78cef7fd 1559cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
56d72f37 1560cookie=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
1561])
1562AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1563
1564dnl Flow miss.
6409e008 1565AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1566
1567for i in 1 2 3 ; do
dc235f7f 1568 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 1569done
57c94f35 1570OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1571OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1572
15056dc8 1573AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1574OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1575tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
15056dc8 1576dnl
6f068379
BP
1577OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1578tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
15056dc8 1579dnl
6f068379
BP
1580OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1581tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
15056dc8
EJ
1582])
1583
1584dnl Singleton controller action.
6409e008 1585AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1586
1587for i in 1 2 3 ; do
dc235f7f 1588 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 1589done
57c94f35 1590OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1591OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1592
15056dc8 1593AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1594OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1595tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
efe179e0 1596OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1597tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
efe179e0 1598OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1599tcp,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
1600])
1601
1602dnl Modified controller action.
6409e008 1603AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1604
1605for i in 1 2 3 ; do
dc235f7f 1606 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 1607done
57c94f35 1608OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1609OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1610
15056dc8 1611AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1612OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1613tcp,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 1614dnl
efe179e0 1615OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1616tcp,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 1617dnl
efe179e0 1618OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1619tcp,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
1620])
1621
363dd1d9 1622dnl Modified VLAN controller action.
9a403b07 1623AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
363dd1d9
JS
1624
1625for i in 1 2 3; do
8249a1fe 1626 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 1627done
57c94f35 1628OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1629OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
363dd1d9 1630
363dd1d9 1631AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1632NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1633ip,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 1634dnl
efe179e0 1635NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1636ip,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 1637dnl
efe179e0 1638NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
f0fb825a 1639ip,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
1640])
1641
349fbdc2 1642dnl Checksum TCP.
6409e008 1643AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1644
1645for i in 1 ; do
1646 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)'
1647done
1648OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1649OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1650
1651AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1652NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 1653tcp,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 1654dnl
efe179e0 1655NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=58 reg0=0x1,in_port=1 (via action) data_len=58 (unbuffered)
f0fb825a 1656tcp,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 1657dnl
efe179e0 1658NXT_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 1659tcp,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 1660dnl
efe179e0 1661NXT_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 1662tcp,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 1663dnl
efe179e0 1664NXT_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 1665tcp,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 1666dnl
efe179e0 1667NXT_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 1668tcp,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 1669dnl
efe179e0 1670NXT_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 1671tcp,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 1672dnl
efe179e0 1673NXT_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 1674tcp,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 1675dnl
efe179e0 1676NXT_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 1677tcp,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
1678])
1679
1680dnl Checksum UDP.
6409e008 1681AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1682
1683for i in 1 ; do
1684 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'
1685done
1686OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1687OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1688
1689AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1690NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1691udp,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 1692dnl
50dcbd8e 1693NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
f0fb825a 1694udp,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 1695dnl
50dcbd8e 1696NXT_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 1697udp,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 1698dnl
50dcbd8e 1699NXT_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 1700udp,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 1701dnl
50dcbd8e 1702NXT_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 1703udp,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 1704dnl
50dcbd8e 1705NXT_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 1706udp,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 1707dnl
50dcbd8e 1708NXT_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 1709udp,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 1710dnl
50dcbd8e 1711NXT_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 1712udp,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 1713dnl
50dcbd8e 1714NXT_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 1715udp,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
1716])
1717
1718dnl Modified ARP controller action.
9a403b07 1719AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1720
1721for i in 1 2 3; do
1722 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)'
1723done
1724
368a198a 1725OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1726OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2 1727AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1728NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1729arp,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 1730NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1731arp,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 1732NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1733arp,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 1734NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1735arp,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 1736NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1737arp,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 1738NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1739arp,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 1740NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1741arp,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 1742NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1743arp,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 1744NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 1745arp,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
1746])
1747
1748AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1749
1750dnl Checksum SCTP.
6409e008 1751AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1752
1753for i in 1 ; do
1754 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'
1755done
1756
f7a22c7e 1757AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
349fbdc2 1758OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1759OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1760AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1761NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
e6d9ab56 1762sctp,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 1763dnl
50dcbd8e 1764NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
f0fb825a 1765sctp,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 1766dnl
50dcbd8e 1767NXT_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 1768sctp,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 1769dnl
50dcbd8e 1770NXT_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 1771sctp,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 1772dnl
50dcbd8e 1773NXT_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 1774sctp,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 1775dnl
50dcbd8e 1776NXT_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 1777sctp,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 1778dnl
50dcbd8e 1779NXT_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 1780sctp,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 1781dnl
50dcbd8e 1782NXT_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 1783sctp,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 1784dnl
50dcbd8e 1785NXT_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 1786sctp,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
1787])
1788
1789AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
1790 cookie=0x1, n_packets=3, n_bytes=212, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1791 cookie=0x2, n_packets=3, n_bytes=162, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1792 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)
1793 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)
1794 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)
1795 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)
1796 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)
1797 cookie=0x8, table=6, n_packets=3, n_bytes=212, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1798 cookie=0x9, table=7, n_packets=3, n_bytes=212, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1799 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
1800 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
1801 n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
349fbdc2
SH
1802NXST_FLOW reply:
1803])
1804
1805OVS_VSWITCHD_STOP
1806AT_CLEANUP
1807
d39ec23d
JP
1808
1809AT_SETUP([ofproto-dpif - controller with slow-path action])
1810OVS_VSWITCHD_START
1811add_of_ports br0 1 2
1812
1813AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,controller"])
1814
1815AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1816
1817for i in 1 2 3 ; do
1818 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)'
1819done
1820
1821OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
1822OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1823
1824AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
1825OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1826tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
d39ec23d 1827dnl
6f068379
BP
1828OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1829tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
d39ec23d 1830dnl
6f068379
BP
1831OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1832tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
d39ec23d
JP
1833])
1834
1835OVS_VSWITCHD_STOP
1836AT_CLEANUP
1837
1838
1dea1435 1839AT_SETUP([ofproto-dpif - controller action without megaflows])
1840OVS_VSWITCHD_START
1841add_of_ports br0 1
1842
1843AT_CHECK([ovs-ofctl add-flow br0 in_port=1,action=controller])
1844AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [dnl
1845megaflows disabled
1846])
1847
1848AT_CAPTURE_FILE([ofctl_monitor.log])
1849AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1850
1851for i in 1 2; do
1852 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)'])
1853done
1854
1855OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
1856OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1857
1858AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 1859flow-dump from the main thread:
74c4530d 1860packets:1, bytes:14, used:0.001s, actions:userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
1dea1435 1861])
1862
1863AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1864NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1865vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1866NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1867vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1868])
1869
af7535e7
AZ
1870AT_CHECK([ovs-appctl revalidator/purge])
1871AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1872
1873dnl Add a controller meter.
d39ec23d 1874AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=controller pktps stats bands=type=drop rate=2'])
af7535e7
AZ
1875
1876dnl Advance time by 1 second.
1877AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1878
1879for i in `seq 1 8`; do
1880 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x4321)'])
1881done
1882
1883AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 1884flow-dump from the main thread:
74c4530d 1885packets:7, bytes:98, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=2,rule_cookie=0,controller_id=0,max_len=65535))))
af7535e7
AZ
1886])
1887
1888AT_CHECK([ovs-appctl time/warp 1], [0], [ignore])
1889OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1890
d39ec23d
JP
1891dnl Out of 8 packets we sent, two were passed by the rate limiter, and
1892dnl the rest of packets were blocked.
af7535e7
AZ
1893AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1894NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1895vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1896NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1897vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1898])
1899dnl Check meter stats to make it gives the same picture;
1900dnl 7 packets hit the meter, but 6 packets are dropped by band0.
bad98905 1901AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
af7535e7 1902OFPST_METER reply (OF1.3) (xid=0x2):
d39ec23d 1903meter:controller flow_count:0 packet_in_count:8 byte_in_count:112 duration:0.0s bands:
af7535e7
AZ
19040: packet_count:6 byte_count:84
1905])
1906
1dea1435 1907OVS_VSWITCHD_STOP
1908AT_CLEANUP
1909
349fbdc2
SH
1910AT_SETUP([ofproto-dpif - MPLS handling])
1911OVS_VSWITCHD_START([dnl
1912 add-port br0 p1 -- set Interface p1 type=dummy
1913])
53eb8cb8 1914on_exit 'kill `cat ovs-ofctl.pid`'
349fbdc2
SH
1915
1916AT_CAPTURE_FILE([ofctl_monitor.log])
1917AT_DATA([flows.txt], [dnl
1918cookie=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
1919cookie=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
1920cookie=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
1921cookie=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
1922cookie=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
1923cookie=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
1924cookie=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
1925cookie=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 1926cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
349fbdc2
SH
1927cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1928cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1929cookie=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
1930
1931cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1932cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1933cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1934cookie=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 1935cookie=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
1936cookie=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
1937cookie=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
1938
1939cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1940cookie=0xd table=1 arp actions=controller
1941
e672ff9b
JR
1942cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1943cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1ffd16af
SH
1944cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1945cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1946
1947cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1948cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1949cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1950
1951cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
e672ff9b
JR
1952cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1953cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1ffd16af 1954
e672ff9b
JR
1955cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1956cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1957cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 1958
e672ff9b
JR
1959cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1960cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1961cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 1962
e672ff9b
JR
1963cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1964cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1965cookie=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
1966])
1967AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1968
b02475c5 1969dnl Modified MPLS controller action.
9a403b07 1970AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1971
1972for i in 1 2 3; do
791a09be 1973 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 1974done
57c94f35 1975OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1976OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1977
b02475c5 1978AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379 1979NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
e6d9ab56 1980mpls,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 1981dnl
6f068379 1982NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
e6d9ab56 1983mpls,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 1984dnl
6f068379 1985NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
e6d9ab56 1986mpls,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
1987])
1988
1989dnl Modified MPLS controller action.
9a403b07 1990AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5 1991
b0a17866 1992for i in 1 2 3; do
8249a1fe 1993 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
1994done
1995OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1996OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b0a17866
SH
1997
1998AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 1999NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 2000ip,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 2001dnl
efe179e0 2002NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 2003ip,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 2004dnl
efe179e0 2005NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
e6d9ab56 2006ip,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
2007])
2008
2009dnl Modified MPLS controller action.
9a403b07 2010AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b0a17866 2011
b02475c5
SH
2012dnl 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)
2013
2014for i in 1 2 3; do
2015 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)'
2016done
bece9ea7 2017OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2018OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
bece9ea7 2019
b02475c5 2020AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2021NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2022mpls,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 2023dnl
efe179e0 2024NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2025mpls,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 2026dnl
efe179e0 2027NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2028mpls,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
2029])
2030
2031dnl Modified MPLS controller action.
9a403b07 2032AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2033
2034for i in 1 2 3; do
8249a1fe 2035 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 2036done
57c94f35 2037OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2038OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2039
b02475c5 2040AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2041NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 2042mpls,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 2043dnl
efe179e0 2044NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 2045mpls,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 2046dnl
efe179e0 2047NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
f0fb825a 2048mpls,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
2049])
2050
b676167a 2051dnl Modified MPLS controller action.
9a403b07 2052AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b676167a
SH
2053
2054for i in 1 2 3; do
8249a1fe 2055 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 2056done
57c94f35 2057OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2058OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b676167a 2059
b676167a 2060AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2061NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2062mpls,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 2063dnl
efe179e0 2064NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2065mpls,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 2066dnl
efe179e0 2067NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2068mpls,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
2069])
2070
0f3f3c3d 2071dnl Modified MPLS controller action.
9a403b07 2072AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
2073
2074for i in 1 2 3; do
8249a1fe 2075 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 2076done
57c94f35 2077OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2078OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 2079
0f3f3c3d 2080AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2081NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2082mpls,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 2083dnl
efe179e0 2084NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2085mpls,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 2086dnl
efe179e0 2087NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2088mpls,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
2089])
2090
2091dnl Modified MPLS controller action.
9a403b07 2092AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
2093
2094for i in 1 2 3; do
8249a1fe 2095 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 2096done
57c94f35 2097OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2098OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 2099
0f3f3c3d 2100AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2101NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2102mpls,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 2103dnl
efe179e0 2104NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2105mpls,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 2106dnl
efe179e0 2107NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2108mpls,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
2109])
2110
1ffd16af
SH
2111AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2112
2113dnl Modified MPLS controller action.
9a403b07 2114AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2115
2116for i in 1 2 3; do
2117 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)'
2118done
2119OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2120OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1ffd16af
SH
2121
2122AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2123NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2124mplsm,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 2125dnl
efe179e0 2126NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2127mplsm,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 2128dnl
efe179e0 2129NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 2130mplsm,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
2131])
2132
2133AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2134
0f3f3c3d 2135dnl Modified MPLS controller action.
9a403b07 2136AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
2137
2138for i in 1 2 3; do
8249a1fe 2139 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 2140done
57c94f35 2141OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2142OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 2143
0f3f3c3d 2144AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2145NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2146mpls,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 2147dnl
efe179e0 2148NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2149mpls,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 2150dnl
efe179e0 2151NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
e6d9ab56 2152mpls,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
2153])
2154
b02475c5 2155dnl Modified MPLS actions.
9a403b07 2156AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2157
2158for i in 1 2 3; do
02830175 2159 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 2160done
57c94f35 2161OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2162OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2163
b02475c5 2164AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2165NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 2166mpls,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 2167dnl
efe179e0 2168NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 2169mpls,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 2170dnl
efe179e0 2171NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
e6d9ab56 2172mpls,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
2173])
2174
2175dnl Modified MPLS ipv6 controller action.
9a403b07 2176AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2177
2178for i in 1 2 3; do
2179 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)'
2180done
57c94f35 2181OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2182OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2183
b02475c5 2184AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 2185NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2186mplsm,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 2187dnl
efe179e0 2188NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2189mplsm,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 2190dnl
efe179e0 2191NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2192mplsm,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
2193])
2194
2195
2196dnl Modified MPLS pop action.
cff78c88
SH
2197dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
2198dnl 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)
2199dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
2200
9a403b07 2201AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b02475c5
SH
2202
2203for i in 1 2 3; do
cff78c88 2204 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 2205done
cff78c88
SH
2206#for i in 2 3; do
2207# 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)'
2208#done
57c94f35 2209OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 2210OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 2211
b02475c5 2212AT_CHECK([cat ofctl_monitor.log], [0], [dnl
cff78c88 2213NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2214tcp,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 2215dnl
cff78c88 2216NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2217tcp,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 2218dnl
cff78c88 2219NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2220tcp,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
2221])
2222
5c0243a9 2223AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
0d56eaf2 2224
1ffd16af
SH
2225dnl Modified MPLS pop action.
2226dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2227dnl 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)
2228dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2229dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2230AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2231
2232for i in 1 2 3; do
2233 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'
2234done
2235OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2236OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2237
2be3fe44 2238AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2239NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2240tcp,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 2241dnl
e672ff9b 2242NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2243tcp,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 2244dnl
e672ff9b 2245NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2246tcp,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
2247])
2248
2249AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2250
2251dnl Modified MPLS pop action.
2252dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2253dnl 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)
2254dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2255dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2256AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2257
2258for i in 1 2 3; do
2259 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'
2260done
2261OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2262OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2263
2be3fe44 2264AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2265NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2266tcp,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 2267dnl
e672ff9b 2268NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2269tcp,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 2270dnl
e672ff9b 2271NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2272tcp,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
2273])
2274
2275AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2276
2277dnl Modified MPLS pop action.
2278dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2279dnl 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)
2280dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2281dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2282AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2283
2284for i in 1 2 3; do
2285 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'
2286done
2287OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2288OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2289
2be3fe44 2290AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2291NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2292tcp,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 2293dnl
e672ff9b 2294NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2295tcp,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 2296dnl
e672ff9b 2297NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2298tcp,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
2299])
2300
2301AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2302
2303dnl Modified MPLS pop action.
2304dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2305dnl 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)
2306dnl (tos 0x0, ttl 255, 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 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2308AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --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 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'
2312done
2313OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2314OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2315
2be3fe44 2316AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2317NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2318tcp,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 2319dnl
e672ff9b 2320NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2321tcp,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 2322dnl
e672ff9b 2323NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2324tcp,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
2325])
2326
2327AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2328
2329dnl Modified MPLS pop action.
2330dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2331dnl 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)
2332dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2333dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2334AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2335
2336for i in 1 2 3; do
2337 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'
2338done
2339OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2340OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2341
2be3fe44 2342AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2343NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2344tcp,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 2345dnl
e672ff9b 2346NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2347tcp,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 2348dnl
e672ff9b 2349NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 2350tcp,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
2351])
2352
2353AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2354
2355dnl Modified MPLS pop action.
2356dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2357dnl 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)
2358dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2359dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2360AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2361
2362for i in 1 2 3; do
2363 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'
2364done
2365OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2366OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2367
2be3fe44 2368AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2369NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
c9c8c8a1 2370tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2371dnl
e672ff9b 2372NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
c9c8c8a1 2373tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2374dnl
e672ff9b 2375NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
c9c8c8a1 2376tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
2377])
2378
2379AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2380
2381dnl Modified MPLS pop action.
2382dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2383dnl 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)
2384dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2385dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2386AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2387
2388for i in 1 2 3; do
2389 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'
2390done
2391OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2392OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2393
2be3fe44 2394AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2395NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2396tcp,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 2397dnl
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: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 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: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
2403])
2404
2405AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2406
2407dnl Modified MPLS pop action.
2408dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2409dnl 60:66:66:66:00:08 > ff:ff:ff:ff:ff:ff, ethertype MPLS unicast (0x8847), length 46: MPLS (label 20, exp 0, [S], ttl 32)
9a403b07 2410AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2411
2412for i in 1 2 3; do
2413 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'
2414done
2415OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2416OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2417
2be3fe44 2418AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
efe179e0 2419NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2420arp,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 2421dnl
efe179e0 2422NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2423arp,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 2424dnl
efe179e0 2425NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
e6d9ab56 2426arp,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
2427])
2428
2429AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2430
2431dnl Modified MPLS pop action.
2432dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2433dnl 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)
2434dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2435dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2436AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2437
2438for i in 1 2 3; do
2439 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'
2440done
2441OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2442OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2443
2be3fe44 2444AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2445NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2446tcp,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 2447dnl
e672ff9b 2448NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2449tcp,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 2450dnl
e672ff9b 2451NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2452tcp,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
2453])
2454
2455AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2456
2457dnl Modified MPLS pop action.
2458dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2459dnl 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)
2460dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2461dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2462AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2463
2464for i in 1 2 3; do
2465 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'
2466done
2467OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2468OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2469
2be3fe44 2470AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2471NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2472tcp,vlan_tci=0x0000,dl_src=60:66:66:66: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 2473dnl
e672ff9b 2474NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2475tcp,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 2476dnl
e672ff9b 2477NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2478tcp,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
2479])
2480
2481AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2482
2483dnl Modified MPLS pop action.
2484dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2485dnl 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)
2486dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2487dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2488AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2489
2490for i in 1 2 3; do
2491 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'
2492done
2493OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2494OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2495
2be3fe44 2496AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2497NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2498tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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 2499dnl
e672ff9b 2500NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2501tcp,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 2502dnl
e672ff9b 2503NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2504tcp,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
2505])
2506
2507AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2508
2509dnl Modified MPLS pop action.
2510dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2511dnl 60:66:66:66:01:00 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
5a0e4aec
BP
2512dnl (label 20, exp 0, [S], ttl 31)
2513dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2514dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2515AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2516
2517for i in 1 2 3; do
2518 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'
2519done
2520OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2521OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2522
2523AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2524NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2525mplsm,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
2526dnl
2527NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2528mplsm,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
2529dnl
2530NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2531mplsm,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
2532])
2533
2534AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2535
2536dnl Modified MPLS pop action.
2537dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2538dnl 60:66:66:66:01:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
5a0e4aec
BP
2539dnl (label 20, exp 0, [S], ttl 31)
2540dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2541dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2542AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2543
2544for i in 1 2 3; do
2545 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'
2546done
2547OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2548OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2549
2550AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2551NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2552mpls,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 2553dnl
e672ff9b 2554NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2555mpls,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 2556dnl
e672ff9b 2557NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2558mpls,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
2559])
2560
2561AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2562
2563dnl Modified MPLS pop action.
2564dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2565dnl 60:66:66:66:01:02 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
5a0e4aec
BP
2566dnl (label 20, exp 0, [S], ttl 31)
2567dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2568dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2569AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2570
2571for i in 1 2 3; do
2572 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'
2573done
2574OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2575OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2576
2577AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2578NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2579mplsm,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
2580dnl
2581NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2582mplsm,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
2583dnl
2584NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2585mplsm,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
2586])
2587
2588AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2589
2590dnl Modified MPLS pop action.
2591dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2592dnl 60:66:66:66:02:00 > 50:54:00:00:02:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
5a0e4aec
BP
2593dnl (label 20, exp 0, [S], ttl 31)
2594dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2595dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2596AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2597
2598for i in 1 2 3; do
2599 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'
2600done
2601OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2602OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2603
2604AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2605NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2606tcp,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 2607dnl
e672ff9b 2608NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2609tcp,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 2610dnl
e672ff9b 2611NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2612tcp,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
2613])
2614
2615AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2616
2617dnl Modified MPLS pop action.
2618dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2619dnl 60:66:66:66:02:01 > 50:54:00:00:02:01, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
5a0e4aec
BP
2620dnl (label 20, exp 0, [S], ttl 31)
2621dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2622dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2623AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2624
2625for i in 1 2 3; do
2626 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'
2627done
e672ff9b 2628
1ffd16af
SH
2629OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2630OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2631
2be3fe44 2632AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2633NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2634tcp,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 2635dnl
e672ff9b 2636NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2637tcp,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 2638dnl
e672ff9b 2639NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2640tcp,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
2641])
2642
2643AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2644
2645dnl Modified MPLS pop action.
2646dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2647dnl 60:66:66:66:02:10 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
5a0e4aec
BP
2648dnl (label 20, exp 0, [S], ttl 31)
2649dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2650dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2651AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2652
2653for i in 1 2 3; do
2654 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 02 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'
2655done
2656OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2657OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2658
2be3fe44 2659AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2660NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2661tcp,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 2662dnl
e672ff9b 2663NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2664tcp,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 2665dnl
e672ff9b 2666NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2667tcp,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
2668])
2669
2670AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2671
2672dnl Modified MPLS pop action.
2673dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2674dnl 60:66:66:66:03:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
5a0e4aec
BP
2675dnl (label 20, exp 0, ttl 31)
2676dnl (label 20, exp 0, [S], ttl 30)
2677dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2678dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2679AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2680
2681for i in 1 2 3; do
2682 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 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'
2683done
2684OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2685OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2686
2687AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2688NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2689mplsm,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 2690dnl
e672ff9b 2691NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2692mplsm,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 2693dnl
e672ff9b 2694NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2695mplsm,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
2696])
2697
2698AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2699
2700dnl Modified MPLS pop action.
2701dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2702dnl 60:66:66:66:03:01 > 50:54:00:00:00:00, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
5a0e4aec
BP
2703dnl (label 20, exp 0, ttl 31)
2704dnl (label 20, exp 0, [S], ttl 30)
2705dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2706dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2707AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2708
2709for i in 1 2 3; do
2710 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 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'
2711done
2712OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2713OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2714
2715AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2716NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2717mpls,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 2718dnl
e672ff9b 2719NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2720mpls,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 2721dnl
e672ff9b 2722NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2723mpls,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
2724])
2725
2726AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2727
2728dnl Modified MPLS pop action.
2729dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2730dnl 60:66:66:66:03:10 > 50:54:00:00:00:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
5a0e4aec
BP
2731dnl (label 20, exp 0, ttl 31)
2732dnl (label 20, exp 0, [S], ttl 30)
2733dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1ffd16af 2734dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
9a403b07 2735AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2736
2737for i in 1 2 3; do
2738 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 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'
2739done
2740OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2741OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2742
2743AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2744NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2745mplsm,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 2746dnl
e672ff9b 2747NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2748mplsm,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 2749dnl
e672ff9b 2750NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2751mplsm,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
2752])
2753
2754AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2755
2756dnl Modified MPLS pop action.
2757dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2758dnl 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)
2759dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2760dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2761AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2762
2763for i in 1 2 3; do
2764 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'
2765done
2766OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2767OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2768
2be3fe44 2769AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2770NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2771mpls,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 2772dnl
e672ff9b 2773NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2774mpls,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 2775dnl
e672ff9b 2776NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2777mpls,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
2778])
2779
2780AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2781
2782dnl Modified MPLS pop action.
2783dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2784dnl 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)
2785dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2786dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2787AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2788
2789for i in 1 2 3; do
2790 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'
2791done
2792OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2793OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2794
2be3fe44 2795AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2796NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2797mplsm,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 2798dnl
e672ff9b 2799NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2800mplsm,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 2801dnl
e672ff9b 2802NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2803mplsm,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
2804])
2805
2806AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2807
2808dnl Modified MPLS pop action.
2809dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2810dnl 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)
2811dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2812dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2813AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2814
2815for i in 1 2 3; do
2816 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'
2817done
2818OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2819OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2820
2be3fe44 2821AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2822NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2823mplsm,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 2824dnl
e672ff9b 2825NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2826mplsm,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 2827dnl
e672ff9b 2828NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2829mplsm,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
2830])
2831
2832AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2833
2834dnl Modified MPLS pop action.
2835dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2836dnl 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)
2837dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2838dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2839AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2840
2841for i in 1 2 3; do
2842 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'
2843done
e672ff9b 2844
1ffd16af
SH
2845OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2846OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2847
2848AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2849NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2850mpls,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 2851dnl
e672ff9b 2852NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2853mpls,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 2854dnl
e672ff9b 2855NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2856mpls,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
2857])
2858
2859AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2860
2861dnl Modified MPLS pop action.
2862dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2863dnl 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)
2864dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2865dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2866AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2867
2868for i in 1 2 3; do
2869 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'
2870done
2871OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2872OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2873
2874AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2875NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2876mplsm,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 2877dnl
e672ff9b 2878NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2879mplsm,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 2880dnl
e672ff9b 2881NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2882mplsm,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
2883])
2884
2885AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2886
2887dnl Modified MPLS pop action.
2888dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2889dnl 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)
2890dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2891dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2892AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2893
2894for i in 1 2 3; do
2895 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'
2896done
e672ff9b 2897
1ffd16af
SH
2898OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2899OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2900
2901AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2902NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2903mpls,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 2904dnl
e672ff9b 2905NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2906mpls,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 2907dnl
e672ff9b 2908NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2909mpls,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
2910])
2911
cea4a6d7 2912AT_CHECK([ovs-appctl revalidator/purge], [0])
ef0ce8ae 2913AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
e672ff9b
JR
2914 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
2915 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
2916 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
2917 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
2918 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
2919 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
2920 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
2921 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
2922 cookie=0xa, n_packets=3, n_bytes=114, dl_src=40:44:44:44:44:44 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
6f068379 2923 cookie=0xa, n_packets=3, n_bytes=318, dl_src=40:44:44:44:44:42 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
efe179e0
DDP
2924 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
2925 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
2926 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
2927 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
2928 cookie=0xd, n_packets=3, n_bytes=138, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
c2d936a4 2929 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
2930 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
2931 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
2932 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 2933 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
2934 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
2935 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 2936 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
1ffd16af
SH
2937 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
2938 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 2939 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
1ffd16af
SH
2940 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2941 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
2942 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
2943 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 2944 cookie=0xd, table=1, n_packets=3, n_bytes=126, arp actions=CONTROLLER:65535
e672ff9b
JR
2945 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
2946 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
2947 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
2948 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
2949 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
2950 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
2951 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
2952 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
2953 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 2954NXST_FLOW reply:
15056dc8
EJ
2955])
2956
2957OVS_VSWITCHD_STOP
8e9ce036 2958AT_CLEANUP
04c956fc 2959
1ffd16af
SH
2960AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2961OVS_VSWITCHD_START([dnl
2962 add-port br0 p1 -- set Interface p1 type=dummy
2963])
53eb8cb8 2964on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
2965
2966AT_CAPTURE_FILE([ofctl_monitor.log])
2967AT_DATA([flows.txt], [dnl
2968table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2969table=1 ip,ip_dscp=8 actions=controller
2970])
2971AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2972
2973
2974dnl Modified MPLS pop action.
2975dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2976dnl 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)
2977dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2978dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 2979AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2980
2981for i in 1 2 3; do
2982 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'
2983done
2984OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2985OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2986
2be3fe44 2987AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1ffd16af 2988OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2989tcp,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
2990dnl
2991OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2992tcp,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
2993dnl
2994OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2995tcp,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
2996])
2997
cea4a6d7 2998AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
2999AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3000 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
3001 table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
3002OFPST_FLOW reply (OF1.2):
3003])
3004
3005OVS_VSWITCHD_STOP
3006AT_CLEANUP
3007
3008AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
3009OVS_VSWITCHD_START([dnl
3010 add-port br0 p1 -- set Interface p1 type=dummy
3011])
53eb8cb8 3012on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
3013
3014dnl N.B: The first (and only) action that accesses L3 data after the
3015dnl pop_mpls action is present in write_actions. This exercises recirculation
3016dnl triggered in write_actions due to a previous action not in write actions.
3017AT_CAPTURE_FILE([ofctl_monitor.log])
3018AT_DATA([flows.txt], [dnl
3019mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
3020])
3021AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
3022
3023dnl Modified MPLS pop action.
3024dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3025dnl 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)
3026dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3027dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
9a403b07 3028AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
3029
3030for i in 1 2 3; do
3031 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'
3032done
3033OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3034OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3035
2be3fe44 3036AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 3037OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3038tcp,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 3039dnl
e672ff9b 3040OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3041tcp,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 3042dnl
e672ff9b 3043OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 3044tcp,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
3045])
3046
cea4a6d7 3047AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
3048AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3049 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
3050OFPST_FLOW reply (OF1.2):
3051])
3052
3053OVS_VSWITCHD_STOP
3054AT_CLEANUP
527ae97e
SH
3055
3056AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
3057OVS_VSWITCHD_START([dnl
3058 add-port br0 p1 -- set Interface p1 type=dummy
3059])
53eb8cb8 3060on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
3061
3062AT_CAPTURE_FILE([ofctl_monitor.log])
3063# A table-miss flow has priority 0 and no match
3064AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3065
3066dnl Singleton controller action.
6409e008 3067AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
3068
3069for i in 1 2 3 ; do
3070 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)'
3071done
3072OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3073OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
527ae97e
SH
3074
3075AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3076OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3077tcp,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 3078dnl
efe179e0 3079OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3080tcp,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 3081dnl
efe179e0 3082OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3083tcp,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
3084])
3085
cea4a6d7 3086AT_CHECK([ovs-appctl revalidator/purge], [0])
527ae97e 3087AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3088 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
527ae97e
SH
3089NXST_FLOW reply:
3090])
3091
3092OVS_VSWITCHD_STOP
3093AT_CLEANUP
3094
3095
3096AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
3097OVS_VSWITCHD_START([dnl
3098 add-port br0 p1 -- set Interface p1 type=dummy
3099])
53eb8cb8 3100on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
3101
3102AT_CAPTURE_FILE([ofctl_monitor.log])
3103# A table-miss flow has priority 0 and no match
3104AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3105
3106dnl Singleton controller action.
6409e008 3107AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
3108
3109for i in 1 2 3 ; do
3110 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)'
3111done
3112OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3113OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
527ae97e
SH
3114
3115AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3116
3117AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3118OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3119tcp,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 3120dnl
efe179e0 3121OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3122tcp,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 3123dnl
efe179e0 3124OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3125tcp,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
3126])
3127
cea4a6d7 3128AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a 3129AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3130 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
ba96552a
SS
3131OFPST_FLOW reply (OF1.3):
3132])
3133
3134OVS_VSWITCHD_STOP
3135AT_CLEANUP
3136
3137AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
3138OVS_VSWITCHD_START([dnl
3139 add-port br0 p1 -- set Interface p1 type=dummy
3140])
53eb8cb8 3141on_exit 'kill `cat ovs-ofctl.pid`'
ba96552a 3142
5b7278a1
JS
3143ovs-appctl time/stop
3144
ba96552a
SS
3145AT_CAPTURE_FILE([ofctl_monitor.log])
3146# A table-miss flow has priority 0 and no match
3147AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3148
3149dnl Singleton controller action.
6409e008 3150AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
ba96552a
SS
3151
3152# Become slave (OF 1.3), which should disable everything except port status.
3153ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3154
5b7278a1
JS
3155# Ensure that ovs-vswitchd gets a chance to reply before sending another command.
3156ovs-appctl time/warp 500 100
3157
ba96552a
SS
3158# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
3159ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
3160
5b7278a1 3161ovs-appctl time/warp 500 100
ba96552a
SS
3162for i in 1 2 3 ; do
3163 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)'
3164done
3165OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3166OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
ba96552a 3167
cea4a6d7 3168AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a
SS
3169AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3170send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
3171OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
3172dnl
3173send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
3174 master:
3175 PACKET_IN: (off)
3176 PORT_STATUS: (off)
3177 FLOW_REMOVED: (off)
904e5202
BP
3178 ROLE_STATUS: (off)
3179 TABLE_STATUS: (off)
3180 REQUESTFORWARD: (off)
ba96552a
SS
3181
3182 slave:
3183 PACKET_IN: no_match
3184 PORT_STATUS: (off)
3185 FLOW_REMOVED: (off)
904e5202
BP
3186 ROLE_STATUS: (off)
3187 TABLE_STATUS: (off)
3188 REQUESTFORWARD: (off)
ba96552a 3189dnl
efe179e0 3190OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3191tcp,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 3192dnl
efe179e0 3193OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3194tcp,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 3195dnl
efe179e0 3196OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3197tcp,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
3198])
3199
3200AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3201
3202AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3203 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
527ae97e
SH
3204OFPST_FLOW reply (OF1.3):
3205])
3206
3207OVS_VSWITCHD_STOP
3208AT_CLEANUP
3209
807c7989
SS
3210
3211AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
3212OVS_VSWITCHD_START([dnl
3213 add-port br0 p1 -- set Interface p1 type=dummy
3214])
53eb8cb8 3215on_exit 'kill `cat ovs-ofctl.pid`'
807c7989
SS
3216
3217AT_CAPTURE_FILE([ofctl_monitor.log])
3218# A table-miss flow has priority 0 and no match
3219AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3220
3221dnl Singleton controller action.
6409e008 3222AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
807c7989
SS
3223
3224for i in 1 2 3 ; do
3225 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)'
3226done
3227OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 3228OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
807c7989 3229
cea4a6d7 3230AT_CHECK([ovs-appctl revalidator/purge], [0])
807c7989 3231AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3232OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3233tcp,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 3234dnl
efe179e0 3235OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3236tcp,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 3237dnl
efe179e0 3238OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
e839d01e 3239tcp,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
3240])
3241
3242AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3243
3244AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 3245 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
807c7989
SS
3246OFPST_FLOW reply (OF1.4):
3247])
3248
3249OVS_VSWITCHD_STOP
3250AT_CLEANUP
3251
3252
029ca940 3253AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3a11fd5b
SS
3254OVS_VSWITCHD_START([dnl
3255 add-port br0 p1 -- set Interface p1 type=dummy
3256])
53eb8cb8 3257on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
3258
3259AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
3260AT_DATA([flows.txt], [dnl
3261table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3262table=1 actions=output(CONTROLLER),goto_table(2)
3263table=2 actions=group:1234
3264])
3a11fd5b 3265AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 3266AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3a11fd5b
SS
3267
3268dnl Singleton controller action.
6409e008 3269AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
3270
3271for i in 1 2 3 ; do
3272 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)'
3273done
331c07ac
YHW
3274AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3275OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
d9c8c57c 3276OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3a11fd5b
SS
3277
3278AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3279
3280AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3281OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3282tcp,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 3283dnl
efe179e0 3284OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3285tcp,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 3286dnl
efe179e0 3287OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3288tcp,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 3289dnl
efe179e0 3290OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3291tcp,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 3292dnl
efe179e0 3293OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3294tcp,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 3295dnl
efe179e0 3296OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3297tcp,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 3298dnl
efe179e0 3299OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3300tcp,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 3301dnl
efe179e0 3302OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3303tcp,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 3304dnl
efe179e0 3305OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3306tcp,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
3307dnl
3308OFPT_PACKET_IN (OF1.3) (xid=0x0): total_len=54 in_port=ANY (via action) data_len=54 (unbuffered)
3309tcp,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
3310])
3311
3312AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3313
3314AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
3315 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3316 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3317 table=2, n_packets=3, n_bytes=162, actions=group:1234
3a11fd5b
SS
3318OFPST_FLOW reply (OF1.3):
3319])
3320
3321OVS_VSWITCHD_STOP
3322AT_CLEANUP
3323
3324
029ca940 3325AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3a11fd5b
SS
3326OVS_VSWITCHD_START([dnl
3327 add-port br0 p1 -- set Interface p1 type=dummy
3328])
53eb8cb8 3329on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
3330
3331AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
3332AT_DATA([flows.txt], [dnl
3333table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3334table=1 actions=output(CONTROLLER),goto_table(2)
3335table=2 actions=group:1234
3336])
3a11fd5b 3337AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 3338AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3a11fd5b
SS
3339
3340dnl Singleton controller action.
6409e008 3341AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
3342
3343for i in 1 2 3 ; do
3344 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)'
3345done
331c07ac
YHW
3346AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3347OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
d9c8c57c 3348OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3a11fd5b
SS
3349
3350AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3351
3352AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 3353OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3354tcp,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 3355dnl
efe179e0 3356OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3357tcp,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 3358dnl
efe179e0 3359OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3360tcp,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 3361dnl
efe179e0 3362OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3363tcp,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 3364dnl
efe179e0 3365OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3366tcp,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 3367dnl
efe179e0 3368OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3369tcp,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 3370dnl
efe179e0 3371OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
e839d01e 3372tcp,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 3373dnl
efe179e0 3374OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
e839d01e 3375tcp,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 3376dnl
efe179e0 3377OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
e839d01e 3378tcp,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
3379dnl
3380OFPT_PACKET_IN (OF1.4) (xid=0x0): total_len=54 in_port=ANY (via packet_out) data_len=54 (unbuffered)
3381tcp,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
3382])
3383
3384AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3385
3386AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
3387 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3388 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3389 table=2, n_packets=3, n_bytes=162, actions=group:1234
3a11fd5b
SS
3390OFPST_FLOW reply (OF1.4):
3391])
3392
3393OVS_VSWITCHD_STOP
3394AT_CLEANUP
3395
f5634764
KG
3396AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3397
3398OVS_VSWITCHD_START([dnl
3399 set bridge br0 datapath_type=dummy \
3400 protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
3401 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
3402
3403AT_CHECK([
3404 ovs-ofctl -OOpenFlow13 del-flows br0
3405 ovs-ofctl -OOpenFlow13 add-group br0 "group_id=6000,type=all,bucket=actions=controller,bucket=actions=resubmit(,48),bucket=actions=resubmit(,81)"
3406 ovs-ofctl -OOpenFlow13 add-flow br0 "table=0, in_port=1, vlan_tci=0x0000/0x1fff actions=write_metadata:0x67870000000000/0xffffff0000000001,goto_table:17"
3407 ovs-ofctl -OOpenFlow13 add-flow br0 "table=17, priority=10,metadata=0x67870000000000/0xffffff0000000000 actions=write_metadata:0xe067870000000000/0xfffffffffffffffe,goto_table:60"
3408 ovs-ofctl -OOpenFlow13 add-flow br0 "table=60, priority=0 actions=resubmit(,17)"
3409 ovs-ofctl -OOpenFlow13 add-flow br0 "table=17, priority=10,metadata=0xe067870000000000/0xffffff0000000000 actions=write_metadata:0x67871d4d000000/0xfffffffffffffffe,goto_table:43"
3410 ovs-ofctl -OOpenFlow13 add-flow br0 "table=43, priority=100,icmp actions=group:6000"
3411 ovs-ofctl -OOpenFlow13 add-flow br0 "table=48, priority=0 actions=resubmit(,49),resubmit(,50)"
3412 ovs-ofctl -OOpenFlow13 add-flow br0 "table=50, priority=0 actions=controller"
3413], [0], [ignore])
3414
3415AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3416
3417AT_CHECK([
3418 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
3419], [0], [ignore])
3420
3421OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
3422OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3423
3424AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3425OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=43 cookie=0x0 total_len=98 metadata=0x67871d4d000000,in_port=1 (via action) data_len=98 (unbuffered)
3426icmp,vlan_tci=0x0000,dl_src=3a:6d:d2:09:9c:ab,dl_dst=1e:2c:e9:2a:66:9e,nw_src=192.168.10.10,nw_dst=192.168.10.30,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:6f20
3427dnl
3428OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=50 cookie=0x0 total_len=98 metadata=0x67871d4d000000,in_port=1 (via no_match) data_len=98 (unbuffered)
3429icmp,vlan_tci=0x0000,dl_src=3a:6d:d2:09:9c:ab,dl_dst=1e:2c:e9:2a:66:9e,nw_src=192.168.10.10,nw_dst=192.168.10.30,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:6f20
3430])
3431
3432OVS_VSWITCHD_STOP
3433AT_CLEANUP
029ca940 3434
f6c8a6b1
BP
3435AT_SETUP([ofproto-dpif - ARP modification slow-path])
3436OVS_VSWITCHD_START
ca5792f0 3437add_of_ports br0 1 2
f6c8a6b1
BP
3438
3439ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3440ovs-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'
3441
3442# Input some packets that should follow the arp modification slow-path.
3443for i in 1 2 3; do
3444 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)'
3445done
3446AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3447
3448# Check the packets that were output.
3449AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
78c9486d
JR
3450arp,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
3451arp,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
3452arp,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
3453arp,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
3454arp,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
3455arp,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
3456arp,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
3457arp,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
3458arp,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
3459])
3460
f6c8a6b1
BP
3461OVS_VSWITCHD_STOP
3462AT_CLEANUP
3463
ecac4ebf 3464AT_SETUP([ofproto-dpif - VLAN handling])
04c956fc 3465OVS_VSWITCHD_START(
023e1e0a
BP
3466 [set Bridge br0 fail-mode=standalone -- \
3467 add-port br0 p1 trunks=10,12 -- \
ecac4ebf 3468 add-port br0 p2 tag=10 -- \
5e9ceccd 3469 add-port br0 p3 tag=12 \
88f52d7f 3470 other-config:priority-tags=if-nonzero -- \
ecac4ebf
BP
3471 add-port br0 p4 tag=12 -- \
3472 add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
3473 add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
3474 add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
5e9ceccd 3475 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
88f52d7f 3476 other-config:priority-tags=if-nonzero -- \
fed8962a
EG
3477 add-port br0 p9 vlan_mode=dot1q-tunnel tag=10 other-config:qinq-ethtype=802.1q -- \
3478 add-port br0 p10 vlan_mode=dot1q-tunnel tag=10 cvlans=10,12 other-config:qinq-ethtype=802.1q -- \
3479 add-port br0 p11 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q -- \
3480 add-port br0 p12 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q \
88f52d7f 3481 other-config:priority-tags=if-nonzero -- \
ecac4ebf
BP
3482 set Interface p1 type=dummy -- \
3483 set Interface p2 type=dummy -- \
3484 set Interface p3 type=dummy -- \
3485 set Interface p4 type=dummy -- \
3486 set Interface p5 type=dummy -- \
3487 set Interface p6 type=dummy -- \
3488 set Interface p7 type=dummy -- \
fed8962a
EG
3489 set Interface p8 type=dummy -- \
3490 set Interface p9 type=dummy -- \
3491 set Interface p10 type=dummy -- \
3492 set Interface p11 type=dummy -- \
3493 set Interface p12 type=dummy --])
04c956fc 3494
247527db
BP
3495dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3496dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
ecac4ebf 3497dnl actions.
04c956fc 3498for tuple in \
e44768b7
JP
3499 "100 none 0 drop" \
3500 "100 0 0 drop" \
3501 "100 0 1 drop" \
fed8962a
EG
3502 "100 10 0 1,5,6,7,8,pop_vlan,2,9" \
3503 "100 10 1 1,5,6,7,8,pop_vlan,2,9" \
e44768b7
JP
3504 "100 11 0 5,7" \
3505 "100 11 1 5,7" \
fed8962a
EG
3506 "100 12 0 1,5,6,pop_vlan,3,4,7,8,11,12" \
3507 "100 12 1 1,5,6,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
247527db
BP
3508 "1 none 0 drop" \
3509 "1 0 0 drop" \
3510 "1 0 1 drop" \
fed8962a
EG
3511 "1 10 0 5,6,7,8,100,pop_vlan,2,9" \
3512 "1 10 1 5,6,7,8,100,pop_vlan,2,9" \
247527db
BP
3513 "1 11 0 drop" \
3514 "1 11 1 drop" \
fed8962a
EG
3515 "1 12 0 5,6,100,pop_vlan,3,4,7,8,11,12" \
3516 "1 12 1 5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3517 "2 none 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3518 "2 0 0 pop_vlan,9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3519 "2 0 1 pop_vlan,9,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
247527db
BP
3520 "2 10 0 drop" \
3521 "2 10 1 drop" \
3522 "2 11 0 drop" \
3523 "2 11 1 drop" \
3524 "2 12 0 drop" \
3525 "2 12 1 drop" \
fed8962a
EG
3526 "3 none 0 4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3527 "3 0 0 pop_vlan,4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3528 "3 0 1 8,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
247527db
BP
3529 "3 10 0 drop" \
3530 "3 10 1 drop" \
3531 "3 11 0 drop" \
3532 "3 11 1 drop" \
3533 "3 12 0 drop" \
3534 "3 12 1 drop" \
fed8962a
EG
3535 "4 none 0 3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3536 "4 0 0 pop_vlan,3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3537 "4 0 1 3,8,12,pop_vlan,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
247527db
BP
3538 "4 10 0 drop" \
3539 "4 10 1 drop" \
3540 "4 11 0 drop" \
3541 "4 11 1 drop" \
3542 "4 12 0 drop" \
3543 "4 12 1 drop" \
fed8962a
EG
3544 "5 none 0 2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3545 "5 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3546 "5 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3547 "5 10 0 1,6,7,8,100,pop_vlan,2,9" \
3548 "5 10 1 1,6,7,8,100,pop_vlan,2,9" \
e44768b7
JP
3549 "5 11 0 7,100" \
3550 "5 11 1 7,100" \
fed8962a
EG
3551 "5 12 0 1,6,100,pop_vlan,3,4,7,8,11,12" \
3552 "5 12 1 1,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3553 "6 none 0 2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3554 "6 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3555 "6 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3556 "6 10 0 1,5,7,8,100,pop_vlan,2,9" \
3557 "6 10 1 1,5,7,8,100,pop_vlan,2,9" \
247527db
BP
3558 "6 11 0 drop" \
3559 "6 11 1 drop" \
fed8962a
EG
3560 "6 12 0 1,5,100,pop_vlan,3,4,7,8,11,12" \
3561 "6 12 1 1,5,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3562 "7 none 0 3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3563 "7 0 0 pop_vlan,3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3564 "7 0 1 3,8,12,pop_vlan,4,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3565 "7 10 0 1,5,6,8,100,pop_vlan,2,9" \
3566 "7 10 1 1,5,6,8,100,pop_vlan,2,9" \
e44768b7
JP
3567 "7 11 0 5,100" \
3568 "7 11 1 5,100" \
fed8962a
EG
3569 "7 12 0 1,5,6,100,pop_vlan,3,4,8,11,12" \
3570 "7 12 1 1,5,6,100,pop_vlan,4,11,push_vlan(vid=0,pcp=1),3,8,12" \
3571 "8 none 0 3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3572 "8 0 0 pop_vlan,3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3573 "8 0 1 3,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3574 "8 10 0 1,5,6,7,100,pop_vlan,2,9" \
3575 "8 10 1 1,5,6,7,100,pop_vlan,2,9" \
247527db
BP
3576 "8 11 0 drop" \
3577 "8 11 1 drop" \
fed8962a
EG
3578 "8 12 0 1,5,6,100,pop_vlan,3,4,7,11,12" \
3579 "8 12 1 1,5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,12" \
3580 "9 none 0 2,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3581 "9 10 0 10,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3582 "9 11 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3583 "10 none 0 drop" \
3584 "10 0 0 drop" \
3585 "10 11 0 drop" \
3586 "10 12 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3587 "11 10 0 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3588 "11 10 1 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100"
04c956fc
BP
3589do
3590 set $tuple
3591 in_port=$1
3592 vlan=$2
ecac4ebf
BP
3593 pcp=$3
3594 expected=$4
04c956fc
BP
3595
3596 if test $vlan = none; then
247527db 3597 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
04c956fc 3598 else
247527db 3599 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
3600 fi
3601
395e68ce
BP
3602 echo "----------------------------------------------------------------------"
3603 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3604
50aa28fd 3605 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
ecac4ebf 3606 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
04c956fc 3607
247527db 3608 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
becffb86 3609 mv stdout expout
247527db 3610 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
04c956fc
BP
3611done
3612
3613OVS_VSWITCHD_STOP
3614AT_CLEANUP
7257b535 3615
f0fb825a
EG
3616AT_SETUP([ofproto-dpif - VLAN depth limit])
3617OVS_VSWITCHD_START([dnl
3618 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3619 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
3620 add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3
3621])
3622
3623AT_DATA([flows.txt], [dnl
3624table=0 in_port=1,eth_type=0x8100,vlan_tci=0x0010/0x01ff actions=output:2
3625table=0 in_port=1,eth_type=0xabcd,vlan_tci=0x0010/0x01ff actions=output:3
3626])
3627AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3628flow="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), \
3629 encap(eth_type(0x8100),vlan(vid=17,pcp=0),encap(eth_type(0xabcd)))"
3630
3631AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3632AT_CHECK([tail -1 stdout], [0],
3633 [Datapath actions: 2
3634])
3635
3636AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3637AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3638AT_CHECK([tail -1 stdout], [0],
3639 [Datapath actions: 3
3640])
3641
3642OVS_VSWITCHD_STOP
3643AT_CLEANUP
3644
3645AT_SETUP([ofproto-dpif - Multi-VLAN actions])
3646OVS_VSWITCHD_START([dnl
3647 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3648 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2
3649])
3650AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3651
3652AT_DATA([flows.txt], [dnl
3653table=0 in_port=1,vlan_tci=0x1100/0x1fff actions=pop_vlan,output:2
3654table=0 in_port=1,vlan_tci=0x1101/0x1fff actions=push_vlan:0x8100,set_field:0x1201/0x1fff->vlan_tci,output:2
3655table=0 in_port=1,vlan_tci=0x1102/0x1fff actions=push_vlan:0x88a8,set_field:0x1202/0x1fff->vlan_tci,output:2
3656table=0 in_port=1,vlan_tci=0x1103/0x1fff actions=set_field:0x1203/0x1fff->vlan_tci,output:2
3657table=0 in_port=1,vlan_tci=0x1104/0x1fff actions=pop_vlan,goto_table:1
3658table=1 vlan_tci=0 actions=output:2
3659table=1 vlan_tci=0x1300/0x1fff actions=pop_vlan,output:2
3660table=1 vlan_tci=0x1301/0x1fff actions=push_vlan:0x88a8,set_field:0x1401/0x1fff->vlan_tci,output:2
3661table=1 vlan_tci=0x1302/0x1fff actions=set_field:0x1402/0x1fff->vlan_tci,output:2
3662])
3663
3664AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3665
3666check_act() {
3667 psd_hdr="in_port(1),eth(src=00:11:22:33:44:55,dst=00:22:44:66:88:00),"
3668 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$psd_hdr$1"], [0], [stdout])
3669 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $2
3670])
3671}
3672
3673check_act "eth_type(0x8100),vlan(vid=0x0100,pcp=0),encap(eth_type(0xabcd))" \
3674 "pop_vlan,2"
3675
3676check_act "eth_type(0x8100),vlan(vid=0x0101,pcp=0),encap(eth_type(0xabcd))" \
3677 "push_vlan(vid=513,pcp=0),2"
3678
3679check_act "eth_type(0x8100),vlan(vid=0x0102,pcp=0),encap(eth_type(0xabcd))" \
3680 "push_vlan(tpid=0x88a8,vid=514,pcp=0),2"
3681
3682check_act "eth_type(0x8100),vlan(vid=0x0103,pcp=0),encap(eth_type(0xabcd))" \
3683 "pop_vlan,push_vlan(vid=515,pcp=0),2"
3684
3685check_act "eth_type(0x8100),vlan(vid=0x0104,pcp=0),encap(eth_type(0xabcd))" \
3686 "pop_vlan,2"
3687
3688check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3689vlan(vid=0x0300,pcp=0),encap(eth_type(0xabcd)))" "pop_vlan,pop_vlan,2"
3690
3691check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3692vlan(vid=0x0301,pcp=0),encap(eth_type(0xabcd)))" \
3693 "pop_vlan,push_vlan(tpid=0x88a8,vid=1025,pcp=0),2"
3694
3695check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3696vlan(vid=0x0302,pcp=0),encap(eth_type(0xabcd)))" \
3697 "pop_vlan,pop_vlan,push_vlan(vid=1026,pcp=0),2"
3698
3699OVS_VSWITCHD_STOP
3700AT_CLEANUP
3701
56879058
JS
3702AT_SETUP([ofproto-dpif - MPLS handling])
3703OVS_VSWITCHD_START([dnl
3704 add-port br0 p1 -- set Interface p1 type=dummy
3705])
53eb8cb8 3706on_exit 'kill `cat ovs-ofctl.pid`'
56879058
JS
3707
3708AT_CAPTURE_FILE([ofctl_monitor.log])
3709AT_DATA([flows.txt], [dnl
3710dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
63636ee8 3711dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
0c1625e8 3712dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
56879058
JS
3713])
3714AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3715
3716dnl In this test, we push an MPLS tag to an ethernet packet.
9a403b07 3717AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
56879058
JS
3718
3719for i in 1 2 3; do
3720 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)'
3721done
62022172 3722OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3723OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
56879058 3724
38b0b29f 3725AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 3726OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
e6d9ab56 3727mpls,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 372800000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
6f068379 372900000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
56879058 373000000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
6f068379
BP
373100000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
373200000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
373300000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
373400000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
373500000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3736OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
e6d9ab56 3737mpls,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 373800000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
6f068379 373900000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
56879058 374000000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
6f068379
BP
374100000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
374200000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
374300000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
374400000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
374500000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3746OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
e6d9ab56 3747mpls,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 374800000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
6f068379 374900000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
56879058 375000000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
6f068379
BP
375100000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
375200000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
375300000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
375400000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
375500000070 36 37 38 39 3a 3b 3c 3d-3e 3f
56879058
JS
3756])
3757
63636ee8
JS
3758dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3759dnl copied exactly, except for the BOS bit.
9a403b07 3760AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
63636ee8
JS
3761
3762for i in 1 2 3; do
3763 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)'
3764done
62022172 3765OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3766OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
63636ee8 3767
38b0b29f 3768AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3769OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3770mpls,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 377100000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 377200000010 a0 40 00 00 a1 40
63636ee8 3773dnl
efe179e0 3774OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3775mpls,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 377600000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 377700000010 a0 40 00 00 a1 40
63636ee8 3778dnl
efe179e0 3779OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3780mpls,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 378100000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
efe179e0 378200000010 a0 40 00 00 a1 40
0c1625e8
SH
3783])
3784
3785dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3786dnl copied exactly, except for the BOS bit. The ethertype should be updated
3787dnl to the MPLS ethertype of the MPLS push action which differs to that
3788dnl of the input packet.
9a403b07 3789AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
0c1625e8
SH
3790
3791for i in 1 2 3; do
3792 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)'
3793done
62022172 3794OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
d9c8c57c 3795OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
0c1625e8 3796
38b0b29f 3797AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
efe179e0 3798OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3799mplsm,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 380000000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 380100000010 a0 40 00 00 a1 40
0c1625e8 3802dnl
efe179e0 3803OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3804mplsm,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 380500000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 380600000010 a0 40 00 00 a1 40
0c1625e8 3807dnl
efe179e0 3808OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
e6d9ab56 3809mplsm,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 381000000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
efe179e0 381100000010 a0 40 00 00 a1 40
63636ee8
JS
3812])
3813
56879058
JS
3814OVS_VSWITCHD_STOP
3815AT_CLEANUP
3816
846e159a
SH
3817AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3818OVS_VSWITCHD_START([dnl
3819 add-port br0 p1 -- set Interface p1 type=dummy
3820])
53eb8cb8 3821on_exit 'kill `cat ovs-ofctl.pid`'
846e159a
SH
3822
3823AT_CAPTURE_FILE([ofctl_monitor.log])
3824AT_DATA([flows.txt], [dnl
3825cookie=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
3826cookie=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
3827cookie=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
3828cookie=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
3829cookie=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
3830cookie=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
3831cookie=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
3832cookie=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
3833cookie=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
3834cookie=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
3835])
3836AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3837
3838dnl Modified MPLS controller action.
3839dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3840dnl both of these in the final flow
9a403b07 3841AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
3842
3843for i in 1 2 3; do
3844 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)'
3845done
62022172 3846OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3847OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3848
38b0b29f 3849AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 3850OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3851mpls,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 385200000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
6f068379
BP
385300000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
385400000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
385500000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
385600000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
385700000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
385800000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
385900000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3860OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3861mpls,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 386200000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
6f068379
BP
386300000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
386400000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
386500000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
386600000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
386700000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
386800000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
386900000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3870OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3871mpls,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 387200000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
6f068379
BP
387300000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
387400000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
387500000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
387600000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
387700000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
387800000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
387900000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
3880])
3881
3882dnl Modified MPLS controller action.
f0fb825a
EG
3883dnl In this test, the input packet is vlan-tagged, which should be kept as
3884dnl inner vlan.
9a403b07 3885AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
3886
3887for i in 1 2 3; do
3888 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))'
3889done
62022172 3890OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3891OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3892
38b0b29f 3893AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 3894OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 3895mpls,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 389600000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
6f068379
BP
389700000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
389800000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
389900000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
390000000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
390100000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
390200000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
390300000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
390400000080 3e 3f
3905OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 3906mpls,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 390700000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
6f068379
BP
390800000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
390900000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
391000000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
391100000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
391200000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
391300000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
391400000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
391500000080 3e 3f
3916OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 3917mpls,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 391800000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
6f068379
BP
391900000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
392000000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
392100000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
392200000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
392300000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
392400000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
392500000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
392600000080 3e 3f
846e159a
SH
3927])
3928
3929dnl Modified MPLS controller action.
3930dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3931dnl both of these in the final flow
9a403b07 3932AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
3933
3934for i in 1 2 3; do
3935 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)'
3936done
62022172 3937OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3938OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3939
38b0b29f 3940AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 3941OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3942mpls,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 394300000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
6f068379
BP
394400000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
394500000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
394600000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
394700000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
394800000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
394900000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
395000000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3951OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3952mpls,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 395300000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
6f068379
BP
395400000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
395500000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
395600000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
395700000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
395800000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
395900000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
396000000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3961OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 3962mpls,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 396300000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
6f068379
BP
396400000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
396500000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
396600000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
396700000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
396800000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
396900000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
397000000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
3971])
3972
3973dnl Modified MPLS controller action.
f0fb825a
EG
3974dnl In this test, the input packet is vlan-tagged, which should be kept as
3975dnl inner vlan.
9a403b07 3976AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
3977
3978for i in 1 2 3; do
3979 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))'
3980done
62022172 3981OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3982OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3983
38b0b29f 3984AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 3985OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 3986mpls,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 398700000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
6f068379
BP
398800000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
398900000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
399000000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
399100000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
399200000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
399300000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
399400000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
399500000080 3e 3f
3996OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 3997mpls,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 399800000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
6f068379
BP
399900000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
400000000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
400100000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
400200000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
400300000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
400400000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
400500000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
400600000080 3e 3f
4007OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4008mpls,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 400900000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
6f068379
BP
401000000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
401100000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
401200000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
401300000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
401400000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
401500000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
401600000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
401700000080 3e 3f
846e159a
SH
4018])
4019
4020dnl Modified MPLS controller action.
4021dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
4022dnl actions are reordered, so we see both of these in the final flow.
9a403b07 4023AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4024
4025for i in 1 2 3; do
4026 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)'
4027done
62022172 4028OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4029OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4030
38b0b29f 4031AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4032OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4033mpls,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 403400000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
6f068379
BP
403500000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
403600000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
403700000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
403800000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
403900000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
404000000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
404100000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4042OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4043mpls,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 404400000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
6f068379
BP
404500000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
404600000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
404700000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
404800000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
404900000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
405000000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
405100000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4052OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4053mpls,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 405400000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
6f068379
BP
405500000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
405600000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
405700000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
405800000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
405900000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
406000000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
406100000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4062])
4063
4064dnl Modified MPLS controller action.
f0fb825a
EG
4065dnl In this test, the input packet is vlan-tagged, which should be kept as
4066dnl inner vlan.
9a403b07 4067AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4068
4069for i in 1 2 3; do
4070 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))'
4071done
62022172 4072OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
28ae2f37 4073OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 4074
38b0b29f 4075AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4076OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4077mpls,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 407800000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
6f068379
BP
407900000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
408000000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
408100000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
408200000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
408300000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
408400000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
408500000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
408600000080 3e 3f
4087OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4088mpls,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 408900000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
6f068379
BP
409000000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
409100000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
409200000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
409300000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
409400000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
409500000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
409600000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
409700000080 3e 3f
4098OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4099mpls,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 410000000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
6f068379
BP
410100000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
410200000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
410300000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
410400000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
410500000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
410600000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
410700000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
410800000080 3e 3f
846e159a
SH
4109])
4110
4111dnl Modified MPLS controller action.
4112dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
4113dnl actions are reordered, so we see both of these in the final flow.
9a403b07 4114AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4115
4116for i in 1 2 3; do
4117 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)'
4118done
62022172 4119OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4120OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4121
38b0b29f 4122AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4123OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4124mpls,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 412500000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
6f068379
BP
412600000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
412700000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
412800000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
412900000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
413000000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
413100000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
413200000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4133OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4134mpls,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 413500000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
6f068379
BP
413600000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
413700000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
413800000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
413900000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
414000000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
414100000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
414200000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4143OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4144mpls,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 414500000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
6f068379
BP
414600000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
414700000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
414800000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
414900000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
415000000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
415100000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
415200000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4153])
4154
4155dnl Modified MPLS controller action.
f0fb825a
EG
4156dnl In this test, the input packet is vlan-tagged, which should be kept as
4157dnl inner vlan.
9a403b07 4158AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4159
4160for i in 1 2 3; do
4161 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))'
4162done
62022172 4163OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4164OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4165
38b0b29f 4166AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4167OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4168mpls,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 416900000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
6f068379
BP
417000000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
417100000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
417200000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
417300000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
417400000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
417500000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
417600000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
417700000080 3e 3f
4178OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4179mpls,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 418000000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
6f068379
BP
418100000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
418200000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
418300000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
418400000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
418500000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
418600000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
418700000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
418800000080 3e 3f
4189OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
f0fb825a 4190mpls,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 419100000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
6f068379
BP
419200000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
419300000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
419400000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
419500000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
419600000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
419700000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
419800000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
419900000080 3e 3f
846e159a
SH
4200])
4201
4202dnl Modified MPLS controller action.
f0fb825a
EG
4203dnl In this test, the input packet is vlan-tagged, which should be kept as
4204dnl inner vlan.
9a403b07 4205AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4206
4207for i in 1 2 3; do
4208 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))'
4209done
62022172 4210OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 4211OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 4212
38b0b29f 4213AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4214OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4215mpls,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 421600000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
6f068379
BP
421700000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
421800000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
421900000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
422000000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
422100000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
422200000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
422300000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4224OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4225mpls,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 422600000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
6f068379
BP
422700000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
422800000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
422900000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
423000000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
423100000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
423200000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
423300000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4234OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4235mpls,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 423600000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
6f068379
BP
423700000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
423800000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
423900000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
424000000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
424100000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
424200000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
424300000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4244])
4245
4246dnl Modified MPLS controller action.
4dc94d7e 4247dnl In this test, the input packet is vlan-tagged, which should be modified
846e159a 4248dnl before we push MPLS and VLAN tags.
9a403b07 4249AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846e159a
SH
4250
4251for i in 1 2 3; do
4252 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))'
4253done
62022172 4254OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
d9c8c57c 4255OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 4256
38b0b29f 4257AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
6f068379 4258OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4259mpls,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 426000000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
6f068379
BP
426100000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
426200000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
426300000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
426400000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
426500000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
426600000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
426700000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4268OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4269mpls,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 427000000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
6f068379
BP
427100000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
427200000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
427300000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
427400000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
427500000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
427600000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
427700000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4278OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
f0fb825a 4279mpls,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 428000000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
6f068379
BP
428100000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
428200000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
428300000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
428400000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
428500000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
428600000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
428700000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
846e159a
SH
4288])
4289
cea4a6d7 4290AT_CHECK([ovs-appctl revalidator/purge], [0])
846e159a 4291AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379
BP
4292 cookie=0xa, n_packets=3, n_bytes=354, dl_src=40:44:44:44:54:50 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,CONTROLLER:65535
4293 cookie=0xa, n_packets=3, n_bytes=354, dl_src=40:44:44:44:54:52 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,CONTROLLER:65535
4294 cookie=0xa, n_packets=3, n_bytes=354, dl_src=40:44:44:44:54:54 actions=push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
4295 cookie=0xa, n_packets=3, n_bytes=354, dl_src=40:44:44:44:54:56 actions=push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
4296 cookie=0xa, n_packets=3, n_bytes=366, dl_src=40:44:44:44:54:51 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,CONTROLLER:65535
4297 cookie=0xa, n_packets=3, n_bytes=366, dl_src=40:44:44:44:54:53 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,CONTROLLER:65535
4298 cookie=0xa, n_packets=3, n_bytes=366, dl_src=40:44:44:44:54:55 actions=push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
4299 cookie=0xa, n_packets=3, n_bytes=366, dl_src=40:44:44:44:54:57 actions=push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
4300 cookie=0xa, n_packets=3, n_bytes=366, vlan_tci=0x1000/0x1000,dl_src=40:44:44:44:54:58 actions=load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
4301 cookie=0xa, n_packets=3, n_bytes=366, vlan_tci=0x1000/0x1000,dl_src=40:44:44:44:54:59 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],set_field:1->vlan_pcp,load:0x63->OXM_OF_VLAN_VID[[]],CONTROLLER:65535
846e159a
SH
4302OFPST_FLOW reply (OF1.2):
4303])
4304
4305OVS_VSWITCHD_STOP
4306AT_CLEANUP
4307
b8778a0d 4308AT_SETUP([ofproto-dpif - fragment handling - trace])
023e1e0a 4309OVS_VSWITCHD_START
ca5792f0 4310add_of_ports br0 1 2 3 4 5 6 90
7257b535 4311AT_DATA([flows.txt], [dnl
586ebdec
BP
4312priority=75 tcp nw_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
4313priority=75 tcp nw_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
4314priority=50 tcp nw_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
4315priority=50 tcp nw_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
4316priority=50 tcp nw_frag=later actions=output:6
7257b535
BP
4317])
4318AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4319
a61680c6 4320base_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
4321no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4322first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4323later_flow="$base_flow,frag=later)"
4324
4325 # mode no first later
4326for tuple in \
4327 'normal 1 5 6' \
4328 'drop 1 drop drop' \
4329 'nx-match 1 2 6'
4330do
4331 set $tuple
4332 mode=$1
4333 no=$2
4334 first=$3
4335 later=$4
4336
4337 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4338 for type in no first later; do
4339 eval flow=\$${type}_flow exp_output=\$$type
7fd51d39 4340 printf "\n%s\n" "----$mode $type-----"
50aa28fd 4341 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
7fd51d39
BP
4342 : > expout
4343 if test $mode = drop && test $type != no; then
2d9b49dd 4344 echo ' 0. Packets are IP fragments and the fragment handling mode is "drop".' >> expout
12e4681c 4345 echo "Datapath actions: $exp_output" >> expout
b8778a0d 4346 elif test $type = later; then
12e4681c
JR
4347 echo "Datapath actions: $exp_output" >> expout
4348 else
dbf4a928 4349 echo "Datapath actions: set(tcp(src=80)),$exp_output" >> expout
7fd51d39 4350 fi
7fd51d39 4351 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
7257b535
BP
4352 done
4353done
023e1e0a 4354OVS_VSWITCHD_STOP
7257b535 4355AT_CLEANUP
848e8809 4356
b8778a0d
JR
4357AT_SETUP([ofproto-dpif - fragment handling - upcall])
4358OVS_VSWITCHD_START
ca5792f0 4359add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
4360AT_DATA([flows.txt], [dnl
4361priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
4362priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
4363priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
4364priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
4365priority=50 tcp ip_frag=later actions=output:6
4366])
4367AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4368
4369base_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"
4370no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4371first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4372later_flow="$base_flow,frag=later)"
4373
4374AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4375
4376mode=normal
4377
4378AT_CHECK([ovs-ofctl set-frags br0 $mode])
4379for type in no first later; do
4380 eval flow=\$${type}_flow
4381 printf "\n%s\n" "----$mode $type-----"
4382
4383 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4384done
4385
4386AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
138d30a9 4387flow-dump from the main thread:
3d4b2e6e
JS
4388recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4389recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),5
4390recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
b8778a0d
JR
4391])
4392
4393mode=drop
4394
98bb4286 4395AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4396AT_CHECK([ovs-ofctl set-frags br0 $mode])
4397for type in no first later; do
4398 eval flow=\$${type}_flow
4399 printf "\n%s\n" "----$mode $type-----"
4400
4401 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4402done
4403
4404AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
138d30a9 4405flow-dump from the main thread:
3d4b2e6e
JS
4406recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4407recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
4408recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
b8778a0d
JR
4409])
4410
4411mode=nx-match
4412
98bb4286 4413AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4414AT_CHECK([ovs-ofctl set-frags br0 $mode])
4415for type in no first later; do
4416 eval flow=\$${type}_flow
4417 printf "\n%s\n" "----$mode $type-----"
4418
4419 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4420done
4421
4422AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
138d30a9 4423flow-dump from the main thread:
3d4b2e6e
JS
4424recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4425recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),2
4426recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
b8778a0d
JR
4427])
4428
4429OVS_VSWITCHD_STOP
4430AT_CLEANUP
4431
4432AT_SETUP([ofproto-dpif - fragment handling - actions])
4433OVS_VSWITCHD_START
ca5792f0 4434add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
4435
4436AT_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])
4437AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4438source field tcp_dst lacks correct prerequisites
4439ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4440])
4441
4442AT_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])
4443AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4444destination field tcp_src lacks correct prerequisites
4445ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4446])
4447
4448AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
4449AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4450set_field udp_src lacks correct prerequisites
b8778a0d
JR
4451ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4452])
4453
4454AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
4455AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4456set_field udp_dst lacks correct prerequisites
b8778a0d
JR
4457ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4458])
4459
4460AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
4461AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4462set_field sctp_src lacks correct prerequisites
b8778a0d
JR
4463ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4464])
4465
4466AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
4467AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
5bcd4754 4468set_field sctp_dst lacks correct prerequisites
b8778a0d
JR
4469ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4470])
4471
4472AT_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])
4473AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4474source field tcp_dst lacks correct prerequisites
4475ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4476])
4477
4478AT_DATA([flows.txt], [dnl
4479priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
4480])
4481AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
4482
4483AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4484
4485mode=normal
4486
4487AT_CHECK([ovs-ofctl set-frags br0 $mode])
4488for frag in 4000 6000 6008 4010; do
4489 printf "\n%s\n" "----$mode $frag-----"
4490
4491 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"])
4492done
4493
4d182934
JS
4494dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
4495dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
4496dnl OVS-2.5, the wildcards and set_field mask are shared internally.
b8778a0d 4497AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 4498flow-dump from the main thread:
3d4b2e6e
JS
4499recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4500recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4501recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
b8778a0d
JR
4502])
4503
98bb4286 4504AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4505AT_CHECK([ovs-ofctl set-frags br0 $mode])
4506for frag in 4000 6000 6008 4010; do
4507 printf "\n%s\n" "----$mode $frag truncated transport header -----"
4508
4509 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
4510done
4511
4512AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 4513flow-dump from the main thread:
3d4b2e6e
JS
4514recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4515recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4516recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:38, used:0.001s, actions:1
b8778a0d
JR
4517])
4518
98bb4286 4519AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
4520AT_CHECK([ovs-ofctl set-frags br0 $mode])
4521for frag in 4000 6000 6001 4002; do
4522 printf "\n%s\n" "----$mode $frag missing transport header-----"
4523
4524 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
4525done
4526
4527AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 4528flow-dump from the main thread:
3d4b2e6e
JS
4529recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4530recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4531recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:34, used:0.001s, actions:1
b8778a0d
JR
4532])
4533
4534OVS_VSWITCHD_STOP
4535AT_CLEANUP
4536
848e8809
EJ
4537AT_SETUP([ofproto-dpif - exit])
4538OVS_VSWITCHD_START
ca5792f0 4539add_of_ports br0 1 2 3 10 11 12 13 14
848e8809
EJ
4540AT_DATA([flows.txt], [dnl
4541in_port=1 actions=output:10,exit,output:11
4542in_port=2 actions=output:12,resubmit:1,output:12
4543in_port=3 actions=output:13,resubmit:2,output:14
4544])
4545AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 4546AT_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
4547AT_CHECK([tail -1 stdout], [0],
4548 [Datapath actions: 10
4549])
50aa28fd 4550AT_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
4551AT_CHECK([tail -1 stdout], [0],
4552 [Datapath actions: 12,10
4553])
50aa28fd 4554AT_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
4555AT_CHECK([tail -1 stdout], [0],
4556 [Datapath actions: 13,12,10
4557])
4558OVS_VSWITCHD_STOP
4559AT_CLEANUP
c06bba01
JP
4560
4561
4562AT_SETUP([ofproto-dpif - mirroring, select_all])
2d5c1a20 4563AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4564OVS_VSWITCHD_START
ca5792f0 4565add_of_ports br0 1 2 3
432fca23 4566ovs-vsctl \
c06bba01
JP
4567 set Bridge br0 mirrors=@m --\
4568 --id=@p3 get Port p3 --\
432fca23 4569 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 4570
c06bba01
JP
4571AT_DATA([flows.txt], [dnl
4572in_port=1 actions=output:2
4573in_port=2 actions=output:1
4574])
4575AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4576
247527db 4577flow="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 4578AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4579AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4580 [Datapath actions: 3,2
c06bba01
JP
4581])
4582
247527db 4583flow="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 4584AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4585AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4586 [Datapath actions: 3,1
c06bba01
JP
4587])
4588
4589OVS_VSWITCHD_STOP
4590AT_CLEANUP
4591
4592
4593AT_SETUP([ofproto-dpif - mirroring, select_src])
2d5c1a20 4594AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4595OVS_VSWITCHD_START
ca5792f0 4596add_of_ports br0 1 2 3
432fca23 4597ovs-vsctl \
c06bba01
JP
4598 set Bridge br0 mirrors=@m --\
4599 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
432fca23 4600 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
c06bba01 4601
c06bba01
JP
4602AT_DATA([flows.txt], [dnl
4603in_port=1 actions=output:2
4604in_port=2 actions=output:1
4605])
4606AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4607
247527db 4608flow="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 4609AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4610AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4611 [Datapath actions: 3,2
c06bba01
JP
4612])
4613
247527db 4614flow="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 4615AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4616AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4617 [Datapath actions: 1
c06bba01
JP
4618])
4619OVS_VSWITCHD_STOP
4620AT_CLEANUP
4621
33158a18 4622AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
2d5c1a20 4623AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4624OVS_VSWITCHD_START
ca5792f0 4625add_of_ports br0 1 2
432fca23 4626ovs-vsctl \
33158a18
JP
4627 set Bridge br0 mirrors=@m --\
4628 --id=@p2 get Port p2 --\
432fca23 4629 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
33158a18 4630
33158a18
JP
4631AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4632
4633# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 4634flow="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
4635AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4636AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4637 [Datapath actions: 1,2
33158a18
JP
4638])
4639
4640OVS_VSWITCHD_STOP
4641AT_CLEANUP
4642
c06bba01
JP
4643
4644AT_SETUP([ofproto-dpif - mirroring, select_dst])
2d5c1a20 4645AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4646OVS_VSWITCHD_START
ca5792f0 4647add_of_ports br0 1 2 3
432fca23 4648ovs-vsctl \
c06bba01
JP
4649 set Bridge br0 mirrors=@m --\
4650 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4651 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
c06bba01 4652
c06bba01
JP
4653AT_DATA([flows.txt], [dnl
4654in_port=1 actions=output:2
4655in_port=2 actions=output:1
4656])
4657AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4658
247527db 4659flow="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 4660AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4661AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4662 [Datapath actions: 2,3
c06bba01
JP
4663])
4664
247527db 4665flow="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 4666AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4667AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4668 [Datapath actions: 1
c06bba01
JP
4669])
4670
4671OVS_VSWITCHD_STOP
4672AT_CLEANUP
4673
4674
4675AT_SETUP([ofproto-dpif - mirroring, select_vlan])
2d5c1a20 4676AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4677OVS_VSWITCHD_START
ca5792f0 4678add_of_ports br0 1 2 3
432fca23 4679ovs-vsctl \
c06bba01
JP
4680 set Bridge br0 mirrors=@m --\
4681 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4682 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
c06bba01 4683
c06bba01
JP
4684AT_DATA([flows.txt], [dnl
4685in_port=1, actions=output:2
4686])
4687AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4688
247527db 4689flow="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 4690AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4691AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4692 [Datapath actions: 2
c06bba01
JP
4693])
4694
247527db 4695flow="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 4696AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4697AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4698 [Datapath actions: 2
c06bba01
JP
4699])
4700
247527db 4701flow="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 4702AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4703AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4704 [Datapath actions: 3,2
c06bba01
JP
4705])
4706
4707OVS_VSWITCHD_STOP
4708AT_CLEANUP
4709
4710
4711AT_SETUP([ofproto-dpif - mirroring, output_port])
2d5c1a20 4712AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4713OVS_VSWITCHD_START
ca5792f0 4714add_of_ports br0 1 2 3
432fca23 4715ovs-vsctl \
c06bba01
JP
4716 set Bridge br0 mirrors=@m --\
4717 --id=@p3 get Port p3 --\
432fca23 4718 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 4719
c06bba01
JP
4720AT_DATA([flows.txt], [dnl
4721in_port=1 actions=mod_vlan_vid:17,output:2
4722in_port=2 actions=output:1
4723])
4724AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4725
247527db 4726flow="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 4727AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4728AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4729 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
c06bba01
JP
4730])
4731
247527db 4732flow="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 4733AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4734AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4735 [Datapath actions: 3,1
c06bba01
JP
4736])
4737
4738OVS_VSWITCHD_STOP
4739AT_CLEANUP
4740
c06bba01 4741AT_SETUP([ofproto-dpif - mirroring, output_vlan])
2d5c1a20 4742AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4743OVS_VSWITCHD_START
ca5792f0 4744add_of_ports br0 1 2
432fca23 4745ovs-vsctl \
c06bba01 4746 set Bridge br0 mirrors=@m --\
432fca23 4747 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
c06bba01 4748
c06bba01
JP
4749AT_DATA([flows.txt], [dnl
4750in_port=1 actions=output:2
4751in_port=2 actions=mod_vlan_vid:17,output:1
4752])
4753AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4754
247527db 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)"
50aa28fd 4756AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
4757actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4758
e44768b7 4759expected="2,push_vlan(vid=12,pcp=0),1,2,100"
247527db 4760AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 4761mv stdout expout
247527db 4762AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01 4763
247527db 4764flow="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 4765AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
4766actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4767
e44768b7 4768expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
247527db 4769AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 4770mv stdout expout
247527db 4771AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01
JP
4772
4773OVS_VSWITCHD_STOP
4774AT_CLEANUP
b44a10b7 4775
faa624b4
BP
4776# This verifies that we don't get duplicate mirroring when mirror_packet()
4777# might be invoked recursively, as a check against regression.
4778AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
2d5c1a20 4779AT_KEYWORDS([mirror mirrors mirroring])
faa624b4
BP
4780OVS_VSWITCHD_START
4781add_of_ports br0 1 2 3
4782ovs-vsctl \
4783 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
5a0e4aec
BP
4784 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
4785 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
4786 -- set Port br0 tag=0 \
4787 -- set Port p1 tag=0 \
4788 -- set Port p2 tag=500 \
4789 -- set Port p3 tag=501
faa624b4
BP
4790
4791flow='in_port=1'
4792AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4793AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4794s/,/\
4795/g' | sort], [0], [100
47962
47973
4798])
4799
4800OVS_VSWITCHD_STOP
4801AT_CLEANUP
4802
29bae541
BP
4803# This test verifies that mirror state is preserved across recirculation.
4804#
4805# Otherwise, post-recirculation the ingress and the output to port 4
4806# would cause the packet to be mirrored to port 3 a second time.
4807AT_SETUP([ofproto-dpif - mirroring with recirculation])
2d5c1a20 4808AT_KEYWORDS([mirror mirrors mirroring])
29bae541 4809OVS_VSWITCHD_START
ca5792f0 4810add_of_ports br0 1 2 3 4
29bae541
BP
4811ovs-vsctl \
4812 set Bridge br0 mirrors=@m --\
4813 --id=@p3 get Port p3 --\
4814 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4815
4816AT_DATA([flows.txt], [dnl
4817in_port=1 actions=2,debug_recirc,4
4818])
4819AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4820
4821flow="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)"
4822AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4823AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4824])
4825AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4826AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4827])
4828
4829OVS_VSWITCHD_STOP
4830AT_CLEANUP
4831
1356dbd1
WT
4832# Tests below verify the snaplen support for mirroring
4833AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen])
4834AT_KEYWORDS([mirror mirrors mirroring])
4835OVS_VSWITCHD_START
4836add_of_ports br0 1 2 3
4837ovs-vsctl \
4838 set Bridge br0 mirrors=@m --\
4839 --id=@p3 get Port p3 --\
4840 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4841
4842AT_DATA([flows.txt], [dnl
4843in_port=1 actions=output:2
4844in_port=2 actions=output:1
4845])
4846AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4847
4848flow="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)"
4849AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4850AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4851 [Datapath actions: trunc(100),3,2
4852])
4853
4854flow="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)"
4855AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4856AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4857 [Datapath actions: trunc(100),3,1
4858])
4859
4860OVS_VSWITCHD_STOP
4861AT_CLEANUP
4862
091d64c4
ZG
4863AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen and reset snaplen])
4864AT_KEYWORDS([mirror mirrors mirroring])
4865OVS_VSWITCHD_START
4866add_of_ports br0 1 2 3
4867ovs-vsctl \
4868 set Bridge br0 mirrors=@m --\
4869 --id=@p3 get Port p3 --\
4870 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4871
4872AT_DATA([flows.txt], [dnl
4873in_port=1 actions=output:2
4874in_port=2 actions=output:1
4875])
4876AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4877
4878flow="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)"
4879AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4880AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4881 [Datapath actions: trunc(100),3,2
4882])
4883
4884ovs-vsctl set mirror mymirror snaplen=77
4885
4886flow="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)"
4887AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4888AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4889 [Datapath actions: trunc(77),3,1
4890])
4891
4892ovs-vsctl set mirror mymirror snaplen=65535
4893
4894flow="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)"
4895AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4896AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4897 [Datapath actions: 3,1
4898])
4899
4900OVS_VSWITCHD_STOP
4901AT_CLEANUP
4902
1356dbd1
WT
4903AT_SETUP([ofproto-dpif - mirroring, select_src with snaplen])
4904AT_KEYWORDS([mirror mirrors mirroring])
4905OVS_VSWITCHD_START
4906add_of_ports br0 1 2 3
4907ovs-vsctl \
4908 set Bridge br0 mirrors=@m --\
4909 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4910 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3 snaplen=100
4911
4912AT_DATA([flows.txt], [dnl
4913in_port=1 actions=output:2
4914in_port=2 actions=output:1
4915])
4916AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4917
4918flow="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)"
4919AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4920AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4921 [Datapath actions: trunc(100),3,2
4922])
4923
4924flow="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)"
4925AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4926AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4927 [Datapath actions: 1
4928])
4929OVS_VSWITCHD_STOP
4930AT_CLEANUP
4931
4932AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port with snaplen])
4933AT_KEYWORDS([mirror mirrors mirroring])
4934OVS_VSWITCHD_START
4935add_of_ports br0 1 2
4936ovs-vsctl \
4937 set Bridge br0 mirrors=@m --\
4938 --id=@p2 get Port p2 --\
4939 --id=@m create Mirror name=mymirror select_all=true output_port=@p2 snaplen=100
4940
4941AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4942
4943# "in_port" defaults to OFPP_NONE if it's not specified.
4944flow="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"
4945AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4946AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4947 [Datapath actions: 1,trunc(100),2
4948])
4949
4950OVS_VSWITCHD_STOP
4951AT_CLEANUP
4952
4953AT_SETUP([ofproto-dpif - mirroring, select_dst with snaplen])
4954AT_KEYWORDS([mirror mirrors mirroring])
4955OVS_VSWITCHD_START
4956add_of_ports br0 1 2 3
4957ovs-vsctl \
4958 set Bridge br0 mirrors=@m --\
4959 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4960 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3 snaplen=100
4961
4962AT_DATA([flows.txt], [dnl
4963in_port=1 actions=output:2
4964in_port=2 actions=output:1
4965])
4966AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4967
4968flow="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)"
4969AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4970AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4971 [Datapath actions: 2,trunc(100),3
4972])
4973
4974flow="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)"
4975AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4976AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4977 [Datapath actions: 1
4978])
4979
4980OVS_VSWITCHD_STOP
4981AT_CLEANUP
4982
4983AT_SETUP([ofproto-dpif - mirroring, select_vlan with snaplen])
4984AT_KEYWORDS([mirror mirrors mirroring])
4985OVS_VSWITCHD_START
4986add_of_ports br0 1 2 3
4987ovs-vsctl \
4988 set Bridge br0 mirrors=@m --\
4989 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4990 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3 snaplen=100
4991
4992AT_DATA([flows.txt], [dnl
4993in_port=1, actions=output:2
4994])
4995AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4996
4997flow="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)"
4998AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4999AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5000 [Datapath actions: 2
5001])
5002
5003flow="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))"
5004AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5005AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5006 [Datapath actions: 2
5007])
5008
5009flow="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))"
5010AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5011AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5012 [Datapath actions: trunc(100),3,2
5013])
5014
5015OVS_VSWITCHD_STOP
5016AT_CLEANUP
5017
5018AT_SETUP([ofproto-dpif - mirroring, output_port with snaplen])
5019AT_KEYWORDS([mirror mirrors mirroring])
5020OVS_VSWITCHD_START
5021add_of_ports br0 1 2 3
5022ovs-vsctl \
5023 set Bridge br0 mirrors=@m --\
5024 --id=@p3 get Port p3 --\
5025 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
5026
5027AT_DATA([flows.txt], [dnl
5028in_port=1 actions=mod_vlan_vid:17,output:2
5029in_port=2 actions=output:1
5030])
5031AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5032
5033flow="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)"
5034AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5035AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5036 [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2
5037])
5038
5039flow="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)"
5040AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5041AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5042 [Datapath actions: trunc(100),3,1
5043])
5044
5045OVS_VSWITCHD_STOP
5046AT_CLEANUP
5047
5048AT_SETUP([ofproto-dpif - mirroring, output_vlan with snaplen])
5049AT_KEYWORDS([mirror mirrors mirroring])
5050OVS_VSWITCHD_START
5051add_of_ports br0 1 2
5052ovs-vsctl \
5053 set Bridge br0 mirrors=@m --\
5054 --id=@m create Mirror name=mymirror select_all=true output_vlan=12 snaplen=100
5055
5056AT_DATA([flows.txt], [dnl
5057in_port=1 actions=output:2
5058in_port=2 actions=mod_vlan_vid:17,output:1
5059])
5060AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5061
5062flow="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)"
5063AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5064actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5065dnl Expect: "trunc(100),100,trunc(100),2,trunc(100),1", with different order
5066AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
5067
5068flow="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)"
5069AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5070actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5071AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
5072
5073OVS_VSWITCHD_STOP
5074AT_CLEANUP
5075
5076AT_SETUP([ofproto-dpif - multiple VLAN output mirrors with snaplen])
5077AT_KEYWORDS([mirror mirrors mirroring])
5078OVS_VSWITCHD_START
5079add_of_ports br0 1 2 3
5080ovs-vsctl \
5081 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
5082 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 snaplen=200 \
5083 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 snaplen=300 \
5084 -- set Port br0 tag=0 \
5085 -- set Port p1 tag=0 \
5086 -- set Port p2 tag=500 \
5087 -- set Port p3 tag=501
5088
5089flow="in_port=1"
5090AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
5091AT_CHECK([tail -1 stdout | egrep "trunc\(200\),2,trunc\(300\),3,100|trunc\(300\),3,trunc\(200\),2,100"], [0], [stdout])
5092
5093OVS_VSWITCHD_STOP
5094AT_CLEANUP
5095
83a31283
BP
5096# This test verifies that the table ID is preserved across recirculation
5097# when a resubmit action requires it (because the action is relative to
5098# the current table rather than specifying a table).
5099AT_SETUP([ofproto-dpif - resubmit with recirculation])
5100OVS_VSWITCHD_START
ca5792f0 5101add_of_ports br0 1 2 3
83a31283
BP
5102
5103AT_DATA([flows.txt], [dnl
5104table=0 in_port=1 actions=2,resubmit(,1)
5105table=1 in_port=1 actions=debug_recirc,resubmit:55
5106table=1 in_port=55 actions=3
5107])
5108AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5109
5110flow="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)"
5111AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5112AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
5113])
5114AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5115AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
5116])
5117
5118OVS_VSWITCHD_STOP
5119AT_CLEANUP
5120
8014f465
JP
5121
5122# This test verifies that tunnel metadata is preserved across
5123# recirculation. At the time of recirculation, fields such as "tun_id"
5124# may be set before the tunnel is "valid" (ie, has a destination
5125# address), but the field should still be available after recirculation.
5126AT_SETUP([ofproto-dpif - resubmit with tun_id])
5127OVS_VSWITCHD_START
5128add_of_ports br0 1 2 3
5129
5130AT_DATA([flows.txt], [dnl
5131table=0 in_port=1 actions=2,load:6->NXM_NX_TUN_ID[[]],resubmit(,1)
5132table=1 in_port=1 actions=debug_recirc,resubmit:55
5133table=1 in_port=55 actions=3
5134])
5135AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5136
5137flow="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)"
5138AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5139AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: icmp,tun_id=0x6,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128,icmp_type=8,icmp_code=0
5140])
5141
5142AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
e3981271 5143AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: recirc_id=0x1,eth,icmp,tun_id=0x6,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128,icmp_type=8,icmp_code=0
8014f465
JP
5144])
5145
5146OVS_VSWITCHD_STOP
5147AT_CLEANUP
5148
5149
6b1c5734
BP
5150# This test verifies that "resubmit", when it triggers recirculation
5151# indirectly through the flow that it recursively invokes, is not
5152# re-executed when execution continues later post-recirculation.
5153AT_SETUP([ofproto-dpif - recirculation after resubmit])
5154OVS_VSWITCHD_START
ca5792f0 5155add_of_ports br0 1 2
6b1c5734
BP
5156
5157AT_DATA([flows.txt], [dnl
5158table=0 in_port=1 actions=resubmit(,1),2
5159table=1 in_port=1 actions=debug_recirc
5160])
5161AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5162
5163flow="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)"
5164AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5165AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
5166])
5167AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5168AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
5169])
5170
5171OVS_VSWITCHD_STOP
5172AT_CLEANUP
5173
323ae1e8
BP
5174# Checks for regression against a bug in which OVS dropped packets
5175# with in_port=CONTROLLER when they were recirculated (because
5176# CONTROLLER isn't a real port and could not be looked up).
5177AT_SETUP([ofproto-dpif - packet-out recirculation])
5178OVS_VSWITCHD_START
5179add_of_ports br0 1 2
5180
5181AT_DATA([flows.txt], [dnl
5182table=0 ip actions=mod_dl_dst:83:83:83:83:83:83,ct(table=1)
5183table=1 ip actions=ct(commit),output:2
5184])
5185AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5186
5187packet=ffffffffffff00102030405008004500001c00000000401100000a000002ffffffff0035111100080000
5188AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=$packet actions=table"])
5189
5190# Dumps out the flow table, extracts the number of packets that have gone
5191# through the (single) flow in table 1, and returns success if it's exactly 1.
5192#
5193# If this remains 0, then the recirculation isn't working properly since the
5194# packet never goes through flow in table 1.
5195check_flows () {
5196 n=$(ovs-ofctl dump-flows br0 table=1 | sed -n 's/.*n_packets=\([[0-9]]\{1,\}\).*/\1/p')
5197 echo "n_packets=$n"
5198 test "$n" = 1
5199}
5200OVS_WAIT_UNTIL([check_flows], [ovs dump-flows br0])
5201
5202OVS_VSWITCHD_STOP
5203AT_CLEANUP
a934a3dd
JP
5204
5205AT_SETUP([ofproto-dpif - debug_slow action])
5206OVS_VSWITCHD_START
5207add_of_ports br0 1 2 3
5208
5209AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,2"])
5210
5211flow="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)"
5212
5213AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5214AT_CHECK_UNQUOTED([tail -3 stdout], [0], [Datapath actions: 2
5215This flow is handled by the userspace slow path because it:
393e9f7c 5216 - Uses action(s) not supported by datapath.
a934a3dd
JP
5217])
5218
5219OVS_VSWITCHD_STOP
5220AT_CLEANUP
5221
5222
77ab5fd2
BP
5223dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
5224dnl
5225dnl Checks the implementation of the continuation mechanism that allows the
5226dnl packet processing pipeline to be paused and resumed. Starts by creating
5227dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
5228dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
5229dnl in the bridge, resuming each time the pipeline pauses, and expects a single
5230dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
5231dnl ACTIONS0 still contains at least one "pause" action, removes one of them
5232dnl and repeats the process.
5233dnl
5234dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
5235dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
5236dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
5237dnl into port 1 on br0, so br1 only comes into action if a patch port (added
5238dnl by EXTRA_SETUP) jumps from one bridge to another.
5239dnl
5240dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
5241dnl both bridges, e.g. to configure mirrors or patch ports.
5242m4_define([CHECK_CONTINUATION], [dnl
5243 AT_SETUP([ofproto-dpif - continuation - $1])
5244 AT_KEYWORDS([continuations pause resume])
5245 OVS_VSWITCHD_START
5246
5247 # count_matches STRING
5248 #
5249 # Prints on stdout the number of occurrences of STRING in stdin.
5250 count_matches () {
5251 sed -n ":start
5252 s/$[1]//p
5253 t start" | wc -l
5254 }
5255
5256 add_of_ports --pcap br0 `seq 1 $2`
5257 m4_if([$3], [0], [],
5258 [add_of_br 1
5259 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
5260
5261 AT_CAPTURE_FILE([ofctl_monitor0.log])
5262 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
5263 m4_if([$3], [0], [],
5264 [AT_CAPTURE_FILE([ofctl_monitor1.log])
5265 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
5266
5267 actions0='$4'
5268 actions1='$5'
5269 $6
5270 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)"
5271 n_packets=0
5272 n_resumes=0
5273 while true; do
5274 printf "\n\nactions for br0:\n%s\n" "$actions0"
5275 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
5276
5277 # Add flows.
5278 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
5279 m4_if([$3], [0], [],
5280 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
5281
70d0cd06
JR
5282 # Make sure the datapath is up-to-date before sending the packet.
5283 ovs-appctl revalidator/wait
5284
77ab5fd2
BP
5285 # Run a packet through the switch.
5286 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5287
5288 # Wait for the expected number of packets to show up.
5289 n_packets=`expr $n_packets + $2 - 1 + $3`
5290 echo "waiting for $n_packets packets..."
5291 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
5292
5293 # Wait for the expected number of NXT_RESUMEs to be logged.
5294 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
5295 echo "waiting for $n_resumes NXT_RESUMEs..."
5296 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
5297
5298 # Eliminate one "pause" from the actions.
5299 #
5300 # If there were none left, then we're done.
5301 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
5302 if test X"$actions0" = X"$next_actions0"; then
5303 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
5304 if test X"$actions1" = X"$next_actions1"; then
5305 break
5306 else
5307 actions1=$next_actions1
5308 fi
5309 else
5310 actions0=$next_actions0
5311 fi
5312
5313 # Delete all the flows and verify that there are none, so that we
5314 # can be sure that our updated flow tables is actually in use
5315 # later.
5316 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
5317 [NXST_FLOW reply:
5318])
5319 m4_if([$3], [0], [],
5320 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
5321 [NXST_FLOW reply:
5322])])
5323 done
5324 OVS_VSWITCHD_STOP
5325 AT_CLEANUP
5326])
5327
5328# Check that pause at the end of the pipeline works OK.
5329#
5330# (xlate_continuation() has a special case for no-op actions; this
5331# fails without that special case.)
5332CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
5333
5334# Check that remaining actions are preserved following resume.
5335CHECK_CONTINUATION([actions], [7], [0],
5336 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
5337
5338# Check that multiple levels of resubmit continue following resume.
5339#
5340# The "resubmit:55", which is relative to the current table, is
5341# particularly interesting because it checks that the notion of the
5342# current table is correctly preserved.
5343CHECK_CONTINUATION([resubmit], [10], [0],
5344 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
5345 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
5346 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
5347 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
5348 table=3 in_port=55 actions=pause 6 pause])
5349
5350# Check that the action set is preserved across pause/resume.
5351CHECK_CONTINUATION([action set], [3], [0],
5352 [in_port=1 actions=1 pause resubmit(,1) pause 2
5353 table=1 actions=write_actions(3)])
5354
5355# Check that metadata and the stack used by push and pop is preserved
5356# across pause/resume.
5357CHECK_CONTINUATION([data stack], [3], [0],
5358 [in_port=1 actions=pause dnl
5359 set_field:1->reg0 dnl
5360 pause dnl
5361 set_field:2->reg1 dnl
5362 pause dnl
5363 output:NXM_NX_REG0[[]] dnl
5364 pause dnl
5365 push:NXM_NX_REG1[[]] dnl
5366 dnl
5367 pop:NXM_NX_REG2[[]] dnl
5368 pause dnl
5369 output:NXM_NX_REG2[[]] dnl
5370 pause dnl
5371 3])
5372
5373# Check that mirror output occurs once and once only, even if
5374# separated by pause/resume.
5375CHECK_CONTINUATION([mirroring], [5], [0],
5376 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
5377 [ovs-vsctl \
5378 set Bridge br0 mirrors=@m --\
5379 --id=@p2 get Port p2 --\
5380 --id=@p3 get Port p3 --\
5381 --id=@p4 get Port p4 --\
5382 --id=@p5 get Port p5 --\
5383 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
5384
5385# Check that pause works in the presence of patch ports.
5386CHECK_CONTINUATION([patch ports], [4], [1],
5387 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
5388 table=1 in_port=1 actions=pause 3 pause 10 pause],
5389 [table=0 in_port=11 actions=pause 5 pause],
5390 [ovs-vsctl \
5391 -- add-port br0 patch10 \
5392 -- set interface patch10 type=patch options:peer=patch11 \
5393 ofport_request=10 \
5394 -- add-port br1 patch11 \
5395 -- set interface patch11 type=patch options:peer=patch10 \
5396 ofport_request=11])
5397
2f355bff
YHW
5398AT_SETUP([ofproto-dpif - continuation flow stats])
5399AT_KEYWORDS([continuations pause resume])
5400OVS_VSWITCHD_START
5401
5402add_of_ports --pcap br0 `seq 1 2`
5403
5404flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5405
5406AT_DATA([flows.txt], [dnl
5407table=0 in_port=1 actions=set_field:1->reg1 controller(pause) resubmit(,2)
5408table=2 reg1=0x1 actions=2
5409])
5410
5411AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5412
5413AT_CAPTURE_FILE([ofctl_monitor0.log])
5414ovs-ofctl monitor br0 resume --detach --no-chdir \
5415--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5416
5417# Run a packet through the switch.
5418AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5419
5420# Check flow stats
5421AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5422AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sed -n 's/idle_age=[[0-9]]*/idle_age=0/p' | grep 'table=2'], [0], [dnl
5423 cookie=0x0, duration=0.0s, table=2, n_packets=1, n_bytes=106, idle_age=0, reg1=0x1 actions=output:2
5424])
5425
420632af 5426# The packet should be received by port 2
1ca0323e 5427AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
07706c50
YHW
5428
5429OVS_VSWITCHD_STOP
5430AT_CLEANUP
5431
5432AT_SETUP([ofproto-dpif - continuation with conntrack])
5433AT_KEYWORDS([continuations pause resume])
5434OVS_VSWITCHD_START
5435
5436add_of_ports --pcap br0 `seq 1 2`
5437
5438flow="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)"
5439
5440AT_DATA([flows.txt], [dnl
5441table=0, in_port=1 icmp action=ct(table=1)
5442table=1, icmp action=controller(pause) resubmit(,2)
5443table=2, in_port=1 icmp ct_state=+trk+new action=output:2
5444])
5445
5446AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5447
5448AT_CAPTURE_FILE([ofctl_monitor0.log])
5449ovs-ofctl monitor br0 resume --detach --no-chdir \
5450--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5451
5452# Run a packet through the switch.
5453AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5454
5455# Check flow stats
5456AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5457AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sed -n 's/idle_age=[[0-9]]*/idle_age=0/p' | grep 'table=2'], [0], [dnl
5458 cookie=0x0, duration=0.0s, table=2, n_packets=1, n_bytes=106, idle_age=0, ct_state=+new+trk,icmp,in_port=1 actions=output:2
5459])
5460
5461# The packet should be received by port 2
1ca0323e 5462AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
2f355bff
YHW
5463
5464OVS_VSWITCHD_STOP
5465AT_CLEANUP
0d3239e8 5466
88d2ac50
YHW
5467AT_SETUP([ofproto-dpif - continuation with patch port])
5468AT_KEYWORDS([continuations pause resume])
5469OVS_VSWITCHD_START(
5470 [add-port br0 p0 -- set Interface p0 type=dummy -- \
5471 add-port br0 patch- -- \
5472 set interface patch- type=patch options:peer=patch+ -- \
5473 add-br br1 -- set bridge br1 datapath-type=dummy fail-mode=secure -- \
5474 add-port br1 patch+ -- set interface patch+ type=patch options:peer=patch-
5475])
5476add_of_ports --pcap br1 1
5477
5478flow="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)"
5479
5480AT_DATA([flows.txt], [dnl
5481table=0, in_port=patch+ icmp action=controller(pause), resubmit(,1)
5482table=1, in_port=patch+ icmp action=ct(table=2)
5483table=2, in_port=patch+ icmp ct_state=+trk+new action=ct(commit, table=3)
5484table=3, in_port=patch+ icmp action=p1
5485])
5486
5487AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5488AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br1 flows.txt])
5489
5490AT_CAPTURE_FILE([ofctl_monitor.log])
5491ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl.pid 2> ofctl_monitor.log
5492
5493# Run a packet through the switch.
5494AT_CHECK([ovs-appctl netdev-dummy/receive p0 "$flow"], [0], [stdout])
5495
5496# Check flow stats
5497AT_CHECK([ovs-ofctl dump-flows br1], [0], [stdout])
5498AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sed -n 's/idle_age=[[0-9]]*/idle_age=0/p' | grep 'table=3' | grep -v 'commit'], [0], [dnl
5499 cookie=0x0, duration=0.0s, table=3, n_packets=1, n_bytes=106, idle_age=0, icmp,in_port=1 actions=output:2
5500])
5501
5502# The packet should be received by port 1
1ca0323e 5503AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p1-tx.pcap | wc -l`])
88d2ac50
YHW
5504
5505OVS_VSWITCHD_STOP
5506AT_CLEANUP
5507
0d3239e8
NS
5508# Check that pause works after the packet is cloned.
5509AT_SETUP([ofproto-dpif - continuation after clone])
5510AT_KEYWORDS([continuations clone pause resume])
5511OVS_VSWITCHD_START
5512
5513add_of_ports --pcap br0 `seq 1 3`
5514
5515flow="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)"
5516
5517AT_DATA([flows.txt], [dnl
5518table=0 in_port=1 actions=set_field:1->reg1 resubmit(,2)
5519table=1 reg1=0x5 actions=controller(pause) resubmit(,3)
5520table=1 reg1=0x1 actions=2
5521table=2 in_port=1 actions=clone(set_field:5->reg1, resubmit(,1))
5522table=3 reg1=0x1 actions=3
5523table=3 reg1=0x5 actions=2
5524])
5525
5526AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5527
5528AT_CAPTURE_FILE([ofctl_monitor0.log])
5529ovs-ofctl monitor br0 resume --detach --no-chdir \
5530--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5531
5532# Run a packet through the switch.
5533AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5534
5535ovs-vsctl show
5536ovs-ofctl dump-flows br0
5537
420632af 5538# The packet should be received by port 2 and not port 3
1ca0323e
BP
5539AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5540AT_CHECK([test 0 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p3-tx.pcap | wc -l`])
0d3239e8
NS
5541
5542# NXT_RESUMEs should be 1 and reg1 should be set to 0x5.
5543OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor*.log | grep NXT_RESUME | grep -c reg1=0x5`])
5544
5545OVS_VSWITCHD_STOP
5546AT_CLEANUP
5547
22bb3cbc
AW
5548# Two testcases below are for the ofproto/trace command
5549# The first one tests all correct syntax:
5550# ofproto/trace [dp_name] odp_flow [-generate|packet]
5551# ofproto/trace br_name br_flow [-generate|packet]
5552AT_SETUP([ofproto-dpif - ofproto/trace command 1])
5553OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 5554add_of_ports br0 1 2 3
22bb3cbc
AW
5555
5556AT_DATA([flows.txt], [dnl
5557in_port=1 actions=output:2
5558in_port=2 actions=output:1
5559])
5560AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5561
e063a73a 5562odp_flow="in_port(p1)"
22bb3cbc 5563br_flow="in_port=1"
0a37839c
GS
5564# Test command: ofproto/trace odp_flow with in_port as a name.
5565AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5566AT_CHECK([tail -1 stdout], [0], [dnl
5567Datapath actions: 2
5568])
5569
5570odp_flow="in_port(1)"
22bb3cbc
AW
5571# Test command: ofproto/trace odp_flow
5572AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5573AT_CHECK([tail -1 stdout], [0], [dnl
5574Datapath actions: 2
5575])
5576
5577# Test command: ofproto/trace dp_name odp_flow
5578AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
5579AT_CHECK([tail -1 stdout], [0], [dnl
5580Datapath actions: 2
5581])
5582# Test commmand: ofproto/trace br_name br_flow
5583AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5584AT_CHECK([tail -1 stdout], [0], [dnl
5585Datapath actions: 2
5586])
5587
5588# Delete the inserted flows
5589AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
5590AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
5591
78c9486d 5592# This section below tests the [-generate] option
22bb3cbc 5593odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
78c9486d 5594br_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
5595
5596# Test command: ofproto/trace odp_flow
5597AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5598# Check for no MAC learning entry
5599AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5600 port VLAN MAC Age
5601])
5602
5603# Test command: ofproto/trace br_name br_flow
5604AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5605# Check for no MAC learning entry
5606AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5607 port VLAN MAC Age
5608])
5609
5610# Test command: ofproto/trace odp_flow -generate
5611AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
5612# Check for the MAC learning entry
5613AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5614 port VLAN MAC Age
5615 3 0 50:54:00:00:00:05 ?
5616])
5617
5618# Test command: ofproto/trace dp_name odp_flow -generate
5619AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5620 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
5621 -generate], [0], [stdout])
5622# Check for both MAC learning entries
5623AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5624 port VLAN MAC Age
5625 3 0 50:54:00:00:00:05 ?
5626 1 0 50:54:00:00:00:06 ?
5627])
5628
5629# Test command: ofproto/trace br_name br_flow -generate
5630AT_CHECK([ovs-appctl ofproto/trace br0 \
5631 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
5632 -generate], [0], [stdout])
5633# Check for both MAC learning entries.
5634AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5635 port VLAN MAC Age
5636 3 0 50:54:00:00:00:05 ?
5637 1 0 50:54:00:00:00:06 ?
5638 2 0 50:54:00:00:00:07 ?
5639])
5640
5641# This section beflow tests the [packet] option
5642# The ovs-tcpundump of packets between port1 and port2
5643pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5644pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
5645
5646# Construct the MAC learning table
5647AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5648 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
5649 -generate], [0], [stdout])
5650
5651# Construct the MAC learning table
5652AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5653 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
5654 -generate], [0], [stdout])
5655
5656# Test command: ofproto/trace odp_flow packet
5657AT_CHECK([ovs-appctl ofproto/trace \
5658 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5659AT_CHECK([tail -1 stdout], [0], [dnl
5660Datapath actions: 2
5661])
2d9b49dd 5662AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5663Flow: 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
5664
5665bridge("br0")
22bb3cbc
AW
5666])
5667
5668# Test command: ofproto/trace dp_name odp_flow packet
5669AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5670 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5671AT_CHECK([tail -1 stdout], [0], [dnl
5672Datapath actions: 2
5673])
2d9b49dd 5674AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5675Flow: 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
5676
5677bridge("br0")
22bb3cbc
AW
5678])
5679
5680# Test command: ofproto/trace br_name br_flow packet
5681AT_CHECK([ovs-appctl ofproto/trace br0 \
1362e248 5682 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
22bb3cbc 5683AT_CHECK([tail -1 stdout], [0], [dnl
ed2e7245 5684Datapath actions: 1
22bb3cbc 5685])
2d9b49dd 5686AT_CHECK([head -n 3 stdout], [0], [dnl
78c9486d 5687Flow: 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
5688
5689bridge("br0")
22bb3cbc
AW
5690])
5691
5692OVS_VSWITCHD_STOP
5693AT_CLEANUP
5694
5695# The second test tests the corner cases
5696AT_SETUP([ofproto-dpif - ofproto/trace command 2])
5697OVS_VSWITCHD_START
ca5792f0 5698add_of_ports br0 1 2
22bb3cbc
AW
5699
5700# Define flows
5701odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
5702br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
5703# Define options
5704generate="-generate"
5705pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5706
5707# Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
5708m4_foreach(
5709[option],
5710[[],
5711["$generate"],
5712["$pkt"]],
5713[AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
5714 [2], [], [stderr])
5715AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5716Cannot find the datapath
22bb3cbc
AW
5717ovs-appctl: ovs-vswitchd: server returned an error
5718])])
5719
5720# Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
5721m4_foreach(
5722[option],
5723[[],
5724["$generate"],
5725["$pkt"]],
5726[AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
5727 [2], [], [stderr])
5728AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5729Cannot find the datapath
22bb3cbc
AW
5730ovs-appctl: ovs-vswitchd: server returned an error
5731])])
5732
5733# Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
5734m4_foreach(
5735[option],
5736[[],
5737["$generate"],
5738["$pkt"]],
5739[AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
5740 [2], [], [stderr])
5741AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5742Cannot find the datapath
22bb3cbc
AW
5743ovs-appctl: ovs-vswitchd: server returned an error
5744])])
5745
5746# Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
5747m4_foreach(
5748[option],
5749[[],
5750["$generate"],
5751["$pkt"]],
5752[AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
5753 [2], [], [stderr])
5754AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 5755Cannot find the datapath
22bb3cbc
AW
5756ovs-appctl: ovs-vswitchd: server returned an error
5757])])
5758
5759# Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
5760m4_foreach(
5761[option],
5762[[],
5763["$generate"],
5764["$pkt"]],
5765[AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
5766 [2], [], [stderr])
5767AT_CHECK([tail -2 stderr], [0], [dnl
b490b189 5768ovs-dummy: unknown bridge
22bb3cbc
AW
5769ovs-appctl: ovs-vswitchd: server returned an error
5770])])
5771
5772# Test incorrect command: ofproto/trace br_flow [-generate|packet]
5773m4_foreach(
5774[option],
5775[[],
5776["$generate"],
5777["$pkt"]],
5778[AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
5779 [2], [], [stderr])
5780AT_CHECK([tail -2 stderr], [0], [dnl
d40533fc 5781syntax error at in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02 (or the bridge name was omitted)
22bb3cbc
AW
5782ovs-appctl: ovs-vswitchd: server returned an error
5783])])
5784
5785# Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
5786AT_CHECK([ovs-appctl ofproto/trace \
5787 ovs-dummy "$odp_flow" garbage_option],
5788 [2], [stdout],[stderr])
5789AT_CHECK([tail -2 stderr], [0], [dnl
5790Trailing garbage in packet data
5791ovs-appctl: ovs-vswitchd: server returned an error
5792])
5793
22bb3cbc
AW
5794# Test incorrect command: ofproto/trace with 0 argument
5795AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
5796AT_CHECK([tail -2 stderr], [0], [dnl
5797"ofproto/trace" command requires at least 1 arguments
5798ovs-appctl: ovs-vswitchd: server returned an error
5799])
5800
5801OVS_VSWITCHD_STOP
5802AT_CLEANUP
5803
b6ec827f
JS
5804# The third test checks that the output of "ovs-dpctl -m" is valid to trace.
5805AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
5806OVS_VSWITCHD_START([dnl
5807 set Open_vSwitch . other_config:max-idle=10000 \
5808 -- add-port br0 p1 -- set Interface p1 type=dummy])
5809
5810AT_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)'])
5811ovs-appctl revalidator/wait
5812AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
5813
5814odp_flow=`cat dp_flows1.txt`
5815AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
b6ec827f 5816Flow: <cleared>
b6ec827f 5817
2d9b49dd
BP
5818bridge("br0")
5819-------------
5820 0. No match.
5821 drop
b6ec827f
JS
5822
5823Final flow: <cleared>
5824Megaflow: <cleared>
5825Datapath actions: drop
5826])
5827
5828dnl Now, try again without megaflows:
5829ovs-appctl upcall/disable-megaflows
5830
5831AT_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)'])
5832ovs-appctl revalidator/wait
5833AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
5834
5835odp_flow=`cat dp_flows2.txt`
5836AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
b6ec827f 5837Flow: <cleared>
b6ec827f 5838
2d9b49dd
BP
5839bridge("br0")
5840-------------
5841 0. No match.
5842 drop
b6ec827f
JS
5843
5844Final flow: <cleared>
5845Megaflow: <cleared>
5846Datapath actions: drop
5847])
5848
5849OVS_VSWITCHD_STOP
5850AT_CLEANUP
5851
aee0979b
BP
5852AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
5853OVS_VSWITCHD_START
ca5792f0 5854add_of_ports br0 1 2 3
aee0979b
BP
5855
5856AT_DATA([flows.txt], [dnl
5857in_port=1 actions=output:2
5858in_port=2 actions=output:1
5859])
5860AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5861
5862AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
5863AT_CHECK([tail -1 stdout], [0], [dnl
5864Datapath actions: push_vlan(vid=123,pcp=0),2
5865])
5866
5867OVS_VSWITCHD_STOP
5868AT_CLEANUP
5869
5870
b44a10b7
BP
5871m4_define([OFPROTO_TRACE],
5872 [flow="$2"
5873 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
5874 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5875 expected="$4"
5876 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
5877 [0], [stdout])
5878 mv stdout expout
5879 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
5880 [0], [expout])])
5881
5882AT_SETUP([ofproto-dpif - MAC learning])
432fca23 5883OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 5884add_of_ports br0 1 2 3
b44a10b7 5885
b44a10b7
BP
5886arp='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)'
5887
5888# Trace an ARP packet arriving on p3, to create a MAC learning entry.
5889OFPROTO_TRACE(
50aa28fd 5890 [ovs-dummy],
247527db 5891 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5892 [-generate],
e44768b7 5893 [1,2,100])
b44a10b7
BP
5894
5895# Check for the MAC learning entry.
83664f72 5896AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5897 port VLAN MAC Age
247527db 5898 3 0 50:54:00:00:00:05 ?
b44a10b7
BP
5899])
5900
5901# Trace a packet arrival destined for the learned MAC.
5902# (This will also learn a MAC.)
5903OFPROTO_TRACE(
50aa28fd 5904 [ovs-dummy],
247527db 5905 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
b44a10b7 5906 [-generate],
247527db 5907 [3])
b44a10b7
BP
5908
5909# Check for both MAC learning entries.
83664f72 5910AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5911 port VLAN MAC Age
247527db
BP
5912 3 0 50:54:00:00:00:05 ?
5913 1 0 50:54:00:00:00:06 ?
b44a10b7
BP
5914])
5915
5916# Trace a packet arrival that updates the first learned MAC entry.
5917OFPROTO_TRACE(
50aa28fd 5918 [ovs-dummy],
247527db 5919 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5920 [-generate],
e44768b7 5921 [1,3,100])
b44a10b7
BP
5922
5923# Check that the MAC learning entry was updated.
83664f72 5924AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5925 port VLAN MAC Age
247527db
BP
5926 1 0 50:54:00:00:00:06 ?
5927 2 0 50:54:00:00:00:05 ?
b44a10b7
BP
5928])
5929
5930# Add another bridge.
5931AT_CHECK(
5932 [ovs-vsctl \
5933 -- add-br br1 \
ad28062f 5934 -- set bridge br1 datapath-type=dummy])
ca5792f0 5935add_of_ports br1 4 5
b44a10b7
BP
5936
5937# Trace some packet arrivals in br1 to create MAC learning entries there too.
5938OFPROTO_TRACE(
50aa28fd 5939 [ovs-dummy],
247527db 5940 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5941 [-generate],
e44768b7 5942 [5,101])
b44a10b7 5943OFPROTO_TRACE(
50aa28fd 5944 [ovs-dummy],
247527db 5945 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 5946 [-generate],
e44768b7 5947 [4,101])
b44a10b7
BP
5948
5949# Check that the MAC learning entries were added.
83664f72 5950AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5951 port VLAN MAC Age
247527db
BP
5952 4 0 50:54:00:00:00:06 ?
5953 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
5954])
5955
5956# Delete port p1 and see that its MAC learning entry disappeared, and
5957# that the MAC learning entry for the same MAC was also deleted from br1.
5958AT_CHECK([ovs-vsctl del-port p1])
83664f72 5959AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5960 port VLAN MAC Age
247527db 5961 2 0 50:54:00:00:00:05 ?
b44a10b7 5962])
83664f72 5963AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 5964 port VLAN MAC Age
247527db 5965 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
5966])
5967
5968OVS_VSWITCHD_STOP
5969AT_CLEANUP
17f7f7e0 5970
c4069512
BP
5971AT_SETUP([ofproto-dpif - MAC table overflow])
5972OVS_VSWITCHD_START(
ad28062f 5973 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 5974add_of_ports br0 1 2 3
c4069512
BP
5975
5976arp='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)'
5977
5978AT_CHECK([ovs-appctl time/stop])
5979
5980# Trace 10 ARP packets arriving on p3, to create MAC learning entries.
5981for i in 0 1 2 3 4 5 6 7 8 9; do
5982 OFPROTO_TRACE(
50aa28fd 5983 [ovs-dummy],
c4069512
BP
5984 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
5985 [-generate],
5986 [1,2,100])
5987 ovs-appctl time/warp 1000
5988done
5989
5990# Check for the MAC learning entries.
5991AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5992 [0], [dnl
5993 3 0 50:54:00:00:00:00
5994 3 0 50:54:00:00:00:01
5995 3 0 50:54:00:00:00:02
5996 3 0 50:54:00:00:00:03
5997 3 0 50:54:00:00:00:04
5998 3 0 50:54:00:00:00:05
5999 3 0 50:54:00:00:00:06
6000 3 0 50:54:00:00:00:07
6001 3 0 50:54:00:00:00:08
6002 3 0 50:54:00:00:00:09
6003 port VLAN MAC Age
6004])
6005
6006# Trace another ARP packet on another MAC.
6007OFPROTO_TRACE(
50aa28fd 6008 [ovs-dummy],
c4069512
BP
6009 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
6010 [-generate],
6011 [1,2,100])
6012
6013# Check that the new one chased the oldest one out of the table.
6014AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
6015 [0], [dnl
6016 3 0 50:54:00:00:00:01 ?
6017 3 0 50:54:00:00:00:02 ?
6018 3 0 50:54:00:00:00:03 ?
6019 3 0 50:54:00:00:00:04 ?
6020 3 0 50:54:00:00:00:05 ?
6021 3 0 50:54:00:00:00:06 ?
6022 3 0 50:54:00:00:00:07 ?
6023 3 0 50:54:00:00:00:08 ?
6024 3 0 50:54:00:00:00:09 ?
6025 3 0 50:54:00:00:00:10 ?
6026 port VLAN MAC Age
6027])
6028OVS_VSWITCHD_STOP
6029AT_CLEANUP
6030
9d078ec2
BP
6031AT_SETUP([ofproto-dpif - MAC table overflow fairness])
6032OVS_VSWITCHD_START(
6033 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 6034add_of_ports br0 1 2 3 4 5 6
9d078ec2
BP
6035
6036arp='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)'
6037
6038AT_CHECK([ovs-appctl time/stop])
6039
6040# Trace packets with 2 different source MACs arriving on each of the 5
6041# ports, filling up the 10-entry learning table.
6042for i in 0 1 2 3 4 5 6 7 8 9; do
6043 p=`expr $i / 2 + 1`
6044 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
6045 ovs-appctl time/warp 1000
6046done
6047
6048# Check for the MAC learning entries.
6049AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
6050 [0], [dnl
6051 1 0 50:54:00:00:00:00
6052 1 0 50:54:00:00:00:01
6053 2 0 50:54:00:00:00:02
6054 2 0 50:54:00:00:00:03
6055 3 0 50:54:00:00:00:04
6056 3 0 50:54:00:00:00:05
6057 4 0 50:54:00:00:00:06
6058 4 0 50:54:00:00:00:07
6059 5 0 50:54:00:00:00:08
6060 5 0 50:54:00:00:00:09
6061 port VLAN MAC Age
6062])
6063
6064# Now trace 16 new MACs on another port.
6065for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
6066 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
6067 ovs-appctl time/warp 1000
6068done
6069
6070# Check the results.
6071#
6072# Our eviction algorithm on overflow is that an arbitrary (but deterministic)
6073# one of the ports with the most learned MACs loses the least recently used
6074# one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
6075# MAC each, and the other 2 of the old ports with 2 MACs each.
6076#
6077# (If someone changes lib/heap.c to do something different with equal-priority
6078# nodes, then the output below could change, but it would still follow the
6079# rules explained above.)
6080AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
6081 [0], [dnl
6082 1 0 50:54:00:00:00:01
6083 2 0 50:54:00:00:00:03
6084 3 0 50:54:00:00:00:04
6085 3 0 50:54:00:00:00:05
6086 4 0 50:54:00:00:00:07
6087 5 0 50:54:00:00:00:08
6088 5 0 50:54:00:00:00:09
6089 6 0 50:54:00:00:0d:ff
6090 6 0 50:54:00:00:0e:ff
6091 6 0 50:54:00:00:0f:ff
6092 port VLAN MAC Age
6093])
6094OVS_VSWITCHD_STOP
6095AT_CLEANUP
6096
4819b3a5 6097# CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
e731d71b
AS
6098#
6099# Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
e731d71b 6100m4_define([CHECK_SFLOW_SAMPLING_PACKET],
4819b3a5 6101 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
e731d71b
AS
6102 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6103
53eb8cb8 6104 on_exit 'kill `cat test-sflow.pid`'
eadd1644 6105 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
e731d71b 6106 AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6107 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
e731d71b
AS
6108 ovs-appctl time/stop
6109
ca5792f0 6110 add_of_ports br0 1 2
e731d71b
AS
6111 ovs-vsctl \
6112 set Interface br0 options:ifindex=1002 -- \
6113 set Interface p1 options:ifindex=1004 -- \
6114 set Interface p2 options:ifindex=1003 -- \
6115 set Bridge br0 sflow=@sf -- \
6116 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
9a9808d7 6117 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
e731d71b
AS
6118
6119 dnl open with ARP packets to seed the bridge-learning. The output
6120 dnl ifIndex numbers should be reported predictably after that.
6121 dnl Since we set sampling=1 we should see all of these packets
6122 dnl reported. Sorting the output by data-source and seqNo makes
6123 dnl it deterministic. Ensuring that we send at least two packets
6124 dnl into each port means we get to check the seq nos are
6125 dnl incrementing correctly.
6126 dnl because packets from different ports can be handled by separate
6127 dnl threads, put some sleeps
6128
6129 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)'
6130 sleep 1
6131 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)'
6132 sleep 1
6133 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)'
6134 sleep 1
6135 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)'
6136 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)'
6137
6138 dnl sleep long enough to get more than one counter sample
6139 dnl from each datasource so we can check sequence numbers
22ecc560 6140 ovs-appctl time/warp 2000 100
e731d71b 6141 OVS_VSWITCHD_STOP
d9c8c57c 6142 OVS_APP_EXIT_AND_WAIT([test-sflow])
8073dd31 6143
e731d71b 6144 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
b559c8bd 6145 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
8073dd31 6146HEADER
5a0e4aec
BP
6147 dgramSeqNo=1
6148 ds=127.0.0.1>2:1000
6149 fsSeqNo=1
6150 in_vlan=0
6151 in_priority=0
6152 out_vlan=0
6153 out_priority=0
6154 meanSkip=1
6155 samplePool=1
6156 dropEvents=0
6157 in_ifindex=1004
6158 in_format=0
6159 out_ifindex=2
6160 out_format=2
6161 hdr_prot=1
6162 pkt_len=46
6163 stripped=4
6164 hdr_len=42
6165 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 6166HEADER
5a0e4aec
BP
6167 dgramSeqNo=1
6168 ds=127.0.0.1>2:1000
6169 fsSeqNo=2
6170 in_vlan=0
6171 in_priority=0
6172 out_vlan=0
6173 out_priority=0
6174 meanSkip=1
6175 samplePool=2
6176 dropEvents=0
6177 in_ifindex=1003
6178 in_format=0
6179 out_ifindex=2
6180 out_format=2
6181 hdr_prot=1
6182 pkt_len=46
6183 stripped=4
6184 hdr_len=42
6185 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 6186HEADER
5a0e4aec
BP
6187 dgramSeqNo=1
6188 ds=127.0.0.1>2:1000
6189 fsSeqNo=3
6190 in_vlan=0
6191 in_priority=0
6192 out_vlan=0
6193 out_priority=0
6194 meanSkip=1
6195 samplePool=3
6196 dropEvents=0
6197 in_ifindex=1004
6198 in_format=0
6199 out_ifindex=1003
6200 out_format=0
6201 hdr_prot=1
6202 pkt_len=110
6203 stripped=4
6204 hdr_len=106
6205 hdr=50-54-00-00-00-07-50-54-00-00-00-05-08-00-45-00-00-5C-00-00-00-00-40-01-F9-4D-C0-A8-00-01-C0-A8-00-02-08-00-13-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
8073dd31 6206HEADER
5a0e4aec
BP
6207 dgramSeqNo=1
6208 ds=127.0.0.1>2:1000
6209 fsSeqNo=4
6210 in_vlan=0
6211 in_priority=0
6212 out_vlan=0
6213 out_priority=0
6214 meanSkip=1
6215 samplePool=4
6216 dropEvents=0
6217 in_ifindex=1003
6218 in_format=0
6219 out_ifindex=1004
6220 out_format=0
6221 hdr_prot=1
6222 pkt_len=110
6223 stripped=4
6224 hdr_len=106
6225 hdr=50-54-00-00-00-05-50-54-00-00-00-07-08-00-45-00-00-5C-00-00-00-00-40-01-F9-4D-C0-A8-00-02-C0-A8-00-01-00-00-1B-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
8073dd31 6226HEADER
5a0e4aec
BP
6227 dgramSeqNo=1
6228 ds=127.0.0.1>2:1000
6229 fsSeqNo=5
6230 in_vlan=0
6231 in_priority=0
6232 out_vlan=0
6233 out_priority=0
6234 meanSkip=1
6235 samplePool=5
6236 dropEvents=0
6237 in_ifindex=1003
6238 in_format=0
6239 out_ifindex=1004
6240 out_format=0
6241 hdr_prot=1
6242 pkt_len=58
6243 stripped=4
6244 hdr_len=54
6245 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
6246])
6247
934386dd 6248 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'ETHCOUNTERS|IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -24 | sed 's/ /\
b559c8bd 6249 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
934386dd 6250ETHCOUNTERS
5a0e4aec
BP
6251 dot3StatsAlignmentErrors=4294967295
6252 dot3StatsFCSErrors=4294967295
6253 dot3StatsSingleCollisionFrames=4294967295
6254 dot3StatsMultipleCollisionFrames=4294967295
6255 dot3StatsSQETestErrors=4294967295
6256 dot3StatsDeferredTransmissions=4294967295
6257 dot3StatsLateCollisions=4294967295
6258 dot3StatsExcessiveCollisions=4294967295
6259 dot3StatsInternalMacTransmitErrors=4294967295
6260 dot3StatsCarrierSenseErrors=4294967295
6261 dot3StatsFrameTooLongs=4294967295
6262 dot3StatsInternalMacReceiveErrors=4294967295
6263 dot3StatsSymbolErrors=4294967295
934386dd 6264ETHCOUNTERS
5a0e4aec
BP
6265 dot3StatsAlignmentErrors=4294967295
6266 dot3StatsFCSErrors=4294967295
6267 dot3StatsSingleCollisionFrames=4294967295
6268 dot3StatsMultipleCollisionFrames=4294967295
6269 dot3StatsSQETestErrors=4294967295
6270 dot3StatsDeferredTransmissions=4294967295
6271 dot3StatsLateCollisions=4294967295
6272 dot3StatsExcessiveCollisions=4294967295
6273 dot3StatsInternalMacTransmitErrors=4294967295
6274 dot3StatsCarrierSenseErrors=4294967295
6275 dot3StatsFrameTooLongs=4294967295
6276 dot3StatsInternalMacReceiveErrors=4294967295
6277 dot3StatsSymbolErrors=4294967295
934386dd 6278ETHCOUNTERS
5a0e4aec
BP
6279 dot3StatsAlignmentErrors=4294967295
6280 dot3StatsFCSErrors=4294967295
6281 dot3StatsSingleCollisionFrames=4294967295
6282 dot3StatsMultipleCollisionFrames=4294967295
6283 dot3StatsSQETestErrors=4294967295
6284 dot3StatsDeferredTransmissions=4294967295
6285 dot3StatsLateCollisions=4294967295
6286 dot3StatsExcessiveCollisions=4294967295
6287 dot3StatsInternalMacTransmitErrors=4294967295
6288 dot3StatsCarrierSenseErrors=4294967295
6289 dot3StatsFrameTooLongs=4294967295
6290 dot3StatsInternalMacReceiveErrors=4294967295
6291 dot3StatsSymbolErrors=4294967295
934386dd 6292ETHCOUNTERS
5a0e4aec
BP
6293 dot3StatsAlignmentErrors=4294967295
6294 dot3StatsFCSErrors=4294967295
6295 dot3StatsSingleCollisionFrames=4294967295
6296 dot3StatsMultipleCollisionFrames=4294967295
6297 dot3StatsSQETestErrors=4294967295
6298 dot3StatsDeferredTransmissions=4294967295
6299 dot3StatsLateCollisions=4294967295
6300 dot3StatsExcessiveCollisions=4294967295
6301 dot3StatsInternalMacTransmitErrors=4294967295
6302 dot3StatsCarrierSenseErrors=4294967295
6303 dot3StatsFrameTooLongs=4294967295
6304 dot3StatsInternalMacReceiveErrors=4294967295
6305 dot3StatsSymbolErrors=4294967295
934386dd 6306ETHCOUNTERS
5a0e4aec
BP
6307 dot3StatsAlignmentErrors=4294967295
6308 dot3StatsFCSErrors=4294967295
6309 dot3StatsSingleCollisionFrames=4294967295
6310 dot3StatsMultipleCollisionFrames=4294967295
6311 dot3StatsSQETestErrors=4294967295
6312 dot3StatsDeferredTransmissions=4294967295
6313 dot3StatsLateCollisions=4294967295
6314 dot3StatsExcessiveCollisions=4294967295
6315 dot3StatsInternalMacTransmitErrors=4294967295
6316 dot3StatsCarrierSenseErrors=4294967295
6317 dot3StatsFrameTooLongs=4294967295
6318 dot3StatsInternalMacReceiveErrors=4294967295
6319 dot3StatsSymbolErrors=4294967295
934386dd 6320ETHCOUNTERS
5a0e4aec
BP
6321 dot3StatsAlignmentErrors=4294967295
6322 dot3StatsFCSErrors=4294967295
6323 dot3StatsSingleCollisionFrames=4294967295
6324 dot3StatsMultipleCollisionFrames=4294967295
6325 dot3StatsSQETestErrors=4294967295
6326 dot3StatsDeferredTransmissions=4294967295
6327 dot3StatsLateCollisions=4294967295
6328 dot3StatsExcessiveCollisions=4294967295
6329 dot3StatsInternalMacTransmitErrors=4294967295
6330 dot3StatsCarrierSenseErrors=4294967295
6331 dot3StatsFrameTooLongs=4294967295
6332 dot3StatsInternalMacReceiveErrors=4294967295
6333 dot3StatsSymbolErrors=4294967295
8073dd31 6334IFCOUNTERS
5a0e4aec
BP
6335 dgramSeqNo=1
6336 ds=127.0.0.1>0:1003
6337 csSeqNo=1
6338 ifindex=1003
6339 type=6
6340 ifspeed=100000000
6341 direction=0
c9c8c8a1 6342 status=3
5a0e4aec
BP
6343 in_octets=202
6344 in_unicasts=3
6345 in_multicasts=4294967295
6346 in_broadcasts=4294967295
6347 in_discards=4294967295
6348 in_errors=4294967295
6349 in_unknownprotos=4294967295
6350 out_octets=148
6351 out_unicasts=2
6352 out_multicasts=4294967295
6353 out_broadcasts=4294967295
6354 out_discards=4294967295
6355 out_errors=4294967295
6356 promiscuous=0
8073dd31 6357IFCOUNTERS
5a0e4aec
BP
6358 dgramSeqNo=1
6359 ds=127.0.0.1>0:1004
6360 csSeqNo=1
6361 ifindex=1004
6362 type=6
6363 ifspeed=100000000
6364 direction=0
c9c8c8a1 6365 status=3
5a0e4aec
BP
6366 in_octets=148
6367 in_unicasts=2
6368 in_multicasts=4294967295
6369 in_broadcasts=4294967295
6370 in_discards=4294967295
6371 in_errors=4294967295
6372 in_unknownprotos=4294967295
6373 out_octets=202
6374 out_unicasts=3
6375 out_multicasts=4294967295
6376 out_broadcasts=4294967295
6377 out_discards=4294967295
6378 out_errors=4294967295
6379 promiscuous=0
8073dd31 6380IFCOUNTERS
5a0e4aec
BP
6381 dgramSeqNo=2
6382 ds=127.0.0.1>0:1002
6383 csSeqNo=1
6384 ifindex=1002
6385 type=6
6386 ifspeed=100000000
6387 direction=0
c9c8c8a1 6388 status=3
5a0e4aec
BP
6389 in_octets=0
6390 in_unicasts=0
6391 in_multicasts=4294967295
6392 in_broadcasts=4294967295
6393 in_discards=4294967295
6394 in_errors=4294967295
6395 in_unknownprotos=4294967295
6396 out_octets=84
6397 out_unicasts=2
6398 out_multicasts=4294967295
6399 out_broadcasts=4294967295
6400 out_discards=4294967295
6401 out_errors=4294967295
6402 promiscuous=0
8073dd31 6403IFCOUNTERS
5a0e4aec
BP
6404 dgramSeqNo=3
6405 ds=127.0.0.1>0:1002
6406 csSeqNo=2
6407 ifindex=1002
6408 type=6
6409 ifspeed=100000000
6410 direction=0
c9c8c8a1 6411 status=3
5a0e4aec
BP
6412 in_octets=0
6413 in_unicasts=0
6414 in_multicasts=4294967295
6415 in_broadcasts=4294967295
6416 in_discards=4294967295
6417 in_errors=4294967295
6418 in_unknownprotos=4294967295
6419 out_octets=84
6420 out_unicasts=2
6421 out_multicasts=4294967295
6422 out_broadcasts=4294967295
6423 out_discards=4294967295
6424 out_errors=4294967295
6425 promiscuous=0
8073dd31 6426IFCOUNTERS
5a0e4aec
BP
6427 dgramSeqNo=3
6428 ds=127.0.0.1>0:1003
6429 csSeqNo=2
6430 ifindex=1003
6431 type=6
6432 ifspeed=100000000
6433 direction=0
c9c8c8a1 6434 status=3
5a0e4aec
BP
6435 in_octets=202
6436 in_unicasts=3
6437 in_multicasts=4294967295
6438 in_broadcasts=4294967295
6439 in_discards=4294967295
6440 in_errors=4294967295
6441 in_unknownprotos=4294967295
6442 out_octets=148
6443 out_unicasts=2
6444 out_multicasts=4294967295
6445 out_broadcasts=4294967295
6446 out_discards=4294967295
6447 out_errors=4294967295
6448 promiscuous=0
8073dd31 6449IFCOUNTERS
5a0e4aec
BP
6450 dgramSeqNo=3
6451 ds=127.0.0.1>0:1004
6452 csSeqNo=2
6453 ifindex=1004
6454 type=6
6455 ifspeed=100000000
6456 direction=0
c9c8c8a1 6457 status=3
5a0e4aec
BP
6458 in_octets=148
6459 in_unicasts=2
6460 in_multicasts=4294967295
6461 in_broadcasts=4294967295
6462 in_discards=4294967295
6463 in_errors=4294967295
6464 in_unknownprotos=4294967295
6465 out_octets=202
6466 out_unicasts=3
6467 out_multicasts=4294967295
6468 out_broadcasts=4294967295
6469 out_discards=4294967295
6470 out_errors=4294967295
6471 promiscuous=0
50b9699f 6472OPENFLOWPORT
5a0e4aec
BP
6473 datapath_id=18364758544493064720
6474 port_no=1
50b9699f 6475OPENFLOWPORT
5a0e4aec
BP
6476 datapath_id=18364758544493064720
6477 port_no=1
50b9699f 6478OPENFLOWPORT
5a0e4aec
BP
6479 datapath_id=18364758544493064720
6480 port_no=2
50b9699f 6481OPENFLOWPORT
5a0e4aec
BP
6482 datapath_id=18364758544493064720
6483 port_no=2
50b9699f 6484OPENFLOWPORT
5a0e4aec
BP
6485 datapath_id=18364758544493064720
6486 port_no=65534
50b9699f 6487OPENFLOWPORT
5a0e4aec
BP
6488 datapath_id=18364758544493064720
6489 port_no=65534
50b9699f 6490PORTNAME
5a0e4aec 6491 portName=br0
50b9699f 6492PORTNAME
5a0e4aec 6493 portName=br0
50b9699f 6494PORTNAME
5a0e4aec 6495 portName=p1
50b9699f 6496PORTNAME
5a0e4aec 6497 portName=p1
50b9699f 6498PORTNAME
5a0e4aec 6499 portName=p2
50b9699f 6500PORTNAME
5a0e4aec 6501 portName=p2
4819b3a5 6502])])
17f7f7e0 6503
aaca4fe0
WT
6504AT_SETUP([ofproto-dpif - basic truncate action])
6505OVS_VSWITCHD_START
6506add_of_ports br0 1 2 3 4 5
6507
6508AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
6509AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
6510AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
6511AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
6512AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
6513
6514AT_DATA([flows.txt], [dnl
6515in_port=3,actions=drop
6516in_port=5,actions=drop
6517in_port=1,actions=output(port=2,max_len=64),output:4
6518])
6519AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6520
6521dnl Datapath actions
6522AT_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])
6523AT_CHECK([tail -1 stdout], [0],
6524[Datapath actions: trunc(64),2,4
6525])
6526
6527dnl An 170 byte packet
6528AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6529
6530AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
6531icmp,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
6532])
6533
6534AT_CHECK([ovs-appctl revalidator/purge], [0])
6535dnl packet with truncated size
6536AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6537n_bytes=64
6538])
6539dnl packet with original size
6540AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6541n_bytes=170
6542])
6543
6544dnl More complicated case
6545AT_CHECK([ovs-ofctl del-flows br0])
6546AT_DATA([flows.txt], [dnl
6547in_port=3,actions=drop
6548in_port=5,actions=drop
6549in_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
6550])
6551AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6552
6553dnl Datapath actions
6554AT_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])
6555AT_CHECK([tail -1 stdout], [0],
6556[Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
6557])
6558
6559dnl An 170 byte packet
6560AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6561
6562AT_CHECK([ovs-appctl revalidator/purge], [0])
6563dnl packet size: 64 + 128 + 170 = 362
6564AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6565n_bytes=362
6566])
6567dnl packet size: 60 + 170 = 230
6568AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6569n_bytes=230
6570])
6571
6572dnl syntax checking
6573AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
6574ovs-ofctl: output to unsupported truncate port: ALL
6575])
6576
6577OVS_VSWITCHD_STOP
6578AT_CLEANUP
6579
6580AT_SETUP([ofproto-dpif - truncate and output to patch port])
6581OVS_VSWITCHD_START([add-br br1 \
6582-- set bridge br1 datapath-type=dummy fail-mode=secure \
6583-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 ofport_request=1 \
6584-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6585
6586add_of_ports br0 2
6587
6588AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
6589AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
6590
6591AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6592[0], [stdout])
6593AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
6594])
6595dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
2d9b49dd 6596AT_CHECK([grep "output_trunc does not support patch port [[0-9]]*" stdout], [0], [stdout])
aaca4fe0
WT
6597
6598OVS_VSWITCHD_STOP
6599AT_CLEANUP
6600
6601AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
6602OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6603 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6604 options:key=5 ofport_request=1\
6605 -- add-port br0 p2 -- set Interface p2 type=dummy \
6606 ofport_request=2])
6607AT_DATA([flows.txt], [dnl
6608actions=output(max_len=100, port=1)
6609])
6610OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6611AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6612
6613AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
6614 br0 65534/100: (dummy-internal)
6615 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
6616 p2 2/2: (dummy)
aaca4fe0
WT
6617])
6618
6619dnl Basic
6620AT_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])
6621AT_CHECK([tail -1 stdout], [0],
6622 [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
6623])
6624
6625OVS_VSWITCHD_STOP
6626AT_CLEANUP
6627
4819b3a5
BP
6628AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
6629CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
6630AT_CLEANUP
6631
6632AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
6633AT_SKIP_IF([test $HAVE_IPV6 = no])
6634CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
6635AT_CLEANUP
1e04fcc8 6636
50b9699f 6637dnl Test sFlow LAG structures
7321bda3 6638AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
80ee73d3 6639AT_SKIP_IF([test "$IS_WIN32" = "yes"])
50b9699f 6640OVS_VSWITCHD_START([dnl
5a0e4aec
BP
6641 add-bond br0 bond p1 p2 -- \
6642 set Port bond lacp=active bond-mode=active-backup \
6643 other_config:lacp-time="fast" \
6644 other_config:lacp-system-id=11:22:33:44:55:66 \
6645 other_config:lacp-system-priority=54321 -- \
6646 set Interface p1 type=dummy \
6647 other_config:lacp-port-id=11 \
6648 other_config:lacp-port-priority=111 \
6649 other_config:lacp-aggregation-key=3333 -- \
6650 set Interface p2 type=dummy \
6651 other_config:lacp-port-id=22 \
6652 other_config:lacp-port-priority=222 \
6653 other_config:lacp-aggregation-key=3333 ])
50b9699f 6654
53eb8cb8 6655on_exit 'kill `cat test-sflow.pid`'
50b9699f
NM
6656AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6657AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6658PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
50b9699f
NM
6659
6660ovs-appctl time/stop
6661
6662ovs-vsctl \
5a0e4aec
BP
6663 set Interface p1 options:ifindex=1003 -- \
6664 set Bridge br0 sflow=@sf -- \
6665 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
96657459 6666 header=128 sampling=1 polling=1 agent=127.0.0.1
50b9699f
NM
6667
6668dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
cea4a6d7
JS
6669AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
6670AT_CHECK([ovs-appctl revalidator/purge], [0])
7bb5820b 6671OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
d9c8c57c 6672OVS_APP_EXIT_AND_WAIT([test-sflow])
50b9699f 6673AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
5a0e4aec 6674 /g']], [0], [dnl
50b9699f 6675LACPCOUNTERS
5a0e4aec
BP
6676 sysID=11:22:33:44:55:66
6677 partnerID=00:00:00:00:00:00
6678 aggID=3333
6679 actorAdmin=0x7
6680 actorOper=0xbf
6681 partnerAdmin=0x0
6682 partnerOper=0x2
6683 LACPDUsRx=0
6684 markerPDUsRx=4294967295
6685 markerRespPDUsRx=4294967295
6686 unknownRx=4294967295
6687 illegalRx=0
6688 LACPDUsTx=1
6689 markerPDUsTx=4294967295
6690 markerRespPDUsTx=4294967295
50b9699f
NM
6691])
6692
6693AT_CLEANUP
6694
7321bda3
NM
6695AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
6696AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6697OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6698
6699dnl set up sFlow logging
7321bda3
NM
6700AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6701AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6702PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
6703ovs-appctl time/stop
6704
6705OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6706AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
5a0e4aec 6707 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
7321bda3
NM
6708AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
6709
6710AT_CHECK([ovs-ofctl add-flow br0 action=3])
6711
6712dnl enable sflow
6713ovs-vsctl \
6714 set Bridge br0 sflow=@sf -- \
96657459 6715 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7321bda3
NM
6716 header=128 sampling=1 polling=0
6717
6718dnl introduce a packet that will be flooded to the tunnel
6719AT_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)'])
6720
6721dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6722for i in `seq 1 30`; do
6723 ovs-appctl time/warp 100
6724done
6725
d9c8c57c 6726OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
6727
6728AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5a0e4aec 6729 /g']], [0], [dnl
7321bda3 6730HEADER
5a0e4aec
BP
6731 dgramSeqNo=1
6732 ds=127.0.0.1>2:1000
6733 fsSeqNo=1
6734 tunnel4_out_length=0
6735 tunnel4_out_protocol=47
6736 tunnel4_out_src=0.0.0.0
6737 tunnel4_out_dst=1.1.1.1
6738 tunnel4_out_src_port=0
6739 tunnel4_out_dst_port=0
6740 tunnel4_out_tcp_flags=0
6741 tunnel4_out_tos=1
6742 tunnel_out_vni=456
6743 in_vlan=0
6744 in_priority=0
6745 out_vlan=0
6746 out_priority=0
6747 meanSkip=1
6748 samplePool=1
6749 dropEvents=0
6750 in_ifindex=0
6751 in_format=0
6752 out_ifindex=1
6753 out_format=2
6754 hdr_prot=1
6755 pkt_len=110
6756 stripped=4
6757 hdr_len=106
6758 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-08-00-45-01-00-5C-00-00-00-00-80-01-12-8A-0A-0A-0A-02-0A-0A-0A-01-08-00-13-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
7321bda3
NM
6759])
6760
7bb5820b 6761OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
7321bda3
NM
6762AT_CLEANUP
6763
6764AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
6765AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6766
6767OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
6768
6769dnl set up sFlow logging
7321bda3
NM
6770AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6771AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6772PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
6773ovs-appctl time/stop
6774
6775AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6776AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
6777AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
6778 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
d14a36f4
BP
6779 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
6780 options:ifindex=2011 ofport_request=5
7321bda3
NM
6781 ], [0])
6782
6783AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6784dummy@ovs-dummy: hit:0 missed:0
7be29a47
BP
6785 br0:
6786 br0 65534/100: (dummy-internal)
6787 p0 1/1: (dummy: ifindex=1010)
6788 int-br:
6789 int-br 65534/2: (dummy-internal)
6790 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
6791 vm1 5/3: (dummy: ifindex=2011)
7321bda3
NM
6792])
6793
6794dnl set up route to 1.1.2.92 via br0 and action=normal
7321bda3
NM
6795AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
6796])
a8704b50
PS
6797AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
6798])
7321bda3
NM
6799AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6800
6801dnl Prime ARP Cache for 1.1.2.92
283d8662 6802AT_CHECK([ovs-appctl netdev-dummy/receive p0 'recirc_id(0),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
7321bda3
NM
6803
6804dnl configure sflow on int-br only
6805ovs-vsctl \
6806 set Bridge int-br sflow=@sf -- \
96657459 6807 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7321bda3
NM
6808 header=128 sampling=1 polling=0
6809
a8704b50
PS
6810dnl set up route to 192.168.1.2 via br0
6811AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
6812])
6813AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
6814])
6815
7321bda3
NM
6816dnl add rule for int-br to force packet onto tunnel. There is no ifindex
6817dnl for this port so the sFlow output will just report that it went to
6818dnl 1 output (out_format=2, out_ifindex=1)
6819AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
6820
6821AT_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)'])
6822
6823dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6824for i in `seq 1 30`; do
6825 ovs-appctl time/warp 100
6826done
6827
d9c8c57c 6828OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
6829
6830AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5a0e4aec 6831 /g']], [0], [dnl
7321bda3 6832HEADER
5a0e4aec
BP
6833 dgramSeqNo=1
6834 ds=127.0.0.1>2:1000
6835 fsSeqNo=1
6836 tunnel4_out_length=0
6837 tunnel4_out_protocol=47
6838 tunnel4_out_src=1.1.2.88
6839 tunnel4_out_dst=1.1.2.92
6840 tunnel4_out_src_port=0
6841 tunnel4_out_dst_port=0
6842 tunnel4_out_tcp_flags=0
6843 tunnel4_out_tos=0
6844 tunnel_out_vni=456
6845 in_vlan=0
6846 in_priority=0
6847 out_vlan=0
6848 out_priority=0
6849 meanSkip=1
6850 samplePool=1
6851 dropEvents=0
6852 in_ifindex=2011
6853 in_format=0
6854 out_ifindex=1
6855 out_format=2
6856 hdr_prot=1
6857 pkt_len=110
6858 stripped=4
6859 hdr_len=106
6860 hdr=50-54-00-00-00-0A-50-54-00-00-00-05-08-00-45-00-00-5C-00-00-00-00-80-01-B6-4D-C0-A8-01-01-C0-A8-02-02-08-00-13-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
7321bda3
NM
6861])
6862
7bb5820b 6863OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
7321bda3
NM
6864AT_CLEANUP
6865
6866AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
7ad705c6 6867AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
7321bda3
NM
6868OVS_VSWITCHD_START
6869AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6870add_of_ports br0 1 2
7321bda3
NM
6871AT_DATA([flows.txt], [dnl
6872table=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
6873table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6874])
6875AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6876
6877dnl set up sFlow logging
7321bda3
NM
6878AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6879AT_CAPTURE_FILE([sflow.log])
fb28ef2d 6880PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
6881ovs-appctl time/stop
6882
6883dnl configure sflow
6884ovs-vsctl \
6885 set Bridge br0 sflow=@sf -- \
96657459 6886 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
7321bda3
NM
6887 header=128 sampling=1 polling=0
6888
6889AT_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)'])
6890AT_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)'])
6891
6892dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6893for i in `seq 1 30`; do
6894 ovs-appctl time/warp 100
6895done
6896
d9c8c57c 6897OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
6898
6899AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5a0e4aec 6900 /g']], [0], [dnl
7321bda3 6901HEADER
5a0e4aec
BP
6902 dgramSeqNo=1
6903 ds=127.0.0.1>2:1000
6904 fsSeqNo=1
6905 mpls_label_0=789
6906 mpls_tc_0=4
6907 mpls_ttl_0=32
6908 mpls_bos_0=0
6909 mpls_label_1=11
6910 mpls_tc_1=3
6911 mpls_ttl_1=64
6912 mpls_bos_1=1
6913 in_vlan=0
6914 in_priority=0
6915 out_vlan=0
6916 out_priority=0
6917 meanSkip=1
6918 samplePool=1
6919 dropEvents=0
6920 in_ifindex=0
6921 in_format=0
6922 out_ifindex=1
6923 out_format=2
6924 hdr_prot=1
6925 pkt_len=22
6926 stripped=4
6927 hdr_len=18
6928 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40
7321bda3 6929HEADER
5a0e4aec
BP
6930 dgramSeqNo=1
6931 ds=127.0.0.1>2:1000
6932 fsSeqNo=2
6933 mpls_label_0=789
6934 mpls_tc_0=4
6935 mpls_ttl_0=32
6936 mpls_bos_0=1
6937 in_vlan=0
6938 in_priority=0
6939 out_vlan=0
6940 out_priority=0
6941 meanSkip=1
6942 samplePool=2
6943 dropEvents=0
6944 in_ifindex=0
6945 in_format=0
6946 out_ifindex=1
6947 out_format=2
6948 hdr_prot=1
6949 pkt_len=38
6950 stripped=4
6951 hdr_len=34
6952 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
6953])
6954
7bb5820b 6955OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
7321bda3
NM
6956AT_CLEANUP
6957
6958
4819b3a5 6959# CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
6960#
6961# Test that basic NetFlow reports flow statistics correctly:
6962# The initial packet of a flow are correctly accounted.
6963# Later packets within a flow are correctly accounted.
6964# Flow actions changing (in this case, due to MAC learning)
6965# cause a record to be sent.
e731d71b 6966m4_define([CHECK_NETFLOW_EXPIRATION],
4819b3a5 6967 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 6968 add_of_ports br0 1 2
e731d71b
AS
6969
6970 ovs-appctl time/stop
53eb8cb8 6971 on_exit 'kill `cat test-netflow.pid`'
eadd1644 6972 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 6973 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 6974 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
6975
6976 ovs-vsctl \
6977 set Bridge br0 netflow=@nf -- \
6978 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6979 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6980
6981 for delay in 1000 30000; do
6982 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 6983 sleep 1 # ensure the order in which these two packets are processed
e731d71b
AS
6984 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)'
6985
6986 ovs-appctl time/warp $delay
6987 done
17f7f7e0 6988
e731d71b 6989 ovs-appctl time/warp 6000
27f57736 6990 ovs-appctl revalidator/wait
e731d71b 6991 OVS_VSWITCHD_STOP
d9c8c57c 6992 OVS_APP_EXIT_AND_WAIT([test-netflow])
e79a6c83 6993
6f068379 6994 AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 106 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
e79a6c83 6995
6f068379 6996 AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 2, 1 pkts, 106 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
e79a6c83 6997
6f068379
BP
6998 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 212 bytes, ICMP 0:0" netflow.log | wc -l`
6999 separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 106 bytes, ICMP 0:0" netflow.log | wc -l`
4819b3a5 7000 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
17f7f7e0 7001
4819b3a5
BP
7002AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
7003CHECK_NETFLOW_EXPIRATION([127.0.0.1])
7004AT_CLEANUP
17f7f7e0 7005
4819b3a5
BP
7006AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
7007AT_SKIP_IF([test $HAVE_IPV6 = no])
7008CHECK_NETFLOW_EXPIRATION([[[::1]]])
7009AT_CLEANUP
1e04fcc8 7010
4819b3a5 7011# CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
7012#
7013# Test that basic NetFlow reports active expirations correctly.
e731d71b 7014m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
4819b3a5 7015 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 7016 add_of_ports br0 1 2
17f7f7e0 7017
53eb8cb8 7018 on_exit 'kill `cat test-netflow.pid`'
eadd1644 7019 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 7020 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 7021 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
17f7f7e0 7022
e731d71b
AS
7023 ovs-vsctl \
7024 set Bridge br0 netflow=@nf -- \
7025 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
7026 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
17f7f7e0 7027
e731d71b
AS
7028 AT_CHECK([ovs-appctl time/stop])
7029 n=1
7030 while test $n -le 60; do
7031 n=`expr $n + 1`
17f7f7e0 7032
e731d71b
AS
7033 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)'
7034 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 7035
e731d71b
AS
7036 ovs-appctl time/warp 1000
7037 done
17f7f7e0 7038
e731d71b
AS
7039 ovs-appctl time/warp 10000
7040
27f57736 7041 ovs-appctl revalidator/wait
e731d71b 7042 OVS_VSWITCHD_STOP
d9c8c57c 7043 OVS_APP_EXIT_AND_WAIT([test-netflow])
e731d71b
AS
7044
7045 # Count the number of reported packets:
7046 # - From source to destination before MAC learning kicks in (just one).
7047 # - From source to destination after that.
7048 # - From destination to source.
7049 n_learn=0
7050 n_in=0
7051 n_out=0
7052 n_other=0
7053 n_recs=0
7054 none=0
7055 while read line; do
7056 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
7057 case $pkts in
7058 [[0-9]]*) ;;
7059 *) continue ;;
7060 esac
7061
7062 case $line in
7063 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
7064 counter=n_learn
7065 ;;
7066 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
7067 counter=n_in
7068 ;;
7069 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
7070 counter=n_out
7071 ;;
7072 *)
7073 counter=n_other
7074 ;;
7075 esac
7076 eval $counter=\`expr \$$counter + \$pkts\`
7077 n_recs=`expr $n_recs + 1`
7078 done < netflow.log
7079
7080 # There should be exactly 1 MAC learning packet,
7081 # exactly 59 other packets in that direction,
7082 # and exactly 60 packets in the other direction.
7083 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
4819b3a5 7084])])
e731d71b 7085
4819b3a5
BP
7086AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
7087CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
7088AT_CLEANUP
e731d71b 7089
4819b3a5
BP
7090AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
7091AT_SKIP_IF([test $HAVE_IPV6 = no])
7092CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
7093AT_CLEANUP
f27f2134 7094
3d198ea5 7095dnl In the absence of an IPFIX collector to verify protocol correctness, simply
fb8f22c1 7096dnl configure bridge IPFIX and ensure that sample action generation works at the
3d198ea5 7097dnl datapath level.
fb8f22c1 7098AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
3d198ea5 7099OVS_VSWITCHD_START
ca5792f0 7100add_of_ports br0 1 2
3d198ea5 7101
fb8f22c1 7102dnl Sample every packet using bridge-based sampling.
3d198ea5
JS
7103AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7104 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7105 sampling=1], [0], [ignore])
7106
fb8f22c1 7107dnl Send some packets that should be sampled.
3d198ea5
JS
7108for i in `seq 1 3`; do
7109 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)'])
7110done
7111AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 7112flow-dump from the main thread:
72471622 7113packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))
3d198ea5
JS
7114])
7115
31b29c2e
AZ
7116AT_CHECK([ovs-appctl revalidator/purge])
7117dnl
7118dnl Add a slowpath meter. The userspace action should be metered.
7119AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])
7120
7121dnl Send some packets that should be sampled and metered.
7122for i in `seq 1 3`; do
7123 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)'])
7124done
7125AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 7126flow-dump from the main thread:
31b29c2e
AZ
7127packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))
7128])
7129
fb8f22c1 7130dnl Remove the IPFIX configuration.
3d198ea5
JS
7131AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7132AT_CHECK([ovs-appctl revalidator/purge])
7133
7134dnl Send some more packets, to ensure that these are not sampled.
7135for i in `seq 1 3`; do
7136 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)'])
7137done
7138AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 7139flow-dump from the main thread:
efe179e0 7140packets:2, bytes:68, used:0.001s, actions:drop
3d198ea5
JS
7141])
7142
7143OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7144AT_CLEANUP
7145
fb8f22c1
BY
7146dnl Bridge IPFIX statistics check
7147AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
7148OVS_VSWITCHD_START
7149add_of_ports br0 1 2
7150
7151dnl Negative test check.
7152AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7153OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7154NXST_IPFIX_BRIDGE request (xid=0x2):
7155])
7156
7157dnl Sample every packet using bridge-based sampling.
7158AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7159 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7160 sampling=1], [0], [ignore])
7161
7162dnl Send some packets that should be sampled.
7163for i in `seq 1 20`; do
7164 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)'])
7165done
7166
7167dnl There are 4 extra IPFIX template packets.
266f8e62 7168AT_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 7169NXST_IPFIX_BRIDGE reply (xid=0x2):
266f8e62
BY
7170 bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7171 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
fb8f22c1
BY
7172])
7173
7174dnl Remove the IPFIX configuration.
7175AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7176AT_CHECK([ovs-appctl revalidator/purge])
7177
7178dnl Send some more packets, to ensure that these are not sampled.
7179for i in `seq 1 2`; do
7180 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)'])
7181done
7182AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7183OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7184NXST_IPFIX_BRIDGE request (xid=0x2):
7185])
7186
7187OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7188AT_CLEANUP
7189
7190dnl Flow IPFIX sanity check
7191AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
7192OVS_VSWITCHD_START
7193add_of_ports br0 1 2
7194
cbef684c
BP
7195# Check for regression against a bug where an invalid target caused an
7196# assertion failure and a crash.
7197AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7198 -- --id=@ipfix create IPFIX targets=\"xyzzy\" \
7199 -- --id=@cs create Flow_Sample_Collector_Set id=0 bridge=@br0 ipfix=@ipfix],
7200 [0], [ignore])
7201
fb8f22c1
BY
7202AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7203 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7204 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7205 [0], [ignore])
7206
7207AT_DATA([flows.txt], [dnl
7208in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7209])
7210
7211AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7212
7213dnl Send some packets that should be sampled.
7214for i in `seq 1 3`; do
7215 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)'])
7216done
7217AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 7218flow-dump from the main thread:
72471622 7219packets: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
7220])
7221
7222dnl Remove the flow which contains sample action.
7223AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7224AT_CHECK([ovs-appctl revalidator/purge])
7225
7226dnl Send some more packets, to ensure that these are not sampled.
7227for i in `seq 1 3`; do
7228 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)'])
7229done
7230AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
138d30a9 7231flow-dump from the main thread:
efe179e0 7232packets:2, bytes:68, used:0.001s, actions:drop
fb8f22c1
BY
7233])
7234
cbef684c
BP
7235OVS_VSWITCHD_STOP(["/sending to collector failed/d
7236/xyzzy/d
7237/no collectors/d"])
fb8f22c1
BY
7238AT_CLEANUP
7239
f69f713b
BY
7240dnl Flow IPFIX sanity check for tunnel set
7241AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
f69f713b
BY
7242OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
7243 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
7244 options:key=5 ofport_request=1\
7245 -- add-port br0 p2 -- set Interface p2 type=stt \
7246 options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
7247 options:key=6 ofport_request=2\
7248 -- add-port br0 p3 -- set Interface p3 type=dummy \
7249 ofport_request=3 \
7250 -- --id=@br0 get Bridge br0 \
7251 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7252 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7253 [<0>
7254<1>
7255])
7256
7257OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
7258
7259dnl Add openflow sample action without sampling_port.
7260AT_DATA([flows.txt], [dnl
7261in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
7262])
7263AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7264
7265AT_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])
7266AT_CHECK([tail -1 stdout], [0], [dnl
72471622 7267Datapath 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
7268])
7269
7270dnl Remove the flow which contains sample action.
7271AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7272AT_CHECK([ovs-appctl revalidator/purge])
7273
7274dnl Add openflow sample action with sampling_port which is
7275dnl equal to output port.
7276AT_DATA([flows2.txt], [dnl
7277in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
7278])
7279AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
7280
7281AT_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])
7282dnl Make sure flow sample action in datapath is behind set tunnel
7283dnl action at egress point of tunnel port.
7284AT_CHECK([tail -1 stdout], [0], [dnl
72471622 7285Datapath 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
7286])
7287
7288dnl Remove the flow which contains sample action.
7289AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7290AT_CHECK([ovs-appctl revalidator/purge])
7291
7292dnl Add a rule with two sample actions and each sample action
7293dnl has a sampling_port
7294AT_DATA([flows3.txt], [dnl
7295in_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
7296])
7297AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
7298
7299AT_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])
7300dnl Make sure flow sample action in datapath is behind set tunnel
7301dnl action at egress point of tunnel port.
7302AT_CHECK([tail -1 stdout], [0], [dnl
72471622 7303Datapath 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
7304])
7305
7306dnl Remove the flow which contains sample action.
7307AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7308AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7309
7310OVS_VSWITCHD_STOP
7311AT_CLEANUP
7312
7ae62a67
WT
7313AT_SETUP([ofproto-dpif - clone action])
7314OVS_VSWITCHD_START
7315add_of_ports br0 1 2 3 4
7316
eee69393 7317dnl Reversible open flow clone actions, no datapath clone action should be generated.
7ae62a67
WT
7318AT_DATA([flows.txt], [dnl
7319in_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
7320])
7321AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7322
7323AT_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])
7324
bef503e8 7325AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7326Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4
bef503e8
AZ
7327])
7328
7329dnl Test flow xlate openflow clone action without using datapath clone action.
ce15b514 7330AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
bef503e8
AZ
7331
7332AT_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])
7333
7ae62a67 7334AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7335Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4
7ae62a67
WT
7336])
7337
9c2a44dc
AZ
7338AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7339AT_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])
7340
7341AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7342Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4
9c2a44dc
AZ
7343])
7344
eee69393
AZ
7345dnl Mixing reversible and irreversible open flow clone actions. Datapath clone action
7346dnl should be generated when necessary.
7347
7348dnl Restore the datapath support level.
7349AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone true], [0], [])
7350AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 10], [0], [])
7351
7352AT_DATA([flows.txt], [dnl
7353in_port=1, ip, actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(ct(commit),output:3),output:4
7354])
7355AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7356
7357AT_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])
7358
7359AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7360Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),clone(ct(commit),3),4
eee69393
AZ
7361])
7362
7363AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7364
7365AT_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])
7366
7367AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7368Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),sample(sample=100.0%,actions(ct(commit),3)),4
eee69393
AZ
7369])
7370
7371AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7372AT_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])
7373
7374AT_CHECK([tail -1 stdout], [0], [dnl
dbf4a928 7375Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),4
eee69393
AZ
7376])
7377AT_CHECK([grep "Failed to compose clone action" stdout], [0], [ignore])
7378
7ae62a67
WT
7379OVS_VSWITCHD_STOP
7380AT_CLEANUP
7381
fb8f22c1
BY
7382dnl Flow based IPFIX statistics check
7383AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
7384OVS_VSWITCHD_START
7385add_of_ports br0 1 2
7386
7387dnl Negative test check.
7388AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7389OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7390NXST_IPFIX_FLOW request (xid=0x2):
7391])
7392
7393AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7394 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7395 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7396 [0], [ignore])
7397
7398AT_DATA([flows.txt], [dnl
7399in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7400])
7401
7402AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7403
7404dnl Send some packets that should be sampled.
7405for i in `seq 1 20`; do
7406 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)'])
7407done
7408
7409dnl There are 4 extra IPFIX template packets.
266f8e62 7410AT_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 7411NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
266f8e62
BY
7412 id 1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7413 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
fb8f22c1
BY
7414])
7415
7416dnl Remove the flow which contains sample action.
7417AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7418AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7419AT_CHECK([ovs-appctl revalidator/purge])
7420
7421dnl Send some more packets, to ensure that these are not sampled.
7422for i in `seq 1 3`; do
7423 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)'])
7424done
7425AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7426OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7427NXST_IPFIX_FLOW request (xid=0x2):
7428])
7429
7430OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7431AT_CLEANUP
7432
23a7d252
JS
7433AT_SETUP([ofproto-dpif - flow stats])
7434OVS_VSWITCHD_START
7435AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7436AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7437
7438ovs-appctl time/stop
7439
7440for i in `seq 1 10`; do
7441 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)'
7442done
7443
cea4a6d7
JS
7444AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7445AT_CHECK([ovs-appctl revalidator/purge], [0])
e96a5c24 7446AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 7447AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
e96a5c24 7448 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6f068379 7449 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
e96a5c24
JS
7450])
7451OVS_VSWITCHD_STOP
7452AT_CLEANUP
8b6987d7
JR
7453
7454AT_SETUP([ofproto-dpif - flow stats reset_counts])
7455OVS_VSWITCHD_START
7456flow="ip,actions=NORMAL"
7457
7458ovs-appctl time/stop
7459
7460AT_CHECK([ovs-ofctl add-flow br0 $flow])
7461
7462warp_and_dump_NXM () {
7463 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7464 AT_CHECK([ovs-appctl revalidator/purge], [0])
7465
7466 AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0], [0], [stdout])
7467 if [[ $5 -gt 0 ]]; then
7468 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, hard_age=$5, ip actions=NORMAL"
7469 else
7470 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, ip actions=NORMAL"
7471 fi
7472 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7473$expected
7474])
7475}
7476
7477warp_and_dump_OF () {
7478 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7479 AT_CHECK([ovs-appctl revalidator/purge], [0])
7480
7481 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0], [0], [stdout])
7482 if [[ $1 -lt 13 -o "$5X" = "X" ]]; then
7483 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, ip actions=NORMAL"
7484 else
7485 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $5 ip actions=NORMAL"
7486 fi
7487 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7488$expected
7489])
7490}
7491
7492send_packet () {
7493 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)'
7494}
7495
7496# OpenFlow 1.0, implicit reset_counts
7497send_packet
6f068379 7498warp_and_dump_NXM 1 1 118 1
8b6987d7
JR
7499AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 add-flow br0 $flow])
7500# add-flow resets duration and counts,
7501# but idle age is inherited from the old flow
7502warp_and_dump_NXM 1 0 0 2
7503
7504send_packet
6f068379 7505warp_and_dump_NXM 2 1 118 1
8b6987d7
JR
7506AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 mod-flows br0 $flow])
7507# mod-flows resets hard_age, but not counts
7508# but duration and idle_age is inherited from the old flow
6f068379 7509warp_and_dump_NXM 3 1 118 2 1
8b6987d7
JR
7510
7511# OpenFlow 1.1, implicit reset_counts
7512send_packet
6f068379 7513warp_and_dump_OF 11 4 2 236
8b6987d7
JR
7514AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 add-flow br0 $flow])
7515# add-flow resets duration and counts,
7516# but idle age is inherited from the old flow
7517warp_and_dump_NXM 1 0 0 2
7518warp_and_dump_OF 11 2 0 0
7519
7520send_packet
6f068379 7521warp_and_dump_OF 11 3 1 118
8b6987d7
JR
7522AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 mod-flows br0 $flow])
7523# mod-flows resets hard_age, but not counts
7524# but duration and idle_age is inherited from the old flow
6f068379
BP
7525warp_and_dump_NXM 4 1 118 2 1
7526warp_and_dump_OF 11 5 1 118
8b6987d7
JR
7527
7528# OpenFlow 1.2, explicit reset_counts
7529send_packet
6f068379 7530warp_and_dump_OF 12 6 2 236
8b6987d7
JR
7531AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 $flow])
7532# add-flow without flags resets duration, but not counts,
7533# idle age is inherited from the old flow
6f068379
BP
7534warp_and_dump_NXM 1 2 236 2
7535warp_and_dump_OF 12 2 2 236
8b6987d7
JR
7536
7537send_packet
6f068379 7538warp_and_dump_OF 12 3 3 354
8b6987d7
JR
7539AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 $flow])
7540# mod-flows without flags does not reset duration nor counts,
7541# idle age is inherited from the old flow
6f068379
BP
7542warp_and_dump_NXM 4 3 354 2 1
7543warp_and_dump_OF 12 5 3 354
8b6987d7
JR
7544
7545send_packet
6f068379 7546warp_and_dump_OF 12 6 4 472
8b6987d7
JR
7547AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 reset_counts,$flow])
7548# add-flow with reset_counts resets both duration and counts,
7549# idle age is inherited from the old flow
7550warp_and_dump_NXM 1 0 0 2
7551warp_and_dump_OF 12 2 0 0
7552
7553send_packet
6f068379 7554warp_and_dump_OF 12 3 1 118
8b6987d7
JR
7555AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 reset_counts,$flow])
7556# mod-flows with reset_counts resets counts, but not duration,
7557# idle age is inherited from the old flow
7558warp_and_dump_NXM 4 0 0 2 1
7559warp_and_dump_OF 12 5 0 0
7560
7561# OpenFlow > 1.3, explicit reset_counts
7562flow_mods_reset_counts () {
7563 # Reset to a known state
7564 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7565
7566 send_packet
6f068379 7567 warp_and_dump_OF $1 1 1 118 reset_counts
8b6987d7
JR
7568 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7569 # add-flow without flags resets duration, but not counts,
7570 # idle age is inherited from the old flow
6f068379
BP
7571 warp_and_dump_NXM 1 1 118 2
7572 warp_and_dump_OF $1 2 1 118
8b6987d7
JR
7573
7574 send_packet
6f068379 7575 warp_and_dump_OF $1 3 2 236
8b6987d7
JR
7576 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7577 # mod-flows without flags does not reset duration nor counts,
7578 # idle age is inherited from the old flow
6f068379
BP
7579 warp_and_dump_NXM 4 2 236 2 1
7580 warp_and_dump_OF $1 5 2 236
8b6987d7
JR
7581
7582 send_packet
6f068379 7583 warp_and_dump_OF $1 6 3 354
8b6987d7
JR
7584 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7585 # add-flow with reset_counts resets both duration and counts,
7586 # idle age is inherited from the old flow
7587 warp_and_dump_NXM 1 0 0 2
7588 warp_and_dump_OF $1 2 0 0 reset_counts
7589
7590 send_packet
6f068379 7591 warp_and_dump_OF $1 3 1 118 reset_counts
8b6987d7
JR
7592 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7593 # mod-flows with reset_counts resets counts, but not duration,
7594 # idle age is inherited from the old flow
7595 warp_and_dump_NXM 4 0 0 2 1
7596 warp_and_dump_OF $1 5 0 0 reset_counts
7597
7598 # Modify flow having reset_counts flag without reset_counts
7599 send_packet
6f068379 7600 warp_and_dump_OF $1 6 1 118 reset_counts
8b6987d7 7601 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
6f068379
BP
7602 warp_and_dump_NXM 7 1 118 2 1
7603 warp_and_dump_OF $1 8 1 118 reset_counts
8b6987d7
JR
7604
7605 # Add flow having reset_counts flag without reset_counts
7606 send_packet
6f068379 7607 warp_and_dump_OF $1 9 2 236 reset_counts
8b6987d7 7608 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
6f068379
BP
7609 warp_and_dump_NXM 1 2 236 2
7610 warp_and_dump_OF $1 2 2 236
8b6987d7
JR
7611
7612 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7613 send_packet
6f068379 7614 warp_and_dump_OF $1 3 3 354
8b6987d7
JR
7615 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7616 warp_and_dump_NXM 4 0 0 2 1
7617 warp_and_dump_OF $1 5 0 0
7618}
7619
7620# OpenFlow versions >= 1.3 should behave the same way
7621flow_mods_reset_counts 13
7622flow_mods_reset_counts 14
c7b02b80
S
7623
7624OVS_VSWITCHD_STOP
7625AT_CLEANUP
7626
7627AT_SETUP([ofproto-dpif - flow stats reset_counts OpenFlow1.5])
7628OVS_VSWITCHD_START
7629flow="ip,actions=NORMAL"
7630
7631ovs-appctl time/stop
7632
7633AT_CHECK([ovs-ofctl add-flow br0 $flow])
7634
7635warp_and_dump_OF () {
7636 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7637 AT_CHECK([ovs-appctl revalidator/purge], [0])
7638
7639 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0 ], [0], [stdout])
7640 if [[ "$6X" = "X" ]]; then
7641 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, idle_age=$5, ip actions=NORMAL"
7642 else
7643 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $6 idle_age=$5, ip actions=NORMAL"
7644 fi
7645 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7646$expected
7647])
7648}
7649
7650send_packet () {
7651 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)'
7652}
7653
7654# OpenFlow 1.5, explicit reset_counts
7655flow_mods_reset_counts () {
7656 # Reset to a known state
7657 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7658
7659 send_packet
7660 warp_and_dump_OF $1 1 1 118 1 reset_counts
7661 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7662 # add-flow without flags resets duration, but not counts,
7663 # idle age is inherited from the old flow
7664 warp_and_dump_OF $1 1 1 118 2
7665
7666 send_packet
7667 warp_and_dump_OF $1 2 2 236 1
7668 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7669 # mod-flows without flags does not reset duration nor counts,
7670 # idle age is inherited from the old flow
7671 warp_and_dump_OF $1 3 2 236 2
7672
7673 send_packet
7674 warp_and_dump_OF $1 4 3 354 1
7675 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7676 # add-flow with reset_counts resets both duration and counts,
7677 # idle age is inherited from the old flow
7678 warp_and_dump_OF $1 1 0 0 2 reset_counts
7679
7680 send_packet
7681 warp_and_dump_OF $1 2 1 118 1 reset_counts
7682 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7683 # mod-flows with reset_counts resets counts, but not duration,
7684 # idle age is inherited from the old flow
7685 warp_and_dump_OF $1 3 0 0 2 reset_counts
7686
7687 # Modify flow having reset_counts flag without reset_counts
7688 send_packet
7689 warp_and_dump_OF $1 4 1 118 1 reset_counts
7690 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7691 warp_and_dump_OF $1 5 1 118 2 reset_counts
7692
7693 # Add flow having reset_counts flag without reset_counts
7694 send_packet
7695 warp_and_dump_OF $1 6 2 236 1 reset_counts
7696 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7697 warp_and_dump_OF $1 1 2 236 2
7698
7699 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7700 send_packet
7701 warp_and_dump_OF $1 2 3 354 1
7702 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7703 warp_and_dump_OF $1 3 0 0 2
7704}
7705
7706# OpenFlow versions >= 1.3 should behave the same way
8b6987d7
JR
7707flow_mods_reset_counts 15
7708
7709OVS_VSWITCHD_STOP
7710AT_CLEANUP
e96a5c24 7711
c7b02b80 7712
e96a5c24
JS
7713AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
7714OVS_VSWITCHD_START
7715AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7716AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7717
7718ovs-appctl time/stop
7719
7720for i in `seq 1 10`; do
7721 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)'
7722done
7723
7724ovs-appctl time/warp 100
7725AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
7726ovs-appctl time/warp 1000
7727
23a7d252 7728AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 7729AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
23a7d252 7730 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6f068379 7731 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
23a7d252
JS
7732])
7733OVS_VSWITCHD_STOP
7734AT_CLEANUP
7735
5f5ebd4c 7736AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
f27f2134
BP
7737OVS_VSWITCHD_START
7738
7739# get_ages DURATION HARD IDLE
7740#
7741# Fetch the flow duration, hard age, and idle age into the variables
7742# whose names are given as arguments. Rounds DURATION down to the
7743# nearest integer. If hard_age doesn't appear in the output, sets
7744# HARD to "none". If idle_age doesn't appear in the output, sets IDLE
7745# to 0.
7746get_ages () {
7747 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7748
7749 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
7750 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
7751 AS_VAR_COPY([$1], [duration])
7752
7753 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
7754 if test X"$hard" = X; then
7755 hard=none
7756 else
7757 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
7758 fi
7759 AS_VAR_COPY([$2], [hard])
7760
7761 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
7762 if test X"$idle" = X; then
7763 idle=0
7764 else
7765 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
7766 fi
7767 AS_VAR_COPY([$3], [idle])
7768}
7769
7770# Add a flow and get its initial hard and idle age.
7771AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
7772get_ages duration1 hard1 idle1
7773
31ef9f51 7774ovs-appctl time/stop
f27f2134
BP
7775# Warp time forward by 10 seconds, then modify the flow's actions.
7776ovs-appctl time/warp 10000
7777get_ages duration2 hard2 idle2
7778AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
7779
7780# Warp time forward by 10 seconds.
7781ovs-appctl time/warp 10000
7782get_ages duration3 hard3 idle3
7783
7784# Warp time forward 10 more seconds, then pass some packets through the flow,
7785# then warp forward a few more times because idle times are only updated
7786# occasionally.
7787ovs-appctl time/warp 10000
7788ovs-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 7789ovs-appctl time/warp 3000 1000
c0526804 7790sleep 1
f27f2134
BP
7791get_ages duration4 hard4 idle4
7792
7793printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
7794printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
7795printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
7796
7797# Duration should increase steadily over time.
7798AT_CHECK([test $duration1 -lt $duration2])
7799AT_CHECK([test $duration2 -lt $duration3])
7800AT_CHECK([test $duration3 -lt $duration4])
7801
7802# Hard age should be "none" initially because it's the same as flow_duration,
7803# then it should increase.
7804AT_CHECK([test $hard1 = none])
7805AT_CHECK([test $hard2 = none])
7806AT_CHECK([test $hard3 != none])
7807AT_CHECK([test $hard4 != none])
7808AT_CHECK([test $hard3 -lt $hard4])
7809
7810# Idle age should increase from 1 to 2 to 3, then decrease.
7811AT_CHECK([test $idle1 -lt $idle2])
7812AT_CHECK([test $idle2 -lt $idle3])
7813AT_CHECK([test $idle3 -gt $idle4])
7814
7815# Check some invariant relationships.
7816AT_CHECK([test $duration1 = $idle1])
7817AT_CHECK([test $duration2 = $idle2])
7818AT_CHECK([test $duration3 = $idle3])
7819AT_CHECK([test $idle3 -gt $hard3])
7820AT_CHECK([test $idle4 -lt $hard4])
7821AT_CHECK([test $hard4 -lt $duration4])
7822
7823OVS_VSWITCHD_STOP
7824AT_CLEANUP
0e553d9c
BP
7825
7826AT_SETUP([ofproto-dpif - fin_timeout])
7827OVS_VSWITCHD_START
b5c1a5df 7828ovs-appctl time/stop
0e553d9c
BP
7829AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
7830AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7831[NXST_FLOW reply:
7832 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7833])
31ef9f51 7834
0e553d9c
BP
7835# Check that a TCP SYN packet does not change the timeout. (Because
7836# flow stats updates are mainly what implements the fin_timeout
7837# feature, we warp forward a couple of times to ensure that flow stats
7838# run before re-checking the flow table.)
323cc924 7839AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
0e553d9c
BP
7840AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7841warped
7842])
cea4a6d7 7843AT_CHECK([ovs-appctl revalidator/purge], [0])
0e553d9c
BP
7844AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7845[NXST_FLOW reply:
7846 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7847])
7848# Check that a TCP FIN packet does change the timeout.
323cc924 7849AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
0e553d9c
BP
7850AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7851warped
7852])
7853AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7854[NXST_FLOW reply:
7855 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
7856])
7857OVS_VSWITCHD_STOP
7858AT_CLEANUP
27022416
JP
7859
7860AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
7861OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
ca5792f0
BP
7862add_of_ports br0 1 2
7863add_of_ports br1 3
27022416
JP
7864
7865AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
7866dummy@br0
7867dummy@br1
7868])
7869OVS_VSWITCHD_STOP
7870AT_CLEANUP
7871
7872AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
e539ba87
IM
7873OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
7874 [--dummy-numa="0,0,0,0,1,1,1,1"])
7875add_pmd_of_ports br0 1 2
ca5792f0 7876add_of_ports br1 3
27022416 7877
e539ba87 7878AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
dc54ef36 7879dummy@ovs-dummy: hit:0 missed:0
7be29a47
BP
7880 br0:
7881 br0 65534/100: (dummy-internal)
7882 p1 1/1: (dummy-pmd: <cleared>)
7883 p2 2/2: (dummy-pmd: <cleared>)
7884 br1:
7885 br1 65534/101: (dummy-internal)
7886 p3 3/3: (dummy)
27022416
JP
7887])
7888OVS_VSWITCHD_STOP
7889AT_CLEANUP
7890
7891AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
054e5aa6 7892# bump max-idle to avoid the flows being reclaimed behind us
27022416 7893OVS_VSWITCHD_START([add-br br1 -- \
054e5aa6 7894 set bridge br1 datapath-type=dummy fail-mode=secure -- \
e539ba87
IM
7895 set Open_vSwitch . other_config:max-idle=10000], [], [],
7896 [--dummy-numa="0,0,0,0,1,1,1,1"])
7897add_of_ports br0 1
7898add_pmd_of_ports br0 2
ca5792f0 7899add_of_ports br1 3
27022416 7900
323cc924
BP
7901AT_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)'])
7902AT_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)'])
7903AT_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 7904ovs-appctl revalidator/wait
3a18d0c2 7905AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e
JS
7906recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7907recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
27022416
JP
7908])
7909
3a18d0c2 7910AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 7911recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
27022416
JP
7912])
7913
3a18d0c2 7914AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e
JS
7915skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
7916skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p2),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=0/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
04b541df
GS
7917])
7918
3a18d0c2 7919AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 7920skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
818650e6
JS
7921])
7922
7923OVS_VSWITCHD_STOP
7924AT_CLEANUP
7925
e539ba87
IM
7926m4_define([OFPROTO_DPIF_GET_FLOW],
7927 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
818650e6 7928
e539ba87
IM
7929 OVS_VSWITCHD_START([add-br br1 -- \
7930 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7931 set Open_vSwitch . other_config:max-idle=10000], [], [],
7932 [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
818650e6 7933
45a9c31d 7934 func=`printf '%s_' "$1" | cut -c 4-`
e539ba87
IM
7935 add_${func}of_ports br0 1 2
7936
7937 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)'])
7938 ovs-appctl revalidator/wait
7939 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
818650e6 7940
e539ba87
IM
7941 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
7942 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
3d4b2e6e 7943recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
04b541df
GS
7944])
7945
e539ba87
IM
7946 OVS_VSWITCHD_STOP
7947 AT_CLEANUP])
7948
7949OFPROTO_DPIF_GET_FLOW([])
7950OFPROTO_DPIF_GET_FLOW([ - pmd])
27022416 7951
50c1efc9 7952AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
8bfd0fda
BP
7953OVS_VSWITCHD_START([dnl
7954 add-port br0 p1 -- set Interface p1 type=dummy
7955])
623540e4 7956AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 7957on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
7958
7959AT_CAPTURE_FILE([ofctl_monitor.log])
7960AT_DATA([flows.txt], [dnl
7961dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 7962dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
7963])
7964AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7965
7966dnl Packet is sent to userspace because a MPLS push or pop action is applied to
47fb7f71 7967dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
8bfd0fda 7968dnl
47fb7f71 7969dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
8bfd0fda 7970dnl 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
7971dnl (label 20, exp 0, [S], ttl 32)
7972dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7973dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7974
7975for dl_src in 00 01; do
47fb7f71 7976 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
7977done
7978sleep 1 # wait for the datapath flow installed
2be3fe44 7979AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
74c4530d
JP
7980recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:00),eth_type(0x8847),mpls(label=20,tc=0,ttl=32,bos=0,label=20,tc=0,ttl=32,bos=1), actions:push_mpls(label=20,tc=0,ttl=32,bos=0,eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
7981recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:01),eth_type(0x8847),mpls(label=20/0x0,tc=0/0,ttl=32/0x0,bos=0/1,label=20/0xfffff,tc=0/7,ttl=32/0xff,bos=1/1), actions:pop_mpls(eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
8bfd0fda 7982])
8bfd0fda
BP
7983
7984OVS_VSWITCHD_STOP
7985AT_CLEANUP
7986
7987
50c1efc9 7988AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
8bfd0fda
BP
7989OVS_VSWITCHD_START([dnl
7990 add-port br0 p1 -- set Interface p1 type=dummy
7991])
623540e4 7992AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 7993on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
7994
7995AT_CAPTURE_FILE([ofctl_monitor.log])
7996AT_DATA([flows.txt], [dnl
7997dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 7998dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
7999])
8000AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8001
8002dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
f2c7be23 8003dnl 4 MPLS LSEs but ovs-vswitchd can only handle up to 3 MPLS LSEs and thus
47fb7f71 8004dnl can't determine the resulting MPLS label after MPLS push/pop actions.
8bfd0fda
BP
8005dnl
8006dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
8007dnl 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)
8008dnl (label 20, exp 0, ttl 32)
8009dnl (label 20, exp 0, ttl 32)
8010dnl (label 20, exp 0, [S], ttl 32)
8011dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
8012dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
8bfd0fda 8013
47fb7f71
JS
8014for dl_src in 00 01; do
8015 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
8016done
8017sleep 1 # wait for the datapath flow installed
2be3fe44 8018AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
74c4530d
JP
8019recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:00),eth_type(0x8847),mpls(label=20,tc=0,ttl=32,bos=0,label=20,tc=0,ttl=32,bos=1), actions:push_mpls(label=20,tc=0,ttl=32,bos=0,eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
8020recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:01),eth_type(0x8847),mpls(label=20/0x0,tc=0/0,ttl=32/0x0,bos=0/1,label=20/0xfffff,tc=0/7,ttl=32/0xff,bos=1/1), actions:pop_mpls(eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
8bfd0fda
BP
8021])
8022
8023OVS_VSWITCHD_STOP
8024AT_CLEANUP
8025
0a740f48
EJ
8026AT_SETUP([ofproto-dpif - patch ports])
8027OVS_VSWITCHD_START([add-br br1 \
8028-- set bridge br1 datapath-type=dummy fail-mode=secure \
8029-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
8030-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
8031
ca5792f0
BP
8032add_of_ports br0 2
8033add_of_ports br1 3
0a740f48 8034
64bb477f
JS
8035AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8036], [])
aef0491b 8037AT_CHECK([ovs-appctl time/stop])
623540e4 8038AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9fc0165a 8039
0a740f48
EJ
8040AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
8041AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
8042
8043for i in $(seq 1 10); do
8044 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
8045 if [[ $i -eq 1 ]]; then
8046 sleep 1
8047 fi
0a740f48
EJ
8048done
8049
8050for i in $(seq 1 5); do
8051 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
8052 if [[ $i -eq 1 ]]; then
8053 sleep 1
8054 fi
0a740f48
EJ
8055done
8056
0a8763fc
EJ
8057AT_CHECK([ovs-appctl time/warp 500], [0],
8058[warped
735d7efb 8059])
732207ad 8060sleep 1 # wait for log writer
735d7efb 8061
0a740f48 8062AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dc54ef36 8063dummy@ovs-dummy: hit:13 missed:2
7be29a47
BP
8064 br0:
8065 br0 65534/100: (dummy-internal)
8066 p2 2/2: (dummy)
8067 pbr0 1/none: (patch: peer=pbr1)
8068 br1:
8069 br1 65534/101: (dummy-internal)
8070 p3 3/3: (dummy)
8071 pbr1 1/none: (patch: peer=pbr0)
0a740f48
EJ
8072])
8073
2be3fe44 8074AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
8075recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
8076recirc_id(0),in_port(101),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
c2a77f33
JS
8077])
8078
2be3fe44 8079AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
6f068379 8080skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(100),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:9, bytes:954, used:0.0s, actions:101,3,2
c2a77f33 8081])
2be3fe44 8082AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
6f068379 8083skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(101),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:4, bytes:424, used:0.0s, actions:100,2,3
0a740f48
EJ
8084])
8085
8086AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
8087OFPST_PORT reply (xid=0x4): 1 ports
6f068379
BP
8088 port 1: rx pkts=5, bytes=530, drop=?, errs=?, frame=?, over=?, crc=?
8089 tx pkts=10, bytes=1060, drop=?, errs=?, coll=?
0a740f48
EJ
8090])
8091
8092AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
8093OFPST_PORT reply (xid=0x4): 1 ports
6f068379
BP
8094 port 1: rx pkts=10, bytes=1060, drop=?, errs=?, frame=?, over=?, crc=?
8095 tx pkts=5, bytes=530, drop=?, errs=?, coll=?
0a740f48
EJ
8096])
8097
8098OVS_VSWITCHD_STOP
8099AT_CLEANUP
655ab909 8100
1774d762
JR
8101AT_SETUP([ofproto-dpif - patch ports - stack])
8102OVS_VSWITCHD_START([add-br br1 \
8103-- set bridge br1 datapath-type=dummy fail-mode=secure \
8104-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
8105-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
8106
ca5792f0
BP
8107add_of_ports br0 2
8108add_of_ports br1 3
1774d762
JR
8109
8110AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8111], [])
8112AT_CHECK([ovs-appctl time/stop])
8113AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8114
8115AT_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"])
8116# Try to pop from empty stack, and push and leave data to stack.
8117AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
8118
8119ovs-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)'
8120
8121AT_CHECK([ovs-appctl time/warp 500], [0],
8122[warped
8123])
8124
8125OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
8126
8127AT_CHECK([ovs-appctl dpif/show], [0], [dnl
8128dummy@ovs-dummy: hit:0 missed:1
7be29a47
BP
8129 br0:
8130 br0 65534/100: (dummy-internal)
8131 p2 2/2: (dummy)
8132 pbr0 1/none: (patch: peer=pbr1)
8133 br1:
8134 br1 65534/101: (dummy-internal)
8135 p3 3/3: (dummy)
8136 pbr1 1/none: (patch: peer=pbr0)
1774d762
JR
8137])
8138
2be3fe44 8139AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e 8140recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:101,set(ipv4(src=255.255.255.254)),2
1774d762
JR
8141])
8142
2d9b49dd 8143AT_CHECK([grep -e '|ofproto_dpif_xlate|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
a4c3463d 8144stack underflow on bridge br1 while processing icmp,in_port=LOCAL,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0
1774d762
JR
8145])
8146
2d9b49dd 8147OVS_VSWITCHD_STOP(["/stack underflow/d"])
1774d762
JR
8148AT_CLEANUP
8149
65e0be10
BP
8150AT_SETUP([ofproto-dpif - port duration])
8151OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
ca5792f0 8152add_of_ports br0 1 2
65e0be10 8153
31ef9f51 8154ovs-appctl time/stop
65e0be10
BP
8155ovs-appctl time/warp 10000
8156
8157AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
125bf01d 8158AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
65e0be10 8159[dnl
65e0be10 8160 duration=?s
65e0be10 8161 duration=?s
65e0be10
BP
8162 duration=?s
8163])
8164OVS_VSWITCHD_STOP
8165AT_CLEANUP
bcd2633a
JP
8166
8167dnl ----------------------------------------------------------------------
8168AT_BANNER([ofproto-dpif -- megaflows])
8169
bcd2633a
JP
8170AT_SETUP([ofproto-dpif megaflow - port classification])
8171OVS_VSWITCHD_START
623540e4 8172AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8173add_of_ports br0 1 2
bcd2633a
JP
8174AT_DATA([flows.txt], [dnl
8175table=0 in_port=1 actions=output(2)
8176])
8177AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8178AT_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 8179sleep 1
bcd2633a 8180AT_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 8181sleep 1
2be3fe44 8182AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e 8183recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8184])
8185OVS_VSWITCHD_STOP
8186AT_CLEANUP
8187
8188AT_SETUP([ofproto-dpif megaflow - L2 classification])
8189OVS_VSWITCHD_START
623540e4 8190AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8191add_of_ports br0 1 2
bcd2633a
JP
8192AT_DATA([flows.txt], [dnl
8193table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
8194])
8195AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8196AT_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)'])
8197AT_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 8198sleep 1
2be3fe44 8199AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8200recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8201recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8202])
8203OVS_VSWITCHD_STOP
8204AT_CLEANUP
8205
8206AT_SETUP([ofproto-dpif megaflow - L3 classification])
8207OVS_VSWITCHD_START
623540e4 8208AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8209add_of_ports br0 1 2
13751fd8 8210AT_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
8211AT_DATA([flows.txt], [dnl
8212table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
8213])
8214AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8215AT_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)'])
8216AT_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 8217sleep 1
2be3fe44 8218AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8219recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
8220recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,frag=no), actions: <del>
bcd2633a
JP
8221])
8222OVS_VSWITCHD_STOP
8223AT_CLEANUP
8224
13751fd8
JR
8225AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
8226OVS_VSWITCHD_START
623540e4 8227AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8228add_of_ports br0 1 2
13751fd8
JR
8229AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=ipv6_dst,ipv6_src], [0], [ignore], [])
8230AT_DATA([flows.txt], [dnl
8231table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
8232])
8233AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8234AT_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)'])
8235AT_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 8236sleep 1
2be3fe44 8237AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8238recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5,frag=no), actions: <del>
8239recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:5:4:3:2:1/ffff:ffff:ffff:fffc::,frag=no), actions: <del>
13751fd8
JR
8240])
8241OVS_VSWITCHD_STOP
8242AT_CLEANUP
8243
bcd2633a
JP
8244AT_SETUP([ofproto-dpif megaflow - L4 classification])
8245OVS_VSWITCHD_START
623540e4 8246AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8247add_of_ports br0 1 2
bcd2633a
JP
8248AT_DATA([flows.txt], [dnl
8249table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
8250])
8251AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8252AT_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 8253sleep 1
bcd2633a 8254AT_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 8255sleep 1
2be3fe44 8256AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e 8257recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=1,frag=no),icmp(type=8), actions: <del>
bcd2633a
JP
8258])
8259OVS_VSWITCHD_STOP
8260AT_CLEANUP
8261
e539ba87
IM
8262m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
8263 [AT_SETUP([ofproto-dpif megaflow - normal$1])
8264 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8265 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
45a9c31d 8266 func=`printf '%s_' "$1" | cut -c 4-`
e539ba87
IM
8267 add_${func}of_ports br0 1 2
8268 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8269 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)'])
8270 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)'])
8271 sleep 1
8272 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8273recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8274recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a 8275])
e539ba87
IM
8276 OVS_VSWITCHD_STOP
8277 AT_CLEANUP])
8278
8279OFPROTO_DPIF_MEGAFLOW_NORMAL([])
8280OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
bcd2633a
JP
8281
8282AT_SETUP([ofproto-dpif megaflow - mpls])
8283OVS_VSWITCHD_START
623540e4 8284AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8285add_of_ports br0 1 2
bcd2633a
JP
8286AT_DATA([flows.txt], [dnl
8287table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
8288table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
8289])
8290AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8291AT_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)'])
8292AT_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 8293sleep 1
3fd12197 8294AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
3d4b2e6e
JS
8295recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1), actions:push_mpls(label=11,tc=3,ttl=64,bos=0,eth_type=0x8847),2
8296recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x8847),mpls(label=11/0x0,tc=3/0,ttl=64/0x0,bos=1/1), actions:pop_mpls(eth_type=0x800),2
bcd2633a
JP
8297])
8298OVS_VSWITCHD_STOP
8299AT_CLEANUP
8300
4819b3a5 8301# CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
e731d71b 8302m4_define([CHECK_MEGAFLOW_NETFLOW],
4819b3a5 8303 [OVS_VSWITCHD_START
623540e4 8304 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8305 add_of_ports br0 1 2
e731d71b
AS
8306
8307 dnl NetFlow configuration disables wildcarding relevant fields
53eb8cb8 8308 on_exit 'kill `cat test-netflow.pid`'
eadd1644 8309 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 8310 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 8311 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
8312 ovs-vsctl \
8313 set Bridge br0 netflow=@nf -- \
8314 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
8315 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
8316
8317 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8318 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)'])
8319 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)'])
8320 sleep 1
2be3fe44 8321 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8322recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
8323recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
bcd2633a 8324])
d9c8c57c 8325 OVS_APP_EXIT_AND_WAIT([test-netflow])
4819b3a5 8326 OVS_VSWITCHD_STOP])
e731d71b 8327
4819b3a5 8328AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
e731d71b 8329CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
4819b3a5
BP
8330AT_CLEANUP
8331
8332AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
8333AT_SKIP_IF([test $HAVE_IPV6 = no])
e731d71b 8334CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
4819b3a5 8335AT_CLEANUP
bcd2633a 8336
e539ba87
IM
8337m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
8338 [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
8339 OVS_VSWITCHD_START(
8340 [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
8341 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
8342 set interface p2 type=$1 ofport_request=2 -- \
8343 set interface p3 type=$1 ofport_request=3], [], [],
8344 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
8345 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
bcd2633a 8346])
e539ba87 8347 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a 8348
e539ba87
IM
8349 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8350 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)'])
8351 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)'])
8352 sleep 1
8353 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8354recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8355recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a 8356])
e539ba87
IM
8357 OVS_VSWITCHD_STOP
8358 AT_CLEANUP])
8359
8360OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
8361OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
bcd2633a
JP
8362
8363AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
8364OVS_VSWITCHD_START(
8365 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
8366 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
8367 set interface p2 type=dummy ofport_request=2 -- \
8368 set interface p3 type=dummy ofport_request=3])
8369AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8370])
623540e4 8371AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a
JP
8372
8373AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8374AT_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)'])
8375AT_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 8376sleep 1
2be3fe44 8377AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8378recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8379recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8380])
8381OVS_VSWITCHD_STOP
8382AT_CLEANUP
8383
8384AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
8385# Create bond0 on br0 with interfaces p0 and p1
8386# and bond1 on br1 with interfaces p2 and p3
8387# with p0 patched to p2 and p1 patched to p3.
8388OVS_VSWITCHD_START(
8389 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
8390 other-config:lacp-time=fast \
8391 other-config:bond-rebalance-interval=0 -- \
8392 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
8393 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
8394 add-br br1 -- \
8395 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
8396 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
8397 fail-mode=secure -- \
8398 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
8399 other-config:lacp-time=fast \
8400 other-config:bond-rebalance-interval=0 -- \
8401 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
8402 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
8403
8404AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8405])
623540e4 8406AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8407add_of_ports br0 7
bcd2633a
JP
8408AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8409AT_CHECK([ovs-ofctl add-flow br1 action=normal])
31ef9f51 8410ovs-appctl time/stop
bcd2633a
JP
8411ovs-appctl time/warp 5000
8412AT_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)'])
8413AT_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 8414sleep 1
2be3fe44 8415AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8416recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8417recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8418])
8419OVS_VSWITCHD_STOP
8420AT_CLEANUP
8421
8422AT_SETUP([ofproto-dpif megaflow - resubmit port action])
8423OVS_VSWITCHD_START
623540e4 8424AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8425add_of_ports br0 1 2
bcd2633a
JP
8426AT_DATA([flows.txt], [dnl
8427table=0 in_port=1,ip actions=resubmit(90)
8428table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
8429])
8430AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8431AT_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)'])
8432AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
ae692725 8433sleep 1
2be3fe44 8434AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8435recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8436recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8437])
8438OVS_VSWITCHD_STOP
8439AT_CLEANUP
8440
8441AT_SETUP([ofproto-dpif megaflow - resubmit table action])
8442OVS_VSWITCHD_START
623540e4 8443AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8444add_of_ports br0 1 2
bcd2633a
JP
8445AT_DATA([flows.txt], [dnl
8446table=0 in_port=1,ip actions=resubmit(,1)
8447table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8448])
8449AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8450AT_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)'])
8451AT_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=
84521,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
ae692725 8453sleep 1
2be3fe44 8454AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8455recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8456recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8457])
8458OVS_VSWITCHD_STOP
8459AT_CLEANUP
8460
8461AT_SETUP([ofproto-dpif megaflow - goto_table action])
8462OVS_VSWITCHD_START
623540e4 8463AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8464add_of_ports br0 1 2
bcd2633a
JP
8465AT_DATA([flows.txt], [dnl
8466table=0 in_port=1,ip actions=goto_table(1)
8467table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8468])
8469AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
8470AT_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)'])
8471AT_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 8472sleep 1
2be3fe44 8473AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8474recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8475recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8476])
8477OVS_VSWITCHD_STOP
8478AT_CLEANUP
8479
8480AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
2d5c1a20 8481AT_KEYWORDS([mirror mirrors mirroring])
bcd2633a 8482OVS_VSWITCHD_START
623540e4 8483AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8484add_of_ports br0 1 2 3
bcd2633a
JP
8485ovs-vsctl \
8486 set Bridge br0 mirrors=@m --\
8487 --id=@p3 get Port p3 --\
8488 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
8489
8490AT_DATA([flows.txt], [dnl
8491in_port=1 actions=output:2
8492])
8493AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8494AT_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 8495sleep 1
bcd2633a 8496AT_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 8497sleep 1
2be3fe44 8498AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e 8499recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8500])
8501OVS_VSWITCHD_STOP
8502AT_CLEANUP
8503
8504AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
8505OVS_VSWITCHD_START
623540e4 8506AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8507add_of_ports br0 1 2 3
bcd2633a
JP
8508ovs-vsctl \
8509 set Bridge br0 mirrors=@m --\
8510 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
8511 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
8512
8513AT_DATA([flows.txt], [dnl
8514in_port=1 actions=output:2
8515])
8516AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8517AT_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))'])
8518AT_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 8519sleep 1
2be3fe44 8520AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8521recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8522recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=11,pcp=7/0x0),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
bcd2633a
JP
8523])
8524OVS_VSWITCHD_STOP
8525AT_CLEANUP
8526
8527AT_SETUP([ofproto-dpif megaflow - move action])
8528OVS_VSWITCHD_START
623540e4 8529AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8530add_of_ports br0 1 2
bcd2633a
JP
8531AT_DATA([flows.txt], [dnl
8532table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
8533table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
8534table=0 in_port=91 reg0=0x0a000002,actions=output(2)
8535])
8536AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8537AT_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)'])
8538AT_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 8539sleep 1
2be3fe44 8540AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8541recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
8542recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
bcd2633a
JP
8543])
8544OVS_VSWITCHD_STOP
8545AT_CLEANUP
8546
8547AT_SETUP([ofproto-dpif megaflow - push action])
8548OVS_VSWITCHD_START
623540e4 8549AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8550add_of_ports br0 1 2
bcd2633a
JP
8551AT_DATA([flows.txt], [dnl
8552table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
8553])
8554AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8555AT_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)'])
8556AT_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 8557sleep 1
2be3fe44 8558AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8559recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
8560recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
bcd2633a
JP
8561])
8562OVS_VSWITCHD_STOP
8563AT_CLEANUP
8564
8565AT_SETUP([ofproto-dpif megaflow - learning])
8566OVS_VSWITCHD_START
623540e4 8567AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8568add_of_ports br0 1 2
bcd2633a
JP
8569AT_DATA([flows.txt], [dnl
8570table=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
8571])
8572AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
31ef9f51 8573ovs-appctl time/stop
956f2bf0
BP
8574# We send each packet twice because the first packet in each flow causes the
8575# flow table to change and thus revalidations, which (depending on timing)
8576# can keep a megaflow from being installed. The revalidations are done by
8577# the second iteration, allowing the flows to be installed.
8578for i in 1 2; do
8579 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)'])
8580 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)'])
8581 ovs-appctl time/warp 100
8582done
ae692725 8583sleep 1
bcd2633a 8584dnl The original flow is missing due to a revalidation.
2be3fe44 8585AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8586recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8587recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
bcd2633a
JP
8588])
8589OVS_VSWITCHD_STOP
8590AT_CLEANUP
d4f4a9b2
JP
8591
8592AT_SETUP([ofproto-dpif megaflow - tunnels])
8593OVS_VSWITCHD_START(
2c0ea78f 8594 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
623540e4 8595AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
2c0ea78f
GS
8596AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
8597 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
8598AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
8599 ofport_request=3])
8600AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
8601 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
8602 ofport_request=4 options:key=flow])
d4f4a9b2
JP
8603AT_DATA([flows.txt], [dnl
8604in_port=1,actions=output(2)
8605in_port=3,actions=output(4)
8606])
8607AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8608dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
8609dnl will cause the packet to be dropped.
8610AT_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 8611sleep 1
d4f4a9b2
JP
8612AT_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)'])
8613AT_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 8614sleep 1
d4f4a9b2 8615AT_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 8616sleep 1
2be3fe44 8617AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8618recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
8619recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
8620recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
1dd35f8a
JP
8621])
8622OVS_VSWITCHD_STOP
8623AT_CLEANUP
8624
8625AT_SETUP([ofproto-dpif megaflow - dec_ttl])
8626OVS_VSWITCHD_START
623540e4 8627AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8628add_of_ports br0 1 2
13751fd8 8629AT_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
8630AT_DATA([flows.txt], [dnl
8631table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
8632])
8633AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8634AT_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)'])
8635AT_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 8636sleep 1
2be3fe44 8637AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
3d4b2e6e
JS
8638recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
8639recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,ttl=64,frag=no), actions: <del>
d4f4a9b2
JP
8640])
8641OVS_VSWITCHD_STOP
8642AT_CLEANUP
74cc3969 8643
f74e7df7
JP
8644AT_SETUP([ofproto-dpif megaflow - set dl_dst])
8645OVS_VSWITCHD_START
623540e4 8646AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 8647add_of_ports br0 1 2
f74e7df7
JP
8648AT_DATA([flows.txt], [dnl
8649table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
8650])
8651AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8652AT_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)'])
8653AT_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 8654sleep 1
d23df9a8
JR
8655dnl The first packet is essentially a no-op, as the new destination MAC is the
8656dnl same as the original. The second entry actually updates the destination
8657dnl MAC.
2be3fe44 8658AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
8659recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions:2
8660recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions:set(eth(dst=50:54:00:00:00:0a)),2
f74e7df7
JP
8661])
8662OVS_VSWITCHD_STOP
8663AT_CLEANUP
8664
e539ba87
IM
8665m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
8666 [AT_SETUP([ofproto-dpif megaflow - disabled$1])
8667 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8668 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
45a9c31d 8669 func=`printf '%s_' "$1" | cut -c 4-`
e539ba87
IM
8670 add_${func}of_ports br0 1 2
8671 AT_DATA([flows.txt], [dnl
8c301900
JR
8672table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
8673table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
8674])
e539ba87 8675 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8c301900 8676], [])
e539ba87 8677 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
64bb477f 8678], [])
e539ba87
IM
8679 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
8680 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8681 for i in 1 2 3 4; do
8682 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)'])
8683 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)'])
8684 if [[ $i -eq 1 ]]; then
8685 sleep 1
8686 fi
8687 done
8688 sleep 1
8689 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
8690skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions:2
8691skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions:drop
c2a77f33 8692])
e539ba87 8693 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
6f068379
BP
8694skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:318, used:0.0s, actions:2
8695skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:318, used:0.0s, actions:drop
8c301900 8696])
e539ba87
IM
8697 OVS_VSWITCHD_STOP
8698 AT_CLEANUP])
8699
8700OFPROTO_DPIF_MEGAFLOW_DISABLED([])
8701OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
8c301900 8702
74cc3969
BP
8703AT_SETUP([ofproto-dpif - datapath port number change])
8704OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 8705add_of_ports br0 1
74cc3969
BP
8706
8707# Trace a flow that should output to p1.
8708AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8709 [0], [stdout])
8710AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
8711])
8712
8713# Change p1's port number to 5.
8714AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
8715
8716# Trace a flow that should output to p1 in its new location.
8717AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8718 [0], [stdout])
8719AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
8720])
8721OVS_VSWITCHD_STOP
8722AT_CLEANUP
2d344ba5
AW
8723
8724# Tests the bundling with various bfd and cfm configurations.
8725AT_SETUP([ofproto - bundle with variable bfd/cfm config])
8726OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
8727 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
8728 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
8729 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
8730 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
8731 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
8732 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
8733 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
8734 set Interface p0 cfm_mpid=1 -- \
8735 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
8736
8737ovs-appctl time/stop
8738# advance the clock to stablize everything.
bdba1947 8739ovs-appctl time/warp 5000 100
2d344ba5
AW
8740# cfm/show should show 'recv' fault.
8741AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
f6d6edc0 8742 fault: recv
2d344ba5
AW
8743])
8744# bfd/show should show 'up'.
8745AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
fc002ed3
BP
8746 Local Session State: up
8747 Remote Session State: up
8748 Local Session State: up
8749 Remote Session State: up
2d344ba5
AW
8750])
8751# bond/show should show 'may-enable: true' for all slaves.
8752AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
828519ca
BP
8753 may_enable: true
8754 may_enable: true
8755 may_enable: true
8756 may_enable: true
2d344ba5
AW
8757])
8758
8759# now disable the bfd on p1.
8760AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
8761# advance the clock to stablize everything.
bdba1947 8762ovs-appctl time/warp 5000 100
2d344ba5
AW
8763# cfm/show should show 'recv' fault.
8764AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
f6d6edc0 8765 fault: recv
2d344ba5
AW
8766])
8767# bfd/show should show 'down'.
8768AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
fc002ed3
BP
8769 Local Session State: down
8770 Remote Session State: down
2d344ba5
AW
8771])
8772# bond/show should show 'may-enable: false' for p0.
125bf01d 8773AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
828519ca
BP
8774 may_enable: false
8775 may_enable: true
2d344ba5
AW
8776])
8777
8778# now enable the bfd on p1 and disable bfd on p0.
8779AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
8780AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
8781# advance the clock to stablize everything.
bdba1947 8782ovs-appctl time/warp 5000 100
2d344ba5
AW
8783# cfm/show should show 'recv' fault.
8784AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
f6d6edc0 8785 fault: recv
2d344ba5
AW
8786])
8787# bfd/show should show 'down'.
8788AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
fc002ed3
BP
8789 Local Session State: down
8790 Remote Session State: down
2d344ba5
AW
8791])
8792# bond/show should show 'may-enable: false' for p0 and p1.
8793AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
828519ca
BP
8794 may_enable: false
8795 may_enable: true
8796 may_enable: false
8797 may_enable: true
2d344ba5
AW
8798])
8799
e441a806
AW
8800OVS_VSWITCHD_STOP
8801AT_CLEANUP
8802
8803AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
8804OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
8805
8806# enable bfd on p0.
8807AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8808# check log.
1335a8d5 8809OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
8810# disable bfd on p0.
8811AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8812# check log.
1335a8d5 8813OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
454ff761 8814AT_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
8815
8816# enable cfm on p0.
8817AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
8818# check log.
1335a8d5 8819OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
8820# disable cfm on p0.
8821AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
8822# check log.
1335a8d5 8823OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
454ff761 8824AT_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
8825
8826# enable both bfd and cfm on p0.
8827AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
8828# check log.
1335a8d5 8829OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
8830# disable bfd on p0.
8831AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8832# check log, there should not be the log of thread terminated.
738cd849 8833AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
8834])
8835# reenable bfd on p0.
8836AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8837# check log, should still be on log of thread created.
738cd849 8838AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
8839monitor thread created
8840])
8841# disable bfd and cfm together.
8842AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
8843# check log.
1335a8d5 8844OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
e441a806
AW
8845
8846OVS_VSWITCHD_STOP
8847AT_CLEANUP
8848
8849# this test helps avoid the deadlock between the main thread and monitor thread.
8850AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
8851OVS_VSWITCHD_START
8852
8853for i in `seq 1 199`
8854do
8855 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])
8856done
8857
98cf638b
AW
8858OVS_VSWITCHD_STOP
8859AT_CLEANUP
98b07853
BP
8860\f
8861AT_BANNER([ofproto-dpif - flow translation resource limits])
8862
790c5d26
BP
8863dnl Resubmits to later tables do not count against the depth limit, so we
8864dnl can do 99 of them even though the maximum depth is 64.
8865AT_SETUP([ofproto-dpif - forward resubmit])
8866OVS_VSWITCHD_START
8867(for i in `seq 0 99`; do
8868 j=`expr $i + 1`
8869 echo "table=$i, actions=resubmit(,$j)"
8870 done
8871 echo "table=100, actions=local") > flows
8872AT_CHECK([ovs-ofctl add-flows br0 flows])
8873AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8874 [0], [stdout])
8875AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
8876])
8877OVS_VSWITCHD_STOP
8878AT_CLEANUP
8879
8880dnl Resubmits to the same or an earlier table count against the depth limit,
8881dnl so only 64 of them are allowed.
8882AT_SETUP([ofproto-dpif - backward resubmit])
8883OVS_VSWITCHD_START
8884(echo "table=0, actions=resubmit(,66)"
8885 for i in `seq 2 66`; do
8886 j=`expr $i - 1`
8887 echo "table=$i, actions=resubmit(,$j)"
8888 done
8889 echo "table=1, actions=local") > flows
8890AT_CHECK([ovs-ofctl add-flows br0 flows])
8891AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8892 [0], [stdout])
8893AT_CHECK([tail -1 stdout], [0],
8894 [Translation failed (Recursion too deep), packet is dropped.
8895])
8896AT_CHECK([grep -c 'over max translation depth 64' stdout],
8897 [0], [1
8898])
8899OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8900AT_CLEANUP
8901
98b07853
BP
8902AT_SETUP([ofproto-dpif - infinite resubmit])
8903OVS_VSWITCHD_START
8904AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
222820c6 8905AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
98b07853 8906 [0], [stdout])
fff1b9c0
JR
8907AT_CHECK([tail -1 stdout], [0],
8908 [Translation failed (Recursion too deep), packet is dropped.
98b07853 8909])
790c5d26 8910AT_CHECK([grep -c 'over max translation depth 64' stdout],
98b07853
BP
8911 [0], [1
8912])
8913OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8914AT_CLEANUP
8915
d1ea2cc3
WT
8916dnl Without using ofproto/trace, make sure the
8917dnl ofproto trace is still logged
8918AT_SETUP([ofproto-dpif - backward resubmit without trace])
8919OVS_VSWITCHD_START
8920(echo "table=0, actions=resubmit(,66)"
8921 for i in `seq 2 66`; do
8922 j=`expr $i - 1`
8923 echo "table=$i, actions=resubmit(,$j)"
8924 done
8925 echo "table=1, actions=local") > flows
8926AT_CHECK([ovs-ofctl add-flows br0 flows])
8927
8928AT_CHECK([ovs-appctl netdev-dummy/receive br0 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'], [0], [stdout])
8929
29c536f5 8930OVS_WAIT_UNTIL([grep 'packet is dropped' ovs-vswitchd.log])
d1ea2cc3
WT
8931
8932dnl make sure the full ofproto trace dump is present
8933AT_CHECK([grep -c "^ *resubmit" ovs-vswitchd.log],
8934 [0], [66
8935])
8936
8937OVS_VSWITCHD_STOP(["/over max translation depth/d
8938/ofproto_dpif_upcall/d"])
8939AT_CLEANUP
8940
98b07853
BP
8941AT_SETUP([ofproto-dpif - exponential resubmit chain])
8942OVS_VSWITCHD_START
ca5792f0 8943add_of_ports br0 1
98b07853
BP
8944(for i in `seq 1 64`; do
8945 j=`expr $i + 1`
8946 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8947 done
8948 echo "in_port=65, actions=local") > flows
8949 AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 8950AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
8951AT_CHECK([tail -1 stdout], [0],
8952 [Translation failed (Too many resubmits), packet is dropped.
8953])
8954AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
98b07853
BP
8955])
8956OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
8957AT_CLEANUP
8958
8959AT_SETUP([ofproto-dpif - too many output actions])
8960OVS_VSWITCHD_START
ca5792f0 8961add_of_ports br0 1
98b07853
BP
8962(for i in `seq 1 12`; do
8963 j=`expr $i + 1`
8964 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8965 done
8966 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
542024c4 8967AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 8968AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
0f032e95
BP
8969AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
8970 [0], [1
98b07853 8971])
fff1b9c0 8972AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
542024c4 8973])
0f032e95 8974OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
98b07853
BP
8975AT_CLEANUP
8976
8977AT_SETUP([ofproto-dpif - stack too deep])
8978OVS_VSWITCHD_START
ca5792f0 8979add_of_ports br0 1
98b07853
BP
8980(for i in `seq 1 12`; do
8981 j=`expr $i + 1`
8982 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8983 done
8984 push="push:NXM_NX_REG0[[]]"
8985 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
8986 AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 8987AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
8988AT_CHECK([tail -1 stdout], [0],
8989 [Translation failed (Stack too deep), packet is dropped.
8990])
8991AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
98b07853
BP
8992])
8993OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
8994AT_CLEANUP
d611866c
SH
8995
8996
2608616d 8997AT_SETUP([ofproto-dpif packet-out controller])
d611866c 8998OVS_VSWITCHD_START
ca5792f0 8999add_of_ports br0 1 2
d611866c
SH
9000
9001AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
9002
9003AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 9004AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
9005
9006for i in 1 2 3; do
5a0e4aec 9007 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
d611866c
SH
9008done
9009
d9c8c57c 9010OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
9011AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9012NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 9013vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9014dnl
9015NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 9016vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9017dnl
9018NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 9019vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9020])
9021
9022AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
9023 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9024NXST_FLOW reply:
9025])
9026
9d36d7d7
BP
9027AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0],
9028 [OFPST_TABLE reply (OF1.3) (xid=0x2):
3c1bb396 9029 table 0:
8811fc0a
BP
9030 active=1, lookup=0, matched=0
9031
9032 table 1:
9033 active=0, lookup=0, matched=0
9d36d7d7
BP
9034
9035 tables 2...253: ditto
9036])
d611866c
SH
9037
9038OVS_VSWITCHD_STOP
9039AT_CLEANUP
9040
2608616d 9041AT_SETUP([ofproto-dpif packet-out controller (patch port)])
d611866c
SH
9042OVS_VSWITCHD_START(
9043 [-- \
9044 add-port br0 p1 -- \
9045 set interface p1 type=patch options:peer=p2 -- \
9046 add-br br1 -- \
9047 set bridge br1 datapath-type=dummy -- \
9048 set bridge br1 fail-mode=secure -- \
9049 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
9050 add-port br1 p2 -- \
9051 set interface p2 type=patch options:peer=p1 --])
9052
9053AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 9054AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
9055
9056for i in 1 2 3; do
5a0e4aec 9057 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
d611866c
SH
9058done
9059
d9c8c57c 9060OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
9061AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9062NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 9063vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9064dnl
9065NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 9066vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9067dnl
9068NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 9069vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9070])
9071
9d36d7d7
BP
9072AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9073OFPST_TABLE reply (OF1.3) (xid=0x2):
8811fc0a
BP
9074 table 0:
9075 active=0, lookup=0, matched=0
d611866c 9076
9d36d7d7
BP
9077 tables 1...253: ditto
9078])
9079
9080AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1], [0], [dnl
9081OFPST_TABLE reply (OF1.3) (xid=0x2):
3c1bb396 9082 table 0:
8811fc0a
BP
9083 active=0, lookup=3, matched=0
9084
9085 table 1:
9086 active=0, lookup=0, matched=0
9d36d7d7
BP
9087
9088 tables 2...253: ditto
9089])
d611866c
SH
9090
9091OVS_VSWITCHD_STOP
9092AT_CLEANUP
9093
880b1458
YHW
9094AT_SETUP([ofproto-dpif packet-out pipeline match field (OpenFlow 1.5)])
9095OVS_VSWITCHD_START
9096
89d7927b
YHW
9097AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=8}->tun_metadata2"])
9098AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata3"])
880b1458
YHW
9099AT_DATA([flows.txt], [dnl
9100table=0,in_port=1 actions=controller
9101table=0,tun_id=3 actions=controller
9102table=0,metadata=5 actions=controller
9103table=0,reg0=1,reg4=2,reg8=3,reg12=5 actions=controller
9104table=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 actions=controller
89d7927b 9105table=0,tun_metadata3=0x11 actions=controller
880b1458
YHW
9106])
9107AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
9108
9109AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
9110ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
9111ovs-appctl -t ovs-ofctl ofctl/barrier
9112ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
9113AT_CAPTURE_FILE([monitor.log])
9114
9115AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=1 packet=0001020304050010203040501111 actions=table"])
9116AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tunnel_id=3 packet=0001020304050010203040502222 actions=table"])
9117AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,metadata=5 packet=0001020304050010203040503333 actions=table"])
9118AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,reg0=1,reg4=2,reg8=3,reg12=5 packet=0001020304050010203040503333 actions=table"])
9119AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 packet=0001020304050010203040503333 actions=table"])
89d7927b 9120AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_metadata2=0x22,tun_metadata3=0x11 packet=0001020304050010203040503333 actions=table"])
880b1458
YHW
9121
9122ovs-appctl -t ovs-ofctl ofctl/barrier
9123OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9124
9125AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
9126OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 in_port=1 (via packet_out) data_len=14 (unbuffered)
9127vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1111
9128OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_id=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
9129vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x2222
9130OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 metadata=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
9131vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9132OFPT_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)
9133vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9134OFPT_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)
9135vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
89d7927b
YHW
9136OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_metadata2=0x22,tun_metadata3=0x11,in_port=2 (via packet_out) data_len=14 (unbuffered)
9137vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
880b1458
YHW
9138OFPT_BARRIER_REPLY (OF1.5):
9139])
9140
9141OVS_VSWITCHD_STOP
9142AT_CLEANUP
d611866c 9143
2608616d 9144AT_SETUP([ofproto-dpif packet-out goto_table])
d611866c 9145OVS_VSWITCHD_START
ca5792f0 9146add_of_ports br0 1 2
d611866c
SH
9147
9148AT_DATA([flows.txt], [dnl
9149table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
9150table=1 dl_dst=50:54:00:00:00:0a actions=controller
9151])
9152AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
9153
9154AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 9155AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
9156
9157for i in 1 2 3; do
9158 ovs-appctl 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)'
9159done
9160
9161OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 9162OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c 9163AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 9164NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9165vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9166dnl
efe179e0 9167NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9168vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9169dnl
efe179e0 9170NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9171vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9172])
9173
cea4a6d7 9174AT_CHECK([ovs-appctl revalidator/purge], [0])
d611866c 9175AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0
DDP
9176 n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=goto_table:1
9177 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
d611866c
SH
9178OFPST_FLOW reply (OF1.3):
9179])
9180
9d36d7d7
BP
9181AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9182OFPST_TABLE reply (OF1.3) (xid=0x2):
3c1bb396
BP
9183 table 0:
9184 active=1, lookup=3, matched=3
9185
8811fc0a 9186 table 1: ditto
9d36d7d7 9187
8811fc0a
BP
9188 table 2:
9189 active=0, lookup=0, matched=0
9d36d7d7
BP
9190
9191 tables 3...253: ditto
9192])
d611866c
SH
9193
9194OVS_VSWITCHD_STOP
9195AT_CLEANUP
9196
9197
2608616d 9198AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
d611866c 9199OVS_VSWITCHD_START
ca5792f0 9200add_of_ports br0 1 2
d611866c 9201
3c1bb396
BP
9202AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
9203AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
d611866c
SH
9204
9205AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 9206AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
9207
9208for i in 1 2 3; do
9209 ovs-appctl 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)'
9210done
9211
9212OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 9213OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c 9214AT_CHECK([cat ofctl_monitor.log], [0], [dnl
efe179e0 9215NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9216vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9217dnl
efe179e0 9218NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9219vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c 9220dnl
efe179e0 9221NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
e6d9ab56 9222vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
9223])
9224
cea4a6d7 9225AT_CHECK([ovs-appctl revalidator/purge], [0])
3c1bb396 9226AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
efe179e0 9227 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
3c1bb396 9228OFPST_FLOW reply (OF1.1):
d611866c
SH
9229])
9230
9d36d7d7
BP
9231AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9232OFPST_TABLE reply (OF1.3) (xid=0x2):
3c1bb396
BP
9233 table 0:
9234 active=0, lookup=3, matched=0
9235
9236 table 1:
8811fc0a
BP
9237 active=1, lookup=3, matched=3
9238
9239 table 2:
9240 active=0, lookup=0, matched=0
9d36d7d7
BP
9241
9242 tables 3...253: ditto
9243])
d611866c
SH
9244
9245OVS_VSWITCHD_STOP
9246AT_CLEANUP
b0e2ec32
JR
9247
9248AT_SETUP([ofproto-dpif - ICMPv6])
9249OVS_VSWITCHD_START
ca5792f0 9250add_of_ports br0 1
b0e2ec32
JR
9251
9252AT_CAPTURE_FILE([ofctl_monitor.log])
9253
6409e008 9254AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b0e2ec32
JR
9255
9256ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9257
d9c8c57c 9258OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
b0e2ec32
JR
9259
9260AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9261NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
e6d9ab56 9262icmp6,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
9263])
9264
9265OVS_VSWITCHD_STOP
9266AT_CLEANUP
e60e935b 9267
8ecb3068
DDP
9268AT_SETUP([ofproto-dpif - ICMPv6 type match])
9269OVS_VSWITCHD_START
9270add_of_ports br0 1 2 3
9271
9272AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
9273AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
9274
9275AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9276
9277AT_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)'])
9278AT_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)'])
9279AT_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)'])
9280AT_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)'])
9281
9282AT_CHECK([ovs-appctl revalidator/purge], [0])
9283
9284AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e
JS
9285recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128), actions:2
9286recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129), actions:3
8ecb3068
DDP
9287])
9288
9289AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6f068379
BP
9290 n_packets=2, n_bytes=252, icmp6,icmp_type=128 actions=output:2
9291 n_packets=2, n_bytes=252, icmp6,icmp_type=129 actions=output:3
8ecb3068
DDP
9292NXST_FLOW reply:
9293])
9294
9295OVS_VSWITCHD_STOP
9296AT_CLEANUP
9297
e60e935b
SRCSA
9298AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
9299OVS_VSWITCHD_START
ca5792f0 9300add_of_ports br0 1
e60e935b
SRCSA
9301AT_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])
9302
9303AT_CAPTURE_FILE([ofctl_monitor.log])
9304
6409e008 9305AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
e60e935b
SRCSA
9306
9307ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9308
d9c8c57c 9309OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
e60e935b
SRCSA
9310
9311AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9312NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
e6d9ab56 9313icmp6,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
9314])
9315
9316OVS_VSWITCHD_STOP
9317AT_CLEANUP
9318
f171fa88
AW
9319# Tests the exact match of CFI bit in installed datapath flows matching VLAN.
9320AT_SETUP([ofproto-dpif - vlan matching])
9321OVS_VSWITCHD_START(
9322 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
9323AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9324
9325AT_CHECK([ovs-ofctl del-flows br0])
9326AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
9327
9328AT_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))'])
9329
47567945 9330OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
9044f2c1 9331AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
3d4b2e6e 9332recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=10),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
f171fa88
AW
9333])
9334OVS_VSWITCHD_STOP
9335AT_CLEANUP
43b2f131
EJ
9336
9337# Tests in place modification of installed datapath flows.
9338AT_SETUP([ofproto-dpif - in place modification])
9339OVS_VSWITCHD_START(
9340 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9341AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9342
9343AT_CHECK([ovs-ofctl del-flows br0])
9344AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
9345
9346ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9347
9348ovs-appctl time/stop
9349
ed8ac2a0
JR
9350AT_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)'])
9351
9352# Wait for the flow setup to be done.
9353OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9354
9355for i in 1 2; do
43b2f131
EJ
9356 ovs-appctl 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)'
9357done
9358
3a18d0c2 9359AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9360recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
43b2f131
EJ
9361])
9362
9363AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
9364
9365ovs-appctl time/warp 500
9366ovs-appctl time/warp 500
9367
9368for i in 1 2 3; do
9369 ovs-appctl 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)'
9370done
9371
3a18d0c2 9372AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9373recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
43b2f131
EJ
9374])
9375
38b0b29f 9376AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
3d4b2e6e 9377dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:push_vlan(vid=4,pcp=0),100
43b2f131
EJ
9378])
9379OVS_VSWITCHD_STOP
9380AT_CLEANUP
449b8131
JR
9381
9382# Tests in place modification of installed datapath flows with vlans.
9383AT_SETUP([ofproto-dpif - in place modification (vlan)])
9384OVS_VSWITCHD_START(
9385 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9386AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9387
49a832f7
DB
9388# Always drop misses
9389AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all drop])
449b8131
JR
9390AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
9391
9392ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9393
9394ovs-appctl time/stop
9395
ed8ac2a0
JR
9396AT_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)'])
9397
449b8131 9398# Check that a correct datapath flow is created.
ed8ac2a0
JR
9399OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9400
9401for i in 1 2; do
449b8131
JR
9402 ovs-appctl 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)'
9403done
9404
3a18d0c2 9405AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9406recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:100
449b8131
JR
9407])
9408
9409# Delete the flow. Then check that the datapath flow is modified to
9410# drop the packets. A modified flow inherits the stats, a new
9411# datapath flow would start from sero.
9412AT_CHECK([ovs-ofctl del-flows br0])
9413
9414ovs-appctl time/warp 500
9415ovs-appctl time/warp 500
9416
9417for i in 1 2 3; do
9418 ovs-appctl 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)'
9419done
9420
3a18d0c2 9421AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9422recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:drop
449b8131
JR
9423])
9424
9425# Add a flow that matches the non-presence of a vlan tag, and check
9426# that the datapath flow is modified accordingly.
9427AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
9428
9429ovs-appctl time/warp 500
9430ovs-appctl time/warp 500
9431
9432for i in 1 2 3; do
9433 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
9434done
9435
3a18d0c2 9436AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e 9437recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
449b8131
JR
9438])
9439
9440# Check that VLAN packets will not hit the same datapath megaflow.
ed8ac2a0
JR
9441
9442AT_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 9443OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
ed8ac2a0
JR
9444
9445for i in 1 2; do
449b8131
JR
9446 ovs-appctl 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))'
9447done
9448
3a18d0c2 9449AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
3d4b2e6e
JS
9450recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9451recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:36, used:0.0s, actions:drop
449b8131
JR
9452])
9453
9454# Check that the new flow matches the CFI bit, while both vid and pcp
9455# are wildcarded.
38b0b29f 9456AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
3d4b2e6e 9457dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), actions:100
a13a0209 9458dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:drop
3d4b2e6e
JS
9459dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:100
9460dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), actions:drop
449b8131
JR
9461])
9462OVS_VSWITCHD_STOP
9463AT_CLEANUP
56de2148
YT
9464
9465AT_SETUP([ofproto-dpif - trace (unchanged)])
9466OVS_VSWITCHD_START
9467AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
9468AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9469])
9470AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
9471AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9472])
ed708b5d
DDP
9473
9474OVS_VSWITCHD_STOP
9475AT_CLEANUP
9476
9477AT_SETUP([ofproto-dpif - conntrack - controller])
9478OVS_VSWITCHD_START
9479
9480add_of_ports br0 1 2
9481
9482AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9483
2cd20955 9484dnl Allow new UDP connections on p1 for dst port 2, drop everything else.
ed708b5d 9485AT_DATA([flows.txt], [dnl
a103c1f4 9486dnl Table 0
2cd20955 9487dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2).
a103c1f4
DDP
9488dnl
9489table=0,priority=100,arp,action=normal
2cd20955
JR
9490table=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)
9491table=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
9492table=0,priority=1,action=drop
9493dnl
2cd20955
JR
9494dnl Pass tracked traffic through ACL, drop everything else.
9495dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers
9496dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets
9497dnl get the ACL lookup using the conntrack tuple and the inverted direction.
9498dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
9499dnl of the master connection, as storted in ct_mark.
9500dnl
9501dnl Incoming non-related packet in the original direction (ACL IN)
9502table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5
9503dnl Incoming non-related reply packet (CT ACL OUT)
9504table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4
9505dnl Outgoing non-related packet (ACL OUT)
9506table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5
9507dnl Outgoing non-related reply packet (CT ACL IN)
9508table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
9509dnl
9510dnl Related packet (CT ACL in the direction of the master connection.)
9511table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
9512dnl Drop everything else.
9513table=1 priority=0, action=drop
9514dnl
9515dnl "ACL table"
9516dnl
9517dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with
9518dnl UDP destination port '2'. Store rule ID (1234) in reg1, verdict
9519dnl in reg2.
9520table=3 priority=10, reg0=1, udp, udp_dst=2 action=set_field:1234->reg1,set_field:1->reg2
9521dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235)
9522table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2
9523dnl
9524dnl Re-process stateful traffic that was not accepted by a stateful rule as
9525dnl normal traffic in the current direction. This should also delete the
9526dnl now stale conntrack state, so that new state can be created in it's place.
9527dnl
9528dnl Stateful accepts go to next table.
9529table=4 priority=100 reg2=1, action=goto_table:5
9530dnl Everything else is reprocessed disregarding the CT state, using the actual
9531dnl packet direction.
9532table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5
9533dnl
9534dnl "ACL verdict processing table."
9535dnl
9536dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0)
9537dnl
9538dnl Drop all non-accepted packets.
9539table=5 reg2=0 priority=1000 action=drop
9540dnl Commit new non-related IP connections.
9541table=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
9542dnl Commit new related connections in either direction, which inherit the mark
9543dnl (the direction of the original direction master tuple) from the master
9544dnl connection.
9545table=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
9546dnl Forward everything else, including stateless accepts.
9547table=5 priority=0 action=goto_table:6
9548dnl
9549dnl "Forwarding table"
9550dnl
9551table=6 action=controller
ed708b5d
DDP
9552])
9553
9554AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9555
9556AT_CAPTURE_FILE([ofctl_monitor.log])
9557AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9558
9559AT_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)'])
9560
9561dnl OK, now start a new connection from port 1.
9562AT_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)'])
9563
9564dnl Now try a reply from port 2.
9565AT_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)'])
9566
9567OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9568OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9569
9570dnl Check this output. We only see the latter two packets, not the first.
ed708b5d 9571AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9572NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=106 (unbuffered)
9573udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
ed708b5d 9574dnl
6f068379
BP
9575NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_zone=1,ct_mark=0x1,ct_label=0x4d2000000000000000000000000,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x2,reg4=0x1,in_port=2 (via action) data_len=106 (unbuffered)
9576udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
ed708b5d
DDP
9577])
9578
9579AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9580
9581dnl OK, now start a second connection from port 1
2cd20955 9582AT_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
9583
9584dnl Now try a reply from port 2.
2cd20955 9585AT_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
9586
9587
9588OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9589OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9590
9591dnl Check this output. We should see both packets
ed708b5d 9592AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9593NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=106 (unbuffered)
9594udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=2 udp_csum:551
ed708b5d 9595dnl
6f068379
BP
9596NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_zone=1,ct_mark=0x1,ct_label=0x4d2000000000000000000000000,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=2,ip,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x2,reg4=0x1,in_port=2 (via action) data_len=106 (unbuffered)
9597udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=3 udp_csum:551
ed708b5d
DDP
9598])
9599
9600OVS_VSWITCHD_STOP
9601AT_CLEANUP
9602
a76a37ef
JR
9603AT_SETUP([ofproto-dpif - conntrack - force commit])
9604OVS_VSWITCHD_START
9605
9606add_of_ports br0 1 2
9607
9608AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9609
9610dnl Allow new connections on p1->p2, but not on p2->p1.
9611AT_DATA([flows.txt], [dnl
9612dnl Table 0
9613dnl
9614table=0,priority=100,arp,action=normal
9615table=0,priority=10,in_port=1,udp,action=ct(commit),controller
9616table=0,priority=10,in_port=2,udp,action=ct(table=1)
9617table=0,priority=1,action=drop
9618dnl
9619dnl Table 1
9620dnl
9621table=1,priority=10,in_port=2,ct_state=+est,udp,action=ct(force,commit),controller
9622table=1,priority=1,action=drop
9623])
9624
9625AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9626
9627AT_CAPTURE_FILE([ofctl_monitor.log])
9628AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9629
9630AT_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)'])
9631
9632dnl OK, now start a new connection from port 1.
9633AT_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)'])
9634
9635dnl Now try a reply from port 2.
9636AT_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)'])
9637
9638OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9639OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9640
9641dnl Check this output. We only see the latter two packets, not the first.
9642dnl Note that the first packet doesn't have the ct_state bits set. This
9643dnl happens because the ct_state field is available only after recirc.
9644AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9645NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9646udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
a76a37ef 9647dnl
6f068379
BP
9648NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9649udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
a76a37ef
JR
9650])
9651
9652AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9653
9654dnl OK, now start a second connection from port 1
9655AT_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)'])
9656
9657dnl Now try a reply from port 2.
9658AT_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)'])
9659
9660OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9661OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9662
9663dnl Check this output. We should see both packets
9664dnl Note that the first packet doesn't have the ct_state bits set. This
9665dnl happens because the ct_state field is available only after recirc.
9666AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9667NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9668udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=4 udp_csum:54f
a76a37ef 9669dnl
6f068379
BP
9670NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9671udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:54f
a76a37ef
JR
9672])
9673
9674dnl
9675dnl Check that the directionality has been changed by force commit.
9676dnl
9677AT_CHECK([ovs-appctl dpctl/dump-conntrack | sort], [], [dnl
9678udp,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)
9679udp,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)
9680])
9681
9682OVS_VSWITCHD_STOP
9683AT_CLEANUP
9684
ed708b5d
DDP
9685AT_SETUP([ofproto-dpif - conntrack - ipv6])
9686OVS_VSWITCHD_START
9687
9688add_of_ports br0 1 2
9689
9690AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9691
9692dnl Allow new connections on p1->p2, but not on p2->p1.
9693AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9694dnl Table 0
9695dnl
9696table=0,priority=100,arp,action=normal
9697table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
9698table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
9699table=0,priority=1,action=drop
9700dnl Table 1
9701dnl
9702table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
9703table=1,priority=1,action=drop
ed708b5d
DDP
9704])
9705
9706AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9707
9708AT_CAPTURE_FILE([ofctl_monitor.log])
9709AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9710
9711AT_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)'])
9712
9713dnl OK, now start a new connection from port 1.
9714AT_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)'])
9715
9716dnl Now try a reply from port 2.
9717AT_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)'])
9718
9719OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9720OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9721
9722dnl Check this output. We only see the latter two packets, not the first.
9723dnl Note that the first packet doesn't have the ct_state bits set. This
9724dnl happens because the ct_state field is available only after recirc.
9725AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9726NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
9727udp6,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,ipv6_src=2001:db8::1,ipv6_dst=2001:db8::2,ipv6_label=0x00000,nw_tos=112,nw_ecn=0,nw_ttl=128,tp_src=1,tp_dst=2 udp_csum:bfe2
9728NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=126 ct_state=est|rpl|trk,ct_ipv6_src=2001:db8::1,ct_ipv6_dst=2001:db8::2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ipv6,in_port=2 (via action) data_len=126 (unbuffered)
9729udp6,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,ipv6_src=2001:db8::2,ipv6_dst=2001:db8::1,ipv6_label=0x00000,nw_tos=112,nw_ecn=0,nw_ttl=128,tp_src=2,tp_dst=1 udp_csum:bfe2
ed708b5d
DDP
9730])
9731
9732OVS_VSWITCHD_STOP
9733AT_CLEANUP
9734
9735AT_SETUP([ofproto-dpif - conntrack - output action])
9736OVS_VSWITCHD_START
9737
9738add_of_ports br0 1 2
9739
9740AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9741
9742dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9743AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9744dnl The flows are in two separate tables for two reasons:
9745dnl * To make the pipeline more clear.
9746dnl * To make megaflows more consistent (we check megaflows below). The
9747dnl unwildcarding in megaflows depends on the internal ordering of the
9748dnl subtables, which are sorted using the system qsort(). qsort()
9749dnl is provided by libc and may or may not be stable, so we can't rely
9750dnl on that. By having separate tables we have more control over which
9751dnl subtables are visited, meaning consistent megaflows.
9752dnl
9753dnl Table 0
9754dnl
9755table=0,priority=100,arp,action=normal
9756table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
9757table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9758table=0,priority=1,action=drop
9759dnl
9760dnl Table 1
9761dnl
9762table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
9763table=1,priority=1,action=drop
ed708b5d
DDP
9764])
9765
9766AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9767
9768
9769AT_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)'])
9770
9771dnl OK, now start a new connection from port 1.
9772AT_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)'])
9773
9774dnl Now try a reply from port 2.
9775AT_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)'])
9776
9777dnl OK, now start a second connection from port 1
9778AT_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)'])
9779
9780dnl Now try a reply from port 2.
9781AT_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)'])
9782
9783
9784AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
3d4b2e6e
JS
9785ct_state(+new-est+trk),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:drop
9786ct_state(-new+est+trk),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:1
9787recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
9788recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct,recirc(0x1)
ed708b5d
DDP
9789])
9790
9791OVS_VSWITCHD_STOP
9792AT_CLEANUP
9793
9794AT_SETUP([ofproto-dpif - conntrack - expiration])
9795OVS_VSWITCHD_START
9796
9797add_of_ports br0 1 2
9798
9799AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9800
9801dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9802AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9803dnl Table 0
9804dnl
9805table=0,priority=100,arp,action=normal
9806table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
9807table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9808table=0,priority=1,action=drop
9809dnl
9810dnl Table 1
9811dnl
9812table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9813table=1,priority=1,action=drop
ed708b5d
DDP
9814])
9815
9816AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9817
9818AT_CAPTURE_FILE([ofctl_monitor.log])
9819AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9820
9821AT_CHECK([ovs-appctl time/stop])
9822
9823dnl Start a new connection from port 1.
9824AT_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)'])
9825
9826dnl Now try a reply from port 2.
9827AT_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)'])
9828
9829ovs-appctl time/warp 100000
9830
9831dnl Now try another reply from port 2.
9832AT_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)'])
9833
9834OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
9835OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9836
9837dnl Check this output. Only one reply must be there
9838AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9839NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
9840udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
ed708b5d
DDP
9841dnl
9842OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
9843])
9844
9845OVS_VSWITCHD_STOP
9846AT_CLEANUP
9847
9848AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
9849OVS_VSWITCHD_START
9850
9851add_of_ports br0 1 2
9852
9853AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9854
9855AT_DATA([flows.txt], [dnl
ed26e3ea 9856ipv6,ct_state=-trk,action=ct(table=0,zone=0)
ed708b5d
DDP
9857ct_state=+trk,action=controller
9858])
9859
9860AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9861
9862AT_CAPTURE_FILE([ofctl_monitor.log])
9863AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9864
9865AT_CHECK([ovs-appctl time/stop])
9866
ed26e3ea 9867AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
ed708b5d
DDP
9868
9869OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
9870OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9871
9872AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7827edca 9873NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,ipv6,in_port=2 (via action) data_len=86 (unbuffered)
ed26e3ea 9874icmp6,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
9875])
9876
9877OVS_VSWITCHD_STOP
9878AT_CLEANUP
9879
9880AT_SETUP([ofproto-dpif - conntrack - zones])
9881OVS_VSWITCHD_START
9882
9883add_of_ports br0 1 2 3 4
9884
9885AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9886
9887dnl Allow new connections on p1->p2 or p3->p4.
9888dnl Allow only established connections p2->p1 and p4->p3
9889dnl p1,p2 and p3,p4 are on different zones
9890AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9891dnl Table 0
9892dnl
9893table=0,priority=100,arp,action=normal
9894table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
9895table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9896table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
9897table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
9898table=0,priority=1,action=drop
9899dnl
9900dnl Table 1
9901dnl
9902table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9903table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
9904table=1,priority=1,action=drop
ed708b5d
DDP
9905])
9906
9907AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9908
9909AT_CAPTURE_FILE([ofctl_monitor.log])
9910AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9911
9912dnl Basic "only established" test on ports 1,2
9913
9914AT_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)'])
9915AT_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)'])
9916AT_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)'])
9917
9918dnl Now use the same 5-tuples but on ports 3,4
9919
9920AT_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)'])
9921AT_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)'])
9922AT_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)'])
9923
9924OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9925OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9926
9927dnl Check this output. We only see the latter two packets (for each zone), not the first.
9928AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9929NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9930udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
ed708b5d 9931dnl
6f068379
BP
9932NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
9933udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
ed708b5d 9934dnl
6f068379
BP
9935NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=3 (via action) data_len=106 (unbuffered)
9936udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
ed708b5d 9937dnl
6f068379
BP
9938NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_zone=1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=4 (via action) data_len=106 (unbuffered)
9939udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
ed708b5d
DDP
9940])
9941
ed708b5d
DDP
9942OVS_VSWITCHD_STOP
9943AT_CLEANUP
9944
9945AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
9946OVS_VSWITCHD_START
9947
9948add_of_ports br0 1 2
9949
9950AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9951
9952dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9953AT_DATA([flows.txt], [dnl
a103c1f4
DDP
9954dnl Table 0
9955dnl
9956table=0,priority=100,arp,action=normal
9957table=0,priority=10,udp,action=ct(table=1,zone=0)
9958table=0,priority=1,action=drop
9959dnl
9960dnl Table 1
9961dnl
9962table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
9963table=1,priority=10,ct_state=+trk+est,udp,action=controller
9964table=1,priority=1,action=drop
ed708b5d
DDP
9965])
9966
9967AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9968
9969AT_CAPTURE_FILE([ofctl_monitor.log])
9970AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9971
9972AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9973
9974dnl OK, now start a new connection from port 1.
9975AT_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)'])
9976
9977dnl Now try a reply from port 2.
9978AT_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)'])
9979
9980OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9981OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9982
9983dnl Check this output. We only see the latter two packets, not the first.
9984AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
9985NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9986udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
ed708b5d 9987dnl
6f068379
BP
9988NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
9989udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
ed708b5d
DDP
9990])
9991
9992OVS_VSWITCHD_STOP
9993AT_CLEANUP
9994
9995AT_SETUP([ofproto-dpif - conntrack - ICMP related])
9996OVS_VSWITCHD_START
9997
9998add_of_ports br0 1 2
9999
10000dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
10001AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10002dnl Table 0
10003dnl
10004table=0,priority=100,arp,action=normal
ed26e3ea
JR
10005table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
10006table=0,priority=10,ip,in_port=2,action=ct(table=1)
a103c1f4
DDP
10007table=0,priority=1,action=drop
10008dnl
10009dnl Table 1
10010dnl
10011table=1,priority=10,in_port=1,ct_state=+trk,action=controller
10012table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
10013table=1,priority=1,action=drop
ed708b5d
DDP
10014])
10015
10016AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10017
10018AT_CAPTURE_FILE([ofctl_monitor.log])
10019AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10020
10021dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
a103c1f4 10022AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
ed708b5d
DDP
10023
10024dnl 2. Send and UDP packet to port 5555
a103c1f4 10025AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
ed708b5d
DDP
10026
10027dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
a103c1f4 10028AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
ed708b5d
DDP
10029
10030OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10031OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10032
10033dnl Check this output. We only see the first and the last packet
10034AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7827edca 10035NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=47 ct_state=new|trk,ct_nw_src=172.16.0.1,ct_nw_dst=172.16.0.2,ct_nw_proto=17,ct_tp_src=41614,ct_tp_dst=5555,ip,in_port=1 (via action) data_len=47 (unbuffered)
ed708b5d
DDP
10036udp,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
10037dnl
7827edca 10038NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=75 ct_state=rel|rpl|trk,ct_nw_src=172.16.0.1,ct_nw_dst=172.16.0.2,ct_nw_proto=17,ct_tp_src=41614,ct_tp_dst=5555,ip,in_port=2 (via action) data_len=75 (unbuffered)
ed708b5d
DDP
10039icmp,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
10040])
10041
10042OVS_VSWITCHD_STOP
10043AT_CLEANUP
10044
10045AT_SETUP([ofproto-dpif - conntrack - ct_mark])
10046OVS_VSWITCHD_START
10047
10048add_of_ports br0 1 2
10049
10050AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10051
10052dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10053AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10054dnl Table 0
10055dnl
ed26e3ea
JR
10056table=0,arp,action=normal
10057table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
10058table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
10059table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
10060table=0,ip,in_port=2,actions=ct(table=1)
10061table=0,priority=0,action=drop
a103c1f4
DDP
10062dnl
10063dnl Table 1
10064dnl
10065table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
10066table=1,priority=1,action=drop
ed708b5d
DDP
10067])
10068
10069AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10070
10071AT_CAPTURE_FILE([ofctl_monitor.log])
10072AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10073
10074AT_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)'])
10075AT_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)'])
10076AT_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)'])
10077
10078AT_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)'])
10079AT_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)'])
10080AT_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)'])
10081
10082OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
10083OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10084
10085dnl Check this output.
10086AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10087NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10088udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
ed708b5d 10089dnl
6f068379
BP
10090NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10091udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=4 udp_csum:54f
ed708b5d 10092dnl
6f068379
BP
10093NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10094udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=5,tp_dst=6 udp_csum:54b
ed708b5d 10095dnl
6f068379
BP
10096NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_mark=0x1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10097udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
ed708b5d 10098dnl
6f068379
BP
10099NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_mark=0x3,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=4,ip,in_port=2 (via action) data_len=106 (unbuffered)
10100udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:54f
ed708b5d
DDP
10101])
10102
10103OVS_VSWITCHD_STOP
10104AT_CLEANUP
10105
10106AT_SETUP([ofproto-dpif - conntrack - ct_label])
10107OVS_VSWITCHD_START
10108
10109add_of_ports br0 1 2
10110
10111AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10112
10113dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10114AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10115dnl Table 0
10116dnl
ed26e3ea
JR
10117table=0,arp,action=normal
10118table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
10119table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
10120table=0,ip,in_port=2,actions=ct(table=1)
a103c1f4
DDP
10121dnl
10122dnl Table 1
10123dnl
10124table=1,priority=10,ct_state=+trk+rpl,actions=controller
10125table=1,priority=1,action=drop
ed708b5d
DDP
10126])
10127
10128AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10129
10130AT_CAPTURE_FILE([ofctl_monitor.log])
10131AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10132
10133AT_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)'])
10134AT_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)'])
10135
10136AT_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)'])
10137AT_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)'])
10138
10139OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10140OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10141
10142dnl Check this output.
10143AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10144NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_label=0x1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10145udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
ed708b5d 10146dnl
6f068379
BP
10147NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_label=0x2,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=4,ip,in_port=2 (via action) data_len=106 (unbuffered)
10148udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:54f
ed708b5d
DDP
10149])
10150
10151OVS_VSWITCHD_STOP
10152AT_CLEANUP
10153
10154AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
10155OVS_VSWITCHD_START
10156
10157add_of_ports br0 1 2
10158
10159AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10160
10161dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10162AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10163dnl The flows are in two separate tables for two reasons:
10164dnl * To make the pipeline more clear.
10165dnl * To make megaflows more consistent (we check megaflows below). The
10166dnl unwildcarding in megaflows depends on the internal ordering of the
10167dnl subtables, which are sorted using the system qsort(). qsort()
10168dnl is provided by libc and may or may not be stable, so we can't rely
10169dnl on that. By having separate tables we have more control over which
10170dnl subtables are visited, meaning consistent megaflows.
10171dnl
10172dnl Table 0
10173dnl
ed26e3ea
JR
10174table=0,arp,action=normal
10175table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
10176table=0,ip,in_port=2,actions=ct(table=1)
10177table=0,priority=0,action=drop
a103c1f4
DDP
10178dnl
10179dnl Table 1
10180dnl
10181table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
10182table=1,priority=1,action=drop
ed708b5d
DDP
10183])
10184
10185AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10186
10187AT_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)'])
10188AT_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)'])
10189
a76a37ef
JR
10190# Give time for logs to appear.
10191ovs-appctl revalidator/wait
10192
ed708b5d 10193AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
3d4b2e6e
JS
10194ct_state(+rpl+trk),ct_label(0x1),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:1
10195recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no),udp(src=1), actions:ct(commit,label=0x1),2
10196recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
ed708b5d
DDP
10197])
10198
10199OVS_VSWITCHD_STOP
10200AT_CLEANUP
10201
10202AT_SETUP([ofproto-dpif - conntrack - no output])
10203OVS_VSWITCHD_START
10204
10205add_of_ports br0 1
10206
10207AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10208
10209dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10210AT_DATA([flows.txt], [dnl
10211in_port=1,udp,action=ct(commit,zone=0)
10212])
10213
10214AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10215
10216dnl Start a new connection from port 1.
10217AT_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)'])
10218
10219AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
3d4b2e6e 10220recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
ed708b5d
DDP
10221])
10222
10223OVS_VSWITCHD_STOP
10224AT_CLEANUP
10225
10226AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
10227OVS_VSWITCHD_START
10228
10229add_of_ports br0 1 2
10230
10231AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10232
10233dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10234AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10235dnl Table 0
10236dnl
10237table=0,priority=100,arp,action=normal
10238table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10239table=0,priority=10,in_port=2,ip,action=ct(table=1)
10240table=0,priority=1,action=drop
10241dnl
10242dnl Table 1
10243dnl
ed708b5d
DDP
10244dnl The following two flows are separated to explicitly count the packets
10245dnl that create a new connection
a103c1f4
DDP
10246table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10247table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
ed708b5d 10248dnl
a103c1f4
DDP
10249table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10250table=1,ip,ct_state=+trk+inv,action=drop
ed708b5d
DDP
10251])
10252
10253AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10254
10255AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10256AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10257AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10258AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
10259AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10260AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10261AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10262AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10263AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10264
10265AT_CHECK([ovs-appctl revalidator/purge])
10266AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10267dnl Only one new connection
10268n_packets=1
10269])
10270
10271AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
10272AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
10273AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
10274AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
10275AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
10276AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
10277AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
10278AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
10279AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
10280
10281AT_CHECK([ovs-appctl revalidator/purge])
10282AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10283dnl Two new connections
10284n_packets=2
10285])
10286
10287OVS_VSWITCHD_STOP
10288AT_CLEANUP
10289
10290AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
10291OVS_VSWITCHD_START
10292
10293add_of_ports br0 1 2
10294
10295AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10296
10297dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10298AT_DATA([flows.txt], [dnl
a103c1f4
DDP
10299dnl Table 0
10300dnl
10301table=0,priority=100,arp,action=normal
10302table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
10303table=0,priority=10,in_port=2,tcp,action=ct(table=1)
10304table=0,priority=1,action=drop
10305dnl
10306dnl Table 1
10307dnl
10308table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
10309table=1,priority=1,action=drop
ed708b5d
DDP
10310])
10311
10312AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10313
10314AT_CHECK([ovs-appctl revalidator/purge])
10315AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10316dnl No dropped packets
10317n_packets=0
10318])
10319
10320AT_CAPTURE_FILE([ofctl_monitor.log])
10321AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10322
10323dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
10324dnl sure that the connection tracker is able to pick up already established
10325dnl connections that use window scaling.
10326dnl
10327dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
10328dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
10329AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
10330AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
10331AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
10332AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a08004500022afc284000400626a10a0101020a01010100020001396bb35b8cadbdb45018000a941f0000 dnl
10333 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10334 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10335 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10336 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10337 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10338 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10339 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10340 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10341 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10342 6666666666666666666666666666666666666666666666666666660a'])
10343AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
10344AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a5054000000090800450001fdf2ca40004006302c0a0101010a010102000100028cadbdb4396bb55d5018000aa60c0000 dnl
10345 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10346 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10347 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10348 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10349 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10350 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10351 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10352 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10353 6565656565656565656565656565656565656565656565656565656565656565656565650a'])
10354AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
10355AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
10356AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
10357AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
10358AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
10359
10360AT_CHECK([ovs-appctl revalidator/purge])
10361
10362OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10363
10364AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10365])
10366
10367AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10368dnl No dropped packets
10369n_packets=0
10370])
10371
56de2148
YT
10372OVS_VSWITCHD_STOP
10373AT_CLEANUP
ae59d134 10374
64207120
DB
10375AT_SETUP([ofproto-dpif - conntrack - disable tcp sequence checking])
10376OVS_VSWITCHD_START
10377
10378add_of_ports br0 1 2
10379
10380dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10381AT_DATA([flows.txt], [dnl
10382dnl Table 0
10383dnl
10384table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10385table=0,priority=10,in_port=2,ip,action=ct(table=1)
10386table=0,priority=1,action=drop
10387dnl
10388dnl Table 1
10389dnl
10390dnl The following two flows are separated to explicitly count the packets
10391dnl that create a new connection
10392table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10393table=1,priority=100,cookie=0x2,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
10394dnl
10395table=1,priority=100,cookie=0x3,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10396table=1,cookie=0x4,ip,ct_state=+trk+inv,action=drop
10397])
10398
10399AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10400
10401dnl Send 9 packets; one packet will be marked invalid.
10402AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10403AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10404AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10405AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10406AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10407AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10408AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10409AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10410AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10411
10412AT_CHECK([ovs-appctl revalidator/purge])
10413AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10414n_packets=1
10415])
10416
10417AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10418n_packets=4
10419])
10420
10421AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10422n_packets=3
10423])
10424
10425AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10426n_packets=1
10427])
10428
10429AT_CHECK([ovs-appctl dpctl/flush-conntrack])
10430
10431AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10432TCP sequence checking: enabled
10433])
10434
10435AT_CHECK([ovs-appctl dpctl/ct-disable-tcp-seq-chk], [], [dnl
10436disabling TCP sequence checking successful
10437])
10438
10439AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10440TCP sequence checking: disabled
10441])
10442
10443dnl Send exactly the same 9 packets to confirm no additional packets are marked invalid.
10444AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10445AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10446AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10447AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10448AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10449AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10450AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10451AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10452AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10453
10454AT_CHECK([ovs-appctl revalidator/purge])
10455AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10456n_packets=2
10457])
10458
10459AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10460n_packets=8
10461])
10462
10463AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10464n_packets=7
10465])
10466
10467AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10468n_packets=1
10469])
10470
10471AT_CHECK([ovs-appctl dpctl/ct-enable-tcp-seq-chk], [], [dnl
10472enabling TCP sequence checking successful
10473])
10474
10475AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10476TCP sequence checking: enabled
10477])
10478
10479AT_CHECK([ovs-appctl dpctl/flush-conntrack])
10480
10481dnl Send exactly the same 9 packets after disabling TCP sequence checking to
10482dnl confirm one more packet is marked invalid.
10483AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10484AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10485AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10486AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10487AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10488AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10489AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10490AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10491AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10492
10493AT_CHECK([ovs-appctl revalidator/purge])
10494AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10495n_packets=3
10496])
10497
10498AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10499n_packets=12
10500])
10501
10502AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10503n_packets=10
10504])
10505
10506AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10507n_packets=2
10508])
10509
10510OVS_VSWITCHD_STOP
10511AT_CLEANUP
10512
72fe7578
BP
10513dnl This is a truncated version of "ofproto-dpif - conntrack - controller",
10514dnl with extra send-to-controller actions following ct_clear to show that
10515dnl the connection tracking data has been cleared.
10516AT_SETUP([ofproto-dpif - conntrack - ct_clear])
10517OVS_VSWITCHD_START
10518
10519add_of_ports br0 1 2
10520
10521AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10522
10523dnl Allow new connections on p1->p2, but not on p2->p1.
10524AT_DATA([flows.txt], [dnl
10525dnl Table 0
10526dnl
10527table=0,priority=100,arp,action=normal
10528table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller,ct_clear,controller
10529table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10530table=0,priority=1,action=drop
10531dnl
10532dnl Table 1
10533dnl
10534table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller,ct_clear,controller
10535table=1,priority=1,action=drop
10536])
10537
10538AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10539
10540AT_CAPTURE_FILE([ofctl_monitor.log])
10541AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10542
10543AT_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)'])
10544
10545dnl OK, now start a new connection from port 1.
10546AT_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)'])
10547
10548dnl Now try a reply from port 2.
10549AT_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)'])
10550
10551OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
10552OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10553
10554dnl Check this output. We only see the latter two packets, not the first.
10555dnl Note that the first packet doesn't have the ct_state bits set. This
10556dnl happens because the ct_state field is available only after recirc.
10557AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6f068379
BP
10558NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10559udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
72fe7578 10560dnl
6f068379
BP
10561NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10562udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
72fe7578 10563dnl
6f068379
BP
10564NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10565udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
72fe7578 10566dnl
6f068379
BP
10567NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
10568udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
72fe7578
BP
10569])
10570OVS_VSWITCHD_STOP
10571AT_CLEANUP
10572
e6bc8e74
YHW
10573AT_SETUP([ofproto-dpif - conntrack - ofproto/trace])
10574OVS_VSWITCHD_START
10575
0f2f05bb 10576add_of_ports br0 1 2 3 4
e6bc8e74
YHW
10577
10578AT_DATA([flows.txt], [dnl
10579dnl Table 0
10580dnl
10581table=0,priority=100,arp,action=normal
10582table=0,priority=10,udp,action=ct(table=1,zone=0)
0f2f05bb 10583table=0,priority=10,tcp,action=ct(table=2,zone=1)
e6bc8e74
YHW
10584table=0,priority=1,action=drop
10585dnl
10586dnl Table 1
10587dnl
5fdd80cc
YHW
10588table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+new,udp,action=ct(commit,zone=0),2
10589table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+est,udp,action=2
10590table=1,priority=10,in_port=2,ct_zone=0,ct_state=+trk+est,udp,action=1
e6bc8e74 10591table=1,priority=1,action=drop
0f2f05bb
YHW
10592dnl
10593dnl Table 2
10594dnl
5fdd80cc
YHW
10595table=2,priority=10,in_port=1,tcp,ct_zone=1,ct_state=+trk+new,tcp,action=ct(commit,zone=1),ct(table=3,zone=2)
10596table=2,priority=10,in_port=1,tcp,ct_zone=1,ct_state=+trk+est,tcp,action=ct(table=3,zone=2)
0f2f05bb
YHW
10597table=2,priority=1,action=drop
10598dnl
10599dnl Table 3
10600dnl
5fdd80cc
YHW
10601table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+new,tcp,action=ct(commit,zone=2),4
10602table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+est,tcp,action=3
0f2f05bb 10603table=2,priority=1,action=drop
e6bc8e74
YHW
10604])
10605
10606AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10607
10608AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,udp'], [0], [stdout])
10609AT_CHECK([tail -1 stdout], [0],
10610 [Datapath actions: drop
10611])
10612
10613AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,udp'], [0], [stdout])
10614AT_CHECK([tail -1 stdout], [0],
10615 [Datapath actions: ct(commit),2
10616])
10617
0f2f05bb
YHW
10618AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp'], [0], [stdout])
10619AT_CHECK([tail -1 stdout], [0],
10620 [Datapath actions: ct(commit,zone=2),4
10621])
10622
10623AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp' --ct-next 'trk,est' --ct-next 'trk,est' ], [0], [stdout])
10624AT_CHECK([tail -1 stdout], [0],
10625 [Datapath actions: 3
10626])
10627
e6bc8e74
YHW
10628OVS_VSWITCHD_STOP
10629AT_CLEANUP
10630
ae59d134
DDP
10631AT_SETUP([ofproto - set mtu])
10632OVS_VSWITCHD_START
10633
10634add_of_ports br0 1
10635
10636# Check that initial MTU is 1500 for 'br0' and 'p1'.
10637AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
106381500
10639])
10640AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
106411500
10642])
10643
10644# Request new MTU for 'p1'
10645AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
10646
10647# Check that the new MTU is applied
15394e0f 10648AT_CHECK([ovs-vsctl wait-until Interface p1 mtu=1600])
ae59d134
DDP
10649# The internal port 'br0' should have the same MTU value as p1, becase it's
10650# the new bridge minimum.
15394e0f 10651AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1600])
ae59d134
DDP
10652
10653AT_CHECK([ovs-vsctl del-port br0 p1])
10654
10655# When 'p1' is deleted, the internal port should return to the default MTU
15394e0f 10656AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1500])
ae59d134 10657
7c12e200
DDP
10658# New port with 'mtu_request' in the same transaction.
10659AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
15394e0f
IM
10660AT_CHECK([ovs-vsctl wait-until Interface p2 mtu=1600])
10661AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1600])
7c12e200 10662
3a414a0a
DDP
10663# Explicitly set mtu_request on the internal interface. This should prevent
10664# the MTU from being overriden.
10665AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
15394e0f 10666AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1700])
3a414a0a
DDP
10667
10668# The new MTU on p2 should not affect br0.
10669AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
15394e0f
IM
10670AT_CHECK([ovs-vsctl wait-until Interface p2 mtu=1400])
10671AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1700])
3a414a0a
DDP
10672
10673# Remove explicit mtu_request from br0. Now it should track the bridge
10674# minimum again.
10675AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
15394e0f 10676AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1400])
3a414a0a 10677
ae59d134
DDP
10678OVS_VSWITCHD_STOP
10679AT_CLEANUP
4a7ab326
DDP
10680
10681AT_SETUP([ofproto - fragment prerequisites])
10682OVS_VSWITCHD_START
10683
10684AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
10685
10686add_of_ports br0 1
10687
10688AT_DATA([flows.txt], [dnl
10689priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
10690priority=1,in_port=1,udp,action=drop
10691])
10692
10693AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10694
10695AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
10696
10697ovs-appctl time/stop
10698AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
10699ovs-appctl time/warp 5000
10700
10701AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
3d4b2e6e 10702recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
4a7ab326
DDP
10703])
10704
10705dnl Change the flow table. This will trigger revalidation of all the flows.
10706AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
10707AT_CHECK([ovs-appctl revalidator/wait], [0])
10708
10709dnl We don't want revalidators to delete any flow. If the flow has been
10710dnl deleted it means that there's some inconsistency with the revalidation.
10711AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
10712
10713OVS_VSWITCHD_STOP
10714AT_CLEANUP
5b34f8fc
NS
10715
10716AT_SETUP([ofproto-dpif - check_pkt_larger action])
10717OVS_VSWITCHD_START
10718add_of_ports br0 1 2 3 4
10719
10720AT_DATA([flows.txt], [dnl
10721table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10722table=1,in_port=1,reg0=0x1/0x1 actions=output:2,resubmit(,2)
10723table=1,in_port=1,actions=output:3,resubmit(,2)
10724table=2,in_port=1,actions=mod_dl_dst:82:82:82:82:82:82,output:4
10725])
10726
10727AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10728AT_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])
10729AT_CHECK([tail -1 stdout], [0], [dnl
10730Datapath actions: check_pkt_len(size=200,gt(2,set(eth(dst=82:82:82:82:82:82)),4),le(3,set(eth(dst=82:82:82:82:82:82)),4))
10731])
10732
10733dnl Test flow xlate check_pkt_large clone action without using datapath check_pkt_len action.
10734AT_CHECK([ovs-appctl dpif/set-dp-features br0 check_pkt_len false], [0], [ignore])
10735
10736AT_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])
10737AT_CHECK([tail -3 stdout], [0], [dnl
10738Datapath actions: 3,set(eth(dst=82:82:82:82:82:82)),4
10739This flow is handled by the userspace slow path because it:
10740 - Uses action(s) not supported by datapath.
10741])
10742
10743dnl Enable datapath check_pkt_len action
10744AT_CHECK([ovs-appctl dpif/set-dp-features br0 check_pkt_len true], [0], [ignore])
10745
10746ovs-ofctl del-flows br0
10747
10748AT_DATA([flows.txt], [dnl
10749table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10750table=1,in_port=1,priority=200,reg0=0x1/0x1 actions=output:2
10751])
10752
10753AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10754AT_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])
10755AT_CHECK([tail -1 stdout], [0], [dnl
10756Datapath actions: check_pkt_len(size=200,gt(2),le(drop))
10757])
10758
10759ovs-ofctl del-flows br0
10760AT_DATA([flows.txt], [dnl
10761table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]]
10762])
10763
10764AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10765AT_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])
10766AT_CHECK([tail -1 stdout], [0], [dnl
10767Datapath actions: check_pkt_len(size=200,gt(drop),le(drop))
10768])
10769
10770ovs-ofctl del-flows br0
10771AT_DATA([flows.txt], [dnl
10772table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10773table=1,in_port=1,priority=200,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(mod_dl_src:80:81:81:81:81:81,set_field:192.168.5.5->ip_dst,output:3),output:4
10774table=1,in_port=1,priority=0,ip actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(ct(commit),output:3),output:4
10775])
10776
10777AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10778AT_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])
10779AT_CHECK([tail -1 stdout], [0], [dnl
10780Datapath actions: check_pkt_len(size=200,gt(set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4),le(set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),clone(ct(commit),3),4))
10781])
10782
10783AT_DATA([flows.txt], [dnl
10784table=0,priority=0 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10785table=1,in_port=1,priority=200,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src, resubmit(,0))
10786table=1,in_port=1,priority=0,ip actions=clone(set_field:192.168.3.4->ip_src, resubmit(,0))
10787])
10788
10789AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10790ovs-ofctl dump-flows br0
10791
10792AT_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])
10793AT_CHECK([tail -3 stdout], [0], [dnl
10794Megaflow: recirc_id=0,eth,ip,reg0=0/0x1,in_port=1,nw_src=10.10.10.2,nw_frag=no
10795Datapath actions: drop
10796Translation failed (Recursion too deep), packet is dropped.
10797])
10798
10799ovs-ofctl del-flows br0
10800AT_DATA([flows.txt], [dnl
10801table=0,priority=0 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10802table=1,ip,nw_src=192.168.3.3 actions=output:3
10803table=1,ip,nw_src=192.168.3.4 actions=output:4
10804table=1,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src, resubmit(,0))
10805table=1,ip actions=clone(set_field:192.168.3.4->ip_src, resubmit(,0))
10806])
10807
10808AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10809ovs-ofctl dump-flows br0
10810
10811AT_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])
10812AT_CHECK([tail -1 stdout], [0], [dnl
10813Datapath actions: check_pkt_len(size=200,gt(set(ipv4(src=192.168.3.3)),check_pkt_len(size=200,gt(3),le(3))),le(set(ipv4(src=192.168.3.4)),check_pkt_len(size=200,gt(4),le(4))))
10814])
10815
10816ovs-ofctl del-flows br0
10817AT_DATA([flows.txt], [dnl
10818table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10819table=1,in_port=1,reg0=0x1/0x1 actions=mod_dl_dst:82:82:82:82:82:82,controller(),resubmit(,2)
10820table=1,in_port=1 actions=resubmit(,2)
10821table=2,ip,dl_dst=82:82:82:82:82:82 actions=ct(table=3)
10822table=2,ip,dl_dst=50:54:00:00:00:0a actions=ct(table=3)
10823table=3,ip,reg0=0x1/0x1 actions=output:2
10824table=3,ip actions=output:4
10825])
10826
10827AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10828AT_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])
10829AT_CHECK([cat stdout | grep Datapath -B1], [0], [dnl
10830Megaflow: recirc_id=0,eth,ip,in_port=1,dl_dst=50:54:00:00:00:0a,nw_frag=no
10831Datapath actions: check_pkt_len(size=200,gt(set(eth(dst=82:82:82:82:82:82)),userspace(pid=0,controller(reason=1,dont_send=1,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535)),ct,recirc(0x2)),le(ct,recirc(0x3)))
10832--
10833Megaflow: recirc_id=0x2,eth,ip,in_port=1,nw_frag=no
10834Datapath actions: 2
10835--
10836Megaflow: recirc_id=0x3,eth,ip,in_port=1,nw_frag=no
10837Datapath actions: 4
10838])
10839
10840OVS_VSWITCHD_STOP
10841AT_CLEANUP
10842
10843AT_SETUP([ofproto-dpif - check_pkt_larger with continuation and ct])
10844OVS_VSWITCHD_START
10845add_of_ports --pcap br0 `seq 1 4`
10846
10847AT_CAPTURE_FILE([ofctl_monitor0.log])
10848AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
10849
10850AT_DATA([flows.txt], [dnl
10851table=0,in_port=1 actions=check_pkt_larger(150)->NXM_NX_REG0[[0]],resubmit(,1)
10852table=1,ip,reg0=0x1/0x1 actions=mod_dl_dst:82:82:82:82:82:82,controller(pause),resubmit(,2)
10853table=1,ip,reg0=0 actions=mod_dl_dst:83:83:83:83:83:83,controller(pause),resubmit(,2)
10854table=2,ip,dl_dst=82:82:82:82:82:82 actions=ct(table=3)
10855table=2,ip,dl_dst=83:83:83:83:83:83 actions=ct(table=3)
10856table=3,ip,reg0=0x1/0x1 actions=ct(commit),output:2
10857table=3,ip actions=ct(commit),output:4
10858])
10859
10860AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10861
10862flow="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)"
10863
10864AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
10865
10866OVS_WAIT_UNTIL([test 1 = `ovs-ofctl parse-pcap p4-tx.pcap \
10867| grep dl_dst=83:83:83:83:83:83 | wc -l`])
10868AT_CHECK([test 0 = `ovs-ofctl parse-pcap p2-tx.pcap | wc -l`])
10869
10870AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow" --len 200], [0], [stdout])
10871
10872OVS_WAIT_UNTIL([test 1 = `ovs-ofctl parse-pcap p2-tx.pcap \
10873| grep dl_dst=82:82:82:82:82:82 | wc -l`])
10874AT_CHECK([test 1 = `ovs-ofctl parse-pcap p2-tx.pcap | wc -l`])
10875
10876OVS_VSWITCHD_STOP
10877AT_CLEANUP