]> git.proxmox.com Git - mirror_ovs.git/blob - tests/ofproto-dpif.at
ofproto-dpif-trace: Improve NAT tracing.
[mirror_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 the main thread:
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 the main thread:
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 the main thread:
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 the main thread:
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=if-nonzero -- \
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=if-nonzero -- \
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=if-nonzero -- \
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)),$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 the main thread:
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 the main thread:
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 the main thread:
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 the main thread:
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 the main thread:
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 the main thread:
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 # Checks for regression against a bug in which OVS dropped packets
5175 # with in_port=CONTROLLER when they were recirculated (because
5176 # CONTROLLER isn't a real port and could not be looked up).
5177 AT_SETUP([ofproto-dpif - packet-out recirculation])
5178 OVS_VSWITCHD_START
5179 add_of_ports br0 1 2
5180
5181 AT_DATA([flows.txt], [dnl
5182 table=0 ip actions=mod_dl_dst:83:83:83:83:83:83,ct(table=1)
5183 table=1 ip actions=ct(commit),output:2
5184 ])
5185 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5186
5187 packet=ffffffffffff00102030405008004500001c00000000401100000a000002ffffffff0035111100080000
5188 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=$packet actions=table"])
5189
5190 # Dumps out the flow table, extracts the number of packets that have gone
5191 # through the (single) flow in table 1, and returns success if it's exactly 1.
5192 #
5193 # If this remains 0, then the recirculation isn't working properly since the
5194 # packet never goes through flow in table 1.
5195 check_flows () {
5196 n=$(ovs-ofctl dump-flows br0 table=1 | sed -n 's/.*n_packets=\([[0-9]]\{1,\}\).*/\1/p')
5197 echo "n_packets=$n"
5198 test "$n" = 1
5199 }
5200 OVS_WAIT_UNTIL([check_flows], [ovs dump-flows br0])
5201
5202 OVS_VSWITCHD_STOP
5203 AT_CLEANUP
5204
5205 AT_SETUP([ofproto-dpif - debug_slow action])
5206 OVS_VSWITCHD_START
5207 add_of_ports br0 1 2 3
5208
5209 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,2"])
5210
5211 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)"
5212
5213 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5214 AT_CHECK_UNQUOTED([tail -3 stdout], [0], [Datapath actions: 2
5215 This flow is handled by the userspace slow path because it:
5216 - Uses action(s) not supported by datapath.
5217 ])
5218
5219 OVS_VSWITCHD_STOP
5220 AT_CLEANUP
5221
5222
5223 dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
5224 dnl
5225 dnl Checks the implementation of the continuation mechanism that allows the
5226 dnl packet processing pipeline to be paused and resumed. Starts by creating
5227 dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
5228 dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
5229 dnl in the bridge, resuming each time the pipeline pauses, and expects a single
5230 dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
5231 dnl ACTIONS0 still contains at least one "pause" action, removes one of them
5232 dnl and repeats the process.
5233 dnl
5234 dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
5235 dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
5236 dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
5237 dnl into port 1 on br0, so br1 only comes into action if a patch port (added
5238 dnl by EXTRA_SETUP) jumps from one bridge to another.
5239 dnl
5240 dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
5241 dnl both bridges, e.g. to configure mirrors or patch ports.
5242 m4_define([CHECK_CONTINUATION], [dnl
5243 AT_SETUP([ofproto-dpif - continuation - $1])
5244 AT_KEYWORDS([continuations pause resume])
5245 OVS_VSWITCHD_START
5246
5247 # count_matches STRING
5248 #
5249 # Prints on stdout the number of occurrences of STRING in stdin.
5250 count_matches () {
5251 sed -n ":start
5252 s/$[1]//p
5253 t start" | wc -l
5254 }
5255
5256 add_of_ports --pcap br0 `seq 1 $2`
5257 m4_if([$3], [0], [],
5258 [add_of_br 1
5259 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
5260
5261 AT_CAPTURE_FILE([ofctl_monitor0.log])
5262 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
5263 m4_if([$3], [0], [],
5264 [AT_CAPTURE_FILE([ofctl_monitor1.log])
5265 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
5266
5267 actions0='$4'
5268 actions1='$5'
5269 $6
5270 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5271 n_packets=0
5272 n_resumes=0
5273 while true; do
5274 printf "\n\nactions for br0:\n%s\n" "$actions0"
5275 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
5276
5277 # Add flows.
5278 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
5279 m4_if([$3], [0], [],
5280 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
5281
5282 # Make sure the datapath is up-to-date before sending the packet.
5283 ovs-appctl revalidator/wait
5284
5285 # Run a packet through the switch.
5286 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5287
5288 # Wait for the expected number of packets to show up.
5289 n_packets=`expr $n_packets + $2 - 1 + $3`
5290 echo "waiting for $n_packets packets..."
5291 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
5292
5293 # Wait for the expected number of NXT_RESUMEs to be logged.
5294 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
5295 echo "waiting for $n_resumes NXT_RESUMEs..."
5296 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
5297
5298 # Eliminate one "pause" from the actions.
5299 #
5300 # If there were none left, then we're done.
5301 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
5302 if test X"$actions0" = X"$next_actions0"; then
5303 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
5304 if test X"$actions1" = X"$next_actions1"; then
5305 break
5306 else
5307 actions1=$next_actions1
5308 fi
5309 else
5310 actions0=$next_actions0
5311 fi
5312
5313 # Delete all the flows and verify that there are none, so that we
5314 # can be sure that our updated flow tables is actually in use
5315 # later.
5316 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
5317 [NXST_FLOW reply:
5318 ])
5319 m4_if([$3], [0], [],
5320 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
5321 [NXST_FLOW reply:
5322 ])])
5323 done
5324 OVS_VSWITCHD_STOP
5325 AT_CLEANUP
5326 ])
5327
5328 # Check that pause at the end of the pipeline works OK.
5329 #
5330 # (xlate_continuation() has a special case for no-op actions; this
5331 # fails without that special case.)
5332 CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
5333
5334 # Check that remaining actions are preserved following resume.
5335 CHECK_CONTINUATION([actions], [7], [0],
5336 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
5337
5338 # Check that multiple levels of resubmit continue following resume.
5339 #
5340 # The "resubmit:55", which is relative to the current table, is
5341 # particularly interesting because it checks that the notion of the
5342 # current table is correctly preserved.
5343 CHECK_CONTINUATION([resubmit], [10], [0],
5344 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
5345 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
5346 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
5347 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
5348 table=3 in_port=55 actions=pause 6 pause])
5349
5350 # Check that the action set is preserved across pause/resume.
5351 CHECK_CONTINUATION([action set], [3], [0],
5352 [in_port=1 actions=1 pause resubmit(,1) pause 2
5353 table=1 actions=write_actions(3)])
5354
5355 # Check that metadata and the stack used by push and pop is preserved
5356 # across pause/resume.
5357 CHECK_CONTINUATION([data stack], [3], [0],
5358 [in_port=1 actions=pause dnl
5359 set_field:1->reg0 dnl
5360 pause dnl
5361 set_field:2->reg1 dnl
5362 pause dnl
5363 output:NXM_NX_REG0[[]] dnl
5364 pause dnl
5365 push:NXM_NX_REG1[[]] dnl
5366 dnl
5367 pop:NXM_NX_REG2[[]] dnl
5368 pause dnl
5369 output:NXM_NX_REG2[[]] dnl
5370 pause dnl
5371 3])
5372
5373 # Check that mirror output occurs once and once only, even if
5374 # separated by pause/resume.
5375 CHECK_CONTINUATION([mirroring], [5], [0],
5376 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
5377 [ovs-vsctl \
5378 set Bridge br0 mirrors=@m --\
5379 --id=@p2 get Port p2 --\
5380 --id=@p3 get Port p3 --\
5381 --id=@p4 get Port p4 --\
5382 --id=@p5 get Port p5 --\
5383 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
5384
5385 # Check that pause works in the presence of patch ports.
5386 CHECK_CONTINUATION([patch ports], [4], [1],
5387 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
5388 table=1 in_port=1 actions=pause 3 pause 10 pause],
5389 [table=0 in_port=11 actions=pause 5 pause],
5390 [ovs-vsctl \
5391 -- add-port br0 patch10 \
5392 -- set interface patch10 type=patch options:peer=patch11 \
5393 ofport_request=10 \
5394 -- add-port br1 patch11 \
5395 -- set interface patch11 type=patch options:peer=patch10 \
5396 ofport_request=11])
5397
5398 AT_SETUP([ofproto-dpif - continuation flow stats])
5399 AT_KEYWORDS([continuations pause resume])
5400 OVS_VSWITCHD_START
5401
5402 add_of_ports --pcap br0 `seq 1 2`
5403
5404 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)"
5405
5406 AT_DATA([flows.txt], [dnl
5407 table=0 in_port=1 actions=set_field:1->reg1 controller(pause) resubmit(,2)
5408 table=2 reg1=0x1 actions=2
5409 ])
5410
5411 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5412
5413 AT_CAPTURE_FILE([ofctl_monitor0.log])
5414 ovs-ofctl monitor br0 resume --detach --no-chdir \
5415 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5416
5417 # Run a packet through the switch.
5418 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5419
5420 # Check flow stats
5421 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5422 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
5423 cookie=0x0, duration=0.0s, table=2, n_packets=1, n_bytes=106, idle_age=0, reg1=0x1 actions=output:2
5424 ])
5425
5426 # The packet should be received by port 2
5427 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5428
5429 OVS_VSWITCHD_STOP
5430 AT_CLEANUP
5431
5432 AT_SETUP([ofproto-dpif - continuation with conntrack])
5433 AT_KEYWORDS([continuations pause resume])
5434 OVS_VSWITCHD_START
5435
5436 add_of_ports --pcap br0 `seq 1 2`
5437
5438 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)"
5439
5440 AT_DATA([flows.txt], [dnl
5441 table=0, in_port=1 icmp action=ct(table=1)
5442 table=1, icmp action=controller(pause) resubmit(,2)
5443 table=2, in_port=1 icmp ct_state=+trk+new action=output:2
5444 ])
5445
5446 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5447
5448 AT_CAPTURE_FILE([ofctl_monitor0.log])
5449 ovs-ofctl monitor br0 resume --detach --no-chdir \
5450 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5451
5452 # Run a packet through the switch.
5453 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5454
5455 # Check flow stats
5456 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5457 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
5458 cookie=0x0, duration=0.0s, table=2, n_packets=1, n_bytes=106, idle_age=0, ct_state=+new+trk,icmp,in_port=1 actions=output:2
5459 ])
5460
5461 # The packet should be received by port 2
5462 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5463
5464 OVS_VSWITCHD_STOP
5465 AT_CLEANUP
5466
5467 AT_SETUP([ofproto-dpif - continuation with patch port])
5468 AT_KEYWORDS([continuations pause resume])
5469 OVS_VSWITCHD_START(
5470 [add-port br0 p0 -- set Interface p0 type=dummy -- \
5471 add-port br0 patch- -- \
5472 set interface patch- type=patch options:peer=patch+ -- \
5473 add-br br1 -- set bridge br1 datapath-type=dummy fail-mode=secure -- \
5474 add-port br1 patch+ -- set interface patch+ type=patch options:peer=patch-
5475 ])
5476 add_of_ports --pcap br1 1
5477
5478 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)"
5479
5480 AT_DATA([flows.txt], [dnl
5481 table=0, in_port=patch+ icmp action=controller(pause), resubmit(,1)
5482 table=1, in_port=patch+ icmp action=ct(table=2)
5483 table=2, in_port=patch+ icmp ct_state=+trk+new action=ct(commit, table=3)
5484 table=3, in_port=patch+ icmp action=p1
5485 ])
5486
5487 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5488 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br1 flows.txt])
5489
5490 AT_CAPTURE_FILE([ofctl_monitor.log])
5491 ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl.pid 2> ofctl_monitor.log
5492
5493 # Run a packet through the switch.
5494 AT_CHECK([ovs-appctl netdev-dummy/receive p0 "$flow"], [0], [stdout])
5495
5496 # Check flow stats
5497 AT_CHECK([ovs-ofctl dump-flows br1], [0], [stdout])
5498 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=3' | grep -v 'commit'], [0], [dnl
5499 cookie=0x0, duration=0.0s, table=3, n_packets=1, n_bytes=106, idle_age=0, icmp,in_port=1 actions=output:2
5500 ])
5501
5502 # The packet should be received by port 1
5503 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p1-tx.pcap | wc -l`])
5504
5505 OVS_VSWITCHD_STOP
5506 AT_CLEANUP
5507
5508 # Check that pause works after the packet is cloned.
5509 AT_SETUP([ofproto-dpif - continuation after clone])
5510 AT_KEYWORDS([continuations clone pause resume])
5511 OVS_VSWITCHD_START
5512
5513 add_of_ports --pcap br0 `seq 1 3`
5514
5515 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)"
5516
5517 AT_DATA([flows.txt], [dnl
5518 table=0 in_port=1 actions=set_field:1->reg1 resubmit(,2)
5519 table=1 reg1=0x5 actions=controller(pause) resubmit(,3)
5520 table=1 reg1=0x1 actions=2
5521 table=2 in_port=1 actions=clone(set_field:5->reg1, resubmit(,1))
5522 table=3 reg1=0x1 actions=3
5523 table=3 reg1=0x5 actions=2
5524 ])
5525
5526 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5527
5528 AT_CAPTURE_FILE([ofctl_monitor0.log])
5529 ovs-ofctl monitor br0 resume --detach --no-chdir \
5530 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5531
5532 # Run a packet through the switch.
5533 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5534
5535 ovs-vsctl show
5536 ovs-ofctl dump-flows br0
5537
5538 # The packet should be received by port 2 and not port 3
5539 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5540 AT_CHECK([test 0 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p3-tx.pcap | wc -l`])
5541
5542 # NXT_RESUMEs should be 1 and reg1 should be set to 0x5.
5543 OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor*.log | grep NXT_RESUME | grep -c reg1=0x5`])
5544
5545 OVS_VSWITCHD_STOP
5546 AT_CLEANUP
5547
5548 # Two testcases below are for the ofproto/trace command
5549 # The first one tests all correct syntax:
5550 # ofproto/trace [dp_name] odp_flow [-generate|packet]
5551 # ofproto/trace br_name br_flow [-generate|packet]
5552 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
5553 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5554 add_of_ports br0 1 2 3
5555
5556 AT_DATA([flows.txt], [dnl
5557 in_port=1 actions=output:2
5558 in_port=2 actions=output:1
5559 ])
5560 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5561
5562 odp_flow="in_port(p1)"
5563 br_flow="in_port=1"
5564 # Test command: ofproto/trace odp_flow with in_port as a name.
5565 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5566 AT_CHECK([tail -1 stdout], [0], [dnl
5567 Datapath actions: 2
5568 ])
5569
5570 odp_flow="in_port(1)"
5571 # Test command: ofproto/trace odp_flow
5572 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5573 AT_CHECK([tail -1 stdout], [0], [dnl
5574 Datapath actions: 2
5575 ])
5576
5577 # Test command: ofproto/trace dp_name odp_flow
5578 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
5579 AT_CHECK([tail -1 stdout], [0], [dnl
5580 Datapath actions: 2
5581 ])
5582 # Test commmand: ofproto/trace br_name br_flow
5583 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5584 AT_CHECK([tail -1 stdout], [0], [dnl
5585 Datapath actions: 2
5586 ])
5587
5588 # Delete the inserted flows
5589 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
5590 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
5591
5592 # This section below tests the [-generate] option
5593 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
5594 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"
5595
5596 # Test command: ofproto/trace odp_flow
5597 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5598 # Check for no MAC learning entry
5599 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5600 port VLAN MAC Age
5601 ])
5602
5603 # Test command: ofproto/trace br_name br_flow
5604 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5605 # Check for no MAC learning entry
5606 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5607 port VLAN MAC Age
5608 ])
5609
5610 # Test command: ofproto/trace odp_flow -generate
5611 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
5612 # Check for the MAC learning entry
5613 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5614 port VLAN MAC Age
5615 3 0 50:54:00:00:00:05 ?
5616 ])
5617
5618 # Test command: ofproto/trace dp_name odp_flow -generate
5619 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5620 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
5621 -generate], [0], [stdout])
5622 # Check for both MAC learning entries
5623 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5624 port VLAN MAC Age
5625 3 0 50:54:00:00:00:05 ?
5626 1 0 50:54:00:00:00:06 ?
5627 ])
5628
5629 # Test command: ofproto/trace br_name br_flow -generate
5630 AT_CHECK([ovs-appctl ofproto/trace br0 \
5631 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
5632 -generate], [0], [stdout])
5633 # Check for both MAC learning entries.
5634 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5635 port VLAN MAC Age
5636 3 0 50:54:00:00:00:05 ?
5637 1 0 50:54:00:00:00:06 ?
5638 2 0 50:54:00:00:00:07 ?
5639 ])
5640
5641 # This section beflow tests the [packet] option
5642 # The ovs-tcpundump of packets between port1 and port2
5643 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5644 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
5645
5646 # Construct the MAC learning table
5647 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5648 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
5649 -generate], [0], [stdout])
5650
5651 # Construct the MAC learning table
5652 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5653 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
5654 -generate], [0], [stdout])
5655
5656 # Test command: ofproto/trace odp_flow packet
5657 AT_CHECK([ovs-appctl ofproto/trace \
5658 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5659 AT_CHECK([tail -1 stdout], [0], [dnl
5660 Datapath actions: 2
5661 ])
5662 AT_CHECK([head -n 3 stdout], [0], [dnl
5663 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
5664
5665 bridge("br0")
5666 ])
5667
5668 # Test command: ofproto/trace dp_name odp_flow packet
5669 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5670 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5671 AT_CHECK([tail -1 stdout], [0], [dnl
5672 Datapath actions: 2
5673 ])
5674 AT_CHECK([head -n 3 stdout], [0], [dnl
5675 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
5676
5677 bridge("br0")
5678 ])
5679
5680 # Test command: ofproto/trace br_name br_flow packet
5681 AT_CHECK([ovs-appctl ofproto/trace br0 \
5682 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
5683 AT_CHECK([tail -1 stdout], [0], [dnl
5684 Datapath actions: 1
5685 ])
5686 AT_CHECK([head -n 3 stdout], [0], [dnl
5687 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
5688
5689 bridge("br0")
5690 ])
5691
5692 OVS_VSWITCHD_STOP
5693 AT_CLEANUP
5694
5695 # The second test tests the corner cases
5696 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
5697 OVS_VSWITCHD_START
5698 add_of_ports br0 1 2
5699
5700 # Define flows
5701 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
5702 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
5703 # Define options
5704 generate="-generate"
5705 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5706
5707 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
5708 m4_foreach(
5709 [option],
5710 [[],
5711 ["$generate"],
5712 ["$pkt"]],
5713 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
5714 [2], [], [stderr])
5715 AT_CHECK([tail -2 stderr], [0], [dnl
5716 Cannot find the datapath
5717 ovs-appctl: ovs-vswitchd: server returned an error
5718 ])])
5719
5720 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
5721 m4_foreach(
5722 [option],
5723 [[],
5724 ["$generate"],
5725 ["$pkt"]],
5726 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
5727 [2], [], [stderr])
5728 AT_CHECK([tail -2 stderr], [0], [dnl
5729 Cannot find the datapath
5730 ovs-appctl: ovs-vswitchd: server returned an error
5731 ])])
5732
5733 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
5734 m4_foreach(
5735 [option],
5736 [[],
5737 ["$generate"],
5738 ["$pkt"]],
5739 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
5740 [2], [], [stderr])
5741 AT_CHECK([tail -2 stderr], [0], [dnl
5742 Cannot find the datapath
5743 ovs-appctl: ovs-vswitchd: server returned an error
5744 ])])
5745
5746 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
5747 m4_foreach(
5748 [option],
5749 [[],
5750 ["$generate"],
5751 ["$pkt"]],
5752 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
5753 [2], [], [stderr])
5754 AT_CHECK([tail -2 stderr], [0], [dnl
5755 Cannot find the datapath
5756 ovs-appctl: ovs-vswitchd: server returned an error
5757 ])])
5758
5759 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
5760 m4_foreach(
5761 [option],
5762 [[],
5763 ["$generate"],
5764 ["$pkt"]],
5765 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
5766 [2], [], [stderr])
5767 AT_CHECK([tail -2 stderr], [0], [dnl
5768 ovs-dummy: unknown bridge
5769 ovs-appctl: ovs-vswitchd: server returned an error
5770 ])])
5771
5772 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
5773 m4_foreach(
5774 [option],
5775 [[],
5776 ["$generate"],
5777 ["$pkt"]],
5778 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
5779 [2], [], [stderr])
5780 AT_CHECK([tail -2 stderr], [0], [dnl
5781 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)
5782 ovs-appctl: ovs-vswitchd: server returned an error
5783 ])])
5784
5785 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
5786 AT_CHECK([ovs-appctl ofproto/trace \
5787 ovs-dummy "$odp_flow" garbage_option],
5788 [2], [stdout],[stderr])
5789 AT_CHECK([tail -2 stderr], [0], [dnl
5790 Trailing garbage in packet data
5791 ovs-appctl: ovs-vswitchd: server returned an error
5792 ])
5793
5794 # Test incorrect command: ofproto/trace with 0 argument
5795 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
5796 AT_CHECK([tail -2 stderr], [0], [dnl
5797 "ofproto/trace" command requires at least 1 arguments
5798 ovs-appctl: ovs-vswitchd: server returned an error
5799 ])
5800
5801 OVS_VSWITCHD_STOP
5802 AT_CLEANUP
5803
5804 # The third test checks that the output of "ovs-dpctl -m" is valid to trace.
5805 AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
5806 OVS_VSWITCHD_START([dnl
5807 set Open_vSwitch . other_config:max-idle=10000 \
5808 -- add-port br0 p1 -- set Interface p1 type=dummy])
5809
5810 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)'])
5811 ovs-appctl revalidator/wait
5812 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
5813
5814 odp_flow=`cat dp_flows1.txt`
5815 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5816 Flow: <cleared>
5817
5818 bridge("br0")
5819 -------------
5820 0. No match.
5821 drop
5822
5823 Final flow: <cleared>
5824 Megaflow: <cleared>
5825 Datapath actions: drop
5826 ])
5827
5828 dnl Now, try again without megaflows:
5829 ovs-appctl upcall/disable-megaflows
5830
5831 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)'])
5832 ovs-appctl revalidator/wait
5833 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
5834
5835 odp_flow=`cat dp_flows2.txt`
5836 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5837 Flow: <cleared>
5838
5839 bridge("br0")
5840 -------------
5841 0. No match.
5842 drop
5843
5844 Final flow: <cleared>
5845 Megaflow: <cleared>
5846 Datapath actions: drop
5847 ])
5848
5849 OVS_VSWITCHD_STOP
5850 AT_CLEANUP
5851
5852 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
5853 OVS_VSWITCHD_START
5854 add_of_ports br0 1 2 3
5855
5856 AT_DATA([flows.txt], [dnl
5857 in_port=1 actions=output:2
5858 in_port=2 actions=output:1
5859 ])
5860 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5861
5862 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
5863 AT_CHECK([tail -1 stdout], [0], [dnl
5864 Datapath actions: push_vlan(vid=123,pcp=0),2
5865 ])
5866
5867 OVS_VSWITCHD_STOP
5868 AT_CLEANUP
5869
5870
5871 m4_define([OFPROTO_TRACE],
5872 [flow="$2"
5873 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
5874 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5875 expected="$4"
5876 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
5877 [0], [stdout])
5878 mv stdout expout
5879 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
5880 [0], [expout])])
5881
5882 AT_SETUP([ofproto-dpif - MAC learning])
5883 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5884 add_of_ports br0 1 2 3
5885
5886 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)'
5887
5888 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
5889 OFPROTO_TRACE(
5890 [ovs-dummy],
5891 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5892 [-generate],
5893 [1,2,100])
5894
5895 # Check for the MAC learning entry.
5896 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5897 port VLAN MAC Age
5898 3 0 50:54:00:00:00:05 ?
5899 ])
5900
5901 # Trace a packet arrival destined for the learned MAC.
5902 # (This will also learn a MAC.)
5903 OFPROTO_TRACE(
5904 [ovs-dummy],
5905 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
5906 [-generate],
5907 [3])
5908
5909 # Check for both MAC learning entries.
5910 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5911 port VLAN MAC Age
5912 3 0 50:54:00:00:00:05 ?
5913 1 0 50:54:00:00:00:06 ?
5914 ])
5915
5916 # Trace a packet arrival that updates the first learned MAC entry.
5917 OFPROTO_TRACE(
5918 [ovs-dummy],
5919 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5920 [-generate],
5921 [1,3,100])
5922
5923 # Check that the MAC learning entry was updated.
5924 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5925 port VLAN MAC Age
5926 1 0 50:54:00:00:00:06 ?
5927 2 0 50:54:00:00:00:05 ?
5928 ])
5929
5930 # Add another bridge.
5931 AT_CHECK(
5932 [ovs-vsctl \
5933 -- add-br br1 \
5934 -- set bridge br1 datapath-type=dummy])
5935 add_of_ports br1 4 5
5936
5937 # Trace some packet arrivals in br1 to create MAC learning entries there too.
5938 OFPROTO_TRACE(
5939 [ovs-dummy],
5940 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
5941 [-generate],
5942 [5,101])
5943 OFPROTO_TRACE(
5944 [ovs-dummy],
5945 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
5946 [-generate],
5947 [4,101])
5948
5949 # Check that the MAC learning entries were added.
5950 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5951 port VLAN MAC Age
5952 4 0 50:54:00:00:00:06 ?
5953 5 0 50:54:00:00:00:07 ?
5954 ])
5955
5956 # Delete port p1 and see that its MAC learning entry disappeared, and
5957 # that the MAC learning entry for the same MAC was also deleted from br1.
5958 AT_CHECK([ovs-vsctl del-port p1])
5959 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5960 port VLAN MAC Age
5961 2 0 50:54:00:00:00:05 ?
5962 ])
5963 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5964 port VLAN MAC Age
5965 5 0 50:54:00:00:00:07 ?
5966 ])
5967
5968 OVS_VSWITCHD_STOP
5969 AT_CLEANUP
5970
5971 AT_SETUP([ofproto-dpif - MAC table overflow])
5972 OVS_VSWITCHD_START(
5973 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
5974 add_of_ports br0 1 2 3
5975
5976 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)'
5977
5978 AT_CHECK([ovs-appctl time/stop])
5979
5980 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
5981 for i in 0 1 2 3 4 5 6 7 8 9; do
5982 OFPROTO_TRACE(
5983 [ovs-dummy],
5984 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
5985 [-generate],
5986 [1,2,100])
5987 ovs-appctl time/warp 1000
5988 done
5989
5990 # Check for the MAC learning entries.
5991 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5992 [0], [dnl
5993 3 0 50:54:00:00:00:00
5994 3 0 50:54:00:00:00:01
5995 3 0 50:54:00:00:00:02
5996 3 0 50:54:00:00:00:03
5997 3 0 50:54:00:00:00:04
5998 3 0 50:54:00:00:00:05
5999 3 0 50:54:00:00:00:06
6000 3 0 50:54:00:00:00:07
6001 3 0 50:54:00:00:00:08
6002 3 0 50:54:00:00:00:09
6003 port VLAN MAC Age
6004 ])
6005
6006 # Trace another ARP packet on another MAC.
6007 OFPROTO_TRACE(
6008 [ovs-dummy],
6009 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
6010 [-generate],
6011 [1,2,100])
6012
6013 # Check that the new one chased the oldest one out of the table.
6014 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
6015 [0], [dnl
6016 3 0 50:54:00:00:00:01 ?
6017 3 0 50:54:00:00:00:02 ?
6018 3 0 50:54:00:00:00:03 ?
6019 3 0 50:54:00:00:00:04 ?
6020 3 0 50:54:00:00:00:05 ?
6021 3 0 50:54:00:00:00:06 ?
6022 3 0 50:54:00:00:00:07 ?
6023 3 0 50:54:00:00:00:08 ?
6024 3 0 50:54:00:00:00:09 ?
6025 3 0 50:54:00:00:00:10 ?
6026 port VLAN MAC Age
6027 ])
6028 OVS_VSWITCHD_STOP
6029 AT_CLEANUP
6030
6031 AT_SETUP([ofproto-dpif - MAC table overflow fairness])
6032 OVS_VSWITCHD_START(
6033 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
6034 add_of_ports br0 1 2 3 4 5 6
6035
6036 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)'
6037
6038 AT_CHECK([ovs-appctl time/stop])
6039
6040 # Trace packets with 2 different source MACs arriving on each of the 5
6041 # ports, filling up the 10-entry learning table.
6042 for i in 0 1 2 3 4 5 6 7 8 9; do
6043 p=`expr $i / 2 + 1`
6044 ovs-appctl ofproto/trace ovs-dummy "in_port($p),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp" -generate
6045 ovs-appctl time/warp 1000
6046 done
6047
6048 # Check for the MAC learning entries.
6049 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
6050 [0], [dnl
6051 1 0 50:54:00:00:00:00
6052 1 0 50:54:00:00:00:01
6053 2 0 50:54:00:00:00:02
6054 2 0 50:54:00:00:00:03
6055 3 0 50:54:00:00:00:04
6056 3 0 50:54:00:00:00:05
6057 4 0 50:54:00:00:00:06
6058 4 0 50:54:00:00:00:07
6059 5 0 50:54:00:00:00:08
6060 5 0 50:54:00:00:00:09
6061 port VLAN MAC Age
6062 ])
6063
6064 # Now trace 16 new MACs on another port.
6065 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
6066 ovs-appctl ofproto/trace ovs-dummy "in_port(6),eth(src=50:54:00:00:0$i:ff,dst=ff:ff:ff:ff:ff:ff),$arp" -generate
6067 ovs-appctl time/warp 1000
6068 done
6069
6070 # Check the results.
6071 #
6072 # Our eviction algorithm on overflow is that an arbitrary (but deterministic)
6073 # one of the ports with the most learned MACs loses the least recently used
6074 # one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
6075 # MAC each, and the other 2 of the old ports with 2 MACs each.
6076 #
6077 # (If someone changes lib/heap.c to do something different with equal-priority
6078 # nodes, then the output below could change, but it would still follow the
6079 # rules explained above.)
6080 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
6081 [0], [dnl
6082 1 0 50:54:00:00:00:01
6083 2 0 50:54:00:00:00:03
6084 3 0 50:54:00:00:00:04
6085 3 0 50:54:00:00:00:05
6086 4 0 50:54:00:00:00:07
6087 5 0 50:54:00:00:00:08
6088 5 0 50:54:00:00:00:09
6089 6 0 50:54:00:00:0d:ff
6090 6 0 50:54:00:00:0e:ff
6091 6 0 50:54:00:00:0f:ff
6092 port VLAN MAC Age
6093 ])
6094 OVS_VSWITCHD_STOP
6095 AT_CLEANUP
6096
6097 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
6098 #
6099 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
6100 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
6101 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6102 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6103
6104 on_exit 'kill `cat test-sflow.pid`'
6105 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
6106 AT_CAPTURE_FILE([sflow.log])
6107 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6108 ovs-appctl time/stop
6109
6110 add_of_ports br0 1 2
6111 ovs-vsctl \
6112 set Interface br0 options:ifindex=1002 -- \
6113 set Interface p1 options:ifindex=1004 -- \
6114 set Interface p2 options:ifindex=1003 -- \
6115 set Bridge br0 sflow=@sf -- \
6116 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
6117 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
6118
6119 dnl open with ARP packets to seed the bridge-learning. The output
6120 dnl ifIndex numbers should be reported predictably after that.
6121 dnl Since we set sampling=1 we should see all of these packets
6122 dnl reported. Sorting the output by data-source and seqNo makes
6123 dnl it deterministic. Ensuring that we send at least two packets
6124 dnl into each port means we get to check the seq nos are
6125 dnl incrementing correctly.
6126 dnl because packets from different ports can be handled by separate
6127 dnl threads, put some sleeps
6128
6129 ovs-appctl netdev-dummy/receive p1 'in_port(2),eth(src=50:54:00:00:00:05,dst=FF:FF:FF:FF:FF:FF),eth_type(0x0806),arp(sip=192.168.0.2,tip=192.168.0.1,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
6130 sleep 1
6131 ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=FF:FF:FF:FF:FF:FF),eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:07,tha=00:00:00:00:00:00)'
6132 sleep 1
6133 ovs-appctl netdev-dummy/receive p1 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
6134 sleep 1
6135 ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)'
6136 ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x86dd),ipv6(src=fe80::1,dst=fe80::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)'
6137
6138 dnl sleep long enough to get more than one counter sample
6139 dnl from each datasource so we can check sequence numbers
6140 ovs-appctl time/warp 2000 100
6141 OVS_VSWITCHD_STOP
6142 OVS_APP_EXIT_AND_WAIT([test-sflow])
6143
6144 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6145 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
6146 HEADER
6147 dgramSeqNo=1
6148 ds=127.0.0.1>2:1000
6149 fsSeqNo=1
6150 in_vlan=0
6151 in_priority=0
6152 out_vlan=0
6153 out_priority=0
6154 meanSkip=1
6155 samplePool=1
6156 dropEvents=0
6157 in_ifindex=1004
6158 in_format=0
6159 out_ifindex=2
6160 out_format=2
6161 hdr_prot=1
6162 pkt_len=46
6163 stripped=4
6164 hdr_len=42
6165 hdr=FF-FF-FF-FF-FF-FF-50-54-00-00-00-05-08-06-00-01-08-00-06-04-00-01-50-54-00-00-00-05-C0-A8-00-02-00-00-00-00-00-00-C0-A8-00-01
6166 HEADER
6167 dgramSeqNo=1
6168 ds=127.0.0.1>2:1000
6169 fsSeqNo=2
6170 in_vlan=0
6171 in_priority=0
6172 out_vlan=0
6173 out_priority=0
6174 meanSkip=1
6175 samplePool=2
6176 dropEvents=0
6177 in_ifindex=1003
6178 in_format=0
6179 out_ifindex=2
6180 out_format=2
6181 hdr_prot=1
6182 pkt_len=46
6183 stripped=4
6184 hdr_len=42
6185 hdr=FF-FF-FF-FF-FF-FF-50-54-00-00-00-07-08-06-00-01-08-00-06-04-00-01-50-54-00-00-00-07-C0-A8-00-01-00-00-00-00-00-00-C0-A8-00-02
6186 HEADER
6187 dgramSeqNo=1
6188 ds=127.0.0.1>2:1000
6189 fsSeqNo=3
6190 in_vlan=0
6191 in_priority=0
6192 out_vlan=0
6193 out_priority=0
6194 meanSkip=1
6195 samplePool=3
6196 dropEvents=0
6197 in_ifindex=1004
6198 in_format=0
6199 out_ifindex=1003
6200 out_format=0
6201 hdr_prot=1
6202 pkt_len=110
6203 stripped=4
6204 hdr_len=106
6205 hdr=50-54-00-00-00-07-50-54-00-00-00-05-08-00-45-00-00-5C-00-00-00-00-40-01-F9-4D-C0-A8-00-01-C0-A8-00-02-08-00-13-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
6206 HEADER
6207 dgramSeqNo=1
6208 ds=127.0.0.1>2:1000
6209 fsSeqNo=4
6210 in_vlan=0
6211 in_priority=0
6212 out_vlan=0
6213 out_priority=0
6214 meanSkip=1
6215 samplePool=4
6216 dropEvents=0
6217 in_ifindex=1003
6218 in_format=0
6219 out_ifindex=1004
6220 out_format=0
6221 hdr_prot=1
6222 pkt_len=110
6223 stripped=4
6224 hdr_len=106
6225 hdr=50-54-00-00-00-05-50-54-00-00-00-07-08-00-45-00-00-5C-00-00-00-00-40-01-F9-4D-C0-A8-00-02-C0-A8-00-01-00-00-1B-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
6226 HEADER
6227 dgramSeqNo=1
6228 ds=127.0.0.1>2:1000
6229 fsSeqNo=5
6230 in_vlan=0
6231 in_priority=0
6232 out_vlan=0
6233 out_priority=0
6234 meanSkip=1
6235 samplePool=5
6236 dropEvents=0
6237 in_ifindex=1003
6238 in_format=0
6239 out_ifindex=1004
6240 out_format=0
6241 hdr_prot=1
6242 pkt_len=58
6243 stripped=4
6244 hdr_len=54
6245 hdr=50-54-00-00-00-05-50-54-00-00-00-07-86-DD-67-00-00-00-00-00-0A-80-FE-80-00-00-00-00-00-00-00-00-00-00-00-00-00-01-FE-80-00-00-00-00-00-00-00-00-00-00-00-00-00-02
6246 ])
6247
6248 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'ETHCOUNTERS|IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -24 | sed 's/ /\
6249 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
6250 ETHCOUNTERS
6251 dot3StatsAlignmentErrors=4294967295
6252 dot3StatsFCSErrors=4294967295
6253 dot3StatsSingleCollisionFrames=4294967295
6254 dot3StatsMultipleCollisionFrames=4294967295
6255 dot3StatsSQETestErrors=4294967295
6256 dot3StatsDeferredTransmissions=4294967295
6257 dot3StatsLateCollisions=4294967295
6258 dot3StatsExcessiveCollisions=4294967295
6259 dot3StatsInternalMacTransmitErrors=4294967295
6260 dot3StatsCarrierSenseErrors=4294967295
6261 dot3StatsFrameTooLongs=4294967295
6262 dot3StatsInternalMacReceiveErrors=4294967295
6263 dot3StatsSymbolErrors=4294967295
6264 ETHCOUNTERS
6265 dot3StatsAlignmentErrors=4294967295
6266 dot3StatsFCSErrors=4294967295
6267 dot3StatsSingleCollisionFrames=4294967295
6268 dot3StatsMultipleCollisionFrames=4294967295
6269 dot3StatsSQETestErrors=4294967295
6270 dot3StatsDeferredTransmissions=4294967295
6271 dot3StatsLateCollisions=4294967295
6272 dot3StatsExcessiveCollisions=4294967295
6273 dot3StatsInternalMacTransmitErrors=4294967295
6274 dot3StatsCarrierSenseErrors=4294967295
6275 dot3StatsFrameTooLongs=4294967295
6276 dot3StatsInternalMacReceiveErrors=4294967295
6277 dot3StatsSymbolErrors=4294967295
6278 ETHCOUNTERS
6279 dot3StatsAlignmentErrors=4294967295
6280 dot3StatsFCSErrors=4294967295
6281 dot3StatsSingleCollisionFrames=4294967295
6282 dot3StatsMultipleCollisionFrames=4294967295
6283 dot3StatsSQETestErrors=4294967295
6284 dot3StatsDeferredTransmissions=4294967295
6285 dot3StatsLateCollisions=4294967295
6286 dot3StatsExcessiveCollisions=4294967295
6287 dot3StatsInternalMacTransmitErrors=4294967295
6288 dot3StatsCarrierSenseErrors=4294967295
6289 dot3StatsFrameTooLongs=4294967295
6290 dot3StatsInternalMacReceiveErrors=4294967295
6291 dot3StatsSymbolErrors=4294967295
6292 ETHCOUNTERS
6293 dot3StatsAlignmentErrors=4294967295
6294 dot3StatsFCSErrors=4294967295
6295 dot3StatsSingleCollisionFrames=4294967295
6296 dot3StatsMultipleCollisionFrames=4294967295
6297 dot3StatsSQETestErrors=4294967295
6298 dot3StatsDeferredTransmissions=4294967295
6299 dot3StatsLateCollisions=4294967295
6300 dot3StatsExcessiveCollisions=4294967295
6301 dot3StatsInternalMacTransmitErrors=4294967295
6302 dot3StatsCarrierSenseErrors=4294967295
6303 dot3StatsFrameTooLongs=4294967295
6304 dot3StatsInternalMacReceiveErrors=4294967295
6305 dot3StatsSymbolErrors=4294967295
6306 ETHCOUNTERS
6307 dot3StatsAlignmentErrors=4294967295
6308 dot3StatsFCSErrors=4294967295
6309 dot3StatsSingleCollisionFrames=4294967295
6310 dot3StatsMultipleCollisionFrames=4294967295
6311 dot3StatsSQETestErrors=4294967295
6312 dot3StatsDeferredTransmissions=4294967295
6313 dot3StatsLateCollisions=4294967295
6314 dot3StatsExcessiveCollisions=4294967295
6315 dot3StatsInternalMacTransmitErrors=4294967295
6316 dot3StatsCarrierSenseErrors=4294967295
6317 dot3StatsFrameTooLongs=4294967295
6318 dot3StatsInternalMacReceiveErrors=4294967295
6319 dot3StatsSymbolErrors=4294967295
6320 ETHCOUNTERS
6321 dot3StatsAlignmentErrors=4294967295
6322 dot3StatsFCSErrors=4294967295
6323 dot3StatsSingleCollisionFrames=4294967295
6324 dot3StatsMultipleCollisionFrames=4294967295
6325 dot3StatsSQETestErrors=4294967295
6326 dot3StatsDeferredTransmissions=4294967295
6327 dot3StatsLateCollisions=4294967295
6328 dot3StatsExcessiveCollisions=4294967295
6329 dot3StatsInternalMacTransmitErrors=4294967295
6330 dot3StatsCarrierSenseErrors=4294967295
6331 dot3StatsFrameTooLongs=4294967295
6332 dot3StatsInternalMacReceiveErrors=4294967295
6333 dot3StatsSymbolErrors=4294967295
6334 IFCOUNTERS
6335 dgramSeqNo=1
6336 ds=127.0.0.1>0:1003
6337 csSeqNo=1
6338 ifindex=1003
6339 type=6
6340 ifspeed=100000000
6341 direction=0
6342 status=3
6343 in_octets=202
6344 in_unicasts=3
6345 in_multicasts=4294967295
6346 in_broadcasts=4294967295
6347 in_discards=4294967295
6348 in_errors=4294967295
6349 in_unknownprotos=4294967295
6350 out_octets=148
6351 out_unicasts=2
6352 out_multicasts=4294967295
6353 out_broadcasts=4294967295
6354 out_discards=4294967295
6355 out_errors=4294967295
6356 promiscuous=0
6357 IFCOUNTERS
6358 dgramSeqNo=1
6359 ds=127.0.0.1>0:1004
6360 csSeqNo=1
6361 ifindex=1004
6362 type=6
6363 ifspeed=100000000
6364 direction=0
6365 status=3
6366 in_octets=148
6367 in_unicasts=2
6368 in_multicasts=4294967295
6369 in_broadcasts=4294967295
6370 in_discards=4294967295
6371 in_errors=4294967295
6372 in_unknownprotos=4294967295
6373 out_octets=202
6374 out_unicasts=3
6375 out_multicasts=4294967295
6376 out_broadcasts=4294967295
6377 out_discards=4294967295
6378 out_errors=4294967295
6379 promiscuous=0
6380 IFCOUNTERS
6381 dgramSeqNo=2
6382 ds=127.0.0.1>0:1002
6383 csSeqNo=1
6384 ifindex=1002
6385 type=6
6386 ifspeed=100000000
6387 direction=0
6388 status=3
6389 in_octets=0
6390 in_unicasts=0
6391 in_multicasts=4294967295
6392 in_broadcasts=4294967295
6393 in_discards=4294967295
6394 in_errors=4294967295
6395 in_unknownprotos=4294967295
6396 out_octets=84
6397 out_unicasts=2
6398 out_multicasts=4294967295
6399 out_broadcasts=4294967295
6400 out_discards=4294967295
6401 out_errors=4294967295
6402 promiscuous=0
6403 IFCOUNTERS
6404 dgramSeqNo=3
6405 ds=127.0.0.1>0:1002
6406 csSeqNo=2
6407 ifindex=1002
6408 type=6
6409 ifspeed=100000000
6410 direction=0
6411 status=3
6412 in_octets=0
6413 in_unicasts=0
6414 in_multicasts=4294967295
6415 in_broadcasts=4294967295
6416 in_discards=4294967295
6417 in_errors=4294967295
6418 in_unknownprotos=4294967295
6419 out_octets=84
6420 out_unicasts=2
6421 out_multicasts=4294967295
6422 out_broadcasts=4294967295
6423 out_discards=4294967295
6424 out_errors=4294967295
6425 promiscuous=0
6426 IFCOUNTERS
6427 dgramSeqNo=3
6428 ds=127.0.0.1>0:1003
6429 csSeqNo=2
6430 ifindex=1003
6431 type=6
6432 ifspeed=100000000
6433 direction=0
6434 status=3
6435 in_octets=202
6436 in_unicasts=3
6437 in_multicasts=4294967295
6438 in_broadcasts=4294967295
6439 in_discards=4294967295
6440 in_errors=4294967295
6441 in_unknownprotos=4294967295
6442 out_octets=148
6443 out_unicasts=2
6444 out_multicasts=4294967295
6445 out_broadcasts=4294967295
6446 out_discards=4294967295
6447 out_errors=4294967295
6448 promiscuous=0
6449 IFCOUNTERS
6450 dgramSeqNo=3
6451 ds=127.0.0.1>0:1004
6452 csSeqNo=2
6453 ifindex=1004
6454 type=6
6455 ifspeed=100000000
6456 direction=0
6457 status=3
6458 in_octets=148
6459 in_unicasts=2
6460 in_multicasts=4294967295
6461 in_broadcasts=4294967295
6462 in_discards=4294967295
6463 in_errors=4294967295
6464 in_unknownprotos=4294967295
6465 out_octets=202
6466 out_unicasts=3
6467 out_multicasts=4294967295
6468 out_broadcasts=4294967295
6469 out_discards=4294967295
6470 out_errors=4294967295
6471 promiscuous=0
6472 OPENFLOWPORT
6473 datapath_id=18364758544493064720
6474 port_no=1
6475 OPENFLOWPORT
6476 datapath_id=18364758544493064720
6477 port_no=1
6478 OPENFLOWPORT
6479 datapath_id=18364758544493064720
6480 port_no=2
6481 OPENFLOWPORT
6482 datapath_id=18364758544493064720
6483 port_no=2
6484 OPENFLOWPORT
6485 datapath_id=18364758544493064720
6486 port_no=65534
6487 OPENFLOWPORT
6488 datapath_id=18364758544493064720
6489 port_no=65534
6490 PORTNAME
6491 portName=br0
6492 PORTNAME
6493 portName=br0
6494 PORTNAME
6495 portName=p1
6496 PORTNAME
6497 portName=p1
6498 PORTNAME
6499 portName=p2
6500 PORTNAME
6501 portName=p2
6502 ])])
6503
6504 AT_SETUP([ofproto-dpif - basic truncate action])
6505 OVS_VSWITCHD_START
6506 add_of_ports br0 1 2 3 4 5
6507
6508 AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
6509 AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
6510 AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
6511 AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
6512 AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
6513
6514 AT_DATA([flows.txt], [dnl
6515 in_port=3,actions=drop
6516 in_port=5,actions=drop
6517 in_port=1,actions=output(port=2,max_len=64),output:4
6518 ])
6519 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6520
6521 dnl Datapath actions
6522 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])
6523 AT_CHECK([tail -1 stdout], [0],
6524 [Datapath actions: trunc(64),2,4
6525 ])
6526
6527 dnl An 170 byte packet
6528 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6529
6530 AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
6531 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
6532 ])
6533
6534 AT_CHECK([ovs-appctl revalidator/purge], [0])
6535 dnl packet with truncated size
6536 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6537 n_bytes=64
6538 ])
6539 dnl packet with original size
6540 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6541 n_bytes=170
6542 ])
6543
6544 dnl More complicated case
6545 AT_CHECK([ovs-ofctl del-flows br0])
6546 AT_DATA([flows.txt], [dnl
6547 in_port=3,actions=drop
6548 in_port=5,actions=drop
6549 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
6550 ])
6551 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6552
6553 dnl Datapath actions
6554 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])
6555 AT_CHECK([tail -1 stdout], [0],
6556 [Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
6557 ])
6558
6559 dnl An 170 byte packet
6560 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6561
6562 AT_CHECK([ovs-appctl revalidator/purge], [0])
6563 dnl packet size: 64 + 128 + 170 = 362
6564 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6565 n_bytes=362
6566 ])
6567 dnl packet size: 60 + 170 = 230
6568 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6569 n_bytes=230
6570 ])
6571
6572 dnl syntax checking
6573 AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
6574 ovs-ofctl: output to unsupported truncate port: ALL
6575 ])
6576
6577 OVS_VSWITCHD_STOP
6578 AT_CLEANUP
6579
6580 AT_SETUP([ofproto-dpif - truncate and output to patch port])
6581 OVS_VSWITCHD_START([add-br br1 \
6582 -- set bridge br1 datapath-type=dummy fail-mode=secure \
6583 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 ofport_request=1 \
6584 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6585
6586 add_of_ports br0 2
6587
6588 AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
6589 AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
6590
6591 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6592 [0], [stdout])
6593 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
6594 ])
6595 dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
6596 AT_CHECK([grep "output_trunc does not support patch port [[0-9]]*" stdout], [0], [stdout])
6597
6598 OVS_VSWITCHD_STOP
6599 AT_CLEANUP
6600
6601 AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
6602 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6603 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6604 options:key=5 ofport_request=1\
6605 -- add-port br0 p2 -- set Interface p2 type=dummy \
6606 ofport_request=2])
6607 AT_DATA([flows.txt], [dnl
6608 actions=output(max_len=100, port=1)
6609 ])
6610 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6611 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6612
6613 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
6614 br0 65534/100: (dummy-internal)
6615 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
6616 p2 2/2: (dummy)
6617 ])
6618
6619 dnl Basic
6620 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])
6621 AT_CHECK([tail -1 stdout], [0],
6622 [Datapath actions: trunc(100),set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),1
6623 ])
6624
6625 OVS_VSWITCHD_STOP
6626 AT_CLEANUP
6627
6628 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
6629 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
6630 AT_CLEANUP
6631
6632 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
6633 AT_SKIP_IF([test $HAVE_IPV6 = no])
6634 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
6635 AT_CLEANUP
6636
6637 dnl Test sFlow LAG structures
6638 AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
6639 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
6640 OVS_VSWITCHD_START([dnl
6641 add-bond br0 bond p1 p2 -- \
6642 set Port bond lacp=active bond-mode=active-backup \
6643 other_config:lacp-time="fast" \
6644 other_config:lacp-system-id=11:22:33:44:55:66 \
6645 other_config:lacp-system-priority=54321 -- \
6646 set Interface p1 type=dummy \
6647 other_config:lacp-port-id=11 \
6648 other_config:lacp-port-priority=111 \
6649 other_config:lacp-aggregation-key=3333 -- \
6650 set Interface p2 type=dummy \
6651 other_config:lacp-port-id=22 \
6652 other_config:lacp-port-priority=222 \
6653 other_config:lacp-aggregation-key=3333 ])
6654
6655 on_exit 'kill `cat test-sflow.pid`'
6656 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6657 AT_CAPTURE_FILE([sflow.log])
6658 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6659
6660 ovs-appctl time/stop
6661
6662 ovs-vsctl \
6663 set Interface p1 options:ifindex=1003 -- \
6664 set Bridge br0 sflow=@sf -- \
6665 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6666 header=128 sampling=1 polling=1 agent=127.0.0.1
6667
6668 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6669 AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
6670 AT_CHECK([ovs-appctl revalidator/purge], [0])
6671 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6672 OVS_APP_EXIT_AND_WAIT([test-sflow])
6673 AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
6674 /g']], [0], [dnl
6675 LACPCOUNTERS
6676 sysID=11:22:33:44:55:66
6677 partnerID=00:00:00:00:00:00
6678 aggID=3333
6679 actorAdmin=0x7
6680 actorOper=0xbf
6681 partnerAdmin=0x0
6682 partnerOper=0x2
6683 LACPDUsRx=0
6684 markerPDUsRx=4294967295
6685 markerRespPDUsRx=4294967295
6686 unknownRx=4294967295
6687 illegalRx=0
6688 LACPDUsTx=1
6689 markerPDUsTx=4294967295
6690 markerRespPDUsTx=4294967295
6691 ])
6692
6693 AT_CLEANUP
6694
6695 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
6696 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6697 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6698
6699 dnl set up sFlow logging
6700 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6701 AT_CAPTURE_FILE([sflow.log])
6702 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6703 ovs-appctl time/stop
6704
6705 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6706 AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
6707 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
6708 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
6709
6710 AT_CHECK([ovs-ofctl add-flow br0 action=3])
6711
6712 dnl enable sflow
6713 ovs-vsctl \
6714 set Bridge br0 sflow=@sf -- \
6715 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
6716 header=128 sampling=1 polling=0
6717
6718 dnl introduce a packet that will be flooded to the tunnel
6719 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)'])
6720
6721 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6722 for i in `seq 1 30`; do
6723 ovs-appctl time/warp 100
6724 done
6725
6726 OVS_APP_EXIT_AND_WAIT([test-sflow])
6727
6728 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6729 /g']], [0], [dnl
6730 HEADER
6731 dgramSeqNo=1
6732 ds=127.0.0.1>2:1000
6733 fsSeqNo=1
6734 tunnel4_out_length=0
6735 tunnel4_out_protocol=47
6736 tunnel4_out_src=0.0.0.0
6737 tunnel4_out_dst=1.1.1.1
6738 tunnel4_out_src_port=0
6739 tunnel4_out_dst_port=0
6740 tunnel4_out_tcp_flags=0
6741 tunnel4_out_tos=1
6742 tunnel_out_vni=456
6743 in_vlan=0
6744 in_priority=0
6745 out_vlan=0
6746 out_priority=0
6747 meanSkip=1
6748 samplePool=1
6749 dropEvents=0
6750 in_ifindex=0
6751 in_format=0
6752 out_ifindex=1
6753 out_format=2
6754 hdr_prot=1
6755 pkt_len=110
6756 stripped=4
6757 hdr_len=106
6758 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-08-00-45-01-00-5C-00-00-00-00-80-01-12-8A-0A-0A-0A-02-0A-0A-0A-01-08-00-13-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
6759 ])
6760
6761 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6762 AT_CLEANUP
6763
6764 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
6765 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6766
6767 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
6768
6769 dnl set up sFlow logging
6770 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6771 AT_CAPTURE_FILE([sflow.log])
6772 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6773 ovs-appctl time/stop
6774
6775 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6776 AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
6777 AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
6778 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
6779 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
6780 options:ifindex=2011 ofport_request=5
6781 ], [0])
6782
6783 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6784 dummy@ovs-dummy: hit:0 missed:0
6785 br0:
6786 br0 65534/100: (dummy-internal)
6787 p0 1/1: (dummy: ifindex=1010)
6788 int-br:
6789 int-br 65534/2: (dummy-internal)
6790 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
6791 vm1 5/3: (dummy: ifindex=2011)
6792 ])
6793
6794 dnl set up route to 1.1.2.92 via br0 and action=normal
6795 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
6796 ])
6797 AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
6798 ])
6799 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6800
6801 dnl Prime ARP Cache for 1.1.2.92
6802 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)'])
6803
6804 dnl configure sflow on int-br only
6805 ovs-vsctl \
6806 set Bridge int-br sflow=@sf -- \
6807 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
6808 header=128 sampling=1 polling=0
6809
6810 dnl set up route to 192.168.1.2 via br0
6811 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
6812 ])
6813 AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
6814 ])
6815
6816 dnl add rule for int-br to force packet onto tunnel. There is no ifindex
6817 dnl for this port so the sFlow output will just report that it went to
6818 dnl 1 output (out_format=2, out_ifindex=1)
6819 AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
6820
6821 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)'])
6822
6823 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6824 for i in `seq 1 30`; do
6825 ovs-appctl time/warp 100
6826 done
6827
6828 OVS_APP_EXIT_AND_WAIT([test-sflow])
6829
6830 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6831 /g']], [0], [dnl
6832 HEADER
6833 dgramSeqNo=1
6834 ds=127.0.0.1>2:1000
6835 fsSeqNo=1
6836 tunnel4_out_length=0
6837 tunnel4_out_protocol=47
6838 tunnel4_out_src=1.1.2.88
6839 tunnel4_out_dst=1.1.2.92
6840 tunnel4_out_src_port=0
6841 tunnel4_out_dst_port=0
6842 tunnel4_out_tcp_flags=0
6843 tunnel4_out_tos=0
6844 tunnel_out_vni=456
6845 in_vlan=0
6846 in_priority=0
6847 out_vlan=0
6848 out_priority=0
6849 meanSkip=1
6850 samplePool=1
6851 dropEvents=0
6852 in_ifindex=2011
6853 in_format=0
6854 out_ifindex=1
6855 out_format=2
6856 hdr_prot=1
6857 pkt_len=110
6858 stripped=4
6859 hdr_len=106
6860 hdr=50-54-00-00-00-0A-50-54-00-00-00-05-08-00-45-00-00-5C-00-00-00-00-80-01-B6-4D-C0-A8-01-01-C0-A8-02-02-08-00-13-FC-00-00-00-00-00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F
6861 ])
6862
6863 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6864 AT_CLEANUP
6865
6866 AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
6867 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6868 OVS_VSWITCHD_START
6869 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6870 add_of_ports br0 1 2
6871 AT_DATA([flows.txt], [dnl
6872 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
6873 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6874 ])
6875 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6876
6877 dnl set up sFlow logging
6878 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6879 AT_CAPTURE_FILE([sflow.log])
6880 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6881 ovs-appctl time/stop
6882
6883 dnl configure sflow
6884 ovs-vsctl \
6885 set Bridge br0 sflow=@sf -- \
6886 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
6887 header=128 sampling=1 polling=0
6888
6889 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)'])
6890 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)'])
6891
6892 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6893 for i in `seq 1 30`; do
6894 ovs-appctl time/warp 100
6895 done
6896
6897 OVS_APP_EXIT_AND_WAIT([test-sflow])
6898
6899 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6900 /g']], [0], [dnl
6901 HEADER
6902 dgramSeqNo=1
6903 ds=127.0.0.1>2:1000
6904 fsSeqNo=1
6905 mpls_label_0=789
6906 mpls_tc_0=4
6907 mpls_ttl_0=32
6908 mpls_bos_0=0
6909 mpls_label_1=11
6910 mpls_tc_1=3
6911 mpls_ttl_1=64
6912 mpls_bos_1=1
6913 in_vlan=0
6914 in_priority=0
6915 out_vlan=0
6916 out_priority=0
6917 meanSkip=1
6918 samplePool=1
6919 dropEvents=0
6920 in_ifindex=0
6921 in_format=0
6922 out_ifindex=1
6923 out_format=2
6924 hdr_prot=1
6925 pkt_len=22
6926 stripped=4
6927 hdr_len=18
6928 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40
6929 HEADER
6930 dgramSeqNo=1
6931 ds=127.0.0.1>2:1000
6932 fsSeqNo=2
6933 mpls_label_0=789
6934 mpls_tc_0=4
6935 mpls_ttl_0=32
6936 mpls_bos_0=1
6937 in_vlan=0
6938 in_priority=0
6939 out_vlan=0
6940 out_priority=0
6941 meanSkip=1
6942 samplePool=2
6943 dropEvents=0
6944 in_ifindex=0
6945 in_format=0
6946 out_ifindex=1
6947 out_format=2
6948 hdr_prot=1
6949 pkt_len=38
6950 stripped=4
6951 hdr_len=34
6952 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-08-00-45-00-00-14-00-00-00-00-00-00-BA-EB-00-00-00-00-00-00-00-00
6953 ])
6954
6955 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6956 AT_CLEANUP
6957
6958
6959 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
6960 #
6961 # Test that basic NetFlow reports flow statistics correctly:
6962 # The initial packet of a flow are correctly accounted.
6963 # Later packets within a flow are correctly accounted.
6964 # Flow actions changing (in this case, due to MAC learning)
6965 # cause a record to be sent.
6966 m4_define([CHECK_NETFLOW_EXPIRATION],
6967 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6968 add_of_ports br0 1 2
6969
6970 ovs-appctl time/stop
6971 on_exit 'kill `cat test-netflow.pid`'
6972 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6973 AT_CAPTURE_FILE([netflow.log])
6974 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6975
6976 ovs-vsctl \
6977 set Bridge br0 netflow=@nf -- \
6978 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6979 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6980
6981 for delay in 1000 30000; do
6982 ovs-appctl netdev-dummy/receive p1 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
6983 sleep 1 # ensure the order in which these two packets are processed
6984 ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)'
6985
6986 ovs-appctl time/warp $delay
6987 done
6988
6989 ovs-appctl time/warp 6000
6990 ovs-appctl revalidator/wait
6991 OVS_VSWITCHD_STOP
6992 OVS_APP_EXIT_AND_WAIT([test-netflow])
6993
6994 AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 106 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
6995
6996 AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 2, 1 pkts, 106 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
6997
6998 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 212 bytes, ICMP 0:0" netflow.log | wc -l`
6999 separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 106 bytes, ICMP 0:0" netflow.log | wc -l`
7000 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
7001
7002 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
7003 CHECK_NETFLOW_EXPIRATION([127.0.0.1])
7004 AT_CLEANUP
7005
7006 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
7007 AT_SKIP_IF([test $HAVE_IPV6 = no])
7008 CHECK_NETFLOW_EXPIRATION([[[::1]]])
7009 AT_CLEANUP
7010
7011 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
7012 #
7013 # Test that basic NetFlow reports active expirations correctly.
7014 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
7015 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
7016 add_of_ports br0 1 2
7017
7018 on_exit 'kill `cat test-netflow.pid`'
7019 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
7020 AT_CAPTURE_FILE([netflow.log])
7021 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
7022
7023 ovs-vsctl \
7024 set Bridge br0 netflow=@nf -- \
7025 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
7026 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
7027
7028 AT_CHECK([ovs-appctl time/stop])
7029 n=1
7030 while test $n -le 60; do
7031 n=`expr $n + 1`
7032
7033 ovs-appctl netdev-dummy/receive p1 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=1234,dst=80)'
7034 ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=1234)'
7035
7036 ovs-appctl time/warp 1000
7037 done
7038
7039 ovs-appctl time/warp 10000
7040
7041 ovs-appctl revalidator/wait
7042 OVS_VSWITCHD_STOP
7043 OVS_APP_EXIT_AND_WAIT([test-netflow])
7044
7045 # Count the number of reported packets:
7046 # - From source to destination before MAC learning kicks in (just one).
7047 # - From source to destination after that.
7048 # - From destination to source.
7049 n_learn=0
7050 n_in=0
7051 n_out=0
7052 n_other=0
7053 n_recs=0
7054 none=0
7055 while read line; do
7056 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
7057 case $pkts in
7058 [[0-9]]*) ;;
7059 *) continue ;;
7060 esac
7061
7062 case $line in
7063 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
7064 counter=n_learn
7065 ;;
7066 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
7067 counter=n_in
7068 ;;
7069 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
7070 counter=n_out
7071 ;;
7072 *)
7073 counter=n_other
7074 ;;
7075 esac
7076 eval $counter=\`expr \$$counter + \$pkts\`
7077 n_recs=`expr $n_recs + 1`
7078 done < netflow.log
7079
7080 # There should be exactly 1 MAC learning packet,
7081 # exactly 59 other packets in that direction,
7082 # and exactly 60 packets in the other direction.
7083 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
7084 ])])
7085
7086 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
7087 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
7088 AT_CLEANUP
7089
7090 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
7091 AT_SKIP_IF([test $HAVE_IPV6 = no])
7092 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
7093 AT_CLEANUP
7094
7095 dnl In the absence of an IPFIX collector to verify protocol correctness, simply
7096 dnl configure bridge IPFIX and ensure that sample action generation works at the
7097 dnl datapath level.
7098 AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
7099 OVS_VSWITCHD_START
7100 add_of_ports br0 1 2
7101
7102 dnl Sample every packet using bridge-based sampling.
7103 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7104 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7105 sampling=1], [0], [ignore])
7106
7107 dnl Send some packets that should be sampled.
7108 for i in `seq 1 3`; do
7109 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])
7110 done
7111 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7112 flow-dump from the main thread:
7113 packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))
7114 ])
7115
7116 AT_CHECK([ovs-appctl revalidator/purge])
7117 dnl
7118 dnl Add a slowpath meter. The userspace action should be metered.
7119 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])
7120
7121 dnl Send some packets that should be sampled and metered.
7122 for i in `seq 1 3`; do
7123 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])
7124 done
7125 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7126 flow-dump from the main thread:
7127 packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))
7128 ])
7129
7130 dnl Remove the IPFIX configuration.
7131 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7132 AT_CHECK([ovs-appctl revalidator/purge])
7133
7134 dnl Send some more packets, to ensure that these are not sampled.
7135 for i in `seq 1 3`; do
7136 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])
7137 done
7138 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7139 flow-dump from the main thread:
7140 packets:2, bytes:68, used:0.001s, actions:drop
7141 ])
7142
7143 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7144 AT_CLEANUP
7145
7146 dnl Bridge IPFIX statistics check
7147 AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
7148 OVS_VSWITCHD_START
7149 add_of_ports br0 1 2
7150
7151 dnl Negative test check.
7152 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7153 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7154 NXST_IPFIX_BRIDGE request (xid=0x2):
7155 ])
7156
7157 dnl Sample every packet using bridge-based sampling.
7158 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7159 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7160 sampling=1], [0], [ignore])
7161
7162 dnl Send some packets that should be sampled.
7163 for i in `seq 1 20`; do
7164 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])
7165 done
7166
7167 dnl There are 4 extra IPFIX template packets.
7168 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
7169 NXST_IPFIX_BRIDGE reply (xid=0x2):
7170 bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7171 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
7172 ])
7173
7174 dnl Remove the IPFIX configuration.
7175 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7176 AT_CHECK([ovs-appctl revalidator/purge])
7177
7178 dnl Send some more packets, to ensure that these are not sampled.
7179 for i in `seq 1 2`; do
7180 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])
7181 done
7182 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7183 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7184 NXST_IPFIX_BRIDGE request (xid=0x2):
7185 ])
7186
7187 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7188 AT_CLEANUP
7189
7190 dnl Flow IPFIX sanity check
7191 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
7192 OVS_VSWITCHD_START
7193 add_of_ports br0 1 2
7194
7195 # Check for regression against a bug where an invalid target caused an
7196 # assertion failure and a crash.
7197 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7198 -- --id=@ipfix create IPFIX targets=\"xyzzy\" \
7199 -- --id=@cs create Flow_Sample_Collector_Set id=0 bridge=@br0 ipfix=@ipfix],
7200 [0], [ignore])
7201
7202 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7203 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7204 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7205 [0], [ignore])
7206
7207 AT_DATA([flows.txt], [dnl
7208 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7209 ])
7210
7211 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7212
7213 dnl Send some packets that should be sampled.
7214 for i in `seq 1 3`; do
7215 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])
7216 done
7217 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7218 flow-dump from the main thread:
7219 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
7220 ])
7221
7222 dnl Remove the flow which contains sample action.
7223 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7224 AT_CHECK([ovs-appctl revalidator/purge])
7225
7226 dnl Send some more packets, to ensure that these are not sampled.
7227 for i in `seq 1 3`; do
7228 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])
7229 done
7230 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7231 flow-dump from the main thread:
7232 packets:2, bytes:68, used:0.001s, actions:drop
7233 ])
7234
7235 OVS_VSWITCHD_STOP(["/sending to collector failed/d
7236 /xyzzy/d
7237 /no collectors/d"])
7238 AT_CLEANUP
7239
7240 dnl Flow IPFIX sanity check for tunnel set
7241 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
7242 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
7243 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
7244 options:key=5 ofport_request=1\
7245 -- add-port br0 p2 -- set Interface p2 type=stt \
7246 options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
7247 options:key=6 ofport_request=2\
7248 -- add-port br0 p3 -- set Interface p3 type=dummy \
7249 ofport_request=3 \
7250 -- --id=@br0 get Bridge br0 \
7251 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7252 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7253 [<0>
7254 <1>
7255 ])
7256
7257 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
7258
7259 dnl Add openflow sample action without sampling_port.
7260 AT_DATA([flows.txt], [dnl
7261 in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
7262 ])
7263 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7264
7265 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])
7266 AT_CHECK([tail -1 stdout], [0], [dnl
7267 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
7268 ])
7269
7270 dnl Remove the flow which contains sample action.
7271 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7272 AT_CHECK([ovs-appctl revalidator/purge])
7273
7274 dnl Add openflow sample action with sampling_port which is
7275 dnl equal to output port.
7276 AT_DATA([flows2.txt], [dnl
7277 in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
7278 ])
7279 AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
7280
7281 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])
7282 dnl Make sure flow sample action in datapath is behind set tunnel
7283 dnl action at egress point of tunnel port.
7284 AT_CHECK([tail -1 stdout], [0], [dnl
7285 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
7286 ])
7287
7288 dnl Remove the flow which contains sample action.
7289 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7290 AT_CHECK([ovs-appctl revalidator/purge])
7291
7292 dnl Add a rule with two sample actions and each sample action
7293 dnl has a sampling_port
7294 AT_DATA([flows3.txt], [dnl
7295 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
7296 ])
7297 AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
7298
7299 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])
7300 dnl Make sure flow sample action in datapath is behind set tunnel
7301 dnl action at egress point of tunnel port.
7302 AT_CHECK([tail -1 stdout], [0], [dnl
7303 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
7304 ])
7305
7306 dnl Remove the flow which contains sample action.
7307 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7308 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7309
7310 OVS_VSWITCHD_STOP
7311 AT_CLEANUP
7312
7313 AT_SETUP([ofproto-dpif - clone action])
7314 OVS_VSWITCHD_START
7315 add_of_ports br0 1 2 3 4
7316
7317 dnl Reversible open flow clone actions, no datapath clone action should be generated.
7318 AT_DATA([flows.txt], [dnl
7319 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
7320 ])
7321 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7322
7323 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])
7324
7325 AT_CHECK([tail -1 stdout], [0], [dnl
7326 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4
7327 ])
7328
7329 dnl Test flow xlate openflow clone action without using datapath clone action.
7330 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7331
7332 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])
7333
7334 AT_CHECK([tail -1 stdout], [0], [dnl
7335 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4
7336 ])
7337
7338 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7339 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])
7340
7341 AT_CHECK([tail -1 stdout], [0], [dnl
7342 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4
7343 ])
7344
7345 dnl Mixing reversible and irreversible open flow clone actions. Datapath clone action
7346 dnl should be generated when necessary.
7347
7348 dnl Restore the datapath support level.
7349 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone true], [0], [])
7350 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 10], [0], [])
7351
7352 AT_DATA([flows.txt], [dnl
7353 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
7354 ])
7355 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7356
7357 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])
7358
7359 AT_CHECK([tail -1 stdout], [0], [dnl
7360 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),clone(ct(commit),3),4
7361 ])
7362
7363 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7364
7365 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])
7366
7367 AT_CHECK([tail -1 stdout], [0], [dnl
7368 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),sample(sample=100.0%,actions(ct(commit),3)),4
7369 ])
7370
7371 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7372 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])
7373
7374 AT_CHECK([tail -1 stdout], [0], [dnl
7375 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),4
7376 ])
7377 AT_CHECK([grep "Failed to compose clone action" stdout], [0], [ignore])
7378
7379 OVS_VSWITCHD_STOP
7380 AT_CLEANUP
7381
7382 dnl Flow based IPFIX statistics check
7383 AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
7384 OVS_VSWITCHD_START
7385 add_of_ports br0 1 2
7386
7387 dnl Negative test check.
7388 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7389 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7390 NXST_IPFIX_FLOW request (xid=0x2):
7391 ])
7392
7393 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7394 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7395 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7396 [0], [ignore])
7397
7398 AT_DATA([flows.txt], [dnl
7399 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7400 ])
7401
7402 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7403
7404 dnl Send some packets that should be sampled.
7405 for i in `seq 1 20`; do
7406 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])
7407 done
7408
7409 dnl There are 4 extra IPFIX template packets.
7410 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
7411 NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
7412 id 1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7413 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
7414 ])
7415
7416 dnl Remove the flow which contains sample action.
7417 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7418 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7419 AT_CHECK([ovs-appctl revalidator/purge])
7420
7421 dnl Send some more packets, to ensure that these are not sampled.
7422 for i in `seq 1 3`; do
7423 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])
7424 done
7425 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7426 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7427 NXST_IPFIX_FLOW request (xid=0x2):
7428 ])
7429
7430 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7431 AT_CLEANUP
7432
7433 AT_SETUP([ofproto-dpif - flow stats])
7434 OVS_VSWITCHD_START
7435 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7436 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7437
7438 ovs-appctl time/stop
7439
7440 for i in `seq 1 10`; do
7441 ovs-appctl netdev-dummy/receive br0 'in_port(0),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no)'
7442 done
7443
7444 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7445 AT_CHECK([ovs-appctl revalidator/purge], [0])
7446 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7447 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
7448 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
7449 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
7450 ])
7451 OVS_VSWITCHD_STOP
7452 AT_CLEANUP
7453
7454 AT_SETUP([ofproto-dpif - flow stats reset_counts])
7455 OVS_VSWITCHD_START
7456 flow="ip,actions=NORMAL"
7457
7458 ovs-appctl time/stop
7459
7460 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7461
7462 warp_and_dump_NXM () {
7463 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7464 AT_CHECK([ovs-appctl revalidator/purge], [0])
7465
7466 AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0], [0], [stdout])
7467 if [[ $5 -gt 0 ]]; then
7468 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, hard_age=$5, ip actions=NORMAL"
7469 else
7470 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, ip actions=NORMAL"
7471 fi
7472 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7473 $expected
7474 ])
7475 }
7476
7477 warp_and_dump_OF () {
7478 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7479 AT_CHECK([ovs-appctl revalidator/purge], [0])
7480
7481 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0], [0], [stdout])
7482 if [[ $1 -lt 13 -o "$5X" = "X" ]]; then
7483 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, ip actions=NORMAL"
7484 else
7485 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $5 ip actions=NORMAL"
7486 fi
7487 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7488 $expected
7489 ])
7490 }
7491
7492 send_packet () {
7493 ovs-appctl netdev-dummy/receive br0 'in_port(0),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no)'
7494 }
7495
7496 # OpenFlow 1.0, implicit reset_counts
7497 send_packet
7498 warp_and_dump_NXM 1 1 118 1
7499 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 add-flow br0 $flow])
7500 # add-flow resets duration and counts,
7501 # but idle age is inherited from the old flow
7502 warp_and_dump_NXM 1 0 0 2
7503
7504 send_packet
7505 warp_and_dump_NXM 2 1 118 1
7506 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 mod-flows br0 $flow])
7507 # mod-flows resets hard_age, but not counts
7508 # but duration and idle_age is inherited from the old flow
7509 warp_and_dump_NXM 3 1 118 2 1
7510
7511 # OpenFlow 1.1, implicit reset_counts
7512 send_packet
7513 warp_and_dump_OF 11 4 2 236
7514 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 add-flow br0 $flow])
7515 # add-flow resets duration and counts,
7516 # but idle age is inherited from the old flow
7517 warp_and_dump_NXM 1 0 0 2
7518 warp_and_dump_OF 11 2 0 0
7519
7520 send_packet
7521 warp_and_dump_OF 11 3 1 118
7522 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 mod-flows br0 $flow])
7523 # mod-flows resets hard_age, but not counts
7524 # but duration and idle_age is inherited from the old flow
7525 warp_and_dump_NXM 4 1 118 2 1
7526 warp_and_dump_OF 11 5 1 118
7527
7528 # OpenFlow 1.2, explicit reset_counts
7529 send_packet
7530 warp_and_dump_OF 12 6 2 236
7531 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 $flow])
7532 # add-flow without flags resets duration, but not counts,
7533 # idle age is inherited from the old flow
7534 warp_and_dump_NXM 1 2 236 2
7535 warp_and_dump_OF 12 2 2 236
7536
7537 send_packet
7538 warp_and_dump_OF 12 3 3 354
7539 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 $flow])
7540 # mod-flows without flags does not reset duration nor counts,
7541 # idle age is inherited from the old flow
7542 warp_and_dump_NXM 4 3 354 2 1
7543 warp_and_dump_OF 12 5 3 354
7544
7545 send_packet
7546 warp_and_dump_OF 12 6 4 472
7547 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 reset_counts,$flow])
7548 # add-flow with reset_counts resets both duration and counts,
7549 # idle age is inherited from the old flow
7550 warp_and_dump_NXM 1 0 0 2
7551 warp_and_dump_OF 12 2 0 0
7552
7553 send_packet
7554 warp_and_dump_OF 12 3 1 118
7555 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 reset_counts,$flow])
7556 # mod-flows with reset_counts resets counts, but not duration,
7557 # idle age is inherited from the old flow
7558 warp_and_dump_NXM 4 0 0 2 1
7559 warp_and_dump_OF 12 5 0 0
7560
7561 # OpenFlow > 1.3, explicit reset_counts
7562 flow_mods_reset_counts () {
7563 # Reset to a known state
7564 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7565
7566 send_packet
7567 warp_and_dump_OF $1 1 1 118 reset_counts
7568 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7569 # add-flow without flags resets duration, but not counts,
7570 # idle age is inherited from the old flow
7571 warp_and_dump_NXM 1 1 118 2
7572 warp_and_dump_OF $1 2 1 118
7573
7574 send_packet
7575 warp_and_dump_OF $1 3 2 236
7576 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7577 # mod-flows without flags does not reset duration nor counts,
7578 # idle age is inherited from the old flow
7579 warp_and_dump_NXM 4 2 236 2 1
7580 warp_and_dump_OF $1 5 2 236
7581
7582 send_packet
7583 warp_and_dump_OF $1 6 3 354
7584 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7585 # add-flow with reset_counts resets both duration and counts,
7586 # idle age is inherited from the old flow
7587 warp_and_dump_NXM 1 0 0 2
7588 warp_and_dump_OF $1 2 0 0 reset_counts
7589
7590 send_packet
7591 warp_and_dump_OF $1 3 1 118 reset_counts
7592 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7593 # mod-flows with reset_counts resets counts, but not duration,
7594 # idle age is inherited from the old flow
7595 warp_and_dump_NXM 4 0 0 2 1
7596 warp_and_dump_OF $1 5 0 0 reset_counts
7597
7598 # Modify flow having reset_counts flag without reset_counts
7599 send_packet
7600 warp_and_dump_OF $1 6 1 118 reset_counts
7601 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7602 warp_and_dump_NXM 7 1 118 2 1
7603 warp_and_dump_OF $1 8 1 118 reset_counts
7604
7605 # Add flow having reset_counts flag without reset_counts
7606 send_packet
7607 warp_and_dump_OF $1 9 2 236 reset_counts
7608 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7609 warp_and_dump_NXM 1 2 236 2
7610 warp_and_dump_OF $1 2 2 236
7611
7612 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7613 send_packet
7614 warp_and_dump_OF $1 3 3 354
7615 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7616 warp_and_dump_NXM 4 0 0 2 1
7617 warp_and_dump_OF $1 5 0 0
7618 }
7619
7620 # OpenFlow versions >= 1.3 should behave the same way
7621 flow_mods_reset_counts 13
7622 flow_mods_reset_counts 14
7623
7624 OVS_VSWITCHD_STOP
7625 AT_CLEANUP
7626
7627 AT_SETUP([ofproto-dpif - flow stats reset_counts OpenFlow1.5])
7628 OVS_VSWITCHD_START
7629 flow="ip,actions=NORMAL"
7630
7631 ovs-appctl time/stop
7632
7633 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7634
7635 warp_and_dump_OF () {
7636 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7637 AT_CHECK([ovs-appctl revalidator/purge], [0])
7638
7639 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0 ], [0], [stdout])
7640 if [[ "$6X" = "X" ]]; then
7641 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, idle_age=$5, ip actions=NORMAL"
7642 else
7643 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $6 idle_age=$5, ip actions=NORMAL"
7644 fi
7645 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7646 $expected
7647 ])
7648 }
7649
7650 send_packet () {
7651 ovs-appctl netdev-dummy/receive br0 'in_port(0),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no)'
7652 }
7653
7654 # OpenFlow 1.5, explicit reset_counts
7655 flow_mods_reset_counts () {
7656 # Reset to a known state
7657 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7658
7659 send_packet
7660 warp_and_dump_OF $1 1 1 118 1 reset_counts
7661 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7662 # add-flow without flags resets duration, but not counts,
7663 # idle age is inherited from the old flow
7664 warp_and_dump_OF $1 1 1 118 2
7665
7666 send_packet
7667 warp_and_dump_OF $1 2 2 236 1
7668 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7669 # mod-flows without flags does not reset duration nor counts,
7670 # idle age is inherited from the old flow
7671 warp_and_dump_OF $1 3 2 236 2
7672
7673 send_packet
7674 warp_and_dump_OF $1 4 3 354 1
7675 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7676 # add-flow with reset_counts resets both duration and counts,
7677 # idle age is inherited from the old flow
7678 warp_and_dump_OF $1 1 0 0 2 reset_counts
7679
7680 send_packet
7681 warp_and_dump_OF $1 2 1 118 1 reset_counts
7682 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7683 # mod-flows with reset_counts resets counts, but not duration,
7684 # idle age is inherited from the old flow
7685 warp_and_dump_OF $1 3 0 0 2 reset_counts
7686
7687 # Modify flow having reset_counts flag without reset_counts
7688 send_packet
7689 warp_and_dump_OF $1 4 1 118 1 reset_counts
7690 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7691 warp_and_dump_OF $1 5 1 118 2 reset_counts
7692
7693 # Add flow having reset_counts flag without reset_counts
7694 send_packet
7695 warp_and_dump_OF $1 6 2 236 1 reset_counts
7696 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7697 warp_and_dump_OF $1 1 2 236 2
7698
7699 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7700 send_packet
7701 warp_and_dump_OF $1 2 3 354 1
7702 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7703 warp_and_dump_OF $1 3 0 0 2
7704 }
7705
7706 # OpenFlow versions >= 1.3 should behave the same way
7707 flow_mods_reset_counts 15
7708
7709 OVS_VSWITCHD_STOP
7710 AT_CLEANUP
7711
7712
7713 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
7714 OVS_VSWITCHD_START
7715 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7716 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7717
7718 ovs-appctl time/stop
7719
7720 for i in `seq 1 10`; do
7721 ovs-appctl netdev-dummy/receive br0 'in_port(0),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no)'
7722 done
7723
7724 ovs-appctl time/warp 100
7725 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
7726 ovs-appctl time/warp 1000
7727
7728 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7729 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
7730 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
7731 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
7732 ])
7733 OVS_VSWITCHD_STOP
7734 AT_CLEANUP
7735
7736 AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
7737 OVS_VSWITCHD_START
7738
7739 # get_ages DURATION HARD IDLE
7740 #
7741 # Fetch the flow duration, hard age, and idle age into the variables
7742 # whose names are given as arguments. Rounds DURATION down to the
7743 # nearest integer. If hard_age doesn't appear in the output, sets
7744 # HARD to "none". If idle_age doesn't appear in the output, sets IDLE
7745 # to 0.
7746 get_ages () {
7747 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7748
7749 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
7750 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
7751 AS_VAR_COPY([$1], [duration])
7752
7753 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
7754 if test X"$hard" = X; then
7755 hard=none
7756 else
7757 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
7758 fi
7759 AS_VAR_COPY([$2], [hard])
7760
7761 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
7762 if test X"$idle" = X; then
7763 idle=0
7764 else
7765 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
7766 fi
7767 AS_VAR_COPY([$3], [idle])
7768 }
7769
7770 # Add a flow and get its initial hard and idle age.
7771 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
7772 get_ages duration1 hard1 idle1
7773
7774 ovs-appctl time/stop
7775 # Warp time forward by 10 seconds, then modify the flow's actions.
7776 ovs-appctl time/warp 10000
7777 get_ages duration2 hard2 idle2
7778 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
7779
7780 # Warp time forward by 10 seconds.
7781 ovs-appctl time/warp 10000
7782 get_ages duration3 hard3 idle3
7783
7784 # Warp time forward 10 more seconds, then pass some packets through the flow,
7785 # then warp forward a few more times because idle times are only updated
7786 # occasionally.
7787 ovs-appctl time/warp 10000
7788 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)'
7789 ovs-appctl time/warp 3000 1000
7790 sleep 1
7791 get_ages duration4 hard4 idle4
7792
7793 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
7794 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
7795 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
7796
7797 # Duration should increase steadily over time.
7798 AT_CHECK([test $duration1 -lt $duration2])
7799 AT_CHECK([test $duration2 -lt $duration3])
7800 AT_CHECK([test $duration3 -lt $duration4])
7801
7802 # Hard age should be "none" initially because it's the same as flow_duration,
7803 # then it should increase.
7804 AT_CHECK([test $hard1 = none])
7805 AT_CHECK([test $hard2 = none])
7806 AT_CHECK([test $hard3 != none])
7807 AT_CHECK([test $hard4 != none])
7808 AT_CHECK([test $hard3 -lt $hard4])
7809
7810 # Idle age should increase from 1 to 2 to 3, then decrease.
7811 AT_CHECK([test $idle1 -lt $idle2])
7812 AT_CHECK([test $idle2 -lt $idle3])
7813 AT_CHECK([test $idle3 -gt $idle4])
7814
7815 # Check some invariant relationships.
7816 AT_CHECK([test $duration1 = $idle1])
7817 AT_CHECK([test $duration2 = $idle2])
7818 AT_CHECK([test $duration3 = $idle3])
7819 AT_CHECK([test $idle3 -gt $hard3])
7820 AT_CHECK([test $idle4 -lt $hard4])
7821 AT_CHECK([test $hard4 -lt $duration4])
7822
7823 OVS_VSWITCHD_STOP
7824 AT_CLEANUP
7825
7826 AT_SETUP([ofproto-dpif - fin_timeout])
7827 OVS_VSWITCHD_START
7828 ovs-appctl time/stop
7829 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
7830 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7831 [NXST_FLOW reply:
7832 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7833 ])
7834
7835 # Check that a TCP SYN packet does not change the timeout. (Because
7836 # flow stats updates are mainly what implements the fin_timeout
7837 # feature, we warp forward a couple of times to ensure that flow stats
7838 # run before re-checking the flow table.)
7839 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
7840 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7841 warped
7842 ])
7843 AT_CHECK([ovs-appctl revalidator/purge], [0])
7844 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7845 [NXST_FLOW reply:
7846 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7847 ])
7848 # Check that a TCP FIN packet does change the timeout.
7849 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
7850 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7851 warped
7852 ])
7853 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7854 [NXST_FLOW reply:
7855 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
7856 ])
7857 OVS_VSWITCHD_STOP
7858 AT_CLEANUP
7859
7860 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
7861 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
7862 add_of_ports br0 1 2
7863 add_of_ports br1 3
7864
7865 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
7866 dummy@br0
7867 dummy@br1
7868 ])
7869 OVS_VSWITCHD_STOP
7870 AT_CLEANUP
7871
7872 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
7873 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
7874 [--dummy-numa="0,0,0,0,1,1,1,1"])
7875 add_pmd_of_ports br0 1 2
7876 add_of_ports br1 3
7877
7878 AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
7879 dummy@ovs-dummy: hit:0 missed:0
7880 br0:
7881 br0 65534/100: (dummy-internal)
7882 p1 1/1: (dummy-pmd: <cleared>)
7883 p2 2/2: (dummy-pmd: <cleared>)
7884 br1:
7885 br1 65534/101: (dummy-internal)
7886 p3 3/3: (dummy)
7887 ])
7888 OVS_VSWITCHD_STOP
7889 AT_CLEANUP
7890
7891 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
7892 # bump max-idle to avoid the flows being reclaimed behind us
7893 OVS_VSWITCHD_START([add-br br1 -- \
7894 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7895 set Open_vSwitch . other_config:max-idle=10000], [], [],
7896 [--dummy-numa="0,0,0,0,1,1,1,1"])
7897 add_of_ports br0 1
7898 add_pmd_of_ports br0 2
7899 add_of_ports br1 3
7900
7901 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)'])
7902 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)'])
7903 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)'])
7904 ovs-appctl revalidator/wait
7905 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7906 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
7907 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
7908 ])
7909
7910 AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
7911 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
7912 ])
7913
7914 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
7915 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
7916 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
7917 ])
7918
7919 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
7920 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
7921 ])
7922
7923 OVS_VSWITCHD_STOP
7924 AT_CLEANUP
7925
7926 m4_define([OFPROTO_DPIF_GET_FLOW],
7927 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
7928
7929 OVS_VSWITCHD_START([add-br br1 -- \
7930 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7931 set Open_vSwitch . other_config:max-idle=10000], [], [],
7932 [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7933
7934 func=`printf '%s_' "$1" | cut -c 4-`
7935 add_${func}of_ports br0 1 2
7936
7937 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
7938 ovs-appctl revalidator/wait
7939 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
7940
7941 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
7942 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
7943 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
7944 ])
7945
7946 OVS_VSWITCHD_STOP
7947 AT_CLEANUP])
7948
7949 OFPROTO_DPIF_GET_FLOW([])
7950 OFPROTO_DPIF_GET_FLOW([ - pmd])
7951
7952 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
7953 OVS_VSWITCHD_START([dnl
7954 add-port br0 p1 -- set Interface p1 type=dummy
7955 ])
7956 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7957 on_exit 'kill `cat ovs-ofctl.pid`'
7958
7959 AT_CAPTURE_FILE([ofctl_monitor.log])
7960 AT_DATA([flows.txt], [dnl
7961 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
7962 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
7963 ])
7964 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7965
7966 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
7967 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
7968 dnl
7969 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
7970 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)
7971 dnl (label 20, exp 0, [S], ttl 32)
7972 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7973 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7974
7975 for dl_src in 00 01; do
7976 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "505400000007 6066666666$dl_src 8847 00014020 00014120 45 00 00 2c 00 00 00 00 40 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45"])
7977 done
7978 sleep 1 # wait for the datapath flow installed
7979 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7980 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))
7981 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))
7982 ])
7983
7984 OVS_VSWITCHD_STOP
7985 AT_CLEANUP
7986
7987
7988 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
7989 OVS_VSWITCHD_START([dnl
7990 add-port br0 p1 -- set Interface p1 type=dummy
7991 ])
7992 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7993 on_exit 'kill `cat ovs-ofctl.pid`'
7994
7995 AT_CAPTURE_FILE([ofctl_monitor.log])
7996 AT_DATA([flows.txt], [dnl
7997 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
7998 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
7999 ])
8000 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8001
8002 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
8003 dnl 4 MPLS LSEs but ovs-vswitchd can only handle up to 3 MPLS LSEs and thus
8004 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
8005 dnl
8006 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
8007 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)
8008 dnl (label 20, exp 0, ttl 32)
8009 dnl (label 20, exp 0, ttl 32)
8010 dnl (label 20, exp 0, [S], ttl 32)
8011 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
8012 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
8013
8014 for dl_src in 00 01; do
8015 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "505400000007 6066666666$dl_src 8847 00014020 00014120 45 00 00 2c 00 00 00 00 40 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45"])
8016 done
8017 sleep 1 # wait for the datapath flow installed
8018 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8019 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))
8020 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))
8021 ])
8022
8023 OVS_VSWITCHD_STOP
8024 AT_CLEANUP
8025
8026 AT_SETUP([ofproto-dpif - patch ports])
8027 OVS_VSWITCHD_START([add-br br1 \
8028 -- set bridge br1 datapath-type=dummy fail-mode=secure \
8029 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
8030 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
8031
8032 add_of_ports br0 2
8033 add_of_ports br1 3
8034
8035 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8036 ], [])
8037 AT_CHECK([ovs-appctl time/stop])
8038 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8039
8040 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
8041 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
8042
8043 for i in $(seq 1 10); do
8044 ovs-appctl netdev-dummy/receive br0 'in_port(100),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
8045 if [[ $i -eq 1 ]]; then
8046 sleep 1
8047 fi
8048 done
8049
8050 for i in $(seq 1 5); do
8051 ovs-appctl netdev-dummy/receive br1 'in_port(101),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
8052 if [[ $i -eq 1 ]]; then
8053 sleep 1
8054 fi
8055 done
8056
8057 AT_CHECK([ovs-appctl time/warp 500], [0],
8058 [warped
8059 ])
8060 sleep 1 # wait for log writer
8061
8062 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
8063 dummy@ovs-dummy: hit:13 missed:2
8064 br0:
8065 br0 65534/100: (dummy-internal)
8066 p2 2/2: (dummy)
8067 pbr0 1/none: (patch: peer=pbr1)
8068 br1:
8069 br1 65534/101: (dummy-internal)
8070 p3 3/3: (dummy)
8071 pbr1 1/none: (patch: peer=pbr0)
8072 ])
8073
8074 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8075 recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
8076 recirc_id(0),in_port(101),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
8077 ])
8078
8079 AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
8080 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
8081 ])
8082 AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
8083 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
8084 ])
8085
8086 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
8087 OFPST_PORT reply (xid=0x4): 1 ports
8088 port 1: rx pkts=5, bytes=530, drop=?, errs=?, frame=?, over=?, crc=?
8089 tx pkts=10, bytes=1060, drop=?, errs=?, coll=?
8090 ])
8091
8092 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
8093 OFPST_PORT reply (xid=0x4): 1 ports
8094 port 1: rx pkts=10, bytes=1060, drop=?, errs=?, frame=?, over=?, crc=?
8095 tx pkts=5, bytes=530, drop=?, errs=?, coll=?
8096 ])
8097
8098 OVS_VSWITCHD_STOP
8099 AT_CLEANUP
8100
8101 AT_SETUP([ofproto-dpif - patch ports - stack])
8102 OVS_VSWITCHD_START([add-br br1 \
8103 -- set bridge br1 datapath-type=dummy fail-mode=secure \
8104 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
8105 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
8106
8107 add_of_ports br0 2
8108 add_of_ports br1 3
8109
8110 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8111 ], [])
8112 AT_CHECK([ovs-appctl time/stop])
8113 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8114
8115 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"])
8116 # Try to pop from empty stack, and push and leave data to stack.
8117 AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
8118
8119 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)'
8120
8121 AT_CHECK([ovs-appctl time/warp 500], [0],
8122 [warped
8123 ])
8124
8125 OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
8126
8127 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
8128 dummy@ovs-dummy: hit:0 missed:1
8129 br0:
8130 br0 65534/100: (dummy-internal)
8131 p2 2/2: (dummy)
8132 pbr0 1/none: (patch: peer=pbr1)
8133 br1:
8134 br1 65534/101: (dummy-internal)
8135 p3 3/3: (dummy)
8136 pbr1 1/none: (patch: peer=pbr0)
8137 ])
8138
8139 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8140 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
8141 ])
8142
8143 AT_CHECK([grep -e '|ofproto_dpif_xlate|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
8144 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
8145 ])
8146
8147 OVS_VSWITCHD_STOP(["/stack underflow/d"])
8148 AT_CLEANUP
8149
8150 AT_SETUP([ofproto-dpif - port duration])
8151 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
8152 add_of_ports br0 1 2
8153
8154 ovs-appctl time/stop
8155 ovs-appctl time/warp 10000
8156
8157 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
8158 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
8159 [dnl
8160 duration=?s
8161 duration=?s
8162 duration=?s
8163 ])
8164 OVS_VSWITCHD_STOP
8165 AT_CLEANUP
8166
8167 dnl ----------------------------------------------------------------------
8168 AT_BANNER([ofproto-dpif -- megaflows])
8169
8170 AT_SETUP([ofproto-dpif megaflow - port classification])
8171 OVS_VSWITCHD_START
8172 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8173 add_of_ports br0 1 2
8174 AT_DATA([flows.txt], [dnl
8175 table=0 in_port=1 actions=output(2)
8176 ])
8177 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8178 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)'])
8179 sleep 1
8180 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)'])
8181 sleep 1
8182 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8183 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8184 ])
8185 OVS_VSWITCHD_STOP
8186 AT_CLEANUP
8187
8188 AT_SETUP([ofproto-dpif megaflow - L2 classification])
8189 OVS_VSWITCHD_START
8190 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8191 add_of_ports br0 1 2
8192 AT_DATA([flows.txt], [dnl
8193 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
8194 ])
8195 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8196 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)'])
8197 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)'])
8198 sleep 1
8199 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8200 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>
8201 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>
8202 ])
8203 OVS_VSWITCHD_STOP
8204 AT_CLEANUP
8205
8206 AT_SETUP([ofproto-dpif megaflow - L3 classification])
8207 OVS_VSWITCHD_START
8208 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8209 add_of_ports br0 1 2
8210 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], [])
8211 AT_DATA([flows.txt], [dnl
8212 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
8213 ])
8214 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8215 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)'])
8216 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)'])
8217 sleep 1
8218 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8219 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>
8220 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>
8221 ])
8222 OVS_VSWITCHD_STOP
8223 AT_CLEANUP
8224
8225 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
8226 OVS_VSWITCHD_START
8227 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8228 add_of_ports br0 1 2
8229 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], [])
8230 AT_DATA([flows.txt], [dnl
8231 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
8232 ])
8233 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8234 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)'])
8235 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)'])
8236 sleep 1
8237 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8238 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>
8239 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>
8240 ])
8241 OVS_VSWITCHD_STOP
8242 AT_CLEANUP
8243
8244 AT_SETUP([ofproto-dpif megaflow - L4 classification])
8245 OVS_VSWITCHD_START
8246 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8247 add_of_ports br0 1 2
8248 AT_DATA([flows.txt], [dnl
8249 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
8250 ])
8251 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8252 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)'])
8253 sleep 1
8254 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)'])
8255 sleep 1
8256 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8257 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>
8258 ])
8259 OVS_VSWITCHD_STOP
8260 AT_CLEANUP
8261
8262 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
8263 [AT_SETUP([ofproto-dpif megaflow - normal$1])
8264 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8265 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8266 func=`printf '%s_' "$1" | cut -c 4-`
8267 add_${func}of_ports br0 1 2
8268 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8269 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8270 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8271 sleep 1
8272 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8273 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>
8274 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>
8275 ])
8276 OVS_VSWITCHD_STOP
8277 AT_CLEANUP])
8278
8279 OFPROTO_DPIF_MEGAFLOW_NORMAL([])
8280 OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
8281
8282 AT_SETUP([ofproto-dpif megaflow - mpls])
8283 OVS_VSWITCHD_START
8284 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8285 add_of_ports br0 1 2
8286 AT_DATA([flows.txt], [dnl
8287 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
8288 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
8289 ])
8290 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8291 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)'])
8292 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)'])
8293 sleep 1
8294 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
8295 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
8296 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
8297 ])
8298 OVS_VSWITCHD_STOP
8299 AT_CLEANUP
8300
8301 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
8302 m4_define([CHECK_MEGAFLOW_NETFLOW],
8303 [OVS_VSWITCHD_START
8304 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8305 add_of_ports br0 1 2
8306
8307 dnl NetFlow configuration disables wildcarding relevant fields
8308 on_exit 'kill `cat test-netflow.pid`'
8309 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
8310 AT_CAPTURE_FILE([netflow.log])
8311 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
8312 ovs-vsctl \
8313 set Bridge br0 netflow=@nf -- \
8314 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
8315 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
8316
8317 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8318 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8319 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8320 sleep 1
8321 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8322 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>
8323 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>
8324 ])
8325 OVS_APP_EXIT_AND_WAIT([test-netflow])
8326 OVS_VSWITCHD_STOP])
8327
8328 AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
8329 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
8330 AT_CLEANUP
8331
8332 AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
8333 AT_SKIP_IF([test $HAVE_IPV6 = no])
8334 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
8335 AT_CLEANUP
8336
8337 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
8338 [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
8339 OVS_VSWITCHD_START(
8340 [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
8341 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
8342 set interface p2 type=$1 ofport_request=2 -- \
8343 set interface p3 type=$1 ofport_request=3], [], [],
8344 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
8345 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8346 ])
8347 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8348
8349 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8350 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8351 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8352 sleep 1
8353 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8354 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>
8355 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>
8356 ])
8357 OVS_VSWITCHD_STOP
8358 AT_CLEANUP])
8359
8360 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
8361 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
8362
8363 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
8364 OVS_VSWITCHD_START(
8365 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
8366 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
8367 set interface p2 type=dummy ofport_request=2 -- \
8368 set interface p3 type=dummy ofport_request=3])
8369 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8370 ])
8371 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8372
8373 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8374 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)'])
8375 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)'])
8376 sleep 1
8377 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8378 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>
8379 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>
8380 ])
8381 OVS_VSWITCHD_STOP
8382 AT_CLEANUP
8383
8384 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
8385 # Create bond0 on br0 with interfaces p0 and p1
8386 # and bond1 on br1 with interfaces p2 and p3
8387 # with p0 patched to p2 and p1 patched to p3.
8388 OVS_VSWITCHD_START(
8389 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
8390 other-config:lacp-time=fast \
8391 other-config:bond-rebalance-interval=0 -- \
8392 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
8393 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
8394 add-br br1 -- \
8395 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
8396 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
8397 fail-mode=secure -- \
8398 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
8399 other-config:lacp-time=fast \
8400 other-config:bond-rebalance-interval=0 -- \
8401 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
8402 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
8403
8404 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8405 ])
8406 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8407 add_of_ports br0 7
8408 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8409 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
8410 ovs-appctl time/stop
8411 ovs-appctl time/warp 5000
8412 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)'])
8413 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)'])
8414 sleep 1
8415 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8416 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>
8417 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>
8418 ])
8419 OVS_VSWITCHD_STOP
8420 AT_CLEANUP
8421
8422 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
8423 OVS_VSWITCHD_START
8424 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8425 add_of_ports br0 1 2
8426 AT_DATA([flows.txt], [dnl
8427 table=0 in_port=1,ip actions=resubmit(90)
8428 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
8429 ])
8430 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8431 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)'])
8432 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)'])
8433 sleep 1
8434 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8435 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>
8436 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>
8437 ])
8438 OVS_VSWITCHD_STOP
8439 AT_CLEANUP
8440
8441 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
8442 OVS_VSWITCHD_START
8443 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8444 add_of_ports br0 1 2
8445 AT_DATA([flows.txt], [dnl
8446 table=0 in_port=1,ip actions=resubmit(,1)
8447 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8448 ])
8449 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8450 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)'])
8451 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=
8452 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8453 sleep 1
8454 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8455 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>
8456 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>
8457 ])
8458 OVS_VSWITCHD_STOP
8459 AT_CLEANUP
8460
8461 AT_SETUP([ofproto-dpif megaflow - goto_table action])
8462 OVS_VSWITCHD_START
8463 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8464 add_of_ports br0 1 2
8465 AT_DATA([flows.txt], [dnl
8466 table=0 in_port=1,ip actions=goto_table(1)
8467 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8468 ])
8469 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
8470 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)'])
8471 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)'])
8472 sleep 1
8473 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8474 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>
8475 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>
8476 ])
8477 OVS_VSWITCHD_STOP
8478 AT_CLEANUP
8479
8480 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
8481 AT_KEYWORDS([mirror mirrors mirroring])
8482 OVS_VSWITCHD_START
8483 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8484 add_of_ports br0 1 2 3
8485 ovs-vsctl \
8486 set Bridge br0 mirrors=@m --\
8487 --id=@p3 get Port p3 --\
8488 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
8489
8490 AT_DATA([flows.txt], [dnl
8491 in_port=1 actions=output:2
8492 ])
8493 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8494 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)'])
8495 sleep 1
8496 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)'])
8497 sleep 1
8498 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8499 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8500 ])
8501 OVS_VSWITCHD_STOP
8502 AT_CLEANUP
8503
8504 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
8505 OVS_VSWITCHD_START
8506 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8507 add_of_ports br0 1 2 3
8508 ovs-vsctl \
8509 set Bridge br0 mirrors=@m --\
8510 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
8511 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
8512
8513 AT_DATA([flows.txt], [dnl
8514 in_port=1 actions=output:2
8515 ])
8516 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8517 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))'])
8518 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)'])
8519 sleep 1
8520 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8521 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8522 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>
8523 ])
8524 OVS_VSWITCHD_STOP
8525 AT_CLEANUP
8526
8527 AT_SETUP([ofproto-dpif megaflow - move action])
8528 OVS_VSWITCHD_START
8529 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8530 add_of_ports br0 1 2
8531 AT_DATA([flows.txt], [dnl
8532 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
8533 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
8534 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
8535 ])
8536 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8537 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)'])
8538 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)'])
8539 sleep 1
8540 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8541 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>
8542 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>
8543 ])
8544 OVS_VSWITCHD_STOP
8545 AT_CLEANUP
8546
8547 AT_SETUP([ofproto-dpif megaflow - push action])
8548 OVS_VSWITCHD_START
8549 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8550 add_of_ports br0 1 2
8551 AT_DATA([flows.txt], [dnl
8552 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
8553 ])
8554 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8555 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)'])
8556 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)'])
8557 sleep 1
8558 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8559 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>
8560 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>
8561 ])
8562 OVS_VSWITCHD_STOP
8563 AT_CLEANUP
8564
8565 AT_SETUP([ofproto-dpif megaflow - learning])
8566 OVS_VSWITCHD_START
8567 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8568 add_of_ports br0 1 2
8569 AT_DATA([flows.txt], [dnl
8570 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
8571 ])
8572 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8573 ovs-appctl time/stop
8574 # We send each packet twice because the first packet in each flow causes the
8575 # flow table to change and thus revalidations, which (depending on timing)
8576 # can keep a megaflow from being installed. The revalidations are done by
8577 # the second iteration, allowing the flows to be installed.
8578 for i in 1 2; do
8579 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8580 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8581 ovs-appctl time/warp 100
8582 done
8583 sleep 1
8584 dnl The original flow is missing due to a revalidation.
8585 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8586 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>
8587 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>
8588 ])
8589 OVS_VSWITCHD_STOP
8590 AT_CLEANUP
8591
8592 AT_SETUP([ofproto-dpif megaflow - tunnels])
8593 OVS_VSWITCHD_START(
8594 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8595 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8596 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
8597 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
8598 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
8599 ofport_request=3])
8600 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
8601 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
8602 ofport_request=4 options:key=flow])
8603 AT_DATA([flows.txt], [dnl
8604 in_port=1,actions=output(2)
8605 in_port=3,actions=output(4)
8606 ])
8607 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8608 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
8609 dnl will cause the packet to be dropped.
8610 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)'])
8611 sleep 1
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=0x1,ttl=64,frag=no),icmp(type=8,code=0)'])
8613 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)'])
8614 sleep 1
8615 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)'])
8616 sleep 1
8617 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8618 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
8619 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
8620 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
8621 ])
8622 OVS_VSWITCHD_STOP
8623 AT_CLEANUP
8624
8625 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
8626 OVS_VSWITCHD_START
8627 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8628 add_of_ports br0 1 2
8629 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], [])
8630 AT_DATA([flows.txt], [dnl
8631 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
8632 ])
8633 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8634 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)'])
8635 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)'])
8636 sleep 1
8637 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8638 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>
8639 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>
8640 ])
8641 OVS_VSWITCHD_STOP
8642 AT_CLEANUP
8643
8644 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
8645 OVS_VSWITCHD_START
8646 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8647 add_of_ports br0 1 2
8648 AT_DATA([flows.txt], [dnl
8649 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
8650 ])
8651 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8652 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)'])
8653 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)'])
8654 sleep 1
8655 dnl The first packet is essentially a no-op, as the new destination MAC is the
8656 dnl same as the original. The second entry actually updates the destination
8657 dnl MAC.
8658 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8659 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
8660 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
8661 ])
8662 OVS_VSWITCHD_STOP
8663 AT_CLEANUP
8664
8665 m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
8666 [AT_SETUP([ofproto-dpif megaflow - disabled$1])
8667 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8668 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8669 func=`printf '%s_' "$1" | cut -c 4-`
8670 add_${func}of_ports br0 1 2
8671 AT_DATA([flows.txt], [dnl
8672 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
8673 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
8674 ])
8675 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8676 ], [])
8677 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8678 ], [])
8679 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
8680 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8681 for i in 1 2 3 4; do
8682 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8683 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8684 if [[ $i -eq 1 ]]; then
8685 sleep 1
8686 fi
8687 done
8688 sleep 1
8689 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8690 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
8691 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
8692 ])
8693 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
8694 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
8695 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
8696 ])
8697 OVS_VSWITCHD_STOP
8698 AT_CLEANUP])
8699
8700 OFPROTO_DPIF_MEGAFLOW_DISABLED([])
8701 OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
8702
8703 AT_SETUP([ofproto-dpif - datapath port number change])
8704 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
8705 add_of_ports br0 1
8706
8707 # Trace a flow that should output to p1.
8708 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8709 [0], [stdout])
8710 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
8711 ])
8712
8713 # Change p1's port number to 5.
8714 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
8715
8716 # Trace a flow that should output to p1 in its new location.
8717 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8718 [0], [stdout])
8719 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
8720 ])
8721 OVS_VSWITCHD_STOP
8722 AT_CLEANUP
8723
8724 # Tests the bundling with various bfd and cfm configurations.
8725 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
8726 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
8727 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
8728 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
8729 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
8730 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
8731 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
8732 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
8733 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
8734 set Interface p0 cfm_mpid=1 -- \
8735 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
8736
8737 ovs-appctl time/stop
8738 # advance the clock to stablize everything.
8739 ovs-appctl time/warp 5000 100
8740 # cfm/show should show 'recv' fault.
8741 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8742 fault: recv
8743 ])
8744 # bfd/show should show 'up'.
8745 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8746 Local Session State: up
8747 Remote Session State: up
8748 Local Session State: up
8749 Remote Session State: up
8750 ])
8751 # bond/show should show 'may-enable: true' for all slaves.
8752 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8753 may_enable: true
8754 may_enable: true
8755 may_enable: true
8756 may_enable: true
8757 ])
8758
8759 # now disable the bfd on p1.
8760 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
8761 # advance the clock to stablize everything.
8762 ovs-appctl time/warp 5000 100
8763 # cfm/show should show 'recv' fault.
8764 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8765 fault: recv
8766 ])
8767 # bfd/show should show 'down'.
8768 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8769 Local Session State: down
8770 Remote Session State: down
8771 ])
8772 # bond/show should show 'may-enable: false' for p0.
8773 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8774 may_enable: false
8775 may_enable: true
8776 ])
8777
8778 # now enable the bfd on p1 and disable bfd on p0.
8779 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
8780 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
8781 # advance the clock to stablize everything.
8782 ovs-appctl time/warp 5000 100
8783 # cfm/show should show 'recv' fault.
8784 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8785 fault: recv
8786 ])
8787 # bfd/show should show 'down'.
8788 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8789 Local Session State: down
8790 Remote Session State: down
8791 ])
8792 # bond/show should show 'may-enable: false' for p0 and p1.
8793 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8794 may_enable: false
8795 may_enable: true
8796 may_enable: false
8797 may_enable: true
8798 ])
8799
8800 OVS_VSWITCHD_STOP
8801 AT_CLEANUP
8802
8803 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
8804 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
8805
8806 # enable bfd on p0.
8807 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8808 # check log.
8809 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8810 # disable bfd on p0.
8811 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8812 # check log.
8813 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8814 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])
8815
8816 # enable cfm on p0.
8817 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
8818 # check log.
8819 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8820 # disable cfm on p0.
8821 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
8822 # check log.
8823 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8824 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])
8825
8826 # enable both bfd and cfm on p0.
8827 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
8828 # check log.
8829 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8830 # disable bfd on p0.
8831 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8832 # check log, there should not be the log of thread terminated.
8833 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
8834 ])
8835 # reenable bfd on p0.
8836 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8837 # check log, should still be on log of thread created.
8838 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
8839 monitor thread created
8840 ])
8841 # disable bfd and cfm together.
8842 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
8843 # check log.
8844 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8845
8846 OVS_VSWITCHD_STOP
8847 AT_CLEANUP
8848
8849 # this test helps avoid the deadlock between the main thread and monitor thread.
8850 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
8851 OVS_VSWITCHD_START
8852
8853 for i in `seq 1 199`
8854 do
8855 AT_CHECK([ovs-vsctl add-port br0 p$i -- set interface p$i type=gre options:remote_ip=1.2.3.4 options:key=$i bfd:enable=true])
8856 done
8857
8858 OVS_VSWITCHD_STOP
8859 AT_CLEANUP
8860 \f
8861 AT_BANNER([ofproto-dpif - flow translation resource limits])
8862
8863 dnl Resubmits to later tables do not count against the depth limit, so we
8864 dnl can do 99 of them even though the maximum depth is 64.
8865 AT_SETUP([ofproto-dpif - forward resubmit])
8866 OVS_VSWITCHD_START
8867 (for i in `seq 0 99`; do
8868 j=`expr $i + 1`
8869 echo "table=$i, actions=resubmit(,$j)"
8870 done
8871 echo "table=100, actions=local") > flows
8872 AT_CHECK([ovs-ofctl add-flows br0 flows])
8873 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8874 [0], [stdout])
8875 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
8876 ])
8877 OVS_VSWITCHD_STOP
8878 AT_CLEANUP
8879
8880 dnl Resubmits to the same or an earlier table count against the depth limit,
8881 dnl so only 64 of them are allowed.
8882 AT_SETUP([ofproto-dpif - backward resubmit])
8883 OVS_VSWITCHD_START
8884 (echo "table=0, actions=resubmit(,66)"
8885 for i in `seq 2 66`; do
8886 j=`expr $i - 1`
8887 echo "table=$i, actions=resubmit(,$j)"
8888 done
8889 echo "table=1, actions=local") > flows
8890 AT_CHECK([ovs-ofctl add-flows br0 flows])
8891 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8892 [0], [stdout])
8893 AT_CHECK([tail -1 stdout], [0],
8894 [Translation failed (Recursion too deep), packet is dropped.
8895 ])
8896 AT_CHECK([grep -c 'over max translation depth 64' stdout],
8897 [0], [1
8898 ])
8899 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8900 AT_CLEANUP
8901
8902 AT_SETUP([ofproto-dpif - infinite resubmit])
8903 OVS_VSWITCHD_START
8904 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
8905 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8906 [0], [stdout])
8907 AT_CHECK([tail -1 stdout], [0],
8908 [Translation failed (Recursion too deep), packet is dropped.
8909 ])
8910 AT_CHECK([grep -c 'over max translation depth 64' stdout],
8911 [0], [1
8912 ])
8913 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8914 AT_CLEANUP
8915
8916 dnl Without using ofproto/trace, make sure the
8917 dnl ofproto trace is still logged
8918 AT_SETUP([ofproto-dpif - backward resubmit without trace])
8919 OVS_VSWITCHD_START
8920 (echo "table=0, actions=resubmit(,66)"
8921 for i in `seq 2 66`; do
8922 j=`expr $i - 1`
8923 echo "table=$i, actions=resubmit(,$j)"
8924 done
8925 echo "table=1, actions=local") > flows
8926 AT_CHECK([ovs-ofctl add-flows br0 flows])
8927
8928 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])
8929
8930 OVS_WAIT_UNTIL([grep 'packet is dropped' ovs-vswitchd.log])
8931
8932 dnl make sure the full ofproto trace dump is present
8933 AT_CHECK([grep -c "^ *resubmit" ovs-vswitchd.log],
8934 [0], [66
8935 ])
8936
8937 OVS_VSWITCHD_STOP(["/over max translation depth/d
8938 /ofproto_dpif_upcall/d"])
8939 AT_CLEANUP
8940
8941 AT_SETUP([ofproto-dpif - exponential resubmit chain])
8942 OVS_VSWITCHD_START
8943 add_of_ports br0 1
8944 (for i in `seq 1 64`; do
8945 j=`expr $i + 1`
8946 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8947 done
8948 echo "in_port=65, actions=local") > flows
8949 AT_CHECK([ovs-ofctl add-flows br0 flows])
8950 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8951 AT_CHECK([tail -1 stdout], [0],
8952 [Translation failed (Too many resubmits), packet is dropped.
8953 ])
8954 AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
8955 ])
8956 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
8957 AT_CLEANUP
8958
8959 AT_SETUP([ofproto-dpif - too many output actions])
8960 OVS_VSWITCHD_START
8961 add_of_ports br0 1
8962 (for i in `seq 1 12`; do
8963 j=`expr $i + 1`
8964 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8965 done
8966 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
8967 AT_CHECK([ovs-ofctl add-flows br0 flows])
8968 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8969 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
8970 [0], [1
8971 ])
8972 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
8973 ])
8974 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
8975 AT_CLEANUP
8976
8977 AT_SETUP([ofproto-dpif - stack too deep])
8978 OVS_VSWITCHD_START
8979 add_of_ports br0 1
8980 (for i in `seq 1 12`; do
8981 j=`expr $i + 1`
8982 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8983 done
8984 push="push:NXM_NX_REG0[[]]"
8985 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
8986 AT_CHECK([ovs-ofctl add-flows br0 flows])
8987 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8988 AT_CHECK([tail -1 stdout], [0],
8989 [Translation failed (Stack too deep), packet is dropped.
8990 ])
8991 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
8992 ])
8993 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
8994 AT_CLEANUP
8995
8996
8997 AT_SETUP([ofproto-dpif packet-out controller])
8998 OVS_VSWITCHD_START
8999 add_of_ports br0 1 2
9000
9001 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
9002
9003 AT_CAPTURE_FILE([ofctl_monitor.log])
9004 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9005
9006 for i in 1 2 3; do
9007 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
9008 done
9009
9010 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9011 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9012 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
9013 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9014 dnl
9015 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
9016 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9017 dnl
9018 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
9019 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9020 ])
9021
9022 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
9023 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9024 NXST_FLOW reply:
9025 ])
9026
9027 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0],
9028 [OFPST_TABLE reply (OF1.3) (xid=0x2):
9029 table 0:
9030 active=1, lookup=0, matched=0
9031
9032 table 1:
9033 active=0, lookup=0, matched=0
9034
9035 tables 2...253: ditto
9036 ])
9037
9038 OVS_VSWITCHD_STOP
9039 AT_CLEANUP
9040
9041 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
9042 OVS_VSWITCHD_START(
9043 [-- \
9044 add-port br0 p1 -- \
9045 set interface p1 type=patch options:peer=p2 -- \
9046 add-br br1 -- \
9047 set bridge br1 datapath-type=dummy -- \
9048 set bridge br1 fail-mode=secure -- \
9049 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
9050 add-port br1 p2 -- \
9051 set interface p2 type=patch options:peer=p1 --])
9052
9053 AT_CAPTURE_FILE([ofctl_monitor.log])
9054 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9055
9056 for i in 1 2 3; do
9057 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
9058 done
9059
9060 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9061 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9062 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
9063 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9064 dnl
9065 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
9066 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9067 dnl
9068 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
9069 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9070 ])
9071
9072 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9073 OFPST_TABLE reply (OF1.3) (xid=0x2):
9074 table 0:
9075 active=0, lookup=0, matched=0
9076
9077 tables 1...253: ditto
9078 ])
9079
9080 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1], [0], [dnl
9081 OFPST_TABLE reply (OF1.3) (xid=0x2):
9082 table 0:
9083 active=0, lookup=3, matched=0
9084
9085 table 1:
9086 active=0, lookup=0, matched=0
9087
9088 tables 2...253: ditto
9089 ])
9090
9091 OVS_VSWITCHD_STOP
9092 AT_CLEANUP
9093
9094 AT_SETUP([ofproto-dpif packet-out pipeline match field (OpenFlow 1.5)])
9095 OVS_VSWITCHD_START
9096
9097 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=8}->tun_metadata2"])
9098 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata3"])
9099 AT_DATA([flows.txt], [dnl
9100 table=0,in_port=1 actions=controller
9101 table=0,tun_id=3 actions=controller
9102 table=0,metadata=5 actions=controller
9103 table=0,reg0=1,reg4=2,reg8=3,reg12=5 actions=controller
9104 table=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 actions=controller
9105 table=0,tun_metadata3=0x11 actions=controller
9106 ])
9107 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
9108
9109 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
9110 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
9111 ovs-appctl -t ovs-ofctl ofctl/barrier
9112 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
9113 AT_CAPTURE_FILE([monitor.log])
9114
9115 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=1 packet=0001020304050010203040501111 actions=table"])
9116 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tunnel_id=3 packet=0001020304050010203040502222 actions=table"])
9117 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,metadata=5 packet=0001020304050010203040503333 actions=table"])
9118 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,reg0=1,reg4=2,reg8=3,reg12=5 packet=0001020304050010203040503333 actions=table"])
9119 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"])
9120 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_metadata2=0x22,tun_metadata3=0x11 packet=0001020304050010203040503333 actions=table"])
9121
9122 ovs-appctl -t ovs-ofctl ofctl/barrier
9123 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9124
9125 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
9126 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 in_port=1 (via packet_out) data_len=14 (unbuffered)
9127 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1111
9128 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_id=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
9129 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x2222
9130 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 metadata=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
9131 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9132 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)
9133 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9134 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)
9135 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9136 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)
9137 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9138 OFPT_BARRIER_REPLY (OF1.5):
9139 ])
9140
9141 OVS_VSWITCHD_STOP
9142 AT_CLEANUP
9143
9144 AT_SETUP([ofproto-dpif packet-out goto_table])
9145 OVS_VSWITCHD_START
9146 add_of_ports br0 1 2
9147
9148 AT_DATA([flows.txt], [dnl
9149 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
9150 table=1 dl_dst=50:54:00:00:00:0a actions=controller
9151 ])
9152 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
9153
9154 AT_CAPTURE_FILE([ofctl_monitor.log])
9155 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9156
9157 for i in 1 2 3; do
9158 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
9159 done
9160
9161 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
9162 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9163 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9164 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9165 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9166 dnl
9167 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9168 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9169 dnl
9170 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9171 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9172 ])
9173
9174 AT_CHECK([ovs-appctl revalidator/purge], [0])
9175 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
9176 n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=goto_table:1
9177 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9178 OFPST_FLOW reply (OF1.3):
9179 ])
9180
9181 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9182 OFPST_TABLE reply (OF1.3) (xid=0x2):
9183 table 0:
9184 active=1, lookup=3, matched=3
9185
9186 table 1: ditto
9187
9188 table 2:
9189 active=0, lookup=0, matched=0
9190
9191 tables 3...253: ditto
9192 ])
9193
9194 OVS_VSWITCHD_STOP
9195 AT_CLEANUP
9196
9197
9198 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
9199 OVS_VSWITCHD_START
9200 add_of_ports br0 1 2
9201
9202 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
9203 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
9204
9205 AT_CAPTURE_FILE([ofctl_monitor.log])
9206 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9207
9208 for i in 1 2 3; do
9209 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
9210 done
9211
9212 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
9213 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9214 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9215 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9216 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9217 dnl
9218 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9219 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9220 dnl
9221 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9222 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9223 ])
9224
9225 AT_CHECK([ovs-appctl revalidator/purge], [0])
9226 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
9227 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9228 OFPST_FLOW reply (OF1.1):
9229 ])
9230
9231 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9232 OFPST_TABLE reply (OF1.3) (xid=0x2):
9233 table 0:
9234 active=0, lookup=3, matched=0
9235
9236 table 1:
9237 active=1, lookup=3, matched=3
9238
9239 table 2:
9240 active=0, lookup=0, matched=0
9241
9242 tables 3...253: ditto
9243 ])
9244
9245 OVS_VSWITCHD_STOP
9246 AT_CLEANUP
9247
9248 AT_SETUP([ofproto-dpif - ICMPv6])
9249 OVS_VSWITCHD_START
9250 add_of_ports br0 1
9251
9252 AT_CAPTURE_FILE([ofctl_monitor.log])
9253
9254 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9255
9256 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9257
9258 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9259
9260 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9261 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
9262 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
9263 ])
9264
9265 OVS_VSWITCHD_STOP
9266 AT_CLEANUP
9267
9268 AT_SETUP([ofproto-dpif - ICMPv6 type match])
9269 OVS_VSWITCHD_START
9270 add_of_ports br0 1 2 3
9271
9272 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
9273 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
9274
9275 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9276
9277 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)'])
9278 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)'])
9279 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)'])
9280 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)'])
9281
9282 AT_CHECK([ovs-appctl revalidator/purge], [0])
9283
9284 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9285 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
9286 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
9287 ])
9288
9289 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
9290 n_packets=2, n_bytes=252, icmp6,icmp_type=128 actions=output:2
9291 n_packets=2, n_bytes=252, icmp6,icmp_type=129 actions=output:3
9292 NXST_FLOW reply:
9293 ])
9294
9295 OVS_VSWITCHD_STOP
9296 AT_CLEANUP
9297
9298 AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
9299 OVS_VSWITCHD_START
9300 add_of_ports br0 1
9301 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])
9302
9303 AT_CAPTURE_FILE([ofctl_monitor.log])
9304
9305 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9306
9307 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9308
9309 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9310
9311 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9312 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
9313 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
9314 ])
9315
9316 OVS_VSWITCHD_STOP
9317 AT_CLEANUP
9318
9319 # Tests the exact match of CFI bit in installed datapath flows matching VLAN.
9320 AT_SETUP([ofproto-dpif - vlan matching])
9321 OVS_VSWITCHD_START(
9322 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
9323 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9324
9325 AT_CHECK([ovs-ofctl del-flows br0])
9326 AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
9327
9328 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))'])
9329
9330 OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
9331 AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
9332 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>
9333 ])
9334 OVS_VSWITCHD_STOP
9335 AT_CLEANUP
9336
9337 # Tests in place modification of installed datapath flows.
9338 AT_SETUP([ofproto-dpif - in place modification])
9339 OVS_VSWITCHD_START(
9340 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9341 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9342
9343 AT_CHECK([ovs-ofctl del-flows br0])
9344 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
9345
9346 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9347
9348 ovs-appctl time/stop
9349
9350 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)'])
9351
9352 # Wait for the flow setup to be done.
9353 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9354
9355 for i in 1 2; do
9356 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
9357 done
9358
9359 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9360 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
9361 ])
9362
9363 AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
9364
9365 ovs-appctl time/warp 500
9366 ovs-appctl time/warp 500
9367
9368 for i in 1 2 3; do
9369 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
9370 done
9371
9372 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9373 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
9374 ])
9375
9376 AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
9377 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
9378 ])
9379 OVS_VSWITCHD_STOP
9380 AT_CLEANUP
9381
9382 # Tests in place modification of installed datapath flows with vlans.
9383 AT_SETUP([ofproto-dpif - in place modification (vlan)])
9384 OVS_VSWITCHD_START(
9385 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9386 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9387
9388 # Always drop misses
9389 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all drop])
9390 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
9391
9392 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9393
9394 ovs-appctl time/stop
9395
9396 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)'])
9397
9398 # Check that a correct datapath flow is created.
9399 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9400
9401 for i in 1 2; do
9402 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
9403 done
9404
9405 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9406 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:100
9407 ])
9408
9409 # Delete the flow. Then check that the datapath flow is modified to
9410 # drop the packets. A modified flow inherits the stats, a new
9411 # datapath flow would start from sero.
9412 AT_CHECK([ovs-ofctl del-flows br0])
9413
9414 ovs-appctl time/warp 500
9415 ovs-appctl time/warp 500
9416
9417 for i in 1 2 3; do
9418 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
9419 done
9420
9421 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9422 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:drop
9423 ])
9424
9425 # Add a flow that matches the non-presence of a vlan tag, and check
9426 # that the datapath flow is modified accordingly.
9427 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
9428
9429 ovs-appctl time/warp 500
9430 ovs-appctl time/warp 500
9431
9432 for i in 1 2 3; do
9433 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
9434 done
9435
9436 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9437 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9438 ])
9439
9440 # Check that VLAN packets will not hit the same datapath megaflow.
9441
9442 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))'])
9443 OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
9444
9445 for i in 1 2; do
9446 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x1234))'
9447 done
9448
9449 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9450 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9451 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
9452 ])
9453
9454 # Check that the new flow matches the CFI bit, while both vid and pcp
9455 # are wildcarded.
9456 AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
9457 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), actions:100
9458 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:drop
9459 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
9460 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
9461 ])
9462 OVS_VSWITCHD_STOP
9463 AT_CLEANUP
9464
9465 AT_SETUP([ofproto-dpif - trace (unchanged)])
9466 OVS_VSWITCHD_START
9467 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
9468 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9469 ])
9470 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
9471 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9472 ])
9473
9474 OVS_VSWITCHD_STOP
9475 AT_CLEANUP
9476
9477 AT_SETUP([ofproto-dpif - conntrack - controller])
9478 OVS_VSWITCHD_START
9479
9480 add_of_ports br0 1 2
9481
9482 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9483
9484 dnl Allow new UDP connections on p1 for dst port 2, drop everything else.
9485 AT_DATA([flows.txt], [dnl
9486 dnl Table 0
9487 dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2).
9488 dnl
9489 table=0,priority=100,arp,action=normal
9490 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)
9491 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)
9492 table=0,priority=1,action=drop
9493 dnl
9494 dnl Pass tracked traffic through ACL, drop everything else.
9495 dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers
9496 dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets
9497 dnl get the ACL lookup using the conntrack tuple and the inverted direction.
9498 dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
9499 dnl of the master connection, as storted in ct_mark.
9500 dnl
9501 dnl Incoming non-related packet in the original direction (ACL IN)
9502 table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5
9503 dnl Incoming non-related reply packet (CT ACL OUT)
9504 table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4
9505 dnl Outgoing non-related packet (ACL OUT)
9506 table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5
9507 dnl Outgoing non-related reply packet (CT ACL IN)
9508 table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
9509 dnl
9510 dnl Related packet (CT ACL in the direction of the master connection.)
9511 table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
9512 dnl Drop everything else.
9513 table=1 priority=0, action=drop
9514 dnl
9515 dnl "ACL table"
9516 dnl
9517 dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with
9518 dnl UDP destination port '2'. Store rule ID (1234) in reg1, verdict
9519 dnl in reg2.
9520 table=3 priority=10, reg0=1, udp, udp_dst=2 action=set_field:1234->reg1,set_field:1->reg2
9521 dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235)
9522 table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2
9523 dnl
9524 dnl Re-process stateful traffic that was not accepted by a stateful rule as
9525 dnl normal traffic in the current direction. This should also delete the
9526 dnl now stale conntrack state, so that new state can be created in it's place.
9527 dnl
9528 dnl Stateful accepts go to next table.
9529 table=4 priority=100 reg2=1, action=goto_table:5
9530 dnl Everything else is reprocessed disregarding the CT state, using the actual
9531 dnl packet direction.
9532 table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5
9533 dnl
9534 dnl "ACL verdict processing table."
9535 dnl
9536 dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0)
9537 dnl
9538 dnl Drop all non-accepted packets.
9539 table=5 reg2=0 priority=1000 action=drop
9540 dnl Commit new non-related IP connections.
9541 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
9542 dnl Commit new related connections in either direction, which inherit the mark
9543 dnl (the direction of the original direction master tuple) from the master
9544 dnl connection.
9545 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
9546 dnl Forward everything else, including stateless accepts.
9547 table=5 priority=0 action=goto_table:6
9548 dnl
9549 dnl "Forwarding table"
9550 dnl
9551 table=6 action=controller
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 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9572 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)
9573 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
9574 dnl
9575 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)
9576 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
9577 ])
9578
9579 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9580
9581 dnl OK, now start a second connection from port 1
9582 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)'])
9583
9584 dnl Now try a reply from port 2.
9585 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)'])
9586
9587
9588 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9589 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9590
9591 dnl Check this output. We should see both packets
9592 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9593 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)
9594 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
9595 dnl
9596 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)
9597 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
9598 ])
9599
9600 OVS_VSWITCHD_STOP
9601 AT_CLEANUP
9602
9603 AT_SETUP([ofproto-dpif - conntrack - force commit])
9604 OVS_VSWITCHD_START
9605
9606 add_of_ports br0 1 2
9607
9608 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9609
9610 dnl Allow new connections on p1->p2, but not on p2->p1.
9611 AT_DATA([flows.txt], [dnl
9612 dnl Table 0
9613 dnl
9614 table=0,priority=100,arp,action=normal
9615 table=0,priority=10,in_port=1,udp,action=ct(commit),controller
9616 table=0,priority=10,in_port=2,udp,action=ct(table=1)
9617 table=0,priority=1,action=drop
9618 dnl
9619 dnl Table 1
9620 dnl
9621 table=1,priority=10,in_port=2,ct_state=+est,udp,action=ct(force,commit),controller
9622 table=1,priority=1,action=drop
9623 ])
9624
9625 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9626
9627 AT_CAPTURE_FILE([ofctl_monitor.log])
9628 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9629
9630 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)'])
9631
9632 dnl OK, now start a new connection from port 1.
9633 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)'])
9634
9635 dnl Now try a reply from port 2.
9636 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)'])
9637
9638 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9639 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9640
9641 dnl Check this output. We only see the latter two packets, not the first.
9642 dnl Note that the first packet doesn't have the ct_state bits set. This
9643 dnl happens because the ct_state field is available only after recirc.
9644 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9645 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9646 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
9647 dnl
9648 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9649 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
9650 ])
9651
9652 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9653
9654 dnl OK, now start a second connection from port 1
9655 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)'])
9656
9657 dnl Now try a reply from port 2.
9658 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)'])
9659
9660 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9661 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9662
9663 dnl Check this output. We should see both packets
9664 dnl Note that the first packet doesn't have the ct_state bits set. This
9665 dnl happens because the ct_state field is available only after recirc.
9666 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9667 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9668 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
9669 dnl
9670 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9671 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
9672 ])
9673
9674 dnl
9675 dnl Check that the directionality has been changed by force commit.
9676 dnl
9677 AT_CHECK([ovs-appctl dpctl/dump-conntrack | sort], [], [dnl
9678 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)
9679 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)
9680 ])
9681
9682 OVS_VSWITCHD_STOP
9683 AT_CLEANUP
9684
9685 AT_SETUP([ofproto-dpif - conntrack - ipv6])
9686 OVS_VSWITCHD_START
9687
9688 add_of_ports br0 1 2
9689
9690 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9691
9692 dnl Allow new connections on p1->p2, but not on p2->p1.
9693 AT_DATA([flows.txt], [dnl
9694 dnl Table 0
9695 dnl
9696 table=0,priority=100,arp,action=normal
9697 table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
9698 table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
9699 table=0,priority=1,action=drop
9700 dnl Table 1
9701 dnl
9702 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
9703 table=1,priority=1,action=drop
9704 ])
9705
9706 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9707
9708 AT_CAPTURE_FILE([ofctl_monitor.log])
9709 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9710
9711 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)'])
9712
9713 dnl OK, now start a new connection from port 1.
9714 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)'])
9715
9716 dnl Now try a reply from port 2.
9717 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)'])
9718
9719 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9720 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9721
9722 dnl Check this output. We only see the latter two packets, not the first.
9723 dnl Note that the first packet doesn't have the ct_state bits set. This
9724 dnl happens because the ct_state field is available only after recirc.
9725 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9726 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
9727 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
9728 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)
9729 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
9730 ])
9731
9732 OVS_VSWITCHD_STOP
9733 AT_CLEANUP
9734
9735 AT_SETUP([ofproto-dpif - conntrack - output action])
9736 OVS_VSWITCHD_START
9737
9738 add_of_ports br0 1 2
9739
9740 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9741
9742 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9743 AT_DATA([flows.txt], [dnl
9744 dnl The flows are in two separate tables for two reasons:
9745 dnl * To make the pipeline more clear.
9746 dnl * To make megaflows more consistent (we check megaflows below). The
9747 dnl unwildcarding in megaflows depends on the internal ordering of the
9748 dnl subtables, which are sorted using the system qsort(). qsort()
9749 dnl is provided by libc and may or may not be stable, so we can't rely
9750 dnl on that. By having separate tables we have more control over which
9751 dnl subtables are visited, meaning consistent megaflows.
9752 dnl
9753 dnl Table 0
9754 dnl
9755 table=0,priority=100,arp,action=normal
9756 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
9757 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9758 table=0,priority=1,action=drop
9759 dnl
9760 dnl Table 1
9761 dnl
9762 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
9763 table=1,priority=1,action=drop
9764 ])
9765
9766 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9767
9768
9769 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)'])
9770
9771 dnl OK, now start a new connection from port 1.
9772 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)'])
9773
9774 dnl Now try a reply from port 2.
9775 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)'])
9776
9777 dnl OK, now start a second connection from port 1
9778 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)'])
9779
9780 dnl Now try a reply from port 2.
9781 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)'])
9782
9783
9784 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9785 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
9786 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
9787 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
9788 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct,recirc(0x1)
9789 ])
9790
9791 OVS_VSWITCHD_STOP
9792 AT_CLEANUP
9793
9794 AT_SETUP([ofproto-dpif - conntrack - expiration])
9795 OVS_VSWITCHD_START
9796
9797 add_of_ports br0 1 2
9798
9799 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9800
9801 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9802 AT_DATA([flows.txt], [dnl
9803 dnl Table 0
9804 dnl
9805 table=0,priority=100,arp,action=normal
9806 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
9807 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9808 table=0,priority=1,action=drop
9809 dnl
9810 dnl Table 1
9811 dnl
9812 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9813 table=1,priority=1,action=drop
9814 ])
9815
9816 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9817
9818 AT_CAPTURE_FILE([ofctl_monitor.log])
9819 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9820
9821 AT_CHECK([ovs-appctl time/stop])
9822
9823 dnl Start a new connection from port 1.
9824 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)'])
9825
9826 dnl Now try a reply from port 2.
9827 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)'])
9828
9829 ovs-appctl time/warp 100000
9830
9831 dnl Now try another reply from port 2.
9832 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)'])
9833
9834 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
9835 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9836
9837 dnl Check this output. Only one reply must be there
9838 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9839 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)
9840 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
9841 dnl
9842 OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
9843 ])
9844
9845 OVS_VSWITCHD_STOP
9846 AT_CLEANUP
9847
9848 AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
9849 OVS_VSWITCHD_START
9850
9851 add_of_ports br0 1 2
9852
9853 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9854
9855 AT_DATA([flows.txt], [dnl
9856 ipv6,ct_state=-trk,action=ct(table=0,zone=0)
9857 ct_state=+trk,action=controller
9858 ])
9859
9860 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9861
9862 AT_CAPTURE_FILE([ofctl_monitor.log])
9863 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9864
9865 AT_CHECK([ovs-appctl time/stop])
9866
9867 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
9868
9869 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
9870 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9871
9872 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9873 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,ipv6,in_port=2 (via action) data_len=86 (unbuffered)
9874 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
9875 ])
9876
9877 OVS_VSWITCHD_STOP
9878 AT_CLEANUP
9879
9880 AT_SETUP([ofproto-dpif - conntrack - zones])
9881 OVS_VSWITCHD_START
9882
9883 add_of_ports br0 1 2 3 4
9884
9885 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9886
9887 dnl Allow new connections on p1->p2 or p3->p4.
9888 dnl Allow only established connections p2->p1 and p4->p3
9889 dnl p1,p2 and p3,p4 are on different zones
9890 AT_DATA([flows.txt], [dnl
9891 dnl Table 0
9892 dnl
9893 table=0,priority=100,arp,action=normal
9894 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
9895 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9896 table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
9897 table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
9898 table=0,priority=1,action=drop
9899 dnl
9900 dnl Table 1
9901 dnl
9902 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9903 table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
9904 table=1,priority=1,action=drop
9905 ])
9906
9907 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9908
9909 AT_CAPTURE_FILE([ofctl_monitor.log])
9910 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9911
9912 dnl Basic "only established" test on ports 1,2
9913
9914 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)'])
9915 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)'])
9916 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)'])
9917
9918 dnl Now use the same 5-tuples but on ports 3,4
9919
9920 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)'])
9921 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)'])
9922 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)'])
9923
9924 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9925 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9926
9927 dnl Check this output. We only see the latter two packets (for each zone), not the first.
9928 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9929 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9930 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
9931 dnl
9932 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)
9933 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
9934 dnl
9935 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=3 (via action) data_len=106 (unbuffered)
9936 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
9937 dnl
9938 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)
9939 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
9940 ])
9941
9942 OVS_VSWITCHD_STOP
9943 AT_CLEANUP
9944
9945 AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
9946 OVS_VSWITCHD_START
9947
9948 add_of_ports br0 1 2
9949
9950 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9951
9952 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9953 AT_DATA([flows.txt], [dnl
9954 dnl Table 0
9955 dnl
9956 table=0,priority=100,arp,action=normal
9957 table=0,priority=10,udp,action=ct(table=1,zone=0)
9958 table=0,priority=1,action=drop
9959 dnl
9960 dnl Table 1
9961 dnl
9962 table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
9963 table=1,priority=10,ct_state=+trk+est,udp,action=controller
9964 table=1,priority=1,action=drop
9965 ])
9966
9967 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9968
9969 AT_CAPTURE_FILE([ofctl_monitor.log])
9970 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9971
9972 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)'])
9973
9974 dnl OK, now start a new connection from port 1.
9975 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)'])
9976
9977 dnl Now try a reply from port 2.
9978 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)'])
9979
9980 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9981 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9982
9983 dnl Check this output. We only see the latter two packets, not the first.
9984 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9985 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9986 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
9987 dnl
9988 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)
9989 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
9990 ])
9991
9992 OVS_VSWITCHD_STOP
9993 AT_CLEANUP
9994
9995 AT_SETUP([ofproto-dpif - conntrack - ICMP related])
9996 OVS_VSWITCHD_START
9997
9998 add_of_ports br0 1 2
9999
10000 dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
10001 AT_DATA([flows.txt], [dnl
10002 dnl Table 0
10003 dnl
10004 table=0,priority=100,arp,action=normal
10005 table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
10006 table=0,priority=10,ip,in_port=2,action=ct(table=1)
10007 table=0,priority=1,action=drop
10008 dnl
10009 dnl Table 1
10010 dnl
10011 table=1,priority=10,in_port=1,ct_state=+trk,action=controller
10012 table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
10013 table=1,priority=1,action=drop
10014 ])
10015
10016 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10017
10018 AT_CAPTURE_FILE([ofctl_monitor.log])
10019 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10020
10021 dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
10022 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
10023
10024 dnl 2. Send and UDP packet to port 5555
10025 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
10026
10027 dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
10028 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
10029
10030 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10031 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10032
10033 dnl Check this output. We only see the first and the last packet
10034 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10035 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)
10036 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
10037 dnl
10038 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)
10039 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
10040 ])
10041
10042 OVS_VSWITCHD_STOP
10043 AT_CLEANUP
10044
10045 AT_SETUP([ofproto-dpif - conntrack - ct_mark])
10046 OVS_VSWITCHD_START
10047
10048 add_of_ports br0 1 2
10049
10050 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10051
10052 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10053 AT_DATA([flows.txt], [dnl
10054 dnl Table 0
10055 dnl
10056 table=0,arp,action=normal
10057 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
10058 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
10059 table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
10060 table=0,ip,in_port=2,actions=ct(table=1)
10061 table=0,priority=0,action=drop
10062 dnl
10063 dnl Table 1
10064 dnl
10065 table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
10066 table=1,priority=1,action=drop
10067 ])
10068
10069 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10070
10071 AT_CAPTURE_FILE([ofctl_monitor.log])
10072 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10073
10074 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)'])
10075 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)'])
10076 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)'])
10077
10078 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)'])
10079 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)'])
10080 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)'])
10081
10082 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
10083 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10084
10085 dnl Check this output.
10086 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10087 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10088 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
10089 dnl
10090 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10091 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
10092 dnl
10093 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10094 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
10095 dnl
10096 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)
10097 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
10098 dnl
10099 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)
10100 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
10101 ])
10102
10103 OVS_VSWITCHD_STOP
10104 AT_CLEANUP
10105
10106 AT_SETUP([ofproto-dpif - conntrack - ct_label])
10107 OVS_VSWITCHD_START
10108
10109 add_of_ports br0 1 2
10110
10111 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10112
10113 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10114 AT_DATA([flows.txt], [dnl
10115 dnl Table 0
10116 dnl
10117 table=0,arp,action=normal
10118 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
10119 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
10120 table=0,ip,in_port=2,actions=ct(table=1)
10121 dnl
10122 dnl Table 1
10123 dnl
10124 table=1,priority=10,ct_state=+trk+rpl,actions=controller
10125 table=1,priority=1,action=drop
10126 ])
10127
10128 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10129
10130 AT_CAPTURE_FILE([ofctl_monitor.log])
10131 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10132
10133 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)'])
10134 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)'])
10135
10136 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)'])
10137 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)'])
10138
10139 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10140 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10141
10142 dnl Check this output.
10143 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10144 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)
10145 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
10146 dnl
10147 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)
10148 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
10149 ])
10150
10151 OVS_VSWITCHD_STOP
10152 AT_CLEANUP
10153
10154 AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
10155 OVS_VSWITCHD_START
10156
10157 add_of_ports br0 1 2
10158
10159 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10160
10161 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10162 AT_DATA([flows.txt], [dnl
10163 dnl The flows are in two separate tables for two reasons:
10164 dnl * To make the pipeline more clear.
10165 dnl * To make megaflows more consistent (we check megaflows below). The
10166 dnl unwildcarding in megaflows depends on the internal ordering of the
10167 dnl subtables, which are sorted using the system qsort(). qsort()
10168 dnl is provided by libc and may or may not be stable, so we can't rely
10169 dnl on that. By having separate tables we have more control over which
10170 dnl subtables are visited, meaning consistent megaflows.
10171 dnl
10172 dnl Table 0
10173 dnl
10174 table=0,arp,action=normal
10175 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
10176 table=0,ip,in_port=2,actions=ct(table=1)
10177 table=0,priority=0,action=drop
10178 dnl
10179 dnl Table 1
10180 dnl
10181 table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
10182 table=1,priority=1,action=drop
10183 ])
10184
10185 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10186
10187 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)'])
10188 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)'])
10189
10190 # Give time for logs to appear.
10191 ovs-appctl revalidator/wait
10192
10193 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
10194 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
10195 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
10196 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
10197 ])
10198
10199 OVS_VSWITCHD_STOP
10200 AT_CLEANUP
10201
10202 AT_SETUP([ofproto-dpif - conntrack - no output])
10203 OVS_VSWITCHD_START
10204
10205 add_of_ports br0 1
10206
10207 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10208
10209 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10210 AT_DATA([flows.txt], [dnl
10211 in_port=1,udp,action=ct(commit,zone=0)
10212 ])
10213
10214 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10215
10216 dnl Start a new connection from port 1.
10217 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)'])
10218
10219 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
10220 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
10221 ])
10222
10223 OVS_VSWITCHD_STOP
10224 AT_CLEANUP
10225
10226 AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
10227 OVS_VSWITCHD_START
10228
10229 add_of_ports br0 1 2
10230
10231 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10232
10233 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10234 AT_DATA([flows.txt], [dnl
10235 dnl Table 0
10236 dnl
10237 table=0,priority=100,arp,action=normal
10238 table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10239 table=0,priority=10,in_port=2,ip,action=ct(table=1)
10240 table=0,priority=1,action=drop
10241 dnl
10242 dnl Table 1
10243 dnl
10244 dnl The following two flows are separated to explicitly count the packets
10245 dnl that create a new connection
10246 table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10247 table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
10248 dnl
10249 table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10250 table=1,ip,ct_state=+trk+inv,action=drop
10251 ])
10252
10253 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10254
10255 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10256 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10257 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10258 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
10259 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10260 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10261 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10262 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10263 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10264
10265 AT_CHECK([ovs-appctl revalidator/purge])
10266 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10267 dnl Only one new connection
10268 n_packets=1
10269 ])
10270
10271 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
10272 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
10273 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
10274 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
10275 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
10276 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
10277 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
10278 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
10279 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
10280
10281 AT_CHECK([ovs-appctl revalidator/purge])
10282 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10283 dnl Two new connections
10284 n_packets=2
10285 ])
10286
10287 OVS_VSWITCHD_STOP
10288 AT_CLEANUP
10289
10290 AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
10291 OVS_VSWITCHD_START
10292
10293 add_of_ports br0 1 2
10294
10295 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10296
10297 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10298 AT_DATA([flows.txt], [dnl
10299 dnl Table 0
10300 dnl
10301 table=0,priority=100,arp,action=normal
10302 table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
10303 table=0,priority=10,in_port=2,tcp,action=ct(table=1)
10304 table=0,priority=1,action=drop
10305 dnl
10306 dnl Table 1
10307 dnl
10308 table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
10309 table=1,priority=1,action=drop
10310 ])
10311
10312 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10313
10314 AT_CHECK([ovs-appctl revalidator/purge])
10315 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10316 dnl No dropped packets
10317 n_packets=0
10318 ])
10319
10320 AT_CAPTURE_FILE([ofctl_monitor.log])
10321 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10322
10323 dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
10324 dnl sure that the connection tracker is able to pick up already established
10325 dnl connections that use window scaling.
10326 dnl
10327 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
10328 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
10329 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
10330 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
10331 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
10332 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a08004500022afc284000400626a10a0101020a01010100020001396bb35b8cadbdb45018000a941f0000 dnl
10333 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10334 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10335 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10336 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10337 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10338 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10339 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10340 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10341 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10342 6666666666666666666666666666666666666666666666666666660a'])
10343 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
10344 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a5054000000090800450001fdf2ca40004006302c0a0101010a010102000100028cadbdb4396bb55d5018000aa60c0000 dnl
10345 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10346 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10347 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10348 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10349 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10350 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10351 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10352 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10353 6565656565656565656565656565656565656565656565656565656565656565656565650a'])
10354 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
10355 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
10356 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
10357 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
10358 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
10359
10360 AT_CHECK([ovs-appctl revalidator/purge])
10361
10362 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10363
10364 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10365 ])
10366
10367 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10368 dnl No dropped packets
10369 n_packets=0
10370 ])
10371
10372 OVS_VSWITCHD_STOP
10373 AT_CLEANUP
10374
10375 AT_SETUP([ofproto-dpif - conntrack - disable tcp sequence checking])
10376 OVS_VSWITCHD_START
10377
10378 add_of_ports br0 1 2
10379
10380 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10381 AT_DATA([flows.txt], [dnl
10382 dnl Table 0
10383 dnl
10384 table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10385 table=0,priority=10,in_port=2,ip,action=ct(table=1)
10386 table=0,priority=1,action=drop
10387 dnl
10388 dnl Table 1
10389 dnl
10390 dnl The following two flows are separated to explicitly count the packets
10391 dnl that create a new connection
10392 table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10393 table=1,priority=100,cookie=0x2,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
10394 dnl
10395 table=1,priority=100,cookie=0x3,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10396 table=1,cookie=0x4,ip,ct_state=+trk+inv,action=drop
10397 ])
10398
10399 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10400
10401 dnl Send 9 packets; one packet will be marked invalid.
10402 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10403 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10404 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10405 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10406 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10407 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10408 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10409 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10410 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10411
10412 AT_CHECK([ovs-appctl revalidator/purge])
10413 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10414 n_packets=1
10415 ])
10416
10417 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10418 n_packets=4
10419 ])
10420
10421 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10422 n_packets=3
10423 ])
10424
10425 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10426 n_packets=1
10427 ])
10428
10429 AT_CHECK([ovs-appctl dpctl/flush-conntrack])
10430
10431 AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10432 TCP sequence checking: enabled
10433 ])
10434
10435 AT_CHECK([ovs-appctl dpctl/ct-disable-tcp-seq-chk], [], [dnl
10436 disabling TCP sequence checking successful
10437 ])
10438
10439 AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10440 TCP sequence checking: disabled
10441 ])
10442
10443 dnl Send exactly the same 9 packets to confirm no additional packets are marked invalid.
10444 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10445 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10446 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10447 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10448 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10449 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10450 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10451 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10452 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10453
10454 AT_CHECK([ovs-appctl revalidator/purge])
10455 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10456 n_packets=2
10457 ])
10458
10459 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10460 n_packets=8
10461 ])
10462
10463 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10464 n_packets=7
10465 ])
10466
10467 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10468 n_packets=1
10469 ])
10470
10471 AT_CHECK([ovs-appctl dpctl/ct-enable-tcp-seq-chk], [], [dnl
10472 enabling TCP sequence checking successful
10473 ])
10474
10475 AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10476 TCP sequence checking: enabled
10477 ])
10478
10479 AT_CHECK([ovs-appctl dpctl/flush-conntrack])
10480
10481 dnl Send exactly the same 9 packets after disabling TCP sequence checking to
10482 dnl confirm one more packet is marked invalid.
10483 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10484 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10485 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10486 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10487 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10488 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10489 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10490 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10491 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10492
10493 AT_CHECK([ovs-appctl revalidator/purge])
10494 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10495 n_packets=3
10496 ])
10497
10498 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10499 n_packets=12
10500 ])
10501
10502 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10503 n_packets=10
10504 ])
10505
10506 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10507 n_packets=2
10508 ])
10509
10510 OVS_VSWITCHD_STOP
10511 AT_CLEANUP
10512
10513 dnl This is a truncated version of "ofproto-dpif - conntrack - controller",
10514 dnl with extra send-to-controller actions following ct_clear to show that
10515 dnl the connection tracking data has been cleared.
10516 AT_SETUP([ofproto-dpif - conntrack - ct_clear])
10517 OVS_VSWITCHD_START
10518
10519 add_of_ports br0 1 2
10520
10521 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10522
10523 dnl Allow new connections on p1->p2, but not on p2->p1.
10524 AT_DATA([flows.txt], [dnl
10525 dnl Table 0
10526 dnl
10527 table=0,priority=100,arp,action=normal
10528 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller,ct_clear,controller
10529 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10530 table=0,priority=1,action=drop
10531 dnl
10532 dnl Table 1
10533 dnl
10534 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller,ct_clear,controller
10535 table=1,priority=1,action=drop
10536 ])
10537
10538 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10539
10540 AT_CAPTURE_FILE([ofctl_monitor.log])
10541 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10542
10543 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)'])
10544
10545 dnl OK, now start a new connection from port 1.
10546 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)'])
10547
10548 dnl Now try a reply from port 2.
10549 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)'])
10550
10551 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
10552 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10553
10554 dnl Check this output. We only see the latter two packets, not the first.
10555 dnl Note that the first packet doesn't have the ct_state bits set. This
10556 dnl happens because the ct_state field is available only after recirc.
10557 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10558 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10559 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
10560 dnl
10561 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10562 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
10563 dnl
10564 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)
10565 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
10566 dnl
10567 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
10568 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
10569 ])
10570 OVS_VSWITCHD_STOP
10571 AT_CLEANUP
10572
10573 AT_SETUP([ofproto-dpif - conntrack - match masked ct fields])
10574 OVS_VSWITCHD_START
10575
10576 add_of_ports br0 1 2
10577
10578 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10579
10580 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10581 AT_DATA([flows.txt], [dnl
10582 table=0,arp,action=normal
10583 table=0,ip,in_port=1,udp,nw_src=10.1.2.1/24,action=ct(commit)
10584 table=0,ip,in_port=1,udp6,ipv6_dst=2001:db8::1/64,action=ct(commit)
10585 table=0,ip,in_port=1,udp,tp_src=3/0x1,action=ct(commit)
10586 table=0,ip,in_port=2,actions=ct(table=1)
10587 table=0,ip6,in_port=2,actions=ct(table=1)
10588 table=1,priority=10,udp,ct_state=+trk+rpl,ct_nw_src=10.1.2.1/24,actions=controller
10589 table=1,priority=10,udp6,ct_state=+trk+rpl,ct_ipv6_dst=2001:db8::1/64,actions=controller
10590 table=1,priority=10,udp,ct_state=+trk+rpl,ct_tp_src=3/0x1,actions=controller
10591 table=1,priority=1,action=drop
10592 ])
10593
10594 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10595
10596 AT_CAPTURE_FILE([ofctl_monitor.log])
10597 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10598
10599 dnl Match ct_nw_src=10.1.2.1/24
10600 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.2.100,dst=10.1.2.200,proto=17,tos=0,ttl=64,frag=no),udp(src=6,dst=6)'])
10601 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.2.200,dst=10.1.2.100,proto=17,tos=0,ttl=64,frag=no),udp(src=6,dst=6)'])
10602
10603 dnl Match ct_ipv6_dst=2001:db8::1/64
10604 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)'])
10605 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)'])
10606
10607 dnl Match ct_tp_src=3/0x1
10608 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)'])
10609 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)'])
10610
10611 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
10612 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10613
10614 dnl Check this output.
10615 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10616 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 ct_state=est|rpl|trk,ct_nw_src=10.1.2.100,ct_nw_dst=10.1.2.200,ct_nw_proto=17,ct_tp_src=6,ct_tp_dst=6,ip,in_port=2 (via action) data_len=106 (unbuffered)
10617 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.2.200,nw_dst=10.1.2.100,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=6,tp_dst=6 udp_csum:221
10618 dnl
10619 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)
10620 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
10621 dnl
10622 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)
10623 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
10624 ])
10625
10626 OVS_VSWITCHD_STOP
10627 AT_CLEANUP
10628
10629 AT_SETUP([ofproto-dpif - conntrack - ofproto/trace])
10630 OVS_VSWITCHD_START
10631
10632 add_of_ports br0 1 2 3 4
10633
10634 AT_DATA([flows.txt], [dnl
10635 dnl Table 0
10636 dnl
10637 table=0,priority=100,arp,action=normal
10638 table=0,priority=10,udp,action=ct(table=1,zone=0)
10639 table=0,priority=10,tcp,action=ct(table=2,zone=1)
10640 table=0,priority=1,action=drop
10641 dnl
10642 dnl Table 1
10643 dnl
10644 table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+new,udp,action=ct(commit,zone=0),2
10645 table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+est,udp,action=2
10646 table=1,priority=10,in_port=2,ct_zone=0,ct_state=+trk+est,udp,action=1
10647 table=1,priority=1,action=drop
10648 dnl
10649 dnl Table 2
10650 dnl
10651 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)
10652 table=2,priority=10,in_port=1,tcp,ct_zone=1,ct_state=+trk+est,tcp,action=ct(table=3,zone=2)
10653 table=2,priority=1,action=drop
10654 dnl
10655 dnl Table 3
10656 dnl
10657 table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+new,tcp,action=ct(commit,zone=2),4
10658 table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+est,tcp,action=3
10659 table=2,priority=1,action=drop
10660 ])
10661
10662 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10663
10664 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,udp'], [0], [stdout])
10665 AT_CHECK([tail -1 stdout], [0],
10666 [Datapath actions: drop
10667 ])
10668
10669 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,udp'], [0], [stdout])
10670 AT_CHECK([tail -1 stdout], [0],
10671 [Datapath actions: ct(commit),2
10672 ])
10673
10674 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp'], [0], [stdout])
10675 AT_CHECK([tail -1 stdout], [0],
10676 [Datapath actions: ct(commit,zone=2),4
10677 ])
10678
10679 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp' --ct-next 'trk,est' --ct-next 'trk,est' ], [0], [stdout])
10680 AT_CHECK([tail -1 stdout], [0],
10681 [Datapath actions: 3
10682 ])
10683
10684 OVS_VSWITCHD_STOP
10685 AT_CLEANUP
10686
10687 AT_SETUP([ofproto-dpif - nat - ofproto/trace])
10688 OVS_VSWITCHD_START
10689
10690 add_of_ports br0 1 2 3
10691
10692 flow="in_port=1,udp,nw_src=1.1.1.1,nw_dst=1.1.1.2,udp_src=100,udp_dst=200"
10693 AT_DATA([flows.txt], [dnl
10694 table=0,priority=100,ip,nw_src=1.1.1.1,ct_state=-trk,action=ct(commit,nat(src=10.0.0.1-10.0.0.42:1000-1042),table=0)
10695 table=0,priority=100,udp,ct_state=+trk,nw_src=10.0.0.1,nw_dst=1.1.1.2,tp_src=1000,tp_dst=200,action=ct(commit,nat(dst=20.0.0.1-20.0.0.42:2000-2042),table=0)
10696 table=0,priority=100,udp,ct_state=+trk,nw_src=10.0.0.1,nw_dst=20.0.0.1,tp_src=1000,tp_dst=2000,action=3
10697 table=0,priority=90,ip,ct_state=+trk,action=2
10698 ])
10699 AT_CHECK([ovs-ofctl del-flows br0])
10700 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10701 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
10702 AT_CHECK([tail -1 stdout], [0],
10703 [Datapath actions: 3
10704 ])
10705
10706 flow="in_port=1,udp6,ipv6_src=1::1,ipv6_dst=1::2,udp_src=100,udp_dst=200"
10707 AT_DATA([flows.txt], [dnl
10708 table=0,priority=100,ip6,ipv6_src=1::1,ct_state=-trk,action=ct(commit,nat(src=[[10::1]]-[[10::42]]:1000-1042),table=0)
10709 table=0,priority=100,udp6,ct_state=+trk,ipv6_src=10::1,ipv6_dst=1::2,tp_src=1000,tp_dst=200,action=ct(commit,nat(dst=[[20::1]]-[[20::42]]:2000-2042),table=0)
10710 table=0,priority=100,udp6,ct_state=+trk,ipv6_src=10::1,ipv6_dst=20::1,tp_src=1000,tp_dst=2000,action=3
10711 table=0,priority=90,ip6,ct_state=+trk,action=2
10712 ])
10713 AT_CHECK([ovs-ofctl del-flows br0])
10714 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10715 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
10716 AT_CHECK([tail -1 stdout], [0],
10717 [Datapath actions: 3
10718 ])
10719
10720 OVS_VSWITCHD_STOP
10721 AT_CLEANUP
10722
10723 AT_SETUP([ofproto - set mtu])
10724 OVS_VSWITCHD_START
10725
10726 add_of_ports br0 1
10727
10728 # Check that initial MTU is 1500 for 'br0' and 'p1'.
10729 AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
10730 1500
10731 ])
10732 AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
10733 1500
10734 ])
10735
10736 # Request new MTU for 'p1'
10737 AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
10738
10739 # Check that the new MTU is applied
10740 AT_CHECK([ovs-vsctl wait-until Interface p1 mtu=1600])
10741 # The internal port 'br0' should have the same MTU value as p1, becase it's
10742 # the new bridge minimum.
10743 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1600])
10744
10745 AT_CHECK([ovs-vsctl del-port br0 p1])
10746
10747 # When 'p1' is deleted, the internal port should return to the default MTU
10748 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1500])
10749
10750 # New port with 'mtu_request' in the same transaction.
10751 AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
10752 AT_CHECK([ovs-vsctl wait-until Interface p2 mtu=1600])
10753 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1600])
10754
10755 # Explicitly set mtu_request on the internal interface. This should prevent
10756 # the MTU from being overriden.
10757 AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
10758 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1700])
10759
10760 # The new MTU on p2 should not affect br0.
10761 AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
10762 AT_CHECK([ovs-vsctl wait-until Interface p2 mtu=1400])
10763 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1700])
10764
10765 # Remove explicit mtu_request from br0. Now it should track the bridge
10766 # minimum again.
10767 AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
10768 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1400])
10769
10770 OVS_VSWITCHD_STOP
10771 AT_CLEANUP
10772
10773 AT_SETUP([ofproto - fragment prerequisites])
10774 OVS_VSWITCHD_START
10775
10776 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
10777
10778 add_of_ports br0 1
10779
10780 AT_DATA([flows.txt], [dnl
10781 priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
10782 priority=1,in_port=1,udp,action=drop
10783 ])
10784
10785 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10786
10787 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
10788
10789 ovs-appctl time/stop
10790 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
10791 ovs-appctl time/warp 5000
10792
10793 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
10794 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
10795 ])
10796
10797 dnl Change the flow table. This will trigger revalidation of all the flows.
10798 AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
10799 AT_CHECK([ovs-appctl revalidator/wait], [0])
10800
10801 dnl We don't want revalidators to delete any flow. If the flow has been
10802 dnl deleted it means that there's some inconsistency with the revalidation.
10803 AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
10804
10805 OVS_VSWITCHD_STOP
10806 AT_CLEANUP
10807
10808 AT_SETUP([ofproto-dpif - check_pkt_larger action])
10809 OVS_VSWITCHD_START
10810 add_of_ports br0 1 2 3 4
10811
10812 AT_DATA([flows.txt], [dnl
10813 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10814 table=1,in_port=1,reg0=0x1/0x1 actions=output:2,resubmit(,2)
10815 table=1,in_port=1,actions=output:3,resubmit(,2)
10816 table=2,in_port=1,actions=mod_dl_dst:82:82:82:82:82:82,output:4
10817 ])
10818
10819 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10820 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])
10821 AT_CHECK([tail -1 stdout], [0], [dnl
10822 Datapath actions: check_pkt_len(size=200,gt(2,set(eth(dst=82:82:82:82:82:82)),4),le(3,set(eth(dst=82:82:82:82:82:82)),4))
10823 ])
10824
10825 dnl Test flow xlate check_pkt_large clone action without using datapath check_pkt_len action.
10826 AT_CHECK([ovs-appctl dpif/set-dp-features br0 check_pkt_len false], [0], [ignore])
10827
10828 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])
10829 AT_CHECK([tail -3 stdout], [0], [dnl
10830 Datapath actions: 3,set(eth(dst=82:82:82:82:82:82)),4
10831 This flow is handled by the userspace slow path because it:
10832 - Uses action(s) not supported by datapath.
10833 ])
10834
10835 dnl Enable datapath check_pkt_len action
10836 AT_CHECK([ovs-appctl dpif/set-dp-features br0 check_pkt_len true], [0], [ignore])
10837
10838 ovs-ofctl del-flows br0
10839
10840 AT_DATA([flows.txt], [dnl
10841 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10842 table=1,in_port=1,priority=200,reg0=0x1/0x1 actions=output:2
10843 ])
10844
10845 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10846 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])
10847 AT_CHECK([tail -1 stdout], [0], [dnl
10848 Datapath actions: check_pkt_len(size=200,gt(2),le(drop))
10849 ])
10850
10851 ovs-ofctl del-flows br0
10852 AT_DATA([flows.txt], [dnl
10853 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]]
10854 ])
10855
10856 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10857 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])
10858 AT_CHECK([tail -1 stdout], [0], [dnl
10859 Datapath actions: check_pkt_len(size=200,gt(drop),le(drop))
10860 ])
10861
10862 ovs-ofctl del-flows br0
10863 AT_DATA([flows.txt], [dnl
10864 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10865 table=1,in_port=1,priority=200,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(mod_dl_src:80:81:81:81:81:81,set_field:192.168.5.5->ip_dst,output:3),output:4
10866 table=1,in_port=1,priority=0,ip actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(ct(commit),output:3),output:4
10867 ])
10868
10869 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10870 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])
10871 AT_CHECK([tail -1 stdout], [0], [dnl
10872 Datapath actions: check_pkt_len(size=200,gt(set(ipv4(dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(dst=10.10.10.1)),4),le(set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),clone(ct(commit),3),4))
10873 ])
10874
10875 AT_DATA([flows.txt], [dnl
10876 table=0,priority=0 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10877 table=1,in_port=1,priority=200,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src, resubmit(,0))
10878 table=1,in_port=1,priority=0,ip actions=clone(set_field:192.168.3.4->ip_src, resubmit(,0))
10879 ])
10880
10881 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10882 ovs-ofctl dump-flows br0
10883
10884 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])
10885 AT_CHECK([tail -3 stdout], [0], [dnl
10886 Megaflow: recirc_id=0,eth,ip,reg0=0/0x1,in_port=1,nw_src=10.10.10.2,nw_frag=no
10887 Datapath actions: drop
10888 Translation failed (Recursion too deep), packet is dropped.
10889 ])
10890
10891 ovs-ofctl del-flows br0
10892 AT_DATA([flows.txt], [dnl
10893 table=0,priority=0 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10894 table=1,ip,nw_src=192.168.3.3 actions=output:3
10895 table=1,ip,nw_src=192.168.3.4 actions=output:4
10896 table=1,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src, resubmit(,0))
10897 table=1,ip actions=clone(set_field:192.168.3.4->ip_src, resubmit(,0))
10898 ])
10899
10900 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10901 ovs-ofctl dump-flows br0
10902
10903 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])
10904 AT_CHECK([tail -1 stdout], [0], [dnl
10905 Datapath actions: check_pkt_len(size=200,gt(set(ipv4(src=192.168.3.3)),check_pkt_len(size=200,gt(3),le(3))),le(set(ipv4(src=192.168.3.4)),check_pkt_len(size=200,gt(4),le(4))))
10906 ])
10907
10908 ovs-ofctl del-flows br0
10909 AT_DATA([flows.txt], [dnl
10910 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10911 table=1,in_port=1,reg0=0x1/0x1 actions=mod_dl_dst:82:82:82:82:82:82,controller(),resubmit(,2)
10912 table=1,in_port=1 actions=resubmit(,2)
10913 table=2,ip,dl_dst=82:82:82:82:82:82 actions=ct(table=3)
10914 table=2,ip,dl_dst=50:54:00:00:00:0a actions=ct(table=3)
10915 table=3,ip,reg0=0x1/0x1 actions=output:2
10916 table=3,ip actions=output:4
10917 ])
10918
10919 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10920 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])
10921 AT_CHECK([cat stdout | grep Datapath -B1], [0], [dnl
10922 Megaflow: recirc_id=0,eth,ip,in_port=1,dl_dst=50:54:00:00:00:0a,nw_frag=no
10923 Datapath actions: check_pkt_len(size=200,gt(set(eth(dst=82:82:82:82:82:82)),userspace(pid=0,controller(reason=1,dont_send=1,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535)),ct,recirc(0x2)),le(ct,recirc(0x3)))
10924 --
10925 Megaflow: recirc_id=0x2,eth,ip,in_port=1,nw_frag=no
10926 Datapath actions: 2
10927 --
10928 Megaflow: recirc_id=0x3,eth,ip,in_port=1,nw_frag=no
10929 Datapath actions: 4
10930 ])
10931
10932 OVS_VSWITCHD_STOP
10933 AT_CLEANUP
10934
10935 AT_SETUP([ofproto-dpif - check_pkt_larger with continuation and ct])
10936 OVS_VSWITCHD_START
10937 add_of_ports --pcap br0 `seq 1 4`
10938
10939 AT_CAPTURE_FILE([ofctl_monitor0.log])
10940 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
10941
10942 AT_DATA([flows.txt], [dnl
10943 table=0,in_port=1 actions=check_pkt_larger(150)->NXM_NX_REG0[[0]],resubmit(,1)
10944 table=1,ip,reg0=0x1/0x1 actions=mod_dl_dst:82:82:82:82:82:82,controller(pause),resubmit(,2)
10945 table=1,ip,reg0=0 actions=mod_dl_dst:83:83:83:83:83:83,controller(pause),resubmit(,2)
10946 table=2,ip,dl_dst=82:82:82:82:82:82 actions=ct(table=3)
10947 table=2,ip,dl_dst=83:83:83:83:83:83 actions=ct(table=3)
10948 table=3,ip,reg0=0x1/0x1 actions=ct(commit),output:2
10949 table=3,ip actions=ct(commit),output:4
10950 ])
10951
10952 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10953
10954 flow="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)"
10955
10956 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
10957
10958 OVS_WAIT_UNTIL([test 1 = `ovs-ofctl parse-pcap p4-tx.pcap \
10959 | grep dl_dst=83:83:83:83:83:83 | wc -l`])
10960 AT_CHECK([test 0 = `ovs-ofctl parse-pcap p2-tx.pcap | wc -l`])
10961
10962 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow" --len 200], [0], [stdout])
10963
10964 OVS_WAIT_UNTIL([test 1 = `ovs-ofctl parse-pcap p2-tx.pcap \
10965 | grep dl_dst=82:82:82:82:82:82 | wc -l`])
10966 AT_CHECK([test 1 = `ovs-ofctl parse-pcap p2-tx.pcap | wc -l`])
10967
10968 OVS_VSWITCHD_STOP
10969 AT_CLEANUP