]> git.proxmox.com Git - ovs.git/blob - tests/ofproto-dpif.at
meta-flow.xml: Fix typos of flow-based tunnel command examples.
[ovs.git] / tests / ofproto-dpif.at
1 AT_BANNER([ofproto-dpif])
2
3 m4_divert_push([PREPARE_TESTS])
4
5 # Helper function to check the spread of dp_hash flows over buckets in the datapath
6 check_dpflow_stats () {
7 min_flows=$1
8 min_buckets=$2
9 dpflows=`cat`
10 if [[ $# -eq 3 ]]; then
11 echo "$dpflows" | grep "actions:hash"
12 n_flows=`echo "$dpflows" | grep -c dp_hash`
13 n_buckets=`echo "$dpflows" | grep dp_hash | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l`
14 else
15 n_flows=`echo "$dpflows" | wc -l`
16 n_buckets=`echo "$dpflows" | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l`
17 fi
18 if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi
19 if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi
20 echo "n_flows=$flows n_buckets=$buckets"
21 }
22
23 m4_divert_pop([PREPARE_TESTS])
24
25
26 AT_SETUP([ofproto-dpif - revalidator/wait])
27 OVS_VSWITCHD_START
28 AT_CHECK([ovs-appctl revalidator/wait])
29 OVS_VSWITCHD_STOP
30 AT_CLEANUP
31
32 AT_SETUP([ofproto-dpif - active-backup bonding])
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.
36 OVS_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 --])
48 WAIT_FOR_DUMMY_PORTS([p3], [p4])
49 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
50
51 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
52 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
53 ovs-appctl netdev-dummy/set-admin-state up
54 ovs-appctl time/warp 100
55 ovs-appctl netdev-dummy/set-admin-state p2 down
56 ovs-appctl time/stop
57 ovs-appctl time/warp 100
58 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
59 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
60 ovs-appctl time/warp 100
61 ovs-appctl netdev-dummy/set-admin-state p2 up
62 ovs-appctl netdev-dummy/set-admin-state p1 down
63 ovs-appctl time/warp 100
64 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00: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)'])
65 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(src=10.0.0.6,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
66 ovs-appctl time/warp 200 100
67 sleep 1
68 AT_CHECK([grep 'in_port([[348]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
69 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
70 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
71 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0d),eth_type(0x0800),ipv4(frag=no), actions: <del>
72 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(frag=no), actions: <del>
73 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), actions: <del>
74 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), actions: <del>
75 ])
76 OVS_VSWITCHD_STOP
77 AT_CLEANUP
78
79 AT_SETUP([ofproto-dpif - balance-slb bonding])
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.
84 OVS_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 --])
98 WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
99 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
100 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
101 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
102 ])
103 ovs-appctl time/stop
104 ovs-appctl time/warp 100
105 (
106 for 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 )
112 ovs-appctl time/warp 100
113 AT_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.
116 AT_CHECK([test `egrep 'in_port\(4\)' br1_flows.txt |wc -l` -gt 3])
117 AT_CHECK([test `egrep 'in_port\(5\)' br1_flows.txt |wc -l` -gt 3])
118 AT_CHECK([test `egrep 'in_port\(6\)' br1_flows.txt |wc -l` -gt 3])
119 OVS_VSWITCHD_STOP
120 AT_CLEANUP
121
122 AT_SETUP([ofproto-dpif - balance-tcp bonding])
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.
127 OVS_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 --])
144 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
145 ])
146 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
147 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
148 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
149 ], [])
150 OVS_WAIT_WHILE([ovs-appctl bond/show | grep "may_enable: false"])
151 ovs-appctl time/stop
152 ovs-appctl time/warp 100
153 ovs-appctl lacp/show > lacp.txt
154 ovs-appctl bond/show > bond.txt
155 (
156 for i in `seq 0 255` ;
157 do
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)"
159 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
160 done
161 )
162 ovs-appctl time/warp 300 100
163 AT_CHECK([ovs-appctl dpif/dump-flows br0 |grep tcp > br0_flows.txt])
164 AT_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.
167 AT_CHECK([test `grep in_port.4 br1_flows.txt |wc -l` -gt 24])
168 AT_CHECK([test `grep in_port.5 br1_flows.txt |wc -l` -gt 24])
169 AT_CHECK([test `grep in_port.6 br1_flows.txt |wc -l` -gt 24])
170
171 OVS_VSWITCHD_STOP()
172 AT_CLEANUP
173
174 # Makes sure recirculation does not change the way packet is handled.
175 AT_SETUP([ofproto-dpif - balance-tcp bonding, different recirc flow ])
176 OVS_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 ])
197 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
198 ])
199
200 # Waits for all ifaces enabled.
201 OVS_WAIT_UNTIL([test `ovs-appctl bond/show | grep -- "may_enable: true" | wc -l` -ge 4])
202
203 # The dl_vlan flow should not be ever matched,
204 # since recirculation should not change the flow handling.
205 AT_DATA([flows.txt], [dnl
206 table=0 priority=1 in_port=5 actions=mod_vlan_vid:1,output(101)
207 table=0 priority=2 in_port=5 dl_vlan=1 actions=drop
208 ])
209 AT_CHECK([ovs-ofctl add-flows br-int flows.txt])
210
211 # Sends a packet to trigger recirculation.
212 AT_CHECK([ovs-appctl netdev-dummy/receive p5 "in_port(5),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1)"])
213
214 # Collects flow stats.
215 AT_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.
219 AT_CHECK([ovs-appctl bridge/dump-flows br1 | ofctl_strip | grep -- "n_packets" | grep -- "table_id" | sed -e 's/output:[[0-9]][[0-9]]*/output/'] , [0], [dnl
220 table_id=254, n_packets=1, n_bytes=38, priority=20,recirc_id=0x0,dp_hash=0x0/0xff,actions=output
221 ])
222
223 # Checks the flow stats in br-int, should be only one match.
224 AT_CHECK([ovs-ofctl dump-flows br-int | ofctl_strip | sort], [0], [dnl
225 n_packets=1, n_bytes=34, priority=1,in_port=5 actions=mod_vlan_vid:1,output:101
226 priority=2,in_port=5,dl_vlan=1 actions=drop
227 NXST_FLOW reply:
228 ])
229
230 OVS_VSWITCHD_STOP()
231 AT_CLEANUP
232
233 AT_SETUP([ofproto-dpif - resubmit])
234 OVS_VSWITCHD_START
235 add_of_ports br0 1 10 11 12 13 14 15 16 17 18 19 20 21
236 AT_DATA([flows.txt], [dnl
237 table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21)
238 table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18)
239 table=0 in_port=3 priority=2000 icmp actions=output(20)
240 table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15)
241 table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2)
242 table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2)
243 ])
244 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
245 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=p1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
246 AT_CHECK([tail -1 stdout], [0],
247 [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
248 ])
249 OVS_VSWITCHD_STOP
250 AT_CLEANUP
251
252 AT_SETUP([ofproto-dpif - goto table])
253 OVS_VSWITCHD_START
254 add_of_ports br0 1 10 11
255 echo "table=0 in_port=1 actions=output(10),goto_table(1)" > flows.txt
256 for i in `seq 1 63`; do echo "table=$i actions=goto_table($(($i+1)))"; done >> flows.txt
257 echo "table=64 actions=output(11)" >> flows.txt
258 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
259 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
260 AT_CHECK([tail -1 stdout], [0],
261 [Datapath actions: 10,11
262 ])
263 OVS_VSWITCHD_STOP
264 AT_CLEANUP
265
266 AT_SETUP([ofproto-dpif - write actions])
267 OVS_VSWITCHD_START
268 add_of_ports br0 1 10 11 12 13
269 AT_DATA([flows.txt], [dnl
270 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
271 table=1 ip actions=write_actions(output(13)),goto_table(2)
272 table=2 ip actions=set_field:192.168.3.91->ip_src,output(11)
273 ])
274 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
275 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
276 AT_CHECK([tail -2 stdout], [0],
277 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
278 Datapath actions: 10,set(ipv4(src=192.168.3.91)),11,set(ipv4(src=192.168.3.90)),13
279 ])
280 OVS_VSWITCHD_STOP
281 AT_CLEANUP
282
283 AT_SETUP([ofproto-dpif - modify IPv6 Neighbor Solitication (ND)])
284 OVS_VSWITCHD_START
285 add_of_ports br0 1 10 11 12 13
286 AT_DATA([flows.txt], [dnl
287 table=0 in_port=1,icmp6,icmpv6_type=135 actions=output(10),write_actions(set_field:fe80::3->nd_target,set_field:aa:aa:aa:aa:aa:aa->nd_sll,output(12)),goto_table(1)
288 table=1 icmp6 actions=write_actions(output(13)),goto_table(2)
289 table=2 in_port=1,icmp6,icmpv6_type=135 actions=set_field:fe80::4->nd_target,set_field:cc:cc:cc:cc:cc:cc->nd_sll,output(11)
290 ])
291 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
292 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,icmp6,ipv6_src=fe80::1,ipv6_dst=fe80::2,nw_tos=0,nw_ttl=128,icmpv6_type=135,nd_target=fe80::2020,nd_sll=66:55:44:33:22:11'], [0], [stdout])
293 AT_CHECK([tail -4 stdout], [0],
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
295 Datapath actions: 10,set(nd(target=fe80::4,sll=cc:cc:cc:cc:cc:cc)),11,set(nd(target=fe80::3,sll=aa:aa:aa:aa:aa:aa)),13
296 This flow is handled by the userspace slow path because it:
297 - Uses action(s) not supported by datapath.
298 ])
299 OVS_VSWITCHD_STOP
300 AT_CLEANUP
301
302 AT_SETUP([ofproto-dpif - clear actions])
303 OVS_VSWITCHD_START
304 add_of_ports br0 1 10 11 12
305 AT_DATA([flows.txt], [dnl
306 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
307 table=1 tcp actions=set_field:91->tp_src,output(11),clear_actions
308 ])
309 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
310 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=9'], [0], [stdout])
311 AT_CHECK([tail -2 stdout], [0],
312 [Megaflow: recirc_id=0,eth,tcp,in_port=1,nw_frag=no,tp_src=8
313 Datapath actions: 10,set(tcp(src=91)),11
314 ])
315 OVS_VSWITCHD_STOP
316 AT_CLEANUP
317
318 AT_SETUP([ofproto-dpif - group chaining])
319 OVS_VSWITCHD_START
320 add_of_ports br0 1 10 11
321 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=set_field:192.168.3.90->ip_src,group:123,bucket=output:11'])
322 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=123,type=all,bucket=output:10'])
323 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
324 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
325 AT_CHECK([tail -1 stdout], [0],
326 [Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
327 ])
328 OVS_VSWITCHD_STOP
329 AT_CLEANUP
330
331 AT_SETUP([ofproto-dpif - all group in action list])
332 OVS_VSWITCHD_START
333 add_of_ports br0 1 10 11
334 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,set_field:192.168.3.90->ip_src,bucket=output:11'])
335 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
336 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
337 # Must match on the source address to be able to restore it's value for
338 # the second bucket
339 AT_CHECK([tail -2 stdout], [0],
340 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
341 Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
342 ])
343 OVS_VSWITCHD_STOP
344 AT_CLEANUP
345
346 AT_SETUP([ofproto-dpif - indirect group in action list])
347 OVS_VSWITCHD_START
348 add_of_ports br0 1 10
349 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
350 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
351 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
352 AT_CHECK([tail -1 stdout], [0],
353 [Datapath actions: 10
354 ])
355 OVS_VSWITCHD_STOP
356 AT_CLEANUP
357
358 AT_SETUP([ofproto-dpif - group actions have no effect afterwards])
359 OVS_VSWITCHD_START
360 add_of_ports br0 1 10
361 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=set_field:192.168.3.90->ip_src,output:10'])
362 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234,output:10'])
363
364 for 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])
367 done
368
369 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | sed 's/packets.*actions:/actions:/' | strip_ufid | strip_used | sort], [0], [dnl
370 flow-dump from non-dpdk interfaces:
371 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:hash(sym_l4(0)),recirc(0x1)
372 recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),10
373 ])
374
375 OVS_VSWITCHD_STOP
376 AT_CLEANUP
377
378 AT_SETUP([ofproto-dpif - all group in action set])
379 OVS_VSWITCHD_START
380 add_of_ports br0 1 10 11
381 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,set_field:192.168.3.90->ip_src,bucket=output:11'])
382 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
383 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
384 # Must match on the source address to be able to restore it's value for
385 # the third bucket
386 AT_CHECK([tail -2 stdout], [0],
387 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
388 Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
389 ])
390 OVS_VSWITCHD_STOP
391 AT_CLEANUP
392
393 AT_SETUP([ofproto-dpif - indirect group in action set])
394 OVS_VSWITCHD_START
395 add_of_ports br0 1 10
396 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
397 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
398 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
399 AT_CHECK([tail -1 stdout], [0],
400 [Datapath actions: 10
401 ])
402 OVS_VSWITCHD_STOP
403 AT_CLEANUP
404
405 AT_SETUP([ofproto-dpif - patch port with action set])
406 OVS_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 ])
414 add_of_ports br0 1
415 add_of_ports br1 2
416 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br1 'ip actions=write_actions(pop_vlan,output:2)'])
417 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=output:10'])
418 AT_CHECK([ovs-appctl ofproto/trace br1 'in_port=20,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_vlan=100,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
419 AT_CHECK([tail -1 stdout], [0],
420 [Datapath actions: pop_vlan,2
421 ])
422 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_vlan=100,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
423 AT_CHECK([tail -1 stdout], [0],
424 [Datapath actions: pop_vlan,2
425 ])
426 OVS_VSWITCHD_STOP
427 AT_CLEANUP
428
429
430 AT_SETUP([ofproto-dpif - select group])
431
432 OVS_VSWITCHD_START
433 add_of_ports br0 1 10 11
434
435 ovs-appctl vlog/set ofproto_dpif:file:dbg
436 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
437 AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
438 ofproto_dpif|DBG|Constructing select group 1234
439 ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
440 ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
441 ofproto_dpif|DBG| Using 16 hash values:
442 ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
443 ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
444 ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 1.
445 ])
446 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
447
448 # Try a bunch of different flows and make sure that they get distributed
449 # # at least somewhat.
450 for 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
455 done
456
457 AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 5 2 dp_hash], [0], [dnl
458 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
459 n_flows=ok n_buckets=ok
460 ])
461
462 OVS_VSWITCHD_STOP
463 AT_CLEANUP
464
465 AT_SETUP([ofproto-dpif - select group with watch port])
466
467 OVS_VSWITCHD_START
468 add_of_ports br0 1 10 11
469 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
470 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
471
472 for 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])
475 done
476
477 AT_CHECK([ovs-appctl dpctl/dump-flows | sort| sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | strip_ufid | strip_used], [0], [dnl
478 flow-dump from non-dpdk interfaces:
479 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:3, bytes:318, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
480 recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:3, bytes:318, used:0.0s, actions:11
481 ])
482
483 OVS_VSWITCHD_STOP
484 AT_CLEANUP
485
486 AT_SETUP([ofproto-dpif - select group with weights])
487
488 # Helper function to check the accuracy of distribution of packets over buckets
489 check_group_stats () {
490 buckets=`grep -o 'packet_count=[[0-9]]*' | cut -d'=' -f2 | tail -n +2`
491 i=0
492 for bucket in $buckets; do
493 min=$1
494 shift
495 if [[ $bucket -ge $min ]]; then
496 echo "bucket$i >= $min"
497 else
498 echo "bucket$i < $min"
499 fi
500 i=`expr $i + 1`
501 if [[ $i -ge 4 ]]; then break; fi
502 done
503 }
504
505 OVS_VSWITCHD_START
506 add_of_ports br0 1 10 11 12 13 14
507
508 ovs-appctl vlog/set ofproto_dpif:file:dbg
509 AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=1234,type=select,bucket=weight:5,output:10,bucket=weight:10,output:11,bucket=weight:25,output:12,bucket=weight:60,output:13,bucket=weight:0,output:14'])
510 AT_CHECK([grep -A9 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
511 ofproto_dpif|DBG|Constructing select group 1234
512 ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
513 ofproto_dpif|DBG| Minimum weight: 5, total weight: 100
514 ofproto_dpif|DBG| Using 32 hash values:
515 ofproto_dpif|DBG| Bucket 0: weight=5, target=1.60 hits=2
516 ofproto_dpif|DBG| Bucket 1: weight=10, target=3.20 hits=3
517 ofproto_dpif|DBG| Bucket 2: weight=25, target=8.00 hits=8
518 ofproto_dpif|DBG| Bucket 3: weight=60, target=19.20 hits=19
519 ofproto_dpif|DBG| Bucket 4: weight=0, target=0.00 hits=0
520 ofproto_dpif|DBG|Use dp_hash with 32 hash values using algorithm 1.
521 ])
522 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
523
524 # Try 1000 different flows and make sure that they get distributed according to weights
525 for 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
532 done
533
534 # Check balanced distribution over 32 dp_hash values
535 AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 32 4 dp_hash], [0], [dnl
536 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:999, bytes:117882, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
537 n_flows=ok n_buckets=ok
538 ])
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
548 ovs-appctl time/warp 1000
549 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-group-stats br0 | sed 's/duration=[[0-9]]\.[[0-9]]*s,//' | check_group_stats 40 80 200 500],
550 [0], [dnl
551 bucket0 >= 40
552 bucket1 >= 80
553 bucket2 >= 200
554 bucket3 >= 500
555 ])
556
557 OVS_VSWITCHD_STOP
558 AT_CLEANUP
559
560 AT_SETUP([ofproto-dpif - select group with explicit dp_hash selection method])
561
562 OVS_VSWITCHD_START
563 add_of_ports br0 1 10 11
564
565 ovs-appctl vlog/set ofproto_dpif:file:dbg
566 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11'])
567 AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
568 ofproto_dpif|DBG|Constructing select group 1234
569 ofproto_dpif|DBG|Selection method specified: dp_hash.
570 ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
571 ofproto_dpif|DBG| Using 16 hash values:
572 ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
573 ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
574 ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 0.
575 ])
576
577 # Fall back to legacy hash with zero buckets
578 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method=dp_hash'])
579 AT_CHECK([grep -A3 "Constructing select group 1235" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
580 ofproto_dpif|DBG|Constructing select group 1235
581 ofproto_dpif|DBG|Selection method specified: dp_hash.
582 ofproto_dpif|DBG| Don't apply dp_hash method without buckets.
583 ofproto_dpif|DBG|Falling back to default hash method.
584 ])
585
586 # Fall back to legacy hash with zero buckets
587 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1236,type=select,selection_method=dp_hash,bucket=weight=1,output:10,bucket=weight=1000,output:11'])
588 AT_CHECK([grep -A4 "Constructing select group 1236" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
589 ofproto_dpif|DBG|Constructing select group 1236
590 ofproto_dpif|DBG|Selection method specified: dp_hash.
591 ofproto_dpif|DBG| Minimum weight: 1, total weight: 1001
592 ofproto_dpif|DBG| Too many hash values required: 1024
593 ofproto_dpif|DBG|Falling back to default hash method.
594 ])
595
596 OVS_VSWITCHD_STOP
597 AT_CLEANUP
598
599 AT_SETUP([ofproto-dpif - select group with legacy hash selection method])
600
601 OVS_VSWITCHD_START
602 add_of_ports br0 1 10 11
603
604 ovs-appctl vlog/set ofproto_dpif:file:dbg
605 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,bucket=output:10,bucket=output:11'])
606 AT_CHECK([grep -A2 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
607 ofproto_dpif|DBG|Constructing select group 1234
608 ofproto_dpif|DBG|Selection method specified: hash.
609 ofproto_dpif|DBG|No hash fields. Falling back to default hash method.
610 ])
611
612 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
613
614 # Try 16 flows with differing default hash values.
615 for 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
620 done
621
622 # Check that the packets installed 16 data path flows and each of the two
623 # buckets is hit at least once.
624 AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
625 n_flows=ok n_buckets=ok
626 ])
627
628 OVS_VSWITCHD_STOP
629 AT_CLEANUP
630
631 AT_SETUP([ofproto-dpif - select group with custom hash selection method])
632
633 OVS_VSWITCHD_START
634 add_of_ports br0 1 10 11
635
636 # Check that parse failures after 'fields' parsing work
637 AT_CHECK([ovs-ofctl -O OpenFlow10 add-group br0 'group_id=1,type=select,fields(eth_dst),bukket=output:10'], [1], ,[dnl
638 ovs-ofctl: unknown keyword bukket
639 ])
640
641 # Check that fields are rejected without "selection_method=hash".
642 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11'], 1, [], [dnl
643 ovs-ofctl: fields may only be specified with "selection_method=hash"
644 ])
645
646 # Check that selection_method_param without selection_method is rejected.
647 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method_param=1,bucket=output:10,bucket=output:11'], 1, [], [dnl
648 ovs-ofctl: selection_method_param is only allowed with "selection_method"
649 ])
650
651 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11'])
652 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
653
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
656 for 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)"
658 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
659 done
660
661 AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
662 n_flows=ok n_buckets=ok
663 ])
664
665 AT_CHECK([ovs-appctl revalidator/purge], [0])
666
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
669 for 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])
672 done
673
674 AT_CHECK([ovs-appctl dpctl/dump-flows | grep -c recirc_id], [0], [dnl
675 1
676 ])
677
678 OVS_VSWITCHD_STOP
679 AT_CLEANUP
680
681 AT_SETUP([ofproto-dpif - fast failover group])
682 OVS_VSWITCHD_START
683 add_of_ports br0 1 10 11
684 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=ff,bucket=watch_port:10,output:10,bucket=watch_port:11,output:11'])
685 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
686 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
687 AT_CHECK([tail -1 stdout], [0],
688 [Datapath actions: 10
689 ])
690 OVS_VSWITCHD_STOP
691 AT_CLEANUP
692
693 AT_SETUP([ofproto-dpif - group stats single bucket])
694 OVS_VSWITCHD_START
695 add_of_ports br0 1 10 11
696 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
697 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
698 (
699 for 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 )
705 AT_CHECK([ovs-appctl revalidator/purge], [0])
706 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
707 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
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
709 OFPST_GROUP reply (OF1.2):
710 ])
711 OVS_VSWITCHD_STOP
712 AT_CLEANUP
713
714 AT_SETUP([ofproto-dpif - group stats all buckets])
715 OVS_VSWITCHD_START
716 add_of_ports br0 1 10 11
717 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
718 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
719 (
720 for 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 )
726 AT_CHECK([ovs-appctl revalidator/purge], [0])
727 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
728 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
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
730 OFPST_GROUP reply (OF1.2):
731 ])
732 OVS_VSWITCHD_STOP
733 AT_CLEANUP
734
735 AT_SETUP([ofproto-dpif - registers])
736 OVS_VSWITCHD_START
737 add_of_ports br0 20 21 22 33 90
738 AT_DATA([flows.txt], [dnl
739 in_port=90 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
740 in_port=91 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
741 in_port=92 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
742 in_port=93 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
743
744 in_port=2 actions=load:0x000db000->NXM_NX_REG0[[]]
745 in_port=3 actions=load:0xdea->NXM_NX_REG0[[20..31]]
746 in_port=4 actions=load:0xeef->NXM_NX_REG0[[0..11]]
747 in_port=5 actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
748 in_port=6 actions=load:0x22222222->NXM_NX_REG2[[]]
749 in_port=7 actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
750 in_port=8 actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
751 in_port=9,reg0=0xdeadbeef actions=output:20
752 in_port=10,reg1=0xdeadbeef actions=output:21
753 in_port=11,reg2=0xeef22dea actions=output:22
754
755 dnl Sanilty check all registers
756 in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
757 in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
758 in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
759 in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
760
761 ])
762 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
763 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
764 AT_CHECK([tail -1 stdout], [0],
765 [Datapath actions: 20,21,22,33
766 ])
767 OVS_VSWITCHD_STOP
768 AT_CLEANUP
769
770 dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
771 dnl in the manner documented in ovs-ofctl(8).
772 AT_SETUP([ofproto-dpif - extended registers])
773 OVS_VSWITCHD_START
774 add_of_ports br0 1 2 3
775 AT_DATA([flows.txt], [dnl
776 table=0 actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
777 table=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.
781 table=0,priority=0 actions=3
782 table=1,priority=0 actions=3
783 ])
784 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
785 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
786 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
787 ])
788 OVS_VSWITCHD_STOP
789 AT_CLEANUP
790
791 dnl Tests that the standardized xxregs are mapped onto the legacy OVS
792 dnl registers in the manner documented in ovs-ofctl(8).
793 AT_SETUP([ofproto-dpif - extended-extended registers])
794 OVS_VSWITCHD_START
795 add_of_ports br0 1 2 3
796 AT_DATA([flows.txt], [dnl
797 table=0 actions=load:0x0123456789abcdeffedcba9876543210->NXM_NX_XXREG1[[]],resubmit(,1)
798 table=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.
802 table=0,priority=0 actions=3
803 table=1,priority=0 actions=3
804 ])
805 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
806 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
807 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
808 ])
809 OVS_VSWITCHD_STOP
810 AT_CLEANUP
811
812 AT_SETUP([ofproto-dpif - load and move order])
813 OVS_VSWITCHD_START
814 add_of_ports br0 1 10 11
815 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,move:NXM_NX_REG1[[]]->NXM_OF_IP_SRC[[]],bucket=output:11'])
816 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(load:0xffffffff->NXM_NX_REG1[[]],move:NXM_NX_REG1[[]]->NXM_NX_REG2[[]],group:1234)'])
817 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
818 AT_CHECK([tail -2 stdout], [0],
819 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
820 Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
821 ])
822 OVS_VSWITCHD_STOP
823 AT_CLEANUP
824
825 dnl Tests that 1.5 copy-field can copy into the standardized xregs.
826 AT_SETUP([ofproto-dpif - copy-field into extended registers])
827 OVS_VSWITCHD_START
828 add_of_ports br0 1 2 3
829 AT_DATA([flows.txt], [dnl
830 table=0 actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
831 table=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.
835 table=0,priority=0 actions=3
836 table=1,priority=0 actions=3
837 ])
838 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
839 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
840 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
841 ])
842 OVS_VSWITCHD_STOP
843 AT_CLEANUP
844
845 dnl Tests that 1.5 set-field with mask in the metadata register.
846 AT_SETUP([ofproto-dpif - masked set-field into metadata])
847 OVS_VSWITCHD_START
848 add_of_ports br0 1 2 3
849 AT_DATA([flows.txt], [dnl
850 table=0 actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
851 table=1 actions=set_field:0x6b/0xff->metadata,goto_table(2)
852 table=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.
856 table=0,priority=0 actions=3
857 table=1,priority=0 actions=3
858 table=2,priority=0 actions=3
859 ])
860 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
861 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
862 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
863 ])
864 OVS_VSWITCHD_STOP
865 AT_CLEANUP
866
867
868 AT_SETUP([ofproto-dpif - actset_output])
869 OVS_VSWITCHD_START
870 add_of_ports br0 1 2 3 4 5 6 7 8 9 10 11 12 13
871 AT_DATA([flows.txt], [dnl
872 table=0,actset_output=unset actions=write_actions(output(2)),goto_table(1)
873 table=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.
876 table=2,priority=20,actset_output=2 actions=4,goto_table(3)
877 table=2,priority=10 actions=5,goto_table(3)
878
879 # Verify that xreg0 got copied properly from actset_output.
880 table=3,priority=20,xreg0=2 actions=6,goto_table(4)
881 table=3,priority=10 actions=7,goto_table(4)
882
883 # Verify that xxreg0 got copied properly from actset_output.
884 table=3,priority=20,xxreg0=2 actions=6,goto_table(4)
885 table=3,priority=10 actions=7,goto_table(4)
886
887 # Verify that adding a group action unsets actset_output,
888 # even if output follows group.
889 table=4 actions=write_actions(group(5),output(10)),goto_table(5)
890 table=5,priority=20,actset_output=unset actions=8,goto_table(6)
891 table=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).
895 table=6 actions=write_actions(output(3)),goto_table(7)
896 table=7,priority=20,actset_output=unset actions=10,goto_table(8)
897 table=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.
901 table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
902 table=9,priority=20,actset_output=2 actions=12
903 table=9,priority=10 actions=13
904 ])
905 AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=5,type=all,bucket=output:1'])
906 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
907 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
908 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
909 ])
910 OVS_VSWITCHD_STOP
911 AT_CLEANUP
912
913 AT_SETUP([ofproto-dpif - push-pop])
914 OVS_VSWITCHD_START
915 add_of_ports br0 20 21 22 33 90
916 AT_DATA([flows.txt], [dnl
917 in_port=90 actions=load:20->NXM_NX_REG0[[0..7]],load:21->NXM_NX_REG1[[0..7]],load:22->NXM_NX_REG2[[0..7]], load:33->NXM_NX_REG3[[0..7]], push:NXM_NX_REG0[[]], push:NXM_NX_REG1[[0..7]],push:NXM_NX_REG2[[0..15]], push:NXM_NX_REG3[[]], resubmit:2, resubmit:3, resubmit:4, resubmit:5
918 in_port=2 actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
919 in_port=3 actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
920 in_port=4 actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
921 in_port=5 actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
922
923 ])
924 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
925 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
926 AT_CHECK([tail -1 stdout], [0],
927 [Datapath actions: 33,22,21,20
928 ])
929 OVS_VSWITCHD_STOP
930 AT_CLEANUP
931
932 AT_SETUP([ofproto-dpif - output])
933 OVS_VSWITCHD_START
934 add_of_ports br0 1 9 10 11 55 66 77 88
935 AT_DATA([flows.txt], [dnl
936 in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
937 in_port=2 actions=output:9
938 in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
939 in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
940 in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
941 in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
942 in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
943 in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
944 ])
945 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
946 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
947 AT_CHECK([tail -1 stdout], [0],
948 [Datapath actions: 9,55,10,55,66,11,77,88,9,1
949 ])
950 OVS_VSWITCHD_STOP
951 AT_CLEANUP
952
953 AT_SETUP([ofproto-dpif - dec_ttl])
954 OVS_VSWITCHD_START
955 add_of_ports br0 1 2 3 4
956 AT_DATA([flows.txt], [dnl
957 table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
958 table=1 in_port=1 action=dec_ttl,output:3
959 ])
960 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
961 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=2,frag=no)' -generate], [0], [stdout])
962 AT_CHECK([tail -4 stdout], [0], [
963 Final flow: ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=111,nw_tos=0,nw_ecn=0,nw_ttl=1
964 Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=2,nw_frag=no
965 Datapath actions: set(ipv4(ttl=1)),2,userspace(pid=0,controller(reason=2,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535)),4
966 ])
967 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=3,frag=no)'], [0], [stdout])
968 AT_CHECK([tail -2 stdout], [0],
969 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=3,nw_frag=no
970 Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
971 ])
972 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)'], [0], [stdout])
973 AT_CHECK([tail -2 stdout], [0],
974 [Megaflow: recirc_id=0,eth,ipv6,in_port=1,nw_ttl=128,nw_frag=no
975 Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
976 ])
977
978 AT_CAPTURE_FILE([ofctl_monitor.log])
979 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
980
981 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=2,frag=no)'
982
983 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
984 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
985 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
986 ip,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=111,nw_tos=0,nw_ecn=0,nw_ttl=1
987 ])
988 OVS_VSWITCHD_STOP
989 AT_CLEANUP
990
991 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
992 dnl buffer to be resized just before pushing the id of the dec_ttl action.
993 dnl Thus the implementation must account for this by using the
994 dnl reallocated buffer rather than the original buffer.
995 dnl
996 dnl A number of similar rules are added to try and exercise
997 dnl xrealloc sufficiently that it returns a different base pointer
998 AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
999 OVS_VSWITCHD_START
1000 add_of_ports br0 1
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
1004 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1005 OVS_VSWITCHD_STOP
1006 AT_CLEANUP
1007
1008 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
1009 dnl buffer to be resized just before pushing the id of the dec_ttl action.
1010 dnl Thus the implementation must account for this by using the
1011 dnl reallocated buffer rather than the original buffer.
1012 dnl
1013 dnl A number of similar rules are added to try and exercise
1014 dnl xrealloc sufficiently that it returns a different base pointer
1015 AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
1016 OVS_VSWITCHD_START
1017 add_of_ports br0 1
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
1021 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1022 OVS_VSWITCHD_STOP
1023 AT_CLEANUP
1024
1025 dnl A note action at offset 24 in ofpacts will cause the ofpacts
1026 dnl buffer to be resized just before pushing the id of the dec_ttl action.
1027 dnl Thus the implementation must account for this by using the
1028 dnl reallocated buffer rather than the original buffer.
1029 dnl
1030 dnl A number of similar rules are added to try and exercise
1031 dnl xrealloc sufficiently that it returns a different base pointer
1032 AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
1033 OVS_VSWITCHD_START
1034 add_of_ports br0 1
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
1038 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1039 OVS_VSWITCHD_STOP
1040 AT_CLEANUP
1041
1042 dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
1043 dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
1044 dnl Using `make check-valgrind' here checks for use-after-free in this
1045 dnl codepath.
1046 AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
1047 OVS_VSWITCHD_START
1048 AT_CHECK([ovs-ofctl add-flow br0 'actions=set_field:0x1->metadata,set_field:0x2->metadata,set_field:0x3->metadata,set_field:0x4->metadata,note:00000000000000000000000000000000,note:00000000000000000000000000000000'])
1049 OVS_VSWITCHD_STOP
1050 AT_CLEANUP
1051
1052 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
1053 OVS_VSWITCHD_START
1054 add_of_ports br0 1 2
1055
1056 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
1057
1058 # "in_port" defaults to OFPP_NONE if it's not specified.
1059 flow="icmp,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,icmp_type=8,icmp_code=0"
1060 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
1061 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
1062 1
1063 2
1064 100
1065 ])
1066
1067 OVS_VSWITCHD_STOP
1068 AT_CLEANUP
1069
1070 AT_SETUP([ofproto-dpif - DSCP])
1071 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
1072 add_of_ports br0 9
1073 AT_DATA([flows.txt], [dnl
1074 actions=output:LOCAL,enqueue:1:1,enqueue:1:2,enqueue:1:2,enqueue:1:1,output:1,mod_nw_tos:0,output:1,output:LOCAL
1075 ])
1076 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1077 AT_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])
1082 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(9),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xff,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
1083 AT_CHECK([tail -2 stdout], [0],
1084 [Megaflow: recirc_id=0,skb_priority=0,eth,ip,in_port=9,nw_tos=252,nw_frag=no
1085 Datapath actions: dnl
1086 100,dnl
1087 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1088 set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
1089 1,dnl
1090 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1091 set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
1092 set(ipv4(tos=0/0xfc)),1,100
1093 ])
1094 OVS_VSWITCHD_STOP
1095 AT_CLEANUP
1096
1097 AT_SETUP([ofproto-dpif - output/flood flags])
1098 OVS_VSWITCHD_START
1099 add_of_ports br0 1 2 3 4 5 6 7
1100
1101 AT_DATA([flows.txt], [dnl
1102 in_port=local actions=local,flood
1103 in_port=1 actions=flood
1104 in_port=2 actions=all
1105 in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
1106 in_port=4 actions=enqueue:LOCAL:1,enqueue:1:1,enqueue:2:1,enqueue:3:2,enqueue:4:1,enqueue:5:1,enqueue:6:1,enqueue:7:1
1107 ])
1108 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1109 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
1110 AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
1111
1112 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
1113 AT_CHECK([tail -1 stdout \
1114 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
1115 1
1116 2
1117 3
1118 4
1119 7
1120 ])
1121
1122 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
1123 AT_CHECK([tail -1 stdout \
1124 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
1125 100
1126 2
1127 3
1128 4
1129 7
1130 ])
1131
1132 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
1133 AT_CHECK([tail -1 stdout \
1134 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
1135 1
1136 100
1137 3
1138 4
1139 6
1140 7
1141 ])
1142
1143 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
1144 AT_CHECK([tail -1 stdout], [0],
1145 [Datapath actions: 100,1,2,4,6,7
1146 ])
1147
1148 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(4),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
1149 AT_CHECK([tail -1 stdout], [0],
1150 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
1151 ])
1152 OVS_VSWITCHD_STOP
1153 AT_CLEANUP
1154
1155 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
1156 OVS_VSWITCHD_START([dnl
1157 add-port br0 p1 -- set Interface p1 type=dummy
1158 ])
1159 on_exit 'kill `cat ovs-ofctl.pid`'
1160
1161 AT_CAPTURE_FILE([ofctl_monitor.log])
1162
1163 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1164
1165 for i in 1 2 3 ; do
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)'
1167 done
1168 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1169 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1170 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1171 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1172 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:2e7e
1173 dnl
1174 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1175 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:2e7e
1176 dnl
1177 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1178 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:2e7e
1179 ])
1180
1181 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1182 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1183 NXST_FLOW reply:
1184 ])
1185
1186 OVS_VSWITCHD_STOP
1187 AT_CLEANUP
1188
1189 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
1190 OVS_VSWITCHD_START([dnl
1191 add-port br0 p1 -- set Interface p1 type=dummy
1192 ])
1193 on_exit 'kill `cat ovs-ofctl.pid`'
1194
1195 AT_CAPTURE_FILE([ofctl_monitor.log])
1196 AT_CHECK([ovs-ofctl del-flows br0])
1197
1198 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1199
1200 dnl Test that missed packets are dropped
1201 for i in 1 2 3 ; do
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)'
1203 done
1204 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1205
1206 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1207 ])
1208
1209 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1210 AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1211 OFPST_FLOW reply (OF1.3):
1212 ])
1213
1214 OVS_VSWITCHD_STOP
1215 AT_CLEANUP
1216
1217 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
1218 OVS_VSWITCHD_START([dnl
1219 add-port br0 p1 -- set Interface p1 type=dummy
1220 ])
1221 on_exit 'kill `cat ovs-ofctl.pid`'
1222
1223 AT_CAPTURE_FILE([ofctl_monitor.log])
1224 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1225
1226 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1227
1228 for i in 1 2 3 ; do
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)'
1230 done
1231 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1232 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1233 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1234 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1235 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:2e5c
1236 dnl
1237 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1238 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:2e5c
1239 dnl
1240 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1241 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:2e5c
1242 ])
1243
1244 AT_CHECK([ovs-appctl revalidator/purge], [0])
1245 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1246 n_packets=3, n_bytes=162, actions=goto_table:1
1247 OFPST_FLOW reply (OF1.2):
1248 ])
1249
1250 OVS_VSWITCHD_STOP
1251 AT_CLEANUP
1252
1253 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
1254 OVS_VSWITCHD_START([dnl
1255 add-port br0 p1 -- set Interface p1 type=dummy
1256 ])
1257 on_exit 'kill `cat ovs-ofctl.pid`'
1258
1259 AT_CAPTURE_FILE([ofctl_monitor.log])
1260 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1261
1262 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1263
1264 for 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)'
1266 done
1267
1268 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1269 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1270 ])
1271
1272 AT_CHECK([ovs-appctl revalidator/purge], [0])
1273 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1274 n_packets=3, n_bytes=354, actions=resubmit(1,1)
1275 OFPST_FLOW reply (OF1.2):
1276 ])
1277
1278 OVS_VSWITCHD_STOP
1279 AT_CLEANUP
1280
1281 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1282 OVS_VSWITCHD_START([dnl
1283 add-port br0 p1 -- set Interface p1 type=dummy
1284 ])
1285 on_exit 'kill `cat ovs-ofctl.pid`'
1286
1287 AT_CAPTURE_FILE([ofctl_monitor.log])
1288 AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1289 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1290
1291 dnl Miss table 0, Hit table 1
1292 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1293
1294 for 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)'
1296 done
1297 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1298 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1299
1300 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1301 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1302 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1303 dnl
1304 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1305 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1306 dnl
1307 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1308 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1309 ])
1310
1311 dnl Hit table 0, Miss all other tables, sent to controller
1312 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1313
1314 for 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)'
1316 done
1317 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1318 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1319
1320 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1321 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1322 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1323 dnl
1324 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1325 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1326 dnl
1327 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1328 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1329 ])
1330
1331 AT_CHECK([ovs-appctl revalidator/purge], [0])
1332 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1333 table=1, n_packets=3, n_bytes=354, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1334 OFPST_FLOW reply (OF1.2):
1335 ])
1336
1337 OVS_VSWITCHD_STOP
1338 AT_CLEANUP
1339
1340 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1341 OVS_VSWITCHD_START([dnl
1342 add-port br0 p1 -- set Interface p1 type=dummy
1343 ])
1344 on_exit 'kill `cat ovs-ofctl.pid`'
1345
1346 AT_CAPTURE_FILE([ofctl_monitor.log])
1347 AT_DATA([flows.txt], [dnl
1348 table=0 actions=goto_table(1)
1349 table=2 dl_src=10:11:11:11:11:11 actions=controller
1350 ])
1351 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1352 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1353
1354 dnl Hit table 0, Miss table 1, Hit table 2
1355 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1356
1357 for 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)'
1359 done
1360 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1361 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1362
1363 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1364 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1365 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1366 dnl
1367 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1368 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1369 dnl
1370 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1371 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1372 ])
1373
1374 dnl Hit table 1, Miss all other tables, sent to controller
1375 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1376
1377 for 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)'
1379 done
1380 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1381 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1382
1383 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1384 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1385 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1386 dnl
1387 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1388 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1389 dnl
1390 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1391 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1392 ])
1393
1394 AT_CHECK([ovs-appctl revalidator/purge], [0])
1395 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
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
1398 OFPST_FLOW reply (OF1.2):
1399 ])
1400
1401 OVS_VSWITCHD_STOP
1402 AT_CLEANUP
1403
1404 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1405 OVS_VSWITCHD_START([dnl
1406 add-port br0 p1 -- set Interface p1 type=dummy
1407 ])
1408 on_exit 'kill `cat ovs-ofctl.pid`'
1409
1410 AT_CAPTURE_FILE([ofctl_monitor.log])
1411 AT_DATA([flows.txt], [dnl
1412 table=0 actions=resubmit(1,1)
1413 table=2 dl_src=10:11:11:11:11:11 actions=controller
1414 ])
1415 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1416 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1417
1418 dnl Hit table 0, Miss table 1, Dropped
1419 AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1420
1421 for 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)'
1423 done
1424 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1425
1426 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1427 ])
1428
1429 dnl Hit table 1, Dropped
1430 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1431
1432 for 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)'
1434 done
1435 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1436
1437 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1438 ])
1439
1440 AT_CHECK([ovs-appctl revalidator/purge], [0])
1441 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1442 n_packets=6, n_bytes=708, actions=resubmit(1,1)
1443 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1444 OFPST_FLOW reply (OF1.2):
1445 ])
1446
1447 OVS_VSWITCHD_STOP
1448 AT_CLEANUP
1449
1450 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1451 OVS_VSWITCHD_START([dnl
1452 add-port br0 p1 -- set Interface p1 type=dummy
1453 ])
1454 on_exit 'kill `cat ovs-ofctl.pid`'
1455
1456 AT_CAPTURE_FILE([ofctl_monitor.log])
1457 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1458
1459 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1460
1461 dnl Test that missed packets are dropped
1462 for 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)'
1464 done
1465 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1466
1467 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1468 ])
1469
1470 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1471 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1472 NXST_FLOW reply:
1473 ])
1474
1475 OVS_VSWITCHD_STOP
1476 AT_CLEANUP
1477
1478 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1479 OVS_VSWITCHD_START([dnl
1480 add-port br0 p1 -- set Interface p1 type=dummy
1481 ])
1482 on_exit 'kill `cat ovs-ofctl.pid`'
1483
1484 AT_CAPTURE_FILE([ofctl_monitor.log])
1485 AT_CHECK([ovs-ofctl del-flows br0])
1486 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1487 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1488
1489 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1490
1491 dnl Test that missed packets are dropped
1492 for 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)'
1494 done
1495 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1496
1497 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1498 ])
1499
1500 AT_CHECK([ovs-appctl revalidator/purge], [0])
1501 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1502 n_packets=3, n_bytes=354, actions=goto_table:1
1503 OFPST_FLOW reply (OF1.2):
1504 ])
1505
1506 OVS_VSWITCHD_STOP
1507 AT_CLEANUP
1508
1509 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1510 OVS_VSWITCHD_START([dnl
1511 add-port br0 p1 -- set Interface p1 type=dummy
1512 ])
1513 on_exit 'kill `cat ovs-ofctl.pid`'
1514
1515 AT_CAPTURE_FILE([ofctl_monitor.log])
1516 AT_CHECK([ovs-ofctl del-flows br0])
1517 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1518 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1519
1520 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1521
1522 dnl Test that missed packets are dropped
1523 for 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)'
1525 done
1526 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1527
1528 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1529 ])
1530
1531 AT_CHECK([ovs-appctl revalidator/purge], [0])
1532 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1533 n_packets=3, n_bytes=354, actions=resubmit(1,1)
1534 OFPST_FLOW reply (OF1.2):
1535 ])
1536
1537 OVS_VSWITCHD_STOP
1538 AT_CLEANUP
1539
1540 AT_SETUP([ofproto-dpif - controller])
1541 OVS_VSWITCHD_START([dnl
1542 add-port br0 p1 -- set Interface p1 type=dummy
1543 ])
1544 on_exit 'kill `cat ovs-ofctl.pid`'
1545
1546 AT_CAPTURE_FILE([ofctl_monitor.log])
1547 AT_DATA([flows.txt], [dnl
1548 cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
1549 cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
1550 cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1551
1552 cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1553 cookie=0x4 table=2 in_port=81 actions=load:2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,controller,resubmit(82,3)
1554 cookie=0x5 table=3 in_port=82 actions=load:3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,controller,resubmit(83,4)
1555 cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1556 cookie=0x7 table=5 in_port=84 actions=load:5->NXM_NX_REG4[[]],load:6->NXM_NX_TUN_ID[[]],mod_nw_dst:84.84.84.84,controller,resubmit(85,6)
1557 cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1558 cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
1559 cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
1560 cookie=0xd dl_src=80:88:88:88:88:88 arp actions=load:2->OXM_OF_ARP_OP[[]],controller,load:0xc0a88001->OXM_OF_ARP_SPA[[]],controller,load:0x404444444441->OXM_OF_ARP_THA[[]],load:0x01010101->OXM_OF_ARP_SPA[[]],load:0x02020202->OXM_OF_ARP_TPA[[]],controller
1561 ])
1562 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1563
1564 dnl Flow miss.
1565 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1566
1567 for i in 1 2 3 ; do
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)'
1569 done
1570 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1571 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1572
1573 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1574 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1575 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1576 dnl
1577 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1578 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1579 dnl
1580 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1581 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1582 ])
1583
1584 dnl Singleton controller action.
1585 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1586
1587 for i in 1 2 3 ; do
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)'
1589 done
1590 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1591 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1592
1593 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1594 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1595 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
1596 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1597 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
1598 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1599 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
1600 ])
1601
1602 dnl Modified controller action.
1603 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1604
1605 for i in 1 2 3 ; do
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)'
1607 done
1608 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1609 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1610
1611 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1612 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1613 tcp,dl_vlan=15,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:2e7e
1614 dnl
1615 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1616 tcp,dl_vlan=15,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:2e7e
1617 dnl
1618 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1619 tcp,dl_vlan=15,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:2e7e
1620 ])
1621
1622 dnl Modified VLAN controller action.
1623 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1624
1625 for i in 1 2 3; do
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)'
1627 done
1628 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1629 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1630
1631 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1632 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1633 ip,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1634 dnl
1635 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1636 ip,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1637 dnl
1638 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1639 ip,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1640 ])
1641
1642 dnl Checksum TCP.
1643 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1644
1645 for 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)'
1647 done
1648 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1649 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1650
1651 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1652 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1653 tcp,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
1654 dnl
1655 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=58 reg0=0x1,in_port=1 (via action) data_len=58 (unbuffered)
1656 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
1657 dnl
1658 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=58 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=58 (unbuffered)
1659 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
1660 dnl
1661 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=58 (unbuffered)
1662 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
1663 dnl
1664 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=58 (unbuffered)
1665 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:4880
1666 dnl
1667 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1668 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:6082
1669 dnl
1670 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1671 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=11,tcp_flags=fin tcp_csum:6035
1672 dnl
1673 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1674 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86,tcp_flags=fin tcp_csum:5fea
1675 dnl
1676 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1677 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86,tcp_flags=fin tcp_csum:5fea
1678 ])
1679
1680 dnl Checksum UDP.
1681 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1682
1683 for 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'
1685 done
1686 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1687 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1688
1689 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1690 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1691 udp,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1692 dnl
1693 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
1694 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1695 dnl
1696 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=64 (unbuffered)
1697 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1698 dnl
1699 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=64 (unbuffered)
1700 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1701 dnl
1702 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=64 (unbuffered)
1703 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:2c37
1704 dnl
1705 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1706 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:4439
1707 dnl
1708 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1709 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=11 udp_csum:43ec
1710 dnl
1711 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1712 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 udp_csum:43a1
1713 dnl
1714 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1715 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 udp_csum:43a1
1716 ])
1717
1718 dnl Modified ARP controller action.
1719 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1720
1721 for 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)'
1723 done
1724
1725 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1726 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1727 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1728 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1729 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1730 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1731 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1732 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1733 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=1.1.1.1,arp_tpa=2.2.2.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
1734 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1735 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1736 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1737 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1738 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1739 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=1.1.1.1,arp_tpa=2.2.2.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
1740 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1741 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1742 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1743 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1744 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1745 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=1.1.1.1,arp_tpa=2.2.2.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
1746 ])
1747
1748 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1749
1750 dnl Checksum SCTP.
1751 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1752
1753 for 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'
1755 done
1756
1757 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1758 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1759 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1760 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1761 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
1762 sctp,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1763 dnl
1764 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
1765 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1766 dnl
1767 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=102 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=102 (unbuffered)
1768 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1769 dnl
1770 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=102 (unbuffered)
1771 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1772 dnl
1773 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=102 (unbuffered)
1774 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1775 dnl
1776 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
1777 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1778 dnl
1779 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
1780 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=2223 sctp_csum:dd778f5f
1781 dnl
1782 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
1783 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 sctp_csum:62051f56
1784 dnl
1785 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
1786 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 sctp_csum:62051f56
1787 ])
1788
1789 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
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
1802 NXST_FLOW reply:
1803 ])
1804
1805 OVS_VSWITCHD_STOP
1806 AT_CLEANUP
1807
1808
1809 AT_SETUP([ofproto-dpif - controller with slow-path action])
1810 OVS_VSWITCHD_START
1811 add_of_ports br0 1 2
1812
1813 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,controller"])
1814
1815 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1816
1817 for 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)'
1819 done
1820
1821 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
1822 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1823
1824 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1825 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1826 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1827 dnl
1828 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1829 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1830 dnl
1831 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1832 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1833 ])
1834
1835 OVS_VSWITCHD_STOP
1836 AT_CLEANUP
1837
1838
1839 AT_SETUP([ofproto-dpif - controller action without megaflows])
1840 OVS_VSWITCHD_START
1841 add_of_ports br0 1
1842
1843 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,action=controller])
1844 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [dnl
1845 megaflows disabled
1846 ])
1847
1848 AT_CAPTURE_FILE([ofctl_monitor.log])
1849 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1850
1851 for 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)'])
1853 done
1854
1855 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
1856 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1857
1858 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1859 flow-dump from non-dpdk interfaces:
1860 packets:1, bytes:14, used:0.001s, actions:userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
1861 ])
1862
1863 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1864 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1865 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1866 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1867 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1868 ])
1869
1870 AT_CHECK([ovs-appctl revalidator/purge])
1871 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1872
1873 dnl Add a controller meter.
1874 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=controller pktps stats bands=type=drop rate=2'])
1875
1876 dnl Advance time by 1 second.
1877 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1878
1879 for 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)'])
1881 done
1882
1883 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1884 flow-dump from non-dpdk interfaces:
1885 packets:7, bytes:98, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=2,rule_cookie=0,controller_id=0,max_len=65535))))
1886 ])
1887
1888 AT_CHECK([ovs-appctl time/warp 1], [0], [ignore])
1889 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1890
1891 dnl Out of 8 packets we sent, two were passed by the rate limiter, and
1892 dnl the rest of packets were blocked.
1893 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1894 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1895 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1896 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1897 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1898 ])
1899 dnl Check meter stats to make it gives the same picture;
1900 dnl 7 packets hit the meter, but 6 packets are dropped by band0.
1901 AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
1902 OFPST_METER reply (OF1.3) (xid=0x2):
1903 meter:controller flow_count:0 packet_in_count:8 byte_in_count:112 duration:0.0s bands:
1904 0: packet_count:6 byte_count:84
1905 ])
1906
1907 OVS_VSWITCHD_STOP
1908 AT_CLEANUP
1909
1910 AT_SETUP([ofproto-dpif - MPLS handling])
1911 OVS_VSWITCHD_START([dnl
1912 add-port br0 p1 -- set Interface p1 type=dummy
1913 ])
1914 on_exit 'kill `cat ovs-ofctl.pid`'
1915
1916 AT_CAPTURE_FILE([ofctl_monitor.log])
1917 AT_DATA([flows.txt], [dnl
1918 cookie=0xa dl_src=40:44:44:44:44:42 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
1919 cookie=0xa dl_src=41:44:44:44:44:42 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],pop_mpls:0x0800,controller
1920 cookie=0xa dl_src=40:44:44:44:44:43 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
1921 cookie=0xa dl_src=40:44:44:44:44:44 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
1922 cookie=0xa dl_src=40:44:44:44:44:45 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,controller
1923 cookie=0xa dl_src=40:44:44:44:44:46 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),controller
1924 cookie=0xa dl_src=40:44:44:44:44:47 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,set_mpls_ttl(10),controller
1925 cookie=0xa dl_src=40:44:44:44:44:48 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),dec_mpls_ttl,controller
1926 cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
1927 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1928 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1929 cookie=0xc dl_src=70:77:77:77:77:77 actions=push_mpls:0x8848,load:1000->OXM_OF_MPLS_LABEL[[]],load:7->OXM_OF_MPLS_TC[[]],controller
1930
1931 cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1932 cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1933 cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1934 cookie=0xd dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:OXM_OF_IPV4_DST[[]],pop:OXM_OF_IPV4_SRC[[]],controller
1935 cookie=0xd dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,1,0,OXM_OF_IPV4_SRC[[0..7]]),controller
1936 cookie=0xd dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,OXM_OF_IPV4_SRC[[0..15]],slaves:1,2),controller
1937 cookie=0xd dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,OXM_OF_IPV4_SRC[[]]=OXM_OF_IPV4_DST[[]]),controller
1938
1939 cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1940 cookie=0xd table=1 arp actions=controller
1941
1942 cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1943 cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1944 cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1945 cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1946
1947 cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1948 cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1949 cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1950
1951 cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
1952 cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1953 cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1954
1955 cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1956 cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1957 cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1958
1959 cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1960 cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1961 cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1962
1963 cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1964 cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1965 cookie=0x5 dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
1966 ])
1967 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1968
1969 dnl Modified MPLS controller action.
1970 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1971
1972 for i in 1 2 3; do
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)'
1974 done
1975 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1976 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1977
1978 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1979 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
1980 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:42,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1981 dnl
1982 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
1983 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:42,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1984 dnl
1985 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
1986 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:42,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1987 ])
1988
1989 dnl Modified MPLS controller action.
1990 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1991
1992 for i in 1 2 3; do
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)'
1994 done
1995 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1996 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1997
1998 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1999 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
2000 ip,vlan_tci=0x0000,dl_src=41:44:44:44:44:42,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
2001 dnl
2002 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
2003 ip,vlan_tci=0x0000,dl_src=41:44:44:44:44:42,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
2004 dnl
2005 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
2006 ip,vlan_tci=0x0000,dl_src=41:44:44:44:44:42,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
2007 ])
2008
2009 dnl Modified MPLS controller action.
2010 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2011
2012 dnl in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x8847),mpls(label=100,tc=3,ttl=64,bos=1)
2013
2014 for 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)'
2016 done
2017 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2018 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2019
2020 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2021 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2022 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=46912
2023 dnl
2024 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2025 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=46912
2026 dnl
2027 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2028 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=46912
2029 ])
2030
2031 dnl Modified MPLS controller action.
2032 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2033
2034 for i in 1 2 3; do
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))'
2036 done
2037 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2038 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2039
2040 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2041 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2042 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
2043 dnl
2044 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2045 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
2046 dnl
2047 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2048 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
2049 ])
2050
2051 dnl Modified MPLS controller action.
2052 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2053
2054 for i in 1 2 3; do
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)'
2056 done
2057 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2058 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2059
2060 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2061 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2062 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=63,mpls_bos=1
2063 dnl
2064 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2065 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=63,mpls_bos=1
2066 dnl
2067 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2068 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=63,mpls_bos=1
2069 ])
2070
2071 dnl Modified MPLS controller action.
2072 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2073
2074 for i in 1 2 3; do
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)'
2076 done
2077 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2078 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2079
2080 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2081 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2082 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2083 dnl
2084 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2085 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2086 dnl
2087 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2088 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2089 ])
2090
2091 dnl Modified MPLS controller action.
2092 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2093
2094 for i in 1 2 3; do
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)'
2096 done
2097 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2098 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2099
2100 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2101 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2102 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2103 dnl
2104 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2105 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2106 dnl
2107 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2108 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2109 ])
2110
2111 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2112
2113 dnl Modified MPLS controller action.
2114 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2115
2116 for 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)'
2118 done
2119 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2120 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2121
2122 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2123 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2124 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
2125 dnl
2126 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2127 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
2128 dnl
2129 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2130 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
2131 ])
2132
2133 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2134
2135 dnl Modified MPLS controller action.
2136 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2137
2138 for i in 1 2 3; do
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)'
2140 done
2141 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2142 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2143
2144 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2145 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2146 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=9,mpls_bos=1
2147 dnl
2148 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2149 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=9,mpls_bos=1
2150 dnl
2151 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2152 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=9,mpls_bos=1
2153 ])
2154
2155 dnl Modified MPLS actions.
2156 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2157
2158 for i in 1 2 3; do
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)'
2160 done
2161 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2162 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2163
2164 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2165 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
2166 mpls,vlan_tci=0x0000,dl_src=50:55:55:55:55:55,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
2167 dnl
2168 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
2169 mpls,vlan_tci=0x0000,dl_src=50:55:55:55:55:55,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
2170 dnl
2171 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
2172 mpls,vlan_tci=0x0000,dl_src=50:55:55:55:55:55,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
2173 ])
2174
2175 dnl Modified MPLS ipv6 controller action.
2176 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2177
2178 for 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)'
2180 done
2181 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2182 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2183
2184 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2185 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2186 mplsm,vlan_tci=0x0000,dl_src=70:77:77:77:77:77,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=128,mpls_bos=1
2187 dnl
2188 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2189 mplsm,vlan_tci=0x0000,dl_src=70:77:77:77:77:77,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=128,mpls_bos=1
2190 dnl
2191 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2192 mplsm,vlan_tci=0x0000,dl_src=70:77:77:77:77:77,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=128,mpls_bos=1
2193 ])
2194
2195
2196 dnl Modified MPLS pop action.
2197 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
2198 dnl 60:66:66:66:66:66 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2199 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
2200
2201 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2202
2203 for i in 1 2 3; do
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'
2205 done
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
2209 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2210 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2211
2212 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2213 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2214 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2215 dnl
2216 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2217 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2218 dnl
2219 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2220 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2221 ])
2222
2223 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2224
2225 dnl Modified MPLS pop action.
2226 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2227 dnl 60:66:66:66:00:01 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2228 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2229 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2230 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2231
2232 for 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'
2234 done
2235 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2236 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2237
2238 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2239 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2240 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2241 dnl
2242 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2243 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2244 dnl
2245 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2246 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2247 ])
2248
2249 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2250
2251 dnl Modified MPLS pop action.
2252 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2253 dnl 60:66:66:66:00:02 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2254 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2255 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2256 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2257
2258 for 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'
2260 done
2261 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2262 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2263
2264 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2265 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2266 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2267 dnl
2268 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2269 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2270 dnl
2271 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2272 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2273 ])
2274
2275 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2276
2277 dnl Modified MPLS pop action.
2278 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2279 dnl 60:66:66:66:00:03 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2280 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2281 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2282 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2283
2284 for 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'
2286 done
2287 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2288 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2289
2290 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2291 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2292 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2293 dnl
2294 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2295 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2296 dnl
2297 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2298 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2299 ])
2300
2301 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2302
2303 dnl Modified MPLS pop action.
2304 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2305 dnl 60:66:66:66:00:04 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2306 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2307 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2308 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2309
2310 for 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'
2312 done
2313 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2314 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2315
2316 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2317 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2318 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2319 dnl
2320 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2321 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2322 dnl
2323 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2324 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2325 ])
2326
2327 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2328
2329 dnl Modified MPLS pop action.
2330 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2331 dnl 60:66:66:66:00:05 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2332 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2333 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2334 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2335
2336 for 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'
2338 done
2339 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2340 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2341
2342 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2343 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2344 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2345 dnl
2346 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2347 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2348 dnl
2349 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2350 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2351 ])
2352
2353 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2354
2355 dnl Modified MPLS pop action.
2356 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2357 dnl 60:66:66:66:00:06 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2358 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2359 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2360 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2361
2362 for 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'
2364 done
2365 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2366 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2367
2368 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2369 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2370 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2371 dnl
2372 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2373 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2374 dnl
2375 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2376 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2377 ])
2378
2379 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2380
2381 dnl Modified MPLS pop action.
2382 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2383 dnl 60:66:66:66:00:07 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2384 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2385 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2386 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2387
2388 for 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'
2390 done
2391 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2392 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2393
2394 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2395 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2396 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2397 dnl
2398 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2399 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2400 dnl
2401 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2402 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2403 ])
2404
2405 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2406
2407 dnl Modified MPLS pop action.
2408 dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2409 dnl 60:66:66:66:00:08 > ff:ff:ff:ff:ff:ff, ethertype MPLS unicast (0x8847), length 46: MPLS (label 20, exp 0, [S], ttl 32)
2410 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2411
2412 for 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'
2414 done
2415 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2416 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2417
2418 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2419 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2420 arp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
2421 dnl
2422 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2423 arp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
2424 dnl
2425 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2426 arp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
2427 ])
2428
2429 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2430
2431 dnl Modified MPLS pop action.
2432 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2433 dnl 60:66:66:66:00:09 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2434 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2435 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2436 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2437
2438 for 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'
2440 done
2441 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2442 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2443
2444 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2445 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2446 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2447 dnl
2448 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2449 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2450 dnl
2451 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2452 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2453 ])
2454
2455 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2456
2457 dnl Modified MPLS pop action.
2458 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2459 dnl 60:66:66:66:00:0a > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2460 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2461 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2462 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2463
2464 for 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'
2466 done
2467 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2468 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2469
2470 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2471 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2472 tcp,vlan_tci=0x0000,dl_src=60:66:66:66: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
2473 dnl
2474 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2475 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2476 dnl
2477 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2478 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2479 ])
2480
2481 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2482
2483 dnl Modified MPLS pop action.
2484 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2485 dnl 60:66:66:66:00:0b > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2486 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2487 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2488 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2489
2490 for 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'
2492 done
2493 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2494 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2495
2496 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2497 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2498 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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
2499 dnl
2500 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2501 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
2502 dnl
2503 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2504 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
2505 ])
2506
2507 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2508
2509 dnl Modified MPLS pop action.
2510 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2511 dnl 60:66:66:66:01:00 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2512 dnl (label 20, exp 0, [S], ttl 31)
2513 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2514 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2515 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2516
2517 for 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'
2519 done
2520 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2521 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2522
2523 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2524 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2525 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2526 dnl
2527 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2528 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2529 dnl
2530 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2531 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2532 ])
2533
2534 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2535
2536 dnl Modified MPLS pop action.
2537 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2538 dnl 60:66:66:66:01:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2539 dnl (label 20, exp 0, [S], ttl 31)
2540 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2541 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2542 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2543
2544 for 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'
2546 done
2547 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2548 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2549
2550 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2551 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2552 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2553 dnl
2554 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2555 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2556 dnl
2557 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2558 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2559 ])
2560
2561 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2562
2563 dnl Modified MPLS pop action.
2564 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2565 dnl 60:66:66:66:01:02 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2566 dnl (label 20, exp 0, [S], ttl 31)
2567 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2568 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2569 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2570
2571 for 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'
2573 done
2574 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2575 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2576
2577 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2578 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2579 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
2580 dnl
2581 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2582 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
2583 dnl
2584 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2585 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
2586 ])
2587
2588 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2589
2590 dnl Modified MPLS pop action.
2591 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2592 dnl 60:66:66:66:02:00 > 50:54:00:00:02:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2593 dnl (label 20, exp 0, [S], ttl 31)
2594 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2595 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2596 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2597
2598 for 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'
2600 done
2601 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2602 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2603
2604 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2605 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2606 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2607 dnl
2608 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2609 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2610 dnl
2611 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2612 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2613 ])
2614
2615 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2616
2617 dnl Modified MPLS pop action.
2618 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2619 dnl 60:66:66:66:02:01 > 50:54:00:00:02:01, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2620 dnl (label 20, exp 0, [S], ttl 31)
2621 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2622 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2623 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2624
2625 for 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'
2627 done
2628
2629 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2630 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2631
2632 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2633 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2634 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2635 dnl
2636 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2637 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2638 dnl
2639 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2640 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2641 ])
2642
2643 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2644
2645 dnl Modified MPLS pop action.
2646 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2647 dnl 60:66:66:66:02:10 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2648 dnl (label 20, exp 0, [S], ttl 31)
2649 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2650 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2651 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2652
2653 for 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'
2655 done
2656 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2657 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2658
2659 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2660 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2661 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2662 dnl
2663 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2664 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2665 dnl
2666 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2667 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2668 ])
2669
2670 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2671
2672 dnl Modified MPLS pop action.
2673 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2674 dnl 60:66:66:66:03:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2675 dnl (label 20, exp 0, ttl 31)
2676 dnl (label 20, exp 0, [S], ttl 30)
2677 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2678 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2679 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2680
2681 for 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'
2683 done
2684 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2685 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2686
2687 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2688 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2689 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2690 dnl
2691 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2692 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2693 dnl
2694 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2695 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2696 ])
2697
2698 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2699
2700 dnl Modified MPLS pop action.
2701 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2702 dnl 60:66:66:66:03:01 > 50:54:00:00:00:00, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2703 dnl (label 20, exp 0, ttl 31)
2704 dnl (label 20, exp 0, [S], ttl 30)
2705 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2706 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2707 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2708
2709 for 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'
2711 done
2712 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2713 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2714
2715 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2716 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2717 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2718 dnl
2719 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2720 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2721 dnl
2722 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2723 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2724 ])
2725
2726 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2727
2728 dnl Modified MPLS pop action.
2729 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2730 dnl 60:66:66:66:03:10 > 50:54:00:00:00:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2731 dnl (label 20, exp 0, ttl 31)
2732 dnl (label 20, exp 0, [S], ttl 30)
2733 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2734 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2735 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2736
2737 for 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'
2739 done
2740 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2741 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2742
2743 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2744 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2745 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2746 dnl
2747 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2748 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2749 dnl
2750 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2751 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2752 ])
2753
2754 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2755
2756 dnl Modified MPLS pop action.
2757 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2758 dnl 60:66:66:66:04:00 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2759 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2760 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2761 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2762
2763 for 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'
2765 done
2766 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2767 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2768
2769 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2770 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2771 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
2772 dnl
2773 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2774 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
2775 dnl
2776 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2777 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
2778 ])
2779
2780 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2781
2782 dnl Modified MPLS pop action.
2783 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2784 dnl 60:66:66:66:04:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2785 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2786 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2787 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2788
2789 for 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'
2791 done
2792 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2793 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2794
2795 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2796 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2797 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
2798 dnl
2799 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2800 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
2801 dnl
2802 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2803 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
2804 ])
2805
2806 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2807
2808 dnl Modified MPLS pop action.
2809 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2810 dnl 60:66:66:66:04:10 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2811 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2812 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2813 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2814
2815 for 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'
2817 done
2818 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2819 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2820
2821 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2822 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2823 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
2824 dnl
2825 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2826 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
2827 dnl
2828 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2829 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
2830 ])
2831
2832 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2833
2834 dnl Modified MPLS pop action.
2835 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2836 dnl 60:66:66:66:05:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2837 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2838 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2839 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2840
2841 for 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'
2843 done
2844
2845 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2846 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2847
2848 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2849 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2850 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
2851 dnl
2852 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2853 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
2854 dnl
2855 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2856 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
2857 ])
2858
2859 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2860
2861 dnl Modified MPLS pop action.
2862 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2863 dnl 60:66:66:66:05:01 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2864 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2865 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2866 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2867
2868 for 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'
2870 done
2871 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2872 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2873
2874 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2875 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2876 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2877 dnl
2878 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2879 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2880 dnl
2881 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2882 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2883 ])
2884
2885 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2886
2887 dnl Modified MPLS pop action.
2888 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2889 dnl 60:66:66:66:05:10 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2890 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2891 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2892 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2893
2894 for 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'
2896 done
2897
2898 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2899 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2900
2901 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2902 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2903 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2904 dnl
2905 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2906 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2907 dnl
2908 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2909 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2910 ])
2911
2912 AT_CHECK([ovs-appctl revalidator/purge], [0])
2913 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
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
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
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
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)
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
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
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
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
2936 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
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
2939 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
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
2944 cookie=0xd, table=1, n_packets=3, n_bytes=126, arp actions=CONTROLLER:65535
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
2954 NXST_FLOW reply:
2955 ])
2956
2957 OVS_VSWITCHD_STOP
2958 AT_CLEANUP
2959
2960 AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2961 OVS_VSWITCHD_START([dnl
2962 add-port br0 p1 -- set Interface p1 type=dummy
2963 ])
2964 on_exit 'kill `cat ovs-ofctl.pid`'
2965
2966 AT_CAPTURE_FILE([ofctl_monitor.log])
2967 AT_DATA([flows.txt], [dnl
2968 table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2969 table=1 ip,ip_dscp=8 actions=controller
2970 ])
2971 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2972
2973
2974 dnl Modified MPLS pop action.
2975 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2976 dnl 60:66:66:66:00:08 > 50:54:00:00:00:01, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2977 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2978 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2979 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2980
2981 for 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'
2983 done
2984 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2985 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2986
2987 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2988 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2989 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2990 dnl
2991 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2992 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2993 dnl
2994 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2995 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2996 ])
2997
2998 AT_CHECK([ovs-appctl revalidator/purge], [0])
2999 AT_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
3002 OFPST_FLOW reply (OF1.2):
3003 ])
3004
3005 OVS_VSWITCHD_STOP
3006 AT_CLEANUP
3007
3008 AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
3009 OVS_VSWITCHD_START([dnl
3010 add-port br0 p1 -- set Interface p1 type=dummy
3011 ])
3012 on_exit 'kill `cat ovs-ofctl.pid`'
3013
3014 dnl N.B: The first (and only) action that accesses L3 data after the
3015 dnl pop_mpls action is present in write_actions. This exercises recirculation
3016 dnl triggered in write_actions due to a previous action not in write actions.
3017 AT_CAPTURE_FILE([ofctl_monitor.log])
3018 AT_DATA([flows.txt], [dnl
3019 mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
3020 ])
3021 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
3022
3023 dnl Modified MPLS pop action.
3024 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3025 dnl 60:66:66:66:00:08 > 50:54:00:00:00:01, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
3026 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3027 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
3028 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3029
3030 for 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'
3032 done
3033 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3034 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3035
3036 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
3037 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3038 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3039 dnl
3040 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3041 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3042 dnl
3043 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3044 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3045 ])
3046
3047 AT_CHECK([ovs-appctl revalidator/purge], [0])
3048 AT_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)
3050 OFPST_FLOW reply (OF1.2):
3051 ])
3052
3053 OVS_VSWITCHD_STOP
3054 AT_CLEANUP
3055
3056 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
3057 OVS_VSWITCHD_START([dnl
3058 add-port br0 p1 -- set Interface p1 type=dummy
3059 ])
3060 on_exit 'kill `cat ovs-ofctl.pid`'
3061
3062 AT_CAPTURE_FILE([ofctl_monitor.log])
3063 # A table-miss flow has priority 0 and no match
3064 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3065
3066 dnl Singleton controller action.
3067 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3068
3069 for 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)'
3071 done
3072 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3073 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3074
3075 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3076 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3077 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3078 dnl
3079 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3080 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3081 dnl
3082 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3083 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3084 ])
3085
3086 AT_CHECK([ovs-appctl revalidator/purge], [0])
3087 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3088 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3089 NXST_FLOW reply:
3090 ])
3091
3092 OVS_VSWITCHD_STOP
3093 AT_CLEANUP
3094
3095
3096 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
3097 OVS_VSWITCHD_START([dnl
3098 add-port br0 p1 -- set Interface p1 type=dummy
3099 ])
3100 on_exit 'kill `cat ovs-ofctl.pid`'
3101
3102 AT_CAPTURE_FILE([ofctl_monitor.log])
3103 # A table-miss flow has priority 0 and no match
3104 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3105
3106 dnl Singleton controller action.
3107 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3108
3109 for 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)'
3111 done
3112 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3113 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3114
3115 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3116
3117 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3118 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3119 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3120 dnl
3121 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3122 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3123 dnl
3124 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3125 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3126 ])
3127
3128 AT_CHECK([ovs-appctl revalidator/purge], [0])
3129 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3130 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3131 OFPST_FLOW reply (OF1.3):
3132 ])
3133
3134 OVS_VSWITCHD_STOP
3135 AT_CLEANUP
3136
3137 AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
3138 OVS_VSWITCHD_START([dnl
3139 add-port br0 p1 -- set Interface p1 type=dummy
3140 ])
3141 on_exit 'kill `cat ovs-ofctl.pid`'
3142
3143 ovs-appctl time/stop
3144
3145 AT_CAPTURE_FILE([ofctl_monitor.log])
3146 # A table-miss flow has priority 0 and no match
3147 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3148
3149 dnl Singleton controller action.
3150 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3151
3152 # Become slave (OF 1.3), which should disable everything except port status.
3153 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3154
3155 # Ensure that ovs-vswitchd gets a chance to reply before sending another command.
3156 ovs-appctl time/warp 500 100
3157
3158 # Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
3159 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
3160
3161 ovs-appctl time/warp 500 100
3162 for 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)'
3164 done
3165 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3166 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3167
3168 AT_CHECK([ovs-appctl revalidator/purge], [0])
3169 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3170 send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
3171 OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
3172 dnl
3173 send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
3174 master:
3175 PACKET_IN: (off)
3176 PORT_STATUS: (off)
3177 FLOW_REMOVED: (off)
3178 ROLE_STATUS: (off)
3179 TABLE_STATUS: (off)
3180 REQUESTFORWARD: (off)
3181
3182 slave:
3183 PACKET_IN: no_match
3184 PORT_STATUS: (off)
3185 FLOW_REMOVED: (off)
3186 ROLE_STATUS: (off)
3187 TABLE_STATUS: (off)
3188 REQUESTFORWARD: (off)
3189 dnl
3190 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3191 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3192 dnl
3193 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3194 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3195 dnl
3196 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3197 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3198 ])
3199
3200 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3201
3202 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3203 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3204 OFPST_FLOW reply (OF1.3):
3205 ])
3206
3207 OVS_VSWITCHD_STOP
3208 AT_CLEANUP
3209
3210
3211 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
3212 OVS_VSWITCHD_START([dnl
3213 add-port br0 p1 -- set Interface p1 type=dummy
3214 ])
3215 on_exit 'kill `cat ovs-ofctl.pid`'
3216
3217 AT_CAPTURE_FILE([ofctl_monitor.log])
3218 # A table-miss flow has priority 0 and no match
3219 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3220
3221 dnl Singleton controller action.
3222 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3223
3224 for 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)'
3226 done
3227 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3228 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3229
3230 AT_CHECK([ovs-appctl revalidator/purge], [0])
3231 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3232 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3233 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3234 dnl
3235 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3236 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3237 dnl
3238 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3239 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3240 ])
3241
3242 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3243
3244 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3245 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3246 OFPST_FLOW reply (OF1.4):
3247 ])
3248
3249 OVS_VSWITCHD_STOP
3250 AT_CLEANUP
3251
3252
3253 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3254 OVS_VSWITCHD_START([dnl
3255 add-port br0 p1 -- set Interface p1 type=dummy
3256 ])
3257 on_exit 'kill `cat ovs-ofctl.pid`'
3258
3259 AT_CAPTURE_FILE([ofctl_monitor.log])
3260 AT_DATA([flows.txt], [dnl
3261 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3262 table=1 actions=output(CONTROLLER),goto_table(2)
3263 table=2 actions=group:1234
3264 ])
3265 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3266 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3267
3268 dnl Singleton controller action.
3269 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3270
3271 for 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)'
3273 done
3274 AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3275 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
3276 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3277
3278 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3279
3280 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3281 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3282 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3283 dnl
3284 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3285 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3286 dnl
3287 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3288 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3289 dnl
3290 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3291 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3292 dnl
3293 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3294 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3295 dnl
3296 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3297 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3298 dnl
3299 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3300 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3301 dnl
3302 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3303 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3304 dnl
3305 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3306 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3307 dnl
3308 OFPT_PACKET_IN (OF1.3) (xid=0x0): total_len=54 in_port=ANY (via action) data_len=54 (unbuffered)
3309 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3310 ])
3311
3312 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3313
3314 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
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
3318 OFPST_FLOW reply (OF1.3):
3319 ])
3320
3321 OVS_VSWITCHD_STOP
3322 AT_CLEANUP
3323
3324
3325 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3326 OVS_VSWITCHD_START([dnl
3327 add-port br0 p1 -- set Interface p1 type=dummy
3328 ])
3329 on_exit 'kill `cat ovs-ofctl.pid`'
3330
3331 AT_CAPTURE_FILE([ofctl_monitor.log])
3332 AT_DATA([flows.txt], [dnl
3333 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3334 table=1 actions=output(CONTROLLER),goto_table(2)
3335 table=2 actions=group:1234
3336 ])
3337 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3338 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3339
3340 dnl Singleton controller action.
3341 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3342
3343 for 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)'
3345 done
3346 AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3347 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
3348 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3349
3350 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3351
3352 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3353 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3354 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3355 dnl
3356 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3357 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3358 dnl
3359 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3360 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3361 dnl
3362 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3363 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3364 dnl
3365 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3366 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3367 dnl
3368 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3369 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3370 dnl
3371 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3372 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3373 dnl
3374 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3375 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3376 dnl
3377 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3378 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3379 dnl
3380 OFPT_PACKET_IN (OF1.4) (xid=0x0): total_len=54 in_port=ANY (via packet_out) data_len=54 (unbuffered)
3381 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3382 ])
3383
3384 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3385
3386 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
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
3390 OFPST_FLOW reply (OF1.4):
3391 ])
3392
3393 OVS_VSWITCHD_STOP
3394 AT_CLEANUP
3395
3396 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3397
3398 OVS_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
3403 AT_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
3415 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3416
3417 AT_CHECK([
3418 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
3419 ], [0], [ignore])
3420
3421 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
3422 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3423
3424 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3425 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=43 cookie=0x0 total_len=98 metadata=0x67871d4d000000,in_port=1 (via action) data_len=98 (unbuffered)
3426 icmp,vlan_tci=0x0000,dl_src=3a:6d:d2:09:9c:ab,dl_dst=1e:2c:e9:2a:66:9e,nw_src=192.168.10.10,nw_dst=192.168.10.30,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:6f20
3427 dnl
3428 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=50 cookie=0x0 total_len=98 metadata=0x67871d4d000000,in_port=1 (via no_match) data_len=98 (unbuffered)
3429 icmp,vlan_tci=0x0000,dl_src=3a:6d:d2:09:9c:ab,dl_dst=1e:2c:e9:2a:66:9e,nw_src=192.168.10.10,nw_dst=192.168.10.30,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:6f20
3430 ])
3431
3432 OVS_VSWITCHD_STOP
3433 AT_CLEANUP
3434
3435 AT_SETUP([ofproto-dpif - ARP modification slow-path])
3436 OVS_VSWITCHD_START
3437 add_of_ports br0 1 2
3438
3439 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3440 ovs-ofctl add-flow br0 'in_port=1,arp actions=load:2->OXM_OF_ARP_OP[[]],2,load:0xc0a88001->OXM_OF_ARP_SPA[[]],2,load:0x404444444441->OXM_OF_ARP_THA[[]],2'
3441
3442 # Input some packets that should follow the arp modification slow-path.
3443 for 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)'
3445 done
3446 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3447
3448 # Check the packets that were output.
3449 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
3450 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3451 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3452 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
3453 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3454 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3455 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
3456 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3457 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3458 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
3459 ])
3460
3461 OVS_VSWITCHD_STOP
3462 AT_CLEANUP
3463
3464 AT_SETUP([ofproto-dpif - VLAN handling])
3465 OVS_VSWITCHD_START(
3466 [set Bridge br0 fail-mode=standalone -- \
3467 add-port br0 p1 trunks=10,12 -- \
3468 add-port br0 p2 tag=10 -- \
3469 add-port br0 p3 tag=12 \
3470 other-config:priority-tags=true -- \
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 -- \
3475 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
3476 other-config:priority-tags=true -- \
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 \
3481 other-config:priority-tags=true -- \
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 -- \
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 --])
3494
3495 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3496 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
3497 dnl actions.
3498 for tuple in \
3499 "100 none 0 drop" \
3500 "100 0 0 drop" \
3501 "100 0 1 drop" \
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" \
3504 "100 11 0 5,7" \
3505 "100 11 1 5,7" \
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" \
3508 "1 none 0 drop" \
3509 "1 0 0 drop" \
3510 "1 0 1 drop" \
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" \
3513 "1 11 0 drop" \
3514 "1 11 1 drop" \
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" \
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" \
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" \
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" \
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" \
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" \
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" \
3549 "5 11 0 7,100" \
3550 "5 11 1 7,100" \
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" \
3558 "6 11 0 drop" \
3559 "6 11 1 drop" \
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" \
3567 "7 11 0 5,100" \
3568 "7 11 1 5,100" \
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" \
3576 "8 11 0 drop" \
3577 "8 11 1 drop" \
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"
3589 do
3590 set $tuple
3591 in_port=$1
3592 vlan=$2
3593 pcp=$3
3594 expected=$4
3595
3596 if test $vlan = none; then
3597 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
3598 else
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))"
3600 fi
3601
3602 echo "----------------------------------------------------------------------"
3603 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3604
3605 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3606 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
3607
3608 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
3609 mv stdout expout
3610 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
3611 done
3612
3613 OVS_VSWITCHD_STOP
3614 AT_CLEANUP
3615
3616 AT_SETUP([ofproto-dpif - VLAN depth limit])
3617 OVS_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
3623 AT_DATA([flows.txt], [dnl
3624 table=0 in_port=1,eth_type=0x8100,vlan_tci=0x0010/0x01ff actions=output:2
3625 table=0 in_port=1,eth_type=0xabcd,vlan_tci=0x0010/0x01ff actions=output:3
3626 ])
3627 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3628 flow="in_port(1),eth(src=00:11:22:33:44:55,dst=00:22:44:66:88:00),eth_type(0x8100),vlan(vid=16,pcp=0), \
3629 encap(eth_type(0x8100),vlan(vid=17,pcp=0),encap(eth_type(0xabcd)))"
3630
3631 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3632 AT_CHECK([tail -1 stdout], [0],
3633 [Datapath actions: 2
3634 ])
3635
3636 AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3637 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3638 AT_CHECK([tail -1 stdout], [0],
3639 [Datapath actions: 3
3640 ])
3641
3642 OVS_VSWITCHD_STOP
3643 AT_CLEANUP
3644
3645 AT_SETUP([ofproto-dpif - Multi-VLAN actions])
3646 OVS_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 ])
3650 AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3651
3652 AT_DATA([flows.txt], [dnl
3653 table=0 in_port=1,vlan_tci=0x1100/0x1fff actions=pop_vlan,output:2
3654 table=0 in_port=1,vlan_tci=0x1101/0x1fff actions=push_vlan:0x8100,set_field:0x1201/0x1fff->vlan_tci,output:2
3655 table=0 in_port=1,vlan_tci=0x1102/0x1fff actions=push_vlan:0x88a8,set_field:0x1202/0x1fff->vlan_tci,output:2
3656 table=0 in_port=1,vlan_tci=0x1103/0x1fff actions=set_field:0x1203/0x1fff->vlan_tci,output:2
3657 table=0 in_port=1,vlan_tci=0x1104/0x1fff actions=pop_vlan,goto_table:1
3658 table=1 vlan_tci=0 actions=output:2
3659 table=1 vlan_tci=0x1300/0x1fff actions=pop_vlan,output:2
3660 table=1 vlan_tci=0x1301/0x1fff actions=push_vlan:0x88a8,set_field:0x1401/0x1fff->vlan_tci,output:2
3661 table=1 vlan_tci=0x1302/0x1fff actions=set_field:0x1402/0x1fff->vlan_tci,output:2
3662 ])
3663
3664 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3665
3666 check_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
3673 check_act "eth_type(0x8100),vlan(vid=0x0100,pcp=0),encap(eth_type(0xabcd))" \
3674 "pop_vlan,2"
3675
3676 check_act "eth_type(0x8100),vlan(vid=0x0101,pcp=0),encap(eth_type(0xabcd))" \
3677 "push_vlan(vid=513,pcp=0),2"
3678
3679 check_act "eth_type(0x8100),vlan(vid=0x0102,pcp=0),encap(eth_type(0xabcd))" \
3680 "push_vlan(tpid=0x88a8,vid=514,pcp=0),2"
3681
3682 check_act "eth_type(0x8100),vlan(vid=0x0103,pcp=0),encap(eth_type(0xabcd))" \
3683 "pop_vlan,push_vlan(vid=515,pcp=0),2"
3684
3685 check_act "eth_type(0x8100),vlan(vid=0x0104,pcp=0),encap(eth_type(0xabcd))" \
3686 "pop_vlan,2"
3687
3688 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3689 vlan(vid=0x0300,pcp=0),encap(eth_type(0xabcd)))" "pop_vlan,pop_vlan,2"
3690
3691 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3692 vlan(vid=0x0301,pcp=0),encap(eth_type(0xabcd)))" \
3693 "pop_vlan,push_vlan(tpid=0x88a8,vid=1025,pcp=0),2"
3694
3695 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3696 vlan(vid=0x0302,pcp=0),encap(eth_type(0xabcd)))" \
3697 "pop_vlan,pop_vlan,push_vlan(vid=1026,pcp=0),2"
3698
3699 OVS_VSWITCHD_STOP
3700 AT_CLEANUP
3701
3702 AT_SETUP([ofproto-dpif - MPLS handling])
3703 OVS_VSWITCHD_START([dnl
3704 add-port br0 p1 -- set Interface p1 type=dummy
3705 ])
3706 on_exit 'kill `cat ovs-ofctl.pid`'
3707
3708 AT_CAPTURE_FILE([ofctl_monitor.log])
3709 AT_DATA([flows.txt], [dnl
3710 dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
3711 dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
3712 dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
3713 ])
3714 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3715
3716 dnl In this test, we push an MPLS tag to an ethernet packet.
3717 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3718
3719 for 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)'
3721 done
3722 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3723 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3724
3725 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3726 OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
3727 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3728 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3729 00000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
3730 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3731 00000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
3732 00000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
3733 00000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
3734 00000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
3735 00000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3736 OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
3737 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3738 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3739 00000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
3740 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3741 00000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
3742 00000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
3743 00000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
3744 00000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
3745 00000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3746 OFPT_PACKET_IN (OF1.2): total_len=122 in_port=1 (via action) data_len=122 (unbuffered)
3747 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3748 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3749 00000010 01 40 45 00 00 68 00 00-00 00 40 06 f9 3c c0 a8
3750 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3751 00000030 00 00 50 00 00 00 4a 4d-00 00 00 01 02 03 04 05
3752 00000040 06 07 08 09 0a 0b 0c 0d-0e 0f 10 11 12 13 14 15
3753 00000050 16 17 18 19 1a 1b 1c 1d-1e 1f 20 21 22 23 24 25
3754 00000060 26 27 28 29 2a 2b 2c 2d-2e 2f 30 31 32 33 34 35
3755 00000070 36 37 38 39 3a 3b 3c 3d-3e 3f
3756 ])
3757
3758 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3759 dnl copied exactly, except for the BOS bit.
3760 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3761
3762 for 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)'
3764 done
3765 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3766 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3767
3768 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3769 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3770 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:01,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
3771 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3772 00000010 a0 40 00 00 a1 40
3773 dnl
3774 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3775 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:01,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
3776 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3777 00000010 a0 40 00 00 a1 40
3778 dnl
3779 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3780 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:01,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
3781 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3782 00000010 a0 40 00 00 a1 40
3783 ])
3784
3785 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3786 dnl copied exactly, except for the BOS bit. The ethertype should be updated
3787 dnl to the MPLS ethertype of the MPLS push action which differs to that
3788 dnl of the input packet.
3789 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3790
3791 for 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)'
3793 done
3794 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3795 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3796
3797 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3798 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3799 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:00:02,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
3800 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3801 00000010 a0 40 00 00 a1 40
3802 dnl
3803 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3804 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:00:02,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
3805 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3806 00000010 a0 40 00 00 a1 40
3807 dnl
3808 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3809 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:00:02,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280
3810 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3811 00000010 a0 40 00 00 a1 40
3812 ])
3813
3814 OVS_VSWITCHD_STOP
3815 AT_CLEANUP
3816
3817 AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3818 OVS_VSWITCHD_START([dnl
3819 add-port br0 p1 -- set Interface p1 type=dummy
3820 ])
3821 on_exit 'kill `cat ovs-ofctl.pid`'
3822
3823 AT_CAPTURE_FILE([ofctl_monitor.log])
3824 AT_DATA([flows.txt], [dnl
3825 cookie=0xa dl_src=40:44:44:44:54:50 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,controller
3826 cookie=0xa dl_src=40:44:44:44:54:51 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,controller
3827 cookie=0xa dl_src=40:44:44:44:54:52 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,controller
3828 cookie=0xa dl_src=40:44:44:44:54:53 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,controller
3829 cookie=0xa dl_src=40:44:44:44:54:54 actions=push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller
3830 cookie=0xa dl_src=40:44:44:44:54:55 actions=push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller
3831 cookie=0xa dl_src=40:44:44:44:54:56 actions=push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller
3832 cookie=0xa dl_src=40:44:44:44:54:57 actions=push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller
3833 cookie=0xa dl_src=40:44:44:44:54:58,vlan_tci=0x1000/0x1000 actions=load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller
3834 cookie=0xa dl_src=40:44:44:44:54:59,vlan_tci=0x1000/0x1000 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],set_vlan_pcp:1,load:99->OXM_OF_VLAN_VID[[]],controller
3835 ])
3836 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3837
3838 dnl Modified MPLS controller action.
3839 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3840 dnl both of these in the final flow
3841 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3842
3843 for 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)'
3845 done
3846 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3847 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3848
3849 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3850 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
3851 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3852 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3853 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
3854 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3855 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
3856 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
3857 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
3858 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
3859 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3860 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
3861 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3862 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3863 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
3864 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3865 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
3866 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
3867 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
3868 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
3869 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3870 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
3871 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3872 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3873 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
3874 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3875 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
3876 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
3877 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
3878 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
3879 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3880 ])
3881
3882 dnl Modified MPLS controller action.
3883 dnl In this test, the input packet is vlan-tagged, which should be kept as
3884 dnl inner vlan.
3885 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3886
3887 for 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))'
3889 done
3890 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3891 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3892
3893 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3894 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
3895 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3896 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3897 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
3898 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
3899 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
3900 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
3901 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
3902 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
3903 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
3904 00000080 3e 3f
3905 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
3906 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3907 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3908 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
3909 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
3910 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
3911 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
3912 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
3913 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
3914 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
3915 00000080 3e 3f
3916 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
3917 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3918 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3919 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
3920 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
3921 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
3922 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
3923 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
3924 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
3925 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
3926 00000080 3e 3f
3927 ])
3928
3929 dnl Modified MPLS controller action.
3930 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3931 dnl both of these in the final flow
3932 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3933
3934 for 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)'
3936 done
3937 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3938 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3939
3940 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3941 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
3942 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3943 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3944 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
3945 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3946 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
3947 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
3948 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
3949 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
3950 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3951 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
3952 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3953 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3954 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
3955 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3956 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
3957 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
3958 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
3959 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
3960 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3961 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
3962 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3963 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3964 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
3965 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3966 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
3967 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
3968 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
3969 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
3970 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
3971 ])
3972
3973 dnl Modified MPLS controller action.
3974 dnl In this test, the input packet is vlan-tagged, which should be kept as
3975 dnl inner vlan.
3976 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3977
3978 for 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))'
3980 done
3981 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3982 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3983
3984 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3985 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
3986 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3987 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3988 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
3989 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
3990 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
3991 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
3992 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
3993 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
3994 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
3995 00000080 3e 3f
3996 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
3997 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3998 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3999 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4000 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4001 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4002 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4003 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4004 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4005 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4006 00000080 3e 3f
4007 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4008 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4009 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
4010 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4011 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4012 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4013 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4014 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4015 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4016 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4017 00000080 3e 3f
4018 ])
4019
4020 dnl Modified MPLS controller action.
4021 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
4022 dnl actions are reordered, so we see both of these in the final flow.
4023 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4024
4025 for 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)'
4027 done
4028 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4029 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4030
4031 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4032 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4033 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4034 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
4035 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4036 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4037 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4038 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4039 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4040 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4041 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4042 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4043 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4044 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
4045 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4046 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4047 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4048 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4049 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4050 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4051 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4052 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4053 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4054 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
4055 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4056 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4057 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4058 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4059 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4060 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4061 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4062 ])
4063
4064 dnl Modified MPLS controller action.
4065 dnl In this test, the input packet is vlan-tagged, which should be kept as
4066 dnl inner vlan.
4067 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4068
4069 for 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))'
4071 done
4072 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4073 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4074
4075 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4076 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4077 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4078 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
4079 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4080 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4081 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4082 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4083 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4084 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4085 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4086 00000080 3e 3f
4087 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4088 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4089 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
4090 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4091 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4092 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4093 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4094 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4095 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4096 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4097 00000080 3e 3f
4098 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4099 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4100 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
4101 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4102 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4103 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4104 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4105 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4106 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4107 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4108 00000080 3e 3f
4109 ])
4110
4111 dnl Modified MPLS controller action.
4112 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
4113 dnl actions are reordered, so we see both of these in the final flow.
4114 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4115
4116 for 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)'
4118 done
4119 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4120 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4121
4122 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4123 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4124 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4125 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
4126 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4127 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4128 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4129 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4130 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4131 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4132 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4133 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4134 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4135 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
4136 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4137 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4138 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4139 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4140 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4141 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4142 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4143 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4144 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4145 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
4146 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4147 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4148 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4149 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4150 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4151 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4152 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4153 ])
4154
4155 dnl Modified MPLS controller action.
4156 dnl In this test, the input packet is vlan-tagged, which should be kept as
4157 dnl inner vlan.
4158 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4159
4160 for 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))'
4162 done
4163 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4164 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4165
4166 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4167 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4168 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4169 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
4170 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4171 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4172 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4173 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4174 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4175 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4176 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4177 00000080 3e 3f
4178 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4179 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4180 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
4181 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4182 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4183 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4184 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4185 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4186 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4187 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4188 00000080 3e 3f
4189 OFPT_PACKET_IN (OF1.2): total_len=130 in_port=1 (via action) data_len=130 (unbuffered)
4190 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4191 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
4192 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 68 00 00
4193 00000020 00 00 40 06 f9 3c c0 a8-00 01 c0 a8 00 02 00 00
4194 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 4a 4d
4195 00000040 00 00 00 01 02 03 04 05-06 07 08 09 0a 0b 0c 0d
4196 00000050 0e 0f 10 11 12 13 14 15-16 17 18 19 1a 1b 1c 1d
4197 00000060 1e 1f 20 21 22 23 24 25-26 27 28 29 2a 2b 2c 2d
4198 00000070 2e 2f 30 31 32 33 34 35-36 37 38 39 3a 3b 3c 3d
4199 00000080 3e 3f
4200 ])
4201
4202 dnl Modified MPLS controller action.
4203 dnl In this test, the input packet is vlan-tagged, which should be kept as
4204 dnl inner vlan.
4205 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4206
4207 for 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))'
4209 done
4210 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4211 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
4212
4213 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4214 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4215 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4216 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
4217 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4218 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4219 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4220 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4221 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4222 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4223 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4224 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4225 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4226 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
4227 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4228 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4229 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4230 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4231 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4232 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4233 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4234 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4235 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4236 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
4237 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4238 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4239 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4240 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4241 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4242 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4243 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4244 ])
4245
4246 dnl Modified MPLS controller action.
4247 dnl In this test, the input packet is vlan-tagged, which should be modified
4248 dnl before we push MPLS and VLAN tags.
4249 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4250
4251 for 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))'
4253 done
4254 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
4255 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4256
4257 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
4258 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4259 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4260 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
4261 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4262 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4263 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4264 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4265 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4266 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4267 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4268 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4269 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4270 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
4271 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4272 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4273 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4274 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4275 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4276 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4277 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4278 OFPT_PACKET_IN (OF1.2): total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
4279 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
4280 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
4281 00000010 88 47 00 00 a1 40 45 00-00 68 00 00 00 00 40 06
4282 00000020 f9 3c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
4283 00000030 00 00 00 00 00 00 50 00-00 00 4a 4d 00 00 00 01
4284 00000040 02 03 04 05 06 07 08 09-0a 0b 0c 0d 0e 0f 10 11
4285 00000050 12 13 14 15 16 17 18 19-1a 1b 1c 1d 1e 1f 20 21
4286 00000060 22 23 24 25 26 27 28 29-2a 2b 2c 2d 2e 2f 30 31
4287 00000070 32 33 34 35 36 37 38 39-3a 3b 3c 3d 3e 3f
4288 ])
4289
4290 AT_CHECK([ovs-appctl revalidator/purge], [0])
4291 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
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
4302 OFPST_FLOW reply (OF1.2):
4303 ])
4304
4305 OVS_VSWITCHD_STOP
4306 AT_CLEANUP
4307
4308 AT_SETUP([ofproto-dpif - fragment handling - trace])
4309 OVS_VSWITCHD_START
4310 add_of_ports br0 1 2 3 4 5 6 90
4311 AT_DATA([flows.txt], [dnl
4312 priority=75 tcp nw_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
4313 priority=75 tcp nw_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
4314 priority=50 tcp nw_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
4315 priority=50 tcp nw_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
4316 priority=50 tcp nw_frag=later actions=output:6
4317 ])
4318 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4319
4320 base_flow="in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=128"
4321 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4322 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4323 later_flow="$base_flow,frag=later)"
4324
4325 # mode no first later
4326 for tuple in \
4327 'normal 1 5 6' \
4328 'drop 1 drop drop' \
4329 'nx-match 1 2 6'
4330 do
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
4340 printf "\n%s\n" "----$mode $type-----"
4341 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4342 : > expout
4343 if test $mode = drop && test $type != no; then
4344 echo ' 0. Packets are IP fragments and the fragment handling mode is "drop".' >> expout
4345 echo "Datapath actions: $exp_output" >> expout
4346 elif test $type = later; then
4347 echo "Datapath actions: $exp_output" >> expout
4348 else
4349 echo "Datapath actions: set(tcp(src=80,dst=80)),$exp_output" >> expout
4350 fi
4351 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
4352 done
4353 done
4354 OVS_VSWITCHD_STOP
4355 AT_CLEANUP
4356
4357 AT_SETUP([ofproto-dpif - fragment handling - upcall])
4358 OVS_VSWITCHD_START
4359 add_of_ports br0 1 2 3 4 5 6 90
4360 AT_DATA([flows.txt], [dnl
4361 priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
4362 priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
4363 priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
4364 priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
4365 priority=50 tcp ip_frag=later actions=output:6
4366 ])
4367 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4368
4369 base_flow="in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=128"
4370 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4371 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4372 later_flow="$base_flow,frag=later)"
4373
4374 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4375
4376 mode=normal
4377
4378 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4379 for 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])
4384 done
4385
4386 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4387 flow-dump from non-dpdk interfaces:
4388 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4389 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),5
4390 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4391 ])
4392
4393 mode=drop
4394
4395 AT_CHECK([ovs-appctl revalidator/purge], [0])
4396 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4397 for 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])
4402 done
4403
4404 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4405 flow-dump from non-dpdk interfaces:
4406 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4407 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
4408 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
4409 ])
4410
4411 mode=nx-match
4412
4413 AT_CHECK([ovs-appctl revalidator/purge], [0])
4414 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4415 for 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])
4420 done
4421
4422 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4423 flow-dump from non-dpdk interfaces:
4424 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4425 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),2
4426 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4427 ])
4428
4429 OVS_VSWITCHD_STOP
4430 AT_CLEANUP
4431
4432 AT_SETUP([ofproto-dpif - fragment handling - actions])
4433 OVS_VSWITCHD_START
4434 add_of_ports br0 1 2 3 4 5 6 90
4435
4436 AT_CHECK([ovs-ofctl add-flow br0 "tcp,ip_frag=later actions=move:OXM_OF_TCP_DST[[0..7]]->OXM_OF_TCP_SRC[[0..7]],output:1"], [1], [], [stderr])
4437 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4438 source field tcp_dst lacks correct prerequisites
4439 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4440 ])
4441
4442 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 "tcp,ip_frag=later actions=move:OXM_OF_PKT_REG0[[0..7]]->OXM_OF_TCP_SRC[[0..7]],output:1"], [1], [], [stderr])
4443 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4444 destination field tcp_src lacks correct prerequisites
4445 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4446 ])
4447
4448 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
4449 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4450 set_field udp_src lacks correct prerequisites
4451 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4452 ])
4453
4454 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
4455 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4456 set_field udp_dst lacks correct prerequisites
4457 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4458 ])
4459
4460 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
4461 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4462 set_field sctp_src lacks correct prerequisites
4463 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4464 ])
4465
4466 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
4467 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4468 set_field sctp_dst lacks correct prerequisites
4469 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4470 ])
4471
4472 AT_CHECK([ovs-ofctl add-flow br0 "tcp,ip_frag=later actions=learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,NXM_OF_IP_SRC[[]]=NXM_OF_IP_DST[[]],NXM_OF_TCP_SRC[[]]=NXM_OF_TCP_DST[[]],output:NXM_NX_REG0[[0..15]]),output:1"], [1], [], [stderr])
4473 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4474 source field tcp_dst lacks correct prerequisites
4475 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4476 ])
4477
4478 AT_DATA([flows.txt], [dnl
4479 priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
4480 ])
4481 AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
4482
4483 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4484
4485 mode=normal
4486
4487 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4488 for 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"])
4492 done
4493
4494 dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
4495 dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
4496 dnl OVS-2.5, the wildcards and set_field mask are shared internally.
4497 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4498 flow-dump from non-dpdk interfaces:
4499 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4500 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4501 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
4502 ])
4503
4504 AT_CHECK([ovs-appctl revalidator/purge], [0])
4505 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4506 for 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"])
4510 done
4511
4512 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4513 flow-dump from non-dpdk interfaces:
4514 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4515 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4516 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:38, used:0.001s, actions:1
4517 ])
4518
4519 AT_CHECK([ovs-appctl revalidator/purge], [0])
4520 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4521 for 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"])
4525 done
4526
4527 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4528 flow-dump from non-dpdk interfaces:
4529 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4530 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4531 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:34, used:0.001s, actions:1
4532 ])
4533
4534 OVS_VSWITCHD_STOP
4535 AT_CLEANUP
4536
4537 AT_SETUP([ofproto-dpif - exit])
4538 OVS_VSWITCHD_START
4539 add_of_ports br0 1 2 3 10 11 12 13 14
4540 AT_DATA([flows.txt], [dnl
4541 in_port=1 actions=output:10,exit,output:11
4542 in_port=2 actions=output:12,resubmit:1,output:12
4543 in_port=3 actions=output:13,resubmit:2,output:14
4544 ])
4545 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4546 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
4547 AT_CHECK([tail -1 stdout], [0],
4548 [Datapath actions: 10
4549 ])
4550 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
4551 AT_CHECK([tail -1 stdout], [0],
4552 [Datapath actions: 12,10
4553 ])
4554 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
4555 AT_CHECK([tail -1 stdout], [0],
4556 [Datapath actions: 13,12,10
4557 ])
4558 OVS_VSWITCHD_STOP
4559 AT_CLEANUP
4560
4561
4562 AT_SETUP([ofproto-dpif - mirroring, select_all])
4563 AT_KEYWORDS([mirror mirrors mirroring])
4564 OVS_VSWITCHD_START
4565 add_of_ports br0 1 2 3
4566 ovs-vsctl \
4567 set Bridge br0 mirrors=@m --\
4568 --id=@p3 get Port p3 --\
4569 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4570
4571 AT_DATA([flows.txt], [dnl
4572 in_port=1 actions=output:2
4573 in_port=2 actions=output:1
4574 ])
4575 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4576
4577 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)"
4578 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4579 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4580 [Datapath actions: 3,2
4581 ])
4582
4583 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4584 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4585 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4586 [Datapath actions: 3,1
4587 ])
4588
4589 OVS_VSWITCHD_STOP
4590 AT_CLEANUP
4591
4592
4593 AT_SETUP([ofproto-dpif - mirroring, select_src])
4594 AT_KEYWORDS([mirror mirrors mirroring])
4595 OVS_VSWITCHD_START
4596 add_of_ports br0 1 2 3
4597 ovs-vsctl \
4598 set Bridge br0 mirrors=@m --\
4599 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4600 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
4601
4602 AT_DATA([flows.txt], [dnl
4603 in_port=1 actions=output:2
4604 in_port=2 actions=output:1
4605 ])
4606 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4607
4608 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)"
4609 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4610 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4611 [Datapath actions: 3,2
4612 ])
4613
4614 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4615 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4616 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4617 [Datapath actions: 1
4618 ])
4619 OVS_VSWITCHD_STOP
4620 AT_CLEANUP
4621
4622 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
4623 AT_KEYWORDS([mirror mirrors mirroring])
4624 OVS_VSWITCHD_START
4625 add_of_ports br0 1 2
4626 ovs-vsctl \
4627 set Bridge br0 mirrors=@m --\
4628 --id=@p2 get Port p2 --\
4629 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
4630
4631 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4632
4633 # "in_port" defaults to OFPP_NONE if it's not specified.
4634 flow="icmp,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_ttl=128,icmp_type=8,icmp_code=0"
4635 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4636 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4637 [Datapath actions: 1,2
4638 ])
4639
4640 OVS_VSWITCHD_STOP
4641 AT_CLEANUP
4642
4643
4644 AT_SETUP([ofproto-dpif - mirroring, select_dst])
4645 AT_KEYWORDS([mirror mirrors mirroring])
4646 OVS_VSWITCHD_START
4647 add_of_ports br0 1 2 3
4648 ovs-vsctl \
4649 set Bridge br0 mirrors=@m --\
4650 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4651 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
4652
4653 AT_DATA([flows.txt], [dnl
4654 in_port=1 actions=output:2
4655 in_port=2 actions=output:1
4656 ])
4657 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4658
4659 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)"
4660 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4661 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4662 [Datapath actions: 2,3
4663 ])
4664
4665 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4666 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4667 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4668 [Datapath actions: 1
4669 ])
4670
4671 OVS_VSWITCHD_STOP
4672 AT_CLEANUP
4673
4674
4675 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
4676 AT_KEYWORDS([mirror mirrors mirroring])
4677 OVS_VSWITCHD_START
4678 add_of_ports br0 1 2 3
4679 ovs-vsctl \
4680 set Bridge br0 mirrors=@m --\
4681 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4682 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
4683
4684 AT_DATA([flows.txt], [dnl
4685 in_port=1, actions=output:2
4686 ])
4687 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4688
4689 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)"
4690 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4691 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4692 [Datapath actions: 2
4693 ])
4694
4695 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=10,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))"
4696 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4697 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4698 [Datapath actions: 2
4699 ])
4700
4701 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=11,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))"
4702 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4703 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4704 [Datapath actions: 3,2
4705 ])
4706
4707 OVS_VSWITCHD_STOP
4708 AT_CLEANUP
4709
4710
4711 AT_SETUP([ofproto-dpif - mirroring, output_port])
4712 AT_KEYWORDS([mirror mirrors mirroring])
4713 OVS_VSWITCHD_START
4714 add_of_ports br0 1 2 3
4715 ovs-vsctl \
4716 set Bridge br0 mirrors=@m --\
4717 --id=@p3 get Port p3 --\
4718 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4719
4720 AT_DATA([flows.txt], [dnl
4721 in_port=1 actions=mod_vlan_vid:17,output:2
4722 in_port=2 actions=output:1
4723 ])
4724 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4725
4726 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)"
4727 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4728 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4729 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
4730 ])
4731
4732 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4733 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4734 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4735 [Datapath actions: 3,1
4736 ])
4737
4738 OVS_VSWITCHD_STOP
4739 AT_CLEANUP
4740
4741 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
4742 AT_KEYWORDS([mirror mirrors mirroring])
4743 OVS_VSWITCHD_START
4744 add_of_ports br0 1 2
4745 ovs-vsctl \
4746 set Bridge br0 mirrors=@m --\
4747 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
4748
4749 AT_DATA([flows.txt], [dnl
4750 in_port=1 actions=output:2
4751 in_port=2 actions=mod_vlan_vid:17,output:1
4752 ])
4753 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4754
4755 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)"
4756 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4757 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4758
4759 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
4760 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4761 mv stdout expout
4762 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4763
4764 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4765 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4766 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4767
4768 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
4769 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4770 mv stdout expout
4771 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4772
4773 OVS_VSWITCHD_STOP
4774 AT_CLEANUP
4775
4776 # This verifies that we don't get duplicate mirroring when mirror_packet()
4777 # might be invoked recursively, as a check against regression.
4778 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
4779 AT_KEYWORDS([mirror mirrors mirroring])
4780 OVS_VSWITCHD_START
4781 add_of_ports br0 1 2 3
4782 ovs-vsctl \
4783 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
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
4790
4791 flow='in_port=1'
4792 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4793 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4794 s/,/\
4795 /g' | sort], [0], [100
4796 2
4797 3
4798 ])
4799
4800 OVS_VSWITCHD_STOP
4801 AT_CLEANUP
4802
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.
4807 AT_SETUP([ofproto-dpif - mirroring with recirculation])
4808 AT_KEYWORDS([mirror mirrors mirroring])
4809 OVS_VSWITCHD_START
4810 add_of_ports br0 1 2 3 4
4811 ovs-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
4816 AT_DATA([flows.txt], [dnl
4817 in_port=1 actions=2,debug_recirc,4
4818 ])
4819 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4820
4821 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)"
4822 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4823 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4824 ])
4825 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4826 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4827 ])
4828
4829 OVS_VSWITCHD_STOP
4830 AT_CLEANUP
4831
4832 # Tests below verify the snaplen support for mirroring
4833 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen])
4834 AT_KEYWORDS([mirror mirrors mirroring])
4835 OVS_VSWITCHD_START
4836 add_of_ports br0 1 2 3
4837 ovs-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
4842 AT_DATA([flows.txt], [dnl
4843 in_port=1 actions=output:2
4844 in_port=2 actions=output:1
4845 ])
4846 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4847
4848 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)"
4849 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4850 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4851 [Datapath actions: trunc(100),3,2
4852 ])
4853
4854 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4855 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4856 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4857 [Datapath actions: trunc(100),3,1
4858 ])
4859
4860 OVS_VSWITCHD_STOP
4861 AT_CLEANUP
4862
4863 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen and reset snaplen])
4864 AT_KEYWORDS([mirror mirrors mirroring])
4865 OVS_VSWITCHD_START
4866 add_of_ports br0 1 2 3
4867 ovs-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
4872 AT_DATA([flows.txt], [dnl
4873 in_port=1 actions=output:2
4874 in_port=2 actions=output:1
4875 ])
4876 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4877
4878 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)"
4879 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4880 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4881 [Datapath actions: trunc(100),3,2
4882 ])
4883
4884 ovs-vsctl set mirror mymirror snaplen=77
4885
4886 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4887 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4888 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4889 [Datapath actions: trunc(77),3,1
4890 ])
4891
4892 ovs-vsctl set mirror mymirror snaplen=65535
4893
4894 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4895 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4896 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4897 [Datapath actions: 3,1
4898 ])
4899
4900 OVS_VSWITCHD_STOP
4901 AT_CLEANUP
4902
4903 AT_SETUP([ofproto-dpif - mirroring, select_src with snaplen])
4904 AT_KEYWORDS([mirror mirrors mirroring])
4905 OVS_VSWITCHD_START
4906 add_of_ports br0 1 2 3
4907 ovs-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
4912 AT_DATA([flows.txt], [dnl
4913 in_port=1 actions=output:2
4914 in_port=2 actions=output:1
4915 ])
4916 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4917
4918 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)"
4919 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4920 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4921 [Datapath actions: trunc(100),3,2
4922 ])
4923
4924 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4925 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4926 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4927 [Datapath actions: 1
4928 ])
4929 OVS_VSWITCHD_STOP
4930 AT_CLEANUP
4931
4932 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port with snaplen])
4933 AT_KEYWORDS([mirror mirrors mirroring])
4934 OVS_VSWITCHD_START
4935 add_of_ports br0 1 2
4936 ovs-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
4941 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4942
4943 # "in_port" defaults to OFPP_NONE if it's not specified.
4944 flow="icmp,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_ttl=128,icmp_type=8,icmp_code=0"
4945 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4946 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4947 [Datapath actions: 1,trunc(100),2
4948 ])
4949
4950 OVS_VSWITCHD_STOP
4951 AT_CLEANUP
4952
4953 AT_SETUP([ofproto-dpif - mirroring, select_dst with snaplen])
4954 AT_KEYWORDS([mirror mirrors mirroring])
4955 OVS_VSWITCHD_START
4956 add_of_ports br0 1 2 3
4957 ovs-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
4962 AT_DATA([flows.txt], [dnl
4963 in_port=1 actions=output:2
4964 in_port=2 actions=output:1
4965 ])
4966 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4967
4968 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)"
4969 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4970 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4971 [Datapath actions: 2,trunc(100),3
4972 ])
4973
4974 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4975 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4976 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4977 [Datapath actions: 1
4978 ])
4979
4980 OVS_VSWITCHD_STOP
4981 AT_CLEANUP
4982
4983 AT_SETUP([ofproto-dpif - mirroring, select_vlan with snaplen])
4984 AT_KEYWORDS([mirror mirrors mirroring])
4985 OVS_VSWITCHD_START
4986 add_of_ports br0 1 2 3
4987 ovs-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
4992 AT_DATA([flows.txt], [dnl
4993 in_port=1, actions=output:2
4994 ])
4995 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4996
4997 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)"
4998 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4999 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5000 [Datapath actions: 2
5001 ])
5002
5003 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=10,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))"
5004 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5005 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5006 [Datapath actions: 2
5007 ])
5008
5009 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=11,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))"
5010 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5011 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5012 [Datapath actions: trunc(100),3,2
5013 ])
5014
5015 OVS_VSWITCHD_STOP
5016 AT_CLEANUP
5017
5018 AT_SETUP([ofproto-dpif - mirroring, output_port with snaplen])
5019 AT_KEYWORDS([mirror mirrors mirroring])
5020 OVS_VSWITCHD_START
5021 add_of_ports br0 1 2 3
5022 ovs-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
5027 AT_DATA([flows.txt], [dnl
5028 in_port=1 actions=mod_vlan_vid:17,output:2
5029 in_port=2 actions=output:1
5030 ])
5031 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5032
5033 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)"
5034 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5035 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5036 [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2
5037 ])
5038
5039 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5040 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5041 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5042 [Datapath actions: trunc(100),3,1
5043 ])
5044
5045 OVS_VSWITCHD_STOP
5046 AT_CLEANUP
5047
5048 AT_SETUP([ofproto-dpif - mirroring, output_vlan with snaplen])
5049 AT_KEYWORDS([mirror mirrors mirroring])
5050 OVS_VSWITCHD_START
5051 add_of_ports br0 1 2
5052 ovs-vsctl \
5053 set Bridge br0 mirrors=@m --\
5054 --id=@m create Mirror name=mymirror select_all=true output_vlan=12 snaplen=100
5055
5056 AT_DATA([flows.txt], [dnl
5057 in_port=1 actions=output:2
5058 in_port=2 actions=mod_vlan_vid:17,output:1
5059 ])
5060 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5061
5062 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)"
5063 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5064 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5065 dnl Expect: "trunc(100),100,trunc(100),2,trunc(100),1", with different order
5066 AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
5067
5068 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5069 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5070 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5071 AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
5072
5073 OVS_VSWITCHD_STOP
5074 AT_CLEANUP
5075
5076 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors with snaplen])
5077 AT_KEYWORDS([mirror mirrors mirroring])
5078 OVS_VSWITCHD_START
5079 add_of_ports br0 1 2 3
5080 ovs-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
5089 flow="in_port=1"
5090 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
5091 AT_CHECK([tail -1 stdout | egrep "trunc\(200\),2,trunc\(300\),3,100|trunc\(300\),3,trunc\(200\),2,100"], [0], [stdout])
5092
5093 OVS_VSWITCHD_STOP
5094 AT_CLEANUP
5095
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).
5099 AT_SETUP([ofproto-dpif - resubmit with recirculation])
5100 OVS_VSWITCHD_START
5101 add_of_ports br0 1 2 3
5102
5103 AT_DATA([flows.txt], [dnl
5104 table=0 in_port=1 actions=2,resubmit(,1)
5105 table=1 in_port=1 actions=debug_recirc,resubmit:55
5106 table=1 in_port=55 actions=3
5107 ])
5108 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5109
5110 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)"
5111 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5112 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
5113 ])
5114 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5115 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
5116 ])
5117
5118 OVS_VSWITCHD_STOP
5119 AT_CLEANUP
5120
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.
5126 AT_SETUP([ofproto-dpif - resubmit with tun_id])
5127 OVS_VSWITCHD_START
5128 add_of_ports br0 1 2 3
5129
5130 AT_DATA([flows.txt], [dnl
5131 table=0 in_port=1 actions=2,load:6->NXM_NX_TUN_ID[[]],resubmit(,1)
5132 table=1 in_port=1 actions=debug_recirc,resubmit:55
5133 table=1 in_port=55 actions=3
5134 ])
5135 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5136
5137 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)"
5138 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5139 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: icmp,tun_id=0x6,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128,icmp_type=8,icmp_code=0
5140 ])
5141
5142 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5143 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: recirc_id=0x1,eth,icmp,tun_id=0x6,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128,icmp_type=8,icmp_code=0
5144 ])
5145
5146 OVS_VSWITCHD_STOP
5147 AT_CLEANUP
5148
5149
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.
5153 AT_SETUP([ofproto-dpif - recirculation after resubmit])
5154 OVS_VSWITCHD_START
5155 add_of_ports br0 1 2
5156
5157 AT_DATA([flows.txt], [dnl
5158 table=0 in_port=1 actions=resubmit(,1),2
5159 table=1 in_port=1 actions=debug_recirc
5160 ])
5161 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5162
5163 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)"
5164 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5165 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
5166 ])
5167 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5168 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
5169 ])
5170
5171 OVS_VSWITCHD_STOP
5172 AT_CLEANUP
5173
5174
5175 AT_SETUP([ofproto-dpif - debug_slow action])
5176 OVS_VSWITCHD_START
5177 add_of_ports br0 1 2 3
5178
5179 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,2"])
5180
5181 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)"
5182
5183 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5184 AT_CHECK_UNQUOTED([tail -3 stdout], [0], [Datapath actions: 2
5185 This flow is handled by the userspace slow path because it:
5186 - Uses action(s) not supported by datapath.
5187 ])
5188
5189 OVS_VSWITCHD_STOP
5190 AT_CLEANUP
5191
5192
5193 dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
5194 dnl
5195 dnl Checks the implementation of the continuation mechanism that allows the
5196 dnl packet processing pipeline to be paused and resumed. Starts by creating
5197 dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
5198 dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
5199 dnl in the bridge, resuming each time the pipeline pauses, and expects a single
5200 dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
5201 dnl ACTIONS0 still contains at least one "pause" action, removes one of them
5202 dnl and repeats the process.
5203 dnl
5204 dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
5205 dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
5206 dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
5207 dnl into port 1 on br0, so br1 only comes into action if a patch port (added
5208 dnl by EXTRA_SETUP) jumps from one bridge to another.
5209 dnl
5210 dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
5211 dnl both bridges, e.g. to configure mirrors or patch ports.
5212 m4_define([CHECK_CONTINUATION], [dnl
5213 AT_SETUP([ofproto-dpif - continuation - $1])
5214 AT_KEYWORDS([continuations pause resume])
5215 OVS_VSWITCHD_START
5216
5217 # count_matches STRING
5218 #
5219 # Prints on stdout the number of occurrences of STRING in stdin.
5220 count_matches () {
5221 sed -n ":start
5222 s/$[1]//p
5223 t start" | wc -l
5224 }
5225
5226 add_of_ports --pcap br0 `seq 1 $2`
5227 m4_if([$3], [0], [],
5228 [add_of_br 1
5229 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
5230
5231 AT_CAPTURE_FILE([ofctl_monitor0.log])
5232 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
5233 m4_if([$3], [0], [],
5234 [AT_CAPTURE_FILE([ofctl_monitor1.log])
5235 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
5236
5237 actions0='$4'
5238 actions1='$5'
5239 $6
5240 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)"
5241 n_packets=0
5242 n_resumes=0
5243 while true; do
5244 printf "\n\nactions for br0:\n%s\n" "$actions0"
5245 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
5246
5247 # Add flows.
5248 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
5249 m4_if([$3], [0], [],
5250 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
5251
5252 # Make sure the datapath is up-to-date before sending the packet.
5253 ovs-appctl revalidator/wait
5254
5255 # Run a packet through the switch.
5256 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5257
5258 # Wait for the expected number of packets to show up.
5259 n_packets=`expr $n_packets + $2 - 1 + $3`
5260 echo "waiting for $n_packets packets..."
5261 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
5262
5263 # Wait for the expected number of NXT_RESUMEs to be logged.
5264 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
5265 echo "waiting for $n_resumes NXT_RESUMEs..."
5266 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
5267
5268 # Eliminate one "pause" from the actions.
5269 #
5270 # If there were none left, then we're done.
5271 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
5272 if test X"$actions0" = X"$next_actions0"; then
5273 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
5274 if test X"$actions1" = X"$next_actions1"; then
5275 break
5276 else
5277 actions1=$next_actions1
5278 fi
5279 else
5280 actions0=$next_actions0
5281 fi
5282
5283 # Delete all the flows and verify that there are none, so that we
5284 # can be sure that our updated flow tables is actually in use
5285 # later.
5286 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
5287 [NXST_FLOW reply:
5288 ])
5289 m4_if([$3], [0], [],
5290 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
5291 [NXST_FLOW reply:
5292 ])])
5293 done
5294 OVS_VSWITCHD_STOP
5295 AT_CLEANUP
5296 ])
5297
5298 # Check that pause at the end of the pipeline works OK.
5299 #
5300 # (xlate_continuation() has a special case for no-op actions; this
5301 # fails without that special case.)
5302 CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
5303
5304 # Check that remaining actions are preserved following resume.
5305 CHECK_CONTINUATION([actions], [7], [0],
5306 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
5307
5308 # Check that multiple levels of resubmit continue following resume.
5309 #
5310 # The "resubmit:55", which is relative to the current table, is
5311 # particularly interesting because it checks that the notion of the
5312 # current table is correctly preserved.
5313 CHECK_CONTINUATION([resubmit], [10], [0],
5314 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
5315 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
5316 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
5317 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
5318 table=3 in_port=55 actions=pause 6 pause])
5319
5320 # Check that the action set is preserved across pause/resume.
5321 CHECK_CONTINUATION([action set], [3], [0],
5322 [in_port=1 actions=1 pause resubmit(,1) pause 2
5323 table=1 actions=write_actions(3)])
5324
5325 # Check that metadata and the stack used by push and pop is preserved
5326 # across pause/resume.
5327 CHECK_CONTINUATION([data stack], [3], [0],
5328 [in_port=1 actions=pause dnl
5329 set_field:1->reg0 dnl
5330 pause dnl
5331 set_field:2->reg1 dnl
5332 pause dnl
5333 output:NXM_NX_REG0[[]] dnl
5334 pause dnl
5335 push:NXM_NX_REG1[[]] dnl
5336 dnl
5337 pop:NXM_NX_REG2[[]] dnl
5338 pause dnl
5339 output:NXM_NX_REG2[[]] dnl
5340 pause dnl
5341 3])
5342
5343 # Check that mirror output occurs once and once only, even if
5344 # separated by pause/resume.
5345 CHECK_CONTINUATION([mirroring], [5], [0],
5346 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
5347 [ovs-vsctl \
5348 set Bridge br0 mirrors=@m --\
5349 --id=@p2 get Port p2 --\
5350 --id=@p3 get Port p3 --\
5351 --id=@p4 get Port p4 --\
5352 --id=@p5 get Port p5 --\
5353 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
5354
5355 # Check that pause works in the presence of patch ports.
5356 CHECK_CONTINUATION([patch ports], [4], [1],
5357 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
5358 table=1 in_port=1 actions=pause 3 pause 10 pause],
5359 [table=0 in_port=11 actions=pause 5 pause],
5360 [ovs-vsctl \
5361 -- add-port br0 patch10 \
5362 -- set interface patch10 type=patch options:peer=patch11 \
5363 ofport_request=10 \
5364 -- add-port br1 patch11 \
5365 -- set interface patch11 type=patch options:peer=patch10 \
5366 ofport_request=11])
5367
5368 AT_SETUP([ofproto-dpif - continuation flow stats])
5369 AT_KEYWORDS([continuations pause resume])
5370 OVS_VSWITCHD_START
5371
5372 add_of_ports --pcap br0 `seq 1 2`
5373
5374 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)"
5375
5376 AT_DATA([flows.txt], [dnl
5377 table=0 in_port=1 actions=set_field:1->reg1 controller(pause) resubmit(,2)
5378 table=2 reg1=0x1 actions=2
5379 ])
5380
5381 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5382
5383 AT_CAPTURE_FILE([ofctl_monitor0.log])
5384 ovs-ofctl monitor br0 resume --detach --no-chdir \
5385 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5386
5387 # Run a packet through the switch.
5388 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5389
5390 # Check flow stats
5391 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5392 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sed -n 's/idle_age=[[0-9]]*/idle_age=0/p' | grep 'table=2'], [0], [dnl
5393 cookie=0x0, duration=0.0s, table=2, n_packets=1, n_bytes=106, idle_age=0, reg1=0x1 actions=output:2
5394 ])
5395
5396 # The packet should be received by port 2
5397 AT_CHECK([test 1 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5398
5399 OVS_VSWITCHD_STOP
5400 AT_CLEANUP
5401
5402 AT_SETUP([ofproto-dpif - continuation with conntrack])
5403 AT_KEYWORDS([continuations pause resume])
5404 OVS_VSWITCHD_START
5405
5406 add_of_ports --pcap br0 `seq 1 2`
5407
5408 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)"
5409
5410 AT_DATA([flows.txt], [dnl
5411 table=0, in_port=1 icmp action=ct(table=1)
5412 table=1, icmp action=controller(pause) resubmit(,2)
5413 table=2, in_port=1 icmp ct_state=+trk+new action=output:2
5414 ])
5415
5416 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5417
5418 AT_CAPTURE_FILE([ofctl_monitor0.log])
5419 ovs-ofctl monitor br0 resume --detach --no-chdir \
5420 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5421
5422 # Run a packet through the switch.
5423 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5424
5425 # Check flow stats
5426 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5427 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sed -n 's/idle_age=[[0-9]]*/idle_age=0/p' | grep 'table=2'], [0], [dnl
5428 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
5429 ])
5430
5431 # The packet should be received by port 2
5432 AT_CHECK([test 1 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5433
5434 OVS_VSWITCHD_STOP
5435 AT_CLEANUP
5436
5437 # Check that pause works after the packet is cloned.
5438 AT_SETUP([ofproto-dpif - continuation after clone])
5439 AT_KEYWORDS([continuations clone pause resume])
5440 OVS_VSWITCHD_START
5441
5442 add_of_ports --pcap br0 `seq 1 3`
5443
5444 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)"
5445
5446 AT_DATA([flows.txt], [dnl
5447 table=0 in_port=1 actions=set_field:1->reg1 resubmit(,2)
5448 table=1 reg1=0x5 actions=controller(pause) resubmit(,3)
5449 table=1 reg1=0x1 actions=2
5450 table=2 in_port=1 actions=clone(set_field:5->reg1, resubmit(,1))
5451 table=3 reg1=0x1 actions=3
5452 table=3 reg1=0x5 actions=2
5453 ])
5454
5455 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5456
5457 AT_CAPTURE_FILE([ofctl_monitor0.log])
5458 ovs-ofctl monitor br0 resume --detach --no-chdir \
5459 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5460
5461 # Run a packet through the switch.
5462 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5463
5464 ovs-vsctl show
5465 ovs-ofctl dump-flows br0
5466
5467 # The packet should be received by port 2 and not port 3
5468 AT_CHECK([test 1 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5469 AT_CHECK([test 0 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p3-tx.pcap | wc -l`])
5470
5471 # NXT_RESUMEs should be 1 and reg1 should be set to 0x5.
5472 OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor*.log | grep NXT_RESUME | grep -c reg1=0x5`])
5473
5474 OVS_VSWITCHD_STOP
5475 AT_CLEANUP
5476
5477 # Two testcases below are for the ofproto/trace command
5478 # The first one tests all correct syntax:
5479 # ofproto/trace [dp_name] odp_flow [-generate|packet]
5480 # ofproto/trace br_name br_flow [-generate|packet]
5481 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
5482 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5483 add_of_ports br0 1 2 3
5484
5485 AT_DATA([flows.txt], [dnl
5486 in_port=1 actions=output:2
5487 in_port=2 actions=output:1
5488 ])
5489 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5490
5491 odp_flow="in_port(p1)"
5492 br_flow="in_port=1"
5493 # Test command: ofproto/trace odp_flow with in_port as a name.
5494 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5495 AT_CHECK([tail -1 stdout], [0], [dnl
5496 Datapath actions: 2
5497 ])
5498
5499 odp_flow="in_port(1)"
5500 # Test command: ofproto/trace odp_flow
5501 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5502 AT_CHECK([tail -1 stdout], [0], [dnl
5503 Datapath actions: 2
5504 ])
5505
5506 # Test command: ofproto/trace dp_name odp_flow
5507 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
5508 AT_CHECK([tail -1 stdout], [0], [dnl
5509 Datapath actions: 2
5510 ])
5511 # Test commmand: ofproto/trace br_name br_flow
5512 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5513 AT_CHECK([tail -1 stdout], [0], [dnl
5514 Datapath actions: 2
5515 ])
5516
5517 # Delete the inserted flows
5518 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
5519 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
5520
5521 # This section below tests the [-generate] option
5522 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
5523 br_flow="arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=ff:ff:ff:ff:ff:ff"
5524
5525 # Test command: ofproto/trace odp_flow
5526 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5527 # Check for no MAC learning entry
5528 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5529 port VLAN MAC Age
5530 ])
5531
5532 # Test command: ofproto/trace br_name br_flow
5533 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5534 # Check for no MAC learning entry
5535 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5536 port VLAN MAC Age
5537 ])
5538
5539 # Test command: ofproto/trace odp_flow -generate
5540 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
5541 # Check for the MAC learning entry
5542 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5543 port VLAN MAC Age
5544 3 0 50:54:00:00:00:05 ?
5545 ])
5546
5547 # Test command: ofproto/trace dp_name odp_flow -generate
5548 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5549 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
5550 -generate], [0], [stdout])
5551 # Check for both MAC learning entries
5552 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5553 port VLAN MAC Age
5554 3 0 50:54:00:00:00:05 ?
5555 1 0 50:54:00:00:00:06 ?
5556 ])
5557
5558 # Test command: ofproto/trace br_name br_flow -generate
5559 AT_CHECK([ovs-appctl ofproto/trace br0 \
5560 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
5561 -generate], [0], [stdout])
5562 # Check for both MAC learning entries.
5563 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5564 port VLAN MAC Age
5565 3 0 50:54:00:00:00:05 ?
5566 1 0 50:54:00:00:00:06 ?
5567 2 0 50:54:00:00:00:07 ?
5568 ])
5569
5570 # This section beflow tests the [packet] option
5571 # The ovs-tcpundump of packets between port1 and port2
5572 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5573 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
5574
5575 # Construct the MAC learning table
5576 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5577 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
5578 -generate], [0], [stdout])
5579
5580 # Construct the MAC learning table
5581 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5582 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
5583 -generate], [0], [stdout])
5584
5585 # Test command: ofproto/trace odp_flow packet
5586 AT_CHECK([ovs-appctl ofproto/trace \
5587 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5588 AT_CHECK([tail -1 stdout], [0], [dnl
5589 Datapath actions: 2
5590 ])
5591 AT_CHECK([head -n 3 stdout], [0], [dnl
5592 Flow: pkt_mark=0x2,skb_priority=0x1,arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_op=0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
5593
5594 bridge("br0")
5595 ])
5596
5597 # Test command: ofproto/trace dp_name odp_flow packet
5598 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5599 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5600 AT_CHECK([tail -1 stdout], [0], [dnl
5601 Datapath actions: 2
5602 ])
5603 AT_CHECK([head -n 3 stdout], [0], [dnl
5604 Flow: pkt_mark=0x2,skb_priority=0x1,arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_op=0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
5605
5606 bridge("br0")
5607 ])
5608
5609 # Test command: ofproto/trace br_name br_flow packet
5610 AT_CHECK([ovs-appctl ofproto/trace br0 \
5611 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
5612 AT_CHECK([tail -1 stdout], [0], [dnl
5613 Datapath actions: 1
5614 ])
5615 AT_CHECK([head -n 3 stdout], [0], [dnl
5616 Flow: pkt_mark=0x1,skb_priority=0x2,arp,in_port=2,vlan_tci=0x0000,dl_src=50:54:00:00:00:02,dl_dst=50:54:00:00:00:01,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_op=0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
5617
5618 bridge("br0")
5619 ])
5620
5621 OVS_VSWITCHD_STOP
5622 AT_CLEANUP
5623
5624 # The second test tests the corner cases
5625 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
5626 OVS_VSWITCHD_START
5627 add_of_ports br0 1 2
5628
5629 # Define flows
5630 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
5631 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
5632 # Define options
5633 generate="-generate"
5634 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5635
5636 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
5637 m4_foreach(
5638 [option],
5639 [[],
5640 ["$generate"],
5641 ["$pkt"]],
5642 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
5643 [2], [], [stderr])
5644 AT_CHECK([tail -2 stderr], [0], [dnl
5645 Cannot find the datapath
5646 ovs-appctl: ovs-vswitchd: server returned an error
5647 ])])
5648
5649 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
5650 m4_foreach(
5651 [option],
5652 [[],
5653 ["$generate"],
5654 ["$pkt"]],
5655 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
5656 [2], [], [stderr])
5657 AT_CHECK([tail -2 stderr], [0], [dnl
5658 Cannot find the datapath
5659 ovs-appctl: ovs-vswitchd: server returned an error
5660 ])])
5661
5662 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
5663 m4_foreach(
5664 [option],
5665 [[],
5666 ["$generate"],
5667 ["$pkt"]],
5668 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
5669 [2], [], [stderr])
5670 AT_CHECK([tail -2 stderr], [0], [dnl
5671 Cannot find the datapath
5672 ovs-appctl: ovs-vswitchd: server returned an error
5673 ])])
5674
5675 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
5676 m4_foreach(
5677 [option],
5678 [[],
5679 ["$generate"],
5680 ["$pkt"]],
5681 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
5682 [2], [], [stderr])
5683 AT_CHECK([tail -2 stderr], [0], [dnl
5684 Cannot find the datapath
5685 ovs-appctl: ovs-vswitchd: server returned an error
5686 ])])
5687
5688 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
5689 m4_foreach(
5690 [option],
5691 [[],
5692 ["$generate"],
5693 ["$pkt"]],
5694 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
5695 [2], [], [stderr])
5696 AT_CHECK([tail -2 stderr], [0], [dnl
5697 ovs-dummy: unknown bridge
5698 ovs-appctl: ovs-vswitchd: server returned an error
5699 ])])
5700
5701 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
5702 m4_foreach(
5703 [option],
5704 [[],
5705 ["$generate"],
5706 ["$pkt"]],
5707 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
5708 [2], [], [stderr])
5709 AT_CHECK([tail -2 stderr], [0], [dnl
5710 syntax error at in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02 (or the bridge name was omitted)
5711 ovs-appctl: ovs-vswitchd: server returned an error
5712 ])])
5713
5714 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
5715 AT_CHECK([ovs-appctl ofproto/trace \
5716 ovs-dummy "$odp_flow" garbage_option],
5717 [2], [stdout],[stderr])
5718 AT_CHECK([tail -2 stderr], [0], [dnl
5719 Trailing garbage in packet data
5720 ovs-appctl: ovs-vswitchd: server returned an error
5721 ])
5722
5723 # Test incorrect command: ofproto/trace with 0 argument
5724 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
5725 AT_CHECK([tail -2 stderr], [0], [dnl
5726 "ofproto/trace" command requires at least 1 arguments
5727 ovs-appctl: ovs-vswitchd: server returned an error
5728 ])
5729
5730 OVS_VSWITCHD_STOP
5731 AT_CLEANUP
5732
5733 # The third test checks that the output of "ovs-dpctl -m" is valid to trace.
5734 AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
5735 OVS_VSWITCHD_START([dnl
5736 set Open_vSwitch . other_config:max-idle=10000 \
5737 -- add-port br0 p1 -- set Interface p1 type=dummy])
5738
5739 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)'])
5740 ovs-appctl revalidator/wait
5741 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
5742
5743 odp_flow=`cat dp_flows1.txt`
5744 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5745 Flow: <cleared>
5746
5747 bridge("br0")
5748 -------------
5749 0. No match.
5750 drop
5751
5752 Final flow: <cleared>
5753 Megaflow: <cleared>
5754 Datapath actions: drop
5755 ])
5756
5757 dnl Now, try again without megaflows:
5758 ovs-appctl upcall/disable-megaflows
5759
5760 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)'])
5761 ovs-appctl revalidator/wait
5762 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
5763
5764 odp_flow=`cat dp_flows2.txt`
5765 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5766 Flow: <cleared>
5767
5768 bridge("br0")
5769 -------------
5770 0. No match.
5771 drop
5772
5773 Final flow: <cleared>
5774 Megaflow: <cleared>
5775 Datapath actions: drop
5776 ])
5777
5778 OVS_VSWITCHD_STOP
5779 AT_CLEANUP
5780
5781 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
5782 OVS_VSWITCHD_START
5783 add_of_ports br0 1 2 3
5784
5785 AT_DATA([flows.txt], [dnl
5786 in_port=1 actions=output:2
5787 in_port=2 actions=output:1
5788 ])
5789 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5790
5791 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
5792 AT_CHECK([tail -1 stdout], [0], [dnl
5793 Datapath actions: push_vlan(vid=123,pcp=0),2
5794 ])
5795
5796 OVS_VSWITCHD_STOP
5797 AT_CLEANUP
5798
5799
5800 m4_define([OFPROTO_TRACE],
5801 [flow="$2"
5802 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
5803 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5804 expected="$4"
5805 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
5806 [0], [stdout])
5807 mv stdout expout
5808 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
5809 [0], [expout])])
5810
5811 AT_SETUP([ofproto-dpif - MAC learning])
5812 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5813 add_of_ports br0 1 2 3
5814
5815 arp='eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
5816
5817 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
5818 OFPROTO_TRACE(
5819 [ovs-dummy],
5820 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5821 [-generate],
5822 [1,2,100])
5823
5824 # Check for the MAC learning entry.
5825 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5826 port VLAN MAC Age
5827 3 0 50:54:00:00:00:05 ?
5828 ])
5829
5830 # Trace a packet arrival destined for the learned MAC.
5831 # (This will also learn a MAC.)
5832 OFPROTO_TRACE(
5833 [ovs-dummy],
5834 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
5835 [-generate],
5836 [3])
5837
5838 # Check for both MAC learning entries.
5839 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5840 port VLAN MAC Age
5841 3 0 50:54:00:00:00:05 ?
5842 1 0 50:54:00:00:00:06 ?
5843 ])
5844
5845 # Trace a packet arrival that updates the first learned MAC entry.
5846 OFPROTO_TRACE(
5847 [ovs-dummy],
5848 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5849 [-generate],
5850 [1,3,100])
5851
5852 # Check that the MAC learning entry was updated.
5853 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5854 port VLAN MAC Age
5855 1 0 50:54:00:00:00:06 ?
5856 2 0 50:54:00:00:00:05 ?
5857 ])
5858
5859 # Add another bridge.
5860 AT_CHECK(
5861 [ovs-vsctl \
5862 -- add-br br1 \
5863 -- set bridge br1 datapath-type=dummy])
5864 add_of_ports br1 4 5
5865
5866 # Trace some packet arrivals in br1 to create MAC learning entries there too.
5867 OFPROTO_TRACE(
5868 [ovs-dummy],
5869 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
5870 [-generate],
5871 [5,101])
5872 OFPROTO_TRACE(
5873 [ovs-dummy],
5874 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
5875 [-generate],
5876 [4,101])
5877
5878 # Check that the MAC learning entries were added.
5879 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5880 port VLAN MAC Age
5881 4 0 50:54:00:00:00:06 ?
5882 5 0 50:54:00:00:00:07 ?
5883 ])
5884
5885 # Delete port p1 and see that its MAC learning entry disappeared, and
5886 # that the MAC learning entry for the same MAC was also deleted from br1.
5887 AT_CHECK([ovs-vsctl del-port p1])
5888 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5889 port VLAN MAC Age
5890 2 0 50:54:00:00:00:05 ?
5891 ])
5892 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5893 port VLAN MAC Age
5894 5 0 50:54:00:00:00:07 ?
5895 ])
5896
5897 OVS_VSWITCHD_STOP
5898 AT_CLEANUP
5899
5900 AT_SETUP([ofproto-dpif - MAC table overflow])
5901 OVS_VSWITCHD_START(
5902 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
5903 add_of_ports br0 1 2 3
5904
5905 arp='eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
5906
5907 AT_CHECK([ovs-appctl time/stop])
5908
5909 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
5910 for i in 0 1 2 3 4 5 6 7 8 9; do
5911 OFPROTO_TRACE(
5912 [ovs-dummy],
5913 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
5914 [-generate],
5915 [1,2,100])
5916 ovs-appctl time/warp 1000
5917 done
5918
5919 # Check for the MAC learning entries.
5920 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5921 [0], [dnl
5922 3 0 50:54:00:00:00:00
5923 3 0 50:54:00:00:00:01
5924 3 0 50:54:00:00:00:02
5925 3 0 50:54:00:00:00:03
5926 3 0 50:54:00:00:00:04
5927 3 0 50:54:00:00:00:05
5928 3 0 50:54:00:00:00:06
5929 3 0 50:54:00:00:00:07
5930 3 0 50:54:00:00:00:08
5931 3 0 50:54:00:00:00:09
5932 port VLAN MAC Age
5933 ])
5934
5935 # Trace another ARP packet on another MAC.
5936 OFPROTO_TRACE(
5937 [ovs-dummy],
5938 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
5939 [-generate],
5940 [1,2,100])
5941
5942 # Check that the new one chased the oldest one out of the table.
5943 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
5944 [0], [dnl
5945 3 0 50:54:00:00:00:01 ?
5946 3 0 50:54:00:00:00:02 ?
5947 3 0 50:54:00:00:00:03 ?
5948 3 0 50:54:00:00:00:04 ?
5949 3 0 50:54:00:00:00:05 ?
5950 3 0 50:54:00:00:00:06 ?
5951 3 0 50:54:00:00:00:07 ?
5952 3 0 50:54:00:00:00:08 ?
5953 3 0 50:54:00:00:00:09 ?
5954 3 0 50:54:00:00:00:10 ?
5955 port VLAN MAC Age
5956 ])
5957 OVS_VSWITCHD_STOP
5958 AT_CLEANUP
5959
5960 AT_SETUP([ofproto-dpif - MAC table overflow fairness])
5961 OVS_VSWITCHD_START(
5962 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
5963 add_of_ports br0 1 2 3 4 5 6
5964
5965 arp='eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
5966
5967 AT_CHECK([ovs-appctl time/stop])
5968
5969 # Trace packets with 2 different source MACs arriving on each of the 5
5970 # ports, filling up the 10-entry learning table.
5971 for i in 0 1 2 3 4 5 6 7 8 9; do
5972 p=`expr $i / 2 + 1`
5973 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
5974 ovs-appctl time/warp 1000
5975 done
5976
5977 # Check for the MAC learning entries.
5978 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5979 [0], [dnl
5980 1 0 50:54:00:00:00:00
5981 1 0 50:54:00:00:00:01
5982 2 0 50:54:00:00:00:02
5983 2 0 50:54:00:00:00:03
5984 3 0 50:54:00:00:00:04
5985 3 0 50:54:00:00:00:05
5986 4 0 50:54:00:00:00:06
5987 4 0 50:54:00:00:00:07
5988 5 0 50:54:00:00:00:08
5989 5 0 50:54:00:00:00:09
5990 port VLAN MAC Age
5991 ])
5992
5993 # Now trace 16 new MACs on another port.
5994 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
5995 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
5996 ovs-appctl time/warp 1000
5997 done
5998
5999 # Check the results.
6000 #
6001 # Our eviction algorithm on overflow is that an arbitrary (but deterministic)
6002 # one of the ports with the most learned MACs loses the least recently used
6003 # one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
6004 # MAC each, and the other 2 of the old ports with 2 MACs each.
6005 #
6006 # (If someone changes lib/heap.c to do something different with equal-priority
6007 # nodes, then the output below could change, but it would still follow the
6008 # rules explained above.)
6009 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
6010 [0], [dnl
6011 1 0 50:54:00:00:00:01
6012 2 0 50:54:00:00:00:03
6013 3 0 50:54:00:00:00:04
6014 3 0 50:54:00:00:00:05
6015 4 0 50:54:00:00:00:07
6016 5 0 50:54:00:00:00:08
6017 5 0 50:54:00:00:00:09
6018 6 0 50:54:00:00:0d:ff
6019 6 0 50:54:00:00:0e:ff
6020 6 0 50:54:00:00:0f:ff
6021 port VLAN MAC Age
6022 ])
6023 OVS_VSWITCHD_STOP
6024 AT_CLEANUP
6025
6026 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
6027 #
6028 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
6029 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
6030 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6031 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6032
6033 on_exit 'kill `cat test-sflow.pid`'
6034 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
6035 AT_CAPTURE_FILE([sflow.log])
6036 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6037 ovs-appctl time/stop
6038
6039 add_of_ports br0 1 2
6040 ovs-vsctl \
6041 set Interface br0 options:ifindex=1002 -- \
6042 set Interface p1 options:ifindex=1004 -- \
6043 set Interface p2 options:ifindex=1003 -- \
6044 set Bridge br0 sflow=@sf -- \
6045 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
6046 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
6047
6048 dnl open with ARP packets to seed the bridge-learning. The output
6049 dnl ifIndex numbers should be reported predictably after that.
6050 dnl Since we set sampling=1 we should see all of these packets
6051 dnl reported. Sorting the output by data-source and seqNo makes
6052 dnl it deterministic. Ensuring that we send at least two packets
6053 dnl into each port means we get to check the seq nos are
6054 dnl incrementing correctly.
6055 dnl because packets from different ports can be handled by separate
6056 dnl threads, put some sleeps
6057
6058 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)'
6059 sleep 1
6060 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)'
6061 sleep 1
6062 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)'
6063 sleep 1
6064 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)'
6065 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)'
6066
6067 dnl sleep long enough to get more than one counter sample
6068 dnl from each datasource so we can check sequence numbers
6069 ovs-appctl time/warp 2000 100
6070 OVS_VSWITCHD_STOP
6071 OVS_APP_EXIT_AND_WAIT([test-sflow])
6072
6073 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6074 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
6075 HEADER
6076 dgramSeqNo=1
6077 ds=127.0.0.1>2:1000
6078 fsSeqNo=1
6079 in_vlan=0
6080 in_priority=0
6081 out_vlan=0
6082 out_priority=0
6083 meanSkip=1
6084 samplePool=1
6085 dropEvents=0
6086 in_ifindex=1004
6087 in_format=0
6088 out_ifindex=2
6089 out_format=2
6090 hdr_prot=1
6091 pkt_len=46
6092 stripped=4
6093 hdr_len=42
6094 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
6095 HEADER
6096 dgramSeqNo=1
6097 ds=127.0.0.1>2:1000
6098 fsSeqNo=2
6099 in_vlan=0
6100 in_priority=0
6101 out_vlan=0
6102 out_priority=0
6103 meanSkip=1
6104 samplePool=2
6105 dropEvents=0
6106 in_ifindex=1003
6107 in_format=0
6108 out_ifindex=2
6109 out_format=2
6110 hdr_prot=1
6111 pkt_len=46
6112 stripped=4
6113 hdr_len=42
6114 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
6115 HEADER
6116 dgramSeqNo=1
6117 ds=127.0.0.1>2:1000
6118 fsSeqNo=3
6119 in_vlan=0
6120 in_priority=0
6121 out_vlan=0
6122 out_priority=0
6123 meanSkip=1
6124 samplePool=3
6125 dropEvents=0
6126 in_ifindex=1004
6127 in_format=0
6128 out_ifindex=1003
6129 out_format=0
6130 hdr_prot=1
6131 pkt_len=110
6132 stripped=4
6133 hdr_len=106
6134 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
6135 HEADER
6136 dgramSeqNo=1
6137 ds=127.0.0.1>2:1000
6138 fsSeqNo=4
6139 in_vlan=0
6140 in_priority=0
6141 out_vlan=0
6142 out_priority=0
6143 meanSkip=1
6144 samplePool=4
6145 dropEvents=0
6146 in_ifindex=1003
6147 in_format=0
6148 out_ifindex=1004
6149 out_format=0
6150 hdr_prot=1
6151 pkt_len=110
6152 stripped=4
6153 hdr_len=106
6154 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
6155 HEADER
6156 dgramSeqNo=1
6157 ds=127.0.0.1>2:1000
6158 fsSeqNo=5
6159 in_vlan=0
6160 in_priority=0
6161 out_vlan=0
6162 out_priority=0
6163 meanSkip=1
6164 samplePool=5
6165 dropEvents=0
6166 in_ifindex=1003
6167 in_format=0
6168 out_ifindex=1004
6169 out_format=0
6170 hdr_prot=1
6171 pkt_len=58
6172 stripped=4
6173 hdr_len=54
6174 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
6175 ])
6176
6177 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'ETHCOUNTERS|IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -24 | sed 's/ /\
6178 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
6179 ETHCOUNTERS
6180 dot3StatsAlignmentErrors=4294967295
6181 dot3StatsFCSErrors=4294967295
6182 dot3StatsSingleCollisionFrames=4294967295
6183 dot3StatsMultipleCollisionFrames=4294967295
6184 dot3StatsSQETestErrors=4294967295
6185 dot3StatsDeferredTransmissions=4294967295
6186 dot3StatsLateCollisions=4294967295
6187 dot3StatsExcessiveCollisions=4294967295
6188 dot3StatsInternalMacTransmitErrors=4294967295
6189 dot3StatsCarrierSenseErrors=4294967295
6190 dot3StatsFrameTooLongs=4294967295
6191 dot3StatsInternalMacReceiveErrors=4294967295
6192 dot3StatsSymbolErrors=4294967295
6193 ETHCOUNTERS
6194 dot3StatsAlignmentErrors=4294967295
6195 dot3StatsFCSErrors=4294967295
6196 dot3StatsSingleCollisionFrames=4294967295
6197 dot3StatsMultipleCollisionFrames=4294967295
6198 dot3StatsSQETestErrors=4294967295
6199 dot3StatsDeferredTransmissions=4294967295
6200 dot3StatsLateCollisions=4294967295
6201 dot3StatsExcessiveCollisions=4294967295
6202 dot3StatsInternalMacTransmitErrors=4294967295
6203 dot3StatsCarrierSenseErrors=4294967295
6204 dot3StatsFrameTooLongs=4294967295
6205 dot3StatsInternalMacReceiveErrors=4294967295
6206 dot3StatsSymbolErrors=4294967295
6207 ETHCOUNTERS
6208 dot3StatsAlignmentErrors=4294967295
6209 dot3StatsFCSErrors=4294967295
6210 dot3StatsSingleCollisionFrames=4294967295
6211 dot3StatsMultipleCollisionFrames=4294967295
6212 dot3StatsSQETestErrors=4294967295
6213 dot3StatsDeferredTransmissions=4294967295
6214 dot3StatsLateCollisions=4294967295
6215 dot3StatsExcessiveCollisions=4294967295
6216 dot3StatsInternalMacTransmitErrors=4294967295
6217 dot3StatsCarrierSenseErrors=4294967295
6218 dot3StatsFrameTooLongs=4294967295
6219 dot3StatsInternalMacReceiveErrors=4294967295
6220 dot3StatsSymbolErrors=4294967295
6221 ETHCOUNTERS
6222 dot3StatsAlignmentErrors=4294967295
6223 dot3StatsFCSErrors=4294967295
6224 dot3StatsSingleCollisionFrames=4294967295
6225 dot3StatsMultipleCollisionFrames=4294967295
6226 dot3StatsSQETestErrors=4294967295
6227 dot3StatsDeferredTransmissions=4294967295
6228 dot3StatsLateCollisions=4294967295
6229 dot3StatsExcessiveCollisions=4294967295
6230 dot3StatsInternalMacTransmitErrors=4294967295
6231 dot3StatsCarrierSenseErrors=4294967295
6232 dot3StatsFrameTooLongs=4294967295
6233 dot3StatsInternalMacReceiveErrors=4294967295
6234 dot3StatsSymbolErrors=4294967295
6235 ETHCOUNTERS
6236 dot3StatsAlignmentErrors=4294967295
6237 dot3StatsFCSErrors=4294967295
6238 dot3StatsSingleCollisionFrames=4294967295
6239 dot3StatsMultipleCollisionFrames=4294967295
6240 dot3StatsSQETestErrors=4294967295
6241 dot3StatsDeferredTransmissions=4294967295
6242 dot3StatsLateCollisions=4294967295
6243 dot3StatsExcessiveCollisions=4294967295
6244 dot3StatsInternalMacTransmitErrors=4294967295
6245 dot3StatsCarrierSenseErrors=4294967295
6246 dot3StatsFrameTooLongs=4294967295
6247 dot3StatsInternalMacReceiveErrors=4294967295
6248 dot3StatsSymbolErrors=4294967295
6249 ETHCOUNTERS
6250 dot3StatsAlignmentErrors=4294967295
6251 dot3StatsFCSErrors=4294967295
6252 dot3StatsSingleCollisionFrames=4294967295
6253 dot3StatsMultipleCollisionFrames=4294967295
6254 dot3StatsSQETestErrors=4294967295
6255 dot3StatsDeferredTransmissions=4294967295
6256 dot3StatsLateCollisions=4294967295
6257 dot3StatsExcessiveCollisions=4294967295
6258 dot3StatsInternalMacTransmitErrors=4294967295
6259 dot3StatsCarrierSenseErrors=4294967295
6260 dot3StatsFrameTooLongs=4294967295
6261 dot3StatsInternalMacReceiveErrors=4294967295
6262 dot3StatsSymbolErrors=4294967295
6263 IFCOUNTERS
6264 dgramSeqNo=1
6265 ds=127.0.0.1>0:1003
6266 csSeqNo=1
6267 ifindex=1003
6268 type=6
6269 ifspeed=100000000
6270 direction=0
6271 status=3
6272 in_octets=202
6273 in_unicasts=3
6274 in_multicasts=4294967295
6275 in_broadcasts=4294967295
6276 in_discards=4294967295
6277 in_errors=4294967295
6278 in_unknownprotos=4294967295
6279 out_octets=148
6280 out_unicasts=2
6281 out_multicasts=4294967295
6282 out_broadcasts=4294967295
6283 out_discards=4294967295
6284 out_errors=4294967295
6285 promiscuous=0
6286 IFCOUNTERS
6287 dgramSeqNo=1
6288 ds=127.0.0.1>0:1004
6289 csSeqNo=1
6290 ifindex=1004
6291 type=6
6292 ifspeed=100000000
6293 direction=0
6294 status=3
6295 in_octets=148
6296 in_unicasts=2
6297 in_multicasts=4294967295
6298 in_broadcasts=4294967295
6299 in_discards=4294967295
6300 in_errors=4294967295
6301 in_unknownprotos=4294967295
6302 out_octets=202
6303 out_unicasts=3
6304 out_multicasts=4294967295
6305 out_broadcasts=4294967295
6306 out_discards=4294967295
6307 out_errors=4294967295
6308 promiscuous=0
6309 IFCOUNTERS
6310 dgramSeqNo=2
6311 ds=127.0.0.1>0:1002
6312 csSeqNo=1
6313 ifindex=1002
6314 type=6
6315 ifspeed=100000000
6316 direction=0
6317 status=3
6318 in_octets=0
6319 in_unicasts=0
6320 in_multicasts=4294967295
6321 in_broadcasts=4294967295
6322 in_discards=4294967295
6323 in_errors=4294967295
6324 in_unknownprotos=4294967295
6325 out_octets=84
6326 out_unicasts=2
6327 out_multicasts=4294967295
6328 out_broadcasts=4294967295
6329 out_discards=4294967295
6330 out_errors=4294967295
6331 promiscuous=0
6332 IFCOUNTERS
6333 dgramSeqNo=3
6334 ds=127.0.0.1>0:1002
6335 csSeqNo=2
6336 ifindex=1002
6337 type=6
6338 ifspeed=100000000
6339 direction=0
6340 status=3
6341 in_octets=0
6342 in_unicasts=0
6343 in_multicasts=4294967295
6344 in_broadcasts=4294967295
6345 in_discards=4294967295
6346 in_errors=4294967295
6347 in_unknownprotos=4294967295
6348 out_octets=84
6349 out_unicasts=2
6350 out_multicasts=4294967295
6351 out_broadcasts=4294967295
6352 out_discards=4294967295
6353 out_errors=4294967295
6354 promiscuous=0
6355 IFCOUNTERS
6356 dgramSeqNo=3
6357 ds=127.0.0.1>0:1003
6358 csSeqNo=2
6359 ifindex=1003
6360 type=6
6361 ifspeed=100000000
6362 direction=0
6363 status=3
6364 in_octets=202
6365 in_unicasts=3
6366 in_multicasts=4294967295
6367 in_broadcasts=4294967295
6368 in_discards=4294967295
6369 in_errors=4294967295
6370 in_unknownprotos=4294967295
6371 out_octets=148
6372 out_unicasts=2
6373 out_multicasts=4294967295
6374 out_broadcasts=4294967295
6375 out_discards=4294967295
6376 out_errors=4294967295
6377 promiscuous=0
6378 IFCOUNTERS
6379 dgramSeqNo=3
6380 ds=127.0.0.1>0:1004
6381 csSeqNo=2
6382 ifindex=1004
6383 type=6
6384 ifspeed=100000000
6385 direction=0
6386 status=3
6387 in_octets=148
6388 in_unicasts=2
6389 in_multicasts=4294967295
6390 in_broadcasts=4294967295
6391 in_discards=4294967295
6392 in_errors=4294967295
6393 in_unknownprotos=4294967295
6394 out_octets=202
6395 out_unicasts=3
6396 out_multicasts=4294967295
6397 out_broadcasts=4294967295
6398 out_discards=4294967295
6399 out_errors=4294967295
6400 promiscuous=0
6401 OPENFLOWPORT
6402 datapath_id=18364758544493064720
6403 port_no=1
6404 OPENFLOWPORT
6405 datapath_id=18364758544493064720
6406 port_no=1
6407 OPENFLOWPORT
6408 datapath_id=18364758544493064720
6409 port_no=2
6410 OPENFLOWPORT
6411 datapath_id=18364758544493064720
6412 port_no=2
6413 OPENFLOWPORT
6414 datapath_id=18364758544493064720
6415 port_no=65534
6416 OPENFLOWPORT
6417 datapath_id=18364758544493064720
6418 port_no=65534
6419 PORTNAME
6420 portName=br0
6421 PORTNAME
6422 portName=br0
6423 PORTNAME
6424 portName=p1
6425 PORTNAME
6426 portName=p1
6427 PORTNAME
6428 portName=p2
6429 PORTNAME
6430 portName=p2
6431 ])])
6432
6433 AT_SETUP([ofproto-dpif - basic truncate action])
6434 OVS_VSWITCHD_START
6435 add_of_ports br0 1 2 3 4 5
6436
6437 AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
6438 AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
6439 AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
6440 AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
6441 AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
6442
6443 AT_DATA([flows.txt], [dnl
6444 in_port=3,actions=drop
6445 in_port=5,actions=drop
6446 in_port=1,actions=output(port=2,max_len=64),output:4
6447 ])
6448 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6449
6450 dnl Datapath actions
6451 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
6452 AT_CHECK([tail -1 stdout], [0],
6453 [Datapath actions: trunc(64),2,4
6454 ])
6455
6456 dnl An 170 byte packet
6457 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6458
6459 AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
6460 icmp,in_port=ANY,vlan_tci=0x0000,dl_src=00:50:56:c0:00:08,dl_dst=00:0c:29:c8:a0:a4,nw_src=192.168.218.1,nw_dst=192.168.218.100,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0
6461 ])
6462
6463 AT_CHECK([ovs-appctl revalidator/purge], [0])
6464 dnl packet with truncated size
6465 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6466 n_bytes=64
6467 ])
6468 dnl packet with original size
6469 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6470 n_bytes=170
6471 ])
6472
6473 dnl More complicated case
6474 AT_CHECK([ovs-ofctl del-flows br0])
6475 AT_DATA([flows.txt], [dnl
6476 in_port=3,actions=drop
6477 in_port=5,actions=drop
6478 in_port=1,actions=output(port=2,max_len=64),output(port=2,max_len=128),output(port=4,max_len=60),output:2,output:4
6479 ])
6480 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6481
6482 dnl Datapath actions
6483 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
6484 AT_CHECK([tail -1 stdout], [0],
6485 [Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
6486 ])
6487
6488 dnl An 170 byte packet
6489 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6490
6491 AT_CHECK([ovs-appctl revalidator/purge], [0])
6492 dnl packet size: 64 + 128 + 170 = 362
6493 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6494 n_bytes=362
6495 ])
6496 dnl packet size: 60 + 170 = 230
6497 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6498 n_bytes=230
6499 ])
6500
6501 dnl syntax checking
6502 AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
6503 ovs-ofctl: output to unsupported truncate port: ALL
6504 ])
6505
6506 OVS_VSWITCHD_STOP
6507 AT_CLEANUP
6508
6509 AT_SETUP([ofproto-dpif - truncate and output to patch port])
6510 OVS_VSWITCHD_START([add-br br1 \
6511 -- set bridge br1 datapath-type=dummy fail-mode=secure \
6512 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 ofport_request=1 \
6513 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6514
6515 add_of_ports br0 2
6516
6517 AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
6518 AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
6519
6520 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6521 [0], [stdout])
6522 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
6523 ])
6524 dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
6525 AT_CHECK([grep "output_trunc does not support patch port [[0-9]]*" stdout], [0], [stdout])
6526
6527 OVS_VSWITCHD_STOP
6528 AT_CLEANUP
6529
6530 AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
6531 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6532 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6533 options:key=5 ofport_request=1\
6534 -- add-port br0 p2 -- set Interface p2 type=dummy \
6535 ofport_request=2])
6536 AT_DATA([flows.txt], [dnl
6537 actions=output(max_len=100, port=1)
6538 ])
6539 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6540 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6541
6542 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
6543 br0 65534/100: (dummy-internal)
6544 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
6545 p2 2/2: (dummy)
6546 ])
6547
6548 dnl Basic
6549 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
6550 AT_CHECK([tail -1 stdout], [0],
6551 [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
6552 ])
6553
6554 OVS_VSWITCHD_STOP
6555 AT_CLEANUP
6556
6557 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
6558 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
6559 AT_CLEANUP
6560
6561 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
6562 AT_SKIP_IF([test $HAVE_IPV6 = no])
6563 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
6564 AT_CLEANUP
6565
6566 dnl Test sFlow LAG structures
6567 AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
6568 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
6569 OVS_VSWITCHD_START([dnl
6570 add-bond br0 bond p1 p2 -- \
6571 set Port bond lacp=active bond-mode=active-backup \
6572 other_config:lacp-time="fast" \
6573 other_config:lacp-system-id=11:22:33:44:55:66 \
6574 other_config:lacp-system-priority=54321 -- \
6575 set Interface p1 type=dummy \
6576 other_config:lacp-port-id=11 \
6577 other_config:lacp-port-priority=111 \
6578 other_config:lacp-aggregation-key=3333 -- \
6579 set Interface p2 type=dummy \
6580 other_config:lacp-port-id=22 \
6581 other_config:lacp-port-priority=222 \
6582 other_config:lacp-aggregation-key=3333 ])
6583
6584 on_exit 'kill `cat test-sflow.pid`'
6585 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6586 AT_CAPTURE_FILE([sflow.log])
6587 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6588
6589 ovs-appctl time/stop
6590
6591 ovs-vsctl \
6592 set Interface p1 options:ifindex=1003 -- \
6593 set Bridge br0 sflow=@sf -- \
6594 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6595 header=128 sampling=1 polling=1 agent=127.0.0.1
6596
6597 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6598 AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
6599 AT_CHECK([ovs-appctl revalidator/purge], [0])
6600 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6601 OVS_APP_EXIT_AND_WAIT([test-sflow])
6602 AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
6603 /g']], [0], [dnl
6604 LACPCOUNTERS
6605 sysID=11:22:33:44:55:66
6606 partnerID=00:00:00:00:00:00
6607 aggID=3333
6608 actorAdmin=0x7
6609 actorOper=0xbf
6610 partnerAdmin=0x0
6611 partnerOper=0x2
6612 LACPDUsRx=0
6613 markerPDUsRx=4294967295
6614 markerRespPDUsRx=4294967295
6615 unknownRx=4294967295
6616 illegalRx=0
6617 LACPDUsTx=1
6618 markerPDUsTx=4294967295
6619 markerRespPDUsTx=4294967295
6620 ])
6621
6622 AT_CLEANUP
6623
6624 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
6625 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6626 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6627
6628 dnl set up sFlow logging
6629 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6630 AT_CAPTURE_FILE([sflow.log])
6631 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6632 ovs-appctl time/stop
6633
6634 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6635 AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
6636 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
6637 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
6638
6639 AT_CHECK([ovs-ofctl add-flow br0 action=3])
6640
6641 dnl enable sflow
6642 ovs-vsctl \
6643 set Bridge br0 sflow=@sf -- \
6644 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
6645 header=128 sampling=1 polling=0
6646
6647 dnl introduce a packet that will be flooded to the tunnel
6648 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(4),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'])
6649
6650 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6651 for i in `seq 1 30`; do
6652 ovs-appctl time/warp 100
6653 done
6654
6655 OVS_APP_EXIT_AND_WAIT([test-sflow])
6656
6657 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6658 /g']], [0], [dnl
6659 HEADER
6660 dgramSeqNo=1
6661 ds=127.0.0.1>2:1000
6662 fsSeqNo=1
6663 tunnel4_out_length=0
6664 tunnel4_out_protocol=47
6665 tunnel4_out_src=0.0.0.0
6666 tunnel4_out_dst=1.1.1.1
6667 tunnel4_out_src_port=0
6668 tunnel4_out_dst_port=0
6669 tunnel4_out_tcp_flags=0
6670 tunnel4_out_tos=1
6671 tunnel_out_vni=456
6672 in_vlan=0
6673 in_priority=0
6674 out_vlan=0
6675 out_priority=0
6676 meanSkip=1
6677 samplePool=1
6678 dropEvents=0
6679 in_ifindex=0
6680 in_format=0
6681 out_ifindex=1
6682 out_format=2
6683 hdr_prot=1
6684 pkt_len=110
6685 stripped=4
6686 hdr_len=106
6687 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
6688 ])
6689
6690 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6691 AT_CLEANUP
6692
6693 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
6694 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6695
6696 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
6697
6698 dnl set up sFlow logging
6699 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6700 AT_CAPTURE_FILE([sflow.log])
6701 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6702 ovs-appctl time/stop
6703
6704 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6705 AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
6706 AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
6707 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
6708 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
6709 options:ifindex=2011 ofport_request=5
6710 ], [0])
6711
6712 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6713 dummy@ovs-dummy: hit:0 missed:0
6714 br0:
6715 br0 65534/100: (dummy-internal)
6716 p0 1/1: (dummy: ifindex=1010)
6717 int-br:
6718 int-br 65534/2: (dummy-internal)
6719 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
6720 vm1 5/3: (dummy: ifindex=2011)
6721 ])
6722
6723 dnl set up route to 1.1.2.92 via br0 and action=normal
6724 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
6725 ])
6726 AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
6727 ])
6728 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6729
6730 dnl Prime ARP Cache for 1.1.2.92
6731 AT_CHECK([ovs-appctl netdev-dummy/receive p0 'recirc_id(0),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
6732
6733 dnl configure sflow on int-br only
6734 ovs-vsctl \
6735 set Bridge int-br sflow=@sf -- \
6736 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
6737 header=128 sampling=1 polling=0
6738
6739 dnl set up route to 192.168.1.2 via br0
6740 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
6741 ])
6742 AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
6743 ])
6744
6745 dnl add rule for int-br to force packet onto tunnel. There is no ifindex
6746 dnl for this port so the sFlow output will just report that it went to
6747 dnl 1 output (out_format=2, out_ifindex=1)
6748 AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
6749
6750 AT_CHECK([ovs-appctl netdev-dummy/receive vm1 'in_port(3),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=192.168.1.1,dst=192.168.2.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'])
6751
6752 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6753 for i in `seq 1 30`; do
6754 ovs-appctl time/warp 100
6755 done
6756
6757 OVS_APP_EXIT_AND_WAIT([test-sflow])
6758
6759 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6760 /g']], [0], [dnl
6761 HEADER
6762 dgramSeqNo=1
6763 ds=127.0.0.1>2:1000
6764 fsSeqNo=1
6765 tunnel4_out_length=0
6766 tunnel4_out_protocol=47
6767 tunnel4_out_src=1.1.2.88
6768 tunnel4_out_dst=1.1.2.92
6769 tunnel4_out_src_port=0
6770 tunnel4_out_dst_port=0
6771 tunnel4_out_tcp_flags=0
6772 tunnel4_out_tos=0
6773 tunnel_out_vni=456
6774 in_vlan=0
6775 in_priority=0
6776 out_vlan=0
6777 out_priority=0
6778 meanSkip=1
6779 samplePool=1
6780 dropEvents=0
6781 in_ifindex=2011
6782 in_format=0
6783 out_ifindex=1
6784 out_format=2
6785 hdr_prot=1
6786 pkt_len=110
6787 stripped=4
6788 hdr_len=106
6789 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
6790 ])
6791
6792 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6793 AT_CLEANUP
6794
6795 AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
6796 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6797 OVS_VSWITCHD_START
6798 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6799 add_of_ports br0 1 2
6800 AT_DATA([flows.txt], [dnl
6801 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,set_mpls_label:789,set_mpls_tc:4,set_mpls_ttl:32,2
6802 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6803 ])
6804 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6805
6806 dnl set up sFlow logging
6807 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6808 AT_CAPTURE_FILE([sflow.log])
6809 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6810 ovs-appctl time/stop
6811
6812 dnl configure sflow
6813 ovs-vsctl \
6814 set Bridge br0 sflow=@sf -- \
6815 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
6816 header=128 sampling=1 polling=0
6817
6818 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1)'])
6819 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)'])
6820
6821 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6822 for i in `seq 1 30`; do
6823 ovs-appctl time/warp 100
6824 done
6825
6826 OVS_APP_EXIT_AND_WAIT([test-sflow])
6827
6828 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6829 /g']], [0], [dnl
6830 HEADER
6831 dgramSeqNo=1
6832 ds=127.0.0.1>2:1000
6833 fsSeqNo=1
6834 mpls_label_0=789
6835 mpls_tc_0=4
6836 mpls_ttl_0=32
6837 mpls_bos_0=0
6838 mpls_label_1=11
6839 mpls_tc_1=3
6840 mpls_ttl_1=64
6841 mpls_bos_1=1
6842 in_vlan=0
6843 in_priority=0
6844 out_vlan=0
6845 out_priority=0
6846 meanSkip=1
6847 samplePool=1
6848 dropEvents=0
6849 in_ifindex=0
6850 in_format=0
6851 out_ifindex=1
6852 out_format=2
6853 hdr_prot=1
6854 pkt_len=22
6855 stripped=4
6856 hdr_len=18
6857 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40
6858 HEADER
6859 dgramSeqNo=1
6860 ds=127.0.0.1>2:1000
6861 fsSeqNo=2
6862 mpls_label_0=789
6863 mpls_tc_0=4
6864 mpls_ttl_0=32
6865 mpls_bos_0=1
6866 in_vlan=0
6867 in_priority=0
6868 out_vlan=0
6869 out_priority=0
6870 meanSkip=1
6871 samplePool=2
6872 dropEvents=0
6873 in_ifindex=0
6874 in_format=0
6875 out_ifindex=1
6876 out_format=2
6877 hdr_prot=1
6878 pkt_len=38
6879 stripped=4
6880 hdr_len=34
6881 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
6882 ])
6883
6884 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6885 AT_CLEANUP
6886
6887
6888 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
6889 #
6890 # Test that basic NetFlow reports flow statistics correctly:
6891 # The initial packet of a flow are correctly accounted.
6892 # Later packets within a flow are correctly accounted.
6893 # Flow actions changing (in this case, due to MAC learning)
6894 # cause a record to be sent.
6895 m4_define([CHECK_NETFLOW_EXPIRATION],
6896 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6897 add_of_ports br0 1 2
6898
6899 ovs-appctl time/stop
6900 on_exit 'kill `cat test-netflow.pid`'
6901 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6902 AT_CAPTURE_FILE([netflow.log])
6903 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6904
6905 ovs-vsctl \
6906 set Bridge br0 netflow=@nf -- \
6907 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6908 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6909
6910 for delay in 1000 30000; do
6911 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)'
6912 sleep 1 # ensure the order in which these two packets are processed
6913 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)'
6914
6915 ovs-appctl time/warp $delay
6916 done
6917
6918 ovs-appctl time/warp 6000
6919 ovs-appctl revalidator/wait
6920 OVS_VSWITCHD_STOP
6921 OVS_APP_EXIT_AND_WAIT([test-netflow])
6922
6923 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])
6924
6925 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])
6926
6927 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 212 bytes, ICMP 0:0" netflow.log | wc -l`
6928 separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 106 bytes, ICMP 0:0" netflow.log | wc -l`
6929 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
6930
6931 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
6932 CHECK_NETFLOW_EXPIRATION([127.0.0.1])
6933 AT_CLEANUP
6934
6935 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
6936 AT_SKIP_IF([test $HAVE_IPV6 = no])
6937 CHECK_NETFLOW_EXPIRATION([[[::1]]])
6938 AT_CLEANUP
6939
6940 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
6941 #
6942 # Test that basic NetFlow reports active expirations correctly.
6943 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
6944 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6945 add_of_ports br0 1 2
6946
6947 on_exit 'kill `cat test-netflow.pid`'
6948 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6949 AT_CAPTURE_FILE([netflow.log])
6950 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6951
6952 ovs-vsctl \
6953 set Bridge br0 netflow=@nf -- \
6954 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6955 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
6956
6957 AT_CHECK([ovs-appctl time/stop])
6958 n=1
6959 while test $n -le 60; do
6960 n=`expr $n + 1`
6961
6962 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)'
6963 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)'
6964
6965 ovs-appctl time/warp 1000
6966 done
6967
6968 ovs-appctl time/warp 10000
6969
6970 ovs-appctl revalidator/wait
6971 OVS_VSWITCHD_STOP
6972 OVS_APP_EXIT_AND_WAIT([test-netflow])
6973
6974 # Count the number of reported packets:
6975 # - From source to destination before MAC learning kicks in (just one).
6976 # - From source to destination after that.
6977 # - From destination to source.
6978 n_learn=0
6979 n_in=0
6980 n_out=0
6981 n_other=0
6982 n_recs=0
6983 none=0
6984 while read line; do
6985 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
6986 case $pkts in
6987 [[0-9]]*) ;;
6988 *) continue ;;
6989 esac
6990
6991 case $line in
6992 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6993 counter=n_learn
6994 ;;
6995 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6996 counter=n_in
6997 ;;
6998 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
6999 counter=n_out
7000 ;;
7001 *)
7002 counter=n_other
7003 ;;
7004 esac
7005 eval $counter=\`expr \$$counter + \$pkts\`
7006 n_recs=`expr $n_recs + 1`
7007 done < netflow.log
7008
7009 # There should be exactly 1 MAC learning packet,
7010 # exactly 59 other packets in that direction,
7011 # and exactly 60 packets in the other direction.
7012 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
7013 ])])
7014
7015 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
7016 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
7017 AT_CLEANUP
7018
7019 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
7020 AT_SKIP_IF([test $HAVE_IPV6 = no])
7021 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
7022 AT_CLEANUP
7023
7024 dnl In the absence of an IPFIX collector to verify protocol correctness, simply
7025 dnl configure bridge IPFIX and ensure that sample action generation works at the
7026 dnl datapath level.
7027 AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
7028 OVS_VSWITCHD_START
7029 add_of_ports br0 1 2
7030
7031 dnl Sample every packet using bridge-based sampling.
7032 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7033 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7034 sampling=1], [0], [ignore])
7035
7036 dnl Send some packets that should be sampled.
7037 for i in `seq 1 3`; do
7038 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)'])
7039 done
7040 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7041 flow-dump from non-dpdk interfaces:
7042 packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))
7043 ])
7044
7045 AT_CHECK([ovs-appctl revalidator/purge])
7046 dnl
7047 dnl Add a slowpath meter. The userspace action should be metered.
7048 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])
7049
7050 dnl Send some packets that should be sampled and metered.
7051 for i in `seq 1 3`; do
7052 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)'])
7053 done
7054 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7055 flow-dump from non-dpdk interfaces:
7056 packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))
7057 ])
7058
7059 dnl Remove the IPFIX configuration.
7060 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7061 AT_CHECK([ovs-appctl revalidator/purge])
7062
7063 dnl Send some more packets, to ensure that these are not sampled.
7064 for i in `seq 1 3`; do
7065 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)'])
7066 done
7067 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7068 flow-dump from non-dpdk interfaces:
7069 packets:2, bytes:68, used:0.001s, actions:drop
7070 ])
7071
7072 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7073 AT_CLEANUP
7074
7075 dnl Bridge IPFIX statistics check
7076 AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
7077 OVS_VSWITCHD_START
7078 add_of_ports br0 1 2
7079
7080 dnl Negative test check.
7081 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7082 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7083 NXST_IPFIX_BRIDGE request (xid=0x2):
7084 ])
7085
7086 dnl Sample every packet using bridge-based sampling.
7087 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7088 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7089 sampling=1], [0], [ignore])
7090
7091 dnl Send some packets that should be sampled.
7092 for i in `seq 1 20`; do
7093 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)'])
7094 done
7095
7096 dnl There are 4 extra IPFIX template packets.
7097 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0 | sed 's/tx pkts=[[0-9]]*/tx pkts=24/' | sed 's/tx errs=[[0-9]]*/tx errs=0/'], [0], [dnl
7098 NXST_IPFIX_BRIDGE reply (xid=0x2):
7099 bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7100 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
7101 ])
7102
7103 dnl Remove the IPFIX configuration.
7104 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7105 AT_CHECK([ovs-appctl revalidator/purge])
7106
7107 dnl Send some more packets, to ensure that these are not sampled.
7108 for i in `seq 1 2`; 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)'])
7110 done
7111 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7112 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7113 NXST_IPFIX_BRIDGE request (xid=0x2):
7114 ])
7115
7116 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7117 AT_CLEANUP
7118
7119 dnl Flow IPFIX sanity check
7120 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
7121 OVS_VSWITCHD_START
7122 add_of_ports br0 1 2
7123
7124 # Check for regression against a bug where an invalid target caused an
7125 # assertion failure and a crash.
7126 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7127 -- --id=@ipfix create IPFIX targets=\"xyzzy\" \
7128 -- --id=@cs create Flow_Sample_Collector_Set id=0 bridge=@br0 ipfix=@ipfix],
7129 [0], [ignore])
7130
7131 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7132 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7133 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7134 [0], [ignore])
7135
7136 AT_DATA([flows.txt], [dnl
7137 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7138 ])
7139
7140 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7141
7142 dnl Send some packets that should be sampled.
7143 for i in `seq 1 3`; do
7144 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)'])
7145 done
7146 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7147 flow-dump from non-dpdk interfaces:
7148 packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=4294967295)),2
7149 ])
7150
7151 dnl Remove the flow which contains sample action.
7152 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7153 AT_CHECK([ovs-appctl revalidator/purge])
7154
7155 dnl Send some more packets, to ensure that these are not sampled.
7156 for i in `seq 1 3`; do
7157 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)'])
7158 done
7159 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7160 flow-dump from non-dpdk interfaces:
7161 packets:2, bytes:68, used:0.001s, actions:drop
7162 ])
7163
7164 OVS_VSWITCHD_STOP(["/sending to collector failed/d
7165 /xyzzy/d
7166 /no collectors/d"])
7167 AT_CLEANUP
7168
7169 dnl Flow IPFIX sanity check for tunnel set
7170 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
7171 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
7172 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
7173 options:key=5 ofport_request=1\
7174 -- add-port br0 p2 -- set Interface p2 type=stt \
7175 options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
7176 options:key=6 ofport_request=2\
7177 -- add-port br0 p3 -- set Interface p3 type=dummy \
7178 ofport_request=3 \
7179 -- --id=@br0 get Bridge br0 \
7180 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7181 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7182 [<0>
7183 <1>
7184 ])
7185
7186 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
7187
7188 dnl Add openflow sample action without sampling_port.
7189 AT_DATA([flows.txt], [dnl
7190 in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
7191 ])
7192 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7193
7194 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7195 AT_CHECK([tail -1 stdout], [0], [dnl
7196 Datapath actions: userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=4294967295)),set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),1
7197 ])
7198
7199 dnl Remove the flow which contains sample action.
7200 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7201 AT_CHECK([ovs-appctl revalidator/purge])
7202
7203 dnl Add openflow sample action with sampling_port which is
7204 dnl equal to output port.
7205 AT_DATA([flows2.txt], [dnl
7206 in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
7207 ])
7208 AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
7209
7210 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7211 dnl Make sure flow sample action in datapath is behind set tunnel
7212 dnl action at egress point of tunnel port.
7213 AT_CHECK([tail -1 stdout], [0], [dnl
7214 Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=1),tunnel_out_port=1),1
7215 ])
7216
7217 dnl Remove the flow which contains sample action.
7218 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7219 AT_CHECK([ovs-appctl revalidator/purge])
7220
7221 dnl Add a rule with two sample actions and each sample action
7222 dnl has a sampling_port
7223 AT_DATA([flows3.txt], [dnl
7224 in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1,sample(probability=65535,collector_set_id=1,sampling_port=2),output:2
7225 ])
7226 AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
7227
7228 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7229 dnl Make sure flow sample action in datapath is behind set tunnel
7230 dnl action at egress point of tunnel port.
7231 AT_CHECK([tail -1 stdout], [0], [dnl
7232 Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=1),tunnel_out_port=1),1,set(tunnel(tun_id=0x6,src=2.2.2.3,dst=1.1.1.2,tos=0x1,ttl=64,tp_dst=7471,flags(df|key))),userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=7471),tunnel_out_port=7471),7471
7233 ])
7234
7235 dnl Remove the flow which contains sample action.
7236 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7237 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7238
7239 OVS_VSWITCHD_STOP
7240 AT_CLEANUP
7241
7242 AT_SETUP([ofproto-dpif - clone action])
7243 OVS_VSWITCHD_START
7244 add_of_ports br0 1 2 3 4
7245
7246 dnl Reversible open flow clone actions, no datapath clone action should be generated.
7247 AT_DATA([flows.txt], [dnl
7248 in_port=1, ip, actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(mod_dl_src:80:81:81:81:81:81,set_field:192.168.5.5->ip_dst,output:3),output:4
7249 ])
7250 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7251
7252 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7253
7254 AT_CHECK([tail -1 stdout], [0], [dnl
7255 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
7256 ])
7257
7258 dnl Test flow xlate openflow clone action without using datapath clone action.
7259 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7260
7261 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7262
7263 AT_CHECK([tail -1 stdout], [0], [dnl
7264 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
7265 ])
7266
7267 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7268 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7269
7270 AT_CHECK([tail -1 stdout], [0], [dnl
7271 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
7272 ])
7273
7274 dnl Mixing reversible and irreversible open flow clone actions. Datapath clone action
7275 dnl should be generated when necessary.
7276
7277 dnl Restore the datapath support level.
7278 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone true], [0], [])
7279 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 10], [0], [])
7280
7281 AT_DATA([flows.txt], [dnl
7282 in_port=1, ip, actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(ct(commit),output:3),output:4
7283 ])
7284 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7285
7286 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7287
7288 AT_CHECK([tail -1 stdout], [0], [dnl
7289 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(ipv4(src=10.10.10.2,dst=10.10.10.1)),clone(ct(commit),3),4
7290 ])
7291
7292 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7293
7294 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7295
7296 AT_CHECK([tail -1 stdout], [0], [dnl
7297 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(ipv4(src=10.10.10.2,dst=10.10.10.1)),sample(sample=100.0%,actions(ct(commit),3)),4
7298 ])
7299
7300 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7301 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
7302
7303 AT_CHECK([tail -1 stdout], [0], [dnl
7304 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
7305 ])
7306 AT_CHECK([grep "Failed to compose clone action" stdout], [0], [ignore])
7307
7308 OVS_VSWITCHD_STOP
7309 AT_CLEANUP
7310
7311 dnl Flow based IPFIX statistics check
7312 AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
7313 OVS_VSWITCHD_START
7314 add_of_ports br0 1 2
7315
7316 dnl Negative test check.
7317 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7318 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7319 NXST_IPFIX_FLOW request (xid=0x2):
7320 ])
7321
7322 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7323 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7324 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7325 [0], [ignore])
7326
7327 AT_DATA([flows.txt], [dnl
7328 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7329 ])
7330
7331 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7332
7333 dnl Send some packets that should be sampled.
7334 for i in `seq 1 20`; do
7335 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)'])
7336 done
7337
7338 dnl There are 4 extra IPFIX template packets.
7339 AT_CHECK([ovs-ofctl dump-ipfix-flow br0 | sed 's/tx pkts=[[0-9]]*/tx pkts=24/' | sed 's/tx errs=[[0-9]]*/tx errs=0/'], [0], [dnl
7340 NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
7341 id 1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7342 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
7343 ])
7344
7345 dnl Remove the flow which contains sample action.
7346 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7347 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7348 AT_CHECK([ovs-appctl revalidator/purge])
7349
7350 dnl Send some more packets, to ensure that these are not sampled.
7351 for i in `seq 1 3`; do
7352 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)'])
7353 done
7354 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7355 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7356 NXST_IPFIX_FLOW request (xid=0x2):
7357 ])
7358
7359 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7360 AT_CLEANUP
7361
7362 AT_SETUP([ofproto-dpif - flow stats])
7363 OVS_VSWITCHD_START
7364 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7365 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7366
7367 ovs-appctl time/stop
7368
7369 for i in `seq 1 10`; do
7370 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)'
7371 done
7372
7373 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7374 AT_CHECK([ovs-appctl revalidator/purge], [0])
7375 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7376 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
7377 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
7378 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
7379 ])
7380 OVS_VSWITCHD_STOP
7381 AT_CLEANUP
7382
7383 AT_SETUP([ofproto-dpif - flow stats reset_counts])
7384 OVS_VSWITCHD_START
7385 flow="ip,actions=NORMAL"
7386
7387 ovs-appctl time/stop
7388
7389 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7390
7391 warp_and_dump_NXM () {
7392 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7393 AT_CHECK([ovs-appctl revalidator/purge], [0])
7394
7395 AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0], [0], [stdout])
7396 if [[ $5 -gt 0 ]]; then
7397 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, hard_age=$5, ip actions=NORMAL"
7398 else
7399 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, ip actions=NORMAL"
7400 fi
7401 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7402 $expected
7403 ])
7404 }
7405
7406 warp_and_dump_OF () {
7407 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7408 AT_CHECK([ovs-appctl revalidator/purge], [0])
7409
7410 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0], [0], [stdout])
7411 if [[ $1 -lt 13 -o "$5X" = "X" ]]; then
7412 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, ip actions=NORMAL"
7413 else
7414 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $5 ip actions=NORMAL"
7415 fi
7416 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7417 $expected
7418 ])
7419 }
7420
7421 send_packet () {
7422 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)'
7423 }
7424
7425 # OpenFlow 1.0, implicit reset_counts
7426 send_packet
7427 warp_and_dump_NXM 1 1 118 1
7428 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 add-flow br0 $flow])
7429 # add-flow resets duration and counts,
7430 # but idle age is inherited from the old flow
7431 warp_and_dump_NXM 1 0 0 2
7432
7433 send_packet
7434 warp_and_dump_NXM 2 1 118 1
7435 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 mod-flows br0 $flow])
7436 # mod-flows resets hard_age, but not counts
7437 # but duration and idle_age is inherited from the old flow
7438 warp_and_dump_NXM 3 1 118 2 1
7439
7440 # OpenFlow 1.1, implicit reset_counts
7441 send_packet
7442 warp_and_dump_OF 11 4 2 236
7443 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 add-flow br0 $flow])
7444 # add-flow resets duration and counts,
7445 # but idle age is inherited from the old flow
7446 warp_and_dump_NXM 1 0 0 2
7447 warp_and_dump_OF 11 2 0 0
7448
7449 send_packet
7450 warp_and_dump_OF 11 3 1 118
7451 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 mod-flows br0 $flow])
7452 # mod-flows resets hard_age, but not counts
7453 # but duration and idle_age is inherited from the old flow
7454 warp_and_dump_NXM 4 1 118 2 1
7455 warp_and_dump_OF 11 5 1 118
7456
7457 # OpenFlow 1.2, explicit reset_counts
7458 send_packet
7459 warp_and_dump_OF 12 6 2 236
7460 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 $flow])
7461 # add-flow without flags resets duration, but not counts,
7462 # idle age is inherited from the old flow
7463 warp_and_dump_NXM 1 2 236 2
7464 warp_and_dump_OF 12 2 2 236
7465
7466 send_packet
7467 warp_and_dump_OF 12 3 3 354
7468 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 $flow])
7469 # mod-flows without flags does not reset duration nor counts,
7470 # idle age is inherited from the old flow
7471 warp_and_dump_NXM 4 3 354 2 1
7472 warp_and_dump_OF 12 5 3 354
7473
7474 send_packet
7475 warp_and_dump_OF 12 6 4 472
7476 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 reset_counts,$flow])
7477 # add-flow with reset_counts resets both duration and counts,
7478 # idle age is inherited from the old flow
7479 warp_and_dump_NXM 1 0 0 2
7480 warp_and_dump_OF 12 2 0 0
7481
7482 send_packet
7483 warp_and_dump_OF 12 3 1 118
7484 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 reset_counts,$flow])
7485 # mod-flows with reset_counts resets counts, but not duration,
7486 # idle age is inherited from the old flow
7487 warp_and_dump_NXM 4 0 0 2 1
7488 warp_and_dump_OF 12 5 0 0
7489
7490 # OpenFlow > 1.3, explicit reset_counts
7491 flow_mods_reset_counts () {
7492 # Reset to a known state
7493 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7494
7495 send_packet
7496 warp_and_dump_OF $1 1 1 118 reset_counts
7497 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7498 # add-flow without flags resets duration, but not counts,
7499 # idle age is inherited from the old flow
7500 warp_and_dump_NXM 1 1 118 2
7501 warp_and_dump_OF $1 2 1 118
7502
7503 send_packet
7504 warp_and_dump_OF $1 3 2 236
7505 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7506 # mod-flows without flags does not reset duration nor counts,
7507 # idle age is inherited from the old flow
7508 warp_and_dump_NXM 4 2 236 2 1
7509 warp_and_dump_OF $1 5 2 236
7510
7511 send_packet
7512 warp_and_dump_OF $1 6 3 354
7513 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7514 # add-flow with reset_counts resets both duration and counts,
7515 # idle age is inherited from the old flow
7516 warp_and_dump_NXM 1 0 0 2
7517 warp_and_dump_OF $1 2 0 0 reset_counts
7518
7519 send_packet
7520 warp_and_dump_OF $1 3 1 118 reset_counts
7521 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7522 # mod-flows with reset_counts resets counts, but not duration,
7523 # idle age is inherited from the old flow
7524 warp_and_dump_NXM 4 0 0 2 1
7525 warp_and_dump_OF $1 5 0 0 reset_counts
7526
7527 # Modify flow having reset_counts flag without reset_counts
7528 send_packet
7529 warp_and_dump_OF $1 6 1 118 reset_counts
7530 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7531 warp_and_dump_NXM 7 1 118 2 1
7532 warp_and_dump_OF $1 8 1 118 reset_counts
7533
7534 # Add flow having reset_counts flag without reset_counts
7535 send_packet
7536 warp_and_dump_OF $1 9 2 236 reset_counts
7537 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7538 warp_and_dump_NXM 1 2 236 2
7539 warp_and_dump_OF $1 2 2 236
7540
7541 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7542 send_packet
7543 warp_and_dump_OF $1 3 3 354
7544 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7545 warp_and_dump_NXM 4 0 0 2 1
7546 warp_and_dump_OF $1 5 0 0
7547 }
7548
7549 # OpenFlow versions >= 1.3 should behave the same way
7550 flow_mods_reset_counts 13
7551 flow_mods_reset_counts 14
7552
7553 OVS_VSWITCHD_STOP
7554 AT_CLEANUP
7555
7556 AT_SETUP([ofproto-dpif - flow stats reset_counts OpenFlow1.5])
7557 OVS_VSWITCHD_START
7558 flow="ip,actions=NORMAL"
7559
7560 ovs-appctl time/stop
7561
7562 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7563
7564 warp_and_dump_OF () {
7565 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7566 AT_CHECK([ovs-appctl revalidator/purge], [0])
7567
7568 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0 ], [0], [stdout])
7569 if [[ "$6X" = "X" ]]; then
7570 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, idle_age=$5, ip actions=NORMAL"
7571 else
7572 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $6 idle_age=$5, ip actions=NORMAL"
7573 fi
7574 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7575 $expected
7576 ])
7577 }
7578
7579 send_packet () {
7580 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)'
7581 }
7582
7583 # OpenFlow 1.5, explicit reset_counts
7584 flow_mods_reset_counts () {
7585 # Reset to a known state
7586 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7587
7588 send_packet
7589 warp_and_dump_OF $1 1 1 118 1 reset_counts
7590 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7591 # add-flow without flags resets duration, but not counts,
7592 # idle age is inherited from the old flow
7593 warp_and_dump_OF $1 1 1 118 2
7594
7595 send_packet
7596 warp_and_dump_OF $1 2 2 236 1
7597 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7598 # mod-flows without flags does not reset duration nor counts,
7599 # idle age is inherited from the old flow
7600 warp_and_dump_OF $1 3 2 236 2
7601
7602 send_packet
7603 warp_and_dump_OF $1 4 3 354 1
7604 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7605 # add-flow with reset_counts resets both duration and counts,
7606 # idle age is inherited from the old flow
7607 warp_and_dump_OF $1 1 0 0 2 reset_counts
7608
7609 send_packet
7610 warp_and_dump_OF $1 2 1 118 1 reset_counts
7611 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7612 # mod-flows with reset_counts resets counts, but not duration,
7613 # idle age is inherited from the old flow
7614 warp_and_dump_OF $1 3 0 0 2 reset_counts
7615
7616 # Modify flow having reset_counts flag without reset_counts
7617 send_packet
7618 warp_and_dump_OF $1 4 1 118 1 reset_counts
7619 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7620 warp_and_dump_OF $1 5 1 118 2 reset_counts
7621
7622 # Add flow having reset_counts flag without reset_counts
7623 send_packet
7624 warp_and_dump_OF $1 6 2 236 1 reset_counts
7625 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7626 warp_and_dump_OF $1 1 2 236 2
7627
7628 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7629 send_packet
7630 warp_and_dump_OF $1 2 3 354 1
7631 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7632 warp_and_dump_OF $1 3 0 0 2
7633 }
7634
7635 # OpenFlow versions >= 1.3 should behave the same way
7636 flow_mods_reset_counts 15
7637
7638 OVS_VSWITCHD_STOP
7639 AT_CLEANUP
7640
7641
7642 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
7643 OVS_VSWITCHD_START
7644 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7645 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7646
7647 ovs-appctl time/stop
7648
7649 for i in `seq 1 10`; do
7650 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)'
7651 done
7652
7653 ovs-appctl time/warp 100
7654 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
7655 ovs-appctl time/warp 1000
7656
7657 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7658 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
7659 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
7660 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
7661 ])
7662 OVS_VSWITCHD_STOP
7663 AT_CLEANUP
7664
7665 AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
7666 OVS_VSWITCHD_START
7667
7668 # get_ages DURATION HARD IDLE
7669 #
7670 # Fetch the flow duration, hard age, and idle age into the variables
7671 # whose names are given as arguments. Rounds DURATION down to the
7672 # nearest integer. If hard_age doesn't appear in the output, sets
7673 # HARD to "none". If idle_age doesn't appear in the output, sets IDLE
7674 # to 0.
7675 get_ages () {
7676 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7677
7678 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
7679 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
7680 AS_VAR_COPY([$1], [duration])
7681
7682 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
7683 if test X"$hard" = X; then
7684 hard=none
7685 else
7686 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
7687 fi
7688 AS_VAR_COPY([$2], [hard])
7689
7690 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
7691 if test X"$idle" = X; then
7692 idle=0
7693 else
7694 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
7695 fi
7696 AS_VAR_COPY([$3], [idle])
7697 }
7698
7699 # Add a flow and get its initial hard and idle age.
7700 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
7701 get_ages duration1 hard1 idle1
7702
7703 ovs-appctl time/stop
7704 # Warp time forward by 10 seconds, then modify the flow's actions.
7705 ovs-appctl time/warp 10000
7706 get_ages duration2 hard2 idle2
7707 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
7708
7709 # Warp time forward by 10 seconds.
7710 ovs-appctl time/warp 10000
7711 get_ages duration3 hard3 idle3
7712
7713 # Warp time forward 10 more seconds, then pass some packets through the flow,
7714 # then warp forward a few more times because idle times are only updated
7715 # occasionally.
7716 ovs-appctl time/warp 10000
7717 ovs-appctl netdev-dummy/receive br0 'in_port(0),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=1234)'
7718 ovs-appctl time/warp 3000 1000
7719 sleep 1
7720 get_ages duration4 hard4 idle4
7721
7722 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
7723 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
7724 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
7725
7726 # Duration should increase steadily over time.
7727 AT_CHECK([test $duration1 -lt $duration2])
7728 AT_CHECK([test $duration2 -lt $duration3])
7729 AT_CHECK([test $duration3 -lt $duration4])
7730
7731 # Hard age should be "none" initially because it's the same as flow_duration,
7732 # then it should increase.
7733 AT_CHECK([test $hard1 = none])
7734 AT_CHECK([test $hard2 = none])
7735 AT_CHECK([test $hard3 != none])
7736 AT_CHECK([test $hard4 != none])
7737 AT_CHECK([test $hard3 -lt $hard4])
7738
7739 # Idle age should increase from 1 to 2 to 3, then decrease.
7740 AT_CHECK([test $idle1 -lt $idle2])
7741 AT_CHECK([test $idle2 -lt $idle3])
7742 AT_CHECK([test $idle3 -gt $idle4])
7743
7744 # Check some invariant relationships.
7745 AT_CHECK([test $duration1 = $idle1])
7746 AT_CHECK([test $duration2 = $idle2])
7747 AT_CHECK([test $duration3 = $idle3])
7748 AT_CHECK([test $idle3 -gt $hard3])
7749 AT_CHECK([test $idle4 -lt $hard4])
7750 AT_CHECK([test $hard4 -lt $duration4])
7751
7752 OVS_VSWITCHD_STOP
7753 AT_CLEANUP
7754
7755 AT_SETUP([ofproto-dpif - fin_timeout])
7756 OVS_VSWITCHD_START
7757 ovs-appctl time/stop
7758 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
7759 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7760 [NXST_FLOW reply:
7761 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7762 ])
7763
7764 # Check that a TCP SYN packet does not change the timeout. (Because
7765 # flow stats updates are mainly what implements the fin_timeout
7766 # feature, we warp forward a couple of times to ensure that flow stats
7767 # run before re-checking the flow table.)
7768 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
7769 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7770 warped
7771 ])
7772 AT_CHECK([ovs-appctl revalidator/purge], [0])
7773 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7774 [NXST_FLOW reply:
7775 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7776 ])
7777 # Check that a TCP FIN packet does change the timeout.
7778 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
7779 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7780 warped
7781 ])
7782 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7783 [NXST_FLOW reply:
7784 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
7785 ])
7786 OVS_VSWITCHD_STOP
7787 AT_CLEANUP
7788
7789 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
7790 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
7791 add_of_ports br0 1 2
7792 add_of_ports br1 3
7793
7794 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
7795 dummy@br0
7796 dummy@br1
7797 ])
7798 OVS_VSWITCHD_STOP
7799 AT_CLEANUP
7800
7801 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
7802 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
7803 [--dummy-numa="0,0,0,0,1,1,1,1"])
7804 add_pmd_of_ports br0 1 2
7805 add_of_ports br1 3
7806
7807 AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
7808 dummy@ovs-dummy: hit:0 missed:0
7809 br0:
7810 br0 65534/100: (dummy-internal)
7811 p1 1/1: (dummy-pmd: <cleared>)
7812 p2 2/2: (dummy-pmd: <cleared>)
7813 br1:
7814 br1 65534/101: (dummy-internal)
7815 p3 3/3: (dummy)
7816 ])
7817 OVS_VSWITCHD_STOP
7818 AT_CLEANUP
7819
7820 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
7821 # bump max-idle to avoid the flows being reclaimed behind us
7822 OVS_VSWITCHD_START([add-br br1 -- \
7823 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7824 set Open_vSwitch . other_config:max-idle=10000], [], [],
7825 [--dummy-numa="0,0,0,0,1,1,1,1"])
7826 add_of_ports br0 1
7827 add_pmd_of_ports br0 2
7828 add_of_ports br1 3
7829
7830 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)'])
7831 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)'])
7832 AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
7833 ovs-appctl revalidator/wait
7834 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7835 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7836 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7837 ])
7838
7839 AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
7840 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7841 ])
7842
7843 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
7844 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
7845 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p2),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=0/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
7846 ])
7847
7848 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
7849 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
7850 ])
7851
7852 OVS_VSWITCHD_STOP
7853 AT_CLEANUP
7854
7855 m4_define([OFPROTO_DPIF_GET_FLOW],
7856 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
7857
7858 OVS_VSWITCHD_START([add-br br1 -- \
7859 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7860 set Open_vSwitch . other_config:max-idle=10000], [], [],
7861 [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7862
7863 func=`printf '%s_' "$1" | cut -c 4-`
7864 add_${func}of_ports br0 1 2
7865
7866 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)'])
7867 ovs-appctl revalidator/wait
7868 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
7869
7870 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
7871 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
7872 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7873 ])
7874
7875 OVS_VSWITCHD_STOP
7876 AT_CLEANUP])
7877
7878 OFPROTO_DPIF_GET_FLOW([])
7879 OFPROTO_DPIF_GET_FLOW([ - pmd])
7880
7881 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
7882 OVS_VSWITCHD_START([dnl
7883 add-port br0 p1 -- set Interface p1 type=dummy
7884 ])
7885 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7886 on_exit 'kill `cat ovs-ofctl.pid`'
7887
7888 AT_CAPTURE_FILE([ofctl_monitor.log])
7889 AT_DATA([flows.txt], [dnl
7890 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
7891 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
7892 ])
7893 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7894
7895 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
7896 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
7897 dnl
7898 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
7899 dnl 60:66:66:66:66:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 74: MPLS (label 20, exp 0, ttl 32)
7900 dnl (label 20, exp 0, [S], ttl 32)
7901 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7902 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7903
7904 for dl_src in 00 01; do
7905 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"])
7906 done
7907 sleep 1 # wait for the datapath flow installed
7908 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7909 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:00),eth_type(0x8847),mpls(label=20,tc=0,ttl=32,bos=0,label=20,tc=0,ttl=32,bos=1), actions:push_mpls(label=20,tc=0,ttl=32,bos=0,eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
7910 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:01),eth_type(0x8847),mpls(label=20/0x0,tc=0/0,ttl=32/0x0,bos=0/1,label=20/0xfffff,tc=0/7,ttl=32/0xff,bos=1/1), actions:pop_mpls(eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
7911 ])
7912
7913 OVS_VSWITCHD_STOP
7914 AT_CLEANUP
7915
7916
7917 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
7918 OVS_VSWITCHD_START([dnl
7919 add-port br0 p1 -- set Interface p1 type=dummy
7920 ])
7921 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7922 on_exit 'kill `cat ovs-ofctl.pid`'
7923
7924 AT_CAPTURE_FILE([ofctl_monitor.log])
7925 AT_DATA([flows.txt], [dnl
7926 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
7927 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
7928 ])
7929 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7930
7931 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
7932 dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
7933 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
7934 dnl
7935 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
7936 dnl 60:66:66:66:66:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 74: MPLS (label 20, exp 0, ttl 32)
7937 dnl (label 20, exp 0, ttl 32)
7938 dnl (label 20, exp 0, ttl 32)
7939 dnl (label 20, exp 0, [S], ttl 32)
7940 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7941 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7942
7943 for dl_src in 00 01; do
7944 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"])
7945 done
7946 sleep 1 # wait for the datapath flow installed
7947 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7948 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:00),eth_type(0x8847),mpls(label=20,tc=0,ttl=32,bos=0,label=20,tc=0,ttl=32,bos=1), actions:push_mpls(label=20,tc=0,ttl=32,bos=0,eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
7949 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:01),eth_type(0x8847),mpls(label=20/0x0,tc=0/0,ttl=32/0x0,bos=0/1,label=20/0xfffff,tc=0/7,ttl=32/0xff,bos=1/1), actions:pop_mpls(eth_type=0x8847),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
7950 ])
7951
7952 OVS_VSWITCHD_STOP
7953 AT_CLEANUP
7954
7955 AT_SETUP([ofproto-dpif - patch ports])
7956 OVS_VSWITCHD_START([add-br br1 \
7957 -- set bridge br1 datapath-type=dummy fail-mode=secure \
7958 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
7959 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
7960
7961 add_of_ports br0 2
7962 add_of_ports br1 3
7963
7964 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7965 ], [])
7966 AT_CHECK([ovs-appctl time/stop])
7967 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7968
7969 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
7970 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
7971
7972 for i in $(seq 1 10); do
7973 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)'
7974 if [[ $i -eq 1 ]]; then
7975 sleep 1
7976 fi
7977 done
7978
7979 for i in $(seq 1 5); do
7980 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)'
7981 if [[ $i -eq 1 ]]; then
7982 sleep 1
7983 fi
7984 done
7985
7986 AT_CHECK([ovs-appctl time/warp 500], [0],
7987 [warped
7988 ])
7989 sleep 1 # wait for log writer
7990
7991 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
7992 dummy@ovs-dummy: hit:13 missed:2
7993 br0:
7994 br0 65534/100: (dummy-internal)
7995 p2 2/2: (dummy)
7996 pbr0 1/none: (patch: peer=pbr1)
7997 br1:
7998 br1 65534/101: (dummy-internal)
7999 p3 3/3: (dummy)
8000 pbr1 1/none: (patch: peer=pbr0)
8001 ])
8002
8003 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8004 recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
8005 recirc_id(0),in_port(101),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
8006 ])
8007
8008 AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
8009 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(100),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:9, bytes:954, used:0.0s, actions:101,3,2
8010 ])
8011 AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
8012 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(101),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:4, bytes:424, used:0.0s, actions:100,2,3
8013 ])
8014
8015 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
8016 OFPST_PORT reply (xid=0x4): 1 ports
8017 port 1: rx pkts=5, bytes=530, drop=?, errs=?, frame=?, over=?, crc=?
8018 tx pkts=10, bytes=1060, drop=?, errs=?, coll=?
8019 ])
8020
8021 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
8022 OFPST_PORT reply (xid=0x4): 1 ports
8023 port 1: rx pkts=10, bytes=1060, drop=?, errs=?, frame=?, over=?, crc=?
8024 tx pkts=5, bytes=530, drop=?, errs=?, coll=?
8025 ])
8026
8027 OVS_VSWITCHD_STOP
8028 AT_CLEANUP
8029
8030 AT_SETUP([ofproto-dpif - patch ports - stack])
8031 OVS_VSWITCHD_START([add-br br1 \
8032 -- set bridge br1 datapath-type=dummy fail-mode=secure \
8033 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
8034 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
8035
8036 add_of_ports br0 2
8037 add_of_ports br1 3
8038
8039 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8040 ], [])
8041 AT_CHECK([ovs-appctl time/stop])
8042 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8043
8044 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=push:OXM_OF_IN_PORT[[0..31]],output:1,pop:OXM_OF_IPV4_SRC[[0..31]],output:2"])
8045 # Try to pop from empty stack, and push and leave data to stack.
8046 AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
8047
8048 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)'
8049
8050 AT_CHECK([ovs-appctl time/warp 500], [0],
8051 [warped
8052 ])
8053
8054 OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
8055
8056 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
8057 dummy@ovs-dummy: hit:0 missed:1
8058 br0:
8059 br0 65534/100: (dummy-internal)
8060 p2 2/2: (dummy)
8061 pbr0 1/none: (patch: peer=pbr1)
8062 br1:
8063 br1 65534/101: (dummy-internal)
8064 p3 3/3: (dummy)
8065 pbr1 1/none: (patch: peer=pbr0)
8066 ])
8067
8068 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8069 recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:101,set(ipv4(src=255.255.255.254)),2
8070 ])
8071
8072 AT_CHECK([grep -e '|ofproto_dpif_xlate|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
8073 stack underflow on bridge br1 while processing icmp,in_port=LOCAL,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0
8074 ])
8075
8076 OVS_VSWITCHD_STOP(["/stack underflow/d"])
8077 AT_CLEANUP
8078
8079 AT_SETUP([ofproto-dpif - port duration])
8080 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
8081 add_of_ports br0 1 2
8082
8083 ovs-appctl time/stop
8084 ovs-appctl time/warp 10000
8085
8086 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
8087 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
8088 [dnl
8089 duration=?s
8090 duration=?s
8091 duration=?s
8092 ])
8093 OVS_VSWITCHD_STOP
8094 AT_CLEANUP
8095
8096 dnl ----------------------------------------------------------------------
8097 AT_BANNER([ofproto-dpif -- megaflows])
8098
8099 AT_SETUP([ofproto-dpif megaflow - port classification])
8100 OVS_VSWITCHD_START
8101 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8102 add_of_ports br0 1 2
8103 AT_DATA([flows.txt], [dnl
8104 table=0 in_port=1 actions=output(2)
8105 ])
8106 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8107 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)'])
8108 sleep 1
8109 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)'])
8110 sleep 1
8111 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8112 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8113 ])
8114 OVS_VSWITCHD_STOP
8115 AT_CLEANUP
8116
8117 AT_SETUP([ofproto-dpif megaflow - L2 classification])
8118 OVS_VSWITCHD_START
8119 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8120 add_of_ports br0 1 2
8121 AT_DATA([flows.txt], [dnl
8122 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
8123 ])
8124 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8125 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)'])
8126 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)'])
8127 sleep 1
8128 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8129 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8130 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
8131 ])
8132 OVS_VSWITCHD_STOP
8133 AT_CLEANUP
8134
8135 AT_SETUP([ofproto-dpif megaflow - L3 classification])
8136 OVS_VSWITCHD_START
8137 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8138 add_of_ports br0 1 2
8139 AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=nw_dst,nw_src], [0], [ignore], [])
8140 AT_DATA([flows.txt], [dnl
8141 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
8142 ])
8143 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8144 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)'])
8145 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)'])
8146 sleep 1
8147 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8148 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
8149 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,frag=no), actions: <del>
8150 ])
8151 OVS_VSWITCHD_STOP
8152 AT_CLEANUP
8153
8154 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
8155 OVS_VSWITCHD_START
8156 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8157 add_of_ports br0 1 2
8158 AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=ipv6_dst,ipv6_src], [0], [ignore], [])
8159 AT_DATA([flows.txt], [dnl
8160 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
8161 ])
8162 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8163 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5,dst=fe80::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)'])
8164 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:5:4:3:2:1,dst=2001:db8:3c4d:1:2:3:4:1,label=0,proto=99,tclass=0x70,hlimit=64,frag=no)'])
8165 sleep 1
8166 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8167 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5,frag=no), actions: <del>
8168 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:5:4:3:2:1/ffff:ffff:ffff:fffc::,frag=no), actions: <del>
8169 ])
8170 OVS_VSWITCHD_STOP
8171 AT_CLEANUP
8172
8173 AT_SETUP([ofproto-dpif megaflow - L4 classification])
8174 OVS_VSWITCHD_START
8175 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8176 add_of_ports br0 1 2
8177 AT_DATA([flows.txt], [dnl
8178 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
8179 ])
8180 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8181 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)'])
8182 sleep 1
8183 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)'])
8184 sleep 1
8185 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8186 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=1,frag=no),icmp(type=8), actions: <del>
8187 ])
8188 OVS_VSWITCHD_STOP
8189 AT_CLEANUP
8190
8191 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
8192 [AT_SETUP([ofproto-dpif megaflow - normal$1])
8193 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8194 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8195 func=`printf '%s_' "$1" | cut -c 4-`
8196 add_${func}of_ports br0 1 2
8197 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8198 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)'])
8199 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)'])
8200 sleep 1
8201 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8202 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8203 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
8204 ])
8205 OVS_VSWITCHD_STOP
8206 AT_CLEANUP])
8207
8208 OFPROTO_DPIF_MEGAFLOW_NORMAL([])
8209 OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
8210
8211 AT_SETUP([ofproto-dpif megaflow - mpls])
8212 OVS_VSWITCHD_START
8213 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8214 add_of_ports br0 1 2
8215 AT_DATA([flows.txt], [dnl
8216 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
8217 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
8218 ])
8219 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8220 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1)'])
8221 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0a),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1)'])
8222 sleep 1
8223 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
8224 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1), actions:push_mpls(label=11,tc=3,ttl=64,bos=0,eth_type=0x8847),2
8225 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x8847),mpls(label=11/0x0,tc=3/0,ttl=64/0x0,bos=1/1), actions:pop_mpls(eth_type=0x800),2
8226 ])
8227 OVS_VSWITCHD_STOP
8228 AT_CLEANUP
8229
8230 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
8231 m4_define([CHECK_MEGAFLOW_NETFLOW],
8232 [OVS_VSWITCHD_START
8233 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8234 add_of_ports br0 1 2
8235
8236 dnl NetFlow configuration disables wildcarding relevant fields
8237 on_exit 'kill `cat test-netflow.pid`'
8238 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
8239 AT_CAPTURE_FILE([netflow.log])
8240 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
8241 ovs-vsctl \
8242 set Bridge br0 netflow=@nf -- \
8243 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
8244 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
8245
8246 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8247 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)'])
8248 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)'])
8249 sleep 1
8250 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8251 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
8252 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
8253 ])
8254 OVS_APP_EXIT_AND_WAIT([test-netflow])
8255 OVS_VSWITCHD_STOP])
8256
8257 AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
8258 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
8259 AT_CLEANUP
8260
8261 AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
8262 AT_SKIP_IF([test $HAVE_IPV6 = no])
8263 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
8264 AT_CLEANUP
8265
8266 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
8267 [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
8268 OVS_VSWITCHD_START(
8269 [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
8270 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
8271 set interface p2 type=$1 ofport_request=2 -- \
8272 set interface p3 type=$1 ofport_request=3], [], [],
8273 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
8274 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8275 ])
8276 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8277
8278 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8279 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)'])
8280 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)'])
8281 sleep 1
8282 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8283 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8284 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
8285 ])
8286 OVS_VSWITCHD_STOP
8287 AT_CLEANUP])
8288
8289 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
8290 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
8291
8292 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
8293 OVS_VSWITCHD_START(
8294 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
8295 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
8296 set interface p2 type=dummy ofport_request=2 -- \
8297 set interface p3 type=dummy ofport_request=3])
8298 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8299 ])
8300 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8301
8302 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8303 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)'])
8304 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)'])
8305 sleep 1
8306 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8307 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8308 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
8309 ])
8310 OVS_VSWITCHD_STOP
8311 AT_CLEANUP
8312
8313 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
8314 # Create bond0 on br0 with interfaces p0 and p1
8315 # and bond1 on br1 with interfaces p2 and p3
8316 # with p0 patched to p2 and p1 patched to p3.
8317 OVS_VSWITCHD_START(
8318 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
8319 other-config:lacp-time=fast \
8320 other-config:bond-rebalance-interval=0 -- \
8321 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
8322 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
8323 add-br br1 -- \
8324 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
8325 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
8326 fail-mode=secure -- \
8327 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
8328 other-config:lacp-time=fast \
8329 other-config:bond-rebalance-interval=0 -- \
8330 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
8331 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
8332
8333 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8334 ])
8335 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8336 add_of_ports br0 7
8337 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8338 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
8339 ovs-appctl time/stop
8340 ovs-appctl time/warp 5000
8341 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8342 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8343 sleep 1
8344 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8345 recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
8346 recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
8347 ])
8348 OVS_VSWITCHD_STOP
8349 AT_CLEANUP
8350
8351 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
8352 OVS_VSWITCHD_START
8353 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8354 add_of_ports br0 1 2
8355 AT_DATA([flows.txt], [dnl
8356 table=0 in_port=1,ip actions=resubmit(90)
8357 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
8358 ])
8359 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8360 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)'])
8361 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)'])
8362 sleep 1
8363 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8364 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8365 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
8366 ])
8367 OVS_VSWITCHD_STOP
8368 AT_CLEANUP
8369
8370 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
8371 OVS_VSWITCHD_START
8372 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8373 add_of_ports br0 1 2
8374 AT_DATA([flows.txt], [dnl
8375 table=0 in_port=1,ip actions=resubmit(,1)
8376 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8377 ])
8378 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8379 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)'])
8380 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=
8381 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8382 sleep 1
8383 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8384 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8385 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
8386 ])
8387 OVS_VSWITCHD_STOP
8388 AT_CLEANUP
8389
8390 AT_SETUP([ofproto-dpif megaflow - goto_table action])
8391 OVS_VSWITCHD_START
8392 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8393 add_of_ports br0 1 2
8394 AT_DATA([flows.txt], [dnl
8395 table=0 in_port=1,ip actions=goto_table(1)
8396 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8397 ])
8398 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
8399 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)'])
8400 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)'])
8401 sleep 1
8402 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8403 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8404 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
8405 ])
8406 OVS_VSWITCHD_STOP
8407 AT_CLEANUP
8408
8409 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
8410 AT_KEYWORDS([mirror mirrors mirroring])
8411 OVS_VSWITCHD_START
8412 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8413 add_of_ports br0 1 2 3
8414 ovs-vsctl \
8415 set Bridge br0 mirrors=@m --\
8416 --id=@p3 get Port p3 --\
8417 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
8418
8419 AT_DATA([flows.txt], [dnl
8420 in_port=1 actions=output:2
8421 ])
8422 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8423 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)'])
8424 sleep 1
8425 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)'])
8426 sleep 1
8427 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8428 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8429 ])
8430 OVS_VSWITCHD_STOP
8431 AT_CLEANUP
8432
8433 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
8434 OVS_VSWITCHD_START
8435 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8436 add_of_ports br0 1 2 3
8437 ovs-vsctl \
8438 set Bridge br0 mirrors=@m --\
8439 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
8440 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
8441
8442 AT_DATA([flows.txt], [dnl
8443 in_port=1 actions=output:2
8444 ])
8445 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8446 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8100),vlan(vid=11,pcp=7),encap(eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0))'])
8447 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)'])
8448 sleep 1
8449 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8450 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8451 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=11,pcp=7/0x0),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
8452 ])
8453 OVS_VSWITCHD_STOP
8454 AT_CLEANUP
8455
8456 AT_SETUP([ofproto-dpif megaflow - move action])
8457 OVS_VSWITCHD_START
8458 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8459 add_of_ports br0 1 2
8460 AT_DATA([flows.txt], [dnl
8461 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
8462 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
8463 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
8464 ])
8465 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8466 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)'])
8467 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)'])
8468 sleep 1
8469 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8470 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
8471 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
8472 ])
8473 OVS_VSWITCHD_STOP
8474 AT_CLEANUP
8475
8476 AT_SETUP([ofproto-dpif megaflow - push action])
8477 OVS_VSWITCHD_START
8478 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8479 add_of_ports br0 1 2
8480 AT_DATA([flows.txt], [dnl
8481 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
8482 ])
8483 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8484 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)'])
8485 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)'])
8486 sleep 1
8487 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8488 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
8489 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
8490 ])
8491 OVS_VSWITCHD_STOP
8492 AT_CLEANUP
8493
8494 AT_SETUP([ofproto-dpif megaflow - learning])
8495 OVS_VSWITCHD_START
8496 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8497 add_of_ports br0 1 2
8498 AT_DATA([flows.txt], [dnl
8499 table=0 in_port=1 actions=load:2->NXM_NX_REG0[[0..15]],learn(table=1,priority=65535,NXM_OF_ETH_SRC[[]],NXM_OF_VLAN_TCI[[0..11]],output:NXM_NX_REG0[[0..15]]),output:2
8500 ])
8501 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8502 ovs-appctl time/stop
8503 # We send each packet twice because the first packet in each flow causes the
8504 # flow table to change and thus revalidations, which (depending on timing)
8505 # can keep a megaflow from being installed. The revalidations are done by
8506 # the second iteration, allowing the flows to be installed.
8507 for i in 1 2; do
8508 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)'])
8509 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)'])
8510 ovs-appctl time/warp 100
8511 done
8512 sleep 1
8513 dnl The original flow is missing due to a revalidation.
8514 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8515 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
8516 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
8517 ])
8518 OVS_VSWITCHD_STOP
8519 AT_CLEANUP
8520
8521 AT_SETUP([ofproto-dpif megaflow - tunnels])
8522 OVS_VSWITCHD_START(
8523 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8524 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8525 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
8526 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
8527 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
8528 ofport_request=3])
8529 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
8530 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
8531 ofport_request=4 options:key=flow])
8532 AT_DATA([flows.txt], [dnl
8533 in_port=1,actions=output(2)
8534 in_port=3,actions=output(4)
8535 ])
8536 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8537 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
8538 dnl will cause the packet to be dropped.
8539 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0xfd,ttl=128,frag=no),icmp(type=8,code=0)'])
8540 sleep 1
8541 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0x1,ttl=64,frag=no),icmp(type=8,code=0)'])
8542 AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0xfd,ttl=128,frag=no),icmp(type=8,code=0)'])
8543 sleep 1
8544 AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0x1,ttl=64,frag=no),icmp(type=8,code=0)'])
8545 sleep 1
8546 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8547 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
8548 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
8549 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
8550 ])
8551 OVS_VSWITCHD_STOP
8552 AT_CLEANUP
8553
8554 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
8555 OVS_VSWITCHD_START
8556 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8557 add_of_ports br0 1 2
8558 AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=nw_dst,nw_src], [0], [ignore], [])
8559 AT_DATA([flows.txt], [dnl
8560 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
8561 ])
8562 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8563 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)'])
8564 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)'])
8565 sleep 1
8566 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8567 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
8568 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,ttl=64,frag=no), actions: <del>
8569 ])
8570 OVS_VSWITCHD_STOP
8571 AT_CLEANUP
8572
8573 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
8574 OVS_VSWITCHD_START
8575 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8576 add_of_ports br0 1 2
8577 AT_DATA([flows.txt], [dnl
8578 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
8579 ])
8580 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8581 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)'])
8582 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)'])
8583 sleep 1
8584 dnl The first packet is essentially a no-op, as the new destination MAC is the
8585 dnl same as the original. The second entry actually updates the destination
8586 dnl MAC.
8587 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8588 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions:2
8589 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions:set(eth(dst=50:54:00:00:00:0a)),2
8590 ])
8591 OVS_VSWITCHD_STOP
8592 AT_CLEANUP
8593
8594 m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
8595 [AT_SETUP([ofproto-dpif megaflow - disabled$1])
8596 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8597 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8598 func=`printf '%s_' "$1" | cut -c 4-`
8599 add_${func}of_ports br0 1 2
8600 AT_DATA([flows.txt], [dnl
8601 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
8602 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
8603 ])
8604 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8605 ], [])
8606 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8607 ], [])
8608 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
8609 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8610 for i in 1 2 3 4; do
8611 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)'])
8612 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)'])
8613 if [[ $i -eq 1 ]]; then
8614 sleep 1
8615 fi
8616 done
8617 sleep 1
8618 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8619 skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions:2
8620 skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions:drop
8621 ])
8622 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
8623 skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:318, used:0.0s, actions:2
8624 skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:318, used:0.0s, actions:drop
8625 ])
8626 OVS_VSWITCHD_STOP
8627 AT_CLEANUP])
8628
8629 OFPROTO_DPIF_MEGAFLOW_DISABLED([])
8630 OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
8631
8632 AT_SETUP([ofproto-dpif - datapath port number change])
8633 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
8634 add_of_ports br0 1
8635
8636 # Trace a flow that should output to p1.
8637 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8638 [0], [stdout])
8639 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
8640 ])
8641
8642 # Change p1's port number to 5.
8643 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
8644
8645 # Trace a flow that should output to p1 in its new location.
8646 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8647 [0], [stdout])
8648 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
8649 ])
8650 OVS_VSWITCHD_STOP
8651 AT_CLEANUP
8652
8653 # Tests the bundling with various bfd and cfm configurations.
8654 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
8655 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
8656 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
8657 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
8658 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
8659 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
8660 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
8661 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
8662 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
8663 set Interface p0 cfm_mpid=1 -- \
8664 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
8665
8666 ovs-appctl time/stop
8667 # advance the clock to stablize everything.
8668 ovs-appctl time/warp 5000 100
8669 # cfm/show should show 'recv' fault.
8670 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8671 fault: recv
8672 ])
8673 # bfd/show should show 'up'.
8674 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8675 Local Session State: up
8676 Remote Session State: up
8677 Local Session State: up
8678 Remote Session State: up
8679 ])
8680 # bond/show should show 'may-enable: true' for all slaves.
8681 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8682 may_enable: true
8683 may_enable: true
8684 may_enable: true
8685 may_enable: true
8686 ])
8687
8688 # now disable the bfd on p1.
8689 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
8690 # advance the clock to stablize everything.
8691 ovs-appctl time/warp 5000 100
8692 # cfm/show should show 'recv' fault.
8693 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8694 fault: recv
8695 ])
8696 # bfd/show should show 'down'.
8697 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8698 Local Session State: down
8699 Remote Session State: down
8700 ])
8701 # bond/show should show 'may-enable: false' for p0.
8702 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8703 may_enable: false
8704 may_enable: true
8705 ])
8706
8707 # now enable the bfd on p1 and disable bfd on p0.
8708 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
8709 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
8710 # advance the clock to stablize everything.
8711 ovs-appctl time/warp 5000 100
8712 # cfm/show should show 'recv' fault.
8713 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8714 fault: recv
8715 ])
8716 # bfd/show should show 'down'.
8717 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8718 Local Session State: down
8719 Remote Session State: down
8720 ])
8721 # bond/show should show 'may-enable: false' for p0 and p1.
8722 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8723 may_enable: false
8724 may_enable: true
8725 may_enable: false
8726 may_enable: true
8727 ])
8728
8729 OVS_VSWITCHD_STOP
8730 AT_CLEANUP
8731
8732 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
8733 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
8734
8735 # enable bfd on p0.
8736 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8737 # check log.
8738 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8739 # disable bfd on p0.
8740 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8741 # check log.
8742 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8743 AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && ovs-appctl vlog/close && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
8744
8745 # enable cfm on p0.
8746 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
8747 # check log.
8748 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8749 # disable cfm on p0.
8750 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
8751 # check log.
8752 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8753 AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && ovs-appctl vlog/close && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
8754
8755 # enable both bfd and cfm on p0.
8756 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
8757 # check log.
8758 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8759 # disable bfd on p0.
8760 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8761 # check log, there should not be the log of thread terminated.
8762 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
8763 ])
8764 # reenable bfd on p0.
8765 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8766 # check log, should still be on log of thread created.
8767 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
8768 monitor thread created
8769 ])
8770 # disable bfd and cfm together.
8771 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
8772 # check log.
8773 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8774
8775 OVS_VSWITCHD_STOP
8776 AT_CLEANUP
8777
8778 # this test helps avoid the deadlock between the main thread and monitor thread.
8779 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
8780 OVS_VSWITCHD_START
8781
8782 for i in `seq 1 199`
8783 do
8784 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])
8785 done
8786
8787 OVS_VSWITCHD_STOP
8788 AT_CLEANUP
8789 \f
8790 AT_BANNER([ofproto-dpif - flow translation resource limits])
8791
8792 dnl Resubmits to later tables do not count against the depth limit, so we
8793 dnl can do 99 of them even though the maximum depth is 64.
8794 AT_SETUP([ofproto-dpif - forward resubmit])
8795 OVS_VSWITCHD_START
8796 (for i in `seq 0 99`; do
8797 j=`expr $i + 1`
8798 echo "table=$i, actions=resubmit(,$j)"
8799 done
8800 echo "table=100, actions=local") > flows
8801 AT_CHECK([ovs-ofctl add-flows br0 flows])
8802 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8803 [0], [stdout])
8804 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
8805 ])
8806 OVS_VSWITCHD_STOP
8807 AT_CLEANUP
8808
8809 dnl Resubmits to the same or an earlier table count against the depth limit,
8810 dnl so only 64 of them are allowed.
8811 AT_SETUP([ofproto-dpif - backward resubmit])
8812 OVS_VSWITCHD_START
8813 (echo "table=0, actions=resubmit(,66)"
8814 for i in `seq 2 66`; do
8815 j=`expr $i - 1`
8816 echo "table=$i, actions=resubmit(,$j)"
8817 done
8818 echo "table=1, actions=local") > flows
8819 AT_CHECK([ovs-ofctl add-flows br0 flows])
8820 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8821 [0], [stdout])
8822 AT_CHECK([tail -1 stdout], [0],
8823 [Translation failed (Recursion too deep), packet is dropped.
8824 ])
8825 AT_CHECK([grep -c 'over max translation depth 64' stdout],
8826 [0], [1
8827 ])
8828 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8829 AT_CLEANUP
8830
8831 AT_SETUP([ofproto-dpif - infinite resubmit])
8832 OVS_VSWITCHD_START
8833 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
8834 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8835 [0], [stdout])
8836 AT_CHECK([tail -1 stdout], [0],
8837 [Translation failed (Recursion too deep), packet is dropped.
8838 ])
8839 AT_CHECK([grep -c 'over max translation depth 64' stdout],
8840 [0], [1
8841 ])
8842 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8843 AT_CLEANUP
8844
8845 dnl Without using ofproto/trace, make sure the
8846 dnl ofproto trace is still logged
8847 AT_SETUP([ofproto-dpif - backward resubmit without trace])
8848 OVS_VSWITCHD_START
8849 (echo "table=0, actions=resubmit(,66)"
8850 for i in `seq 2 66`; do
8851 j=`expr $i - 1`
8852 echo "table=$i, actions=resubmit(,$j)"
8853 done
8854 echo "table=1, actions=local") > flows
8855 AT_CHECK([ovs-ofctl add-flows br0 flows])
8856
8857 AT_CHECK([ovs-appctl netdev-dummy/receive br0 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'], [0], [stdout])
8858
8859 OVS_WAIT_UNTIL([grep 'packet is dropped' ovs-vswitchd.log])
8860
8861 dnl make sure the full ofproto trace dump is present
8862 AT_CHECK([grep -c "^ *resubmit" ovs-vswitchd.log],
8863 [0], [66
8864 ])
8865
8866 OVS_VSWITCHD_STOP(["/over max translation depth/d
8867 /ofproto_dpif_upcall/d"])
8868 AT_CLEANUP
8869
8870 AT_SETUP([ofproto-dpif - exponential resubmit chain])
8871 OVS_VSWITCHD_START
8872 add_of_ports br0 1
8873 (for i in `seq 1 64`; do
8874 j=`expr $i + 1`
8875 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8876 done
8877 echo "in_port=65, actions=local") > flows
8878 AT_CHECK([ovs-ofctl add-flows br0 flows])
8879 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8880 AT_CHECK([tail -1 stdout], [0],
8881 [Translation failed (Too many resubmits), packet is dropped.
8882 ])
8883 AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
8884 ])
8885 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
8886 AT_CLEANUP
8887
8888 AT_SETUP([ofproto-dpif - too many output actions])
8889 OVS_VSWITCHD_START
8890 add_of_ports br0 1
8891 (for i in `seq 1 12`; do
8892 j=`expr $i + 1`
8893 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8894 done
8895 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
8896 AT_CHECK([ovs-ofctl add-flows br0 flows])
8897 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8898 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
8899 [0], [1
8900 ])
8901 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
8902 ])
8903 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
8904 AT_CLEANUP
8905
8906 AT_SETUP([ofproto-dpif - stack too deep])
8907 OVS_VSWITCHD_START
8908 add_of_ports br0 1
8909 (for i in `seq 1 12`; do
8910 j=`expr $i + 1`
8911 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8912 done
8913 push="push:NXM_NX_REG0[[]]"
8914 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
8915 AT_CHECK([ovs-ofctl add-flows br0 flows])
8916 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8917 AT_CHECK([tail -1 stdout], [0],
8918 [Translation failed (Stack too deep), packet is dropped.
8919 ])
8920 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
8921 ])
8922 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
8923 AT_CLEANUP
8924
8925
8926 AT_SETUP([ofproto-dpif packet-out controller])
8927 OVS_VSWITCHD_START
8928 add_of_ports br0 1 2
8929
8930 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
8931
8932 AT_CAPTURE_FILE([ofctl_monitor.log])
8933 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8934
8935 for i in 1 2 3; do
8936 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
8937 done
8938
8939 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8940 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8941 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
8942 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8943 dnl
8944 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
8945 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8946 dnl
8947 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
8948 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8949 ])
8950
8951 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
8952 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8953 NXST_FLOW reply:
8954 ])
8955
8956 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0],
8957 [OFPST_TABLE reply (OF1.3) (xid=0x2):
8958 table 0:
8959 active=1, lookup=0, matched=0
8960
8961 table 1:
8962 active=0, lookup=0, matched=0
8963
8964 tables 2...253: ditto
8965 ])
8966
8967 OVS_VSWITCHD_STOP
8968 AT_CLEANUP
8969
8970 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
8971 OVS_VSWITCHD_START(
8972 [-- \
8973 add-port br0 p1 -- \
8974 set interface p1 type=patch options:peer=p2 -- \
8975 add-br br1 -- \
8976 set bridge br1 datapath-type=dummy -- \
8977 set bridge br1 fail-mode=secure -- \
8978 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
8979 add-port br1 p2 -- \
8980 set interface p2 type=patch options:peer=p1 --])
8981
8982 AT_CAPTURE_FILE([ofctl_monitor.log])
8983 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8984
8985 for i in 1 2 3; do
8986 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
8987 done
8988
8989 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8990 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8991 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
8992 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8993 dnl
8994 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
8995 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8996 dnl
8997 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
8998 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8999 ])
9000
9001 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9002 OFPST_TABLE reply (OF1.3) (xid=0x2):
9003 table 0:
9004 active=0, lookup=0, matched=0
9005
9006 tables 1...253: ditto
9007 ])
9008
9009 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1], [0], [dnl
9010 OFPST_TABLE reply (OF1.3) (xid=0x2):
9011 table 0:
9012 active=0, lookup=3, matched=0
9013
9014 table 1:
9015 active=0, lookup=0, matched=0
9016
9017 tables 2...253: ditto
9018 ])
9019
9020 OVS_VSWITCHD_STOP
9021 AT_CLEANUP
9022
9023 AT_SETUP([ofproto-dpif packet-out pipeline match field (OpenFlow 1.5)])
9024 OVS_VSWITCHD_START
9025
9026 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=8}->tun_metadata2"])
9027 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata3"])
9028 AT_DATA([flows.txt], [dnl
9029 table=0,in_port=1 actions=controller
9030 table=0,tun_id=3 actions=controller
9031 table=0,metadata=5 actions=controller
9032 table=0,reg0=1,reg4=2,reg8=3,reg12=5 actions=controller
9033 table=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 actions=controller
9034 table=0,tun_metadata3=0x11 actions=controller
9035 ])
9036 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
9037
9038 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
9039 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
9040 ovs-appctl -t ovs-ofctl ofctl/barrier
9041 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
9042 AT_CAPTURE_FILE([monitor.log])
9043
9044 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=1 packet=0001020304050010203040501111 actions=table"])
9045 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tunnel_id=3 packet=0001020304050010203040502222 actions=table"])
9046 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,metadata=5 packet=0001020304050010203040503333 actions=table"])
9047 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,reg0=1,reg4=2,reg8=3,reg12=5 packet=0001020304050010203040503333 actions=table"])
9048 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 packet=0001020304050010203040503333 actions=table"])
9049 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_metadata2=0x22,tun_metadata3=0x11 packet=0001020304050010203040503333 actions=table"])
9050
9051 ovs-appctl -t ovs-ofctl ofctl/barrier
9052 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9053
9054 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
9055 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 in_port=1 (via packet_out) data_len=14 (unbuffered)
9056 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1111
9057 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_id=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
9058 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x2222
9059 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 metadata=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
9060 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9061 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 reg0=0x1,reg4=0x2,reg8=0x3,reg12=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
9062 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9063 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=1,tun_gbp_flags=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
9064 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9065 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_metadata2=0x22,tun_metadata3=0x11,in_port=2 (via packet_out) data_len=14 (unbuffered)
9066 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9067 OFPT_BARRIER_REPLY (OF1.5):
9068 ])
9069
9070 OVS_VSWITCHD_STOP
9071 AT_CLEANUP
9072
9073 AT_SETUP([ofproto-dpif packet-out goto_table])
9074 OVS_VSWITCHD_START
9075 add_of_ports br0 1 2
9076
9077 AT_DATA([flows.txt], [dnl
9078 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
9079 table=1 dl_dst=50:54:00:00:00:0a actions=controller
9080 ])
9081 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
9082
9083 AT_CAPTURE_FILE([ofctl_monitor.log])
9084 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9085
9086 for i in 1 2 3; do
9087 ovs-appctl 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)'
9088 done
9089
9090 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
9091 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9092 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9093 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9094 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9095 dnl
9096 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9097 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9098 dnl
9099 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9100 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9101 ])
9102
9103 AT_CHECK([ovs-appctl revalidator/purge], [0])
9104 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
9105 n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=goto_table:1
9106 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9107 OFPST_FLOW reply (OF1.3):
9108 ])
9109
9110 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9111 OFPST_TABLE reply (OF1.3) (xid=0x2):
9112 table 0:
9113 active=1, lookup=3, matched=3
9114
9115 table 1: ditto
9116
9117 table 2:
9118 active=0, lookup=0, matched=0
9119
9120 tables 3...253: ditto
9121 ])
9122
9123 OVS_VSWITCHD_STOP
9124 AT_CLEANUP
9125
9126
9127 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
9128 OVS_VSWITCHD_START
9129 add_of_ports br0 1 2
9130
9131 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
9132 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
9133
9134 AT_CAPTURE_FILE([ofctl_monitor.log])
9135 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9136
9137 for i in 1 2 3; do
9138 ovs-appctl 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)'
9139 done
9140
9141 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
9142 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9143 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9144 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9145 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9146 dnl
9147 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9148 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9149 dnl
9150 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9151 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9152 ])
9153
9154 AT_CHECK([ovs-appctl revalidator/purge], [0])
9155 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
9156 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9157 OFPST_FLOW reply (OF1.1):
9158 ])
9159
9160 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9161 OFPST_TABLE reply (OF1.3) (xid=0x2):
9162 table 0:
9163 active=0, lookup=3, matched=0
9164
9165 table 1:
9166 active=1, lookup=3, matched=3
9167
9168 table 2:
9169 active=0, lookup=0, matched=0
9170
9171 tables 3...253: ditto
9172 ])
9173
9174 OVS_VSWITCHD_STOP
9175 AT_CLEANUP
9176
9177 AT_SETUP([ofproto-dpif - ICMPv6])
9178 OVS_VSWITCHD_START
9179 add_of_ports br0 1
9180
9181 AT_CAPTURE_FILE([ofctl_monitor.log])
9182
9183 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9184
9185 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9186
9187 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9188
9189 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9190 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
9191 icmp6,vlan_tci=0x0000,dl_src=00:00:86:05:80:da,dl_dst=00:60:97:07:69:ea,ipv6_src=fe80::200:86ff:fe05:80da,ipv6_dst=fe80::260:97ff:fe07:69ea,ipv6_label=0x00000,nw_tos=0,nw_ecn=0,nw_ttl=255,icmp_type=135,icmp_code=0,nd_target=fe80::260:97ff:fe07:69ea,nd_sll=00:00:86:05:80:da,nd_tll=00:00:00:00:00:00 icmp6_csum:68bd
9192 ])
9193
9194 OVS_VSWITCHD_STOP
9195 AT_CLEANUP
9196
9197 AT_SETUP([ofproto-dpif - ICMPv6 type match])
9198 OVS_VSWITCHD_START
9199 add_of_ports br0 1 2 3
9200
9201 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
9202 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
9203
9204 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9205
9206 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128)'])
9207 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128)'])
9208 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129)'])
9209 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129)'])
9210
9211 AT_CHECK([ovs-appctl revalidator/purge], [0])
9212
9213 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9214 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128), actions:2
9215 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129), actions:3
9216 ])
9217
9218 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
9219 n_packets=2, n_bytes=252, icmp6,icmp_type=128 actions=output:2
9220 n_packets=2, n_bytes=252, icmp6,icmp_type=129 actions=output:3
9221 NXST_FLOW reply:
9222 ])
9223
9224 OVS_VSWITCHD_STOP
9225 AT_CLEANUP
9226
9227 AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
9228 OVS_VSWITCHD_START
9229 add_of_ports br0 1
9230 AT_CHECK([ovs-ofctl add-flow br0 icmp6,icmpv6_type=135,action=set_field:fe80::1-\>nd_target,set_field:32:21:14:86:11:74-\>nd_sll,output:controller])
9231
9232 AT_CAPTURE_FILE([ofctl_monitor.log])
9233
9234 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9235
9236 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9237
9238 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9239
9240 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9241 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
9242 icmp6,vlan_tci=0x0000,dl_src=00:00:86:05:80:da,dl_dst=00:60:97:07:69:ea,ipv6_src=fe80::200:86ff:fe05:80da,ipv6_dst=fe80::260:97ff:fe07:69ea,ipv6_label=0x00000,nw_tos=0,nw_ecn=0,nw_ttl=255,icmp_type=135,icmp_code=0,nd_target=fe80::1,nd_sll=32:21:14:86:11:74,nd_tll=00:00:00:00:00:00 icmp6_csum:19d3
9243 ])
9244
9245 OVS_VSWITCHD_STOP
9246 AT_CLEANUP
9247
9248 # Tests the exact match of CFI bit in installed datapath flows matching VLAN.
9249 AT_SETUP([ofproto-dpif - vlan matching])
9250 OVS_VSWITCHD_START(
9251 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
9252 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9253
9254 AT_CHECK([ovs-ofctl del-flows br0])
9255 AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
9256
9257 AT_CHECK([ovs-appctl netdev-dummy/receive p0 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8100),vlan(vid=10,pcp=0),encap(eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0))'])
9258
9259 OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
9260 AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
9261 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=10),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
9262 ])
9263 OVS_VSWITCHD_STOP
9264 AT_CLEANUP
9265
9266 # Tests in place modification of installed datapath flows.
9267 AT_SETUP([ofproto-dpif - in place modification])
9268 OVS_VSWITCHD_START(
9269 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9270 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9271
9272 AT_CHECK([ovs-ofctl del-flows br0])
9273 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
9274
9275 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9276
9277 ovs-appctl time/stop
9278
9279 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)'])
9280
9281 # Wait for the flow setup to be done.
9282 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9283
9284 for i in 1 2; do
9285 ovs-appctl 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)'
9286 done
9287
9288 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9289 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
9290 ])
9291
9292 AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
9293
9294 ovs-appctl time/warp 500
9295 ovs-appctl time/warp 500
9296
9297 for i in 1 2 3; do
9298 ovs-appctl 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)'
9299 done
9300
9301 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9302 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
9303 ])
9304
9305 AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
9306 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:push_vlan(vid=4,pcp=0),100
9307 ])
9308 OVS_VSWITCHD_STOP
9309 AT_CLEANUP
9310
9311 # Tests in place modification of installed datapath flows with vlans.
9312 AT_SETUP([ofproto-dpif - in place modification (vlan)])
9313 OVS_VSWITCHD_START(
9314 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9315 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9316
9317 # Always drop misses
9318 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all drop])
9319 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
9320
9321 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9322
9323 ovs-appctl time/stop
9324
9325 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)'])
9326
9327 # Check that a correct datapath flow is created.
9328 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9329
9330 for i in 1 2; do
9331 ovs-appctl 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)'
9332 done
9333
9334 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9335 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:100
9336 ])
9337
9338 # Delete the flow. Then check that the datapath flow is modified to
9339 # drop the packets. A modified flow inherits the stats, a new
9340 # datapath flow would start from sero.
9341 AT_CHECK([ovs-ofctl del-flows br0])
9342
9343 ovs-appctl time/warp 500
9344 ovs-appctl time/warp 500
9345
9346 for i in 1 2 3; do
9347 ovs-appctl 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)'
9348 done
9349
9350 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9351 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:drop
9352 ])
9353
9354 # Add a flow that matches the non-presence of a vlan tag, and check
9355 # that the datapath flow is modified accordingly.
9356 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
9357
9358 ovs-appctl time/warp 500
9359 ovs-appctl time/warp 500
9360
9361 for i in 1 2 3; do
9362 ovs-appctl 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)'
9363 done
9364
9365 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9366 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9367 ])
9368
9369 # Check that VLAN packets will not hit the same datapath megaflow.
9370
9371 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x1234))'])
9372 OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
9373
9374 for i in 1 2; do
9375 ovs-appctl 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))'
9376 done
9377
9378 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9379 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9380 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:36, used:0.0s, actions:drop
9381 ])
9382
9383 # Check that the new flow matches the CFI bit, while both vid and pcp
9384 # are wildcarded.
9385 AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
9386 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), actions:100
9387 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234)
9388 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:100
9389 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), actions:drop
9390 ])
9391 OVS_VSWITCHD_STOP
9392 AT_CLEANUP
9393
9394 AT_SETUP([ofproto-dpif - trace (unchanged)])
9395 OVS_VSWITCHD_START
9396 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
9397 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9398 ])
9399 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
9400 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9401 ])
9402
9403 OVS_VSWITCHD_STOP
9404 AT_CLEANUP
9405
9406 AT_SETUP([ofproto-dpif - conntrack - controller])
9407 OVS_VSWITCHD_START
9408
9409 add_of_ports br0 1 2
9410
9411 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9412
9413 dnl Allow new UDP connections on p1 for dst port 2, drop everything else.
9414 AT_DATA([flows.txt], [dnl
9415 dnl Table 0
9416 dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2).
9417 dnl
9418 table=0,priority=100,arp,action=normal
9419 table=0,priority=10,in_port=1,ip,action=set_field:1->reg4,set_field:1->reg3,ct(zone=NXM_NX_REG4[[0..15]],table=1)
9420 table=0,priority=10,in_port=2,ip,action=set_field:1->reg4,set_field:2->reg3,ct(zone=NXM_NX_REG4[[0..15]],table=1)
9421 table=0,priority=1,action=drop
9422 dnl
9423 dnl Pass tracked traffic through ACL, drop everything else.
9424 dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers
9425 dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets
9426 dnl get the ACL lookup using the conntrack tuple and the inverted direction.
9427 dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
9428 dnl of the master connection, as storted in ct_mark.
9429 dnl
9430 dnl Incoming non-related packet in the original direction (ACL IN)
9431 table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5
9432 dnl Incoming non-related reply packet (CT ACL OUT)
9433 table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4
9434 dnl Outgoing non-related packet (ACL OUT)
9435 table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5
9436 dnl Outgoing non-related reply packet (CT ACL IN)
9437 table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
9438 dnl
9439 dnl Related packet (CT ACL in the direction of the master connection.)
9440 table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
9441 dnl Drop everything else.
9442 table=1 priority=0, action=drop
9443 dnl
9444 dnl "ACL table"
9445 dnl
9446 dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with
9447 dnl UDP destination port '2'. Store rule ID (1234) in reg1, verdict
9448 dnl in reg2.
9449 table=3 priority=10, reg0=1, udp, udp_dst=2 action=set_field:1234->reg1,set_field:1->reg2
9450 dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235)
9451 table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2
9452 dnl
9453 dnl Re-process stateful traffic that was not accepted by a stateful rule as
9454 dnl normal traffic in the current direction. This should also delete the
9455 dnl now stale conntrack state, so that new state can be created in it's place.
9456 dnl
9457 dnl Stateful accepts go to next table.
9458 table=4 priority=100 reg2=1, action=goto_table:5
9459 dnl Everything else is reprocessed disregarding the CT state, using the actual
9460 dnl packet direction.
9461 table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5
9462 dnl
9463 dnl "ACL verdict processing table."
9464 dnl
9465 dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0)
9466 dnl
9467 dnl Drop all non-accepted packets.
9468 table=5 reg2=0 priority=1000 action=drop
9469 dnl Commit new non-related IP connections.
9470 table=5 priority=10 reg2=1 ct_state=+new-rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,exec(move:NXM_NX_REG3[[0..31]]->NXM_NX_CT_MARK[[0..31]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
9471 dnl Commit new related connections in either direction, which inherit the mark
9472 dnl (the direction of the original direction master tuple) from the master
9473 dnl connection.
9474 table=5 priority=10 reg2=1 ct_state=+new+rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,exec(move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
9475 dnl Forward everything else, including stateless accepts.
9476 table=5 priority=0 action=goto_table:6
9477 dnl
9478 dnl "Forwarding table"
9479 dnl
9480 table=6 action=controller
9481 ])
9482
9483 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9484
9485 AT_CAPTURE_FILE([ofctl_monitor.log])
9486 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9487
9488 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9489
9490 dnl OK, now start a new connection from port 1.
9491 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
9492
9493 dnl Now try a reply from port 2.
9494 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9495
9496 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9497 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9498
9499 dnl Check this output. We only see the latter two packets, not the first.
9500 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9501 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=106 (unbuffered)
9502 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
9503 dnl
9504 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_zone=1,ct_mark=0x1,ct_label=0x4d2000000000000000000000000,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x2,reg4=0x1,in_port=2 (via action) data_len=106 (unbuffered)
9505 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
9506 ])
9507
9508 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9509
9510 dnl OK, now start a second connection from port 1
9511 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=2)'])
9512
9513 dnl Now try a reply from port 2.
9514 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=3)'])
9515
9516
9517 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9518 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9519
9520 dnl Check this output. We should see both packets
9521 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9522 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=106 (unbuffered)
9523 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=2 udp_csum:551
9524 dnl
9525 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_zone=1,ct_mark=0x1,ct_label=0x4d2000000000000000000000000,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=2,ip,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x2,reg4=0x1,in_port=2 (via action) data_len=106 (unbuffered)
9526 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=3 udp_csum:551
9527 ])
9528
9529 OVS_VSWITCHD_STOP
9530 AT_CLEANUP
9531
9532 AT_SETUP([ofproto-dpif - conntrack - force commit])
9533 OVS_VSWITCHD_START
9534
9535 add_of_ports br0 1 2
9536
9537 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9538
9539 dnl Allow new connections on p1->p2, but not on p2->p1.
9540 AT_DATA([flows.txt], [dnl
9541 dnl Table 0
9542 dnl
9543 table=0,priority=100,arp,action=normal
9544 table=0,priority=10,in_port=1,udp,action=ct(commit),controller
9545 table=0,priority=10,in_port=2,udp,action=ct(table=1)
9546 table=0,priority=1,action=drop
9547 dnl
9548 dnl Table 1
9549 dnl
9550 table=1,priority=10,in_port=2,ct_state=+est,udp,action=ct(force,commit),controller
9551 table=1,priority=1,action=drop
9552 ])
9553
9554 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9555
9556 AT_CAPTURE_FILE([ofctl_monitor.log])
9557 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9558
9559 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9560
9561 dnl OK, now start a new connection from port 1.
9562 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
9563
9564 dnl Now try a reply from port 2.
9565 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9566
9567 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9568 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9569
9570 dnl Check this output. We only see the latter two packets, not the first.
9571 dnl Note that the first packet doesn't have the ct_state bits set. This
9572 dnl happens because the ct_state field is available only after recirc.
9573 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9574 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9575 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
9576 dnl
9577 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9578 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
9579 ])
9580
9581 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9582
9583 dnl OK, now start a second connection from port 1
9584 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=4)'])
9585
9586 dnl Now try a reply from port 2.
9587 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=4,dst=3)'])
9588
9589 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9590 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9591
9592 dnl Check this output. We should see both packets
9593 dnl Note that the first packet doesn't have the ct_state bits set. This
9594 dnl happens because the ct_state field is available only after recirc.
9595 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9596 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9597 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=4 udp_csum:54f
9598 dnl
9599 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9600 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:54f
9601 ])
9602
9603 dnl
9604 dnl Check that the directionality has been changed by force commit.
9605 dnl
9606 AT_CHECK([ovs-appctl dpctl/dump-conntrack | sort], [], [dnl
9607 udp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=2,dport=1),reply=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=2)
9608 udp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=4,dport=3),reply=(src=10.1.1.1,dst=10.1.1.2,sport=3,dport=4)
9609 ])
9610
9611 OVS_VSWITCHD_STOP
9612 AT_CLEANUP
9613
9614 AT_SETUP([ofproto-dpif - conntrack - ipv6])
9615 OVS_VSWITCHD_START
9616
9617 add_of_ports br0 1 2
9618
9619 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9620
9621 dnl Allow new connections on p1->p2, but not on p2->p1.
9622 AT_DATA([flows.txt], [dnl
9623 dnl Table 0
9624 dnl
9625 table=0,priority=100,arp,action=normal
9626 table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
9627 table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
9628 table=0,priority=1,action=drop
9629 dnl Table 1
9630 dnl
9631 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
9632 table=1,priority=1,action=drop
9633 ])
9634
9635 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9636
9637 AT_CAPTURE_FILE([ofctl_monitor.log])
9638 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9639
9640 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x86dd),ipv6(src=2001:db8::2,dst=2001:db8::1,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=2,dst=1)'])
9641
9642 dnl OK, now start a new connection from port 1.
9643 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x86dd),ipv6(src=2001:db8::1,dst=2001:db8::2,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=1,dst=2)'])
9644
9645 dnl Now try a reply from port 2.
9646 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x86dd),ipv6(src=2001:db8::2,dst=2001:db8::1,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=2,dst=1)'])
9647
9648 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9649 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9650
9651 dnl Check this output. We only see the latter two packets, not the first.
9652 dnl Note that the first packet doesn't have the ct_state bits set. This
9653 dnl happens because the ct_state field is available only after recirc.
9654 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9655 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
9656 udp6,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,ipv6_src=2001:db8::1,ipv6_dst=2001:db8::2,ipv6_label=0x00000,nw_tos=112,nw_ecn=0,nw_ttl=128,tp_src=1,tp_dst=2 udp_csum:bfe2
9657 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=126 ct_state=est|rpl|trk,ct_ipv6_src=2001:db8::1,ct_ipv6_dst=2001:db8::2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ipv6,in_port=2 (via action) data_len=126 (unbuffered)
9658 udp6,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,ipv6_src=2001:db8::2,ipv6_dst=2001:db8::1,ipv6_label=0x00000,nw_tos=112,nw_ecn=0,nw_ttl=128,tp_src=2,tp_dst=1 udp_csum:bfe2
9659 ])
9660
9661 OVS_VSWITCHD_STOP
9662 AT_CLEANUP
9663
9664 AT_SETUP([ofproto-dpif - conntrack - output action])
9665 OVS_VSWITCHD_START
9666
9667 add_of_ports br0 1 2
9668
9669 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9670
9671 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9672 AT_DATA([flows.txt], [dnl
9673 dnl The flows are in two separate tables for two reasons:
9674 dnl * To make the pipeline more clear.
9675 dnl * To make megaflows more consistent (we check megaflows below). The
9676 dnl unwildcarding in megaflows depends on the internal ordering of the
9677 dnl subtables, which are sorted using the system qsort(). qsort()
9678 dnl is provided by libc and may or may not be stable, so we can't rely
9679 dnl on that. By having separate tables we have more control over which
9680 dnl subtables are visited, meaning consistent megaflows.
9681 dnl
9682 dnl Table 0
9683 dnl
9684 table=0,priority=100,arp,action=normal
9685 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
9686 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9687 table=0,priority=1,action=drop
9688 dnl
9689 dnl Table 1
9690 dnl
9691 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
9692 table=1,priority=1,action=drop
9693 ])
9694
9695 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9696
9697
9698 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9699
9700 dnl OK, now start a new connection from port 1.
9701 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
9702
9703 dnl Now try a reply from port 2.
9704 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9705
9706 dnl OK, now start a second connection from port 1
9707 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
9708
9709 dnl Now try a reply from port 2.
9710 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9711
9712
9713 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9714 ct_state(+new-est+trk),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:drop
9715 ct_state(-new+est+trk),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:1
9716 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
9717 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct,recirc(0x1)
9718 ])
9719
9720 OVS_VSWITCHD_STOP
9721 AT_CLEANUP
9722
9723 AT_SETUP([ofproto-dpif - conntrack - expiration])
9724 OVS_VSWITCHD_START
9725
9726 add_of_ports br0 1 2
9727
9728 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9729
9730 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9731 AT_DATA([flows.txt], [dnl
9732 dnl Table 0
9733 dnl
9734 table=0,priority=100,arp,action=normal
9735 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
9736 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9737 table=0,priority=1,action=drop
9738 dnl
9739 dnl Table 1
9740 dnl
9741 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9742 table=1,priority=1,action=drop
9743 ])
9744
9745 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9746
9747 AT_CAPTURE_FILE([ofctl_monitor.log])
9748 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9749
9750 AT_CHECK([ovs-appctl time/stop])
9751
9752 dnl Start a new connection from port 1.
9753 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
9754
9755 dnl Now try a reply from port 2.
9756 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9757
9758 ovs-appctl time/warp 100000
9759
9760 dnl Now try another reply from port 2.
9761 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9762
9763 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
9764 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9765
9766 dnl Check this output. Only one reply must be there
9767 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9768 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
9769 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
9770 dnl
9771 OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
9772 ])
9773
9774 OVS_VSWITCHD_STOP
9775 AT_CLEANUP
9776
9777 AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
9778 OVS_VSWITCHD_START
9779
9780 add_of_ports br0 1 2
9781
9782 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9783
9784 AT_DATA([flows.txt], [dnl
9785 ipv6,ct_state=-trk,action=ct(table=0,zone=0)
9786 ct_state=+trk,action=controller
9787 ])
9788
9789 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9790
9791 AT_CAPTURE_FILE([ofctl_monitor.log])
9792 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9793
9794 AT_CHECK([ovs-appctl time/stop])
9795
9796 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
9797
9798 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
9799 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9800
9801 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9802 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,ipv6,in_port=2 (via action) data_len=86 (unbuffered)
9803 icmp6,vlan_tci=0x0000,dl_src=00:00:86:05:80:da,dl_dst=00:60:97:07:69:ea,ipv6_src=fe80::200:86ff:fe05:80da,ipv6_dst=fe80::260:97ff:fe07:69ea,ipv6_label=0x00000,nw_tos=0,nw_ecn=0,nw_ttl=255,icmp_type=135,icmp_code=0,nd_target=fe80::260:97ff:fe07:69ea,nd_sll=00:00:86:05:80:da,nd_tll=00:00:00:00:00:00 icmp6_csum:68bd
9804 ])
9805
9806 OVS_VSWITCHD_STOP
9807 AT_CLEANUP
9808
9809 AT_SETUP([ofproto-dpif - conntrack - zones])
9810 OVS_VSWITCHD_START
9811
9812 add_of_ports br0 1 2 3 4
9813
9814 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9815
9816 dnl Allow new connections on p1->p2 or p3->p4.
9817 dnl Allow only established connections p2->p1 and p4->p3
9818 dnl p1,p2 and p3,p4 are on different zones
9819 AT_DATA([flows.txt], [dnl
9820 dnl Table 0
9821 dnl
9822 table=0,priority=100,arp,action=normal
9823 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
9824 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9825 table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
9826 table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
9827 table=0,priority=1,action=drop
9828 dnl
9829 dnl Table 1
9830 dnl
9831 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9832 table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
9833 table=1,priority=1,action=drop
9834 ])
9835
9836 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9837
9838 AT_CAPTURE_FILE([ofctl_monitor.log])
9839 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9840
9841 dnl Basic "only established" test on ports 1,2
9842
9843 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9844 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
9845 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9846
9847 dnl Now use the same 5-tuples but on ports 3,4
9848
9849 AT_CHECK([ovs-appctl netdev-dummy/receive p4 'in_port(4),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9850 AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
9851 AT_CHECK([ovs-appctl netdev-dummy/receive p4 'in_port(4),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9852
9853 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9854 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9855
9856 dnl Check this output. We only see the latter two packets (for each zone), not the first.
9857 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9858 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9859 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
9860 dnl
9861 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
9862 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
9863 dnl
9864 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=3 (via action) data_len=106 (unbuffered)
9865 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
9866 dnl
9867 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_zone=1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=4 (via action) data_len=106 (unbuffered)
9868 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
9869 ])
9870
9871 OVS_VSWITCHD_STOP
9872 AT_CLEANUP
9873
9874 AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
9875 OVS_VSWITCHD_START
9876
9877 add_of_ports br0 1 2
9878
9879 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9880
9881 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9882 AT_DATA([flows.txt], [dnl
9883 dnl Table 0
9884 dnl
9885 table=0,priority=100,arp,action=normal
9886 table=0,priority=10,udp,action=ct(table=1,zone=0)
9887 table=0,priority=1,action=drop
9888 dnl
9889 dnl Table 1
9890 dnl
9891 table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
9892 table=1,priority=10,ct_state=+trk+est,udp,action=controller
9893 table=1,priority=1,action=drop
9894 ])
9895
9896 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9897
9898 AT_CAPTURE_FILE([ofctl_monitor.log])
9899 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9900
9901 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9902
9903 dnl OK, now start a new connection from port 1.
9904 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
9905
9906 dnl Now try a reply from port 2.
9907 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
9908
9909 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9910 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9911
9912 dnl Check this output. We only see the latter two packets, not the first.
9913 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9914 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9915 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
9916 dnl
9917 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
9918 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
9919 ])
9920
9921 OVS_VSWITCHD_STOP
9922 AT_CLEANUP
9923
9924 AT_SETUP([ofproto-dpif - conntrack - ICMP related])
9925 OVS_VSWITCHD_START
9926
9927 add_of_ports br0 1 2
9928
9929 dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
9930 AT_DATA([flows.txt], [dnl
9931 dnl Table 0
9932 dnl
9933 table=0,priority=100,arp,action=normal
9934 table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
9935 table=0,priority=10,ip,in_port=2,action=ct(table=1)
9936 table=0,priority=1,action=drop
9937 dnl
9938 dnl Table 1
9939 dnl
9940 table=1,priority=10,in_port=1,ct_state=+trk,action=controller
9941 table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
9942 table=1,priority=1,action=drop
9943 ])
9944
9945 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9946
9947 AT_CAPTURE_FILE([ofctl_monitor.log])
9948 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9949
9950 dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
9951 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
9952
9953 dnl 2. Send and UDP packet to port 5555
9954 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
9955
9956 dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
9957 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
9958
9959 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9960 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9961
9962 dnl Check this output. We only see the first and the last packet
9963 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9964 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=47 ct_state=new|trk,ct_nw_src=172.16.0.1,ct_nw_dst=172.16.0.2,ct_nw_proto=17,ct_tp_src=41614,ct_tp_dst=5555,ip,in_port=1 (via action) data_len=47 (unbuffered)
9965 udp,vlan_tci=0x0000,dl_src=e6:4c:47:35:28:c9,dl_dst=c6:f9:4e:cb:72:db,nw_src=172.16.0.1,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=41614,tp_dst=5555 udp_csum:2096
9966 dnl
9967 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=75 ct_state=rel|rpl|trk,ct_nw_src=172.16.0.1,ct_nw_dst=172.16.0.2,ct_nw_proto=17,ct_tp_src=41614,ct_tp_dst=5555,ip,in_port=2 (via action) data_len=75 (unbuffered)
9968 icmp,vlan_tci=0x0000,dl_src=c6:f9:4e:cb:72:db,dl_dst=e6:4c:47:35:28:c9,nw_src=172.16.0.2,nw_dst=172.16.0.1,nw_tos=192,nw_ecn=0,nw_ttl=64,icmp_type=3,icmp_code=3 icmp_csum:553f
9969 ])
9970
9971 OVS_VSWITCHD_STOP
9972 AT_CLEANUP
9973
9974 AT_SETUP([ofproto-dpif - conntrack - ct_mark])
9975 OVS_VSWITCHD_START
9976
9977 add_of_ports br0 1 2
9978
9979 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9980
9981 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9982 AT_DATA([flows.txt], [dnl
9983 dnl Table 0
9984 dnl
9985 table=0,arp,action=normal
9986 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
9987 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
9988 table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
9989 table=0,ip,in_port=2,actions=ct(table=1)
9990 table=0,priority=0,action=drop
9991 dnl
9992 dnl Table 1
9993 dnl
9994 table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
9995 table=1,priority=1,action=drop
9996 ])
9997
9998 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9999
10000 AT_CAPTURE_FILE([ofctl_monitor.log])
10001 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10002
10003 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10004 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=4)'])
10005 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=5,dst=6)'])
10006
10007 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10008 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=4,dst=3)'])
10009 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=6,dst=5)'])
10010
10011 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
10012 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10013
10014 dnl Check this output.
10015 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10016 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10017 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
10018 dnl
10019 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10020 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=4 udp_csum:54f
10021 dnl
10022 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10023 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=5,tp_dst=6 udp_csum:54b
10024 dnl
10025 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_mark=0x1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10026 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10027 dnl
10028 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_mark=0x3,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=4,ip,in_port=2 (via action) data_len=106 (unbuffered)
10029 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:54f
10030 ])
10031
10032 OVS_VSWITCHD_STOP
10033 AT_CLEANUP
10034
10035 AT_SETUP([ofproto-dpif - conntrack - ct_label])
10036 OVS_VSWITCHD_START
10037
10038 add_of_ports br0 1 2
10039
10040 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10041
10042 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10043 AT_DATA([flows.txt], [dnl
10044 dnl Table 0
10045 dnl
10046 table=0,arp,action=normal
10047 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
10048 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
10049 table=0,ip,in_port=2,actions=ct(table=1)
10050 dnl
10051 dnl Table 1
10052 dnl
10053 table=1,priority=10,ct_state=+trk+rpl,actions=controller
10054 table=1,priority=1,action=drop
10055 ])
10056
10057 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10058
10059 AT_CAPTURE_FILE([ofctl_monitor.log])
10060 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10061
10062 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10063 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=4)'])
10064
10065 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10066 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=4,dst=3)'])
10067
10068 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10069 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10070
10071 dnl Check this output.
10072 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10073 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_label=0x1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10074 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10075 dnl
10076 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_label=0x2,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=4,ip,in_port=2 (via action) data_len=106 (unbuffered)
10077 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:54f
10078 ])
10079
10080 OVS_VSWITCHD_STOP
10081 AT_CLEANUP
10082
10083 AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
10084 OVS_VSWITCHD_START
10085
10086 add_of_ports br0 1 2
10087
10088 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10089
10090 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10091 AT_DATA([flows.txt], [dnl
10092 dnl The flows are in two separate tables for two reasons:
10093 dnl * To make the pipeline more clear.
10094 dnl * To make megaflows more consistent (we check megaflows below). The
10095 dnl unwildcarding in megaflows depends on the internal ordering of the
10096 dnl subtables, which are sorted using the system qsort(). qsort()
10097 dnl is provided by libc and may or may not be stable, so we can't rely
10098 dnl on that. By having separate tables we have more control over which
10099 dnl subtables are visited, meaning consistent megaflows.
10100 dnl
10101 dnl Table 0
10102 dnl
10103 table=0,arp,action=normal
10104 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
10105 table=0,ip,in_port=2,actions=ct(table=1)
10106 table=0,priority=0,action=drop
10107 dnl
10108 dnl Table 1
10109 dnl
10110 table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
10111 table=1,priority=1,action=drop
10112 ])
10113
10114 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10115
10116 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10117 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10118
10119 # Give time for logs to appear.
10120 ovs-appctl revalidator/wait
10121
10122 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
10123 ct_state(+rpl+trk),ct_label(0x1),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:1
10124 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no),udp(src=1), actions:ct(commit,label=0x1),2
10125 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
10126 ])
10127
10128 OVS_VSWITCHD_STOP
10129 AT_CLEANUP
10130
10131 AT_SETUP([ofproto-dpif - conntrack - no output])
10132 OVS_VSWITCHD_START
10133
10134 add_of_ports br0 1
10135
10136 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10137
10138 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10139 AT_DATA([flows.txt], [dnl
10140 in_port=1,udp,action=ct(commit,zone=0)
10141 ])
10142
10143 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10144
10145 dnl Start a new connection from port 1.
10146 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10147
10148 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
10149 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
10150 ])
10151
10152 OVS_VSWITCHD_STOP
10153 AT_CLEANUP
10154
10155 AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
10156 OVS_VSWITCHD_START
10157
10158 add_of_ports br0 1 2
10159
10160 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10161
10162 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10163 AT_DATA([flows.txt], [dnl
10164 dnl Table 0
10165 dnl
10166 table=0,priority=100,arp,action=normal
10167 table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10168 table=0,priority=10,in_port=2,ip,action=ct(table=1)
10169 table=0,priority=1,action=drop
10170 dnl
10171 dnl Table 1
10172 dnl
10173 dnl The following two flows are separated to explicitly count the packets
10174 dnl that create a new connection
10175 table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10176 table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
10177 dnl
10178 table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10179 table=1,ip,ct_state=+trk+inv,action=drop
10180 ])
10181
10182 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10183
10184 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10185 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10186 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10187 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
10188 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10189 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10190 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10191 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10192 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10193
10194 AT_CHECK([ovs-appctl revalidator/purge])
10195 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10196 dnl Only one new connection
10197 n_packets=1
10198 ])
10199
10200 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
10201 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
10202 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
10203 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
10204 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
10205 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
10206 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
10207 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
10208 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
10209
10210 AT_CHECK([ovs-appctl revalidator/purge])
10211 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10212 dnl Two new connections
10213 n_packets=2
10214 ])
10215
10216 OVS_VSWITCHD_STOP
10217 AT_CLEANUP
10218
10219 AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
10220 OVS_VSWITCHD_START
10221
10222 add_of_ports br0 1 2
10223
10224 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10225
10226 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10227 AT_DATA([flows.txt], [dnl
10228 dnl Table 0
10229 dnl
10230 table=0,priority=100,arp,action=normal
10231 table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
10232 table=0,priority=10,in_port=2,tcp,action=ct(table=1)
10233 table=0,priority=1,action=drop
10234 dnl
10235 dnl Table 1
10236 dnl
10237 table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
10238 table=1,priority=1,action=drop
10239 ])
10240
10241 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10242
10243 AT_CHECK([ovs-appctl revalidator/purge])
10244 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10245 dnl No dropped packets
10246 n_packets=0
10247 ])
10248
10249 AT_CAPTURE_FILE([ofctl_monitor.log])
10250 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10251
10252 dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
10253 dnl sure that the connection tracker is able to pick up already established
10254 dnl connections that use window scaling.
10255 dnl
10256 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
10257 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
10258 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
10259 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
10260 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
10261 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a08004500022afc284000400626a10a0101020a01010100020001396bb35b8cadbdb45018000a941f0000 dnl
10262 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10263 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10264 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10265 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10266 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10267 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10268 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10269 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10270 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10271 6666666666666666666666666666666666666666666666666666660a'])
10272 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
10273 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a5054000000090800450001fdf2ca40004006302c0a0101010a010102000100028cadbdb4396bb55d5018000aa60c0000 dnl
10274 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10275 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10276 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10277 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10278 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10279 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10280 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10281 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10282 6565656565656565656565656565656565656565656565656565656565656565656565650a'])
10283 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
10284 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
10285 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
10286 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
10287 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
10288
10289 AT_CHECK([ovs-appctl revalidator/purge])
10290
10291 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10292
10293 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10294 ])
10295
10296 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10297 dnl No dropped packets
10298 n_packets=0
10299 ])
10300
10301 OVS_VSWITCHD_STOP
10302 AT_CLEANUP
10303
10304 dnl This is a truncated version of "ofproto-dpif - conntrack - controller",
10305 dnl with extra send-to-controller actions following ct_clear to show that
10306 dnl the connection tracking data has been cleared.
10307 AT_SETUP([ofproto-dpif - conntrack - ct_clear])
10308 OVS_VSWITCHD_START
10309
10310 add_of_ports br0 1 2
10311
10312 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10313
10314 dnl Allow new connections on p1->p2, but not on p2->p1.
10315 AT_DATA([flows.txt], [dnl
10316 dnl Table 0
10317 dnl
10318 table=0,priority=100,arp,action=normal
10319 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller,ct_clear,controller
10320 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10321 table=0,priority=1,action=drop
10322 dnl
10323 dnl Table 1
10324 dnl
10325 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller,ct_clear,controller
10326 table=1,priority=1,action=drop
10327 ])
10328
10329 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10330
10331 AT_CAPTURE_FILE([ofctl_monitor.log])
10332 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10333
10334 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10335
10336 dnl OK, now start a new connection from port 1.
10337 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
10338
10339 dnl Now try a reply from port 2.
10340 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
10341
10342 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
10343 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10344
10345 dnl Check this output. We only see the latter two packets, not the first.
10346 dnl Note that the first packet doesn't have the ct_state bits set. This
10347 dnl happens because the ct_state field is available only after recirc.
10348 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10349 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10350 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
10351 dnl
10352 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10353 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:553
10354 dnl
10355 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,ip,in_port=2 (via action) data_len=106 (unbuffered)
10356 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10357 dnl
10358 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
10359 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:553
10360 ])
10361 OVS_VSWITCHD_STOP
10362 AT_CLEANUP
10363
10364 AT_SETUP([ofproto-dpif - conntrack - ofproto/trace])
10365 OVS_VSWITCHD_START
10366
10367 add_of_ports br0 1 2 3 4
10368
10369 AT_DATA([flows.txt], [dnl
10370 dnl Table 0
10371 dnl
10372 table=0,priority=100,arp,action=normal
10373 table=0,priority=10,udp,action=ct(table=1,zone=0)
10374 table=0,priority=10,tcp,action=ct(table=2,zone=1)
10375 table=0,priority=1,action=drop
10376 dnl
10377 dnl Table 1
10378 dnl
10379 table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+new,udp,action=ct(commit,zone=0),2
10380 table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+est,udp,action=2
10381 table=1,priority=10,in_port=2,ct_zone=0,ct_state=+trk+est,udp,action=1
10382 table=1,priority=1,action=drop
10383 dnl
10384 dnl Table 2
10385 dnl
10386 table=2,priority=10,in_port=1,tcp,ct_zone=1,ct_state=+trk+new,tcp,action=ct(commit,zone=1),ct(table=3,zone=2)
10387 table=2,priority=10,in_port=1,tcp,ct_zone=1,ct_state=+trk+est,tcp,action=ct(table=3,zone=2)
10388 table=2,priority=1,action=drop
10389 dnl
10390 dnl Table 3
10391 dnl
10392 table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+new,tcp,action=ct(commit,zone=2),4
10393 table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+est,tcp,action=3
10394 table=2,priority=1,action=drop
10395 ])
10396
10397 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10398
10399 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,udp'], [0], [stdout])
10400 AT_CHECK([tail -1 stdout], [0],
10401 [Datapath actions: drop
10402 ])
10403
10404 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,udp'], [0], [stdout])
10405 AT_CHECK([tail -1 stdout], [0],
10406 [Datapath actions: ct(commit),2
10407 ])
10408
10409 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp'], [0], [stdout])
10410 AT_CHECK([tail -1 stdout], [0],
10411 [Datapath actions: ct(commit,zone=2),4
10412 ])
10413
10414 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp' --ct-next 'trk,est' --ct-next 'trk,est' ], [0], [stdout])
10415 AT_CHECK([tail -1 stdout], [0],
10416 [Datapath actions: 3
10417 ])
10418
10419 OVS_VSWITCHD_STOP
10420 AT_CLEANUP
10421
10422 AT_SETUP([ofproto - set mtu])
10423 OVS_VSWITCHD_START
10424
10425 add_of_ports br0 1
10426
10427 # Check that initial MTU is 1500 for 'br0' and 'p1'.
10428 AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
10429 1500
10430 ])
10431 AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
10432 1500
10433 ])
10434
10435 # Request new MTU for 'p1'
10436 AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
10437
10438 # Check that the new MTU is applied
10439 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p1 mtu=1600])
10440 # The internal port 'br0' should have the same MTU value as p1, becase it's
10441 # the new bridge minimum.
10442 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
10443
10444 AT_CHECK([ovs-vsctl del-port br0 p1])
10445
10446 # When 'p1' is deleted, the internal port should return to the default MTU
10447 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1500])
10448
10449 # New port with 'mtu_request' in the same transaction.
10450 AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
10451 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1600])
10452 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
10453
10454 # Explicitly set mtu_request on the internal interface. This should prevent
10455 # the MTU from being overriden.
10456 AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
10457 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
10458
10459 # The new MTU on p2 should not affect br0.
10460 AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
10461 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1400])
10462 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
10463
10464 # Remove explicit mtu_request from br0. Now it should track the bridge
10465 # minimum again.
10466 AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
10467 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1400])
10468
10469 OVS_VSWITCHD_STOP
10470 AT_CLEANUP
10471
10472 AT_SETUP([ofproto - fragment prerequisites])
10473 OVS_VSWITCHD_START
10474
10475 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
10476
10477 add_of_ports br0 1
10478
10479 AT_DATA([flows.txt], [dnl
10480 priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
10481 priority=1,in_port=1,udp,action=drop
10482 ])
10483
10484 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10485
10486 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
10487
10488 ovs-appctl time/stop
10489 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
10490 ovs-appctl time/warp 5000
10491
10492 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
10493 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
10494 ])
10495
10496 dnl Change the flow table. This will trigger revalidation of all the flows.
10497 AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
10498 AT_CHECK([ovs-appctl revalidator/wait], [0])
10499
10500 dnl We don't want revalidators to delete any flow. If the flow has been
10501 dnl deleted it means that there's some inconsistency with the revalidation.
10502 AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
10503
10504 OVS_VSWITCHD_STOP
10505 AT_CLEANUP