]> git.proxmox.com Git - mirror_ovs.git/blob - tests/ofproto-dpif.at
ofproto-dpif: Expose datapath capability to ovsdb.
[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 non-dpdk interfaces:
371 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:hash(sym_l4(0)),recirc(0x1)
372 recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),10
373 ])
374
375 OVS_VSWITCHD_STOP
376 AT_CLEANUP
377
378 AT_SETUP([ofproto-dpif - all group in action set])
379 OVS_VSWITCHD_START
380 add_of_ports br0 1 10 11
381 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,set_field:192.168.3.90->ip_src,bucket=output:11'])
382 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
383 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
384 # Must match on the source address to be able to restore it's value for
385 # the third bucket
386 AT_CHECK([tail -2 stdout], [0],
387 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
388 Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
389 ])
390 OVS_VSWITCHD_STOP
391 AT_CLEANUP
392
393 AT_SETUP([ofproto-dpif - indirect group in action set])
394 OVS_VSWITCHD_START
395 add_of_ports br0 1 10
396 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
397 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
398 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
399 AT_CHECK([tail -1 stdout], [0],
400 [Datapath actions: 10
401 ])
402 OVS_VSWITCHD_STOP
403 AT_CLEANUP
404
405 AT_SETUP([ofproto-dpif - patch port with action set])
406 OVS_VSWITCHD_START([ \
407 add-br br1 -- \
408 set bridge br1 datapath-type=dummy fail-mode=secure -- \
409 add-port br0 patch10 -- \
410 set interface patch10 type=patch options:peer=patch20 ofport_request=10 -- \
411 add-port br1 patch20 -- \
412 set interface patch20 type=patch options:peer=patch10 ofport_request=20
413 ])
414 add_of_ports br0 1
415 add_of_ports br1 2
416 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br1 'ip actions=write_actions(pop_vlan,output:2)'])
417 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=output:10'])
418 AT_CHECK([ovs-appctl ofproto/trace br1 'in_port=20,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_vlan=100,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
419 AT_CHECK([tail -1 stdout], [0],
420 [Datapath actions: pop_vlan,2
421 ])
422 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_vlan=100,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
423 AT_CHECK([tail -1 stdout], [0],
424 [Datapath actions: pop_vlan,2
425 ])
426 OVS_VSWITCHD_STOP
427 AT_CLEANUP
428
429
430 AT_SETUP([ofproto-dpif - select group])
431
432 OVS_VSWITCHD_START
433 add_of_ports br0 1 10 11
434
435 ovs-appctl vlog/set ofproto_dpif:file:dbg
436 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
437 AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
438 ofproto_dpif|DBG|Constructing select group 1234
439 ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
440 ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
441 ofproto_dpif|DBG| Using 16 hash values:
442 ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
443 ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
444 ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 1.
445 ])
446 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
447
448 # Try a bunch of different flows and make sure that they get distributed
449 # # at least somewhat.
450 for d in 0 1 2 3; do
451 for s in 1 2 3 4 ; do
452 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.$s,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
453 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
454 done
455 done
456
457 AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 5 2 dp_hash], [0], [dnl
458 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
459 n_flows=ok n_buckets=ok
460 ])
461
462 OVS_VSWITCHD_STOP
463 AT_CLEANUP
464
465 AT_SETUP([ofproto-dpif - select group with watch port])
466
467 OVS_VSWITCHD_START
468 add_of_ports br0 1 10 11
469 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
470 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
471
472 for d in 0 1 2 3; do
473 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
474 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
475 done
476
477 AT_CHECK([ovs-appctl dpctl/dump-flows | sort| sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | strip_ufid | strip_used], [0], [dnl
478 flow-dump from non-dpdk interfaces:
479 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:3, bytes:318, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
480 recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:3, bytes:318, used:0.0s, actions:11
481 ])
482
483 OVS_VSWITCHD_STOP
484 AT_CLEANUP
485
486 AT_SETUP([ofproto-dpif - select group with weights])
487
488 # Helper function to check the accuracy of distribution of packets over buckets
489 check_group_stats () {
490 buckets=`grep -o 'packet_count=[[0-9]]*' | cut -d'=' -f2 | tail -n +2`
491 i=0
492 for bucket in $buckets; do
493 min=$1
494 shift
495 if [[ $bucket -ge $min ]]; then
496 echo "bucket$i >= $min"
497 else
498 echo "bucket$i < $min"
499 fi
500 i=`expr $i + 1`
501 if [[ $i -ge 4 ]]; then break; fi
502 done
503 }
504
505 OVS_VSWITCHD_START
506 add_of_ports br0 1 10 11 12 13 14
507
508 ovs-appctl vlog/set ofproto_dpif:file:dbg
509 AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=1234,type=select,bucket=weight:5,output:10,bucket=weight:10,output:11,bucket=weight:25,output:12,bucket=weight:60,output:13,bucket=weight:0,output:14'])
510 AT_CHECK([grep -A9 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
511 ofproto_dpif|DBG|Constructing select group 1234
512 ofproto_dpif|DBG|No selection method specified. Trying dp_hash.
513 ofproto_dpif|DBG| Minimum weight: 5, total weight: 100
514 ofproto_dpif|DBG| Using 32 hash values:
515 ofproto_dpif|DBG| Bucket 0: weight=5, target=1.60 hits=2
516 ofproto_dpif|DBG| Bucket 1: weight=10, target=3.20 hits=3
517 ofproto_dpif|DBG| Bucket 2: weight=25, target=8.00 hits=8
518 ofproto_dpif|DBG| Bucket 3: weight=60, target=19.20 hits=19
519 ofproto_dpif|DBG| Bucket 4: weight=0, target=0.00 hits=0
520 ofproto_dpif|DBG|Use dp_hash with 32 hash values using algorithm 1.
521 ])
522 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
523
524 # Try 1000 different flows and make sure that they get distributed according to weights
525 for d1 in 0 1 2 3 4 5 6 7 8 9 ; do
526 for d2 in 0 1 2 3 4 5 6 7 8 9 ; do
527 for s in 0 1 2 3 4 5 6 7 8 9 ; do
528 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.1.$s,dst=192.168.$d1.$d2,proto=6,tos=0,ttl=128,frag=no),tcp(src=1000$s,dst=1000)"
529 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
530 done
531 done
532 done
533
534 # Check balanced distribution over 32 dp_hash values
535 AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 32 4 dp_hash], [0], [dnl
536 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:999, bytes:117882, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1)
537 n_flows=ok n_buckets=ok
538 ])
539
540 # Check that actual distribution over the buckets is reasonably accurate:
541 ideal weights dp_hash values
542 # bucket0: 5%*1000 = 50 2/32*1000 = 63
543 # bucket1: 10%*1000 = 100 3/32*1000 = 94
544 # bucket2: 25%*1000 = 250 8/32*1000 = 250
545 # bucket3: 60%*1000 = 600 19/32*1000 = 594
546 # bucket4: 0 0
547
548 ovs-appctl time/warp 1000
549 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-group-stats br0 | sed 's/duration=[[0-9]]\.[[0-9]]*s,//' | check_group_stats 40 80 200 500],
550 [0], [dnl
551 bucket0 >= 40
552 bucket1 >= 80
553 bucket2 >= 200
554 bucket3 >= 500
555 ])
556
557 OVS_VSWITCHD_STOP
558 AT_CLEANUP
559
560 AT_SETUP([ofproto-dpif - select group with explicit dp_hash selection method])
561
562 OVS_VSWITCHD_START
563 add_of_ports br0 1 10 11
564
565 ovs-appctl vlog/set ofproto_dpif:file:dbg
566 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11'])
567 AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
568 ofproto_dpif|DBG|Constructing select group 1234
569 ofproto_dpif|DBG|Selection method specified: dp_hash.
570 ofproto_dpif|DBG| Minimum weight: 1, total weight: 2
571 ofproto_dpif|DBG| Using 16 hash values:
572 ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8
573 ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8
574 ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 0.
575 ])
576
577 # Fall back to legacy hash with zero buckets
578 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method=dp_hash'])
579 AT_CHECK([grep -A3 "Constructing select group 1235" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
580 ofproto_dpif|DBG|Constructing select group 1235
581 ofproto_dpif|DBG|Selection method specified: dp_hash.
582 ofproto_dpif|DBG| Don't apply dp_hash method without buckets.
583 ofproto_dpif|DBG|Falling back to default hash method.
584 ])
585
586 # Fall back to legacy hash with zero buckets
587 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1236,type=select,selection_method=dp_hash,bucket=weight=1,output:10,bucket=weight=1000,output:11'])
588 AT_CHECK([grep -A4 "Constructing select group 1236" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
589 ofproto_dpif|DBG|Constructing select group 1236
590 ofproto_dpif|DBG|Selection method specified: dp_hash.
591 ofproto_dpif|DBG| Minimum weight: 1, total weight: 1001
592 ofproto_dpif|DBG| Too many hash values required: 1024
593 ofproto_dpif|DBG|Falling back to default hash method.
594 ])
595
596 OVS_VSWITCHD_STOP
597 AT_CLEANUP
598
599 AT_SETUP([ofproto-dpif - select group with legacy hash selection method])
600
601 OVS_VSWITCHD_START
602 add_of_ports br0 1 10 11
603
604 ovs-appctl vlog/set ofproto_dpif:file:dbg
605 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,bucket=output:10,bucket=output:11'])
606 AT_CHECK([grep -A2 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl
607 ofproto_dpif|DBG|Constructing select group 1234
608 ofproto_dpif|DBG|Selection method specified: hash.
609 ofproto_dpif|DBG|No hash fields. Falling back to default hash method.
610 ])
611
612 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
613
614 # Try 16 flows with differing default hash values.
615 for d in 0 1 2 3; do
616 for s in 1 2 3 4 ; do
617 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.$s,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
618 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
619 done
620 done
621
622 # Check that the packets installed 16 data path flows and each of the two
623 # buckets is hit at least once.
624 AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
625 n_flows=ok n_buckets=ok
626 ])
627
628 OVS_VSWITCHD_STOP
629 AT_CLEANUP
630
631 AT_SETUP([ofproto-dpif - select group with custom hash selection method])
632
633 OVS_VSWITCHD_START
634 add_of_ports br0 1 10 11
635
636 # Check that parse failures after 'fields' parsing work
637 AT_CHECK([ovs-ofctl -O OpenFlow10 add-group br0 'group_id=1,type=select,fields(eth_dst),bukket=output:10'], [1], ,[dnl
638 ovs-ofctl: unknown keyword bukket
639 ])
640
641 # Check that fields are rejected without "selection_method=hash".
642 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11'], 1, [], [dnl
643 ovs-ofctl: fields may only be specified with "selection_method=hash"
644 ])
645
646 # Check that selection_method_param without selection_method is rejected.
647 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method_param=1,bucket=output:10,bucket=output:11'], 1, [], [dnl
648 ovs-ofctl: selection_method_param is only allowed with "selection_method"
649 ])
650
651 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11'])
652 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
653
654 # Try 16 flows with differing custom hash and check that they give rise to
655 # 16 data path flows and each of the two buckets is hit at least once
656 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
657 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:$d),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
658 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
659 done
660
661 AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl
662 n_flows=ok n_buckets=ok
663 ])
664
665 AT_CHECK([ovs-appctl revalidator/purge], [0])
666
667 # Try 16 flows that differ only in fields that are not part of the custom
668 # hash and check that there is only a single datapath flow
669 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
670 pkt="in_port(1),eth(src=50:54:00:00:00:$d,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
671 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
672 done
673
674 AT_CHECK([ovs-appctl dpctl/dump-flows | grep -c recirc_id], [0], [dnl
675 1
676 ])
677
678 OVS_VSWITCHD_STOP
679 AT_CLEANUP
680
681 AT_SETUP([ofproto-dpif - fast failover group])
682 OVS_VSWITCHD_START
683 add_of_ports br0 1 10 11
684 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=ff,bucket=watch_port:10,output:10,bucket=watch_port:11,output:11'])
685 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
686 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
687 AT_CHECK([tail -1 stdout], [0],
688 [Datapath actions: 10
689 ])
690 OVS_VSWITCHD_STOP
691 AT_CLEANUP
692
693 AT_SETUP([ofproto-dpif - group stats single bucket])
694 OVS_VSWITCHD_START
695 add_of_ports br0 1 10 11
696 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
697 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
698 (
699 for i in `seq 0 2`;
700 do
701 pkt="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)"
702 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
703 done
704 )
705 AT_CHECK([ovs-appctl revalidator/purge], [0])
706 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
707 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
708 group_id=1234,ref_count=1,packet_count=3,byte_count=318,bucket0:packet_count=3,byte_count=318,bucket1:packet_count=0,byte_count=0
709 OFPST_GROUP reply (OF1.2):
710 ])
711 OVS_VSWITCHD_STOP
712 AT_CLEANUP
713
714 AT_SETUP([ofproto-dpif - group stats all buckets])
715 OVS_VSWITCHD_START
716 add_of_ports br0 1 10 11
717 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
718 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
719 (
720 for i in `seq 0 2`;
721 do
722 pkt="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)"
723 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
724 done
725 )
726 AT_CHECK([ovs-appctl revalidator/purge], [0])
727 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
728 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
729 group_id=1234,ref_count=1,packet_count=3,byte_count=318,bucket0:packet_count=3,byte_count=318,bucket1:packet_count=3,byte_count=318
730 OFPST_GROUP reply (OF1.2):
731 ])
732 OVS_VSWITCHD_STOP
733 AT_CLEANUP
734
735 AT_SETUP([ofproto-dpif - registers])
736 OVS_VSWITCHD_START
737 add_of_ports br0 20 21 22 33 90
738 AT_DATA([flows.txt], [dnl
739 in_port=90 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
740 in_port=91 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
741 in_port=92 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
742 in_port=93 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
743
744 in_port=2 actions=load:0x000db000->NXM_NX_REG0[[]]
745 in_port=3 actions=load:0xdea->NXM_NX_REG0[[20..31]]
746 in_port=4 actions=load:0xeef->NXM_NX_REG0[[0..11]]
747 in_port=5 actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
748 in_port=6 actions=load:0x22222222->NXM_NX_REG2[[]]
749 in_port=7 actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
750 in_port=8 actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
751 in_port=9,reg0=0xdeadbeef actions=output:20
752 in_port=10,reg1=0xdeadbeef actions=output:21
753 in_port=11,reg2=0xeef22dea actions=output:22
754
755 dnl Sanilty check all registers
756 in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
757 in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
758 in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
759 in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
760
761 ])
762 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
763 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
764 AT_CHECK([tail -1 stdout], [0],
765 [Datapath actions: 20,21,22,33
766 ])
767 OVS_VSWITCHD_STOP
768 AT_CLEANUP
769
770 dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
771 dnl in the manner documented in ovs-ofctl(8).
772 AT_SETUP([ofproto-dpif - extended registers])
773 OVS_VSWITCHD_START
774 add_of_ports br0 1 2 3
775 AT_DATA([flows.txt], [dnl
776 table=0 actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
777 table=1,reg2=0xfedcba98,reg3=0x76543210 actions=2
778
779 # These low-priority rules shouldn't match. They're here only to make really
780 # sure that the test fails if either of the above rules fails to match.
781 table=0,priority=0 actions=3
782 table=1,priority=0 actions=3
783 ])
784 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
785 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
786 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
787 ])
788 OVS_VSWITCHD_STOP
789 AT_CLEANUP
790
791 dnl Tests that the standardized xxregs are mapped onto the legacy OVS
792 dnl registers in the manner documented in ovs-ofctl(8).
793 AT_SETUP([ofproto-dpif - extended-extended registers])
794 OVS_VSWITCHD_START
795 add_of_ports br0 1 2 3
796 AT_DATA([flows.txt], [dnl
797 table=0 actions=load:0x0123456789abcdeffedcba9876543210->NXM_NX_XXREG1[[]],resubmit(,1)
798 table=1,reg4=0x01234567,reg5=0x89abcdef,reg6=0xfedcba98,reg7=0x76543210 actions=2
799
800 # These low-priority rules shouldn't match. They're here only to make really
801 # sure that the test fails if either of the above rules fails to match.
802 table=0,priority=0 actions=3
803 table=1,priority=0 actions=3
804 ])
805 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
806 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
807 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
808 ])
809 OVS_VSWITCHD_STOP
810 AT_CLEANUP
811
812 AT_SETUP([ofproto-dpif - load and move order])
813 OVS_VSWITCHD_START
814 add_of_ports br0 1 10 11
815 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,move:NXM_NX_REG1[[]]->NXM_OF_IP_SRC[[]],bucket=output:11'])
816 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(load:0xffffffff->NXM_NX_REG1[[]],move:NXM_NX_REG1[[]]->NXM_NX_REG2[[]],group:1234)'])
817 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
818 AT_CHECK([tail -2 stdout], [0],
819 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
820 Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
821 ])
822 OVS_VSWITCHD_STOP
823 AT_CLEANUP
824
825 dnl Tests that 1.5 copy-field can copy into the standardized xregs.
826 AT_SETUP([ofproto-dpif - copy-field into extended registers])
827 OVS_VSWITCHD_START
828 add_of_ports br0 1 2 3
829 AT_DATA([flows.txt], [dnl
830 table=0 actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
831 table=1,xreg0=0x0000505400000005 actions=2
832
833 # These low-priority rules shouldn't match. They're here only to make really
834 # sure that the test fails if either of the above rules fails to match.
835 table=0,priority=0 actions=3
836 table=1,priority=0 actions=3
837 ])
838 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
839 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
840 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
841 ])
842 OVS_VSWITCHD_STOP
843 AT_CLEANUP
844
845 dnl Tests that 1.5 set-field with mask in the metadata register.
846 AT_SETUP([ofproto-dpif - masked set-field into metadata])
847 OVS_VSWITCHD_START
848 add_of_ports br0 1 2 3
849 AT_DATA([flows.txt], [dnl
850 table=0 actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
851 table=1 actions=set_field:0x6b/0xff->metadata,goto_table(2)
852 table=2,metadata=0xfafafafa5a5a5a6b actions=2
853
854 # These low-priority rules shouldn't match. They're here only to make really
855 # sure that the test fails if either of the above rules fails to match.
856 table=0,priority=0 actions=3
857 table=1,priority=0 actions=3
858 table=2,priority=0 actions=3
859 ])
860 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
861 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
862 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
863 ])
864 OVS_VSWITCHD_STOP
865 AT_CLEANUP
866
867
868 AT_SETUP([ofproto-dpif - actset_output])
869 OVS_VSWITCHD_START
870 add_of_ports br0 1 2 3 4 5 6 7 8 9 10 11 12 13
871 AT_DATA([flows.txt], [dnl
872 table=0,actset_output=unset actions=write_actions(output(2)),goto_table(1)
873 table=1 actions=move:ONFOXM_ET_ACTSET_OUTPUT[[0..31]]->OXM_OF_PKT_REG0[[0..31]],goto_table(2)
874
875 # Verify that actset_output got set.
876 table=2,priority=20,actset_output=2 actions=4,goto_table(3)
877 table=2,priority=10 actions=5,goto_table(3)
878
879 # Verify that xreg0 got copied properly from actset_output.
880 table=3,priority=20,xreg0=2 actions=6,goto_table(4)
881 table=3,priority=10 actions=7,goto_table(4)
882
883 # Verify that xxreg0 got copied properly from actset_output.
884 table=3,priority=20,xxreg0=2 actions=6,goto_table(4)
885 table=3,priority=10 actions=7,goto_table(4)
886
887 # Verify that adding a group action unsets actset_output,
888 # even if output follows group.
889 table=4 actions=write_actions(group(5),output(10)),goto_table(5)
890 table=5,priority=20,actset_output=unset actions=8,goto_table(6)
891 table=5,priority=10 actions=9,goto_table(6)
892
893 # Verify that adding another output action doesn't change actset_output
894 # (since there's still a group).
895 table=6 actions=write_actions(output(3)),goto_table(7)
896 table=7,priority=20,actset_output=unset actions=10,goto_table(8)
897 table=7,priority=10 actions=11,goto_table(8)
898
899 # Verify that clearing the action set, then writing an output action,
900 # causes actset_output to be set again.
901 table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
902 table=9,priority=20,actset_output=2 actions=12
903 table=9,priority=10 actions=13
904 ])
905 AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=5,type=all,bucket=output:1'])
906 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
907 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
908 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
909 ])
910 OVS_VSWITCHD_STOP
911 AT_CLEANUP
912
913 AT_SETUP([ofproto-dpif - push-pop])
914 OVS_VSWITCHD_START
915 add_of_ports br0 20 21 22 33 90
916 AT_DATA([flows.txt], [dnl
917 in_port=90 actions=load:20->NXM_NX_REG0[[0..7]],load:21->NXM_NX_REG1[[0..7]],load:22->NXM_NX_REG2[[0..7]], load:33->NXM_NX_REG3[[0..7]], push:NXM_NX_REG0[[]], push:NXM_NX_REG1[[0..7]],push:NXM_NX_REG2[[0..15]], push:NXM_NX_REG3[[]], resubmit:2, resubmit:3, resubmit:4, resubmit:5
918 in_port=2 actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
919 in_port=3 actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
920 in_port=4 actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
921 in_port=5 actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
922
923 ])
924 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
925 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
926 AT_CHECK([tail -1 stdout], [0],
927 [Datapath actions: 33,22,21,20
928 ])
929 OVS_VSWITCHD_STOP
930 AT_CLEANUP
931
932 AT_SETUP([ofproto-dpif - output])
933 OVS_VSWITCHD_START
934 add_of_ports br0 1 9 10 11 55 66 77 88
935 AT_DATA([flows.txt], [dnl
936 in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
937 in_port=2 actions=output:9
938 in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
939 in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
940 in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
941 in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
942 in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
943 in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
944 ])
945 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
946 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
947 AT_CHECK([tail -1 stdout], [0],
948 [Datapath actions: 9,55,10,55,66,11,77,88,9,1
949 ])
950 OVS_VSWITCHD_STOP
951 AT_CLEANUP
952
953 AT_SETUP([ofproto-dpif - dec_ttl])
954 OVS_VSWITCHD_START
955 add_of_ports br0 1 2 3 4
956 AT_DATA([flows.txt], [dnl
957 table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
958 table=1 in_port=1 action=dec_ttl,output:3
959 ])
960 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
961 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=2,frag=no)' -generate], [0], [stdout])
962 AT_CHECK([tail -4 stdout], [0], [
963 Final flow: ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=111,nw_tos=0,nw_ecn=0,nw_ttl=1
964 Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=2,nw_frag=no
965 Datapath actions: set(ipv4(ttl=1)),2,userspace(pid=0,controller(reason=2,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535)),4
966 ])
967 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=3,frag=no)'], [0], [stdout])
968 AT_CHECK([tail -2 stdout], [0],
969 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=3,nw_frag=no
970 Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
971 ])
972 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)'], [0], [stdout])
973 AT_CHECK([tail -2 stdout], [0],
974 [Megaflow: recirc_id=0,eth,ipv6,in_port=1,nw_ttl=128,nw_frag=no
975 Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
976 ])
977
978 AT_CAPTURE_FILE([ofctl_monitor.log])
979 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
980
981 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=2,frag=no)'
982
983 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
984 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
985 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
986 ip,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=111,nw_tos=0,nw_ecn=0,nw_ttl=1
987 ])
988 OVS_VSWITCHD_STOP
989 AT_CLEANUP
990
991 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
992 dnl buffer to be resized just before pushing the id of the dec_ttl action.
993 dnl Thus the implementation must account for this by using the
994 dnl reallocated buffer rather than the original buffer.
995 dnl
996 dnl A number of similar rules are added to try and exercise
997 dnl xrealloc sufficiently that it returns a different base pointer
998 AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
999 OVS_VSWITCHD_START
1000 add_of_ports br0 1
1001 (for i in `seq 0 255`; do
1002 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
1003 done) > flows.txt
1004 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1005 OVS_VSWITCHD_STOP
1006 AT_CLEANUP
1007
1008 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
1009 dnl buffer to be resized just before pushing the id of the dec_ttl action.
1010 dnl Thus the implementation must account for this by using the
1011 dnl reallocated buffer rather than the original buffer.
1012 dnl
1013 dnl A number of similar rules are added to try and exercise
1014 dnl xrealloc sufficiently that it returns a different base pointer
1015 AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
1016 OVS_VSWITCHD_START
1017 add_of_ports br0 1
1018 (for i in `seq 0 255`; do
1019 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
1020 done) > flows.txt
1021 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1022 OVS_VSWITCHD_STOP
1023 AT_CLEANUP
1024
1025 dnl A note action at offset 24 in ofpacts will cause the ofpacts
1026 dnl buffer to be resized just before pushing the id of the dec_ttl action.
1027 dnl Thus the implementation must account for this by using the
1028 dnl reallocated buffer rather than the original buffer.
1029 dnl
1030 dnl A number of similar rules are added to try and exercise
1031 dnl xrealloc sufficiently that it returns a different base pointer
1032 AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
1033 OVS_VSWITCHD_START
1034 add_of_ports br0 1
1035 (for i in `seq 0 255`; do
1036 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
1037 done) > flows.txt
1038 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1039 OVS_VSWITCHD_STOP
1040 AT_CLEANUP
1041
1042 dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
1043 dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
1044 dnl Using `make check-valgrind' here checks for use-after-free in this
1045 dnl codepath.
1046 AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
1047 OVS_VSWITCHD_START
1048 AT_CHECK([ovs-ofctl add-flow br0 'actions=set_field:0x1->metadata,set_field:0x2->metadata,set_field:0x3->metadata,set_field:0x4->metadata,note:00000000000000000000000000000000,note:00000000000000000000000000000000'])
1049 OVS_VSWITCHD_STOP
1050 AT_CLEANUP
1051
1052 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
1053 OVS_VSWITCHD_START
1054 add_of_ports br0 1 2
1055
1056 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
1057
1058 # "in_port" defaults to OFPP_NONE if it's not specified.
1059 flow="icmp,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,icmp_type=8,icmp_code=0"
1060 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
1061 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
1062 1
1063 2
1064 100
1065 ])
1066
1067 OVS_VSWITCHD_STOP
1068 AT_CLEANUP
1069
1070 AT_SETUP([ofproto-dpif - DSCP])
1071 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
1072 add_of_ports br0 9
1073 AT_DATA([flows.txt], [dnl
1074 actions=output:LOCAL,enqueue:1:1,enqueue:1:2,enqueue:1:2,enqueue:1:1,output:1,mod_nw_tos:0,output:1,output:LOCAL
1075 ])
1076 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1077 AT_CHECK([ovs-vsctl -- \
1078 set Port p1 qos=@newqos --\
1079 --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
1080 --id=@q1 create Queue dscp=1 --\
1081 --id=@q2 create Queue dscp=2], [0], [ignore])
1082 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(9),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xff,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
1083 AT_CHECK([tail -2 stdout], [0],
1084 [Megaflow: recirc_id=0,skb_priority=0,eth,ip,in_port=9,nw_tos=252,nw_frag=no
1085 Datapath actions: dnl
1086 100,dnl
1087 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1088 set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
1089 1,dnl
1090 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
1091 set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
1092 set(ipv4(tos=0/0xfc)),1,100
1093 ])
1094 OVS_VSWITCHD_STOP
1095 AT_CLEANUP
1096
1097 AT_SETUP([ofproto-dpif - output/flood flags])
1098 OVS_VSWITCHD_START
1099 add_of_ports br0 1 2 3 4 5 6 7
1100
1101 AT_DATA([flows.txt], [dnl
1102 in_port=local actions=local,flood
1103 in_port=1 actions=flood
1104 in_port=2 actions=all
1105 in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
1106 in_port=4 actions=enqueue:LOCAL:1,enqueue:1:1,enqueue:2:1,enqueue:3:2,enqueue:4:1,enqueue:5:1,enqueue:6:1,enqueue:7:1
1107 ])
1108 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1109 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
1110 AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
1111
1112 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
1113 AT_CHECK([tail -1 stdout \
1114 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
1115 1
1116 2
1117 3
1118 4
1119 7
1120 ])
1121
1122 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
1123 AT_CHECK([tail -1 stdout \
1124 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
1125 100
1126 2
1127 3
1128 4
1129 7
1130 ])
1131
1132 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
1133 AT_CHECK([tail -1 stdout \
1134 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
1135 1
1136 100
1137 3
1138 4
1139 6
1140 7
1141 ])
1142
1143 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
1144 AT_CHECK([tail -1 stdout], [0],
1145 [Datapath actions: 100,1,2,4,6,7
1146 ])
1147
1148 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(4),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
1149 AT_CHECK([tail -1 stdout], [0],
1150 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
1151 ])
1152 OVS_VSWITCHD_STOP
1153 AT_CLEANUP
1154
1155 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
1156 OVS_VSWITCHD_START([dnl
1157 add-port br0 p1 -- set Interface p1 type=dummy
1158 ])
1159 on_exit 'kill `cat ovs-ofctl.pid`'
1160
1161 AT_CAPTURE_FILE([ofctl_monitor.log])
1162
1163 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1164
1165 for i in 1 2 3 ; do
1166 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(syn)'
1167 done
1168 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1169 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1170 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1171 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1172 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:2e7e
1173 dnl
1174 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1175 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:2e7e
1176 dnl
1177 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1178 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:2e7e
1179 ])
1180
1181 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1182 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1183 NXST_FLOW reply:
1184 ])
1185
1186 OVS_VSWITCHD_STOP
1187 AT_CLEANUP
1188
1189 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
1190 OVS_VSWITCHD_START([dnl
1191 add-port br0 p1 -- set Interface p1 type=dummy
1192 ])
1193 on_exit 'kill `cat ovs-ofctl.pid`'
1194
1195 AT_CAPTURE_FILE([ofctl_monitor.log])
1196 AT_CHECK([ovs-ofctl del-flows br0])
1197
1198 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1199
1200 dnl Test that missed packets are dropped
1201 for i in 1 2 3 ; do
1202 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(ack,syn)'
1203 done
1204 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1205
1206 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1207 ])
1208
1209 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1210 AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1211 OFPST_FLOW reply (OF1.3):
1212 ])
1213
1214 OVS_VSWITCHD_STOP
1215 AT_CLEANUP
1216
1217 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
1218 OVS_VSWITCHD_START([dnl
1219 add-port br0 p1 -- set Interface p1 type=dummy
1220 ])
1221 on_exit 'kill `cat ovs-ofctl.pid`'
1222
1223 AT_CAPTURE_FILE([ofctl_monitor.log])
1224 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1225
1226 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1227
1228 for i in 1 2 3 ; do
1229 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(urg|rst)'
1230 done
1231 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1232 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1233 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1234 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1235 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:2e5c
1236 dnl
1237 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1238 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:2e5c
1239 dnl
1240 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1241 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:2e5c
1242 ])
1243
1244 AT_CHECK([ovs-appctl revalidator/purge], [0])
1245 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1246 n_packets=3, n_bytes=162, actions=goto_table:1
1247 OFPST_FLOW reply (OF1.2):
1248 ])
1249
1250 OVS_VSWITCHD_STOP
1251 AT_CLEANUP
1252
1253 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
1254 OVS_VSWITCHD_START([dnl
1255 add-port br0 p1 -- set Interface p1 type=dummy
1256 ])
1257 on_exit 'kill `cat ovs-ofctl.pid`'
1258
1259 AT_CAPTURE_FILE([ofctl_monitor.log])
1260 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1261
1262 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1263
1264 for i in 1 2 3 ; do
1265 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1266 done
1267
1268 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1269 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1270 ])
1271
1272 AT_CHECK([ovs-appctl revalidator/purge], [0])
1273 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1274 n_packets=3, n_bytes=354, actions=resubmit(1,1)
1275 OFPST_FLOW reply (OF1.2):
1276 ])
1277
1278 OVS_VSWITCHD_STOP
1279 AT_CLEANUP
1280
1281 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1282 OVS_VSWITCHD_START([dnl
1283 add-port br0 p1 -- set Interface p1 type=dummy
1284 ])
1285 on_exit 'kill `cat ovs-ofctl.pid`'
1286
1287 AT_CAPTURE_FILE([ofctl_monitor.log])
1288 AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1289 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1290
1291 dnl Miss table 0, Hit table 1
1292 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1293
1294 for i in 1 2 3 ; do
1295 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1296 done
1297 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1298 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1299
1300 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1301 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1302 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1303 dnl
1304 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1305 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1306 dnl
1307 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1308 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1309 ])
1310
1311 dnl Hit table 0, Miss all other tables, sent to controller
1312 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1313
1314 for i in 1 2 3 ; do
1315 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1316 done
1317 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1318 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1319
1320 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1321 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1322 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1323 dnl
1324 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1325 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1326 dnl
1327 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1328 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1329 ])
1330
1331 AT_CHECK([ovs-appctl revalidator/purge], [0])
1332 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1333 table=1, n_packets=3, n_bytes=354, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1334 OFPST_FLOW reply (OF1.2):
1335 ])
1336
1337 OVS_VSWITCHD_STOP
1338 AT_CLEANUP
1339
1340 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1341 OVS_VSWITCHD_START([dnl
1342 add-port br0 p1 -- set Interface p1 type=dummy
1343 ])
1344 on_exit 'kill `cat ovs-ofctl.pid`'
1345
1346 AT_CAPTURE_FILE([ofctl_monitor.log])
1347 AT_DATA([flows.txt], [dnl
1348 table=0 actions=goto_table(1)
1349 table=2 dl_src=10:11:11:11:11:11 actions=controller
1350 ])
1351 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1352 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1353
1354 dnl Hit table 0, Miss table 1, Hit table 2
1355 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1356
1357 for i in 1 2 3 ; do
1358 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1359 done
1360 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1361 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1362
1363 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1364 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1365 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1366 dnl
1367 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1368 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1369 dnl
1370 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1371 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1372 ])
1373
1374 dnl Hit table 1, Miss all other tables, sent to controller
1375 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1376
1377 for i in 1 2 3 ; do
1378 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1379 done
1380 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1381 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1382
1383 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1384 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1385 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1386 dnl
1387 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1388 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1389 dnl
1390 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1391 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1392 ])
1393
1394 AT_CHECK([ovs-appctl revalidator/purge], [0])
1395 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1396 n_packets=6, n_bytes=708, actions=goto_table:1
1397 table=2, n_packets=3, n_bytes=354, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1398 OFPST_FLOW reply (OF1.2):
1399 ])
1400
1401 OVS_VSWITCHD_STOP
1402 AT_CLEANUP
1403
1404 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1405 OVS_VSWITCHD_START([dnl
1406 add-port br0 p1 -- set Interface p1 type=dummy
1407 ])
1408 on_exit 'kill `cat ovs-ofctl.pid`'
1409
1410 AT_CAPTURE_FILE([ofctl_monitor.log])
1411 AT_DATA([flows.txt], [dnl
1412 table=0 actions=resubmit(1,1)
1413 table=2 dl_src=10:11:11:11:11:11 actions=controller
1414 ])
1415 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1416 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1417
1418 dnl Hit table 0, Miss table 1, Dropped
1419 AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1420
1421 for i in 1 2 3 ; do
1422 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1423 done
1424 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1425
1426 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1427 ])
1428
1429 dnl Hit table 1, Dropped
1430 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1431
1432 for i in 1 2 3 ; do
1433 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1434 done
1435 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1436
1437 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1438 ])
1439
1440 AT_CHECK([ovs-appctl revalidator/purge], [0])
1441 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1442 n_packets=6, n_bytes=708, actions=resubmit(1,1)
1443 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1444 OFPST_FLOW reply (OF1.2):
1445 ])
1446
1447 OVS_VSWITCHD_STOP
1448 AT_CLEANUP
1449
1450 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1451 OVS_VSWITCHD_START([dnl
1452 add-port br0 p1 -- set Interface p1 type=dummy
1453 ])
1454 on_exit 'kill `cat ovs-ofctl.pid`'
1455
1456 AT_CAPTURE_FILE([ofctl_monitor.log])
1457 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1458
1459 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1460
1461 dnl Test that missed packets are dropped
1462 for i in 1 2 3 ; do
1463 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1464 done
1465 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1466
1467 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1468 ])
1469
1470 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1471 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1472 NXST_FLOW reply:
1473 ])
1474
1475 OVS_VSWITCHD_STOP
1476 AT_CLEANUP
1477
1478 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1479 OVS_VSWITCHD_START([dnl
1480 add-port br0 p1 -- set Interface p1 type=dummy
1481 ])
1482 on_exit 'kill `cat ovs-ofctl.pid`'
1483
1484 AT_CAPTURE_FILE([ofctl_monitor.log])
1485 AT_CHECK([ovs-ofctl del-flows br0])
1486 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1487 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1488
1489 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1490
1491 dnl Test that missed packets are dropped
1492 for i in 1 2 3 ; do
1493 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1494 done
1495 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1496
1497 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1498 ])
1499
1500 AT_CHECK([ovs-appctl revalidator/purge], [0])
1501 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1502 n_packets=3, n_bytes=354, actions=goto_table:1
1503 OFPST_FLOW reply (OF1.2):
1504 ])
1505
1506 OVS_VSWITCHD_STOP
1507 AT_CLEANUP
1508
1509 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1510 OVS_VSWITCHD_START([dnl
1511 add-port br0 p1 -- set Interface p1 type=dummy
1512 ])
1513 on_exit 'kill `cat ovs-ofctl.pid`'
1514
1515 AT_CAPTURE_FILE([ofctl_monitor.log])
1516 AT_CHECK([ovs-ofctl del-flows br0])
1517 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1518 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1519
1520 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1521
1522 dnl Test that missed packets are dropped
1523 for i in 1 2 3 ; do
1524 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1525 done
1526 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1527
1528 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1529 ])
1530
1531 AT_CHECK([ovs-appctl revalidator/purge], [0])
1532 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1533 n_packets=3, n_bytes=354, actions=resubmit(1,1)
1534 OFPST_FLOW reply (OF1.2):
1535 ])
1536
1537 OVS_VSWITCHD_STOP
1538 AT_CLEANUP
1539
1540 AT_SETUP([ofproto-dpif - controller])
1541 OVS_VSWITCHD_START([dnl
1542 add-port br0 p1 -- set Interface p1 type=dummy
1543 ])
1544 on_exit 'kill `cat ovs-ofctl.pid`'
1545
1546 AT_CAPTURE_FILE([ofctl_monitor.log])
1547 AT_DATA([flows.txt], [dnl
1548 cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
1549 cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
1550 cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1551
1552 cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1553 cookie=0x4 table=2 in_port=81 actions=load:2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,controller,resubmit(82,3)
1554 cookie=0x5 table=3 in_port=82 actions=load:3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,controller,resubmit(83,4)
1555 cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1556 cookie=0x7 table=5 in_port=84 actions=load:5->NXM_NX_REG4[[]],load:6->NXM_NX_TUN_ID[[]],mod_nw_dst:84.84.84.84,controller,resubmit(85,6)
1557 cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1558 cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
1559 cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
1560 cookie=0xd dl_src=80:88:88:88:88:88 arp actions=load:2->OXM_OF_ARP_OP[[]],controller,load:0xc0a88001->OXM_OF_ARP_SPA[[]],controller,load:0x404444444441->OXM_OF_ARP_THA[[]],load:0x01010101->OXM_OF_ARP_SPA[[]],load:0x02020202->OXM_OF_ARP_TPA[[]],controller
1561 ])
1562 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1563
1564 dnl Flow miss.
1565 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1566
1567 for i in 1 2 3 ; do
1568 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1569 done
1570 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1571 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1572
1573 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1574 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1575 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1576 dnl
1577 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1578 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1579 dnl
1580 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via no_match) data_len=118 (unbuffered)
1581 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1582 ])
1583
1584 dnl Singleton controller action.
1585 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1586
1587 for i in 1 2 3 ; do
1588 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x002)'
1589 done
1590 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1591 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1592
1593 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1594 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1595 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
1596 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1597 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
1598 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1599 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
1600 ])
1601
1602 dnl Modified controller action.
1603 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1604
1605 for i in 1 2 3 ; do
1606 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=30:33:33:33:33:33,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x001)'
1607 done
1608 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1609 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1610
1611 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1612 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1613 tcp,dl_vlan=15,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:2e7e
1614 dnl
1615 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1616 tcp,dl_vlan=15,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:2e7e
1617 dnl
1618 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1619 tcp,dl_vlan=15,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:2e7e
1620 ])
1621
1622 dnl Modified VLAN controller action.
1623 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1624
1625 for i in 1 2 3; do
1626 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:41,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=16,tos=0,ttl=64,frag=no)'
1627 done
1628 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1629 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1630
1631 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1632 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1633 ip,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1634 dnl
1635 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1636 ip,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1637 dnl
1638 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1639 ip,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1640 ])
1641
1642 dnl Checksum TCP.
1643 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1644
1645 for i in 1 ; do
1646 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=20:22:22:22:22:22,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=11),tcp_flags(0x001)'
1647 done
1648 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1649 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1650
1651 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1652 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1653 tcp,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
1654 dnl
1655 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=58 reg0=0x1,in_port=1 (via action) data_len=58 (unbuffered)
1656 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
1657 dnl
1658 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=58 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=58 (unbuffered)
1659 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
1660 dnl
1661 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=58 (unbuffered)
1662 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
1663 dnl
1664 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=58 (unbuffered)
1665 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:4880
1666 dnl
1667 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1668 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:6082
1669 dnl
1670 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1671 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=11,tcp_flags=fin tcp_csum:6035
1672 dnl
1673 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1674 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86,tcp_flags=fin tcp_csum:5fea
1675 dnl
1676 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1677 tcp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86,tcp_flags=fin tcp_csum:5fea
1678 ])
1679
1680 dnl Checksum UDP.
1681 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1682
1683 for i in 1 ; do
1684 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 20 22 22 22 22 22 08 00 45 00 00 1C 00 00 00 00 00 11 00 00 C0 A8 00 01 C0 A8 00 02 00 08 00 0B 00 00 12 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
1685 done
1686 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1687 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1688
1689 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1690 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1691 udp,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1692 dnl
1693 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
1694 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1695 dnl
1696 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=64 (unbuffered)
1697 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1698 dnl
1699 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=64 (unbuffered)
1700 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1701 dnl
1702 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=64 (unbuffered)
1703 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:2c37
1704 dnl
1705 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1706 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:4439
1707 dnl
1708 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1709 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=11 udp_csum:43ec
1710 dnl
1711 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1712 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 udp_csum:43a1
1713 dnl
1714 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
1715 udp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 udp_csum:43a1
1716 ])
1717
1718 dnl Modified ARP controller action.
1719 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1720
1721 for i in 1 2 3; do
1722 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=80:88:88:88:88:88,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
1723 done
1724
1725 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1726 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1727 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1728 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1729 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1730 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1731 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1732 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1733 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=1.1.1.1,arp_tpa=2.2.2.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
1734 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1735 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1736 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1737 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1738 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1739 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=1.1.1.1,arp_tpa=2.2.2.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
1740 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1741 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1742 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1743 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
1744 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1745 arp,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=1.1.1.1,arp_tpa=2.2.2.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
1746 ])
1747
1748 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1749
1750 dnl Checksum SCTP.
1751 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1752
1753 for i in 1 ; do
1754 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 20 22 22 22 22 22 08 00 45 00 00 24 00 00 00 00 00 84 00 00 C0 A8 00 01 C0 A8 00 02 04 58 08 af 00 00 00 00 d9 d7 91 57 01 00 00 34 cf 28 ec 4e 00 01 40 00 00 0a ff ff b7 53 24 19 00 05 00 08 7f 00 00 01 00 05 00 08 c0 a8 02 07 00 0c 00 06 00 05 00 00 80 00 00 04 c0 00 00 04'
1755 done
1756
1757 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1758 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1759 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1760 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1761 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
1762 sctp,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1763 dnl
1764 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
1765 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1766 dnl
1767 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=102 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=102 (unbuffered)
1768 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1769 dnl
1770 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=102 (unbuffered)
1771 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1772 dnl
1773 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=102 (unbuffered)
1774 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1775 dnl
1776 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
1777 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1778 dnl
1779 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
1780 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=2223 sctp_csum:dd778f5f
1781 dnl
1782 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
1783 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 sctp_csum:62051f56
1784 dnl
1785 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
1786 sctp,dl_vlan=80,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 sctp_csum:62051f56
1787 ])
1788
1789 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1790 cookie=0x1, n_packets=3, n_bytes=212, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1791 cookie=0x2, n_packets=3, n_bytes=162, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1792 cookie=0x3, table=1, n_packets=3, n_bytes=212, in_port=80 actions=load:0x1->NXM_NX_REG0[[]],mod_vlan_vid:80,CONTROLLER:65535,resubmit(81,2)
1793 cookie=0x4, table=2, n_packets=3, n_bytes=212, in_port=81 actions=load:0x2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,CONTROLLER:65535,resubmit(82,3)
1794 cookie=0x5, table=3, n_packets=3, n_bytes=212, in_port=82 actions=load:0x3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,CONTROLLER:65535,resubmit(83,4)
1795 cookie=0x6, table=4, n_packets=3, n_bytes=212, in_port=83 actions=load:0x4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,CONTROLLER:65535,resubmit(84,5)
1796 cookie=0x7, table=5, n_packets=3, n_bytes=212, in_port=84 actions=load:0x5->NXM_NX_REG4[[]],load:0x6->NXM_NX_TUN_ID[[]],mod_nw_dst:84.84.84.84,CONTROLLER:65535,resubmit(85,6)
1797 cookie=0x8, table=6, n_packets=3, n_bytes=212, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1798 cookie=0x9, table=7, n_packets=3, n_bytes=212, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1799 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,CONTROLLER:65535
1800 cookie=0xd, n_packets=3, n_bytes=126, arp,dl_src=80:88:88:88:88:88 actions=load:0x2->NXM_OF_ARP_OP[[]],CONTROLLER:65535,load:0xc0a88001->NXM_OF_ARP_SPA[[]],CONTROLLER:65535,load:0x404444444441->NXM_NX_ARP_THA[[]],load:0x1010101->NXM_OF_ARP_SPA[[]],load:0x2020202->NXM_OF_ARP_TPA[[]],CONTROLLER:65535
1801 n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1802 NXST_FLOW reply:
1803 ])
1804
1805 OVS_VSWITCHD_STOP
1806 AT_CLEANUP
1807
1808
1809 AT_SETUP([ofproto-dpif - controller with slow-path action])
1810 OVS_VSWITCHD_START
1811 add_of_ports br0 1 2
1812
1813 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,controller"])
1814
1815 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1816
1817 for i in 1 2 3 ; do
1818 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1819 done
1820
1821 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
1822 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1823
1824 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1825 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1826 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1827 dnl
1828 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1829 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1830 dnl
1831 OFPT_PACKET_IN (xid=0x0): total_len=118 in_port=1 (via action) data_len=118 (unbuffered)
1832 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:4a2c
1833 ])
1834
1835 OVS_VSWITCHD_STOP
1836 AT_CLEANUP
1837
1838
1839 AT_SETUP([ofproto-dpif - controller action without megaflows])
1840 OVS_VSWITCHD_START
1841 add_of_ports br0 1
1842
1843 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,action=controller])
1844 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [dnl
1845 megaflows disabled
1846 ])
1847
1848 AT_CAPTURE_FILE([ofctl_monitor.log])
1849 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1850
1851 for i in 1 2; do
1852 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'])
1853 done
1854
1855 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
1856 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1857
1858 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1859 flow-dump from non-dpdk interfaces:
1860 packets:1, bytes:14, used:0.001s, actions:userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=1,rule_cookie=0,controller_id=0,max_len=65535))
1861 ])
1862
1863 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1864 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1865 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1866 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1867 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1868 ])
1869
1870 AT_CHECK([ovs-appctl revalidator/purge])
1871 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1872
1873 dnl Add a controller meter.
1874 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=controller pktps stats bands=type=drop rate=2'])
1875
1876 dnl Advance time by 1 second.
1877 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1878
1879 for i in `seq 1 8`; do
1880 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x4321)'])
1881 done
1882
1883 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1884 flow-dump from non-dpdk interfaces:
1885 packets:7, bytes:98, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,controller(reason=1,dont_send=0,continuation=0,recirc_id=2,rule_cookie=0,controller_id=0,max_len=65535))))
1886 ])
1887
1888 AT_CHECK([ovs-appctl time/warp 1], [0], [ignore])
1889 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1890
1891 dnl Out of 8 packets we sent, two were passed by the rate limiter, and
1892 dnl the rest of packets were blocked.
1893 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1894 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1895 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1896 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1897 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1898 ])
1899 dnl Check meter stats to make it gives the same picture;
1900 dnl 7 packets hit the meter, but 6 packets are dropped by band0.
1901 AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
1902 OFPST_METER reply (OF1.3) (xid=0x2):
1903 meter:controller flow_count:0 packet_in_count:8 byte_in_count:112 duration:0.0s bands:
1904 0: packet_count:6 byte_count:84
1905 ])
1906
1907 OVS_VSWITCHD_STOP
1908 AT_CLEANUP
1909
1910 AT_SETUP([ofproto-dpif - MPLS handling])
1911 OVS_VSWITCHD_START([dnl
1912 add-port br0 p1 -- set Interface p1 type=dummy
1913 ])
1914 on_exit 'kill `cat ovs-ofctl.pid`'
1915
1916 AT_CAPTURE_FILE([ofctl_monitor.log])
1917 AT_DATA([flows.txt], [dnl
1918 cookie=0xa dl_src=40:44:44:44:44:42 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
1919 cookie=0xa dl_src=41:44:44:44:44:42 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],pop_mpls:0x0800,controller
1920 cookie=0xa dl_src=40:44:44:44:44:43 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
1921 cookie=0xa dl_src=40:44:44:44:44:44 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
1922 cookie=0xa dl_src=40:44:44:44:44:45 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,controller
1923 cookie=0xa dl_src=40:44:44:44:44:46 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),controller
1924 cookie=0xa dl_src=40:44:44:44:44:47 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,set_mpls_ttl(10),controller
1925 cookie=0xa dl_src=40:44:44:44:44:48 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),dec_mpls_ttl,controller
1926 cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
1927 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1928 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1929 cookie=0xc dl_src=70:77:77:77:77:77 actions=push_mpls:0x8848,load:1000->OXM_OF_MPLS_LABEL[[]],load:7->OXM_OF_MPLS_TC[[]],controller
1930
1931 cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1932 cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1933 cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1934 cookie=0xd dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:OXM_OF_IPV4_DST[[]],pop:OXM_OF_IPV4_SRC[[]],controller
1935 cookie=0xd dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,1,0,OXM_OF_IPV4_SRC[[0..7]]),controller
1936 cookie=0xd dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,OXM_OF_IPV4_SRC[[0..15]],slaves:1,2),controller
1937 cookie=0xd dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,OXM_OF_IPV4_SRC[[]]=OXM_OF_IPV4_DST[[]]),controller
1938
1939 cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1940 cookie=0xd table=1 arp actions=controller
1941
1942 cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1943 cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1944 cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1945 cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1946
1947 cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1948 cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1949 cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1950
1951 cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
1952 cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1953 cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1954
1955 cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1956 cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1957 cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1958
1959 cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1960 cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1961 cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1962
1963 cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1964 cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1965 cookie=0x5 dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
1966 ])
1967 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1968
1969 dnl Modified MPLS controller action.
1970 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1971
1972 for i in 1 2 3; do
1973 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:42,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=17,tos=0,ttl=64,frag=no),udp(src=7777,dst=80)'
1974 done
1975 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1976 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1977
1978 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1979 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
1980 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:42,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1981 dnl
1982 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
1983 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:42,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1984 dnl
1985 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=110 in_port=1 (via action) data_len=110 (unbuffered)
1986 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:42,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1987 ])
1988
1989 dnl Modified MPLS controller action.
1990 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1991
1992 for i in 1 2 3; do
1993 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=41:44:44:44:44:42,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=16,tos=0,ttl=64,frag=no)'
1994 done
1995 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1996 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1997
1998 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1999 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
2000 ip,vlan_tci=0x0000,dl_src=41:44:44:44:44:42,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
2001 dnl
2002 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
2003 ip,vlan_tci=0x0000,dl_src=41:44:44:44:44:42,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
2004 dnl
2005 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
2006 ip,vlan_tci=0x0000,dl_src=41:44:44:44:44:42,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
2007 ])
2008
2009 dnl Modified MPLS controller action.
2010 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2011
2012 dnl in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x8847),mpls(label=100,tc=3,ttl=64,bos=1)
2013
2014 for i in 1 2 3; do
2015 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:43,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1)'
2016 done
2017 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2018 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2019
2020 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2021 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2022 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=46912
2023 dnl
2024 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2025 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=46912
2026 dnl
2027 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2028 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=46912
2029 ])
2030
2031 dnl Modified MPLS controller action.
2032 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2033
2034 for i in 1 2 3; do
2035 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:44,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=16,tos=0,ttl=64,frag=no))'
2036 done
2037 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2038 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2039
2040 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2041 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2042 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
2043 dnl
2044 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2045 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
2046 dnl
2047 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2048 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
2049 ])
2050
2051 dnl Modified MPLS controller action.
2052 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2053
2054 for i in 1 2 3; do
2055 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:45,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=16,tos=0,ttl=64,frag=no)'
2056 done
2057 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2058 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2059
2060 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2061 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2062 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=63,mpls_bos=1
2063 dnl
2064 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2065 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=63,mpls_bos=1
2066 dnl
2067 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2068 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=63,mpls_bos=1
2069 ])
2070
2071 dnl Modified MPLS controller action.
2072 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2073
2074 for i in 1 2 3; do
2075 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:46,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=16,tos=0,ttl=64,frag=no)'
2076 done
2077 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2078 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2079
2080 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2081 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2082 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2083 dnl
2084 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2085 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2086 dnl
2087 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2088 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2089 ])
2090
2091 dnl Modified MPLS controller action.
2092 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2093
2094 for i in 1 2 3; do
2095 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:47,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=16,tos=0,ttl=64,frag=no)'
2096 done
2097 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2098 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2099
2100 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2101 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2102 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2103 dnl
2104 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2105 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2106 dnl
2107 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2108 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=10,mpls_bos=1
2109 ])
2110
2111 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2112
2113 dnl Modified MPLS controller action.
2114 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2115
2116 for i in 1 2 3; do
2117 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:49,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=10,tc=3,ttl=64,bos=1)'
2118 done
2119 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2120 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2121
2122 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2123 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2124 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
2125 dnl
2126 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2127 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
2128 dnl
2129 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
2130 mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
2131 ])
2132
2133 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2134
2135 dnl Modified MPLS controller action.
2136 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2137
2138 for i in 1 2 3; do
2139 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:48,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=16,tos=0,ttl=64,frag=no)'
2140 done
2141 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2142 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2143
2144 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2145 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2146 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=9,mpls_bos=1
2147 dnl
2148 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2149 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=9,mpls_bos=1
2150 dnl
2151 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
2152 mpls,vlan_tci=0x0000,dl_src=40:44:44:44:44:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=9,mpls_bos=1
2153 ])
2154
2155 dnl Modified MPLS actions.
2156 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2157
2158 for i in 1 2 3; do
2159 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:55:55:55:55:55,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=100,tc=7,ttl=64,bos=1)'
2160 done
2161 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2162 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2163
2164 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2165 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
2166 mpls,vlan_tci=0x0000,dl_src=50:55:55:55:55:55,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
2167 dnl
2168 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
2169 mpls,vlan_tci=0x0000,dl_src=50:55:55:55:55:55,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
2170 dnl
2171 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
2172 mpls,vlan_tci=0x0000,dl_src=50:55:55:55:55:55,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=64,mpls_bos=1
2173 ])
2174
2175 dnl Modified MPLS ipv6 controller action.
2176 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2177
2178 for i in 1 2 3; do
2179 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=70:77:77:77:77:77,dst=50:54:00:00:00:07),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)'
2180 done
2181 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2182 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2183
2184 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2185 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2186 mplsm,vlan_tci=0x0000,dl_src=70:77:77:77:77:77,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=128,mpls_bos=1
2187 dnl
2188 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2189 mplsm,vlan_tci=0x0000,dl_src=70:77:77:77:77:77,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=128,mpls_bos=1
2190 dnl
2191 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2192 mplsm,vlan_tci=0x0000,dl_src=70:77:77:77:77:77,dl_dst=50:54:00:00:00:07,mpls_label=1000,mpls_tc=7,mpls_ttl=128,mpls_bos=1
2193 ])
2194
2195
2196 dnl Modified MPLS pop action.
2197 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
2198 dnl 60:66:66:66:66:66 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2199 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
2200
2201 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2202
2203 for i in 1 2 3; do
2204 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 66 66 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 40 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2205 done
2206 #for i in 2 3; do
2207 # ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=60:66:66:66:66:66,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=10,tc=3,ttl=100,bos=1)'
2208 #done
2209 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2210 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2211
2212 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2213 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2214 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2215 dnl
2216 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2217 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2218 dnl
2219 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2220 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2221 ])
2222
2223 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2224
2225 dnl Modified MPLS pop action.
2226 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2227 dnl 60:66:66:66:00:01 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2228 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2229 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2230 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2231
2232 for i in 1 2 3; do
2233 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 01 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2234 done
2235 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2236 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2237
2238 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2239 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2240 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2241 dnl
2242 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2243 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2244 dnl
2245 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2246 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2247 ])
2248
2249 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2250
2251 dnl Modified MPLS pop action.
2252 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2253 dnl 60:66:66:66:00:02 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2254 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2255 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2256 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2257
2258 for i in 1 2 3; do
2259 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 02 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2260 done
2261 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2262 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2263
2264 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2265 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2266 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2267 dnl
2268 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2269 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2270 dnl
2271 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2272 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2273 ])
2274
2275 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2276
2277 dnl Modified MPLS pop action.
2278 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2279 dnl 60:66:66:66:00:03 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2280 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2281 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2282 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2283
2284 for i in 1 2 3; do
2285 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 03 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2286 done
2287 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2288 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2289
2290 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2291 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2292 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2293 dnl
2294 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2295 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2296 dnl
2297 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2298 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2299 ])
2300
2301 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2302
2303 dnl Modified MPLS pop action.
2304 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2305 dnl 60:66:66:66:00:04 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2306 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2307 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2308 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2309
2310 for i in 1 2 3; do
2311 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 04 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2312 done
2313 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2314 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2315
2316 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2317 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2318 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2319 dnl
2320 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2321 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2322 dnl
2323 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2324 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
2325 ])
2326
2327 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2328
2329 dnl Modified MPLS pop action.
2330 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2331 dnl 60:66:66:66:00:05 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2332 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2333 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2334 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2335
2336 for i in 1 2 3; do
2337 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 05 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2338 done
2339 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2340 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2341
2342 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2343 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2344 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2345 dnl
2346 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2347 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2348 dnl
2349 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2350 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2351 ])
2352
2353 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2354
2355 dnl Modified MPLS pop action.
2356 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2357 dnl 60:66:66:66:00:06 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2358 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2359 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2360 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2361
2362 for i in 1 2 3; do
2363 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 06 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2364 done
2365 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2366 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2367
2368 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2369 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2370 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2371 dnl
2372 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2373 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2374 dnl
2375 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2376 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2377 ])
2378
2379 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2380
2381 dnl Modified MPLS pop action.
2382 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2383 dnl 60:66:66:66:00:07 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2384 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2385 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2386 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2387
2388 for i in 1 2 3; do
2389 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 07 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2390 done
2391 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2392 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2393
2394 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2395 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2396 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2397 dnl
2398 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2399 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2400 dnl
2401 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2402 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2403 ])
2404
2405 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2406
2407 dnl Modified MPLS pop action.
2408 dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2409 dnl 60:66:66:66:00:08 > ff:ff:ff:ff:ff:ff, ethertype MPLS unicast (0x8847), length 46: MPLS (label 20, exp 0, [S], ttl 32)
2410 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2411
2412 for i in 1 2 3; do
2413 ovs-appctl netdev-dummy/receive p1 'ff ff ff ff ff ff 60 66 66 66 00 08 88 47 00 01 41 20 00 01 08 00 06 04 00 02 60 66 66 66 00 08 c0 a8 00 01 ff ff ff ff ff ff ff ff ff ff'
2414 done
2415 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2416 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2417
2418 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2419 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2420 arp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
2421 dnl
2422 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2423 arp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
2424 dnl
2425 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2426 arp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
2427 ])
2428
2429 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2430
2431 dnl Modified MPLS pop action.
2432 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2433 dnl 60:66:66:66:00:09 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2434 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2435 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2436 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2437
2438 for i in 1 2 3; do
2439 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 09 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2440 done
2441 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2442 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2443
2444 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2445 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2446 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2447 dnl
2448 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2449 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2450 dnl
2451 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2452 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2453 ])
2454
2455 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2456
2457 dnl Modified MPLS pop action.
2458 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2459 dnl 60:66:66:66:00:0a > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2460 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2461 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2462 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2463
2464 for i in 1 2 3; do
2465 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 0a 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2466 done
2467 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2468 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2469
2470 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2471 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2472 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2473 dnl
2474 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2475 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2476 dnl
2477 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2478 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
2479 ])
2480
2481 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2482
2483 dnl Modified MPLS pop action.
2484 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2485 dnl 60:66:66:66:00:0b > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2486 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2487 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2488 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2489
2490 for i in 1 2 3; do
2491 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 0b 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2492 done
2493 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2494 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2495
2496 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2497 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2498 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
2499 dnl
2500 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2501 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
2502 dnl
2503 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2504 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
2505 ])
2506
2507 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2508
2509 dnl Modified MPLS pop action.
2510 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2511 dnl 60:66:66:66:01:00 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2512 dnl (label 20, exp 0, [S], ttl 31)
2513 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2514 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2515 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2516
2517 for i in 1 2 3; do
2518 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 01 00 88 48 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2519 done
2520 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2521 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2522
2523 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2524 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2525 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2526 dnl
2527 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2528 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2529 dnl
2530 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2531 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2532 ])
2533
2534 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2535
2536 dnl Modified MPLS pop action.
2537 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2538 dnl 60:66:66:66:01:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2539 dnl (label 20, exp 0, [S], ttl 31)
2540 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2541 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2542 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2543
2544 for i in 1 2 3; do
2545 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 01 01 88 47 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2546 done
2547 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2548 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2549
2550 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2551 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2552 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2553 dnl
2554 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2555 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2556 dnl
2557 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2558 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2559 ])
2560
2561 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2562
2563 dnl Modified MPLS pop action.
2564 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2565 dnl 60:66:66:66:01:02 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2566 dnl (label 20, exp 0, [S], ttl 31)
2567 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2568 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2569 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2570
2571 for i in 1 2 3; do
2572 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 01 02 88 48 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2573 done
2574 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2575 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2576
2577 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2578 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2579 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
2580 dnl
2581 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2582 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
2583 dnl
2584 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2585 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
2586 ])
2587
2588 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2589
2590 dnl Modified MPLS pop action.
2591 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2592 dnl 60:66:66:66:02:00 > 50:54:00:00:02:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2593 dnl (label 20, exp 0, [S], ttl 31)
2594 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2595 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2596 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2597
2598 for i in 1 2 3; do
2599 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 02 00 88 47 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2600 done
2601 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2602 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2603
2604 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2605 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2606 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2607 dnl
2608 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2609 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2610 dnl
2611 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2612 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2613 ])
2614
2615 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2616
2617 dnl Modified MPLS pop action.
2618 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2619 dnl 60:66:66:66:02:01 > 50:54:00:00:02:01, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2620 dnl (label 20, exp 0, [S], ttl 31)
2621 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2622 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2623 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2624
2625 for i in 1 2 3; do
2626 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 02 01 88 48 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2627 done
2628
2629 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2630 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2631
2632 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2633 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2634 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2635 dnl
2636 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2637 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2638 dnl
2639 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2640 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2641 ])
2642
2643 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2644
2645 dnl Modified MPLS pop action.
2646 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2647 dnl 60:66:66:66:02:10 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2648 dnl (label 20, exp 0, [S], ttl 31)
2649 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2650 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2651 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2652
2653 for i in 1 2 3; do
2654 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 02 10 88 47 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2655 done
2656 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2657 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2658
2659 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2660 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2661 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2662 dnl
2663 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2664 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2665 dnl
2666 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2667 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2668 ])
2669
2670 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2671
2672 dnl Modified MPLS pop action.
2673 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2674 dnl 60:66:66:66:03:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2675 dnl (label 20, exp 0, ttl 31)
2676 dnl (label 20, exp 0, [S], ttl 30)
2677 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2678 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2679 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2680
2681 for i in 1 2 3; do
2682 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 00 88 47 00 01 40 20 00 01 40 1f 00 01 41 1e 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2683 done
2684 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2685 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2686
2687 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2688 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2689 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2690 dnl
2691 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2692 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2693 dnl
2694 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2695 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2696 ])
2697
2698 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2699
2700 dnl Modified MPLS pop action.
2701 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2702 dnl 60:66:66:66:03:01 > 50:54:00:00:00:00, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2703 dnl (label 20, exp 0, ttl 31)
2704 dnl (label 20, exp 0, [S], ttl 30)
2705 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2706 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2707 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2708
2709 for i in 1 2 3; do
2710 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 01 88 48 00 01 40 20 00 01 40 1f 00 01 41 1e 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2711 done
2712 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2713 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2714
2715 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2716 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2717 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2718 dnl
2719 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2720 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2721 dnl
2722 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2723 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2724 ])
2725
2726 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2727
2728 dnl Modified MPLS pop action.
2729 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2730 dnl 60:66:66:66:03:10 > 50:54:00:00:00:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2731 dnl (label 20, exp 0, ttl 31)
2732 dnl (label 20, exp 0, [S], ttl 30)
2733 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2734 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2735 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2736
2737 for i in 1 2 3; do
2738 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 10 88 47 00 01 40 20 00 01 40 1f 00 01 41 1e 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2739 done
2740 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2741 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2742
2743 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2744 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2745 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2746 dnl
2747 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2748 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2749 dnl
2750 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2751 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2752 ])
2753
2754 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2755
2756 dnl Modified MPLS pop action.
2757 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2758 dnl 60:66:66:66:04:00 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2759 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2760 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2761 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2762
2763 for i in 1 2 3; do
2764 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 04 00 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2765 done
2766 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2767 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2768
2769 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2770 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2771 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
2772 dnl
2773 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2774 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
2775 dnl
2776 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2777 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
2778 ])
2779
2780 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2781
2782 dnl Modified MPLS pop action.
2783 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2784 dnl 60:66:66:66:04:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2785 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2786 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2787 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2788
2789 for i in 1 2 3; do
2790 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 04 01 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2791 done
2792 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2793 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2794
2795 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2796 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2797 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
2798 dnl
2799 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2800 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
2801 dnl
2802 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2803 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
2804 ])
2805
2806 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2807
2808 dnl Modified MPLS pop action.
2809 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2810 dnl 60:66:66:66:04:10 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2811 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2812 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2813 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2814
2815 for i in 1 2 3; do
2816 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 04 10 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2817 done
2818 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2819 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2820
2821 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2822 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2823 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
2824 dnl
2825 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2826 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
2827 dnl
2828 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2829 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
2830 ])
2831
2832 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2833
2834 dnl Modified MPLS pop action.
2835 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2836 dnl 60:66:66:66:05:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2837 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2838 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2839 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2840
2841 for i in 1 2 3; do
2842 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 05 00 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2843 done
2844
2845 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2846 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2847
2848 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2849 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2850 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
2851 dnl
2852 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2853 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
2854 dnl
2855 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2856 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
2857 ])
2858
2859 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2860
2861 dnl Modified MPLS pop action.
2862 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2863 dnl 60:66:66:66:05:01 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2864 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2865 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2866 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2867
2868 for i in 1 2 3; do
2869 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 05 01 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2870 done
2871 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2872 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2873
2874 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2875 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2876 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2877 dnl
2878 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2879 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2880 dnl
2881 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2882 mplsm,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2883 ])
2884
2885 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2886
2887 dnl Modified MPLS pop action.
2888 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2889 dnl 60:66:66:66:05:10 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2890 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2891 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2892 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2893
2894 for i in 1 2 3; do
2895 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 05 10 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2896 done
2897
2898 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2899 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2900
2901 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2902 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2903 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2904 dnl
2905 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2906 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2907 dnl
2908 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2909 mpls,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2910 ])
2911
2912 AT_CHECK([ovs-appctl revalidator/purge], [0])
2913 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2914 cookie=0x5, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,CONTROLLER:65535
2915 cookie=0x5, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
2916 cookie=0x5, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,CONTROLLER:65535
2917 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:45 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,CONTROLLER:65535
2918 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:46 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),CONTROLLER:65535
2919 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:47 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,set_mpls_ttl(10),CONTROLLER:65535
2920 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:48 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),dec_mpls_ttl,CONTROLLER:65535
2921 cookie=0xa, n_packets=3, n_bytes=102, dl_src=41:44:44:44:44:42 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],pop_mpls:0x0800,CONTROLLER:65535
2922 cookie=0xa, n_packets=3, n_bytes=114, dl_src=40:44:44:44:44:44 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2923 cookie=0xa, n_packets=3, n_bytes=318, dl_src=40:44:44:44:44:42 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2924 cookie=0xa, n_packets=3, n_bytes=54, dl_src=40:44:44:44:44:43 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2925 cookie=0xa, n_packets=3, n_bytes=54, mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
2926 cookie=0xb, n_packets=3, n_bytes=54, mpls,dl_src=50:55:55:55:55:55 actions=load:0x3e8->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
2927 cookie=0xc, n_packets=3, n_bytes=162, dl_src=70:77:77:77:77:77 actions=push_mpls:0x8848,load:0x3e8->OXM_OF_MPLS_LABEL[[]],load:0x7->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2928 cookie=0xd, n_packets=3, n_bytes=138, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
2929 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
2930 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->NXM_OF_IP_DST[[]],CONTROLLER:65535
2931 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:NXM_OF_IP_DST[[]]->NXM_OF_IP_SRC[[]],CONTROLLER:65535
2932 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:NXM_OF_IP_DST[[]],pop:NXM_OF_IP_SRC[[]],CONTROLLER:65535
2933 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,1,0,NXM_OF_IP_SRC[[0..7]]),CONTROLLER:65535
2934 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,NXM_OF_IP_SRC[[0..15]],slaves:1,2),CONTROLLER:65535
2935 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,NXM_OF_IP_SRC[[]]=NXM_OF_IP_DST[[]]),CONTROLLER:65535
2936 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
2937 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,CONTROLLER:65535
2938 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,CONTROLLER:65535
2939 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
2940 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2941 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,CONTROLLER:65535
2942 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2943 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,CONTROLLER:65535
2944 cookie=0xd, table=1, n_packets=3, n_bytes=126, arp actions=CONTROLLER:65535
2945 cookie=0xdeadbeef, table=2, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
2946 cookie=0xe, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
2947 cookie=0xe, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
2948 cookie=0xe, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,CONTROLLER:65535
2949 cookie=0xe, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,CONTROLLER:65535
2950 cookie=0xe, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
2951 cookie=0xf, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,CONTROLLER:65535
2952 cookie=0xf, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
2953 cookie=0xf, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
2954 NXST_FLOW reply:
2955 ])
2956
2957 OVS_VSWITCHD_STOP
2958 AT_CLEANUP
2959
2960 AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2961 OVS_VSWITCHD_START([dnl
2962 add-port br0 p1 -- set Interface p1 type=dummy
2963 ])
2964 on_exit 'kill `cat ovs-ofctl.pid`'
2965
2966 AT_CAPTURE_FILE([ofctl_monitor.log])
2967 AT_DATA([flows.txt], [dnl
2968 table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2969 table=1 ip,ip_dscp=8 actions=controller
2970 ])
2971 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2972
2973
2974 dnl Modified MPLS pop action.
2975 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2976 dnl 60:66:66:66:00:08 > 50:54:00:00:00:01, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2977 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2978 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2979 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2980
2981 for i in 1 2 3; do
2982 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 01 60 66 66 66 00 08 88 48 00 01 41 20 45 20 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2983 done
2984 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2985 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2986
2987 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2988 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2989 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2990 dnl
2991 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2992 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2993 dnl
2994 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2995 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2996 ])
2997
2998 AT_CHECK([ovs-appctl revalidator/purge], [0])
2999 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3000 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
3001 table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
3002 OFPST_FLOW reply (OF1.2):
3003 ])
3004
3005 OVS_VSWITCHD_STOP
3006 AT_CLEANUP
3007
3008 AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
3009 OVS_VSWITCHD_START([dnl
3010 add-port br0 p1 -- set Interface p1 type=dummy
3011 ])
3012 on_exit 'kill `cat ovs-ofctl.pid`'
3013
3014 dnl N.B: The first (and only) action that accesses L3 data after the
3015 dnl pop_mpls action is present in write_actions. This exercises recirculation
3016 dnl triggered in write_actions due to a previous action not in write actions.
3017 AT_CAPTURE_FILE([ofctl_monitor.log])
3018 AT_DATA([flows.txt], [dnl
3019 mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
3020 ])
3021 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
3022
3023 dnl Modified MPLS pop action.
3024 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
3025 dnl 60:66:66:66:00:08 > 50:54:00:00:00:01, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
3026 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
3027 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
3028 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3029
3030 for i in 1 2 3; do
3031 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 01 60 66 66 66 00 08 88 48 00 01 41 20 45 20 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
3032 done
3033 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3034 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3035
3036 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
3037 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3038 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3039 dnl
3040 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3041 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3042 dnl
3043 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3044 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
3045 ])
3046
3047 AT_CHECK([ovs-appctl revalidator/purge], [0])
3048 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3049 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
3050 OFPST_FLOW reply (OF1.2):
3051 ])
3052
3053 OVS_VSWITCHD_STOP
3054 AT_CLEANUP
3055
3056 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
3057 OVS_VSWITCHD_START([dnl
3058 add-port br0 p1 -- set Interface p1 type=dummy
3059 ])
3060 on_exit 'kill `cat ovs-ofctl.pid`'
3061
3062 AT_CAPTURE_FILE([ofctl_monitor.log])
3063 # A table-miss flow has priority 0 and no match
3064 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3065
3066 dnl Singleton controller action.
3067 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3068
3069 for i in 1 2 3 ; do
3070 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x002)'
3071 done
3072 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3073 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3074
3075 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3076 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3077 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3078 dnl
3079 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3080 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3081 dnl
3082 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3083 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3084 ])
3085
3086 AT_CHECK([ovs-appctl revalidator/purge], [0])
3087 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3088 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3089 NXST_FLOW reply:
3090 ])
3091
3092 OVS_VSWITCHD_STOP
3093 AT_CLEANUP
3094
3095
3096 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
3097 OVS_VSWITCHD_START([dnl
3098 add-port br0 p1 -- set Interface p1 type=dummy
3099 ])
3100 on_exit 'kill `cat ovs-ofctl.pid`'
3101
3102 AT_CAPTURE_FILE([ofctl_monitor.log])
3103 # A table-miss flow has priority 0 and no match
3104 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3105
3106 dnl Singleton controller action.
3107 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3108
3109 for i in 1 2 3 ; do
3110 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x002)'
3111 done
3112 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3113 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3114
3115 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3116
3117 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3118 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3119 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3120 dnl
3121 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3122 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3123 dnl
3124 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3125 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3126 ])
3127
3128 AT_CHECK([ovs-appctl revalidator/purge], [0])
3129 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3130 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3131 OFPST_FLOW reply (OF1.3):
3132 ])
3133
3134 OVS_VSWITCHD_STOP
3135 AT_CLEANUP
3136
3137 AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
3138 OVS_VSWITCHD_START([dnl
3139 add-port br0 p1 -- set Interface p1 type=dummy
3140 ])
3141 on_exit 'kill `cat ovs-ofctl.pid`'
3142
3143 ovs-appctl time/stop
3144
3145 AT_CAPTURE_FILE([ofctl_monitor.log])
3146 # A table-miss flow has priority 0 and no match
3147 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3148
3149 dnl Singleton controller action.
3150 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3151
3152 # Become slave (OF 1.3), which should disable everything except port status.
3153 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3154
3155 # Ensure that ovs-vswitchd gets a chance to reply before sending another command.
3156 ovs-appctl time/warp 500 100
3157
3158 # Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
3159 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
3160
3161 ovs-appctl time/warp 500 100
3162 for i in 1 2 3 ; do
3163 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x002)'
3164 done
3165 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3166 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3167
3168 AT_CHECK([ovs-appctl revalidator/purge], [0])
3169 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3170 send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
3171 OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
3172 dnl
3173 send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
3174 master:
3175 PACKET_IN: (off)
3176 PORT_STATUS: (off)
3177 FLOW_REMOVED: (off)
3178 ROLE_STATUS: (off)
3179 TABLE_STATUS: (off)
3180 REQUESTFORWARD: (off)
3181
3182 slave:
3183 PACKET_IN: no_match
3184 PORT_STATUS: (off)
3185 FLOW_REMOVED: (off)
3186 ROLE_STATUS: (off)
3187 TABLE_STATUS: (off)
3188 REQUESTFORWARD: (off)
3189 dnl
3190 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3191 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3192 dnl
3193 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3194 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3195 dnl
3196 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3197 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3198 ])
3199
3200 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3201
3202 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3203 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3204 OFPST_FLOW reply (OF1.3):
3205 ])
3206
3207 OVS_VSWITCHD_STOP
3208 AT_CLEANUP
3209
3210
3211 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
3212 OVS_VSWITCHD_START([dnl
3213 add-port br0 p1 -- set Interface p1 type=dummy
3214 ])
3215 on_exit 'kill `cat ovs-ofctl.pid`'
3216
3217 AT_CAPTURE_FILE([ofctl_monitor.log])
3218 # A table-miss flow has priority 0 and no match
3219 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3220
3221 dnl Singleton controller action.
3222 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3223
3224 for i in 1 2 3 ; do
3225 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x002)'
3226 done
3227 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3228 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3229
3230 AT_CHECK([ovs-appctl revalidator/purge], [0])
3231 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3232 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3233 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3234 dnl
3235 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3236 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3237 dnl
3238 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3239 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3240 ])
3241
3242 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3243
3244 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3245 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3246 OFPST_FLOW reply (OF1.4):
3247 ])
3248
3249 OVS_VSWITCHD_STOP
3250 AT_CLEANUP
3251
3252
3253 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3254 OVS_VSWITCHD_START([dnl
3255 add-port br0 p1 -- set Interface p1 type=dummy
3256 ])
3257 on_exit 'kill `cat ovs-ofctl.pid`'
3258
3259 AT_CAPTURE_FILE([ofctl_monitor.log])
3260 AT_DATA([flows.txt], [dnl
3261 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3262 table=1 actions=output(CONTROLLER),goto_table(2)
3263 table=2 actions=group:1234
3264 ])
3265 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3266 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3267
3268 dnl Singleton controller action.
3269 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3270
3271 for i in 1 2 3 ; do
3272 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x002)'
3273 done
3274 AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3275 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
3276 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3277
3278 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3279
3280 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3281 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3282 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3283 dnl
3284 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3285 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3286 dnl
3287 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3288 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3289 dnl
3290 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3291 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3292 dnl
3293 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3294 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3295 dnl
3296 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3297 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3298 dnl
3299 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3300 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3301 dnl
3302 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3303 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3304 dnl
3305 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3306 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3307 dnl
3308 OFPT_PACKET_IN (OF1.3) (xid=0x0): total_len=54 in_port=ANY (via action) data_len=54 (unbuffered)
3309 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3310 ])
3311
3312 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3313
3314 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3315 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3316 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3317 table=2, n_packets=3, n_bytes=162, actions=group:1234
3318 OFPST_FLOW reply (OF1.3):
3319 ])
3320
3321 OVS_VSWITCHD_STOP
3322 AT_CLEANUP
3323
3324
3325 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3326 OVS_VSWITCHD_START([dnl
3327 add-port br0 p1 -- set Interface p1 type=dummy
3328 ])
3329 on_exit 'kill `cat ovs-ofctl.pid`'
3330
3331 AT_CAPTURE_FILE([ofctl_monitor.log])
3332 AT_DATA([flows.txt], [dnl
3333 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3334 table=1 actions=output(CONTROLLER),goto_table(2)
3335 table=2 actions=group:1234
3336 ])
3337 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3338 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3339
3340 dnl Singleton controller action.
3341 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3342
3343 for i in 1 2 3 ; do
3344 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x002)'
3345 done
3346 AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3347 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
3348 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3349
3350 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3351
3352 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3353 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3354 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3355 dnl
3356 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3357 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3358 dnl
3359 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3360 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3361 dnl
3362 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3363 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3364 dnl
3365 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3366 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3367 dnl
3368 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3369 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3370 dnl
3371 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3372 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3373 dnl
3374 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3375 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3376 dnl
3377 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3378 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3379 dnl
3380 OFPT_PACKET_IN (OF1.4) (xid=0x0): total_len=54 in_port=ANY (via packet_out) data_len=54 (unbuffered)
3381 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3382 ])
3383
3384 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3385
3386 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3387 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3388 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3389 table=2, n_packets=3, n_bytes=162, actions=group:1234
3390 OFPST_FLOW reply (OF1.4):
3391 ])
3392
3393 OVS_VSWITCHD_STOP
3394 AT_CLEANUP
3395
3396 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3397
3398 OVS_VSWITCHD_START([dnl
3399 set bridge br0 datapath_type=dummy \
3400 protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
3401 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
3402
3403 AT_CHECK([
3404 ovs-ofctl -OOpenFlow13 del-flows br0
3405 ovs-ofctl -OOpenFlow13 add-group br0 "group_id=6000,type=all,bucket=actions=controller,bucket=actions=resubmit(,48),bucket=actions=resubmit(,81)"
3406 ovs-ofctl -OOpenFlow13 add-flow br0 "table=0, in_port=1, vlan_tci=0x0000/0x1fff actions=write_metadata:0x67870000000000/0xffffff0000000001,goto_table:17"
3407 ovs-ofctl -OOpenFlow13 add-flow br0 "table=17, priority=10,metadata=0x67870000000000/0xffffff0000000000 actions=write_metadata:0xe067870000000000/0xfffffffffffffffe,goto_table:60"
3408 ovs-ofctl -OOpenFlow13 add-flow br0 "table=60, priority=0 actions=resubmit(,17)"
3409 ovs-ofctl -OOpenFlow13 add-flow br0 "table=17, priority=10,metadata=0xe067870000000000/0xffffff0000000000 actions=write_metadata:0x67871d4d000000/0xfffffffffffffffe,goto_table:43"
3410 ovs-ofctl -OOpenFlow13 add-flow br0 "table=43, priority=100,icmp actions=group:6000"
3411 ovs-ofctl -OOpenFlow13 add-flow br0 "table=48, priority=0 actions=resubmit(,49),resubmit(,50)"
3412 ovs-ofctl -OOpenFlow13 add-flow br0 "table=50, priority=0 actions=controller"
3413 ], [0], [ignore])
3414
3415 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3416
3417 AT_CHECK([
3418 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
3419 ], [0], [ignore])
3420
3421 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
3422 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3423
3424 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3425 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=43 cookie=0x0 total_len=98 metadata=0x67871d4d000000,in_port=1 (via action) data_len=98 (unbuffered)
3426 icmp,vlan_tci=0x0000,dl_src=3a:6d:d2:09:9c:ab,dl_dst=1e:2c:e9:2a:66:9e,nw_src=192.168.10.10,nw_dst=192.168.10.30,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:6f20
3427 dnl
3428 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=50 cookie=0x0 total_len=98 metadata=0x67871d4d000000,in_port=1 (via no_match) data_len=98 (unbuffered)
3429 icmp,vlan_tci=0x0000,dl_src=3a:6d:d2:09:9c:ab,dl_dst=1e:2c:e9:2a:66:9e,nw_src=192.168.10.10,nw_dst=192.168.10.30,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:6f20
3430 ])
3431
3432 OVS_VSWITCHD_STOP
3433 AT_CLEANUP
3434
3435 AT_SETUP([ofproto-dpif - ARP modification slow-path])
3436 OVS_VSWITCHD_START
3437 add_of_ports br0 1 2
3438
3439 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3440 ovs-ofctl add-flow br0 'in_port=1,arp actions=load:2->OXM_OF_ARP_OP[[]],2,load:0xc0a88001->OXM_OF_ARP_SPA[[]],2,load:0x404444444441->OXM_OF_ARP_THA[[]],2'
3441
3442 # Input some packets that should follow the arp modification slow-path.
3443 for i in 1 2 3; do
3444 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=80:88:88:88:88:88,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
3445 done
3446 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3447
3448 # Check the packets that were output.
3449 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
3450 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3451 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3452 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
3453 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3454 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3455 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
3456 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3457 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
3458 arp,in_port=ANY,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.128.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=40:44:44:44:44:41
3459 ])
3460
3461 OVS_VSWITCHD_STOP
3462 AT_CLEANUP
3463
3464 AT_SETUP([ofproto-dpif - VLAN handling])
3465 OVS_VSWITCHD_START(
3466 [set Bridge br0 fail-mode=standalone -- \
3467 add-port br0 p1 trunks=10,12 -- \
3468 add-port br0 p2 tag=10 -- \
3469 add-port br0 p3 tag=12 \
3470 other-config:priority-tags=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 non-dpdk interfaces:
4388 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4389 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),5
4390 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4391 ])
4392
4393 mode=drop
4394
4395 AT_CHECK([ovs-appctl revalidator/purge], [0])
4396 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4397 for type in no first later; do
4398 eval flow=\$${type}_flow
4399 printf "\n%s\n" "----$mode $type-----"
4400
4401 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4402 done
4403
4404 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4405 flow-dump from non-dpdk interfaces:
4406 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4407 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
4408 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
4409 ])
4410
4411 mode=nx-match
4412
4413 AT_CHECK([ovs-appctl revalidator/purge], [0])
4414 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4415 for type in no first later; do
4416 eval flow=\$${type}_flow
4417 printf "\n%s\n" "----$mode $type-----"
4418
4419 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4420 done
4421
4422 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4423 flow-dump from non-dpdk interfaces:
4424 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4425 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),2
4426 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4427 ])
4428
4429 OVS_VSWITCHD_STOP
4430 AT_CLEANUP
4431
4432 AT_SETUP([ofproto-dpif - fragment handling - actions])
4433 OVS_VSWITCHD_START
4434 add_of_ports br0 1 2 3 4 5 6 90
4435
4436 AT_CHECK([ovs-ofctl add-flow br0 "tcp,ip_frag=later actions=move:OXM_OF_TCP_DST[[0..7]]->OXM_OF_TCP_SRC[[0..7]],output:1"], [1], [], [stderr])
4437 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4438 source field tcp_dst lacks correct prerequisites
4439 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4440 ])
4441
4442 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 "tcp,ip_frag=later actions=move:OXM_OF_PKT_REG0[[0..7]]->OXM_OF_TCP_SRC[[0..7]],output:1"], [1], [], [stderr])
4443 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4444 destination field tcp_src lacks correct prerequisites
4445 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4446 ])
4447
4448 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
4449 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4450 set_field udp_src lacks correct prerequisites
4451 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4452 ])
4453
4454 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
4455 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4456 set_field udp_dst lacks correct prerequisites
4457 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4458 ])
4459
4460 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
4461 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4462 set_field sctp_src lacks correct prerequisites
4463 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4464 ])
4465
4466 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
4467 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4468 set_field sctp_dst lacks correct prerequisites
4469 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4470 ])
4471
4472 AT_CHECK([ovs-ofctl add-flow br0 "tcp,ip_frag=later actions=learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,NXM_OF_IP_SRC[[]]=NXM_OF_IP_DST[[]],NXM_OF_TCP_SRC[[]]=NXM_OF_TCP_DST[[]],output:NXM_NX_REG0[[0..15]]),output:1"], [1], [], [stderr])
4473 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4474 source field tcp_dst lacks correct prerequisites
4475 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4476 ])
4477
4478 AT_DATA([flows.txt], [dnl
4479 priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
4480 ])
4481 AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
4482
4483 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4484
4485 mode=normal
4486
4487 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4488 for frag in 4000 6000 6008 4010; do
4489 printf "\n%s\n" "----$mode $frag-----"
4490
4491 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 003c 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016 751e267b 00000000 a002 16d0 1736 0000 02 04 05 b4 04 02 08 0a 2d 25 08 5f 00 00 00 00 01 03 03 07"])
4492 done
4493
4494 dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
4495 dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
4496 dnl OVS-2.5, the wildcards and set_field mask are shared internally.
4497 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4498 flow-dump from non-dpdk interfaces:
4499 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4500 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4501 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
4502 ])
4503
4504 AT_CHECK([ovs-appctl revalidator/purge], [0])
4505 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4506 for frag in 4000 6000 6008 4010; do
4507 printf "\n%s\n" "----$mode $frag truncated transport header -----"
4508
4509 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
4510 done
4511
4512 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4513 flow-dump from non-dpdk interfaces:
4514 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4515 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4516 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:38, used:0.001s, actions:1
4517 ])
4518
4519 AT_CHECK([ovs-appctl revalidator/purge], [0])
4520 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4521 for frag in 4000 6000 6001 4002; do
4522 printf "\n%s\n" "----$mode $frag missing transport header-----"
4523
4524 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
4525 done
4526
4527 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4528 flow-dump from non-dpdk interfaces:
4529 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4530 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4531 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:34, used:0.001s, actions:1
4532 ])
4533
4534 OVS_VSWITCHD_STOP
4535 AT_CLEANUP
4536
4537 AT_SETUP([ofproto-dpif - exit])
4538 OVS_VSWITCHD_START
4539 add_of_ports br0 1 2 3 10 11 12 13 14
4540 AT_DATA([flows.txt], [dnl
4541 in_port=1 actions=output:10,exit,output:11
4542 in_port=2 actions=output:12,resubmit:1,output:12
4543 in_port=3 actions=output:13,resubmit:2,output:14
4544 ])
4545 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4546 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
4547 AT_CHECK([tail -1 stdout], [0],
4548 [Datapath actions: 10
4549 ])
4550 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
4551 AT_CHECK([tail -1 stdout], [0],
4552 [Datapath actions: 12,10
4553 ])
4554 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
4555 AT_CHECK([tail -1 stdout], [0],
4556 [Datapath actions: 13,12,10
4557 ])
4558 OVS_VSWITCHD_STOP
4559 AT_CLEANUP
4560
4561
4562 AT_SETUP([ofproto-dpif - mirroring, select_all])
4563 AT_KEYWORDS([mirror mirrors mirroring])
4564 OVS_VSWITCHD_START
4565 add_of_ports br0 1 2 3
4566 ovs-vsctl \
4567 set Bridge br0 mirrors=@m --\
4568 --id=@p3 get Port p3 --\
4569 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4570
4571 AT_DATA([flows.txt], [dnl
4572 in_port=1 actions=output:2
4573 in_port=2 actions=output:1
4574 ])
4575 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4576
4577 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4578 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4579 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4580 [Datapath actions: 3,2
4581 ])
4582
4583 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4584 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4585 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4586 [Datapath actions: 3,1
4587 ])
4588
4589 OVS_VSWITCHD_STOP
4590 AT_CLEANUP
4591
4592
4593 AT_SETUP([ofproto-dpif - mirroring, select_src])
4594 AT_KEYWORDS([mirror mirrors mirroring])
4595 OVS_VSWITCHD_START
4596 add_of_ports br0 1 2 3
4597 ovs-vsctl \
4598 set Bridge br0 mirrors=@m --\
4599 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4600 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
4601
4602 AT_DATA([flows.txt], [dnl
4603 in_port=1 actions=output:2
4604 in_port=2 actions=output:1
4605 ])
4606 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4607
4608 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4609 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4610 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4611 [Datapath actions: 3,2
4612 ])
4613
4614 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4615 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4616 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4617 [Datapath actions: 1
4618 ])
4619 OVS_VSWITCHD_STOP
4620 AT_CLEANUP
4621
4622 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
4623 AT_KEYWORDS([mirror mirrors mirroring])
4624 OVS_VSWITCHD_START
4625 add_of_ports br0 1 2
4626 ovs-vsctl \
4627 set Bridge br0 mirrors=@m --\
4628 --id=@p2 get Port p2 --\
4629 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
4630
4631 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4632
4633 # "in_port" defaults to OFPP_NONE if it's not specified.
4634 flow="icmp,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_ttl=128,icmp_type=8,icmp_code=0"
4635 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4636 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4637 [Datapath actions: 1,2
4638 ])
4639
4640 OVS_VSWITCHD_STOP
4641 AT_CLEANUP
4642
4643
4644 AT_SETUP([ofproto-dpif - mirroring, select_dst])
4645 AT_KEYWORDS([mirror mirrors mirroring])
4646 OVS_VSWITCHD_START
4647 add_of_ports br0 1 2 3
4648 ovs-vsctl \
4649 set Bridge br0 mirrors=@m --\
4650 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4651 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
4652
4653 AT_DATA([flows.txt], [dnl
4654 in_port=1 actions=output:2
4655 in_port=2 actions=output:1
4656 ])
4657 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4658
4659 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4660 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4661 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4662 [Datapath actions: 2,3
4663 ])
4664
4665 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4666 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4667 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4668 [Datapath actions: 1
4669 ])
4670
4671 OVS_VSWITCHD_STOP
4672 AT_CLEANUP
4673
4674
4675 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
4676 AT_KEYWORDS([mirror mirrors mirroring])
4677 OVS_VSWITCHD_START
4678 add_of_ports br0 1 2 3
4679 ovs-vsctl \
4680 set Bridge br0 mirrors=@m --\
4681 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4682 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
4683
4684 AT_DATA([flows.txt], [dnl
4685 in_port=1, actions=output:2
4686 ])
4687 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4688
4689 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4690 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4691 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4692 [Datapath actions: 2
4693 ])
4694
4695 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=10,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))"
4696 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4697 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4698 [Datapath actions: 2
4699 ])
4700
4701 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=11,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))"
4702 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4703 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4704 [Datapath actions: 3,2
4705 ])
4706
4707 OVS_VSWITCHD_STOP
4708 AT_CLEANUP
4709
4710
4711 AT_SETUP([ofproto-dpif - mirroring, output_port])
4712 AT_KEYWORDS([mirror mirrors mirroring])
4713 OVS_VSWITCHD_START
4714 add_of_ports br0 1 2 3
4715 ovs-vsctl \
4716 set Bridge br0 mirrors=@m --\
4717 --id=@p3 get Port p3 --\
4718 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4719
4720 AT_DATA([flows.txt], [dnl
4721 in_port=1 actions=mod_vlan_vid:17,output:2
4722 in_port=2 actions=output:1
4723 ])
4724 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4725
4726 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4727 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4728 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4729 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
4730 ])
4731
4732 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4733 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4734 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4735 [Datapath actions: 3,1
4736 ])
4737
4738 OVS_VSWITCHD_STOP
4739 AT_CLEANUP
4740
4741 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
4742 AT_KEYWORDS([mirror mirrors mirroring])
4743 OVS_VSWITCHD_START
4744 add_of_ports br0 1 2
4745 ovs-vsctl \
4746 set Bridge br0 mirrors=@m --\
4747 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
4748
4749 AT_DATA([flows.txt], [dnl
4750 in_port=1 actions=output:2
4751 in_port=2 actions=mod_vlan_vid:17,output:1
4752 ])
4753 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4754
4755 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4756 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4757 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4758
4759 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
4760 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4761 mv stdout expout
4762 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4763
4764 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4765 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4766 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4767
4768 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
4769 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4770 mv stdout expout
4771 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4772
4773 OVS_VSWITCHD_STOP
4774 AT_CLEANUP
4775
4776 # This verifies that we don't get duplicate mirroring when mirror_packet()
4777 # might be invoked recursively, as a check against regression.
4778 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
4779 AT_KEYWORDS([mirror mirrors mirroring])
4780 OVS_VSWITCHD_START
4781 add_of_ports br0 1 2 3
4782 ovs-vsctl \
4783 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4784 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
4785 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
4786 -- set Port br0 tag=0 \
4787 -- set Port p1 tag=0 \
4788 -- set Port p2 tag=500 \
4789 -- set Port p3 tag=501
4790
4791 flow='in_port=1'
4792 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4793 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4794 s/,/\
4795 /g' | sort], [0], [100
4796 2
4797 3
4798 ])
4799
4800 OVS_VSWITCHD_STOP
4801 AT_CLEANUP
4802
4803 # This test verifies that mirror state is preserved across recirculation.
4804 #
4805 # Otherwise, post-recirculation the ingress and the output to port 4
4806 # would cause the packet to be mirrored to port 3 a second time.
4807 AT_SETUP([ofproto-dpif - mirroring with recirculation])
4808 AT_KEYWORDS([mirror mirrors mirroring])
4809 OVS_VSWITCHD_START
4810 add_of_ports br0 1 2 3 4
4811 ovs-vsctl \
4812 set Bridge br0 mirrors=@m --\
4813 --id=@p3 get Port p3 --\
4814 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4815
4816 AT_DATA([flows.txt], [dnl
4817 in_port=1 actions=2,debug_recirc,4
4818 ])
4819 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4820
4821 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4822 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4823 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4824 ])
4825 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4826 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4827 ])
4828
4829 OVS_VSWITCHD_STOP
4830 AT_CLEANUP
4831
4832 # Tests below verify the snaplen support for mirroring
4833 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen])
4834 AT_KEYWORDS([mirror mirrors mirroring])
4835 OVS_VSWITCHD_START
4836 add_of_ports br0 1 2 3
4837 ovs-vsctl \
4838 set Bridge br0 mirrors=@m --\
4839 --id=@p3 get Port p3 --\
4840 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4841
4842 AT_DATA([flows.txt], [dnl
4843 in_port=1 actions=output:2
4844 in_port=2 actions=output:1
4845 ])
4846 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4847
4848 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4849 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4850 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4851 [Datapath actions: trunc(100),3,2
4852 ])
4853
4854 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4855 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4856 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4857 [Datapath actions: trunc(100),3,1
4858 ])
4859
4860 OVS_VSWITCHD_STOP
4861 AT_CLEANUP
4862
4863 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen and reset snaplen])
4864 AT_KEYWORDS([mirror mirrors mirroring])
4865 OVS_VSWITCHD_START
4866 add_of_ports br0 1 2 3
4867 ovs-vsctl \
4868 set Bridge br0 mirrors=@m --\
4869 --id=@p3 get Port p3 --\
4870 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4871
4872 AT_DATA([flows.txt], [dnl
4873 in_port=1 actions=output:2
4874 in_port=2 actions=output:1
4875 ])
4876 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4877
4878 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4879 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4880 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4881 [Datapath actions: trunc(100),3,2
4882 ])
4883
4884 ovs-vsctl set mirror mymirror snaplen=77
4885
4886 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4887 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4888 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4889 [Datapath actions: trunc(77),3,1
4890 ])
4891
4892 ovs-vsctl set mirror mymirror snaplen=65535
4893
4894 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4895 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4896 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4897 [Datapath actions: 3,1
4898 ])
4899
4900 OVS_VSWITCHD_STOP
4901 AT_CLEANUP
4902
4903 AT_SETUP([ofproto-dpif - mirroring, select_src with snaplen])
4904 AT_KEYWORDS([mirror mirrors mirroring])
4905 OVS_VSWITCHD_START
4906 add_of_ports br0 1 2 3
4907 ovs-vsctl \
4908 set Bridge br0 mirrors=@m --\
4909 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4910 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3 snaplen=100
4911
4912 AT_DATA([flows.txt], [dnl
4913 in_port=1 actions=output:2
4914 in_port=2 actions=output:1
4915 ])
4916 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4917
4918 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4919 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4920 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4921 [Datapath actions: trunc(100),3,2
4922 ])
4923
4924 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4925 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4926 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4927 [Datapath actions: 1
4928 ])
4929 OVS_VSWITCHD_STOP
4930 AT_CLEANUP
4931
4932 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port with snaplen])
4933 AT_KEYWORDS([mirror mirrors mirroring])
4934 OVS_VSWITCHD_START
4935 add_of_ports br0 1 2
4936 ovs-vsctl \
4937 set Bridge br0 mirrors=@m --\
4938 --id=@p2 get Port p2 --\
4939 --id=@m create Mirror name=mymirror select_all=true output_port=@p2 snaplen=100
4940
4941 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4942
4943 # "in_port" defaults to OFPP_NONE if it's not specified.
4944 flow="icmp,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_ttl=128,icmp_type=8,icmp_code=0"
4945 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4946 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4947 [Datapath actions: 1,trunc(100),2
4948 ])
4949
4950 OVS_VSWITCHD_STOP
4951 AT_CLEANUP
4952
4953 AT_SETUP([ofproto-dpif - mirroring, select_dst with snaplen])
4954 AT_KEYWORDS([mirror mirrors mirroring])
4955 OVS_VSWITCHD_START
4956 add_of_ports br0 1 2 3
4957 ovs-vsctl \
4958 set Bridge br0 mirrors=@m --\
4959 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4960 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3 snaplen=100
4961
4962 AT_DATA([flows.txt], [dnl
4963 in_port=1 actions=output:2
4964 in_port=2 actions=output:1
4965 ])
4966 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4967
4968 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4969 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4970 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4971 [Datapath actions: 2,trunc(100),3
4972 ])
4973
4974 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4975 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4976 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4977 [Datapath actions: 1
4978 ])
4979
4980 OVS_VSWITCHD_STOP
4981 AT_CLEANUP
4982
4983 AT_SETUP([ofproto-dpif - mirroring, select_vlan with snaplen])
4984 AT_KEYWORDS([mirror mirrors mirroring])
4985 OVS_VSWITCHD_START
4986 add_of_ports br0 1 2 3
4987 ovs-vsctl \
4988 set Bridge br0 mirrors=@m --\
4989 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4990 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3 snaplen=100
4991
4992 AT_DATA([flows.txt], [dnl
4993 in_port=1, actions=output:2
4994 ])
4995 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4996
4997 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4998 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4999 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5000 [Datapath actions: 2
5001 ])
5002
5003 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=10,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))"
5004 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5005 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5006 [Datapath actions: 2
5007 ])
5008
5009 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=11,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))"
5010 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5011 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5012 [Datapath actions: trunc(100),3,2
5013 ])
5014
5015 OVS_VSWITCHD_STOP
5016 AT_CLEANUP
5017
5018 AT_SETUP([ofproto-dpif - mirroring, output_port with snaplen])
5019 AT_KEYWORDS([mirror mirrors mirroring])
5020 OVS_VSWITCHD_START
5021 add_of_ports br0 1 2 3
5022 ovs-vsctl \
5023 set Bridge br0 mirrors=@m --\
5024 --id=@p3 get Port p3 --\
5025 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
5026
5027 AT_DATA([flows.txt], [dnl
5028 in_port=1 actions=mod_vlan_vid:17,output:2
5029 in_port=2 actions=output:1
5030 ])
5031 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5032
5033 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5034 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5035 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5036 [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2
5037 ])
5038
5039 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5040 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5041 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
5042 [Datapath actions: trunc(100),3,1
5043 ])
5044
5045 OVS_VSWITCHD_STOP
5046 AT_CLEANUP
5047
5048 AT_SETUP([ofproto-dpif - mirroring, output_vlan with snaplen])
5049 AT_KEYWORDS([mirror mirrors mirroring])
5050 OVS_VSWITCHD_START
5051 add_of_ports br0 1 2
5052 ovs-vsctl \
5053 set Bridge br0 mirrors=@m --\
5054 --id=@m create Mirror name=mymirror select_all=true output_vlan=12 snaplen=100
5055
5056 AT_DATA([flows.txt], [dnl
5057 in_port=1 actions=output:2
5058 in_port=2 actions=mod_vlan_vid:17,output:1
5059 ])
5060 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5061
5062 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5063 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5064 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5065 dnl Expect: "trunc(100),100,trunc(100),2,trunc(100),1", with different order
5066 AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
5067
5068 flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5069 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
5070 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5071 AT_CHECK([echo "$actual" | sed -n 's/.*\(trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*,trunc([0-9]*),[0-9]*\)/\1/p'], [0])
5072
5073 OVS_VSWITCHD_STOP
5074 AT_CLEANUP
5075
5076 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors with snaplen])
5077 AT_KEYWORDS([mirror mirrors mirroring])
5078 OVS_VSWITCHD_START
5079 add_of_ports br0 1 2 3
5080 ovs-vsctl \
5081 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
5082 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 snaplen=200 \
5083 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 snaplen=300 \
5084 -- set Port br0 tag=0 \
5085 -- set Port p1 tag=0 \
5086 -- set Port p2 tag=500 \
5087 -- set Port p3 tag=501
5088
5089 flow="in_port=1"
5090 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
5091 AT_CHECK([tail -1 stdout | egrep "trunc\(200\),2,trunc\(300\),3,100|trunc\(300\),3,trunc\(200\),2,100"], [0], [stdout])
5092
5093 OVS_VSWITCHD_STOP
5094 AT_CLEANUP
5095
5096 # This test verifies that the table ID is preserved across recirculation
5097 # when a resubmit action requires it (because the action is relative to
5098 # the current table rather than specifying a table).
5099 AT_SETUP([ofproto-dpif - resubmit with recirculation])
5100 OVS_VSWITCHD_START
5101 add_of_ports br0 1 2 3
5102
5103 AT_DATA([flows.txt], [dnl
5104 table=0 in_port=1 actions=2,resubmit(,1)
5105 table=1 in_port=1 actions=debug_recirc,resubmit:55
5106 table=1 in_port=55 actions=3
5107 ])
5108 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5109
5110 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5111 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5112 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
5113 ])
5114 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5115 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
5116 ])
5117
5118 OVS_VSWITCHD_STOP
5119 AT_CLEANUP
5120
5121
5122 # This test verifies that tunnel metadata is preserved across
5123 # recirculation. At the time of recirculation, fields such as "tun_id"
5124 # may be set before the tunnel is "valid" (ie, has a destination
5125 # address), but the field should still be available after recirculation.
5126 AT_SETUP([ofproto-dpif - resubmit with tun_id])
5127 OVS_VSWITCHD_START
5128 add_of_ports br0 1 2 3
5129
5130 AT_DATA([flows.txt], [dnl
5131 table=0 in_port=1 actions=2,load:6->NXM_NX_TUN_ID[[]],resubmit(,1)
5132 table=1 in_port=1 actions=debug_recirc,resubmit:55
5133 table=1 in_port=55 actions=3
5134 ])
5135 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5136
5137 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5138 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5139 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: icmp,tun_id=0x6,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128,icmp_type=8,icmp_code=0
5140 ])
5141
5142 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5143 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: recirc_id=0x1,eth,icmp,tun_id=0x6,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128,icmp_type=8,icmp_code=0
5144 ])
5145
5146 OVS_VSWITCHD_STOP
5147 AT_CLEANUP
5148
5149
5150 # This test verifies that "resubmit", when it triggers recirculation
5151 # indirectly through the flow that it recursively invokes, is not
5152 # re-executed when execution continues later post-recirculation.
5153 AT_SETUP([ofproto-dpif - recirculation after resubmit])
5154 OVS_VSWITCHD_START
5155 add_of_ports br0 1 2
5156
5157 AT_DATA([flows.txt], [dnl
5158 table=0 in_port=1 actions=resubmit(,1),2
5159 table=1 in_port=1 actions=debug_recirc
5160 ])
5161 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5162
5163 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5164 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5165 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
5166 ])
5167 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
5168 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
5169 ])
5170
5171 OVS_VSWITCHD_STOP
5172 AT_CLEANUP
5173
5174
5175 AT_SETUP([ofproto-dpif - debug_slow action])
5176 OVS_VSWITCHD_START
5177 add_of_ports br0 1 2 3
5178
5179 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1,actions=debug_slow,2"])
5180
5181 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5182
5183 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
5184 AT_CHECK_UNQUOTED([tail -3 stdout], [0], [Datapath actions: 2
5185 This flow is handled by the userspace slow path because it:
5186 - Uses action(s) not supported by datapath.
5187 ])
5188
5189 OVS_VSWITCHD_STOP
5190 AT_CLEANUP
5191
5192
5193 dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
5194 dnl
5195 dnl Checks the implementation of the continuation mechanism that allows the
5196 dnl packet processing pipeline to be paused and resumed. Starts by creating
5197 dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
5198 dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
5199 dnl in the bridge, resuming each time the pipeline pauses, and expects a single
5200 dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
5201 dnl ACTIONS0 still contains at least one "pause" action, removes one of them
5202 dnl and repeats the process.
5203 dnl
5204 dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
5205 dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
5206 dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
5207 dnl into port 1 on br0, so br1 only comes into action if a patch port (added
5208 dnl by EXTRA_SETUP) jumps from one bridge to another.
5209 dnl
5210 dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
5211 dnl both bridges, e.g. to configure mirrors or patch ports.
5212 m4_define([CHECK_CONTINUATION], [dnl
5213 AT_SETUP([ofproto-dpif - continuation - $1])
5214 AT_KEYWORDS([continuations pause resume])
5215 OVS_VSWITCHD_START
5216
5217 # count_matches STRING
5218 #
5219 # Prints on stdout the number of occurrences of STRING in stdin.
5220 count_matches () {
5221 sed -n ":start
5222 s/$[1]//p
5223 t start" | wc -l
5224 }
5225
5226 add_of_ports --pcap br0 `seq 1 $2`
5227 m4_if([$3], [0], [],
5228 [add_of_br 1
5229 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
5230
5231 AT_CAPTURE_FILE([ofctl_monitor0.log])
5232 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
5233 m4_if([$3], [0], [],
5234 [AT_CAPTURE_FILE([ofctl_monitor1.log])
5235 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
5236
5237 actions0='$4'
5238 actions1='$5'
5239 $6
5240 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5241 n_packets=0
5242 n_resumes=0
5243 while true; do
5244 printf "\n\nactions for br0:\n%s\n" "$actions0"
5245 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
5246
5247 # Add flows.
5248 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
5249 m4_if([$3], [0], [],
5250 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
5251
5252 # Make sure the datapath is up-to-date before sending the packet.
5253 ovs-appctl revalidator/wait
5254
5255 # Run a packet through the switch.
5256 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5257
5258 # Wait for the expected number of packets to show up.
5259 n_packets=`expr $n_packets + $2 - 1 + $3`
5260 echo "waiting for $n_packets packets..."
5261 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
5262
5263 # Wait for the expected number of NXT_RESUMEs to be logged.
5264 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
5265 echo "waiting for $n_resumes NXT_RESUMEs..."
5266 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
5267
5268 # Eliminate one "pause" from the actions.
5269 #
5270 # If there were none left, then we're done.
5271 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
5272 if test X"$actions0" = X"$next_actions0"; then
5273 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
5274 if test X"$actions1" = X"$next_actions1"; then
5275 break
5276 else
5277 actions1=$next_actions1
5278 fi
5279 else
5280 actions0=$next_actions0
5281 fi
5282
5283 # Delete all the flows and verify that there are none, so that we
5284 # can be sure that our updated flow tables is actually in use
5285 # later.
5286 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
5287 [NXST_FLOW reply:
5288 ])
5289 m4_if([$3], [0], [],
5290 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
5291 [NXST_FLOW reply:
5292 ])])
5293 done
5294 OVS_VSWITCHD_STOP
5295 AT_CLEANUP
5296 ])
5297
5298 # Check that pause at the end of the pipeline works OK.
5299 #
5300 # (xlate_continuation() has a special case for no-op actions; this
5301 # fails without that special case.)
5302 CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
5303
5304 # Check that remaining actions are preserved following resume.
5305 CHECK_CONTINUATION([actions], [7], [0],
5306 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
5307
5308 # Check that multiple levels of resubmit continue following resume.
5309 #
5310 # The "resubmit:55", which is relative to the current table, is
5311 # particularly interesting because it checks that the notion of the
5312 # current table is correctly preserved.
5313 CHECK_CONTINUATION([resubmit], [10], [0],
5314 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
5315 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
5316 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
5317 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
5318 table=3 in_port=55 actions=pause 6 pause])
5319
5320 # Check that the action set is preserved across pause/resume.
5321 CHECK_CONTINUATION([action set], [3], [0],
5322 [in_port=1 actions=1 pause resubmit(,1) pause 2
5323 table=1 actions=write_actions(3)])
5324
5325 # Check that metadata and the stack used by push and pop is preserved
5326 # across pause/resume.
5327 CHECK_CONTINUATION([data stack], [3], [0],
5328 [in_port=1 actions=pause dnl
5329 set_field:1->reg0 dnl
5330 pause dnl
5331 set_field:2->reg1 dnl
5332 pause dnl
5333 output:NXM_NX_REG0[[]] dnl
5334 pause dnl
5335 push:NXM_NX_REG1[[]] dnl
5336 dnl
5337 pop:NXM_NX_REG2[[]] dnl
5338 pause dnl
5339 output:NXM_NX_REG2[[]] dnl
5340 pause dnl
5341 3])
5342
5343 # Check that mirror output occurs once and once only, even if
5344 # separated by pause/resume.
5345 CHECK_CONTINUATION([mirroring], [5], [0],
5346 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
5347 [ovs-vsctl \
5348 set Bridge br0 mirrors=@m --\
5349 --id=@p2 get Port p2 --\
5350 --id=@p3 get Port p3 --\
5351 --id=@p4 get Port p4 --\
5352 --id=@p5 get Port p5 --\
5353 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
5354
5355 # Check that pause works in the presence of patch ports.
5356 CHECK_CONTINUATION([patch ports], [4], [1],
5357 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
5358 table=1 in_port=1 actions=pause 3 pause 10 pause],
5359 [table=0 in_port=11 actions=pause 5 pause],
5360 [ovs-vsctl \
5361 -- add-port br0 patch10 \
5362 -- set interface patch10 type=patch options:peer=patch11 \
5363 ofport_request=10 \
5364 -- add-port br1 patch11 \
5365 -- set interface patch11 type=patch options:peer=patch10 \
5366 ofport_request=11])
5367
5368 AT_SETUP([ofproto-dpif - continuation flow stats])
5369 AT_KEYWORDS([continuations pause resume])
5370 OVS_VSWITCHD_START
5371
5372 add_of_ports --pcap br0 `seq 1 2`
5373
5374 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5375
5376 AT_DATA([flows.txt], [dnl
5377 table=0 in_port=1 actions=set_field:1->reg1 controller(pause) resubmit(,2)
5378 table=2 reg1=0x1 actions=2
5379 ])
5380
5381 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5382
5383 AT_CAPTURE_FILE([ofctl_monitor0.log])
5384 ovs-ofctl monitor br0 resume --detach --no-chdir \
5385 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5386
5387 # Run a packet through the switch.
5388 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5389
5390 # Check flow stats
5391 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5392 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sed -n 's/idle_age=[[0-9]]*/idle_age=0/p' | grep 'table=2'], [0], [dnl
5393 cookie=0x0, duration=0.0s, table=2, n_packets=1, n_bytes=106, idle_age=0, reg1=0x1 actions=output:2
5394 ])
5395
5396 # The packet should be received by port 2
5397 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5398
5399 OVS_VSWITCHD_STOP
5400 AT_CLEANUP
5401
5402 AT_SETUP([ofproto-dpif - continuation with conntrack])
5403 AT_KEYWORDS([continuations pause resume])
5404 OVS_VSWITCHD_START
5405
5406 add_of_ports --pcap br0 `seq 1 2`
5407
5408 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
5409
5410 AT_DATA([flows.txt], [dnl
5411 table=0, in_port=1 icmp action=ct(table=1)
5412 table=1, icmp action=controller(pause) resubmit(,2)
5413 table=2, in_port=1 icmp ct_state=+trk+new action=output:2
5414 ])
5415
5416 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5417
5418 AT_CAPTURE_FILE([ofctl_monitor0.log])
5419 ovs-ofctl monitor br0 resume --detach --no-chdir \
5420 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5421
5422 # Run a packet through the switch.
5423 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5424
5425 # Check flow stats
5426 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5427 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sed -n 's/idle_age=[[0-9]]*/idle_age=0/p' | grep 'table=2'], [0], [dnl
5428 cookie=0x0, duration=0.0s, table=2, n_packets=1, n_bytes=106, idle_age=0, ct_state=+new+trk,icmp,in_port=1 actions=output:2
5429 ])
5430
5431 # The packet should be received by port 2
5432 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5433
5434 OVS_VSWITCHD_STOP
5435 AT_CLEANUP
5436
5437 AT_SETUP([ofproto-dpif - continuation with patch port])
5438 AT_KEYWORDS([continuations pause resume])
5439 OVS_VSWITCHD_START(
5440 [add-port br0 p0 -- set Interface p0 type=dummy -- \
5441 add-port br0 patch- -- \
5442 set interface patch- type=patch options:peer=patch+ -- \
5443 add-br br1 -- set bridge br1 datapath-type=dummy fail-mode=secure -- \
5444 add-port br1 patch+ -- set interface patch+ type=patch options:peer=patch-
5445 ])
5446 add_of_ports --pcap br1 1
5447
5448 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)"
5449
5450 AT_DATA([flows.txt], [dnl
5451 table=0, in_port=patch+ icmp action=controller(pause), resubmit(,1)
5452 table=1, in_port=patch+ icmp action=ct(table=2)
5453 table=2, in_port=patch+ icmp ct_state=+trk+new action=ct(commit, table=3)
5454 table=3, in_port=patch+ icmp action=p1
5455 ])
5456
5457 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5458 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br1 flows.txt])
5459
5460 AT_CAPTURE_FILE([ofctl_monitor.log])
5461 ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl.pid 2> ofctl_monitor.log
5462
5463 # Run a packet through the switch.
5464 AT_CHECK([ovs-appctl netdev-dummy/receive p0 "$flow"], [0], [stdout])
5465
5466 # Check flow stats
5467 AT_CHECK([ovs-ofctl dump-flows br1], [0], [stdout])
5468 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
5469 cookie=0x0, duration=0.0s, table=3, n_packets=1, n_bytes=106, idle_age=0, icmp,in_port=1 actions=output:2
5470 ])
5471
5472 # The packet should be received by port 1
5473 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p1-tx.pcap | wc -l`])
5474
5475 OVS_VSWITCHD_STOP
5476 AT_CLEANUP
5477
5478 # Check that pause works after the packet is cloned.
5479 AT_SETUP([ofproto-dpif - continuation after clone])
5480 AT_KEYWORDS([continuations clone pause resume])
5481 OVS_VSWITCHD_START
5482
5483 add_of_ports --pcap br0 `seq 1 3`
5484
5485 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)"
5486
5487 AT_DATA([flows.txt], [dnl
5488 table=0 in_port=1 actions=set_field:1->reg1 resubmit(,2)
5489 table=1 reg1=0x5 actions=controller(pause) resubmit(,3)
5490 table=1 reg1=0x1 actions=2
5491 table=2 in_port=1 actions=clone(set_field:5->reg1, resubmit(,1))
5492 table=3 reg1=0x1 actions=3
5493 table=3 reg1=0x5 actions=2
5494 ])
5495
5496 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5497
5498 AT_CAPTURE_FILE([ofctl_monitor0.log])
5499 ovs-ofctl monitor br0 resume --detach --no-chdir \
5500 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5501
5502 # Run a packet through the switch.
5503 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5504
5505 ovs-vsctl show
5506 ovs-ofctl dump-flows br0
5507
5508 # The packet should be received by port 2 and not port 3
5509 AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5510 AT_CHECK([test 0 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p3-tx.pcap | wc -l`])
5511
5512 # NXT_RESUMEs should be 1 and reg1 should be set to 0x5.
5513 OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor*.log | grep NXT_RESUME | grep -c reg1=0x5`])
5514
5515 OVS_VSWITCHD_STOP
5516 AT_CLEANUP
5517
5518 # Two testcases below are for the ofproto/trace command
5519 # The first one tests all correct syntax:
5520 # ofproto/trace [dp_name] odp_flow [-generate|packet]
5521 # ofproto/trace br_name br_flow [-generate|packet]
5522 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
5523 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5524 add_of_ports br0 1 2 3
5525
5526 AT_DATA([flows.txt], [dnl
5527 in_port=1 actions=output:2
5528 in_port=2 actions=output:1
5529 ])
5530 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5531
5532 odp_flow="in_port(p1)"
5533 br_flow="in_port=1"
5534 # Test command: ofproto/trace odp_flow with in_port as a name.
5535 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5536 AT_CHECK([tail -1 stdout], [0], [dnl
5537 Datapath actions: 2
5538 ])
5539
5540 odp_flow="in_port(1)"
5541 # Test command: ofproto/trace odp_flow
5542 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5543 AT_CHECK([tail -1 stdout], [0], [dnl
5544 Datapath actions: 2
5545 ])
5546
5547 # Test command: ofproto/trace dp_name odp_flow
5548 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
5549 AT_CHECK([tail -1 stdout], [0], [dnl
5550 Datapath actions: 2
5551 ])
5552 # Test commmand: ofproto/trace br_name br_flow
5553 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5554 AT_CHECK([tail -1 stdout], [0], [dnl
5555 Datapath actions: 2
5556 ])
5557
5558 # Delete the inserted flows
5559 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
5560 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
5561
5562 # This section below tests the [-generate] option
5563 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
5564 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"
5565
5566 # Test command: ofproto/trace odp_flow
5567 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5568 # Check for no MAC learning entry
5569 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5570 port VLAN MAC Age
5571 ])
5572
5573 # Test command: ofproto/trace br_name br_flow
5574 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5575 # Check for no MAC learning entry
5576 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5577 port VLAN MAC Age
5578 ])
5579
5580 # Test command: ofproto/trace odp_flow -generate
5581 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
5582 # Check for the MAC learning entry
5583 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5584 port VLAN MAC Age
5585 3 0 50:54:00:00:00:05 ?
5586 ])
5587
5588 # Test command: ofproto/trace dp_name odp_flow -generate
5589 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5590 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
5591 -generate], [0], [stdout])
5592 # Check for both MAC learning entries
5593 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5594 port VLAN MAC Age
5595 3 0 50:54:00:00:00:05 ?
5596 1 0 50:54:00:00:00:06 ?
5597 ])
5598
5599 # Test command: ofproto/trace br_name br_flow -generate
5600 AT_CHECK([ovs-appctl ofproto/trace br0 \
5601 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
5602 -generate], [0], [stdout])
5603 # Check for both MAC learning entries.
5604 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5605 port VLAN MAC Age
5606 3 0 50:54:00:00:00:05 ?
5607 1 0 50:54:00:00:00:06 ?
5608 2 0 50:54:00:00:00:07 ?
5609 ])
5610
5611 # This section beflow tests the [packet] option
5612 # The ovs-tcpundump of packets between port1 and port2
5613 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5614 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
5615
5616 # Construct the MAC learning table
5617 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5618 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
5619 -generate], [0], [stdout])
5620
5621 # Construct the MAC learning table
5622 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5623 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
5624 -generate], [0], [stdout])
5625
5626 # Test command: ofproto/trace odp_flow packet
5627 AT_CHECK([ovs-appctl ofproto/trace \
5628 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5629 AT_CHECK([tail -1 stdout], [0], [dnl
5630 Datapath actions: 2
5631 ])
5632 AT_CHECK([head -n 3 stdout], [0], [dnl
5633 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
5634
5635 bridge("br0")
5636 ])
5637
5638 # Test command: ofproto/trace dp_name odp_flow packet
5639 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5640 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5641 AT_CHECK([tail -1 stdout], [0], [dnl
5642 Datapath actions: 2
5643 ])
5644 AT_CHECK([head -n 3 stdout], [0], [dnl
5645 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
5646
5647 bridge("br0")
5648 ])
5649
5650 # Test command: ofproto/trace br_name br_flow packet
5651 AT_CHECK([ovs-appctl ofproto/trace br0 \
5652 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
5653 AT_CHECK([tail -1 stdout], [0], [dnl
5654 Datapath actions: 1
5655 ])
5656 AT_CHECK([head -n 3 stdout], [0], [dnl
5657 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
5658
5659 bridge("br0")
5660 ])
5661
5662 OVS_VSWITCHD_STOP
5663 AT_CLEANUP
5664
5665 # The second test tests the corner cases
5666 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
5667 OVS_VSWITCHD_START
5668 add_of_ports br0 1 2
5669
5670 # Define flows
5671 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
5672 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
5673 # Define options
5674 generate="-generate"
5675 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5676
5677 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
5678 m4_foreach(
5679 [option],
5680 [[],
5681 ["$generate"],
5682 ["$pkt"]],
5683 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
5684 [2], [], [stderr])
5685 AT_CHECK([tail -2 stderr], [0], [dnl
5686 Cannot find the datapath
5687 ovs-appctl: ovs-vswitchd: server returned an error
5688 ])])
5689
5690 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
5691 m4_foreach(
5692 [option],
5693 [[],
5694 ["$generate"],
5695 ["$pkt"]],
5696 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
5697 [2], [], [stderr])
5698 AT_CHECK([tail -2 stderr], [0], [dnl
5699 Cannot find the datapath
5700 ovs-appctl: ovs-vswitchd: server returned an error
5701 ])])
5702
5703 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
5704 m4_foreach(
5705 [option],
5706 [[],
5707 ["$generate"],
5708 ["$pkt"]],
5709 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
5710 [2], [], [stderr])
5711 AT_CHECK([tail -2 stderr], [0], [dnl
5712 Cannot find the datapath
5713 ovs-appctl: ovs-vswitchd: server returned an error
5714 ])])
5715
5716 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
5717 m4_foreach(
5718 [option],
5719 [[],
5720 ["$generate"],
5721 ["$pkt"]],
5722 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
5723 [2], [], [stderr])
5724 AT_CHECK([tail -2 stderr], [0], [dnl
5725 Cannot find the datapath
5726 ovs-appctl: ovs-vswitchd: server returned an error
5727 ])])
5728
5729 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
5730 m4_foreach(
5731 [option],
5732 [[],
5733 ["$generate"],
5734 ["$pkt"]],
5735 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
5736 [2], [], [stderr])
5737 AT_CHECK([tail -2 stderr], [0], [dnl
5738 ovs-dummy: unknown bridge
5739 ovs-appctl: ovs-vswitchd: server returned an error
5740 ])])
5741
5742 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
5743 m4_foreach(
5744 [option],
5745 [[],
5746 ["$generate"],
5747 ["$pkt"]],
5748 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
5749 [2], [], [stderr])
5750 AT_CHECK([tail -2 stderr], [0], [dnl
5751 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)
5752 ovs-appctl: ovs-vswitchd: server returned an error
5753 ])])
5754
5755 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
5756 AT_CHECK([ovs-appctl ofproto/trace \
5757 ovs-dummy "$odp_flow" garbage_option],
5758 [2], [stdout],[stderr])
5759 AT_CHECK([tail -2 stderr], [0], [dnl
5760 Trailing garbage in packet data
5761 ovs-appctl: ovs-vswitchd: server returned an error
5762 ])
5763
5764 # Test incorrect command: ofproto/trace with 0 argument
5765 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
5766 AT_CHECK([tail -2 stderr], [0], [dnl
5767 "ofproto/trace" command requires at least 1 arguments
5768 ovs-appctl: ovs-vswitchd: server returned an error
5769 ])
5770
5771 OVS_VSWITCHD_STOP
5772 AT_CLEANUP
5773
5774 # The third test checks that the output of "ovs-dpctl -m" is valid to trace.
5775 AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
5776 OVS_VSWITCHD_START([dnl
5777 set Open_vSwitch . other_config:max-idle=10000 \
5778 -- add-port br0 p1 -- set Interface p1 type=dummy])
5779
5780 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)'])
5781 ovs-appctl revalidator/wait
5782 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
5783
5784 odp_flow=`cat dp_flows1.txt`
5785 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5786 Flow: <cleared>
5787
5788 bridge("br0")
5789 -------------
5790 0. No match.
5791 drop
5792
5793 Final flow: <cleared>
5794 Megaflow: <cleared>
5795 Datapath actions: drop
5796 ])
5797
5798 dnl Now, try again without megaflows:
5799 ovs-appctl upcall/disable-megaflows
5800
5801 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)'])
5802 ovs-appctl revalidator/wait
5803 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
5804
5805 odp_flow=`cat dp_flows2.txt`
5806 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5807 Flow: <cleared>
5808
5809 bridge("br0")
5810 -------------
5811 0. No match.
5812 drop
5813
5814 Final flow: <cleared>
5815 Megaflow: <cleared>
5816 Datapath actions: drop
5817 ])
5818
5819 OVS_VSWITCHD_STOP
5820 AT_CLEANUP
5821
5822 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
5823 OVS_VSWITCHD_START
5824 add_of_ports br0 1 2 3
5825
5826 AT_DATA([flows.txt], [dnl
5827 in_port=1 actions=output:2
5828 in_port=2 actions=output:1
5829 ])
5830 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5831
5832 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
5833 AT_CHECK([tail -1 stdout], [0], [dnl
5834 Datapath actions: push_vlan(vid=123,pcp=0),2
5835 ])
5836
5837 OVS_VSWITCHD_STOP
5838 AT_CLEANUP
5839
5840
5841 m4_define([OFPROTO_TRACE],
5842 [flow="$2"
5843 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
5844 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5845 expected="$4"
5846 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
5847 [0], [stdout])
5848 mv stdout expout
5849 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
5850 [0], [expout])])
5851
5852 AT_SETUP([ofproto-dpif - MAC learning])
5853 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5854 add_of_ports br0 1 2 3
5855
5856 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)'
5857
5858 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
5859 OFPROTO_TRACE(
5860 [ovs-dummy],
5861 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5862 [-generate],
5863 [1,2,100])
5864
5865 # Check for the MAC learning entry.
5866 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5867 port VLAN MAC Age
5868 3 0 50:54:00:00:00:05 ?
5869 ])
5870
5871 # Trace a packet arrival destined for the learned MAC.
5872 # (This will also learn a MAC.)
5873 OFPROTO_TRACE(
5874 [ovs-dummy],
5875 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
5876 [-generate],
5877 [3])
5878
5879 # Check for both MAC learning entries.
5880 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5881 port VLAN MAC Age
5882 3 0 50:54:00:00:00:05 ?
5883 1 0 50:54:00:00:00:06 ?
5884 ])
5885
5886 # Trace a packet arrival that updates the first learned MAC entry.
5887 OFPROTO_TRACE(
5888 [ovs-dummy],
5889 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5890 [-generate],
5891 [1,3,100])
5892
5893 # Check that the MAC learning entry was updated.
5894 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5895 port VLAN MAC Age
5896 1 0 50:54:00:00:00:06 ?
5897 2 0 50:54:00:00:00:05 ?
5898 ])
5899
5900 # Add another bridge.
5901 AT_CHECK(
5902 [ovs-vsctl \
5903 -- add-br br1 \
5904 -- set bridge br1 datapath-type=dummy])
5905 add_of_ports br1 4 5
5906
5907 # Trace some packet arrivals in br1 to create MAC learning entries there too.
5908 OFPROTO_TRACE(
5909 [ovs-dummy],
5910 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
5911 [-generate],
5912 [5,101])
5913 OFPROTO_TRACE(
5914 [ovs-dummy],
5915 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
5916 [-generate],
5917 [4,101])
5918
5919 # Check that the MAC learning entries were added.
5920 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5921 port VLAN MAC Age
5922 4 0 50:54:00:00:00:06 ?
5923 5 0 50:54:00:00:00:07 ?
5924 ])
5925
5926 # Delete port p1 and see that its MAC learning entry disappeared, and
5927 # that the MAC learning entry for the same MAC was also deleted from br1.
5928 AT_CHECK([ovs-vsctl del-port p1])
5929 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5930 port VLAN MAC Age
5931 2 0 50:54:00:00:00:05 ?
5932 ])
5933 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5934 port VLAN MAC Age
5935 5 0 50:54:00:00:00:07 ?
5936 ])
5937
5938 OVS_VSWITCHD_STOP
5939 AT_CLEANUP
5940
5941 AT_SETUP([ofproto-dpif - MAC table overflow])
5942 OVS_VSWITCHD_START(
5943 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
5944 add_of_ports br0 1 2 3
5945
5946 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)'
5947
5948 AT_CHECK([ovs-appctl time/stop])
5949
5950 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
5951 for i in 0 1 2 3 4 5 6 7 8 9; do
5952 OFPROTO_TRACE(
5953 [ovs-dummy],
5954 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
5955 [-generate],
5956 [1,2,100])
5957 ovs-appctl time/warp 1000
5958 done
5959
5960 # Check for the MAC learning entries.
5961 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5962 [0], [dnl
5963 3 0 50:54:00:00:00:00
5964 3 0 50:54:00:00:00:01
5965 3 0 50:54:00:00:00:02
5966 3 0 50:54:00:00:00:03
5967 3 0 50:54:00:00:00:04
5968 3 0 50:54:00:00:00:05
5969 3 0 50:54:00:00:00:06
5970 3 0 50:54:00:00:00:07
5971 3 0 50:54:00:00:00:08
5972 3 0 50:54:00:00:00:09
5973 port VLAN MAC Age
5974 ])
5975
5976 # Trace another ARP packet on another MAC.
5977 OFPROTO_TRACE(
5978 [ovs-dummy],
5979 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
5980 [-generate],
5981 [1,2,100])
5982
5983 # Check that the new one chased the oldest one out of the table.
5984 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
5985 [0], [dnl
5986 3 0 50:54:00:00:00:01 ?
5987 3 0 50:54:00:00:00:02 ?
5988 3 0 50:54:00:00:00:03 ?
5989 3 0 50:54:00:00:00:04 ?
5990 3 0 50:54:00:00:00:05 ?
5991 3 0 50:54:00:00:00:06 ?
5992 3 0 50:54:00:00:00:07 ?
5993 3 0 50:54:00:00:00:08 ?
5994 3 0 50:54:00:00:00:09 ?
5995 3 0 50:54:00:00:00:10 ?
5996 port VLAN MAC Age
5997 ])
5998 OVS_VSWITCHD_STOP
5999 AT_CLEANUP
6000
6001 AT_SETUP([ofproto-dpif - MAC table overflow fairness])
6002 OVS_VSWITCHD_START(
6003 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
6004 add_of_ports br0 1 2 3 4 5 6
6005
6006 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)'
6007
6008 AT_CHECK([ovs-appctl time/stop])
6009
6010 # Trace packets with 2 different source MACs arriving on each of the 5
6011 # ports, filling up the 10-entry learning table.
6012 for i in 0 1 2 3 4 5 6 7 8 9; do
6013 p=`expr $i / 2 + 1`
6014 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
6015 ovs-appctl time/warp 1000
6016 done
6017
6018 # Check for the MAC learning entries.
6019 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
6020 [0], [dnl
6021 1 0 50:54:00:00:00:00
6022 1 0 50:54:00:00:00:01
6023 2 0 50:54:00:00:00:02
6024 2 0 50:54:00:00:00:03
6025 3 0 50:54:00:00:00:04
6026 3 0 50:54:00:00:00:05
6027 4 0 50:54:00:00:00:06
6028 4 0 50:54:00:00:00:07
6029 5 0 50:54:00:00:00:08
6030 5 0 50:54:00:00:00:09
6031 port VLAN MAC Age
6032 ])
6033
6034 # Now trace 16 new MACs on another port.
6035 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
6036 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
6037 ovs-appctl time/warp 1000
6038 done
6039
6040 # Check the results.
6041 #
6042 # Our eviction algorithm on overflow is that an arbitrary (but deterministic)
6043 # one of the ports with the most learned MACs loses the least recently used
6044 # one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
6045 # MAC each, and the other 2 of the old ports with 2 MACs each.
6046 #
6047 # (If someone changes lib/heap.c to do something different with equal-priority
6048 # nodes, then the output below could change, but it would still follow the
6049 # rules explained above.)
6050 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
6051 [0], [dnl
6052 1 0 50:54:00:00:00:01
6053 2 0 50:54:00:00:00:03
6054 3 0 50:54:00:00:00:04
6055 3 0 50:54:00:00:00:05
6056 4 0 50:54:00:00:00:07
6057 5 0 50:54:00:00:00:08
6058 5 0 50:54:00:00:00:09
6059 6 0 50:54:00:00:0d:ff
6060 6 0 50:54:00:00:0e:ff
6061 6 0 50:54:00:00:0f:ff
6062 port VLAN MAC Age
6063 ])
6064 OVS_VSWITCHD_STOP
6065 AT_CLEANUP
6066
6067 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
6068 #
6069 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
6070 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
6071 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6072 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6073
6074 on_exit 'kill `cat test-sflow.pid`'
6075 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
6076 AT_CAPTURE_FILE([sflow.log])
6077 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6078 ovs-appctl time/stop
6079
6080 add_of_ports br0 1 2
6081 ovs-vsctl \
6082 set Interface br0 options:ifindex=1002 -- \
6083 set Interface p1 options:ifindex=1004 -- \
6084 set Interface p2 options:ifindex=1003 -- \
6085 set Bridge br0 sflow=@sf -- \
6086 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
6087 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
6088
6089 dnl open with ARP packets to seed the bridge-learning. The output
6090 dnl ifIndex numbers should be reported predictably after that.
6091 dnl Since we set sampling=1 we should see all of these packets
6092 dnl reported. Sorting the output by data-source and seqNo makes
6093 dnl it deterministic. Ensuring that we send at least two packets
6094 dnl into each port means we get to check the seq nos are
6095 dnl incrementing correctly.
6096 dnl because packets from different ports can be handled by separate
6097 dnl threads, put some sleeps
6098
6099 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)'
6100 sleep 1
6101 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)'
6102 sleep 1
6103 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)'
6104 sleep 1
6105 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)'
6106 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)'
6107
6108 dnl sleep long enough to get more than one counter sample
6109 dnl from each datasource so we can check sequence numbers
6110 ovs-appctl time/warp 2000 100
6111 OVS_VSWITCHD_STOP
6112 OVS_APP_EXIT_AND_WAIT([test-sflow])
6113
6114 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6115 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
6116 HEADER
6117 dgramSeqNo=1
6118 ds=127.0.0.1>2:1000
6119 fsSeqNo=1
6120 in_vlan=0
6121 in_priority=0
6122 out_vlan=0
6123 out_priority=0
6124 meanSkip=1
6125 samplePool=1
6126 dropEvents=0
6127 in_ifindex=1004
6128 in_format=0
6129 out_ifindex=2
6130 out_format=2
6131 hdr_prot=1
6132 pkt_len=46
6133 stripped=4
6134 hdr_len=42
6135 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
6136 HEADER
6137 dgramSeqNo=1
6138 ds=127.0.0.1>2:1000
6139 fsSeqNo=2
6140 in_vlan=0
6141 in_priority=0
6142 out_vlan=0
6143 out_priority=0
6144 meanSkip=1
6145 samplePool=2
6146 dropEvents=0
6147 in_ifindex=1003
6148 in_format=0
6149 out_ifindex=2
6150 out_format=2
6151 hdr_prot=1
6152 pkt_len=46
6153 stripped=4
6154 hdr_len=42
6155 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
6156 HEADER
6157 dgramSeqNo=1
6158 ds=127.0.0.1>2:1000
6159 fsSeqNo=3
6160 in_vlan=0
6161 in_priority=0
6162 out_vlan=0
6163 out_priority=0
6164 meanSkip=1
6165 samplePool=3
6166 dropEvents=0
6167 in_ifindex=1004
6168 in_format=0
6169 out_ifindex=1003
6170 out_format=0
6171 hdr_prot=1
6172 pkt_len=110
6173 stripped=4
6174 hdr_len=106
6175 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
6176 HEADER
6177 dgramSeqNo=1
6178 ds=127.0.0.1>2:1000
6179 fsSeqNo=4
6180 in_vlan=0
6181 in_priority=0
6182 out_vlan=0
6183 out_priority=0
6184 meanSkip=1
6185 samplePool=4
6186 dropEvents=0
6187 in_ifindex=1003
6188 in_format=0
6189 out_ifindex=1004
6190 out_format=0
6191 hdr_prot=1
6192 pkt_len=110
6193 stripped=4
6194 hdr_len=106
6195 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
6196 HEADER
6197 dgramSeqNo=1
6198 ds=127.0.0.1>2:1000
6199 fsSeqNo=5
6200 in_vlan=0
6201 in_priority=0
6202 out_vlan=0
6203 out_priority=0
6204 meanSkip=1
6205 samplePool=5
6206 dropEvents=0
6207 in_ifindex=1003
6208 in_format=0
6209 out_ifindex=1004
6210 out_format=0
6211 hdr_prot=1
6212 pkt_len=58
6213 stripped=4
6214 hdr_len=54
6215 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
6216 ])
6217
6218 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'ETHCOUNTERS|IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -24 | sed 's/ /\
6219 /g' | sed 's/\(.*\)ds=\[::1\]\(.*\)/\1ds=127.0.0.1\2/g' ]], [0], [dnl
6220 ETHCOUNTERS
6221 dot3StatsAlignmentErrors=4294967295
6222 dot3StatsFCSErrors=4294967295
6223 dot3StatsSingleCollisionFrames=4294967295
6224 dot3StatsMultipleCollisionFrames=4294967295
6225 dot3StatsSQETestErrors=4294967295
6226 dot3StatsDeferredTransmissions=4294967295
6227 dot3StatsLateCollisions=4294967295
6228 dot3StatsExcessiveCollisions=4294967295
6229 dot3StatsInternalMacTransmitErrors=4294967295
6230 dot3StatsCarrierSenseErrors=4294967295
6231 dot3StatsFrameTooLongs=4294967295
6232 dot3StatsInternalMacReceiveErrors=4294967295
6233 dot3StatsSymbolErrors=4294967295
6234 ETHCOUNTERS
6235 dot3StatsAlignmentErrors=4294967295
6236 dot3StatsFCSErrors=4294967295
6237 dot3StatsSingleCollisionFrames=4294967295
6238 dot3StatsMultipleCollisionFrames=4294967295
6239 dot3StatsSQETestErrors=4294967295
6240 dot3StatsDeferredTransmissions=4294967295
6241 dot3StatsLateCollisions=4294967295
6242 dot3StatsExcessiveCollisions=4294967295
6243 dot3StatsInternalMacTransmitErrors=4294967295
6244 dot3StatsCarrierSenseErrors=4294967295
6245 dot3StatsFrameTooLongs=4294967295
6246 dot3StatsInternalMacReceiveErrors=4294967295
6247 dot3StatsSymbolErrors=4294967295
6248 ETHCOUNTERS
6249 dot3StatsAlignmentErrors=4294967295
6250 dot3StatsFCSErrors=4294967295
6251 dot3StatsSingleCollisionFrames=4294967295
6252 dot3StatsMultipleCollisionFrames=4294967295
6253 dot3StatsSQETestErrors=4294967295
6254 dot3StatsDeferredTransmissions=4294967295
6255 dot3StatsLateCollisions=4294967295
6256 dot3StatsExcessiveCollisions=4294967295
6257 dot3StatsInternalMacTransmitErrors=4294967295
6258 dot3StatsCarrierSenseErrors=4294967295
6259 dot3StatsFrameTooLongs=4294967295
6260 dot3StatsInternalMacReceiveErrors=4294967295
6261 dot3StatsSymbolErrors=4294967295
6262 ETHCOUNTERS
6263 dot3StatsAlignmentErrors=4294967295
6264 dot3StatsFCSErrors=4294967295
6265 dot3StatsSingleCollisionFrames=4294967295
6266 dot3StatsMultipleCollisionFrames=4294967295
6267 dot3StatsSQETestErrors=4294967295
6268 dot3StatsDeferredTransmissions=4294967295
6269 dot3StatsLateCollisions=4294967295
6270 dot3StatsExcessiveCollisions=4294967295
6271 dot3StatsInternalMacTransmitErrors=4294967295
6272 dot3StatsCarrierSenseErrors=4294967295
6273 dot3StatsFrameTooLongs=4294967295
6274 dot3StatsInternalMacReceiveErrors=4294967295
6275 dot3StatsSymbolErrors=4294967295
6276 ETHCOUNTERS
6277 dot3StatsAlignmentErrors=4294967295
6278 dot3StatsFCSErrors=4294967295
6279 dot3StatsSingleCollisionFrames=4294967295
6280 dot3StatsMultipleCollisionFrames=4294967295
6281 dot3StatsSQETestErrors=4294967295
6282 dot3StatsDeferredTransmissions=4294967295
6283 dot3StatsLateCollisions=4294967295
6284 dot3StatsExcessiveCollisions=4294967295
6285 dot3StatsInternalMacTransmitErrors=4294967295
6286 dot3StatsCarrierSenseErrors=4294967295
6287 dot3StatsFrameTooLongs=4294967295
6288 dot3StatsInternalMacReceiveErrors=4294967295
6289 dot3StatsSymbolErrors=4294967295
6290 ETHCOUNTERS
6291 dot3StatsAlignmentErrors=4294967295
6292 dot3StatsFCSErrors=4294967295
6293 dot3StatsSingleCollisionFrames=4294967295
6294 dot3StatsMultipleCollisionFrames=4294967295
6295 dot3StatsSQETestErrors=4294967295
6296 dot3StatsDeferredTransmissions=4294967295
6297 dot3StatsLateCollisions=4294967295
6298 dot3StatsExcessiveCollisions=4294967295
6299 dot3StatsInternalMacTransmitErrors=4294967295
6300 dot3StatsCarrierSenseErrors=4294967295
6301 dot3StatsFrameTooLongs=4294967295
6302 dot3StatsInternalMacReceiveErrors=4294967295
6303 dot3StatsSymbolErrors=4294967295
6304 IFCOUNTERS
6305 dgramSeqNo=1
6306 ds=127.0.0.1>0:1003
6307 csSeqNo=1
6308 ifindex=1003
6309 type=6
6310 ifspeed=100000000
6311 direction=0
6312 status=3
6313 in_octets=202
6314 in_unicasts=3
6315 in_multicasts=4294967295
6316 in_broadcasts=4294967295
6317 in_discards=4294967295
6318 in_errors=4294967295
6319 in_unknownprotos=4294967295
6320 out_octets=148
6321 out_unicasts=2
6322 out_multicasts=4294967295
6323 out_broadcasts=4294967295
6324 out_discards=4294967295
6325 out_errors=4294967295
6326 promiscuous=0
6327 IFCOUNTERS
6328 dgramSeqNo=1
6329 ds=127.0.0.1>0:1004
6330 csSeqNo=1
6331 ifindex=1004
6332 type=6
6333 ifspeed=100000000
6334 direction=0
6335 status=3
6336 in_octets=148
6337 in_unicasts=2
6338 in_multicasts=4294967295
6339 in_broadcasts=4294967295
6340 in_discards=4294967295
6341 in_errors=4294967295
6342 in_unknownprotos=4294967295
6343 out_octets=202
6344 out_unicasts=3
6345 out_multicasts=4294967295
6346 out_broadcasts=4294967295
6347 out_discards=4294967295
6348 out_errors=4294967295
6349 promiscuous=0
6350 IFCOUNTERS
6351 dgramSeqNo=2
6352 ds=127.0.0.1>0:1002
6353 csSeqNo=1
6354 ifindex=1002
6355 type=6
6356 ifspeed=100000000
6357 direction=0
6358 status=3
6359 in_octets=0
6360 in_unicasts=0
6361 in_multicasts=4294967295
6362 in_broadcasts=4294967295
6363 in_discards=4294967295
6364 in_errors=4294967295
6365 in_unknownprotos=4294967295
6366 out_octets=84
6367 out_unicasts=2
6368 out_multicasts=4294967295
6369 out_broadcasts=4294967295
6370 out_discards=4294967295
6371 out_errors=4294967295
6372 promiscuous=0
6373 IFCOUNTERS
6374 dgramSeqNo=3
6375 ds=127.0.0.1>0:1002
6376 csSeqNo=2
6377 ifindex=1002
6378 type=6
6379 ifspeed=100000000
6380 direction=0
6381 status=3
6382 in_octets=0
6383 in_unicasts=0
6384 in_multicasts=4294967295
6385 in_broadcasts=4294967295
6386 in_discards=4294967295
6387 in_errors=4294967295
6388 in_unknownprotos=4294967295
6389 out_octets=84
6390 out_unicasts=2
6391 out_multicasts=4294967295
6392 out_broadcasts=4294967295
6393 out_discards=4294967295
6394 out_errors=4294967295
6395 promiscuous=0
6396 IFCOUNTERS
6397 dgramSeqNo=3
6398 ds=127.0.0.1>0:1003
6399 csSeqNo=2
6400 ifindex=1003
6401 type=6
6402 ifspeed=100000000
6403 direction=0
6404 status=3
6405 in_octets=202
6406 in_unicasts=3
6407 in_multicasts=4294967295
6408 in_broadcasts=4294967295
6409 in_discards=4294967295
6410 in_errors=4294967295
6411 in_unknownprotos=4294967295
6412 out_octets=148
6413 out_unicasts=2
6414 out_multicasts=4294967295
6415 out_broadcasts=4294967295
6416 out_discards=4294967295
6417 out_errors=4294967295
6418 promiscuous=0
6419 IFCOUNTERS
6420 dgramSeqNo=3
6421 ds=127.0.0.1>0:1004
6422 csSeqNo=2
6423 ifindex=1004
6424 type=6
6425 ifspeed=100000000
6426 direction=0
6427 status=3
6428 in_octets=148
6429 in_unicasts=2
6430 in_multicasts=4294967295
6431 in_broadcasts=4294967295
6432 in_discards=4294967295
6433 in_errors=4294967295
6434 in_unknownprotos=4294967295
6435 out_octets=202
6436 out_unicasts=3
6437 out_multicasts=4294967295
6438 out_broadcasts=4294967295
6439 out_discards=4294967295
6440 out_errors=4294967295
6441 promiscuous=0
6442 OPENFLOWPORT
6443 datapath_id=18364758544493064720
6444 port_no=1
6445 OPENFLOWPORT
6446 datapath_id=18364758544493064720
6447 port_no=1
6448 OPENFLOWPORT
6449 datapath_id=18364758544493064720
6450 port_no=2
6451 OPENFLOWPORT
6452 datapath_id=18364758544493064720
6453 port_no=2
6454 OPENFLOWPORT
6455 datapath_id=18364758544493064720
6456 port_no=65534
6457 OPENFLOWPORT
6458 datapath_id=18364758544493064720
6459 port_no=65534
6460 PORTNAME
6461 portName=br0
6462 PORTNAME
6463 portName=br0
6464 PORTNAME
6465 portName=p1
6466 PORTNAME
6467 portName=p1
6468 PORTNAME
6469 portName=p2
6470 PORTNAME
6471 portName=p2
6472 ])])
6473
6474 AT_SETUP([ofproto-dpif - basic truncate action])
6475 OVS_VSWITCHD_START
6476 add_of_ports br0 1 2 3 4 5
6477
6478 AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
6479 AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
6480 AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
6481 AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
6482 AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
6483
6484 AT_DATA([flows.txt], [dnl
6485 in_port=3,actions=drop
6486 in_port=5,actions=drop
6487 in_port=1,actions=output(port=2,max_len=64),output:4
6488 ])
6489 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6490
6491 dnl Datapath actions
6492 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])
6493 AT_CHECK([tail -1 stdout], [0],
6494 [Datapath actions: trunc(64),2,4
6495 ])
6496
6497 dnl An 170 byte packet
6498 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6499
6500 AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
6501 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
6502 ])
6503
6504 AT_CHECK([ovs-appctl revalidator/purge], [0])
6505 dnl packet with truncated size
6506 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6507 n_bytes=64
6508 ])
6509 dnl packet with original size
6510 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6511 n_bytes=170
6512 ])
6513
6514 dnl More complicated case
6515 AT_CHECK([ovs-ofctl del-flows br0])
6516 AT_DATA([flows.txt], [dnl
6517 in_port=3,actions=drop
6518 in_port=5,actions=drop
6519 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
6520 ])
6521 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6522
6523 dnl Datapath actions
6524 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])
6525 AT_CHECK([tail -1 stdout], [0],
6526 [Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
6527 ])
6528
6529 dnl An 170 byte packet
6530 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6531
6532 AT_CHECK([ovs-appctl revalidator/purge], [0])
6533 dnl packet size: 64 + 128 + 170 = 362
6534 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6535 n_bytes=362
6536 ])
6537 dnl packet size: 60 + 170 = 230
6538 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6539 n_bytes=230
6540 ])
6541
6542 dnl syntax checking
6543 AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
6544 ovs-ofctl: output to unsupported truncate port: ALL
6545 ])
6546
6547 OVS_VSWITCHD_STOP
6548 AT_CLEANUP
6549
6550 AT_SETUP([ofproto-dpif - truncate and output to patch port])
6551 OVS_VSWITCHD_START([add-br br1 \
6552 -- set bridge br1 datapath-type=dummy fail-mode=secure \
6553 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 ofport_request=1 \
6554 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6555
6556 add_of_ports br0 2
6557
6558 AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
6559 AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
6560
6561 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6562 [0], [stdout])
6563 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
6564 ])
6565 dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
6566 AT_CHECK([grep "output_trunc does not support patch port [[0-9]]*" stdout], [0], [stdout])
6567
6568 OVS_VSWITCHD_STOP
6569 AT_CLEANUP
6570
6571 AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
6572 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6573 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6574 options:key=5 ofport_request=1\
6575 -- add-port br0 p2 -- set Interface p2 type=dummy \
6576 ofport_request=2])
6577 AT_DATA([flows.txt], [dnl
6578 actions=output(max_len=100, port=1)
6579 ])
6580 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6581 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6582
6583 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
6584 br0 65534/100: (dummy-internal)
6585 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
6586 p2 2/2: (dummy)
6587 ])
6588
6589 dnl Basic
6590 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])
6591 AT_CHECK([tail -1 stdout], [0],
6592 [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
6593 ])
6594
6595 OVS_VSWITCHD_STOP
6596 AT_CLEANUP
6597
6598 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
6599 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
6600 AT_CLEANUP
6601
6602 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
6603 AT_SKIP_IF([test $HAVE_IPV6 = no])
6604 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
6605 AT_CLEANUP
6606
6607 dnl Test sFlow LAG structures
6608 AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
6609 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
6610 OVS_VSWITCHD_START([dnl
6611 add-bond br0 bond p1 p2 -- \
6612 set Port bond lacp=active bond-mode=active-backup \
6613 other_config:lacp-time="fast" \
6614 other_config:lacp-system-id=11:22:33:44:55:66 \
6615 other_config:lacp-system-priority=54321 -- \
6616 set Interface p1 type=dummy \
6617 other_config:lacp-port-id=11 \
6618 other_config:lacp-port-priority=111 \
6619 other_config:lacp-aggregation-key=3333 -- \
6620 set Interface p2 type=dummy \
6621 other_config:lacp-port-id=22 \
6622 other_config:lacp-port-priority=222 \
6623 other_config:lacp-aggregation-key=3333 ])
6624
6625 on_exit 'kill `cat test-sflow.pid`'
6626 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6627 AT_CAPTURE_FILE([sflow.log])
6628 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6629
6630 ovs-appctl time/stop
6631
6632 ovs-vsctl \
6633 set Interface p1 options:ifindex=1003 -- \
6634 set Bridge br0 sflow=@sf -- \
6635 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6636 header=128 sampling=1 polling=1 agent=127.0.0.1
6637
6638 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6639 AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
6640 AT_CHECK([ovs-appctl revalidator/purge], [0])
6641 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6642 OVS_APP_EXIT_AND_WAIT([test-sflow])
6643 AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
6644 /g']], [0], [dnl
6645 LACPCOUNTERS
6646 sysID=11:22:33:44:55:66
6647 partnerID=00:00:00:00:00:00
6648 aggID=3333
6649 actorAdmin=0x7
6650 actorOper=0xbf
6651 partnerAdmin=0x0
6652 partnerOper=0x2
6653 LACPDUsRx=0
6654 markerPDUsRx=4294967295
6655 markerRespPDUsRx=4294967295
6656 unknownRx=4294967295
6657 illegalRx=0
6658 LACPDUsTx=1
6659 markerPDUsTx=4294967295
6660 markerRespPDUsTx=4294967295
6661 ])
6662
6663 AT_CLEANUP
6664
6665 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
6666 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6667 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6668
6669 dnl set up sFlow logging
6670 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6671 AT_CAPTURE_FILE([sflow.log])
6672 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6673 ovs-appctl time/stop
6674
6675 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6676 AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
6677 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
6678 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
6679
6680 AT_CHECK([ovs-ofctl add-flow br0 action=3])
6681
6682 dnl enable sflow
6683 ovs-vsctl \
6684 set Bridge br0 sflow=@sf -- \
6685 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
6686 header=128 sampling=1 polling=0
6687
6688 dnl introduce a packet that will be flooded to the tunnel
6689 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)'])
6690
6691 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6692 for i in `seq 1 30`; do
6693 ovs-appctl time/warp 100
6694 done
6695
6696 OVS_APP_EXIT_AND_WAIT([test-sflow])
6697
6698 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6699 /g']], [0], [dnl
6700 HEADER
6701 dgramSeqNo=1
6702 ds=127.0.0.1>2:1000
6703 fsSeqNo=1
6704 tunnel4_out_length=0
6705 tunnel4_out_protocol=47
6706 tunnel4_out_src=0.0.0.0
6707 tunnel4_out_dst=1.1.1.1
6708 tunnel4_out_src_port=0
6709 tunnel4_out_dst_port=0
6710 tunnel4_out_tcp_flags=0
6711 tunnel4_out_tos=1
6712 tunnel_out_vni=456
6713 in_vlan=0
6714 in_priority=0
6715 out_vlan=0
6716 out_priority=0
6717 meanSkip=1
6718 samplePool=1
6719 dropEvents=0
6720 in_ifindex=0
6721 in_format=0
6722 out_ifindex=1
6723 out_format=2
6724 hdr_prot=1
6725 pkt_len=110
6726 stripped=4
6727 hdr_len=106
6728 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
6729 ])
6730
6731 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6732 AT_CLEANUP
6733
6734 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
6735 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6736
6737 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
6738
6739 dnl set up sFlow logging
6740 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6741 AT_CAPTURE_FILE([sflow.log])
6742 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6743 ovs-appctl time/stop
6744
6745 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6746 AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
6747 AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
6748 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
6749 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
6750 options:ifindex=2011 ofport_request=5
6751 ], [0])
6752
6753 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6754 dummy@ovs-dummy: hit:0 missed:0
6755 br0:
6756 br0 65534/100: (dummy-internal)
6757 p0 1/1: (dummy: ifindex=1010)
6758 int-br:
6759 int-br 65534/2: (dummy-internal)
6760 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
6761 vm1 5/3: (dummy: ifindex=2011)
6762 ])
6763
6764 dnl set up route to 1.1.2.92 via br0 and action=normal
6765 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
6766 ])
6767 AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
6768 ])
6769 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6770
6771 dnl Prime ARP Cache for 1.1.2.92
6772 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)'])
6773
6774 dnl configure sflow on int-br only
6775 ovs-vsctl \
6776 set Bridge int-br sflow=@sf -- \
6777 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
6778 header=128 sampling=1 polling=0
6779
6780 dnl set up route to 192.168.1.2 via br0
6781 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
6782 ])
6783 AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
6784 ])
6785
6786 dnl add rule for int-br to force packet onto tunnel. There is no ifindex
6787 dnl for this port so the sFlow output will just report that it went to
6788 dnl 1 output (out_format=2, out_ifindex=1)
6789 AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
6790
6791 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)'])
6792
6793 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6794 for i in `seq 1 30`; do
6795 ovs-appctl time/warp 100
6796 done
6797
6798 OVS_APP_EXIT_AND_WAIT([test-sflow])
6799
6800 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6801 /g']], [0], [dnl
6802 HEADER
6803 dgramSeqNo=1
6804 ds=127.0.0.1>2:1000
6805 fsSeqNo=1
6806 tunnel4_out_length=0
6807 tunnel4_out_protocol=47
6808 tunnel4_out_src=1.1.2.88
6809 tunnel4_out_dst=1.1.2.92
6810 tunnel4_out_src_port=0
6811 tunnel4_out_dst_port=0
6812 tunnel4_out_tcp_flags=0
6813 tunnel4_out_tos=0
6814 tunnel_out_vni=456
6815 in_vlan=0
6816 in_priority=0
6817 out_vlan=0
6818 out_priority=0
6819 meanSkip=1
6820 samplePool=1
6821 dropEvents=0
6822 in_ifindex=2011
6823 in_format=0
6824 out_ifindex=1
6825 out_format=2
6826 hdr_prot=1
6827 pkt_len=110
6828 stripped=4
6829 hdr_len=106
6830 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
6831 ])
6832
6833 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6834 AT_CLEANUP
6835
6836 AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
6837 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6838 OVS_VSWITCHD_START
6839 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6840 add_of_ports br0 1 2
6841 AT_DATA([flows.txt], [dnl
6842 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
6843 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6844 ])
6845 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6846
6847 dnl set up sFlow logging
6848 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6849 AT_CAPTURE_FILE([sflow.log])
6850 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6851 ovs-appctl time/stop
6852
6853 dnl configure sflow
6854 ovs-vsctl \
6855 set Bridge br0 sflow=@sf -- \
6856 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" agent=127.0.0.1 \
6857 header=128 sampling=1 polling=0
6858
6859 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)'])
6860 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)'])
6861
6862 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6863 for i in `seq 1 30`; do
6864 ovs-appctl time/warp 100
6865 done
6866
6867 OVS_APP_EXIT_AND_WAIT([test-sflow])
6868
6869 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6870 /g']], [0], [dnl
6871 HEADER
6872 dgramSeqNo=1
6873 ds=127.0.0.1>2:1000
6874 fsSeqNo=1
6875 mpls_label_0=789
6876 mpls_tc_0=4
6877 mpls_ttl_0=32
6878 mpls_bos_0=0
6879 mpls_label_1=11
6880 mpls_tc_1=3
6881 mpls_ttl_1=64
6882 mpls_bos_1=1
6883 in_vlan=0
6884 in_priority=0
6885 out_vlan=0
6886 out_priority=0
6887 meanSkip=1
6888 samplePool=1
6889 dropEvents=0
6890 in_ifindex=0
6891 in_format=0
6892 out_ifindex=1
6893 out_format=2
6894 hdr_prot=1
6895 pkt_len=22
6896 stripped=4
6897 hdr_len=18
6898 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40
6899 HEADER
6900 dgramSeqNo=1
6901 ds=127.0.0.1>2:1000
6902 fsSeqNo=2
6903 mpls_label_0=789
6904 mpls_tc_0=4
6905 mpls_ttl_0=32
6906 mpls_bos_0=1
6907 in_vlan=0
6908 in_priority=0
6909 out_vlan=0
6910 out_priority=0
6911 meanSkip=1
6912 samplePool=2
6913 dropEvents=0
6914 in_ifindex=0
6915 in_format=0
6916 out_ifindex=1
6917 out_format=2
6918 hdr_prot=1
6919 pkt_len=38
6920 stripped=4
6921 hdr_len=34
6922 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
6923 ])
6924
6925 OVS_VSWITCHD_STOP(["/failed to get flags for network device 127.0.0.1/d"])
6926 AT_CLEANUP
6927
6928
6929 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
6930 #
6931 # Test that basic NetFlow reports flow statistics correctly:
6932 # The initial packet of a flow are correctly accounted.
6933 # Later packets within a flow are correctly accounted.
6934 # Flow actions changing (in this case, due to MAC learning)
6935 # cause a record to be sent.
6936 m4_define([CHECK_NETFLOW_EXPIRATION],
6937 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6938 add_of_ports br0 1 2
6939
6940 ovs-appctl time/stop
6941 on_exit 'kill `cat test-netflow.pid`'
6942 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6943 AT_CAPTURE_FILE([netflow.log])
6944 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6945
6946 ovs-vsctl \
6947 set Bridge br0 netflow=@nf -- \
6948 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6949 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6950
6951 for delay in 1000 30000; do
6952 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)'
6953 sleep 1 # ensure the order in which these two packets are processed
6954 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)'
6955
6956 ovs-appctl time/warp $delay
6957 done
6958
6959 ovs-appctl time/warp 6000
6960 ovs-appctl revalidator/wait
6961 OVS_VSWITCHD_STOP
6962 OVS_APP_EXIT_AND_WAIT([test-netflow])
6963
6964 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])
6965
6966 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])
6967
6968 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 212 bytes, ICMP 0:0" netflow.log | wc -l`
6969 separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 106 bytes, ICMP 0:0" netflow.log | wc -l`
6970 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
6971
6972 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
6973 CHECK_NETFLOW_EXPIRATION([127.0.0.1])
6974 AT_CLEANUP
6975
6976 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
6977 AT_SKIP_IF([test $HAVE_IPV6 = no])
6978 CHECK_NETFLOW_EXPIRATION([[[::1]]])
6979 AT_CLEANUP
6980
6981 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
6982 #
6983 # Test that basic NetFlow reports active expirations correctly.
6984 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
6985 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6986 add_of_ports br0 1 2
6987
6988 on_exit 'kill `cat test-netflow.pid`'
6989 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6990 AT_CAPTURE_FILE([netflow.log])
6991 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6992
6993 ovs-vsctl \
6994 set Bridge br0 netflow=@nf -- \
6995 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6996 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
6997
6998 AT_CHECK([ovs-appctl time/stop])
6999 n=1
7000 while test $n -le 60; do
7001 n=`expr $n + 1`
7002
7003 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)'
7004 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)'
7005
7006 ovs-appctl time/warp 1000
7007 done
7008
7009 ovs-appctl time/warp 10000
7010
7011 ovs-appctl revalidator/wait
7012 OVS_VSWITCHD_STOP
7013 OVS_APP_EXIT_AND_WAIT([test-netflow])
7014
7015 # Count the number of reported packets:
7016 # - From source to destination before MAC learning kicks in (just one).
7017 # - From source to destination after that.
7018 # - From destination to source.
7019 n_learn=0
7020 n_in=0
7021 n_out=0
7022 n_other=0
7023 n_recs=0
7024 none=0
7025 while read line; do
7026 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
7027 case $pkts in
7028 [[0-9]]*) ;;
7029 *) continue ;;
7030 esac
7031
7032 case $line in
7033 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
7034 counter=n_learn
7035 ;;
7036 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
7037 counter=n_in
7038 ;;
7039 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
7040 counter=n_out
7041 ;;
7042 *)
7043 counter=n_other
7044 ;;
7045 esac
7046 eval $counter=\`expr \$$counter + \$pkts\`
7047 n_recs=`expr $n_recs + 1`
7048 done < netflow.log
7049
7050 # There should be exactly 1 MAC learning packet,
7051 # exactly 59 other packets in that direction,
7052 # and exactly 60 packets in the other direction.
7053 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
7054 ])])
7055
7056 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
7057 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
7058 AT_CLEANUP
7059
7060 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
7061 AT_SKIP_IF([test $HAVE_IPV6 = no])
7062 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
7063 AT_CLEANUP
7064
7065 dnl In the absence of an IPFIX collector to verify protocol correctness, simply
7066 dnl configure bridge IPFIX and ensure that sample action generation works at the
7067 dnl datapath level.
7068 AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
7069 OVS_VSWITCHD_START
7070 add_of_ports br0 1 2
7071
7072 dnl Sample every packet using bridge-based sampling.
7073 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7074 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7075 sampling=1], [0], [ignore])
7076
7077 dnl Send some packets that should be sampled.
7078 for i in `seq 1 3`; do
7079 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)'])
7080 done
7081 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7082 flow-dump from non-dpdk interfaces:
7083 packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))
7084 ])
7085
7086 AT_CHECK([ovs-appctl revalidator/purge])
7087 dnl
7088 dnl Add a slowpath meter. The userspace action should be metered.
7089 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])
7090
7091 dnl Send some packets that should be sampled and metered.
7092 for i in `seq 1 3`; do
7093 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])
7094 done
7095 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7096 flow-dump from non-dpdk interfaces:
7097 packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))
7098 ])
7099
7100 dnl Remove the IPFIX configuration.
7101 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7102 AT_CHECK([ovs-appctl revalidator/purge])
7103
7104 dnl Send some more packets, to ensure that these are not sampled.
7105 for i in `seq 1 3`; do
7106 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)'])
7107 done
7108 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7109 flow-dump from non-dpdk interfaces:
7110 packets:2, bytes:68, used:0.001s, actions:drop
7111 ])
7112
7113 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7114 AT_CLEANUP
7115
7116 dnl Bridge IPFIX statistics check
7117 AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
7118 OVS_VSWITCHD_START
7119 add_of_ports br0 1 2
7120
7121 dnl Negative test check.
7122 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
7123 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7124 NXST_IPFIX_BRIDGE request (xid=0x2):
7125 ])
7126
7127 dnl Sample every packet using bridge-based sampling.
7128 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
7129 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
7130 sampling=1], [0], [ignore])
7131
7132 dnl Send some packets that should be sampled.
7133 for i in `seq 1 20`; do
7134 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)'])
7135 done
7136
7137 dnl There are 4 extra IPFIX template packets.
7138 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
7139 NXST_IPFIX_BRIDGE reply (xid=0x2):
7140 bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7141 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
7142 ])
7143
7144 dnl Remove the IPFIX configuration.
7145 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
7146 AT_CHECK([ovs-appctl revalidator/purge])
7147
7148 dnl Send some more packets, to ensure that these are not sampled.
7149 for i in `seq 1 2`; do
7150 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)'])
7151 done
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 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7158 AT_CLEANUP
7159
7160 dnl Flow IPFIX sanity check
7161 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
7162 OVS_VSWITCHD_START
7163 add_of_ports br0 1 2
7164
7165 # Check for regression against a bug where an invalid target caused an
7166 # assertion failure and a crash.
7167 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7168 -- --id=@ipfix create IPFIX targets=\"xyzzy\" \
7169 -- --id=@cs create Flow_Sample_Collector_Set id=0 bridge=@br0 ipfix=@ipfix],
7170 [0], [ignore])
7171
7172 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7173 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7174 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7175 [0], [ignore])
7176
7177 AT_DATA([flows.txt], [dnl
7178 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7179 ])
7180
7181 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7182
7183 dnl Send some packets that should be sampled.
7184 for i in `seq 1 3`; do
7185 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)'])
7186 done
7187 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7188 flow-dump from non-dpdk interfaces:
7189 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
7190 ])
7191
7192 dnl Remove the flow which contains sample action.
7193 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7194 AT_CHECK([ovs-appctl revalidator/purge])
7195
7196 dnl Send some more packets, to ensure that these are not sampled.
7197 for i in `seq 1 3`; do
7198 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)'])
7199 done
7200 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
7201 flow-dump from non-dpdk interfaces:
7202 packets:2, bytes:68, used:0.001s, actions:drop
7203 ])
7204
7205 OVS_VSWITCHD_STOP(["/sending to collector failed/d
7206 /xyzzy/d
7207 /no collectors/d"])
7208 AT_CLEANUP
7209
7210 dnl Flow IPFIX sanity check for tunnel set
7211 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
7212 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
7213 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
7214 options:key=5 ofport_request=1\
7215 -- add-port br0 p2 -- set Interface p2 type=stt \
7216 options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
7217 options:key=6 ofport_request=2\
7218 -- add-port br0 p3 -- set Interface p3 type=dummy \
7219 ofport_request=3 \
7220 -- --id=@br0 get Bridge br0 \
7221 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7222 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7223 [<0>
7224 <1>
7225 ])
7226
7227 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
7228
7229 dnl Add openflow sample action without sampling_port.
7230 AT_DATA([flows.txt], [dnl
7231 in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
7232 ])
7233 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7234
7235 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])
7236 AT_CHECK([tail -1 stdout], [0], [dnl
7237 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
7238 ])
7239
7240 dnl Remove the flow which contains sample action.
7241 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7242 AT_CHECK([ovs-appctl revalidator/purge])
7243
7244 dnl Add openflow sample action with sampling_port which is
7245 dnl equal to output port.
7246 AT_DATA([flows2.txt], [dnl
7247 in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
7248 ])
7249 AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
7250
7251 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])
7252 dnl Make sure flow sample action in datapath is behind set tunnel
7253 dnl action at egress point of tunnel port.
7254 AT_CHECK([tail -1 stdout], [0], [dnl
7255 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
7256 ])
7257
7258 dnl Remove the flow which contains sample action.
7259 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7260 AT_CHECK([ovs-appctl revalidator/purge])
7261
7262 dnl Add a rule with two sample actions and each sample action
7263 dnl has a sampling_port
7264 AT_DATA([flows3.txt], [dnl
7265 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
7266 ])
7267 AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
7268
7269 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])
7270 dnl Make sure flow sample action in datapath is behind set tunnel
7271 dnl action at egress point of tunnel port.
7272 AT_CHECK([tail -1 stdout], [0], [dnl
7273 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
7274 ])
7275
7276 dnl Remove the flow which contains sample action.
7277 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
7278 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7279
7280 OVS_VSWITCHD_STOP
7281 AT_CLEANUP
7282
7283 AT_SETUP([ofproto-dpif - clone action])
7284 OVS_VSWITCHD_START
7285 add_of_ports br0 1 2 3 4
7286
7287 dnl Reversible open flow clone actions, no datapath clone action should be generated.
7288 AT_DATA([flows.txt], [dnl
7289 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
7290 ])
7291 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7292
7293 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])
7294
7295 AT_CHECK([tail -1 stdout], [0], [dnl
7296 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
7297 ])
7298
7299 dnl Test flow xlate openflow clone action without using datapath clone action.
7300 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7301
7302 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])
7303
7304 AT_CHECK([tail -1 stdout], [0], [dnl
7305 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
7306 ])
7307
7308 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7309 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])
7310
7311 AT_CHECK([tail -1 stdout], [0], [dnl
7312 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
7313 ])
7314
7315 dnl Mixing reversible and irreversible open flow clone actions. Datapath clone action
7316 dnl should be generated when necessary.
7317
7318 dnl Restore the datapath support level.
7319 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone true], [0], [])
7320 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 10], [0], [])
7321
7322 AT_DATA([flows.txt], [dnl
7323 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
7324 ])
7325 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7326
7327 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])
7328
7329 AT_CHECK([tail -1 stdout], [0], [dnl
7330 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),clone(ct(commit),3),4
7331 ])
7332
7333 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
7334
7335 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])
7336
7337 AT_CHECK([tail -1 stdout], [0], [dnl
7338 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
7339 ])
7340
7341 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
7342 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])
7343
7344 AT_CHECK([tail -1 stdout], [0], [dnl
7345 Datapath actions: set(ipv4(dst=192.168.4.4)),2,set(ipv4(dst=10.10.10.1)),4
7346 ])
7347 AT_CHECK([grep "Failed to compose clone action" stdout], [0], [ignore])
7348
7349 OVS_VSWITCHD_STOP
7350 AT_CLEANUP
7351
7352 dnl Flow based IPFIX statistics check
7353 AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
7354 OVS_VSWITCHD_START
7355 add_of_ports br0 1 2
7356
7357 dnl Negative test check.
7358 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7359 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7360 NXST_IPFIX_FLOW request (xid=0x2):
7361 ])
7362
7363 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
7364 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
7365 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
7366 [0], [ignore])
7367
7368 AT_DATA([flows.txt], [dnl
7369 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
7370 ])
7371
7372 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
7373
7374 dnl Send some packets that should be sampled.
7375 for i in `seq 1 20`; do
7376 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)'])
7377 done
7378
7379 dnl There are 4 extra IPFIX template packets.
7380 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
7381 NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
7382 id 1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
7383 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
7384 ])
7385
7386 dnl Remove the flow which contains sample action.
7387 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
7388 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
7389 AT_CHECK([ovs-appctl revalidator/purge])
7390
7391 dnl Send some more packets, to ensure that these are not sampled.
7392 for i in `seq 1 3`; do
7393 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)'])
7394 done
7395 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
7396 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
7397 NXST_IPFIX_FLOW request (xid=0x2):
7398 ])
7399
7400 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
7401 AT_CLEANUP
7402
7403 AT_SETUP([ofproto-dpif - flow stats])
7404 OVS_VSWITCHD_START
7405 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7406 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7407
7408 ovs-appctl time/stop
7409
7410 for i in `seq 1 10`; do
7411 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)'
7412 done
7413
7414 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7415 AT_CHECK([ovs-appctl revalidator/purge], [0])
7416 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7417 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
7418 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
7419 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
7420 ])
7421 OVS_VSWITCHD_STOP
7422 AT_CLEANUP
7423
7424 AT_SETUP([ofproto-dpif - flow stats reset_counts])
7425 OVS_VSWITCHD_START
7426 flow="ip,actions=NORMAL"
7427
7428 ovs-appctl time/stop
7429
7430 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7431
7432 warp_and_dump_NXM () {
7433 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7434 AT_CHECK([ovs-appctl revalidator/purge], [0])
7435
7436 AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0], [0], [stdout])
7437 if [[ $5 -gt 0 ]]; then
7438 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, hard_age=$5, ip actions=NORMAL"
7439 else
7440 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, ip actions=NORMAL"
7441 fi
7442 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7443 $expected
7444 ])
7445 }
7446
7447 warp_and_dump_OF () {
7448 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7449 AT_CHECK([ovs-appctl revalidator/purge], [0])
7450
7451 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0], [0], [stdout])
7452 if [[ $1 -lt 13 -o "$5X" = "X" ]]; then
7453 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, ip actions=NORMAL"
7454 else
7455 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $5 ip actions=NORMAL"
7456 fi
7457 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7458 $expected
7459 ])
7460 }
7461
7462 send_packet () {
7463 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)'
7464 }
7465
7466 # OpenFlow 1.0, implicit reset_counts
7467 send_packet
7468 warp_and_dump_NXM 1 1 118 1
7469 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 add-flow br0 $flow])
7470 # add-flow resets duration and counts,
7471 # but idle age is inherited from the old flow
7472 warp_and_dump_NXM 1 0 0 2
7473
7474 send_packet
7475 warp_and_dump_NXM 2 1 118 1
7476 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 mod-flows br0 $flow])
7477 # mod-flows resets hard_age, but not counts
7478 # but duration and idle_age is inherited from the old flow
7479 warp_and_dump_NXM 3 1 118 2 1
7480
7481 # OpenFlow 1.1, implicit reset_counts
7482 send_packet
7483 warp_and_dump_OF 11 4 2 236
7484 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 add-flow br0 $flow])
7485 # add-flow resets duration and counts,
7486 # but idle age is inherited from the old flow
7487 warp_and_dump_NXM 1 0 0 2
7488 warp_and_dump_OF 11 2 0 0
7489
7490 send_packet
7491 warp_and_dump_OF 11 3 1 118
7492 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 mod-flows br0 $flow])
7493 # mod-flows resets hard_age, but not counts
7494 # but duration and idle_age is inherited from the old flow
7495 warp_and_dump_NXM 4 1 118 2 1
7496 warp_and_dump_OF 11 5 1 118
7497
7498 # OpenFlow 1.2, explicit reset_counts
7499 send_packet
7500 warp_and_dump_OF 12 6 2 236
7501 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 $flow])
7502 # add-flow without flags resets duration, but not counts,
7503 # idle age is inherited from the old flow
7504 warp_and_dump_NXM 1 2 236 2
7505 warp_and_dump_OF 12 2 2 236
7506
7507 send_packet
7508 warp_and_dump_OF 12 3 3 354
7509 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 $flow])
7510 # mod-flows without flags does not reset duration nor counts,
7511 # idle age is inherited from the old flow
7512 warp_and_dump_NXM 4 3 354 2 1
7513 warp_and_dump_OF 12 5 3 354
7514
7515 send_packet
7516 warp_and_dump_OF 12 6 4 472
7517 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 reset_counts,$flow])
7518 # add-flow with reset_counts resets both duration and counts,
7519 # idle age is inherited from the old flow
7520 warp_and_dump_NXM 1 0 0 2
7521 warp_and_dump_OF 12 2 0 0
7522
7523 send_packet
7524 warp_and_dump_OF 12 3 1 118
7525 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 reset_counts,$flow])
7526 # mod-flows with reset_counts resets counts, but not duration,
7527 # idle age is inherited from the old flow
7528 warp_and_dump_NXM 4 0 0 2 1
7529 warp_and_dump_OF 12 5 0 0
7530
7531 # OpenFlow > 1.3, explicit reset_counts
7532 flow_mods_reset_counts () {
7533 # Reset to a known state
7534 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7535
7536 send_packet
7537 warp_and_dump_OF $1 1 1 118 reset_counts
7538 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7539 # add-flow without flags resets duration, but not counts,
7540 # idle age is inherited from the old flow
7541 warp_and_dump_NXM 1 1 118 2
7542 warp_and_dump_OF $1 2 1 118
7543
7544 send_packet
7545 warp_and_dump_OF $1 3 2 236
7546 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7547 # mod-flows without flags does not reset duration nor counts,
7548 # idle age is inherited from the old flow
7549 warp_and_dump_NXM 4 2 236 2 1
7550 warp_and_dump_OF $1 5 2 236
7551
7552 send_packet
7553 warp_and_dump_OF $1 6 3 354
7554 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7555 # add-flow with reset_counts resets both duration and counts,
7556 # idle age is inherited from the old flow
7557 warp_and_dump_NXM 1 0 0 2
7558 warp_and_dump_OF $1 2 0 0 reset_counts
7559
7560 send_packet
7561 warp_and_dump_OF $1 3 1 118 reset_counts
7562 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7563 # mod-flows with reset_counts resets counts, but not duration,
7564 # idle age is inherited from the old flow
7565 warp_and_dump_NXM 4 0 0 2 1
7566 warp_and_dump_OF $1 5 0 0 reset_counts
7567
7568 # Modify flow having reset_counts flag without reset_counts
7569 send_packet
7570 warp_and_dump_OF $1 6 1 118 reset_counts
7571 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7572 warp_and_dump_NXM 7 1 118 2 1
7573 warp_and_dump_OF $1 8 1 118 reset_counts
7574
7575 # Add flow having reset_counts flag without reset_counts
7576 send_packet
7577 warp_and_dump_OF $1 9 2 236 reset_counts
7578 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7579 warp_and_dump_NXM 1 2 236 2
7580 warp_and_dump_OF $1 2 2 236
7581
7582 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7583 send_packet
7584 warp_and_dump_OF $1 3 3 354
7585 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7586 warp_and_dump_NXM 4 0 0 2 1
7587 warp_and_dump_OF $1 5 0 0
7588 }
7589
7590 # OpenFlow versions >= 1.3 should behave the same way
7591 flow_mods_reset_counts 13
7592 flow_mods_reset_counts 14
7593
7594 OVS_VSWITCHD_STOP
7595 AT_CLEANUP
7596
7597 AT_SETUP([ofproto-dpif - flow stats reset_counts OpenFlow1.5])
7598 OVS_VSWITCHD_START
7599 flow="ip,actions=NORMAL"
7600
7601 ovs-appctl time/stop
7602
7603 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7604
7605 warp_and_dump_OF () {
7606 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
7607 AT_CHECK([ovs-appctl revalidator/purge], [0])
7608
7609 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0 ], [0], [stdout])
7610 if [[ "$6X" = "X" ]]; then
7611 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, idle_age=$5, ip actions=NORMAL"
7612 else
7613 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $6 idle_age=$5, ip actions=NORMAL"
7614 fi
7615 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
7616 $expected
7617 ])
7618 }
7619
7620 send_packet () {
7621 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)'
7622 }
7623
7624 # OpenFlow 1.5, explicit reset_counts
7625 flow_mods_reset_counts () {
7626 # Reset to a known state
7627 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7628
7629 send_packet
7630 warp_and_dump_OF $1 1 1 118 1 reset_counts
7631 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7632 # add-flow without flags resets duration, but not counts,
7633 # idle age is inherited from the old flow
7634 warp_and_dump_OF $1 1 1 118 2
7635
7636 send_packet
7637 warp_and_dump_OF $1 2 2 236 1
7638 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7639 # mod-flows without flags does not reset duration nor counts,
7640 # idle age is inherited from the old flow
7641 warp_and_dump_OF $1 3 2 236 2
7642
7643 send_packet
7644 warp_and_dump_OF $1 4 3 354 1
7645 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7646 # add-flow with reset_counts resets both duration and counts,
7647 # idle age is inherited from the old flow
7648 warp_and_dump_OF $1 1 0 0 2 reset_counts
7649
7650 send_packet
7651 warp_and_dump_OF $1 2 1 118 1 reset_counts
7652 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7653 # mod-flows with reset_counts resets counts, but not duration,
7654 # idle age is inherited from the old flow
7655 warp_and_dump_OF $1 3 0 0 2 reset_counts
7656
7657 # Modify flow having reset_counts flag without reset_counts
7658 send_packet
7659 warp_and_dump_OF $1 4 1 118 1 reset_counts
7660 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7661 warp_and_dump_OF $1 5 1 118 2 reset_counts
7662
7663 # Add flow having reset_counts flag without reset_counts
7664 send_packet
7665 warp_and_dump_OF $1 6 2 236 1 reset_counts
7666 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7667 warp_and_dump_OF $1 1 2 236 2
7668
7669 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7670 send_packet
7671 warp_and_dump_OF $1 2 3 354 1
7672 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7673 warp_and_dump_OF $1 3 0 0 2
7674 }
7675
7676 # OpenFlow versions >= 1.3 should behave the same way
7677 flow_mods_reset_counts 15
7678
7679 OVS_VSWITCHD_STOP
7680 AT_CLEANUP
7681
7682
7683 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
7684 OVS_VSWITCHD_START
7685 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7686 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7687
7688 ovs-appctl time/stop
7689
7690 for i in `seq 1 10`; do
7691 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)'
7692 done
7693
7694 ovs-appctl time/warp 100
7695 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
7696 ovs-appctl time/warp 1000
7697
7698 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7699 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
7700 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
7701 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=1180, idle_age=1, ip actions=NORMAL
7702 ])
7703 OVS_VSWITCHD_STOP
7704 AT_CLEANUP
7705
7706 AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
7707 OVS_VSWITCHD_START
7708
7709 # get_ages DURATION HARD IDLE
7710 #
7711 # Fetch the flow duration, hard age, and idle age into the variables
7712 # whose names are given as arguments. Rounds DURATION down to the
7713 # nearest integer. If hard_age doesn't appear in the output, sets
7714 # HARD to "none". If idle_age doesn't appear in the output, sets IDLE
7715 # to 0.
7716 get_ages () {
7717 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7718
7719 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
7720 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
7721 AS_VAR_COPY([$1], [duration])
7722
7723 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
7724 if test X"$hard" = X; then
7725 hard=none
7726 else
7727 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
7728 fi
7729 AS_VAR_COPY([$2], [hard])
7730
7731 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
7732 if test X"$idle" = X; then
7733 idle=0
7734 else
7735 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
7736 fi
7737 AS_VAR_COPY([$3], [idle])
7738 }
7739
7740 # Add a flow and get its initial hard and idle age.
7741 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
7742 get_ages duration1 hard1 idle1
7743
7744 ovs-appctl time/stop
7745 # Warp time forward by 10 seconds, then modify the flow's actions.
7746 ovs-appctl time/warp 10000
7747 get_ages duration2 hard2 idle2
7748 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
7749
7750 # Warp time forward by 10 seconds.
7751 ovs-appctl time/warp 10000
7752 get_ages duration3 hard3 idle3
7753
7754 # Warp time forward 10 more seconds, then pass some packets through the flow,
7755 # then warp forward a few more times because idle times are only updated
7756 # occasionally.
7757 ovs-appctl time/warp 10000
7758 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)'
7759 ovs-appctl time/warp 3000 1000
7760 sleep 1
7761 get_ages duration4 hard4 idle4
7762
7763 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
7764 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
7765 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
7766
7767 # Duration should increase steadily over time.
7768 AT_CHECK([test $duration1 -lt $duration2])
7769 AT_CHECK([test $duration2 -lt $duration3])
7770 AT_CHECK([test $duration3 -lt $duration4])
7771
7772 # Hard age should be "none" initially because it's the same as flow_duration,
7773 # then it should increase.
7774 AT_CHECK([test $hard1 = none])
7775 AT_CHECK([test $hard2 = none])
7776 AT_CHECK([test $hard3 != none])
7777 AT_CHECK([test $hard4 != none])
7778 AT_CHECK([test $hard3 -lt $hard4])
7779
7780 # Idle age should increase from 1 to 2 to 3, then decrease.
7781 AT_CHECK([test $idle1 -lt $idle2])
7782 AT_CHECK([test $idle2 -lt $idle3])
7783 AT_CHECK([test $idle3 -gt $idle4])
7784
7785 # Check some invariant relationships.
7786 AT_CHECK([test $duration1 = $idle1])
7787 AT_CHECK([test $duration2 = $idle2])
7788 AT_CHECK([test $duration3 = $idle3])
7789 AT_CHECK([test $idle3 -gt $hard3])
7790 AT_CHECK([test $idle4 -lt $hard4])
7791 AT_CHECK([test $hard4 -lt $duration4])
7792
7793 OVS_VSWITCHD_STOP
7794 AT_CLEANUP
7795
7796 AT_SETUP([ofproto-dpif - fin_timeout])
7797 OVS_VSWITCHD_START
7798 ovs-appctl time/stop
7799 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
7800 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7801 [NXST_FLOW reply:
7802 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7803 ])
7804
7805 # Check that a TCP SYN packet does not change the timeout. (Because
7806 # flow stats updates are mainly what implements the fin_timeout
7807 # feature, we warp forward a couple of times to ensure that flow stats
7808 # run before re-checking the flow table.)
7809 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
7810 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7811 warped
7812 ])
7813 AT_CHECK([ovs-appctl revalidator/purge], [0])
7814 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7815 [NXST_FLOW reply:
7816 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7817 ])
7818 # Check that a TCP FIN packet does change the timeout.
7819 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
7820 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7821 warped
7822 ])
7823 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7824 [NXST_FLOW reply:
7825 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
7826 ])
7827 OVS_VSWITCHD_STOP
7828 AT_CLEANUP
7829
7830 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
7831 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
7832 add_of_ports br0 1 2
7833 add_of_ports br1 3
7834
7835 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
7836 dummy@br0
7837 dummy@br1
7838 ])
7839 OVS_VSWITCHD_STOP
7840 AT_CLEANUP
7841
7842 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
7843 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
7844 [--dummy-numa="0,0,0,0,1,1,1,1"])
7845 add_pmd_of_ports br0 1 2
7846 add_of_ports br1 3
7847
7848 AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
7849 dummy@ovs-dummy: hit:0 missed:0
7850 br0:
7851 br0 65534/100: (dummy-internal)
7852 p1 1/1: (dummy-pmd: <cleared>)
7853 p2 2/2: (dummy-pmd: <cleared>)
7854 br1:
7855 br1 65534/101: (dummy-internal)
7856 p3 3/3: (dummy)
7857 ])
7858 OVS_VSWITCHD_STOP
7859 AT_CLEANUP
7860
7861 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
7862 # bump max-idle to avoid the flows being reclaimed behind us
7863 OVS_VSWITCHD_START([add-br br1 -- \
7864 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7865 set Open_vSwitch . other_config:max-idle=10000], [], [],
7866 [--dummy-numa="0,0,0,0,1,1,1,1"])
7867 add_of_ports br0 1
7868 add_pmd_of_ports br0 2
7869 add_of_ports br1 3
7870
7871 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)'])
7872 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)'])
7873 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)'])
7874 ovs-appctl revalidator/wait
7875 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7876 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
7877 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
7878 ])
7879
7880 AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
7881 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
7882 ])
7883
7884 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
7885 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
7886 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
7887 ])
7888
7889 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
7890 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
7891 ])
7892
7893 OVS_VSWITCHD_STOP
7894 AT_CLEANUP
7895
7896 m4_define([OFPROTO_DPIF_GET_FLOW],
7897 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
7898
7899 OVS_VSWITCHD_START([add-br br1 -- \
7900 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7901 set Open_vSwitch . other_config:max-idle=10000], [], [],
7902 [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7903
7904 func=`printf '%s_' "$1" | cut -c 4-`
7905 add_${func}of_ports br0 1 2
7906
7907 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)'])
7908 ovs-appctl revalidator/wait
7909 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
7910
7911 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
7912 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
7913 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
7914 ])
7915
7916 OVS_VSWITCHD_STOP
7917 AT_CLEANUP])
7918
7919 OFPROTO_DPIF_GET_FLOW([])
7920 OFPROTO_DPIF_GET_FLOW([ - pmd])
7921
7922 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
7923 OVS_VSWITCHD_START([dnl
7924 add-port br0 p1 -- set Interface p1 type=dummy
7925 ])
7926 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7927 on_exit 'kill `cat ovs-ofctl.pid`'
7928
7929 AT_CAPTURE_FILE([ofctl_monitor.log])
7930 AT_DATA([flows.txt], [dnl
7931 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
7932 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
7933 ])
7934 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7935
7936 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
7937 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
7938 dnl
7939 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
7940 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)
7941 dnl (label 20, exp 0, [S], ttl 32)
7942 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7943 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7944
7945 for dl_src in 00 01; do
7946 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"])
7947 done
7948 sleep 1 # wait for the datapath flow installed
7949 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7950 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))
7951 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))
7952 ])
7953
7954 OVS_VSWITCHD_STOP
7955 AT_CLEANUP
7956
7957
7958 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
7959 OVS_VSWITCHD_START([dnl
7960 add-port br0 p1 -- set Interface p1 type=dummy
7961 ])
7962 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7963 on_exit 'kill `cat ovs-ofctl.pid`'
7964
7965 AT_CAPTURE_FILE([ofctl_monitor.log])
7966 AT_DATA([flows.txt], [dnl
7967 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
7968 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
7969 ])
7970 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7971
7972 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
7973 dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
7974 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
7975 dnl
7976 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
7977 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)
7978 dnl (label 20, exp 0, ttl 32)
7979 dnl (label 20, exp 0, ttl 32)
7980 dnl (label 20, exp 0, [S], ttl 32)
7981 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7982 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7983
7984 for dl_src in 00 01; do
7985 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"])
7986 done
7987 sleep 1 # wait for the datapath flow installed
7988 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7989 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))
7990 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))
7991 ])
7992
7993 OVS_VSWITCHD_STOP
7994 AT_CLEANUP
7995
7996 AT_SETUP([ofproto-dpif - patch ports])
7997 OVS_VSWITCHD_START([add-br br1 \
7998 -- set bridge br1 datapath-type=dummy fail-mode=secure \
7999 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
8000 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
8001
8002 add_of_ports br0 2
8003 add_of_ports br1 3
8004
8005 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8006 ], [])
8007 AT_CHECK([ovs-appctl time/stop])
8008 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8009
8010 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
8011 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
8012
8013 for i in $(seq 1 10); do
8014 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)'
8015 if [[ $i -eq 1 ]]; then
8016 sleep 1
8017 fi
8018 done
8019
8020 for i in $(seq 1 5); do
8021 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)'
8022 if [[ $i -eq 1 ]]; then
8023 sleep 1
8024 fi
8025 done
8026
8027 AT_CHECK([ovs-appctl time/warp 500], [0],
8028 [warped
8029 ])
8030 sleep 1 # wait for log writer
8031
8032 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
8033 dummy@ovs-dummy: hit:13 missed:2
8034 br0:
8035 br0 65534/100: (dummy-internal)
8036 p2 2/2: (dummy)
8037 pbr0 1/none: (patch: peer=pbr1)
8038 br1:
8039 br1 65534/101: (dummy-internal)
8040 p3 3/3: (dummy)
8041 pbr1 1/none: (patch: peer=pbr0)
8042 ])
8043
8044 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8045 recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
8046 recirc_id(0),in_port(101),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
8047 ])
8048
8049 AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
8050 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
8051 ])
8052 AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
8053 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
8054 ])
8055
8056 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
8057 OFPST_PORT reply (xid=0x4): 1 ports
8058 port 1: rx pkts=5, bytes=530, drop=?, errs=?, frame=?, over=?, crc=?
8059 tx pkts=10, bytes=1060, drop=?, errs=?, coll=?
8060 ])
8061
8062 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
8063 OFPST_PORT reply (xid=0x4): 1 ports
8064 port 1: rx pkts=10, bytes=1060, drop=?, errs=?, frame=?, over=?, crc=?
8065 tx pkts=5, bytes=530, drop=?, errs=?, coll=?
8066 ])
8067
8068 OVS_VSWITCHD_STOP
8069 AT_CLEANUP
8070
8071 AT_SETUP([ofproto-dpif - patch ports - stack])
8072 OVS_VSWITCHD_START([add-br br1 \
8073 -- set bridge br1 datapath-type=dummy fail-mode=secure \
8074 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
8075 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
8076
8077 add_of_ports br0 2
8078 add_of_ports br1 3
8079
8080 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8081 ], [])
8082 AT_CHECK([ovs-appctl time/stop])
8083 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8084
8085 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"])
8086 # Try to pop from empty stack, and push and leave data to stack.
8087 AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
8088
8089 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)'
8090
8091 AT_CHECK([ovs-appctl time/warp 500], [0],
8092 [warped
8093 ])
8094
8095 OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
8096
8097 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
8098 dummy@ovs-dummy: hit:0 missed:1
8099 br0:
8100 br0 65534/100: (dummy-internal)
8101 p2 2/2: (dummy)
8102 pbr0 1/none: (patch: peer=pbr1)
8103 br1:
8104 br1 65534/101: (dummy-internal)
8105 p3 3/3: (dummy)
8106 pbr1 1/none: (patch: peer=pbr0)
8107 ])
8108
8109 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8110 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
8111 ])
8112
8113 AT_CHECK([grep -e '|ofproto_dpif_xlate|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
8114 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
8115 ])
8116
8117 OVS_VSWITCHD_STOP(["/stack underflow/d"])
8118 AT_CLEANUP
8119
8120 AT_SETUP([ofproto-dpif - port duration])
8121 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
8122 add_of_ports br0 1 2
8123
8124 ovs-appctl time/stop
8125 ovs-appctl time/warp 10000
8126
8127 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
8128 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
8129 [dnl
8130 duration=?s
8131 duration=?s
8132 duration=?s
8133 ])
8134 OVS_VSWITCHD_STOP
8135 AT_CLEANUP
8136
8137 dnl ----------------------------------------------------------------------
8138 AT_BANNER([ofproto-dpif -- megaflows])
8139
8140 AT_SETUP([ofproto-dpif megaflow - port classification])
8141 OVS_VSWITCHD_START
8142 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8143 add_of_ports br0 1 2
8144 AT_DATA([flows.txt], [dnl
8145 table=0 in_port=1 actions=output(2)
8146 ])
8147 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8148 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)'])
8149 sleep 1
8150 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)'])
8151 sleep 1
8152 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8153 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8154 ])
8155 OVS_VSWITCHD_STOP
8156 AT_CLEANUP
8157
8158 AT_SETUP([ofproto-dpif megaflow - L2 classification])
8159 OVS_VSWITCHD_START
8160 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8161 add_of_ports br0 1 2
8162 AT_DATA([flows.txt], [dnl
8163 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
8164 ])
8165 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8166 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)'])
8167 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)'])
8168 sleep 1
8169 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8170 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>
8171 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>
8172 ])
8173 OVS_VSWITCHD_STOP
8174 AT_CLEANUP
8175
8176 AT_SETUP([ofproto-dpif megaflow - L3 classification])
8177 OVS_VSWITCHD_START
8178 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8179 add_of_ports br0 1 2
8180 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], [])
8181 AT_DATA([flows.txt], [dnl
8182 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
8183 ])
8184 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8185 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)'])
8186 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)'])
8187 sleep 1
8188 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8189 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>
8190 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>
8191 ])
8192 OVS_VSWITCHD_STOP
8193 AT_CLEANUP
8194
8195 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
8196 OVS_VSWITCHD_START
8197 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8198 add_of_ports br0 1 2
8199 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], [])
8200 AT_DATA([flows.txt], [dnl
8201 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
8202 ])
8203 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8204 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)'])
8205 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)'])
8206 sleep 1
8207 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8208 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>
8209 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>
8210 ])
8211 OVS_VSWITCHD_STOP
8212 AT_CLEANUP
8213
8214 AT_SETUP([ofproto-dpif megaflow - L4 classification])
8215 OVS_VSWITCHD_START
8216 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8217 add_of_ports br0 1 2
8218 AT_DATA([flows.txt], [dnl
8219 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
8220 ])
8221 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8222 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)'])
8223 sleep 1
8224 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)'])
8225 sleep 1
8226 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8227 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>
8228 ])
8229 OVS_VSWITCHD_STOP
8230 AT_CLEANUP
8231
8232 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
8233 [AT_SETUP([ofproto-dpif megaflow - normal$1])
8234 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8235 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8236 func=`printf '%s_' "$1" | cut -c 4-`
8237 add_${func}of_ports br0 1 2
8238 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8239 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8240 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8241 sleep 1
8242 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8243 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>
8244 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>
8245 ])
8246 OVS_VSWITCHD_STOP
8247 AT_CLEANUP])
8248
8249 OFPROTO_DPIF_MEGAFLOW_NORMAL([])
8250 OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
8251
8252 AT_SETUP([ofproto-dpif megaflow - mpls])
8253 OVS_VSWITCHD_START
8254 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8255 add_of_ports br0 1 2
8256 AT_DATA([flows.txt], [dnl
8257 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
8258 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
8259 ])
8260 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8261 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)'])
8262 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)'])
8263 sleep 1
8264 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
8265 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
8266 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
8267 ])
8268 OVS_VSWITCHD_STOP
8269 AT_CLEANUP
8270
8271 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
8272 m4_define([CHECK_MEGAFLOW_NETFLOW],
8273 [OVS_VSWITCHD_START
8274 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8275 add_of_ports br0 1 2
8276
8277 dnl NetFlow configuration disables wildcarding relevant fields
8278 on_exit 'kill `cat test-netflow.pid`'
8279 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
8280 AT_CAPTURE_FILE([netflow.log])
8281 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
8282 ovs-vsctl \
8283 set Bridge br0 netflow=@nf -- \
8284 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
8285 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
8286
8287 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8288 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)'])
8289 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)'])
8290 sleep 1
8291 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8292 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>
8293 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>
8294 ])
8295 OVS_APP_EXIT_AND_WAIT([test-netflow])
8296 OVS_VSWITCHD_STOP])
8297
8298 AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
8299 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
8300 AT_CLEANUP
8301
8302 AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
8303 AT_SKIP_IF([test $HAVE_IPV6 = no])
8304 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
8305 AT_CLEANUP
8306
8307 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
8308 [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
8309 OVS_VSWITCHD_START(
8310 [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
8311 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
8312 set interface p2 type=$1 ofport_request=2 -- \
8313 set interface p3 type=$1 ofport_request=3], [], [],
8314 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
8315 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8316 ])
8317 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8318
8319 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8320 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)'])
8321 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)'])
8322 sleep 1
8323 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8324 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>
8325 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>
8326 ])
8327 OVS_VSWITCHD_STOP
8328 AT_CLEANUP])
8329
8330 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
8331 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
8332
8333 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
8334 OVS_VSWITCHD_START(
8335 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
8336 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
8337 set interface p2 type=dummy ofport_request=2 -- \
8338 set interface p3 type=dummy ofport_request=3])
8339 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8340 ])
8341 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8342
8343 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8344 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)'])
8345 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)'])
8346 sleep 1
8347 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8348 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>
8349 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>
8350 ])
8351 OVS_VSWITCHD_STOP
8352 AT_CLEANUP
8353
8354 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
8355 # Create bond0 on br0 with interfaces p0 and p1
8356 # and bond1 on br1 with interfaces p2 and p3
8357 # with p0 patched to p2 and p1 patched to p3.
8358 OVS_VSWITCHD_START(
8359 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
8360 other-config:lacp-time=fast \
8361 other-config:bond-rebalance-interval=0 -- \
8362 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
8363 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
8364 add-br br1 -- \
8365 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
8366 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
8367 fail-mode=secure -- \
8368 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
8369 other-config:lacp-time=fast \
8370 other-config:bond-rebalance-interval=0 -- \
8371 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
8372 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
8373
8374 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
8375 ])
8376 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8377 add_of_ports br0 7
8378 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
8379 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
8380 ovs-appctl time/stop
8381 ovs-appctl time/warp 5000
8382 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)'])
8383 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)'])
8384 sleep 1
8385 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8386 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>
8387 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>
8388 ])
8389 OVS_VSWITCHD_STOP
8390 AT_CLEANUP
8391
8392 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
8393 OVS_VSWITCHD_START
8394 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8395 add_of_ports br0 1 2
8396 AT_DATA([flows.txt], [dnl
8397 table=0 in_port=1,ip actions=resubmit(90)
8398 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
8399 ])
8400 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8401 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)'])
8402 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)'])
8403 sleep 1
8404 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8405 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>
8406 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>
8407 ])
8408 OVS_VSWITCHD_STOP
8409 AT_CLEANUP
8410
8411 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
8412 OVS_VSWITCHD_START
8413 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8414 add_of_ports br0 1 2
8415 AT_DATA([flows.txt], [dnl
8416 table=0 in_port=1,ip actions=resubmit(,1)
8417 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8418 ])
8419 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8420 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)'])
8421 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=
8422 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
8423 sleep 1
8424 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8425 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>
8426 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>
8427 ])
8428 OVS_VSWITCHD_STOP
8429 AT_CLEANUP
8430
8431 AT_SETUP([ofproto-dpif megaflow - goto_table action])
8432 OVS_VSWITCHD_START
8433 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8434 add_of_ports br0 1 2
8435 AT_DATA([flows.txt], [dnl
8436 table=0 in_port=1,ip actions=goto_table(1)
8437 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
8438 ])
8439 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
8440 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)'])
8441 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)'])
8442 sleep 1
8443 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8444 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>
8445 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>
8446 ])
8447 OVS_VSWITCHD_STOP
8448 AT_CLEANUP
8449
8450 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
8451 AT_KEYWORDS([mirror mirrors mirroring])
8452 OVS_VSWITCHD_START
8453 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8454 add_of_ports br0 1 2 3
8455 ovs-vsctl \
8456 set Bridge br0 mirrors=@m --\
8457 --id=@p3 get Port p3 --\
8458 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
8459
8460 AT_DATA([flows.txt], [dnl
8461 in_port=1 actions=output:2
8462 ])
8463 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8464 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)'])
8465 sleep 1
8466 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)'])
8467 sleep 1
8468 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8469 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8470 ])
8471 OVS_VSWITCHD_STOP
8472 AT_CLEANUP
8473
8474 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
8475 OVS_VSWITCHD_START
8476 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8477 add_of_ports br0 1 2 3
8478 ovs-vsctl \
8479 set Bridge br0 mirrors=@m --\
8480 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
8481 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
8482
8483 AT_DATA([flows.txt], [dnl
8484 in_port=1 actions=output:2
8485 ])
8486 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8487 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))'])
8488 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)'])
8489 sleep 1
8490 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8491 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
8492 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>
8493 ])
8494 OVS_VSWITCHD_STOP
8495 AT_CLEANUP
8496
8497 AT_SETUP([ofproto-dpif megaflow - move action])
8498 OVS_VSWITCHD_START
8499 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8500 add_of_ports br0 1 2
8501 AT_DATA([flows.txt], [dnl
8502 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
8503 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
8504 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
8505 ])
8506 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8507 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)'])
8508 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)'])
8509 sleep 1
8510 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8511 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>
8512 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>
8513 ])
8514 OVS_VSWITCHD_STOP
8515 AT_CLEANUP
8516
8517 AT_SETUP([ofproto-dpif megaflow - push action])
8518 OVS_VSWITCHD_START
8519 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8520 add_of_ports br0 1 2
8521 AT_DATA([flows.txt], [dnl
8522 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
8523 ])
8524 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8525 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)'])
8526 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)'])
8527 sleep 1
8528 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8529 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>
8530 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>
8531 ])
8532 OVS_VSWITCHD_STOP
8533 AT_CLEANUP
8534
8535 AT_SETUP([ofproto-dpif megaflow - learning])
8536 OVS_VSWITCHD_START
8537 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8538 add_of_ports br0 1 2
8539 AT_DATA([flows.txt], [dnl
8540 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
8541 ])
8542 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8543 ovs-appctl time/stop
8544 # We send each packet twice because the first packet in each flow causes the
8545 # flow table to change and thus revalidations, which (depending on timing)
8546 # can keep a megaflow from being installed. The revalidations are done by
8547 # the second iteration, allowing the flows to be installed.
8548 for i in 1 2; do
8549 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)'])
8550 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)'])
8551 ovs-appctl time/warp 100
8552 done
8553 sleep 1
8554 dnl The original flow is missing due to a revalidation.
8555 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8556 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>
8557 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>
8558 ])
8559 OVS_VSWITCHD_STOP
8560 AT_CLEANUP
8561
8562 AT_SETUP([ofproto-dpif megaflow - tunnels])
8563 OVS_VSWITCHD_START(
8564 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8565 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8566 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
8567 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
8568 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
8569 ofport_request=3])
8570 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
8571 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
8572 ofport_request=4 options:key=flow])
8573 AT_DATA([flows.txt], [dnl
8574 in_port=1,actions=output(2)
8575 in_port=3,actions=output(4)
8576 ])
8577 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8578 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
8579 dnl will cause the packet to be dropped.
8580 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)'])
8581 sleep 1
8582 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0x1,ttl=64,frag=no),icmp(type=8,code=0)'])
8583 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)'])
8584 sleep 1
8585 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)'])
8586 sleep 1
8587 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8588 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
8589 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
8590 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
8591 ])
8592 OVS_VSWITCHD_STOP
8593 AT_CLEANUP
8594
8595 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
8596 OVS_VSWITCHD_START
8597 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8598 add_of_ports br0 1 2
8599 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], [])
8600 AT_DATA([flows.txt], [dnl
8601 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
8602 ])
8603 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8604 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)'])
8605 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)'])
8606 sleep 1
8607 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8608 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>
8609 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>
8610 ])
8611 OVS_VSWITCHD_STOP
8612 AT_CLEANUP
8613
8614 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
8615 OVS_VSWITCHD_START
8616 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8617 add_of_ports br0 1 2
8618 AT_DATA([flows.txt], [dnl
8619 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
8620 ])
8621 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8622 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)'])
8623 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)'])
8624 sleep 1
8625 dnl The first packet is essentially a no-op, as the new destination MAC is the
8626 dnl same as the original. The second entry actually updates the destination
8627 dnl MAC.
8628 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8629 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
8630 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
8631 ])
8632 OVS_VSWITCHD_STOP
8633 AT_CLEANUP
8634
8635 m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
8636 [AT_SETUP([ofproto-dpif megaflow - disabled$1])
8637 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8638 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8639 func=`printf '%s_' "$1" | cut -c 4-`
8640 add_${func}of_ports br0 1 2
8641 AT_DATA([flows.txt], [dnl
8642 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
8643 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
8644 ])
8645 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8646 ], [])
8647 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8648 ], [])
8649 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
8650 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8651 for i in 1 2 3 4; do
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 if [[ $i -eq 1 ]]; then
8655 sleep 1
8656 fi
8657 done
8658 sleep 1
8659 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8660 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
8661 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
8662 ])
8663 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
8664 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
8665 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
8666 ])
8667 OVS_VSWITCHD_STOP
8668 AT_CLEANUP])
8669
8670 OFPROTO_DPIF_MEGAFLOW_DISABLED([])
8671 OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
8672
8673 AT_SETUP([ofproto-dpif - datapath port number change])
8674 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
8675 add_of_ports br0 1
8676
8677 # Trace a flow that should output to p1.
8678 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8679 [0], [stdout])
8680 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
8681 ])
8682
8683 # Change p1's port number to 5.
8684 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
8685
8686 # Trace a flow that should output to p1 in its new location.
8687 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8688 [0], [stdout])
8689 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
8690 ])
8691 OVS_VSWITCHD_STOP
8692 AT_CLEANUP
8693
8694 # Tests the bundling with various bfd and cfm configurations.
8695 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
8696 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
8697 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
8698 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
8699 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
8700 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
8701 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
8702 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
8703 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
8704 set Interface p0 cfm_mpid=1 -- \
8705 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
8706
8707 ovs-appctl time/stop
8708 # advance the clock to stablize everything.
8709 ovs-appctl time/warp 5000 100
8710 # cfm/show should show 'recv' fault.
8711 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8712 fault: recv
8713 ])
8714 # bfd/show should show 'up'.
8715 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8716 Local Session State: up
8717 Remote Session State: up
8718 Local Session State: up
8719 Remote Session State: up
8720 ])
8721 # bond/show should show 'may-enable: true' for all slaves.
8722 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8723 may_enable: true
8724 may_enable: true
8725 may_enable: true
8726 may_enable: true
8727 ])
8728
8729 # now disable the bfd on p1.
8730 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
8731 # advance the clock to stablize everything.
8732 ovs-appctl time/warp 5000 100
8733 # cfm/show should show 'recv' fault.
8734 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8735 fault: recv
8736 ])
8737 # bfd/show should show 'down'.
8738 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8739 Local Session State: down
8740 Remote Session State: down
8741 ])
8742 # bond/show should show 'may-enable: false' for p0.
8743 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8744 may_enable: false
8745 may_enable: true
8746 ])
8747
8748 # now enable the bfd on p1 and disable bfd on p0.
8749 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
8750 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
8751 # advance the clock to stablize everything.
8752 ovs-appctl time/warp 5000 100
8753 # cfm/show should show 'recv' fault.
8754 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8755 fault: recv
8756 ])
8757 # bfd/show should show 'down'.
8758 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8759 Local Session State: down
8760 Remote Session State: down
8761 ])
8762 # bond/show should show 'may-enable: false' for p0 and p1.
8763 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8764 may_enable: false
8765 may_enable: true
8766 may_enable: false
8767 may_enable: true
8768 ])
8769
8770 OVS_VSWITCHD_STOP
8771 AT_CLEANUP
8772
8773 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
8774 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
8775
8776 # enable bfd on p0.
8777 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8778 # check log.
8779 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8780 # disable bfd on p0.
8781 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8782 # check log.
8783 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8784 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])
8785
8786 # enable cfm on p0.
8787 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
8788 # check log.
8789 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8790 # disable cfm on p0.
8791 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
8792 # check log.
8793 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8794 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])
8795
8796 # enable both bfd and cfm on p0.
8797 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
8798 # check log.
8799 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8800 # disable bfd on p0.
8801 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8802 # check log, there should not be the log of thread terminated.
8803 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
8804 ])
8805 # reenable bfd on p0.
8806 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8807 # check log, should still be on log of thread created.
8808 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
8809 monitor thread created
8810 ])
8811 # disable bfd and cfm together.
8812 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
8813 # check log.
8814 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8815
8816 OVS_VSWITCHD_STOP
8817 AT_CLEANUP
8818
8819 # this test helps avoid the deadlock between the main thread and monitor thread.
8820 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
8821 OVS_VSWITCHD_START
8822
8823 for i in `seq 1 199`
8824 do
8825 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])
8826 done
8827
8828 OVS_VSWITCHD_STOP
8829 AT_CLEANUP
8830 \f
8831 AT_BANNER([ofproto-dpif - flow translation resource limits])
8832
8833 dnl Resubmits to later tables do not count against the depth limit, so we
8834 dnl can do 99 of them even though the maximum depth is 64.
8835 AT_SETUP([ofproto-dpif - forward resubmit])
8836 OVS_VSWITCHD_START
8837 (for i in `seq 0 99`; do
8838 j=`expr $i + 1`
8839 echo "table=$i, actions=resubmit(,$j)"
8840 done
8841 echo "table=100, actions=local") > flows
8842 AT_CHECK([ovs-ofctl add-flows br0 flows])
8843 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8844 [0], [stdout])
8845 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
8846 ])
8847 OVS_VSWITCHD_STOP
8848 AT_CLEANUP
8849
8850 dnl Resubmits to the same or an earlier table count against the depth limit,
8851 dnl so only 64 of them are allowed.
8852 AT_SETUP([ofproto-dpif - backward resubmit])
8853 OVS_VSWITCHD_START
8854 (echo "table=0, actions=resubmit(,66)"
8855 for i in `seq 2 66`; do
8856 j=`expr $i - 1`
8857 echo "table=$i, actions=resubmit(,$j)"
8858 done
8859 echo "table=1, actions=local") > flows
8860 AT_CHECK([ovs-ofctl add-flows br0 flows])
8861 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8862 [0], [stdout])
8863 AT_CHECK([tail -1 stdout], [0],
8864 [Translation failed (Recursion too deep), packet is dropped.
8865 ])
8866 AT_CHECK([grep -c 'over max translation depth 64' stdout],
8867 [0], [1
8868 ])
8869 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8870 AT_CLEANUP
8871
8872 AT_SETUP([ofproto-dpif - infinite resubmit])
8873 OVS_VSWITCHD_START
8874 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
8875 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8876 [0], [stdout])
8877 AT_CHECK([tail -1 stdout], [0],
8878 [Translation failed (Recursion too deep), packet is dropped.
8879 ])
8880 AT_CHECK([grep -c 'over max translation depth 64' stdout],
8881 [0], [1
8882 ])
8883 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8884 AT_CLEANUP
8885
8886 dnl Without using ofproto/trace, make sure the
8887 dnl ofproto trace is still logged
8888 AT_SETUP([ofproto-dpif - backward resubmit without trace])
8889 OVS_VSWITCHD_START
8890 (echo "table=0, actions=resubmit(,66)"
8891 for i in `seq 2 66`; do
8892 j=`expr $i - 1`
8893 echo "table=$i, actions=resubmit(,$j)"
8894 done
8895 echo "table=1, actions=local") > flows
8896 AT_CHECK([ovs-ofctl add-flows br0 flows])
8897
8898 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])
8899
8900 OVS_WAIT_UNTIL([grep 'packet is dropped' ovs-vswitchd.log])
8901
8902 dnl make sure the full ofproto trace dump is present
8903 AT_CHECK([grep -c "^ *resubmit" ovs-vswitchd.log],
8904 [0], [66
8905 ])
8906
8907 OVS_VSWITCHD_STOP(["/over max translation depth/d
8908 /ofproto_dpif_upcall/d"])
8909 AT_CLEANUP
8910
8911 AT_SETUP([ofproto-dpif - exponential resubmit chain])
8912 OVS_VSWITCHD_START
8913 add_of_ports br0 1
8914 (for i in `seq 1 64`; do
8915 j=`expr $i + 1`
8916 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8917 done
8918 echo "in_port=65, actions=local") > flows
8919 AT_CHECK([ovs-ofctl add-flows br0 flows])
8920 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8921 AT_CHECK([tail -1 stdout], [0],
8922 [Translation failed (Too many resubmits), packet is dropped.
8923 ])
8924 AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
8925 ])
8926 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
8927 AT_CLEANUP
8928
8929 AT_SETUP([ofproto-dpif - too many output actions])
8930 OVS_VSWITCHD_START
8931 add_of_ports br0 1
8932 (for i in `seq 1 12`; do
8933 j=`expr $i + 1`
8934 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8935 done
8936 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
8937 AT_CHECK([ovs-ofctl add-flows br0 flows])
8938 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8939 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
8940 [0], [1
8941 ])
8942 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
8943 ])
8944 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
8945 AT_CLEANUP
8946
8947 AT_SETUP([ofproto-dpif - stack too deep])
8948 OVS_VSWITCHD_START
8949 add_of_ports br0 1
8950 (for i in `seq 1 12`; do
8951 j=`expr $i + 1`
8952 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8953 done
8954 push="push:NXM_NX_REG0[[]]"
8955 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
8956 AT_CHECK([ovs-ofctl add-flows br0 flows])
8957 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8958 AT_CHECK([tail -1 stdout], [0],
8959 [Translation failed (Stack too deep), packet is dropped.
8960 ])
8961 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
8962 ])
8963 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
8964 AT_CLEANUP
8965
8966
8967 AT_SETUP([ofproto-dpif packet-out controller])
8968 OVS_VSWITCHD_START
8969 add_of_ports br0 1 2
8970
8971 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
8972
8973 AT_CAPTURE_FILE([ofctl_monitor.log])
8974 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8975
8976 for i in 1 2 3; do
8977 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
8978 done
8979
8980 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8981 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8982 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
8983 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8984 dnl
8985 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
8986 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8987 dnl
8988 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
8989 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8990 ])
8991
8992 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
8993 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8994 NXST_FLOW reply:
8995 ])
8996
8997 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0],
8998 [OFPST_TABLE reply (OF1.3) (xid=0x2):
8999 table 0:
9000 active=1, lookup=0, matched=0
9001
9002 table 1:
9003 active=0, lookup=0, matched=0
9004
9005 tables 2...253: ditto
9006 ])
9007
9008 OVS_VSWITCHD_STOP
9009 AT_CLEANUP
9010
9011 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
9012 OVS_VSWITCHD_START(
9013 [-- \
9014 add-port br0 p1 -- \
9015 set interface p1 type=patch options:peer=p2 -- \
9016 add-br br1 -- \
9017 set bridge br1 datapath-type=dummy -- \
9018 set bridge br1 fail-mode=secure -- \
9019 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
9020 add-port br1 p2 -- \
9021 set interface p2 type=patch options:peer=p1 --])
9022
9023 AT_CAPTURE_FILE([ofctl_monitor.log])
9024 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9025
9026 for i in 1 2 3; do
9027 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
9028 done
9029
9030 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9031 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9032 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
9033 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9034 dnl
9035 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
9036 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9037 dnl
9038 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
9039 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9040 ])
9041
9042 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9043 OFPST_TABLE reply (OF1.3) (xid=0x2):
9044 table 0:
9045 active=0, lookup=0, matched=0
9046
9047 tables 1...253: ditto
9048 ])
9049
9050 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1], [0], [dnl
9051 OFPST_TABLE reply (OF1.3) (xid=0x2):
9052 table 0:
9053 active=0, lookup=3, matched=0
9054
9055 table 1:
9056 active=0, lookup=0, matched=0
9057
9058 tables 2...253: ditto
9059 ])
9060
9061 OVS_VSWITCHD_STOP
9062 AT_CLEANUP
9063
9064 AT_SETUP([ofproto-dpif packet-out pipeline match field (OpenFlow 1.5)])
9065 OVS_VSWITCHD_START
9066
9067 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=8}->tun_metadata2"])
9068 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata3"])
9069 AT_DATA([flows.txt], [dnl
9070 table=0,in_port=1 actions=controller
9071 table=0,tun_id=3 actions=controller
9072 table=0,metadata=5 actions=controller
9073 table=0,reg0=1,reg4=2,reg8=3,reg12=5 actions=controller
9074 table=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 actions=controller
9075 table=0,tun_metadata3=0x11 actions=controller
9076 ])
9077 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
9078
9079 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
9080 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
9081 ovs-appctl -t ovs-ofctl ofctl/barrier
9082 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
9083 AT_CAPTURE_FILE([monitor.log])
9084
9085 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=1 packet=0001020304050010203040501111 actions=table"])
9086 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tunnel_id=3 packet=0001020304050010203040502222 actions=table"])
9087 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,metadata=5 packet=0001020304050010203040503333 actions=table"])
9088 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,reg0=1,reg4=2,reg8=3,reg12=5 packet=0001020304050010203040503333 actions=table"])
9089 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"])
9090 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_metadata2=0x22,tun_metadata3=0x11 packet=0001020304050010203040503333 actions=table"])
9091
9092 ovs-appctl -t ovs-ofctl ofctl/barrier
9093 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9094
9095 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
9096 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 in_port=1 (via packet_out) data_len=14 (unbuffered)
9097 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1111
9098 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_id=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
9099 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x2222
9100 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 metadata=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
9101 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9102 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)
9103 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9104 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)
9105 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9106 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)
9107 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
9108 OFPT_BARRIER_REPLY (OF1.5):
9109 ])
9110
9111 OVS_VSWITCHD_STOP
9112 AT_CLEANUP
9113
9114 AT_SETUP([ofproto-dpif packet-out goto_table])
9115 OVS_VSWITCHD_START
9116 add_of_ports br0 1 2
9117
9118 AT_DATA([flows.txt], [dnl
9119 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
9120 table=1 dl_dst=50:54:00:00:00:0a actions=controller
9121 ])
9122 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
9123
9124 AT_CAPTURE_FILE([ofctl_monitor.log])
9125 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9126
9127 for i in 1 2 3; do
9128 ovs-appctl 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)'
9129 done
9130
9131 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
9132 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9133 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9134 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9135 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9136 dnl
9137 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9138 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9139 dnl
9140 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9141 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9142 ])
9143
9144 AT_CHECK([ovs-appctl revalidator/purge], [0])
9145 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
9146 n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=goto_table:1
9147 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9148 OFPST_FLOW reply (OF1.3):
9149 ])
9150
9151 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9152 OFPST_TABLE reply (OF1.3) (xid=0x2):
9153 table 0:
9154 active=1, lookup=3, matched=3
9155
9156 table 1: ditto
9157
9158 table 2:
9159 active=0, lookup=0, matched=0
9160
9161 tables 3...253: ditto
9162 ])
9163
9164 OVS_VSWITCHD_STOP
9165 AT_CLEANUP
9166
9167
9168 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
9169 OVS_VSWITCHD_START
9170 add_of_ports br0 1 2
9171
9172 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
9173 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
9174
9175 AT_CAPTURE_FILE([ofctl_monitor.log])
9176 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9177
9178 for i in 1 2 3; do
9179 ovs-appctl 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)'
9180 done
9181
9182 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
9183 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9184 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9185 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9186 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9187 dnl
9188 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9189 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9190 dnl
9191 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
9192 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
9193 ])
9194
9195 AT_CHECK([ovs-appctl revalidator/purge], [0])
9196 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
9197 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
9198 OFPST_FLOW reply (OF1.1):
9199 ])
9200
9201 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0], [0], [dnl
9202 OFPST_TABLE reply (OF1.3) (xid=0x2):
9203 table 0:
9204 active=0, lookup=3, matched=0
9205
9206 table 1:
9207 active=1, lookup=3, matched=3
9208
9209 table 2:
9210 active=0, lookup=0, matched=0
9211
9212 tables 3...253: ditto
9213 ])
9214
9215 OVS_VSWITCHD_STOP
9216 AT_CLEANUP
9217
9218 AT_SETUP([ofproto-dpif - ICMPv6])
9219 OVS_VSWITCHD_START
9220 add_of_ports br0 1
9221
9222 AT_CAPTURE_FILE([ofctl_monitor.log])
9223
9224 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9225
9226 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9227
9228 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9229
9230 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9231 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
9232 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
9233 ])
9234
9235 OVS_VSWITCHD_STOP
9236 AT_CLEANUP
9237
9238 AT_SETUP([ofproto-dpif - ICMPv6 type match])
9239 OVS_VSWITCHD_START
9240 add_of_ports br0 1 2 3
9241
9242 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
9243 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
9244
9245 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9246
9247 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)'])
9248 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)'])
9249 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)'])
9250 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)'])
9251
9252 AT_CHECK([ovs-appctl revalidator/purge], [0])
9253
9254 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9255 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
9256 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
9257 ])
9258
9259 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
9260 n_packets=2, n_bytes=252, icmp6,icmp_type=128 actions=output:2
9261 n_packets=2, n_bytes=252, icmp6,icmp_type=129 actions=output:3
9262 NXST_FLOW reply:
9263 ])
9264
9265 OVS_VSWITCHD_STOP
9266 AT_CLEANUP
9267
9268 AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
9269 OVS_VSWITCHD_START
9270 add_of_ports br0 1
9271 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])
9272
9273 AT_CAPTURE_FILE([ofctl_monitor.log])
9274
9275 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9276
9277 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
9278
9279 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9280
9281 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9282 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
9283 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
9284 ])
9285
9286 OVS_VSWITCHD_STOP
9287 AT_CLEANUP
9288
9289 # Tests the exact match of CFI bit in installed datapath flows matching VLAN.
9290 AT_SETUP([ofproto-dpif - vlan matching])
9291 OVS_VSWITCHD_START(
9292 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
9293 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9294
9295 AT_CHECK([ovs-ofctl del-flows br0])
9296 AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
9297
9298 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))'])
9299
9300 OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
9301 AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
9302 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>
9303 ])
9304 OVS_VSWITCHD_STOP
9305 AT_CLEANUP
9306
9307 # Tests in place modification of installed datapath flows.
9308 AT_SETUP([ofproto-dpif - in place modification])
9309 OVS_VSWITCHD_START(
9310 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9311 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9312
9313 AT_CHECK([ovs-ofctl del-flows br0])
9314 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
9315
9316 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9317
9318 ovs-appctl time/stop
9319
9320 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)'])
9321
9322 # Wait for the flow setup to be done.
9323 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9324
9325 for i in 1 2; do
9326 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
9327 done
9328
9329 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9330 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
9331 ])
9332
9333 AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
9334
9335 ovs-appctl time/warp 500
9336 ovs-appctl time/warp 500
9337
9338 for i in 1 2 3; do
9339 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
9340 done
9341
9342 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9343 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
9344 ])
9345
9346 AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
9347 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
9348 ])
9349 OVS_VSWITCHD_STOP
9350 AT_CLEANUP
9351
9352 # Tests in place modification of installed datapath flows with vlans.
9353 AT_SETUP([ofproto-dpif - in place modification (vlan)])
9354 OVS_VSWITCHD_START(
9355 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
9356 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9357
9358 # Always drop misses
9359 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all drop])
9360 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
9361
9362 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
9363
9364 ovs-appctl time/stop
9365
9366 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)'])
9367
9368 # Check that a correct datapath flow is created.
9369 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
9370
9371 for i in 1 2; do
9372 ovs-appctl 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)'
9373 done
9374
9375 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9376 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:100
9377 ])
9378
9379 # Delete the flow. Then check that the datapath flow is modified to
9380 # drop the packets. A modified flow inherits the stats, a new
9381 # datapath flow would start from sero.
9382 AT_CHECK([ovs-ofctl del-flows br0])
9383
9384 ovs-appctl time/warp 500
9385 ovs-appctl time/warp 500
9386
9387 for i in 1 2 3; do
9388 ovs-appctl 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)'
9389 done
9390
9391 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9392 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:drop
9393 ])
9394
9395 # Add a flow that matches the non-presence of a vlan tag, and check
9396 # that the datapath flow is modified accordingly.
9397 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
9398
9399 ovs-appctl time/warp 500
9400 ovs-appctl time/warp 500
9401
9402 for i in 1 2 3; do
9403 ovs-appctl 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)'
9404 done
9405
9406 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9407 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9408 ])
9409
9410 # Check that VLAN packets will not hit the same datapath megaflow.
9411
9412 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))'])
9413 OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
9414
9415 for i in 1 2; do
9416 ovs-appctl 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))'
9417 done
9418
9419 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
9420 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
9421 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
9422 ])
9423
9424 # Check that the new flow matches the CFI bit, while both vid and pcp
9425 # are wildcarded.
9426 AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
9427 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), actions:100
9428 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)
9429 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
9430 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
9431 ])
9432 OVS_VSWITCHD_STOP
9433 AT_CLEANUP
9434
9435 AT_SETUP([ofproto-dpif - trace (unchanged)])
9436 OVS_VSWITCHD_START
9437 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
9438 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9439 ])
9440 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
9441 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
9442 ])
9443
9444 OVS_VSWITCHD_STOP
9445 AT_CLEANUP
9446
9447 AT_SETUP([ofproto-dpif - conntrack - controller])
9448 OVS_VSWITCHD_START
9449
9450 add_of_ports br0 1 2
9451
9452 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9453
9454 dnl Allow new UDP connections on p1 for dst port 2, drop everything else.
9455 AT_DATA([flows.txt], [dnl
9456 dnl Table 0
9457 dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2).
9458 dnl
9459 table=0,priority=100,arp,action=normal
9460 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)
9461 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)
9462 table=0,priority=1,action=drop
9463 dnl
9464 dnl Pass tracked traffic through ACL, drop everything else.
9465 dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers
9466 dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets
9467 dnl get the ACL lookup using the conntrack tuple and the inverted direction.
9468 dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
9469 dnl of the master connection, as storted in ct_mark.
9470 dnl
9471 dnl Incoming non-related packet in the original direction (ACL IN)
9472 table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5
9473 dnl Incoming non-related reply packet (CT ACL OUT)
9474 table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4
9475 dnl Outgoing non-related packet (ACL OUT)
9476 table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5
9477 dnl Outgoing non-related reply packet (CT ACL IN)
9478 table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
9479 dnl
9480 dnl Related packet (CT ACL in the direction of the master connection.)
9481 table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
9482 dnl Drop everything else.
9483 table=1 priority=0, action=drop
9484 dnl
9485 dnl "ACL table"
9486 dnl
9487 dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with
9488 dnl UDP destination port '2'. Store rule ID (1234) in reg1, verdict
9489 dnl in reg2.
9490 table=3 priority=10, reg0=1, udp, udp_dst=2 action=set_field:1234->reg1,set_field:1->reg2
9491 dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235)
9492 table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2
9493 dnl
9494 dnl Re-process stateful traffic that was not accepted by a stateful rule as
9495 dnl normal traffic in the current direction. This should also delete the
9496 dnl now stale conntrack state, so that new state can be created in it's place.
9497 dnl
9498 dnl Stateful accepts go to next table.
9499 table=4 priority=100 reg2=1, action=goto_table:5
9500 dnl Everything else is reprocessed disregarding the CT state, using the actual
9501 dnl packet direction.
9502 table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5
9503 dnl
9504 dnl "ACL verdict processing table."
9505 dnl
9506 dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0)
9507 dnl
9508 dnl Drop all non-accepted packets.
9509 table=5 reg2=0 priority=1000 action=drop
9510 dnl Commit new non-related IP connections.
9511 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
9512 dnl Commit new related connections in either direction, which inherit the mark
9513 dnl (the direction of the original direction master tuple) from the master
9514 dnl connection.
9515 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
9516 dnl Forward everything else, including stateless accepts.
9517 table=5 priority=0 action=goto_table:6
9518 dnl
9519 dnl "Forwarding table"
9520 dnl
9521 table=6 action=controller
9522 ])
9523
9524 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9525
9526 AT_CAPTURE_FILE([ofctl_monitor.log])
9527 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9528
9529 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)'])
9530
9531 dnl OK, now start a new connection from port 1.
9532 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)'])
9533
9534 dnl Now try a reply from port 2.
9535 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)'])
9536
9537 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9538 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9539
9540 dnl Check this output. We only see the latter two packets, not the first.
9541 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9542 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)
9543 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
9544 dnl
9545 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)
9546 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
9547 ])
9548
9549 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9550
9551 dnl OK, now start a second connection from port 1
9552 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)'])
9553
9554 dnl Now try a reply from port 2.
9555 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)'])
9556
9557
9558 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9559 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9560
9561 dnl Check this output. We should see both packets
9562 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9563 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)
9564 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
9565 dnl
9566 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)
9567 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
9568 ])
9569
9570 OVS_VSWITCHD_STOP
9571 AT_CLEANUP
9572
9573 AT_SETUP([ofproto-dpif - conntrack - force commit])
9574 OVS_VSWITCHD_START
9575
9576 add_of_ports br0 1 2
9577
9578 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9579
9580 dnl Allow new connections on p1->p2, but not on p2->p1.
9581 AT_DATA([flows.txt], [dnl
9582 dnl Table 0
9583 dnl
9584 table=0,priority=100,arp,action=normal
9585 table=0,priority=10,in_port=1,udp,action=ct(commit),controller
9586 table=0,priority=10,in_port=2,udp,action=ct(table=1)
9587 table=0,priority=1,action=drop
9588 dnl
9589 dnl Table 1
9590 dnl
9591 table=1,priority=10,in_port=2,ct_state=+est,udp,action=ct(force,commit),controller
9592 table=1,priority=1,action=drop
9593 ])
9594
9595 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9596
9597 AT_CAPTURE_FILE([ofctl_monitor.log])
9598 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9599
9600 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)'])
9601
9602 dnl OK, now start a new connection from port 1.
9603 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)'])
9604
9605 dnl Now try a reply from port 2.
9606 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)'])
9607
9608 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9609 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9610
9611 dnl Check this output. We only see the latter two packets, not the first.
9612 dnl Note that the first packet doesn't have the ct_state bits set. This
9613 dnl happens because the ct_state field is available only after recirc.
9614 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9615 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9616 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
9617 dnl
9618 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9619 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
9620 ])
9621
9622 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9623
9624 dnl OK, now start a second connection from port 1
9625 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)'])
9626
9627 dnl Now try a reply from port 2.
9628 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)'])
9629
9630 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9631 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9632
9633 dnl Check this output. We should see both packets
9634 dnl Note that the first packet doesn't have the ct_state bits set. This
9635 dnl happens because the ct_state field is available only after recirc.
9636 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9637 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9638 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
9639 dnl
9640 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
9641 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
9642 ])
9643
9644 dnl
9645 dnl Check that the directionality has been changed by force commit.
9646 dnl
9647 AT_CHECK([ovs-appctl dpctl/dump-conntrack | sort], [], [dnl
9648 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)
9649 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)
9650 ])
9651
9652 OVS_VSWITCHD_STOP
9653 AT_CLEANUP
9654
9655 AT_SETUP([ofproto-dpif - conntrack - ipv6])
9656 OVS_VSWITCHD_START
9657
9658 add_of_ports br0 1 2
9659
9660 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9661
9662 dnl Allow new connections on p1->p2, but not on p2->p1.
9663 AT_DATA([flows.txt], [dnl
9664 dnl Table 0
9665 dnl
9666 table=0,priority=100,arp,action=normal
9667 table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
9668 table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
9669 table=0,priority=1,action=drop
9670 dnl Table 1
9671 dnl
9672 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
9673 table=1,priority=1,action=drop
9674 ])
9675
9676 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9677
9678 AT_CAPTURE_FILE([ofctl_monitor.log])
9679 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9680
9681 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)'])
9682
9683 dnl OK, now start a new connection from port 1.
9684 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)'])
9685
9686 dnl Now try a reply from port 2.
9687 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)'])
9688
9689 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9690 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9691
9692 dnl Check this output. We only see the latter two packets, not the first.
9693 dnl Note that the first packet doesn't have the ct_state bits set. This
9694 dnl happens because the ct_state field is available only after recirc.
9695 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9696 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=126 in_port=1 (via action) data_len=126 (unbuffered)
9697 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
9698 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)
9699 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
9700 ])
9701
9702 OVS_VSWITCHD_STOP
9703 AT_CLEANUP
9704
9705 AT_SETUP([ofproto-dpif - conntrack - output action])
9706 OVS_VSWITCHD_START
9707
9708 add_of_ports br0 1 2
9709
9710 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9711
9712 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9713 AT_DATA([flows.txt], [dnl
9714 dnl The flows are in two separate tables for two reasons:
9715 dnl * To make the pipeline more clear.
9716 dnl * To make megaflows more consistent (we check megaflows below). The
9717 dnl unwildcarding in megaflows depends on the internal ordering of the
9718 dnl subtables, which are sorted using the system qsort(). qsort()
9719 dnl is provided by libc and may or may not be stable, so we can't rely
9720 dnl on that. By having separate tables we have more control over which
9721 dnl subtables are visited, meaning consistent megaflows.
9722 dnl
9723 dnl Table 0
9724 dnl
9725 table=0,priority=100,arp,action=normal
9726 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
9727 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9728 table=0,priority=1,action=drop
9729 dnl
9730 dnl Table 1
9731 dnl
9732 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
9733 table=1,priority=1,action=drop
9734 ])
9735
9736 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9737
9738
9739 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)'])
9740
9741 dnl OK, now start a new connection from port 1.
9742 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)'])
9743
9744 dnl Now try a reply from port 2.
9745 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)'])
9746
9747 dnl OK, now start a second connection from port 1
9748 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)'])
9749
9750 dnl Now try a reply from port 2.
9751 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)'])
9752
9753
9754 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9755 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
9756 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
9757 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
9758 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct,recirc(0x1)
9759 ])
9760
9761 OVS_VSWITCHD_STOP
9762 AT_CLEANUP
9763
9764 AT_SETUP([ofproto-dpif - conntrack - expiration])
9765 OVS_VSWITCHD_START
9766
9767 add_of_ports br0 1 2
9768
9769 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9770
9771 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9772 AT_DATA([flows.txt], [dnl
9773 dnl Table 0
9774 dnl
9775 table=0,priority=100,arp,action=normal
9776 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
9777 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9778 table=0,priority=1,action=drop
9779 dnl
9780 dnl Table 1
9781 dnl
9782 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9783 table=1,priority=1,action=drop
9784 ])
9785
9786 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9787
9788 AT_CAPTURE_FILE([ofctl_monitor.log])
9789 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9790
9791 AT_CHECK([ovs-appctl time/stop])
9792
9793 dnl Start a new connection from port 1.
9794 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)'])
9795
9796 dnl Now try a reply from port 2.
9797 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)'])
9798
9799 ovs-appctl time/warp 100000
9800
9801 dnl Now try another reply from port 2.
9802 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)'])
9803
9804 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
9805 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9806
9807 dnl Check this output. Only one reply must be there
9808 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9809 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)
9810 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
9811 dnl
9812 OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
9813 ])
9814
9815 OVS_VSWITCHD_STOP
9816 AT_CLEANUP
9817
9818 AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
9819 OVS_VSWITCHD_START
9820
9821 add_of_ports br0 1 2
9822
9823 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9824
9825 AT_DATA([flows.txt], [dnl
9826 ipv6,ct_state=-trk,action=ct(table=0,zone=0)
9827 ct_state=+trk,action=controller
9828 ])
9829
9830 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9831
9832 AT_CAPTURE_FILE([ofctl_monitor.log])
9833 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9834
9835 AT_CHECK([ovs-appctl time/stop])
9836
9837 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
9838
9839 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
9840 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9841
9842 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9843 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,ipv6,in_port=2 (via action) data_len=86 (unbuffered)
9844 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
9845 ])
9846
9847 OVS_VSWITCHD_STOP
9848 AT_CLEANUP
9849
9850 AT_SETUP([ofproto-dpif - conntrack - zones])
9851 OVS_VSWITCHD_START
9852
9853 add_of_ports br0 1 2 3 4
9854
9855 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9856
9857 dnl Allow new connections on p1->p2 or p3->p4.
9858 dnl Allow only established connections p2->p1 and p4->p3
9859 dnl p1,p2 and p3,p4 are on different zones
9860 AT_DATA([flows.txt], [dnl
9861 dnl Table 0
9862 dnl
9863 table=0,priority=100,arp,action=normal
9864 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
9865 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9866 table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
9867 table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
9868 table=0,priority=1,action=drop
9869 dnl
9870 dnl Table 1
9871 dnl
9872 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9873 table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
9874 table=1,priority=1,action=drop
9875 ])
9876
9877 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9878
9879 AT_CAPTURE_FILE([ofctl_monitor.log])
9880 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9881
9882 dnl Basic "only established" test on ports 1,2
9883
9884 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)'])
9885 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)'])
9886 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)'])
9887
9888 dnl Now use the same 5-tuples but on ports 3,4
9889
9890 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)'])
9891 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)'])
9892 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)'])
9893
9894 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9895 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9896
9897 dnl Check this output. We only see the latter two packets (for each zone), not the first.
9898 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9899 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9900 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
9901 dnl
9902 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)
9903 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
9904 dnl
9905 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=3 (via action) data_len=106 (unbuffered)
9906 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
9907 dnl
9908 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)
9909 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
9910 ])
9911
9912 OVS_VSWITCHD_STOP
9913 AT_CLEANUP
9914
9915 AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
9916 OVS_VSWITCHD_START
9917
9918 add_of_ports br0 1 2
9919
9920 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9921
9922 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9923 AT_DATA([flows.txt], [dnl
9924 dnl Table 0
9925 dnl
9926 table=0,priority=100,arp,action=normal
9927 table=0,priority=10,udp,action=ct(table=1,zone=0)
9928 table=0,priority=1,action=drop
9929 dnl
9930 dnl Table 1
9931 dnl
9932 table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
9933 table=1,priority=10,ct_state=+trk+est,udp,action=controller
9934 table=1,priority=1,action=drop
9935 ])
9936
9937 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9938
9939 AT_CAPTURE_FILE([ofctl_monitor.log])
9940 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9941
9942 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)'])
9943
9944 dnl OK, now start a new connection from port 1.
9945 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)'])
9946
9947 dnl Now try a reply from port 2.
9948 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)'])
9949
9950 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9951 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9952
9953 dnl Check this output. We only see the latter two packets, not the first.
9954 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9955 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
9956 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
9957 dnl
9958 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)
9959 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
9960 ])
9961
9962 OVS_VSWITCHD_STOP
9963 AT_CLEANUP
9964
9965 AT_SETUP([ofproto-dpif - conntrack - ICMP related])
9966 OVS_VSWITCHD_START
9967
9968 add_of_ports br0 1 2
9969
9970 dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
9971 AT_DATA([flows.txt], [dnl
9972 dnl Table 0
9973 dnl
9974 table=0,priority=100,arp,action=normal
9975 table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
9976 table=0,priority=10,ip,in_port=2,action=ct(table=1)
9977 table=0,priority=1,action=drop
9978 dnl
9979 dnl Table 1
9980 dnl
9981 table=1,priority=10,in_port=1,ct_state=+trk,action=controller
9982 table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
9983 table=1,priority=1,action=drop
9984 ])
9985
9986 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9987
9988 AT_CAPTURE_FILE([ofctl_monitor.log])
9989 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9990
9991 dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
9992 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
9993
9994 dnl 2. Send and UDP packet to port 5555
9995 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
9996
9997 dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
9998 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
9999
10000 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10001 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10002
10003 dnl Check this output. We only see the first and the last packet
10004 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10005 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)
10006 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
10007 dnl
10008 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)
10009 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
10010 ])
10011
10012 OVS_VSWITCHD_STOP
10013 AT_CLEANUP
10014
10015 AT_SETUP([ofproto-dpif - conntrack - ct_mark])
10016 OVS_VSWITCHD_START
10017
10018 add_of_ports br0 1 2
10019
10020 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10021
10022 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10023 AT_DATA([flows.txt], [dnl
10024 dnl Table 0
10025 dnl
10026 table=0,arp,action=normal
10027 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
10028 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
10029 table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
10030 table=0,ip,in_port=2,actions=ct(table=1)
10031 table=0,priority=0,action=drop
10032 dnl
10033 dnl Table 1
10034 dnl
10035 table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
10036 table=1,priority=1,action=drop
10037 ])
10038
10039 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10040
10041 AT_CAPTURE_FILE([ofctl_monitor.log])
10042 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10043
10044 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)'])
10045 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)'])
10046 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)'])
10047
10048 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)'])
10049 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)'])
10050 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)'])
10051
10052 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
10053 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10054
10055 dnl Check this output.
10056 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10057 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10058 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
10059 dnl
10060 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10061 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
10062 dnl
10063 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10064 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
10065 dnl
10066 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)
10067 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
10068 dnl
10069 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)
10070 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
10071 ])
10072
10073 OVS_VSWITCHD_STOP
10074 AT_CLEANUP
10075
10076 AT_SETUP([ofproto-dpif - conntrack - ct_label])
10077 OVS_VSWITCHD_START
10078
10079 add_of_ports br0 1 2
10080
10081 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10082
10083 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10084 AT_DATA([flows.txt], [dnl
10085 dnl Table 0
10086 dnl
10087 table=0,arp,action=normal
10088 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
10089 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
10090 table=0,ip,in_port=2,actions=ct(table=1)
10091 dnl
10092 dnl Table 1
10093 dnl
10094 table=1,priority=10,ct_state=+trk+rpl,actions=controller
10095 table=1,priority=1,action=drop
10096 ])
10097
10098 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10099
10100 AT_CAPTURE_FILE([ofctl_monitor.log])
10101 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10102
10103 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)'])
10104 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)'])
10105
10106 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)'])
10107 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)'])
10108
10109 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
10110 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10111
10112 dnl Check this output.
10113 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10114 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)
10115 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
10116 dnl
10117 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)
10118 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
10119 ])
10120
10121 OVS_VSWITCHD_STOP
10122 AT_CLEANUP
10123
10124 AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
10125 OVS_VSWITCHD_START
10126
10127 add_of_ports br0 1 2
10128
10129 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10130
10131 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10132 AT_DATA([flows.txt], [dnl
10133 dnl The flows are in two separate tables for two reasons:
10134 dnl * To make the pipeline more clear.
10135 dnl * To make megaflows more consistent (we check megaflows below). The
10136 dnl unwildcarding in megaflows depends on the internal ordering of the
10137 dnl subtables, which are sorted using the system qsort(). qsort()
10138 dnl is provided by libc and may or may not be stable, so we can't rely
10139 dnl on that. By having separate tables we have more control over which
10140 dnl subtables are visited, meaning consistent megaflows.
10141 dnl
10142 dnl Table 0
10143 dnl
10144 table=0,arp,action=normal
10145 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
10146 table=0,ip,in_port=2,actions=ct(table=1)
10147 table=0,priority=0,action=drop
10148 dnl
10149 dnl Table 1
10150 dnl
10151 table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
10152 table=1,priority=1,action=drop
10153 ])
10154
10155 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10156
10157 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)'])
10158 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)'])
10159
10160 # Give time for logs to appear.
10161 ovs-appctl revalidator/wait
10162
10163 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
10164 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
10165 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
10166 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
10167 ])
10168
10169 OVS_VSWITCHD_STOP
10170 AT_CLEANUP
10171
10172 AT_SETUP([ofproto-dpif - conntrack - no output])
10173 OVS_VSWITCHD_START
10174
10175 add_of_ports br0 1
10176
10177 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10178
10179 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10180 AT_DATA([flows.txt], [dnl
10181 in_port=1,udp,action=ct(commit,zone=0)
10182 ])
10183
10184 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10185
10186 dnl Start a new connection from port 1.
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
10189 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
10190 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
10191 ])
10192
10193 OVS_VSWITCHD_STOP
10194 AT_CLEANUP
10195
10196 AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
10197 OVS_VSWITCHD_START
10198
10199 add_of_ports br0 1 2
10200
10201 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10202
10203 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10204 AT_DATA([flows.txt], [dnl
10205 dnl Table 0
10206 dnl
10207 table=0,priority=100,arp,action=normal
10208 table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10209 table=0,priority=10,in_port=2,ip,action=ct(table=1)
10210 table=0,priority=1,action=drop
10211 dnl
10212 dnl Table 1
10213 dnl
10214 dnl The following two flows are separated to explicitly count the packets
10215 dnl that create a new connection
10216 table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10217 table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
10218 dnl
10219 table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10220 table=1,ip,ct_state=+trk+inv,action=drop
10221 ])
10222
10223 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10224
10225 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10226 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10227 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10228 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
10229 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10230 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10231 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10232 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10233 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10234
10235 AT_CHECK([ovs-appctl revalidator/purge])
10236 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10237 dnl Only one new connection
10238 n_packets=1
10239 ])
10240
10241 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
10242 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
10243 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
10244 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
10245 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
10246 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
10247 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
10248 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
10249 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
10250
10251 AT_CHECK([ovs-appctl revalidator/purge])
10252 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10253 dnl Two new connections
10254 n_packets=2
10255 ])
10256
10257 OVS_VSWITCHD_STOP
10258 AT_CLEANUP
10259
10260 AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
10261 OVS_VSWITCHD_START
10262
10263 add_of_ports br0 1 2
10264
10265 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10266
10267 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10268 AT_DATA([flows.txt], [dnl
10269 dnl Table 0
10270 dnl
10271 table=0,priority=100,arp,action=normal
10272 table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
10273 table=0,priority=10,in_port=2,tcp,action=ct(table=1)
10274 table=0,priority=1,action=drop
10275 dnl
10276 dnl Table 1
10277 dnl
10278 table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
10279 table=1,priority=1,action=drop
10280 ])
10281
10282 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10283
10284 AT_CHECK([ovs-appctl revalidator/purge])
10285 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10286 dnl No dropped packets
10287 n_packets=0
10288 ])
10289
10290 AT_CAPTURE_FILE([ofctl_monitor.log])
10291 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10292
10293 dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
10294 dnl sure that the connection tracker is able to pick up already established
10295 dnl connections that use window scaling.
10296 dnl
10297 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
10298 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
10299 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
10300 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
10301 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
10302 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a08004500022afc284000400626a10a0101020a01010100020001396bb35b8cadbdb45018000a941f0000 dnl
10303 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10304 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10305 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10306 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10307 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10308 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10309 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10310 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10311 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
10312 6666666666666666666666666666666666666666666666666666660a'])
10313 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
10314 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a5054000000090800450001fdf2ca40004006302c0a0101010a010102000100028cadbdb4396bb55d5018000aa60c0000 dnl
10315 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10316 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10317 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10318 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10319 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10320 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10321 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10322 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
10323 6565656565656565656565656565656565656565656565656565656565656565656565650a'])
10324 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
10325 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
10326 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
10327 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
10328 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
10329
10330 AT_CHECK([ovs-appctl revalidator/purge])
10331
10332 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10333
10334 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10335 ])
10336
10337 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10338 dnl No dropped packets
10339 n_packets=0
10340 ])
10341
10342 OVS_VSWITCHD_STOP
10343 AT_CLEANUP
10344
10345 AT_SETUP([ofproto-dpif - conntrack - disable tcp sequence checking])
10346 OVS_VSWITCHD_START
10347
10348 add_of_ports br0 1 2
10349
10350 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
10351 AT_DATA([flows.txt], [dnl
10352 dnl Table 0
10353 dnl
10354 table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
10355 table=0,priority=10,in_port=2,ip,action=ct(table=1)
10356 table=0,priority=1,action=drop
10357 dnl
10358 dnl Table 1
10359 dnl
10360 dnl The following two flows are separated to explicitly count the packets
10361 dnl that create a new connection
10362 table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
10363 table=1,priority=100,cookie=0x2,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
10364 dnl
10365 table=1,priority=100,cookie=0x3,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
10366 table=1,cookie=0x4,ip,ct_state=+trk+inv,action=drop
10367 ])
10368
10369 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10370
10371 dnl Send 9 packets; one packet will be marked invalid.
10372 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10373 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10374 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10375 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10376 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10377 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10378 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10379 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10380 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10381
10382 AT_CHECK([ovs-appctl revalidator/purge])
10383 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10384 n_packets=1
10385 ])
10386
10387 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10388 n_packets=4
10389 ])
10390
10391 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10392 n_packets=3
10393 ])
10394
10395 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10396 n_packets=1
10397 ])
10398
10399 AT_CHECK([ovs-appctl dpctl/flush-conntrack])
10400
10401 AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10402 TCP sequence checking: enabled
10403 ])
10404
10405 AT_CHECK([ovs-appctl dpctl/ct-disable-tcp-seq-chk], [], [dnl
10406 disabling TCP sequence checking successful
10407 ])
10408
10409 AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10410 TCP sequence checking: disabled
10411 ])
10412
10413 dnl Send exactly the same 9 packets to confirm no additional packets are marked invalid.
10414 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10415 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10416 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10417 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10418 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10419 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10420 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10421 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10422 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10423
10424 AT_CHECK([ovs-appctl revalidator/purge])
10425 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10426 n_packets=2
10427 ])
10428
10429 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10430 n_packets=8
10431 ])
10432
10433 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10434 n_packets=7
10435 ])
10436
10437 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10438 n_packets=1
10439 ])
10440
10441 AT_CHECK([ovs-appctl dpctl/ct-enable-tcp-seq-chk], [], [dnl
10442 enabling TCP sequence checking successful
10443 ])
10444
10445 AT_CHECK([ovs-appctl dpctl/ct-get-tcp-seq-chk], [], [dnl
10446 TCP sequence checking: enabled
10447 ])
10448
10449 AT_CHECK([ovs-appctl dpctl/flush-conntrack])
10450
10451 dnl Send exactly the same 9 packets after disabling TCP sequence checking to
10452 dnl confirm one more packet is marked invalid.
10453 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
10454 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
10455 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
10456 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200010000000000000000501872106a7300007061796c6f61640a'])
10457 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
10458 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
10459 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
10460 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
10461 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
10462
10463 AT_CHECK([ovs-appctl revalidator/purge])
10464 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10465 n_packets=3
10466 ])
10467
10468 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x2 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10469 n_packets=12
10470 ])
10471
10472 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x3 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10473 n_packets=10
10474 ])
10475
10476 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x4 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
10477 n_packets=2
10478 ])
10479
10480 OVS_VSWITCHD_STOP
10481 AT_CLEANUP
10482
10483 dnl This is a truncated version of "ofproto-dpif - conntrack - controller",
10484 dnl with extra send-to-controller actions following ct_clear to show that
10485 dnl the connection tracking data has been cleared.
10486 AT_SETUP([ofproto-dpif - conntrack - ct_clear])
10487 OVS_VSWITCHD_START
10488
10489 add_of_ports br0 1 2
10490
10491 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
10492
10493 dnl Allow new connections on p1->p2, but not on p2->p1.
10494 AT_DATA([flows.txt], [dnl
10495 dnl Table 0
10496 dnl
10497 table=0,priority=100,arp,action=normal
10498 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller,ct_clear,controller
10499 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
10500 table=0,priority=1,action=drop
10501 dnl
10502 dnl Table 1
10503 dnl
10504 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller,ct_clear,controller
10505 table=1,priority=1,action=drop
10506 ])
10507
10508 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10509
10510 AT_CAPTURE_FILE([ofctl_monitor.log])
10511 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
10512
10513 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)'])
10514
10515 dnl OK, now start a new connection from port 1.
10516 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)'])
10517
10518 dnl Now try a reply from port 2.
10519 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)'])
10520
10521 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
10522 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
10523
10524 dnl Check this output. We only see the latter two packets, not the first.
10525 dnl Note that the first packet doesn't have the ct_state bits set. This
10526 dnl happens because the ct_state field is available only after recirc.
10527 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
10528 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10529 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
10530 dnl
10531 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=106 in_port=1 (via action) data_len=106 (unbuffered)
10532 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
10533 dnl
10534 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)
10535 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
10536 dnl
10537 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=106 in_port=2 (via action) data_len=106 (unbuffered)
10538 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
10539 ])
10540 OVS_VSWITCHD_STOP
10541 AT_CLEANUP
10542
10543 AT_SETUP([ofproto-dpif - conntrack - ofproto/trace])
10544 OVS_VSWITCHD_START
10545
10546 add_of_ports br0 1 2 3 4
10547
10548 AT_DATA([flows.txt], [dnl
10549 dnl Table 0
10550 dnl
10551 table=0,priority=100,arp,action=normal
10552 table=0,priority=10,udp,action=ct(table=1,zone=0)
10553 table=0,priority=10,tcp,action=ct(table=2,zone=1)
10554 table=0,priority=1,action=drop
10555 dnl
10556 dnl Table 1
10557 dnl
10558 table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+new,udp,action=ct(commit,zone=0),2
10559 table=1,priority=10,in_port=1,ct_zone=0,ct_state=+trk+est,udp,action=2
10560 table=1,priority=10,in_port=2,ct_zone=0,ct_state=+trk+est,udp,action=1
10561 table=1,priority=1,action=drop
10562 dnl
10563 dnl Table 2
10564 dnl
10565 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)
10566 table=2,priority=10,in_port=1,tcp,ct_zone=1,ct_state=+trk+est,tcp,action=ct(table=3,zone=2)
10567 table=2,priority=1,action=drop
10568 dnl
10569 dnl Table 3
10570 dnl
10571 table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+new,tcp,action=ct(commit,zone=2),4
10572 table=3,priority=10,in_port=1,tcp,ct_zone=2,ct_state=+trk+est,tcp,action=3
10573 table=2,priority=1,action=drop
10574 ])
10575
10576 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10577
10578 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,udp'], [0], [stdout])
10579 AT_CHECK([tail -1 stdout], [0],
10580 [Datapath actions: drop
10581 ])
10582
10583 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,udp'], [0], [stdout])
10584 AT_CHECK([tail -1 stdout], [0],
10585 [Datapath actions: ct(commit),2
10586 ])
10587
10588 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp'], [0], [stdout])
10589 AT_CHECK([tail -1 stdout], [0],
10590 [Datapath actions: ct(commit,zone=2),4
10591 ])
10592
10593 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp' --ct-next 'trk,est' --ct-next 'trk,est' ], [0], [stdout])
10594 AT_CHECK([tail -1 stdout], [0],
10595 [Datapath actions: 3
10596 ])
10597
10598 OVS_VSWITCHD_STOP
10599 AT_CLEANUP
10600
10601 AT_SETUP([ofproto - set mtu])
10602 OVS_VSWITCHD_START
10603
10604 add_of_ports br0 1
10605
10606 # Check that initial MTU is 1500 for 'br0' and 'p1'.
10607 AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
10608 1500
10609 ])
10610 AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
10611 1500
10612 ])
10613
10614 # Request new MTU for 'p1'
10615 AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
10616
10617 # Check that the new MTU is applied
10618 AT_CHECK([ovs-vsctl wait-until Interface p1 mtu=1600])
10619 # The internal port 'br0' should have the same MTU value as p1, becase it's
10620 # the new bridge minimum.
10621 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1600])
10622
10623 AT_CHECK([ovs-vsctl del-port br0 p1])
10624
10625 # When 'p1' is deleted, the internal port should return to the default MTU
10626 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1500])
10627
10628 # New port with 'mtu_request' in the same transaction.
10629 AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
10630 AT_CHECK([ovs-vsctl wait-until Interface p2 mtu=1600])
10631 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1600])
10632
10633 # Explicitly set mtu_request on the internal interface. This should prevent
10634 # the MTU from being overriden.
10635 AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
10636 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1700])
10637
10638 # The new MTU on p2 should not affect br0.
10639 AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
10640 AT_CHECK([ovs-vsctl wait-until Interface p2 mtu=1400])
10641 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1700])
10642
10643 # Remove explicit mtu_request from br0. Now it should track the bridge
10644 # minimum again.
10645 AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
10646 AT_CHECK([ovs-vsctl wait-until Interface br0 mtu=1400])
10647
10648 OVS_VSWITCHD_STOP
10649 AT_CLEANUP
10650
10651 AT_SETUP([ofproto - fragment prerequisites])
10652 OVS_VSWITCHD_START
10653
10654 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
10655
10656 add_of_ports br0 1
10657
10658 AT_DATA([flows.txt], [dnl
10659 priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
10660 priority=1,in_port=1,udp,action=drop
10661 ])
10662
10663 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
10664
10665 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
10666
10667 ovs-appctl time/stop
10668 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
10669 ovs-appctl time/warp 5000
10670
10671 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
10672 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
10673 ])
10674
10675 dnl Change the flow table. This will trigger revalidation of all the flows.
10676 AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
10677 AT_CHECK([ovs-appctl revalidator/wait], [0])
10678
10679 dnl We don't want revalidators to delete any flow. If the flow has been
10680 dnl deleted it means that there's some inconsistency with the revalidation.
10681 AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
10682
10683 OVS_VSWITCHD_STOP
10684 AT_CLEANUP
10685
10686 AT_SETUP([ofproto-dpif - check_pkt_larger action])
10687 OVS_VSWITCHD_START
10688 add_of_ports br0 1 2 3 4
10689
10690 AT_DATA([flows.txt], [dnl
10691 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10692 table=1,in_port=1,reg0=0x1/0x1 actions=output:2,resubmit(,2)
10693 table=1,in_port=1,actions=output:3,resubmit(,2)
10694 table=2,in_port=1,actions=mod_dl_dst:82:82:82:82:82:82,output:4
10695 ])
10696
10697 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10698 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])
10699 AT_CHECK([tail -1 stdout], [0], [dnl
10700 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))
10701 ])
10702
10703 dnl Test flow xlate check_pkt_large clone action without using datapath check_pkt_len action.
10704 AT_CHECK([ovs-appctl dpif/set-dp-features br0 check_pkt_len false], [0], [ignore])
10705
10706 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])
10707 AT_CHECK([tail -3 stdout], [0], [dnl
10708 Datapath actions: 3,set(eth(dst=82:82:82:82:82:82)),4
10709 This flow is handled by the userspace slow path because it:
10710 - Uses action(s) not supported by datapath.
10711 ])
10712
10713 dnl Enable datapath check_pkt_len action
10714 AT_CHECK([ovs-appctl dpif/set-dp-features br0 check_pkt_len true], [0], [ignore])
10715
10716 ovs-ofctl del-flows br0
10717
10718 AT_DATA([flows.txt], [dnl
10719 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10720 table=1,in_port=1,priority=200,reg0=0x1/0x1 actions=output:2
10721 ])
10722
10723 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10724 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])
10725 AT_CHECK([tail -1 stdout], [0], [dnl
10726 Datapath actions: check_pkt_len(size=200,gt(2),le(drop))
10727 ])
10728
10729 ovs-ofctl del-flows br0
10730 AT_DATA([flows.txt], [dnl
10731 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]]
10732 ])
10733
10734 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10735 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])
10736 AT_CHECK([tail -1 stdout], [0], [dnl
10737 Datapath actions: check_pkt_len(size=200,gt(drop),le(drop))
10738 ])
10739
10740 ovs-ofctl del-flows br0
10741 AT_DATA([flows.txt], [dnl
10742 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10743 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
10744 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
10745 ])
10746
10747 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10748 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])
10749 AT_CHECK([tail -1 stdout], [0], [dnl
10750 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))
10751 ])
10752
10753 AT_DATA([flows.txt], [dnl
10754 table=0,priority=0 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10755 table=1,in_port=1,priority=200,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src, resubmit(,0))
10756 table=1,in_port=1,priority=0,ip actions=clone(set_field:192.168.3.4->ip_src, resubmit(,0))
10757 ])
10758
10759 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10760 ovs-ofctl dump-flows br0
10761
10762 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])
10763 AT_CHECK([tail -3 stdout], [0], [dnl
10764 Megaflow: recirc_id=0,eth,ip,reg0=0/0x1,in_port=1,nw_src=10.10.10.2,nw_frag=no
10765 Datapath actions: drop
10766 Translation failed (Recursion too deep), packet is dropped.
10767 ])
10768
10769 ovs-ofctl del-flows br0
10770 AT_DATA([flows.txt], [dnl
10771 table=0,priority=0 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10772 table=1,ip,nw_src=192.168.3.3 actions=output:3
10773 table=1,ip,nw_src=192.168.3.4 actions=output:4
10774 table=1,reg0=0x1/0x1,ip actions=clone(set_field:192.168.3.3->ip_src, resubmit(,0))
10775 table=1,ip actions=clone(set_field:192.168.3.4->ip_src, resubmit(,0))
10776 ])
10777
10778 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10779 ovs-ofctl dump-flows br0
10780
10781 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])
10782 AT_CHECK([tail -1 stdout], [0], [dnl
10783 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))))
10784 ])
10785
10786 ovs-ofctl del-flows br0
10787 AT_DATA([flows.txt], [dnl
10788 table=0,in_port=1 actions=check_pkt_larger(200)->NXM_NX_REG0[[0]],resubmit(,1)
10789 table=1,in_port=1,reg0=0x1/0x1 actions=mod_dl_dst:82:82:82:82:82:82,controller(),resubmit(,2)
10790 table=1,in_port=1 actions=resubmit(,2)
10791 table=2,ip,dl_dst=82:82:82:82:82:82 actions=ct(table=3)
10792 table=2,ip,dl_dst=50:54:00:00:00:0a actions=ct(table=3)
10793 table=3,ip,reg0=0x1/0x1 actions=output:2
10794 table=3,ip actions=output:4
10795 ])
10796
10797 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10798 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])
10799 AT_CHECK([cat stdout | grep Datapath -B1], [0], [dnl
10800 Megaflow: recirc_id=0,eth,ip,in_port=1,dl_dst=50:54:00:00:00:0a,nw_frag=no
10801 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)))
10802 --
10803 Megaflow: recirc_id=0x2,eth,ip,in_port=1,nw_frag=no
10804 Datapath actions: 2
10805 --
10806 Megaflow: recirc_id=0x3,eth,ip,in_port=1,nw_frag=no
10807 Datapath actions: 4
10808 ])
10809
10810 OVS_VSWITCHD_STOP
10811 AT_CLEANUP
10812
10813 AT_SETUP([ofproto-dpif - check_pkt_larger with continuation and ct])
10814 OVS_VSWITCHD_START
10815 add_of_ports --pcap br0 `seq 1 4`
10816
10817 AT_CAPTURE_FILE([ofctl_monitor0.log])
10818 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
10819
10820 AT_DATA([flows.txt], [dnl
10821 table=0,in_port=1 actions=check_pkt_larger(150)->NXM_NX_REG0[[0]],resubmit(,1)
10822 table=1,ip,reg0=0x1/0x1 actions=mod_dl_dst:82:82:82:82:82:82,controller(pause),resubmit(,2)
10823 table=1,ip,reg0=0 actions=mod_dl_dst:83:83:83:83:83:83,controller(pause),resubmit(,2)
10824 table=2,ip,dl_dst=82:82:82:82:82:82 actions=ct(table=3)
10825 table=2,ip,dl_dst=83:83:83:83:83:83 actions=ct(table=3)
10826 table=3,ip,reg0=0x1/0x1 actions=ct(commit),output:2
10827 table=3,ip actions=ct(commit),output:4
10828 ])
10829
10830 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flows br0 flows.txt])
10831
10832 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)"
10833
10834 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
10835
10836 OVS_WAIT_UNTIL([test 1 = `ovs-ofctl parse-pcap p4-tx.pcap \
10837 | grep dl_dst=83:83:83:83:83:83 | wc -l`])
10838 AT_CHECK([test 0 = `ovs-ofctl parse-pcap p2-tx.pcap | wc -l`])
10839
10840 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow" --len 200], [0], [stdout])
10841
10842 OVS_WAIT_UNTIL([test 1 = `ovs-ofctl parse-pcap p2-tx.pcap \
10843 | grep dl_dst=82:82:82:82:82:82 | wc -l`])
10844 AT_CHECK([test 1 = `ovs-ofctl parse-pcap p2-tx.pcap | wc -l`])
10845
10846 OVS_VSWITCHD_STOP
10847 AT_CLEANUP