9b94f3d848a09b41386726f4e56148c2381452b8
[cascardo/ovs.git] / tests / ofproto-dpif.at
1 AT_BANNER([ofproto-dpif])
2
3 AT_SETUP([ofproto-dpif - revalidator/wait])
4 OVS_VSWITCHD_START
5 AT_CHECK([ovs-appctl revalidator/wait])
6 OVS_VSWITCHD_STOP
7 AT_CLEANUP
8
9 AT_SETUP([ofproto-dpif - active-backup bonding])
10 # Create br0 with interfaces p1, p2 and p7, creating bond0 with p1 and p2
11 #    and br1 with interfaces p3, p4 and p8.
12 # toggle p1,p2 of bond0 up and down to test bonding in active-backup mode.
13 OVS_VSWITCHD_START(
14   [add-bond br0 bond0 p1 p2 bond_mode=active-backup --\
15    set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
16    set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
17    add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
18    add-br br1 -- \
19    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
20    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
21                   fail-mode=secure -- \
22    add-port br1 p3 -- set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
23    add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
24    add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
25 WAIT_FOR_DUMMY_PORTS([p3], [p4])
26 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
27
28 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
29 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
30 ovs-appctl netdev-dummy/set-admin-state up
31 ovs-appctl time/warp 100
32 ovs-appctl netdev-dummy/set-admin-state p2 down
33 ovs-appctl time/stop
34 ovs-appctl time/warp 100
35 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)'])
36 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)'])
37 ovs-appctl time/warp 100
38 ovs-appctl netdev-dummy/set-admin-state p2 up
39 ovs-appctl netdev-dummy/set-admin-state p1 down
40 ovs-appctl time/warp 100
41 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)'])
42 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)'])
43 ovs-appctl time/warp 200 100
44 sleep 1
45 AT_CHECK([grep 'in_port([[348]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
46 recirc_id(0),in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
47 recirc_id(0),in_port(3),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
48 recirc_id(0),in_port(4),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0d),eth_type(0x0800),ipv4(frag=no), actions: <del>
49 recirc_id(0),in_port(4),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(frag=no), actions: <del>
50 recirc_id(0),in_port(4),eth(src=50:54:00:00:00:09,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), actions: <del>
51 recirc_id(0),in_port(4),eth(src=50:54:00:00:00:0b,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), actions: <del>
52 ])
53 OVS_VSWITCHD_STOP
54 AT_CLEANUP
55
56 AT_SETUP([ofproto-dpif - balance-slb bonding])
57 # Create br0 with interfaces bond0(p1, p2, p3) and p7,
58 #    and br1 with interfaces p4, p5, p6 and p8.
59 #    p1 <-> p4, p2 <-> p5, p3 <-> p6
60 # Send some traffic, make sure the traffic are spread based on source mac.
61 OVS_VSWITCHD_START(
62   [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-slb --\
63    set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
64    set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
65    set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
66    add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
67    add-br br1 -- \
68    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
69    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
70                   fail-mode=secure -- \
71    add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
72    add-port br1 p5 -- set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
73    add-port br1 p6 -- set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
74    add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
75 WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
76 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
77 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
78 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
79 ])
80 ovs-appctl time/stop
81 ovs-appctl time/warp 100
82 (
83 for i in `seq 0 100 |xargs printf '%02x\n'`;
84     do
85     pkt="in_port(7),eth(src=50:54:00:00:00:$i,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)"
86     AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
87     done
88 )
89 ovs-appctl time/warp 100
90 AT_CHECK([ovs-appctl dpif/dump-flows br1 > br1_flows.txt])
91 # Make sure there is resonable distribution to all three ports.
92 # We don't want to make this check precise, in case hash function changes.
93 AT_CHECK([test `egrep 'in_port\(4\)' br1_flows.txt |wc -l` -gt 3])
94 AT_CHECK([test `egrep 'in_port\(5\)' br1_flows.txt |wc -l` -gt 3])
95 AT_CHECK([test `egrep 'in_port\(6\)' br1_flows.txt |wc -l` -gt 3])
96 OVS_VSWITCHD_STOP
97 AT_CLEANUP
98
99 AT_SETUP([ofproto-dpif - balance-tcp bonding])
100 # Create br0 with interfaces bond0(p1, p2, p3) and p7,
101 #    and br1 with interfaces bond1(p4, p5, p6) and p8.
102 #    bond0 <-> bond1
103 # Send some traffic, make sure the traffic are spread based on L4 headers.
104 OVS_VSWITCHD_START(
105   [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-tcp lacp=active \
106         other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
107    set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
108    set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
109    set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
110    add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
111    add-br br1 -- \
112    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
113    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
114                   fail-mode=secure -- \
115    add-bond br1 bond1 p4 p5 p6 bond_mode=balance-tcp lacp=active \
116         other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
117    set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
118    set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
119    set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
120    add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
121 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
122 ])
123 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
124 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
125 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
126 ], [])
127 OVS_WAIT_WHILE([ovs-appctl bond/show | grep "may_enable: false"])
128 ovs-appctl time/stop
129 ovs-appctl time/warp 100
130 ovs-appctl lacp/show > lacp.txt
131 ovs-appctl bond/show > bond.txt
132 (
133 for i in `seq 0 255` ;
134     do
135     pkt="in_port(7),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=$i),tcp_flags(ack)"
136     AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
137     done
138 )
139 ovs-appctl time/warp 300 100
140 AT_CHECK([ovs-appctl dpif/dump-flows br0 |grep tcp > br0_flows.txt])
141 AT_CHECK([ovs-appctl dpif/dump-flows br1 |grep tcp > br1_flows.txt])
142 # Make sure there is resonable distribution to all three ports.
143 # We don't want to make this check precise, in case hash function changes.
144 AT_CHECK([test `grep in_port.4 br1_flows.txt |wc -l` -gt 24])
145 AT_CHECK([test `grep in_port.5 br1_flows.txt |wc -l` -gt 24])
146 AT_CHECK([test `grep in_port.6 br1_flows.txt |wc -l` -gt 24])
147
148 OVS_VSWITCHD_STOP()
149 AT_CLEANUP
150
151 # Makes sure recirculation does not change the way packet is handled.
152 AT_SETUP([ofproto-dpif - balance-tcp bonding, different recirc flow ])
153 OVS_VSWITCHD_START(
154   [add-bond br0 bond0 p1 p2 bond_mode=balance-tcp lacp=active \
155        other-config:lacp-time=fast other-config:bond-rebalance-interval=0 -- \
156    set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
157    set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
158    add-br br1 -- \
159    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
160    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
161        fail-mode=standalone -- \
162    add-bond br1 bond1 p3 p4 bond_mode=balance-tcp lacp=active \
163        other-config:lacp-time=fast other-config:bond-rebalance-interval=0 -- \
164    set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
165    set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
166    add-port br1 br1- -- set interface br1- type=patch options:peer=br1+ ofport_request=100 -- \
167    add-br br-int -- \
168    set bridge br-int other-config:hwaddr=aa:77:aa:77:00:00 -- \
169    set bridge br-int datapath-type=dummy other-config:datapath-id=1235 \
170        fail-mode=secure -- \
171    add-port br-int br1+ -- set interface br1+ type=patch options:peer=br1- ofport_request=101 -- \
172    add-port br-int p5 -- set interface p5 ofport_request=5 type=dummy
173 ])
174 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
175 ])
176
177 # Waits for all ifaces enabled.
178 OVS_WAIT_UNTIL([test `ovs-appctl bond/show | grep -- "may_enable: true" |  wc -l` -ge 4])
179
180 # The dl_vlan flow should not be ever matched,
181 # since recirculation should not change the flow handling.
182 AT_DATA([flows.txt], [dnl
183 table=0 priority=1 in_port=5 actions=mod_vlan_vid:1,output(101)
184 table=0 priority=2 in_port=5 dl_vlan=1 actions=drop
185 ])
186 AT_CHECK([ovs-ofctl add-flows br-int flows.txt])
187
188 # Sends a packet to trigger recirculation.
189 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)"])
190
191 # Collects flow stats.
192 AT_CHECK([ovs-appctl revalidator/purge], [0])
193
194 # Checks the flow stats in br1, should only be one flow with non-zero
195 # 'n_packets' from internal table.
196 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
197 table_id=254, n_packets=1, n_bytes=64, priority=20,recirc_id=0x0,dp_hash=0x0/0xff,actions=output
198 ])
199
200 # Checks the flow stats in br-int, should be only one match.
201 AT_CHECK([ovs-ofctl dump-flows br-int | ofctl_strip | sort], [0], [dnl
202  n_packets=1, n_bytes=60, priority=1,in_port=5 actions=mod_vlan_vid:1,output:101
203  priority=2,in_port=5,dl_vlan=1 actions=drop
204 NXST_FLOW reply:
205 ])
206
207 OVS_VSWITCHD_STOP()
208 AT_CLEANUP
209
210 AT_SETUP([ofproto-dpif - resubmit])
211 OVS_VSWITCHD_START
212 add_of_ports br0 1 10 11 12 13 14 15 16 17 18 19 20 21
213 AT_DATA([flows.txt], [dnl
214 table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21)
215 table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18)
216 table=0 in_port=3 priority=2000 icmp actions=output(20)
217 table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15)
218 table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2)
219 table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2)
220 ])
221 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
222 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])
223 AT_CHECK([tail -1 stdout], [0],
224   [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
225 ])
226 OVS_VSWITCHD_STOP
227 AT_CLEANUP
228
229 AT_SETUP([ofproto-dpif - goto table])
230 OVS_VSWITCHD_START
231 add_of_ports br0 1 10 11
232 echo "table=0 in_port=1 actions=output(10),goto_table(1)" > flows.txt
233 for i in `seq 1 63`; do echo "table=$i actions=goto_table($(($i+1)))"; done >> flows.txt
234 echo "table=64 actions=output(11)" >> flows.txt
235 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
236 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])
237 AT_CHECK([tail -1 stdout], [0],
238   [Datapath actions: 10,11
239 ])
240 OVS_VSWITCHD_STOP
241 AT_CLEANUP
242
243 AT_SETUP([ofproto-dpif - write actions])
244 OVS_VSWITCHD_START
245 add_of_ports br0 1 10 11 12 13
246 AT_DATA([flows.txt], [dnl
247 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
248 table=1 ip actions=write_actions(output(13)),goto_table(2)
249 table=2 ip actions=set_field:192.168.3.91->ip_src,output(11)
250 ])
251 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
252 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])
253 AT_CHECK([tail -2 stdout], [0],
254   [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
255 Datapath actions: 10,set(ipv4(src=192.168.3.91)),11,set(ipv4(src=192.168.3.90)),13
256 ])
257 OVS_VSWITCHD_STOP
258 AT_CLEANUP
259
260 AT_SETUP([ofproto-dpif - modify IPv6 Neighbor Solitication (ND)])
261 OVS_VSWITCHD_START
262 add_of_ports br0 1 10 11 12 13
263 AT_DATA([flows.txt], [dnl
264 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)
265 table=1 icmp6 actions=write_actions(output(13)),goto_table(2)
266 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)
267 ])
268 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
269 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])
270 AT_CHECK([tail -4 stdout], [0],
271   [Megaflow: recirc_id=0,icmp6,in_port=1,nw_frag=no,icmp_type=0x87/0xff,icmp_code=0x0/0xff,nd_target=fe80::2020,nd_sll=66:55:44:33:22:11
272 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
273 This flow is handled by the userspace slow path because it:
274         - Uses action(s) not supported by datapath.
275 ])
276 OVS_VSWITCHD_STOP
277 AT_CLEANUP
278
279 AT_SETUP([ofproto-dpif - clear actions])
280 OVS_VSWITCHD_START
281 add_of_ports br0 1 10 11 12
282 AT_DATA([flows.txt], [dnl
283 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
284 table=1 tcp actions=set_field:91->tp_src,output(11),clear_actions
285 ])
286 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
287 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])
288 AT_CHECK([tail -2 stdout], [0],
289   [Megaflow: recirc_id=0,tcp,in_port=1,nw_frag=no,tp_src=8
290 Datapath actions: 10,set(tcp(src=91)),11
291 ])
292 OVS_VSWITCHD_STOP
293 AT_CLEANUP
294
295 AT_SETUP([ofproto-dpif - group chaining])
296 OVS_VSWITCHD_START
297 add_of_ports br0 1 10 11
298 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'])
299 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=123,type=all,bucket=output:10'])
300 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
301 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])
302 AT_CHECK([tail -1 stdout], [0],
303   [Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
304 ])
305 OVS_VSWITCHD_STOP
306 AT_CLEANUP
307
308 AT_SETUP([ofproto-dpif - all group in action list])
309 OVS_VSWITCHD_START
310 add_of_ports br0 1 10 11
311 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'])
312 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
313 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])
314 # Must match on the source address to be able to restore it's value for
315 # the second bucket
316 AT_CHECK([tail -2 stdout], [0],
317   [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
318 Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
319 ])
320 OVS_VSWITCHD_STOP
321 AT_CLEANUP
322
323 AT_SETUP([ofproto-dpif - indirect group in action list])
324 OVS_VSWITCHD_START
325 add_of_ports br0 1 10
326 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
327 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
328 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])
329 AT_CHECK([tail -1 stdout], [0],
330   [Datapath actions: 10
331 ])
332 OVS_VSWITCHD_STOP
333 AT_CLEANUP
334
335 AT_SETUP([ofproto-dpif - group actions have no effect afterwards])
336 OVS_VSWITCHD_START
337 add_of_ports br0 1 10
338 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'])
339 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234,output:10'])
340 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])
341 AT_CHECK([tail -1 stdout], [0],
342   [Datapath actions: set(ipv4(src=192.168.3.90,dst=192.168.0.2)),10,set(ipv4(src=192.168.0.1,dst=192.168.0.2)),10
343 ])
344 OVS_VSWITCHD_STOP
345 AT_CLEANUP
346
347 AT_SETUP([ofproto-dpif - all group in action set])
348 OVS_VSWITCHD_START
349 add_of_ports br0 1 10 11
350 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'])
351 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
352 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])
353 # Must match on the source address to be able to restore it's value for
354 # the third bucket
355 AT_CHECK([tail -2 stdout], [0],
356   [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
357 Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
358 ])
359 OVS_VSWITCHD_STOP
360 AT_CLEANUP
361
362 AT_SETUP([ofproto-dpif - indirect group in action set])
363 OVS_VSWITCHD_START
364 add_of_ports br0 1 10
365 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
366 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
367 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])
368 AT_CHECK([tail -1 stdout], [0],
369   [Datapath actions: 10
370 ])
371 OVS_VSWITCHD_STOP
372 AT_CLEANUP
373
374 AT_SETUP([ofproto-dpif - select group])
375 OVS_VSWITCHD_START
376 add_of_ports br0 1 10 11
377 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
378 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
379
380 # Try a bunch of different flows and make sure that they get distributed
381 # at least somewhat.
382 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
383     AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:0$d,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0"], [0], [stdout])
384     tail -1 stdout >> results
385 done
386 sort results | uniq -c
387 AT_CHECK([sort results | uniq], [0],
388   [Datapath actions: 10
389 Datapath actions: 11
390 ])
391 OVS_VSWITCHD_STOP
392 AT_CLEANUP
393
394 AT_SETUP([ofproto-dpif - select group with watch port])
395 OVS_VSWITCHD_START
396 add_of_ports br0 1 10 11
397 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
398 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
399 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00: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])
400 AT_CHECK([tail -1 stdout], [0],
401   [Datapath actions: 11
402 ])
403 OVS_VSWITCHD_STOP
404 AT_CLEANUP
405
406 AT_SETUP([ofproto-dpif - select group with weight])
407 OVS_VSWITCHD_START
408 add_of_ports br0 1 10 11 12
409 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11,weight=2000,bucket=output:12,weight=0'])
410 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
411 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00: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])
412 AT_CHECK([tail -1 stdout], [0],
413   [Datapath actions: 11
414 ])
415 OVS_VSWITCHD_STOP
416 AT_CLEANUP
417
418 AT_SETUP([ofproto-dpif - select group with hash selection method])
419 OVS_VSWITCHD_START
420 add_of_ports br0 1 10 11
421 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,fields=eth_dst,bucket=output:10,bucket=output:11'])
422 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
423
424 # Try a bunch of different flows and make sure that they get distributed
425 # at least somewhat.
426 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
427     AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:0$d,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0"], [0], [stdout])
428     tail -1 stdout >> results
429 done
430 sort results | uniq -c
431 AT_CHECK([sort results | uniq], [0],
432   [Datapath actions: 10
433 Datapath actions: 11
434 ])
435
436 > results
437 # Try a bunch of different flows and make sure that they are not distributed
438 # as they only vary a field that is not hashed
439 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
440     AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:0$d,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0"], [0], [stdout])
441     tail -1 stdout >> results
442 done
443 sort results | uniq -c
444 AT_CHECK([sort results | uniq | sed 's/1[[01]]/1?/'], [0],
445   [Datapath actions: 1?
446 ])
447
448 OVS_VSWITCHD_STOP
449 AT_CLEANUP
450
451 AT_SETUP([ofproto-dpif - fast failover group])
452 OVS_VSWITCHD_START
453 add_of_ports br0 1 10 11
454 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'])
455 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
456 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])
457 AT_CHECK([tail -1 stdout], [0],
458   [Datapath actions: drop
459 ])
460 OVS_VSWITCHD_STOP
461 AT_CLEANUP
462
463 AT_SETUP([ofproto-dpif - group stats single bucket])
464 OVS_VSWITCHD_START
465 add_of_ports br0 1 10 11
466 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
467 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
468 (
469 for i in `seq 0 2`;
470     do
471     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)"
472     AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
473     done
474 )
475 AT_CHECK([ovs-appctl revalidator/purge], [0])
476 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
477 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
478  group_id=1234,ref_count=1,packet_count=3,byte_count=180,bucket0:packet_count=3,byte_count=180,bucket1:packet_count=0,byte_count=0
479 OFPST_GROUP reply (OF1.2):
480 ])
481 OVS_VSWITCHD_STOP
482 AT_CLEANUP
483
484 AT_SETUP([ofproto-dpif - group stats all buckets])
485 OVS_VSWITCHD_START
486 add_of_ports br0 1 10 11
487 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
488 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
489 (
490 for i in `seq 0 2`;
491     do
492     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)"
493     AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
494     done
495 )
496 AT_CHECK([ovs-appctl revalidator/purge], [0])
497 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
498 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
499  group_id=1234,ref_count=1,packet_count=3,byte_count=180,bucket0:packet_count=3,byte_count=180,bucket1:packet_count=3,byte_count=180
500 OFPST_GROUP reply (OF1.2):
501 ])
502 OVS_VSWITCHD_STOP
503 AT_CLEANUP
504
505 AT_SETUP([ofproto-dpif - registers])
506 OVS_VSWITCHD_START
507 add_of_ports br0 20 21 22 33 90
508 AT_DATA([flows.txt], [dnl
509 in_port=90                 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
510 in_port=91                 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
511 in_port=92                 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
512 in_port=93                 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
513
514 in_port=2                  actions=load:0x000db000->NXM_NX_REG0[[]]
515 in_port=3                  actions=load:0xdea->NXM_NX_REG0[[20..31]]
516 in_port=4                  actions=load:0xeef->NXM_NX_REG0[[0..11]]
517 in_port=5                  actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
518 in_port=6                  actions=load:0x22222222->NXM_NX_REG2[[]]
519 in_port=7                  actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
520 in_port=8                  actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
521 in_port=9,reg0=0xdeadbeef  actions=output:20
522 in_port=10,reg1=0xdeadbeef actions=output:21
523 in_port=11,reg2=0xeef22dea actions=output:22
524
525 dnl Sanilty check all registers
526 in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
527 in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
528 in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
529 in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
530
531 ])
532 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
533 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])
534 AT_CHECK([tail -1 stdout], [0],
535   [Datapath actions: 20,21,22,33
536 ])
537 OVS_VSWITCHD_STOP
538 AT_CLEANUP
539
540 dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
541 dnl in the manner documented in ovs-ofctl(8).
542 AT_SETUP([ofproto-dpif - extended registers])
543 OVS_VSWITCHD_START
544 add_of_ports br0 1 2 3
545 AT_DATA([flows.txt], [dnl
546 table=0     actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
547 table=1,reg2=0xfedcba98,reg3=0x76543210   actions=2
548
549 # These low-priority rules shouldn't match.  They're here only to make really
550 # sure that the test fails if either of the above rules fails to match.
551 table=0,priority=0                        actions=3
552 table=1,priority=0                        actions=3
553 ])
554 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
555 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])
556 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
557 ])
558 OVS_VSWITCHD_STOP
559 AT_CLEANUP
560
561 AT_SETUP([ofproto-dpif - load and move order])
562 OVS_VSWITCHD_START
563 add_of_ports br0 1 10 11
564 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'])
565 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)'])
566 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])
567 AT_CHECK([tail -2 stdout], [0],
568   [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
569 Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
570 ])
571 OVS_VSWITCHD_STOP
572 AT_CLEANUP
573
574 dnl Tests that 1.5 copy-field can copy into the standardized xregs.
575 AT_SETUP([ofproto-dpif - copy-field into extended registers])
576 OVS_VSWITCHD_START
577 add_of_ports br0 1 2 3
578 AT_DATA([flows.txt], [dnl
579 table=0     actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
580 table=1,xreg0=0x0000505400000005   actions=2
581
582 # These low-priority rules shouldn't match.  They're here only to make really
583 # sure that the test fails if either of the above rules fails to match.
584 table=0,priority=0                        actions=3
585 table=1,priority=0                        actions=3
586 ])
587 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
588 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])
589 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
590 ])
591 OVS_VSWITCHD_STOP
592 AT_CLEANUP
593
594 dnl Tests that 1.5 set-field with mask in the metadata register.
595 AT_SETUP([ofproto-dpif - masked set-field into metadata])
596 OVS_VSWITCHD_START
597 add_of_ports br0 1 2 3
598 AT_DATA([flows.txt], [dnl
599 table=0     actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
600 table=1     actions=set_field:0x6b/0xff->metadata,goto_table(2)
601 table=2,metadata=0xfafafafa5a5a5a6b  actions=2
602
603 # These low-priority rules shouldn't match.  They're here only to make really
604 # sure that the test fails if either of the above rules fails to match.
605 table=0,priority=0                        actions=3
606 table=1,priority=0                        actions=3
607 table=2,priority=0                        actions=3
608 ])
609 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
610 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])
611 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
612 ])
613 OVS_VSWITCHD_STOP
614 AT_CLEANUP
615
616
617 AT_SETUP([ofproto-dpif - actset_output])
618 OVS_VSWITCHD_START
619 add_of_ports br0 1 2 3 4 5 6 7 8 9 10 11 12 13
620 AT_DATA([flows.txt], [dnl
621 table=0,actset_output=unset     actions=write_actions(output(2)),goto_table(1)
622 table=1     actions=move:ONFOXM_ET_ACTSET_OUTPUT[[0..31]]->OXM_OF_PKT_REG0[[0..31]],goto_table(2)
623
624 # Verify that actset_output got set.
625 table=2,priority=20,actset_output=2  actions=4,goto_table(3)
626 table=2,priority=10                  actions=5,goto_table(3)
627
628 # Verify that xreg0 got copied properly from actset_output.
629 table=3,priority=20,xreg0=2  actions=6,goto_table(4)
630 table=3,priority=10          actions=7,goto_table(4)
631
632 # Verify that adding a group action unsets actset_output,
633 # even if output follows group.
634 table=4 actions=write_actions(group(5),output(10)),goto_table(5)
635 table=5,priority=20,actset_output=unset  actions=8,goto_table(6)
636 table=5,priority=10                      actions=9,goto_table(6)
637
638 # Verify that adding another output action doesn't change actset_output
639 # (since there's still a group).
640 table=6 actions=write_actions(output(3)),goto_table(7)
641 table=7,priority=20,actset_output=unset  actions=10,goto_table(8)
642 table=7,priority=10                      actions=11,goto_table(8)
643
644 # Verify that clearing the action set, then writing an output action,
645 # causes actset_output to be set again.
646 table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
647 table=9,priority=20,actset_output=2 actions=12
648 table=9,priority=10                 actions=13
649 ])
650 AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=5,type=all,bucket=output:1'])
651 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
652 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])
653 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
654 ])
655 OVS_VSWITCHD_STOP
656 AT_CLEANUP
657 AT_SETUP([ofproto-dpif - push-pop])
658 OVS_VSWITCHD_START
659 add_of_ports br0 20 21 22 33 90
660 AT_DATA([flows.txt], [dnl
661 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
662 in_port=2            actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
663 in_port=3            actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
664 in_port=4            actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
665 in_port=5            actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
666
667 ])
668 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
669 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])
670 AT_CHECK([tail -1 stdout], [0],
671   [Datapath actions: 33,22,21,20
672 ])
673 OVS_VSWITCHD_STOP
674 AT_CLEANUP
675
676 AT_SETUP([ofproto-dpif - output])
677 OVS_VSWITCHD_START
678 add_of_ports br0 1 9 10 11 55 66 77 88
679 AT_DATA([flows.txt], [dnl
680 in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
681 in_port=2 actions=output:9
682 in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
683 in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
684 in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
685 in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
686 in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
687 in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
688 ])
689 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
690 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])
691 AT_CHECK([tail -1 stdout], [0],
692   [Datapath actions: 9,55,10,55,66,11,77,88,9,1
693 ])
694 OVS_VSWITCHD_STOP
695 AT_CLEANUP
696
697 AT_SETUP([ofproto-dpif - dec_ttl])
698 OVS_VSWITCHD_START
699 add_of_ports br0 1 2 3 4
700 AT_DATA([flows.txt], [dnl
701 table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
702 table=1 in_port=1 action=dec_ttl,output:3
703 ])
704 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
705 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])
706 AT_CHECK([tail -4 stdout], [0],
707   [Megaflow: recirc_id=0,ip,in_port=1,nw_ttl=2,nw_frag=no
708 Datapath actions: set(ipv4(ttl=1)),2,4
709 This flow is handled by the userspace slow path because it:
710         - Sends "packet-in" messages to the OpenFlow controller.
711 ])
712 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])
713 AT_CHECK([tail -2 stdout], [0],
714   [Megaflow: recirc_id=0,ip,in_port=1,nw_ttl=3,nw_frag=no
715 Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
716 ])
717 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])
718 AT_CHECK([tail -2 stdout], [0],
719   [Megaflow: recirc_id=0,ipv6,in_port=1,nw_ttl=128,nw_frag=no
720 Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
721 ])
722
723 AT_CAPTURE_FILE([ofctl_monitor.log])
724 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
725 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])
726 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
727 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
728 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
729 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
730 ])
731 OVS_VSWITCHD_STOP
732 AT_CLEANUP
733
734 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
735 dnl buffer to be resized just before pushing the id of the dec_ttl action.
736 dnl Thus the implementation must account for this by using the
737 dnl reallocated buffer rather than the original buffer.
738 dnl
739 dnl A number of similar rules are added to try and exercise
740 dnl xrealloc sufficiently that it returns a different base pointer
741 AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
742 OVS_VSWITCHD_START
743 add_of_ports br0 1
744 (for i in `seq 0 255`; do
745   printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
746  done) > flows.txt
747 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
748 OVS_VSWITCHD_STOP
749 AT_CLEANUP
750
751 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
752 dnl buffer to be resized just before pushing the id of the dec_ttl action.
753 dnl Thus the implementation must account for this by using the
754 dnl reallocated buffer rather than the original buffer.
755 dnl
756 dnl A number of similar rules are added to try and exercise
757 dnl xrealloc sufficiently that it returns a different base pointer
758 AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
759 OVS_VSWITCHD_START
760 add_of_ports br0 1
761 (for i in `seq 0 255`; do
762   printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
763  done) > flows.txt
764 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
765 OVS_VSWITCHD_STOP
766 AT_CLEANUP
767
768 dnl A note action at offset 24 in ofpacts will cause the ofpacts
769 dnl buffer to be resized just before pushing the id of the dec_ttl action.
770 dnl Thus the implementation must account for this by using the
771 dnl reallocated buffer rather than the original buffer.
772 dnl
773 dnl A number of similar rules are added to try and exercise
774 dnl xrealloc sufficiently that it returns a different base pointer
775 AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
776 OVS_VSWITCHD_START
777 add_of_ports br0 1
778 (for i in `seq 0 255`; do
779   printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
780  done) > flows.txt
781 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
782 OVS_VSWITCHD_STOP
783 AT_CLEANUP
784
785 dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
786 dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
787 dnl Using `make check-valgrind' here checks for use-after-free in this
788 dnl codepath.
789 AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
790 OVS_VSWITCHD_START
791 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'])
792 OVS_VSWITCHD_STOP
793 AT_CLEANUP
794
795 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
796 OVS_VSWITCHD_START
797 add_of_ports br0 1 2
798
799 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
800
801 # "in_port" defaults to OFPP_NONE if it's not specified.
802 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"
803 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
804 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
805 1
806 2
807 100
808 ])
809
810 OVS_VSWITCHD_STOP
811 AT_CLEANUP
812
813 AT_SETUP([ofproto-dpif - DSCP])
814 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
815 add_of_ports br0 9
816 AT_DATA([flows.txt], [dnl
817 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
818 ])
819 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
820 AT_CHECK([ovs-vsctl -- \
821         set Port p1 qos=@newqos --\
822         --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
823         --id=@q1 create Queue dscp=1 --\
824         --id=@q2 create Queue dscp=2], [0], [ignore])
825 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])
826 AT_CHECK([tail -2 stdout], [0],
827   [Megaflow: recirc_id=0,skb_priority=0,ip,in_port=9,nw_tos=252,nw_frag=no
828 Datapath actions: dnl
829 100,dnl
830 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
831 set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
832 1,dnl
833 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
834 set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
835 set(ipv4(tos=0/0xfc)),1,100
836 ])
837 OVS_VSWITCHD_STOP
838 AT_CLEANUP
839
840 AT_SETUP([ofproto-dpif - output/flood flags])
841 OVS_VSWITCHD_START
842 add_of_ports br0 1 2 3 4 5 6 7
843
844 AT_DATA([flows.txt], [dnl
845 in_port=local actions=local,flood
846 in_port=1 actions=flood
847 in_port=2 actions=all
848 in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
849 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
850 ])
851 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
852 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
853 AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
854
855 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])
856 AT_CHECK([tail -1 stdout \
857 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
858 1
859 2
860 3
861 4
862 7
863 ])
864
865 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])
866 AT_CHECK([tail -1 stdout \
867 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
868 100
869 2
870 3
871 4
872 7
873 ])
874
875 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])
876 AT_CHECK([tail -1 stdout \
877 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
878 1
879 100
880 3
881 4
882 6
883 7
884 ])
885
886 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])
887 AT_CHECK([tail -1 stdout], [0],
888   [Datapath actions: 100,1,2,4,6,7
889 ])
890
891 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])
892 AT_CHECK([tail -1 stdout], [0],
893   [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
894 ])
895 OVS_VSWITCHD_STOP
896 AT_CLEANUP
897
898 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
899 OVS_VSWITCHD_START([dnl
900    add-port br0 p1 -- set Interface p1 type=dummy
901 ])
902 on_exit 'kill `cat ovs-ofctl.pid`'
903
904 AT_CAPTURE_FILE([ofctl_monitor.log])
905
906 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
907
908 for i in 1 2 3 ; do
909     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)'
910 done
911 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
912 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
913 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
914 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
915 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:0
916 dnl
917 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
918 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:0
919 dnl
920 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
921 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:0
922 ])
923
924 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
925 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
926 NXST_FLOW reply:
927 ])
928
929 OVS_VSWITCHD_STOP
930 AT_CLEANUP
931
932 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
933 OVS_VSWITCHD_START([dnl
934    add-port br0 p1 -- set Interface p1 type=dummy
935 ])
936 on_exit 'kill `cat ovs-ofctl.pid`'
937
938 AT_CAPTURE_FILE([ofctl_monitor.log])
939 AT_CHECK([ovs-ofctl del-flows br0])
940
941 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
942
943 dnl Test that missed packets are droped
944 for i in 1 2 3 ; do
945     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)'
946 done
947 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
948
949 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
950 ])
951
952 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
953 AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
954 OFPST_FLOW reply (OF1.3):
955 ])
956
957 OVS_VSWITCHD_STOP
958 AT_CLEANUP
959
960 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
961 OVS_VSWITCHD_START([dnl
962    add-port br0 p1 -- set Interface p1 type=dummy
963 ])
964 on_exit 'kill `cat ovs-ofctl.pid`'
965
966 AT_CAPTURE_FILE([ofctl_monitor.log])
967 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
968
969 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
970
971 for i in 1 2 3 ; do
972     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)'
973 done
974 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
975 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
976 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
977 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
978 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:0
979 dnl
980 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
981 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:0
982 dnl
983 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
984 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:0
985 ])
986
987 AT_CHECK([ovs-appctl revalidator/purge], [0])
988 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
989  n_packets=3, n_bytes=180, actions=goto_table:1
990 OFPST_FLOW reply (OF1.2):
991 ])
992
993 OVS_VSWITCHD_STOP
994 AT_CLEANUP
995
996 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
997 OVS_VSWITCHD_START([dnl
998    add-port br0 p1 -- set Interface p1 type=dummy
999 ])
1000 on_exit 'kill `cat ovs-ofctl.pid`'
1001
1002 AT_CAPTURE_FILE([ofctl_monitor.log])
1003 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1004
1005 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1006
1007 for i in 1 2 3 ; do
1008     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)'
1009 done
1010
1011 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1012 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1013 ])
1014
1015 AT_CHECK([ovs-appctl revalidator/purge], [0])
1016 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1017  n_packets=3, n_bytes=180, actions=resubmit(1,1)
1018 OFPST_FLOW reply (OF1.2):
1019 ])
1020
1021 OVS_VSWITCHD_STOP
1022 AT_CLEANUP
1023
1024 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1025 OVS_VSWITCHD_START([dnl
1026    add-port br0 p1 -- set Interface p1 type=dummy
1027 ])
1028 on_exit 'kill `cat ovs-ofctl.pid`'
1029
1030 AT_CAPTURE_FILE([ofctl_monitor.log])
1031 AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1032 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1033
1034 dnl Miss table 0, Hit table 1
1035 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1036
1037 for i in 1 2 3 ; do
1038     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)'
1039 done
1040 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1041 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1042
1043 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1044 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1045 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:0
1046 dnl
1047 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1048 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:0
1049 dnl
1050 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1051 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:0
1052 ])
1053
1054 dnl Hit table 0, Miss all other tables, sent to controller
1055 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1056
1057 for i in 1 2 3 ; do
1058     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)'
1059 done
1060 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1061 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1062
1063 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1064 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1065 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:0
1066 dnl
1067 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1068 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:0
1069 dnl
1070 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1071 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:0
1072 ])
1073
1074 AT_CHECK([ovs-appctl revalidator/purge], [0])
1075 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1076  table=1, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1077 OFPST_FLOW reply (OF1.2):
1078 ])
1079
1080 OVS_VSWITCHD_STOP
1081 AT_CLEANUP
1082
1083 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1084 OVS_VSWITCHD_START([dnl
1085    add-port br0 p1 -- set Interface p1 type=dummy
1086 ])
1087 on_exit 'kill `cat ovs-ofctl.pid`'
1088
1089 AT_CAPTURE_FILE([ofctl_monitor.log])
1090 AT_DATA([flows.txt], [dnl
1091 table=0 actions=goto_table(1)
1092 table=2 dl_src=10:11:11:11:11:11 actions=controller
1093 ])
1094 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1095 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1096
1097 dnl Hit table 0, Miss table 1, Hit table 2
1098 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1099
1100 for i in 1 2 3 ; do
1101     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)'
1102 done
1103 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1104 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1105
1106 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1107 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1108 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:0
1109 dnl
1110 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1111 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:0
1112 dnl
1113 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1114 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:0
1115 ])
1116
1117 dnl Hit table 1, Miss all other tables, sent to controller
1118 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1119
1120 for i in 1 2 3 ; do
1121     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)'
1122 done
1123 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1124 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1125
1126 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1127 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1128 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:0
1129 dnl
1130 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1131 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:0
1132 dnl
1133 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1134 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:0
1135 ])
1136
1137 AT_CHECK([ovs-appctl revalidator/purge], [0])
1138 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1139  n_packets=6, n_bytes=360, actions=goto_table:1
1140  table=2, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1141 OFPST_FLOW reply (OF1.2):
1142 ])
1143
1144 OVS_VSWITCHD_STOP
1145 AT_CLEANUP
1146
1147 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1148 OVS_VSWITCHD_START([dnl
1149    add-port br0 p1 -- set Interface p1 type=dummy
1150 ])
1151 on_exit 'kill `cat ovs-ofctl.pid`'
1152
1153 AT_CAPTURE_FILE([ofctl_monitor.log])
1154 AT_DATA([flows.txt], [dnl
1155 table=0 actions=resubmit(1,1)
1156 table=2 dl_src=10:11:11:11:11:11 actions=controller
1157 ])
1158 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1159 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1160
1161 dnl Hit table 0, Miss table 1, Dropped
1162 AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1163
1164 for i in 1 2 3 ; do
1165     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)'
1166 done
1167 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1168
1169 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1170 ])
1171
1172 dnl Hit table 1, Dropped
1173 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1174
1175 for i in 1 2 3 ; do
1176     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)'
1177 done
1178 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1179
1180 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1181 ])
1182
1183 AT_CHECK([ovs-appctl revalidator/purge], [0])
1184 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1185  n_packets=6, n_bytes=360, actions=resubmit(1,1)
1186  table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1187 OFPST_FLOW reply (OF1.2):
1188 ])
1189
1190 OVS_VSWITCHD_STOP
1191 AT_CLEANUP
1192
1193 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1194 OVS_VSWITCHD_START([dnl
1195    add-port br0 p1 -- set Interface p1 type=dummy
1196 ])
1197 on_exit 'kill `cat ovs-ofctl.pid`'
1198
1199 AT_CAPTURE_FILE([ofctl_monitor.log])
1200 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1201
1202 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1203
1204 dnl Test that missed packets are droped
1205 for i in 1 2 3 ; do
1206     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)'
1207 done
1208 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1209
1210 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1211 ])
1212
1213 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1214 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1215 NXST_FLOW reply:
1216 ])
1217
1218 OVS_VSWITCHD_STOP
1219 AT_CLEANUP
1220
1221 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1222 OVS_VSWITCHD_START([dnl
1223    add-port br0 p1 -- set Interface p1 type=dummy
1224 ])
1225 on_exit 'kill `cat ovs-ofctl.pid`'
1226
1227 AT_CAPTURE_FILE([ofctl_monitor.log])
1228 AT_CHECK([ovs-ofctl del-flows br0])
1229 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1230 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1231
1232 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1233
1234 dnl Test that missed packets are droped
1235 for i in 1 2 3 ; do
1236     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)'
1237 done
1238 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1239
1240 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1241 ])
1242
1243 AT_CHECK([ovs-appctl revalidator/purge], [0])
1244 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1245  n_packets=3, n_bytes=180, actions=goto_table:1
1246 OFPST_FLOW reply (OF1.2):
1247 ])
1248
1249 OVS_VSWITCHD_STOP
1250 AT_CLEANUP
1251
1252 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1253 OVS_VSWITCHD_START([dnl
1254    add-port br0 p1 -- set Interface p1 type=dummy
1255 ])
1256 on_exit 'kill `cat ovs-ofctl.pid`'
1257
1258 AT_CAPTURE_FILE([ofctl_monitor.log])
1259 AT_CHECK([ovs-ofctl del-flows br0])
1260 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1261 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1262
1263 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1264
1265 dnl Test that missed packets are droped
1266 for i in 1 2 3 ; do
1267     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)'
1268 done
1269 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1270
1271 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1272 ])
1273
1274 AT_CHECK([ovs-appctl revalidator/purge], [0])
1275 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1276  n_packets=3, n_bytes=180, actions=resubmit(1,1)
1277 OFPST_FLOW reply (OF1.2):
1278 ])
1279
1280 OVS_VSWITCHD_STOP
1281 AT_CLEANUP
1282
1283 AT_SETUP([ofproto-dpif - controller])
1284 OVS_VSWITCHD_START([dnl
1285    add-port br0 p1 -- set Interface p1 type=dummy
1286 ])
1287 on_exit 'kill `cat ovs-ofctl.pid`'
1288
1289 AT_CAPTURE_FILE([ofctl_monitor.log])
1290 AT_DATA([flows.txt], [dnl
1291 cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
1292 cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
1293 cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1294
1295 cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1296 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)
1297 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)
1298 cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1299 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)
1300 cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1301 cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
1302 cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
1303 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
1304 ])
1305 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1306
1307 dnl Flow miss.
1308 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1309
1310 for i in 1 2 3 ; do
1311     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)'
1312 done
1313 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1314 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1315
1316 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1317 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1318 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:0
1319 dnl
1320 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1321 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:0
1322 dnl
1323 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1324 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:0
1325 ])
1326
1327 dnl Singleton controller action.
1328 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1329
1330 for i in 1 2 3 ; do
1331     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)'
1332 done
1333 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1334 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1335
1336 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1337 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1338 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:0
1339 dnl
1340 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1341 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:0
1342 dnl
1343 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1344 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:0
1345 ])
1346
1347 dnl Modified controller action.
1348 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1349
1350 for i in 1 2 3 ; do
1351     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)'
1352 done
1353 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1354 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1355
1356 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1357 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1358 tcp,dl_vlan=15,dl_vlan_pcp=0,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:0
1359 dnl
1360 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1361 tcp,dl_vlan=15,dl_vlan_pcp=0,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:0
1362 dnl
1363 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1364 tcp,dl_vlan=15,dl_vlan_pcp=0,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:0
1365 ])
1366
1367 dnl Modified VLAN controller action.
1368 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1369
1370 for i in 1 2 3; do
1371     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)'
1372 done
1373 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1374 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1375
1376 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1377 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1378 ip,dl_vlan=99,dl_vlan_pcp=1,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
1379 dnl
1380 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1381 ip,dl_vlan=99,dl_vlan_pcp=1,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
1382 dnl
1383 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1384 ip,dl_vlan=99,dl_vlan_pcp=1,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
1385 ])
1386
1387 dnl Checksum TCP.
1388 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1389
1390 for i in 1 ; do
1391     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)'
1392 done
1393 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1394 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1395
1396 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1397 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1398 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:0
1399 dnl
1400 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
1401 tcp,dl_vlan=80,dl_vlan_pcp=0,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:0
1402 dnl
1403 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)
1404 tcp,dl_vlan=80,dl_vlan_pcp=0,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:0
1405 dnl
1406 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)
1407 tcp,dl_vlan=80,dl_vlan_pcp=0,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:0
1408 dnl
1409 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)
1410 tcp,dl_vlan=80,dl_vlan_pcp=0,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:1a03
1411 dnl
1412 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)
1413 tcp,dl_vlan=80,dl_vlan_pcp=0,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:3205
1414 dnl
1415 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)
1416 tcp,dl_vlan=80,dl_vlan_pcp=0,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:31b8
1417 dnl
1418 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)
1419 tcp,dl_vlan=80,dl_vlan_pcp=0,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:316d
1420 dnl
1421 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)
1422 tcp,dl_vlan=80,dl_vlan_pcp=0,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:316d
1423 ])
1424
1425 dnl Checksum UDP.
1426 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1427
1428 for i in 1 ; do
1429     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'
1430 done
1431 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1432 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1433
1434 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1435 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1436 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
1437 dnl
1438 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
1439 udp,dl_vlan=80,dl_vlan_pcp=0,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
1440 dnl
1441 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)
1442 udp,dl_vlan=80,dl_vlan_pcp=0,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
1443 dnl
1444 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)
1445 udp,dl_vlan=80,dl_vlan_pcp=0,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
1446 dnl
1447 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)
1448 udp,dl_vlan=80,dl_vlan_pcp=0,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
1449 dnl
1450 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)
1451 udp,dl_vlan=80,dl_vlan_pcp=0,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
1452 dnl
1453 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)
1454 udp,dl_vlan=80,dl_vlan_pcp=0,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
1455 dnl
1456 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)
1457 udp,dl_vlan=80,dl_vlan_pcp=0,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
1458 dnl
1459 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)
1460 udp,dl_vlan=80,dl_vlan_pcp=0,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
1461 ])
1462
1463 dnl Modified ARP controller action.
1464 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1465
1466 for i in 1 2 3; do
1467     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)'
1468 done
1469
1470 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1471 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1472 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1473 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1474 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
1475 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1476 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
1477 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1478 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
1479 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1480 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
1481 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1482 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
1483 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1484 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
1485 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1486 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
1487 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1488 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
1489 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1490 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
1491 ])
1492
1493 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1494
1495 dnl Checksum SCTP.
1496 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1497
1498 for i in 1 ; do
1499     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'
1500 done
1501
1502 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1503 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1504 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1505 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1506 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
1507 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
1508 dnl
1509 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
1510 sctp,dl_vlan=80,dl_vlan_pcp=0,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
1511 dnl
1512 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)
1513 sctp,dl_vlan=80,dl_vlan_pcp=0,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
1514 dnl
1515 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)
1516 sctp,dl_vlan=80,dl_vlan_pcp=0,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
1517 dnl
1518 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)
1519 sctp,dl_vlan=80,dl_vlan_pcp=0,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
1520 dnl
1521 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)
1522 sctp,dl_vlan=80,dl_vlan_pcp=0,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
1523 dnl
1524 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)
1525 sctp,dl_vlan=80,dl_vlan_pcp=0,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
1526 dnl
1527 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)
1528 sctp,dl_vlan=80,dl_vlan_pcp=0,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
1529 dnl
1530 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)
1531 sctp,dl_vlan=80,dl_vlan_pcp=0,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
1532 ])
1533
1534 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1535  cookie=0x1, n_packets=3, n_bytes=218, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1536  cookie=0x2, n_packets=3, n_bytes=180, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1537  cookie=0x3, table=1, n_packets=3, n_bytes=218, in_port=80 actions=load:0x1->NXM_NX_REG0[[]],mod_vlan_vid:80,CONTROLLER:65535,resubmit(81,2)
1538  cookie=0x4, table=2, n_packets=3, n_bytes=218, in_port=81 actions=load:0x2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,CONTROLLER:65535,resubmit(82,3)
1539  cookie=0x5, table=3, n_packets=3, n_bytes=218, in_port=82 actions=load:0x3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,CONTROLLER:65535,resubmit(83,4)
1540  cookie=0x6, table=4, n_packets=3, n_bytes=218, in_port=83 actions=load:0x4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,CONTROLLER:65535,resubmit(84,5)
1541  cookie=0x7, table=5, n_packets=3, n_bytes=218, 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)
1542  cookie=0x8, table=6, n_packets=3, n_bytes=218, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1543  cookie=0x9, table=7, n_packets=3, n_bytes=218, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1544  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,CONTROLLER:65535
1545  cookie=0xd, n_packets=3, n_bytes=180, 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
1546  n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1547 NXST_FLOW reply:
1548 ])
1549
1550 OVS_VSWITCHD_STOP
1551 AT_CLEANUP
1552
1553 AT_SETUP([ofproto-dpif - MPLS handling])
1554 OVS_VSWITCHD_START([dnl
1555    add-port br0 p1 -- set Interface p1 type=dummy
1556 ])
1557 on_exit 'kill `cat ovs-ofctl.pid`'
1558
1559 AT_CAPTURE_FILE([ofctl_monitor.log])
1560 AT_DATA([flows.txt], [dnl
1561 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
1562 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
1563 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
1564 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
1565 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
1566 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
1567 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
1568 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
1569 cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
1570 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1571 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1572 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
1573
1574 cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1575 cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1576 cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1577 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
1578 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
1579 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
1580 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
1581
1582 cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1583 cookie=0xd table=1 arp actions=controller
1584
1585 cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1586 cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1587 cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1588 cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1589
1590 cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1591 cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1592 cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1593
1594 cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
1595 cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1596 cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1597
1598 cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1599 cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1600 cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1601
1602 cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1603 cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1604 cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1605
1606 cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1607 cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1608 cookie=0x5 dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
1609 ])
1610 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1611
1612 dnl Modified MPLS controller action.
1613 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1614
1615 for i in 1 2 3; do
1616     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)'
1617 done
1618 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1619 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1620
1621 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1622 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1623 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
1624 dnl
1625 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1626 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
1627 dnl
1628 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1629 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
1630 ])
1631
1632 dnl Modified MPLS controller action.
1633 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1634
1635 for i in 1 2 3; do
1636     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)'
1637 done
1638 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1639 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1640
1641 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1642 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1643 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
1644 dnl
1645 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1646 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
1647 dnl
1648 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1649 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
1650 ])
1651
1652 dnl Modified MPLS controller action.
1653 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1654
1655 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)
1656
1657 for i in 1 2 3; do
1658     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)'
1659 done
1660 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1661 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1662
1663 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1664 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1665 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
1666 dnl
1667 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1668 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
1669 dnl
1670 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1671 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
1672 ])
1673
1674 dnl Modified MPLS controller action.
1675 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1676
1677 for i in 1 2 3; do
1678     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))'
1679 done
1680 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1681 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1682
1683 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1684 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1685 mpls,dl_vlan=99,dl_vlan_pcp=7,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
1686 dnl
1687 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1688 mpls,dl_vlan=99,dl_vlan_pcp=7,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
1689 dnl
1690 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1691 mpls,dl_vlan=99,dl_vlan_pcp=7,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
1692 ])
1693
1694 dnl Modified MPLS controller action.
1695 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1696
1697 for i in 1 2 3; do
1698     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)'
1699 done
1700 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1701 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1702
1703 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1704 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1705 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
1706 dnl
1707 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1708 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
1709 dnl
1710 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1711 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
1712 ])
1713
1714 dnl Modified MPLS controller action.
1715 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1716
1717 for i in 1 2 3; do
1718     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)'
1719 done
1720 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1721 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1722
1723 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1724 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1725 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
1726 dnl
1727 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1728 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
1729 dnl
1730 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1731 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
1732 ])
1733
1734 dnl Modified MPLS controller action.
1735 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1736
1737 for i in 1 2 3; do
1738     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)'
1739 done
1740 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1741 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1742
1743 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1744 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1745 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
1746 dnl
1747 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1748 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
1749 dnl
1750 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1751 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
1752 ])
1753
1754 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1755
1756 dnl Modified MPLS controller action.
1757 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1758
1759 for i in 1 2 3; do
1760     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)'
1761 done
1762 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1763 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1764
1765 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1766 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1767 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
1768 dnl
1769 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1770 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
1771 dnl
1772 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1773 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
1774 ])
1775
1776 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1777
1778 dnl Modified MPLS controller action.
1779 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1780
1781 for i in 1 2 3; do
1782     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)'
1783 done
1784 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1785 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1786
1787 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1788 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1789 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
1790 dnl
1791 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1792 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
1793 dnl
1794 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1795 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
1796 ])
1797
1798 dnl Modified MPLS actions.
1799 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1800
1801 for i in 1 2 3; do
1802     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)'
1803 done
1804 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1805 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1806
1807 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1808 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1809 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
1810 dnl
1811 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1812 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
1813 dnl
1814 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1815 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
1816 ])
1817
1818 dnl Modified MPLS ipv6 controller action.
1819 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1820
1821 for i in 1 2 3; do
1822     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)'
1823 done
1824 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1825 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1826
1827 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1828 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1829 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
1830 dnl
1831 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1832 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
1833 dnl
1834 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1835 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
1836 ])
1837
1838
1839 dnl Modified MPLS pop action.
1840 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
1841 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)
1842 dnl             (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
1843
1844 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1845
1846 for i in 1 2 3; do
1847     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'
1848 done
1849 #for i in 2 3; do
1850 #    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)'
1851 #done
1852 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1853 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1854
1855 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1856 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1857 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
1858 dnl
1859 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1860 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
1861 dnl
1862 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1863 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
1864 ])
1865
1866 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1867
1868 dnl Modified MPLS pop action.
1869 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1870 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)
1871 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1872 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1873 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1874
1875 for i in 1 2 3; do
1876     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'
1877 done
1878 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1879 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1880
1881 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1882 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1883 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
1884 dnl
1885 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1886 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
1887 dnl
1888 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1889 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
1890 ])
1891
1892 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1893
1894 dnl Modified MPLS pop action.
1895 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1896 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)
1897 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1898 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1899 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1900
1901 for i in 1 2 3; do
1902     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'
1903 done
1904 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1905 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1906
1907 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1908 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1909 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
1910 dnl
1911 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1912 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
1913 dnl
1914 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1915 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
1916 ])
1917
1918 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1919
1920 dnl Modified MPLS pop action.
1921 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1922 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)
1923 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1924 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1925 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1926
1927 for i in 1 2 3; do
1928     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'
1929 done
1930 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1931 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1932
1933 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1934 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1935 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
1936 dnl
1937 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1938 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
1939 dnl
1940 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1941 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
1942 ])
1943
1944 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1945
1946 dnl Modified MPLS pop action.
1947 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1948 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)
1949 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1950 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1951 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1952
1953 for i in 1 2 3; do
1954     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'
1955 done
1956 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1957 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1958
1959 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1960 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1961 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
1962 dnl
1963 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1964 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
1965 dnl
1966 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1967 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
1968 ])
1969
1970 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1971
1972 dnl Modified MPLS pop action.
1973 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1974 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)
1975 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1976 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1977 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1978
1979 for i in 1 2 3; do
1980     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'
1981 done
1982 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1983 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1984
1985 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1986 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1987 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
1988 dnl
1989 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1990 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
1991 dnl
1992 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1993 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
1994 ])
1995
1996 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1997
1998 dnl Modified MPLS pop action.
1999 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2000 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)
2001 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2002 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2003 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2004
2005 for i in 1 2 3; do
2006     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'
2007 done
2008 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2009 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2010
2011 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2012 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2013 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2014 dnl
2015 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2016 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2017 dnl
2018 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2019 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
2020 ])
2021
2022 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2023
2024 dnl Modified MPLS pop action.
2025 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2026 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)
2027 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2028 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2029 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2030
2031 for i in 1 2 3; do
2032     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'
2033 done
2034 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2035 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2036
2037 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2038 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2039 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
2040 dnl
2041 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2042 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
2043 dnl
2044 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2045 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
2046 ])
2047
2048 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2049
2050 dnl Modified MPLS pop action.
2051 dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2052 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)
2053 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2054
2055 for i in 1 2 3; do
2056     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'
2057 done
2058 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2059 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2060
2061 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2062 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
2063 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
2064 dnl
2065 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
2066 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
2067 dnl
2068 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
2069 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
2070 ])
2071
2072 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2073
2074 dnl Modified MPLS pop action.
2075 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2076 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)
2077 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2078 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2079 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2080
2081 for i in 1 2 3; do
2082     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'
2083 done
2084 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2085 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2086
2087 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2088 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2089 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
2090 dnl
2091 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2092 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
2093 dnl
2094 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2095 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
2096 ])
2097
2098 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2099
2100 dnl Modified MPLS pop action.
2101 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2102 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)
2103 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2104 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2105 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2106
2107 for i in 1 2 3; do
2108     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'
2109 done
2110 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2111 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2112
2113 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2114 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2115 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
2116 dnl
2117 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2118 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
2119 dnl
2120 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2121 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
2122 ])
2123
2124 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2125
2126 dnl Modified MPLS pop action.
2127 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2128 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)
2129 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2130 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2131 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2132
2133 for i in 1 2 3; do
2134     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'
2135 done
2136 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2137 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2138
2139 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2140 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2141 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
2142 dnl
2143 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2144 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
2145 dnl
2146 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2147 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
2148 ])
2149
2150 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2151
2152 dnl Modified MPLS pop action.
2153 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2154 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)
2155 dnl             (label 20, exp 0, [S], ttl 31)
2156 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2157 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2158 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2159
2160 for i in 1 2 3; do
2161     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'
2162 done
2163 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2164 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2165
2166 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2167 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2168 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
2169 dnl
2170 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2171 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
2172 dnl
2173 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2174 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
2175 ])
2176
2177 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2178
2179 dnl Modified MPLS pop action.
2180 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2181 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)
2182 dnl             (label 20, exp 0, [S], ttl 31)
2183 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2184 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2185 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2186
2187 for i in 1 2 3; do
2188     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'
2189 done
2190 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2191 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2192
2193 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2194 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2195 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
2196 dnl
2197 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2198 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
2199 dnl
2200 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2201 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
2202 ])
2203
2204 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2205
2206 dnl Modified MPLS pop action.
2207 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2208 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)
2209 dnl             (label 20, exp 0, [S], ttl 31)
2210 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2211 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2212 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2213
2214 for i in 1 2 3; do
2215     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'
2216 done
2217 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2218 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2219
2220 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2221 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2222 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
2223 dnl
2224 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2225 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
2226 dnl
2227 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2228 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
2229 ])
2230
2231 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2232
2233 dnl Modified MPLS pop action.
2234 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2235 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)
2236 dnl             (label 20, exp 0, [S], ttl 31)
2237 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2238 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2239 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2240
2241 for i in 1 2 3; do
2242     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'
2243 done
2244 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2245 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2246
2247 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2248 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2249 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
2250 dnl
2251 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2252 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
2253 dnl
2254 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2255 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
2256 ])
2257
2258 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2259
2260 dnl Modified MPLS pop action.
2261 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2262 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)
2263 dnl             (label 20, exp 0, [S], ttl 31)
2264 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2265 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2266 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2267
2268 for i in 1 2 3; do
2269     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'
2270 done
2271
2272 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2273 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2274
2275 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2276 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2277 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
2278 dnl
2279 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2280 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
2281 dnl
2282 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2283 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
2284 ])
2285
2286 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2287
2288 dnl Modified MPLS pop action.
2289 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2290 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)
2291 dnl             (label 20, exp 0, [S], ttl 31)
2292 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2293 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2294 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2295
2296 for i in 1 2 3; do
2297     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'
2298 done
2299 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2300 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2301
2302 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2303 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2304 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
2305 dnl
2306 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2307 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
2308 dnl
2309 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2310 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
2311 ])
2312
2313 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2314
2315 dnl Modified MPLS pop action.
2316 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2317 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)
2318 dnl             (label 20, exp 0, ttl 31)
2319 dnl             (label 20, exp 0, [S], ttl 30)
2320 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2321 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2322 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2323
2324 for i in 1 2 3; do
2325     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'
2326 done
2327 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2328 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2329
2330 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2331 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2332 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
2333 dnl
2334 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2335 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
2336 dnl
2337 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2338 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
2339 ])
2340
2341 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2342
2343 dnl Modified MPLS pop action.
2344 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2345 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)
2346 dnl             (label 20, exp 0, ttl 31)
2347 dnl             (label 20, exp 0, [S], ttl 30)
2348 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2349 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2350 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2351
2352 for i in 1 2 3; do
2353     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'
2354 done
2355 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2356 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2357
2358 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2359 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2360 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
2361 dnl
2362 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2363 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
2364 dnl
2365 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2366 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
2367 ])
2368
2369 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2370
2371 dnl Modified MPLS pop action.
2372 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2373 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)
2374 dnl             (label 20, exp 0, ttl 31)
2375 dnl             (label 20, exp 0, [S], ttl 30)
2376 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2377 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2378 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2379
2380 for i in 1 2 3; do
2381     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'
2382 done
2383 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2384 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2385
2386 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2387 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2388 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
2389 dnl
2390 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2391 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
2392 dnl
2393 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2394 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
2395 ])
2396
2397 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2398
2399 dnl Modified MPLS pop action.
2400 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2401 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)
2402 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2403 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2404 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2405
2406 for i in 1 2 3; do
2407     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'
2408 done
2409 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2410 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2411
2412 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2413 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2414 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
2415 dnl
2416 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2417 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
2418 dnl
2419 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2420 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
2421 ])
2422
2423 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2424
2425 dnl Modified MPLS pop action.
2426 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2427 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)
2428 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2429 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2430 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2431
2432 for i in 1 2 3; do
2433     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'
2434 done
2435 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2436 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2437
2438 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2439 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2440 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
2441 dnl
2442 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2443 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
2444 dnl
2445 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2446 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
2447 ])
2448
2449 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2450
2451 dnl Modified MPLS pop action.
2452 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2453 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)
2454 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2455 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2456 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2457
2458 for i in 1 2 3; do
2459     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'
2460 done
2461 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2462 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2463
2464 AT_CHECK([strip_metadata <  ofctl_monitor.log], [0], [dnl
2465 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2466 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
2467 dnl
2468 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2469 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
2470 dnl
2471 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2472 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
2473 ])
2474
2475 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2476
2477 dnl Modified MPLS pop action.
2478 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2479 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)
2480 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2481 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2482 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2483
2484 for i in 1 2 3; do
2485     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'
2486 done
2487
2488 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2489 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2490
2491 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2492 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2493 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
2494 dnl
2495 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2496 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
2497 dnl
2498 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2499 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
2500 ])
2501
2502 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2503
2504 dnl Modified MPLS pop action.
2505 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2506 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)
2507 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2508 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2509 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2510
2511 for i in 1 2 3; do
2512     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'
2513 done
2514 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2515 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2516
2517 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2518 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2519 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
2520 dnl
2521 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2522 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
2523 dnl
2524 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2525 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
2526 ])
2527
2528 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2529
2530 dnl Modified MPLS pop action.
2531 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2532 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)
2533 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2534 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2535 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2536
2537 for i in 1 2 3; do
2538     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'
2539 done
2540
2541 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2542 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2543
2544 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2545 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2546 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
2547 dnl
2548 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2549 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
2550 dnl
2551 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2552 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
2553 ])
2554
2555 AT_CHECK([ovs-appctl revalidator/purge], [0])
2556 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2557  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
2558  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
2559  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
2560  cookie=0xa, n_packets=3, n_bytes=180, 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
2561  cookie=0xa, n_packets=3, n_bytes=180, 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
2562  cookie=0xa, n_packets=3, n_bytes=180, 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
2563  cookie=0xa, n_packets=3, n_bytes=180, 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
2564  cookie=0xa, n_packets=3, n_bytes=180, 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
2565  cookie=0xa, n_packets=3, n_bytes=180, 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
2566  cookie=0xa, n_packets=3, n_bytes=180, 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
2567  cookie=0xa, n_packets=3, n_bytes=180, 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
2568  cookie=0xa, n_packets=3, n_bytes=180, mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
2569  cookie=0xb, n_packets=3, n_bytes=180, mpls,dl_src=50:55:55:55:55:55 actions=load:0x3e8->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
2570  cookie=0xc, n_packets=3, n_bytes=180, 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
2571  cookie=0xd, n_packets=3, n_bytes=180, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
2572  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
2573  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
2574  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
2575  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
2576  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
2577  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
2578  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
2579  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
2580  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
2581  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
2582  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
2583  cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2584  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
2585  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
2586  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
2587  cookie=0xd, table=1, n_packets=3, n_bytes=168, arp actions=CONTROLLER:65535
2588  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
2589  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
2590  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
2591  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
2592  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
2593  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
2594  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
2595  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
2596  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
2597 NXST_FLOW reply:
2598 ])
2599
2600 OVS_VSWITCHD_STOP
2601 AT_CLEANUP
2602
2603 AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2604 OVS_VSWITCHD_START([dnl
2605    add-port br0 p1 -- set Interface p1 type=dummy
2606 ])
2607 on_exit 'kill `cat ovs-ofctl.pid`'
2608
2609 AT_CAPTURE_FILE([ofctl_monitor.log])
2610 AT_DATA([flows.txt], [dnl
2611 table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2612 table=1 ip,ip_dscp=8 actions=controller
2613 ])
2614 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2615
2616
2617 dnl Modified MPLS pop action.
2618 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2619 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)
2620 dnl             (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2621 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2622 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
2623
2624 for i in 1 2 3; do
2625     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'
2626 done
2627 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2628 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2629
2630 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2631 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2632 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
2633 dnl
2634 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2635 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
2636 dnl
2637 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2638 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
2639 ])
2640
2641 AT_CHECK([ovs-appctl revalidator/purge], [0])
2642 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2643  n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
2644  table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
2645 OFPST_FLOW reply (OF1.2):
2646 ])
2647
2648 OVS_VSWITCHD_STOP
2649 AT_CLEANUP
2650
2651 AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
2652 OVS_VSWITCHD_START([dnl
2653    add-port br0 p1 -- set Interface p1 type=dummy
2654 ])
2655 on_exit 'kill `cat ovs-ofctl.pid`'
2656
2657 dnl N.B: The first (and only) action that accesses L3 data after the
2658 dnl pop_mpls action is present in write_actions. This exercises recirculation
2659 dnl triggered in write_actions due to a previous action not in write actions.
2660 AT_CAPTURE_FILE([ofctl_monitor.log])
2661 AT_DATA([flows.txt], [dnl
2662 mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
2663 ])
2664 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2665
2666 dnl Modified MPLS pop action.
2667 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2668 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)
2669 dnl             (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2670 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2671 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
2672
2673 for i in 1 2 3; do
2674     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'
2675 done
2676 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2677 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2678
2679 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2680 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2681 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
2682 dnl
2683 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2684 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
2685 dnl
2686 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2687 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
2688 ])
2689
2690 AT_CHECK([ovs-appctl revalidator/purge], [0])
2691 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2692  n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
2693 OFPST_FLOW reply (OF1.2):
2694 ])
2695
2696 OVS_VSWITCHD_STOP
2697 AT_CLEANUP
2698
2699 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
2700 OVS_VSWITCHD_START([dnl
2701    add-port br0 p1 -- set Interface p1 type=dummy
2702 ])
2703 on_exit 'kill `cat ovs-ofctl.pid`'
2704
2705 AT_CAPTURE_FILE([ofctl_monitor.log])
2706 # A table-miss flow has priority 0 and no match
2707 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2708
2709 dnl Singleton controller action.
2710 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2711
2712 for i in 1 2 3 ; do
2713     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)'
2714 done
2715 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2716 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2717
2718 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2719 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2720 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:0
2721 dnl
2722 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2723 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:0
2724 dnl
2725 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2726 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:0
2727 ])
2728
2729 AT_CHECK([ovs-appctl revalidator/purge], [0])
2730 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2731  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2732 NXST_FLOW reply:
2733 ])
2734
2735 OVS_VSWITCHD_STOP
2736 AT_CLEANUP
2737
2738
2739 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
2740 OVS_VSWITCHD_START([dnl
2741    add-port br0 p1 -- set Interface p1 type=dummy
2742 ])
2743 on_exit 'kill `cat ovs-ofctl.pid`'
2744
2745 AT_CAPTURE_FILE([ofctl_monitor.log])
2746 # A table-miss flow has priority 0 and no match
2747 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2748
2749 dnl Singleton controller action.
2750 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2751
2752 for i in 1 2 3 ; do
2753     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)'
2754 done
2755 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2756 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2757
2758 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2759
2760 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2761 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2762 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:0
2763 dnl
2764 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2765 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:0
2766 dnl
2767 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2768 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:0
2769 ])
2770
2771 AT_CHECK([ovs-appctl revalidator/purge], [0])
2772 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2773  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2774 OFPST_FLOW reply (OF1.3):
2775 ])
2776
2777 OVS_VSWITCHD_STOP
2778 AT_CLEANUP
2779
2780 AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
2781 OVS_VSWITCHD_START([dnl
2782    add-port br0 p1 -- set Interface p1 type=dummy
2783 ])
2784 on_exit 'kill `cat ovs-ofctl.pid`'
2785
2786 ovs-appctl time/stop
2787
2788 AT_CAPTURE_FILE([ofctl_monitor.log])
2789 # A table-miss flow has priority 0 and no match
2790 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2791
2792 dnl Singleton controller action.
2793 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2794
2795 # Become slave (OF 1.3), which should disable everything except port status.
2796 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2797
2798 # Ensure that ovs-vswitchd gets a chance to reply before sending another command.
2799 ovs-appctl time/warp 500 100
2800
2801 # Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
2802 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
2803
2804 ovs-appctl time/warp 500 100
2805 for i in 1 2 3 ; do
2806     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)'
2807 done
2808 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2809 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2810
2811 AT_CHECK([ovs-appctl revalidator/purge], [0])
2812 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2813 send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
2814 OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
2815 dnl
2816 send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
2817  master:
2818        PACKET_IN: (off)
2819      PORT_STATUS: (off)
2820     FLOW_REMOVED: (off)
2821      ROLE_STATUS: (off)
2822     TABLE_STATUS: (off)
2823   REQUESTFORWARD: (off)
2824
2825  slave:
2826        PACKET_IN: no_match
2827      PORT_STATUS: (off)
2828     FLOW_REMOVED: (off)
2829      ROLE_STATUS: (off)
2830     TABLE_STATUS: (off)
2831   REQUESTFORWARD: (off)
2832 dnl
2833 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2834 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:0
2835 dnl
2836 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2837 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:0
2838 dnl
2839 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2840 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:0
2841 ])
2842
2843 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2844
2845 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2846  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2847 OFPST_FLOW reply (OF1.3):
2848 ])
2849
2850 OVS_VSWITCHD_STOP
2851 AT_CLEANUP
2852
2853
2854 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
2855 OVS_VSWITCHD_START([dnl
2856    add-port br0 p1 -- set Interface p1 type=dummy
2857 ])
2858 on_exit 'kill `cat ovs-ofctl.pid`'
2859
2860 AT_CAPTURE_FILE([ofctl_monitor.log])
2861 # A table-miss flow has priority 0 and no match
2862 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2863
2864 dnl Singleton controller action.
2865 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2866
2867 for i in 1 2 3 ; do
2868     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)'
2869 done
2870 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2871 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2872
2873 AT_CHECK([ovs-appctl revalidator/purge], [0])
2874 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2875 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2876 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:0
2877 dnl
2878 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2879 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:0
2880 dnl
2881 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2882 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:0
2883 ])
2884
2885 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2886
2887 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2888  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2889 OFPST_FLOW reply (OF1.4):
2890 ])
2891
2892 OVS_VSWITCHD_STOP
2893 AT_CLEANUP
2894
2895
2896 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
2897 OVS_VSWITCHD_START([dnl
2898    add-port br0 p1 -- set Interface p1 type=dummy
2899 ])
2900 on_exit 'kill `cat ovs-ofctl.pid`'
2901
2902 AT_CAPTURE_FILE([ofctl_monitor.log])
2903 AT_DATA([flows.txt], [dnl
2904 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
2905 table=1 actions=output(CONTROLLER),goto_table(2)
2906 table=2 actions=group:1234
2907 ])
2908 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
2909 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
2910
2911 dnl Singleton controller action.
2912 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2913
2914 for i in 1 2 3 ; do
2915     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)'
2916 done
2917 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2918 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2919
2920 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2921
2922 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2923 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2924 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:0
2925 dnl
2926 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2927 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:0
2928 dnl
2929 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2930 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:0
2931 dnl
2932 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2933 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:0
2934 dnl
2935 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2936 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:0
2937 dnl
2938 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2939 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:0
2940 dnl
2941 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2942 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:0
2943 dnl
2944 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2945 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:0
2946 dnl
2947 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2948 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:0
2949 ])
2950
2951 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2952
2953 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2954  n_packets=3, n_bytes=180, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
2955  table=1, n_packets=3, n_bytes=180, actions=CONTROLLER:65535,goto_table:2
2956  table=2, n_packets=3, n_bytes=180, actions=group:1234
2957 OFPST_FLOW reply (OF1.3):
2958 ])
2959
2960 OVS_VSWITCHD_STOP
2961 AT_CLEANUP
2962
2963
2964 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
2965 OVS_VSWITCHD_START([dnl
2966    add-port br0 p1 -- set Interface p1 type=dummy
2967 ])
2968 on_exit 'kill `cat ovs-ofctl.pid`'
2969
2970 AT_CAPTURE_FILE([ofctl_monitor.log])
2971 AT_DATA([flows.txt], [dnl
2972 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
2973 table=1 actions=output(CONTROLLER),goto_table(2)
2974 table=2 actions=group:1234
2975 ])
2976 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
2977 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
2978
2979 dnl Singleton controller action.
2980 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2981
2982 for i in 1 2 3 ; do
2983     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)'
2984 done
2985 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2986 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2987
2988 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2989
2990 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2991 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2992 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:0
2993 dnl
2994 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
2995 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:0
2996 dnl
2997 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action_set) data_len=60 (unbuffered)
2998 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:0
2999 dnl
3000 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
3001 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:0
3002 dnl
3003 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
3004 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:0
3005 dnl
3006 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action_set) data_len=60 (unbuffered)
3007 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:0
3008 dnl
3009 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
3010 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:0
3011 dnl
3012 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
3013 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:0
3014 dnl
3015 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action_set) data_len=60 (unbuffered)
3016 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:0
3017 ])
3018
3019 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3020
3021 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3022  n_packets=3, n_bytes=180, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3023  table=1, n_packets=3, n_bytes=180, actions=CONTROLLER:65535,goto_table:2
3024  table=2, n_packets=3, n_bytes=180, actions=group:1234
3025 OFPST_FLOW reply (OF1.4):
3026 ])
3027
3028 OVS_VSWITCHD_STOP
3029 AT_CLEANUP
3030
3031
3032 AT_SETUP([ofproto-dpif - ARP modification slow-path])
3033 OVS_VSWITCHD_START
3034 add_of_ports br0 1 2
3035
3036 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3037 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'
3038
3039 # Input some packets that should follow the arp modification slow-path.
3040 for i in 1 2 3; do
3041     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)'
3042 done
3043 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3044
3045 # Check the packets that were output.
3046 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
3047 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
3048 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
3049 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
3050 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
3051 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
3052 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
3053 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
3054 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
3055 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
3056 ])
3057
3058 OVS_VSWITCHD_STOP
3059 AT_CLEANUP
3060
3061 AT_SETUP([ofproto-dpif - VLAN handling])
3062 OVS_VSWITCHD_START(
3063   [set Bridge br0 fail-mode=standalone -- \
3064    add-port br0 p1                                  trunks=10,12 -- \
3065    add-port br0 p2                           tag=10              -- \
3066    add-port br0 p3                           tag=12              \
3067                    other-config:priority-tags=true               -- \
3068    add-port br0 p4                           tag=12              -- \
3069    add-port br0 p5 vlan_mode=native-tagged   tag=10              -- \
3070    add-port br0 p6 vlan_mode=native-tagged   tag=10 trunks=10,12 -- \
3071    add-port br0 p7 vlan_mode=native-untagged tag=12              -- \
3072    add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
3073                    other-config:priority-tags=true               -- \
3074    set Interface p1 type=dummy -- \
3075    set Interface p2 type=dummy -- \
3076    set Interface p3 type=dummy -- \
3077    set Interface p4 type=dummy -- \
3078    set Interface p5 type=dummy -- \
3079    set Interface p6 type=dummy -- \
3080    set Interface p7 type=dummy -- \
3081    set Interface p8 type=dummy --])
3082
3083 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3084 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
3085 dnl actions.
3086 for tuple in \
3087         "100 none 0 drop" \
3088         "100 0    0 drop" \
3089         "100 0    1 drop" \
3090         "100 10   0 1,5,6,7,8,pop_vlan,2" \
3091         "100 10   1 1,5,6,7,8,pop_vlan,2" \
3092         "100 11   0 5,7" \
3093         "100 11   1 5,7" \
3094         "100 12   0 1,5,6,pop_vlan,3,4,7,8" \
3095         "100 12   1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3096         "1  none 0 drop" \
3097         "1  0    0 drop" \
3098         "1  0    1 drop" \
3099         "1  10   0 5,6,7,8,100,pop_vlan,2" \
3100         "1  10   1 5,6,7,8,100,pop_vlan,2" \
3101         "1  11   0 drop" \
3102         "1  11   1 drop" \
3103         "1  12   0 5,6,100,pop_vlan,3,4,7,8" \
3104         "1  12   1 5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3105         "2  none 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3106         "2  0    0 pop_vlan,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3107         "2  0    1 pop_vlan,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
3108         "2  10   0 drop" \
3109         "2  10   1 drop" \
3110         "2  11   0 drop" \
3111         "2  11   1 drop" \
3112         "2  12   0 drop" \
3113         "2  12   1 drop" \
3114         "3  none 0 4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3115         "3  0    0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3116         "3  0    1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
3117         "3  10   0 drop" \
3118         "3  10   1 drop" \
3119         "3  11   0 drop" \
3120         "3  11   1 drop" \
3121         "3  12   0 drop" \
3122         "3  12   1 drop" \
3123         "4  none 0 3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3124         "4  0    0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3125         "4  0    1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
3126         "4  10   0 drop" \
3127         "4  10   1 drop" \
3128         "4  11   0 drop" \
3129         "4  11   1 drop" \
3130         "4  12   0 drop" \
3131         "4  12   1 drop" \
3132         "5  none 0 2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3133         "5  0    0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3134         "5  0    1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3135         "5  10   0 1,6,7,8,100,pop_vlan,2" \
3136         "5  10   1 1,6,7,8,100,pop_vlan,2" \
3137         "5  11   0 7,100" \
3138         "5  11   1 7,100" \
3139         "5  12   0 1,6,100,pop_vlan,3,4,7,8" \
3140         "5  12   1 1,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3141         "6  none 0 2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3142         "6  0    0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3143         "6  0    1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3144         "6  10   0 1,5,7,8,100,pop_vlan,2" \
3145         "6  10   1 1,5,7,8,100,pop_vlan,2" \
3146         "6  11   0 drop" \
3147         "6  11   1 drop" \
3148         "6  12   0 1,5,100,pop_vlan,3,4,7,8" \
3149         "6  12   1 1,5,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3150         "7  none 0 3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3151         "7  0    0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3152         "7  0    1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),1,5,6,100" \
3153         "7  10   0 1,5,6,8,100,pop_vlan,2" \
3154         "7  10   1 1,5,6,8,100,pop_vlan,2" \
3155         "7  11   0 5,100" \
3156         "7  11   1 5,100" \
3157         "7  12   0 1,5,6,100,pop_vlan,3,4,8" \
3158         "7  12   1 1,5,6,100,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
3159         "8  none 0 3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
3160         "8  0    0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
3161         "8  0    1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
3162         "8  10   0 1,5,6,7,100,pop_vlan,2" \
3163         "8  10   1 1,5,6,7,100,pop_vlan,2" \
3164         "8  11   0 drop" \
3165         "8  11   1 drop" \
3166         "8  12   0 1,5,6,100,pop_vlan,3,4,7" \
3167         "8  12   1 1,5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
3168 do
3169   set $tuple
3170   in_port=$1
3171   vlan=$2
3172   pcp=$3
3173   expected=$4
3174
3175   if test $vlan = none; then
3176     flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
3177   else
3178     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))"
3179   fi
3180
3181   echo "----------------------------------------------------------------------"
3182   echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3183
3184   AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3185   actual=`tail -1 stdout | sed 's/Datapath actions: //'`
3186
3187   AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
3188   mv stdout expout
3189   AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
3190 done
3191
3192 OVS_VSWITCHD_STOP
3193 AT_CLEANUP
3194
3195 AT_SETUP([ofproto-dpif - MPLS handling])
3196 OVS_VSWITCHD_START([dnl
3197    add-port br0 p1 -- set Interface p1 type=dummy
3198 ])
3199 on_exit 'kill `cat ovs-ofctl.pid`'
3200
3201 AT_CAPTURE_FILE([ofctl_monitor.log])
3202 AT_DATA([flows.txt], [dnl
3203 dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
3204 dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
3205 dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
3206 ])
3207 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3208
3209 dnl In this test, we push an MPLS tag to an ethernet packet.
3210 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3211
3212 for i in 1 2 3; do
3213     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)'
3214 done
3215 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3216 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3217
3218 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3219 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3220 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
3221 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3222 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3223 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3224 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3225 dnl
3226 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3227 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
3228 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3229 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3230 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3231 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3232 dnl
3233 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3234 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
3235 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3236 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3237 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3238 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3239 ])
3240
3241 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3242 dnl copied exactly, except for the BOS bit.
3243 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3244
3245 for i in 1 2 3; do
3246     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)'
3247 done
3248 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3249 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3250
3251 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3252 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3253 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
3254 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3255 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3256 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3257 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3258 dnl
3259 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3260 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
3261 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3262 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3263 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3264 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3265 dnl
3266 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3267 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
3268 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3269 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3270 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3271 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3272 ])
3273
3274 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3275 dnl copied exactly, except for the BOS bit. The ethertype should be updated
3276 dnl to the MPLS ethertype of the MPLS push action which differs to that
3277 dnl of the input packet.
3278 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3279
3280 for i in 1 2 3; do
3281     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)'
3282 done
3283 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3284 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3285
3286 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3287 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3288 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
3289 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3290 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3291 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3292 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3293 dnl
3294 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3295 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
3296 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3297 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3298 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3299 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3300 dnl
3301 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3302 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
3303 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3304 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3305 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3306 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3307 ])
3308
3309 OVS_VSWITCHD_STOP
3310 AT_CLEANUP
3311
3312 AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3313 OVS_VSWITCHD_START([dnl
3314    add-port br0 p1 -- set Interface p1 type=dummy
3315 ])
3316 on_exit 'kill `cat ovs-ofctl.pid`'
3317
3318 AT_CAPTURE_FILE([ofctl_monitor.log])
3319 AT_DATA([flows.txt], [dnl
3320 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
3321 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
3322 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
3323 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
3324 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
3325 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
3326 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
3327 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
3328 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
3329 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
3330 ])
3331 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3332
3333 dnl Modified MPLS controller action.
3334 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3335 dnl both of these in the final flow
3336 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3337
3338 for i in 1 2 3; do
3339     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)'
3340 done
3341 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3342 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3343
3344 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3345 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3346 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3347 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3348 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3349 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3350 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3351 00000040  00 00 00 00
3352 dnl
3353 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3354 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3355 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3356 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3357 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3358 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3359 00000040  00 00 00 00
3360 dnl
3361 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3362 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3363 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3364 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3365 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3366 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3367 00000040  00 00 00 00
3368 ])
3369
3370 dnl Modified MPLS controller action.
3371 dnl In this test, the input packet is vlan-tagged, which should be stripped
3372 dnl before we push the MPLS and VLAN tags.
3373 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3374
3375 for i in 1 2 3; do
3376     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))'
3377 done
3378 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3379 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3380
3381 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3382 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3383 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3384 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3385 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3386 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3387 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3388 dnl
3389 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3390 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3391 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3392 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3393 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3394 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3395 dnl
3396 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3397 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3398 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3399 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3400 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3401 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3402 ])
3403
3404 dnl Modified MPLS controller action.
3405 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3406 dnl both of these in the final flow
3407 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3408
3409 for i in 1 2 3; do
3410     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)'
3411 done
3412 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3413 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3414
3415 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3416 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3417 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3418 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3419 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3420 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3421 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3422 00000040  00 00 00 00
3423 dnl
3424 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3425 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3426 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3427 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3428 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3429 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3430 00000040  00 00 00 00
3431 dnl
3432 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3433 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3434 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3435 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3436 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3437 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3438 00000040  00 00 00 00
3439 ])
3440
3441 dnl Modified MPLS controller action.
3442 dnl In this test, the input packet is vlan-tagged, which should be stripped
3443 dnl before we push the MPLS and VLAN tags.
3444 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3445
3446 for i in 1 2 3; do
3447     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))'
3448 done
3449 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3450 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3451
3452 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3453 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3454 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3455 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3456 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3457 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3458 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3459 dnl
3460 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3461 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3462 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3463 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3464 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3465 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3466 dnl
3467 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3468 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3469 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3470 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3471 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3472 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3473 ])
3474
3475 dnl Modified MPLS controller action.
3476 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3477 dnl actions are reordered, so we see both of these in the final flow.
3478 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3479
3480 for i in 1 2 3; do
3481     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)'
3482 done
3483 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3484 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3485
3486 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3487 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3488 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3489 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3490 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3491 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3492 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3493 00000040  00 00 00 00
3494 dnl
3495 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3496 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3497 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3498 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3499 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3500 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3501 00000040  00 00 00 00
3502 dnl
3503 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3504 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3505 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3506 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3507 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3508 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3509 00000040  00 00 00 00
3510 ])
3511
3512 dnl Modified MPLS controller action.
3513 dnl In this test, the input packet is vlan-tagged, which should be stripped
3514 dnl before we push the MPLS and VLAN tags.
3515 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3516
3517 for i in 1 2 3; do
3518     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))'
3519 done
3520 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3521 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3522
3523 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3524 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3525 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3526 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3527 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3528 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3529 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3530 dnl
3531 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3532 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3533 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3534 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3535 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3536 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3537 dnl
3538 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3539 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3540 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3541 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3542 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3543 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3544 ])
3545
3546 dnl Modified MPLS controller action.
3547 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3548 dnl actions are reordered, so we see both of these in the final flow.
3549 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3550
3551 for i in 1 2 3; do
3552     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)'
3553 done
3554 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3555 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3556
3557 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3558 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3559 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3560 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3561 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3562 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3563 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3564 00000040  00 00 00 00
3565 dnl
3566 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3567 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3568 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3569 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3570 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3571 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3572 00000040  00 00 00 00
3573 dnl
3574 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3575 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3576 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3577 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3578 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3579 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3580 00000040  00 00 00 00
3581 ])
3582
3583 dnl Modified MPLS controller action.
3584 dnl In this test, the input packet is vlan-tagged, which should be stripped
3585 dnl before we push the MPLS and VLAN tags.
3586 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
3587
3588 for i in 1 2 3; do
3589     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))'
3590 done
3591 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3592 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3593
3594 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3595 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3596 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3597 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3598 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3599 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3600 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3601 dnl
3602 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3603 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3604 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3605 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3606 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3607 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3608 dnl
3609 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3610 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3611 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3612 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3613 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3614 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3615 ])
3616
3617 dnl Modified MPLS controller action.
3618 dnl In this test, the input packet is vlan-tagged, which should be stripped
3619 dnl before we push the MPLS and VLAN tags.
3620 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3621
3622 for i in 1 2 3; do
3623     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))'
3624 done
3625 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3626 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3627
3628 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3629 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3630 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3631 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3632 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3633 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3634 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3635 dnl
3636 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3637 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3638 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3639 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3640 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3641 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3642 dnl
3643 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3644 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3645 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3646 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3647 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3648 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3649 ])
3650
3651 dnl Modified MPLS controller action.
3652 dnl In this test, the input packet is vlan-tagged, which should be modified
3653 dnl before we push MPLS and VLAN tags.
3654 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3655
3656 for i in 1 2 3; do
3657     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))'
3658 done
3659 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3660 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3661
3662 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3663 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3664 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3665 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3666 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3667 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3668 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3669 dnl
3670 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3671 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3672 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3673 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3674 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3675 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3676 dnl
3677 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3678 mpls,dl_vlan=99,dl_vlan_pcp=1,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
3679 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3680 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3681 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3682 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3683 ])
3684
3685 AT_CHECK([ovs-appctl revalidator/purge], [0])
3686 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3687  cookie=0xa, n_packets=3, n_bytes=180, 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
3688  cookie=0xa, n_packets=3, n_bytes=180, 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
3689  cookie=0xa, n_packets=3, n_bytes=180, 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
3690  cookie=0xa, n_packets=3, n_bytes=180, 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
3691  cookie=0xa, n_packets=3, n_bytes=180, 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
3692  cookie=0xa, n_packets=3, n_bytes=180, 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
3693  cookie=0xa, n_packets=3, n_bytes=180, 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
3694  cookie=0xa, n_packets=3, n_bytes=180, 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
3695  cookie=0xa, n_packets=3, n_bytes=180, 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
3696  cookie=0xa, n_packets=3, n_bytes=180, 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
3697 OFPST_FLOW reply (OF1.2):
3698 ])
3699
3700 OVS_VSWITCHD_STOP
3701 AT_CLEANUP
3702
3703 AT_SETUP([ofproto-dpif - fragment handling - trace])
3704 OVS_VSWITCHD_START
3705 add_of_ports br0 1 2 3 4 5 6 90
3706 AT_DATA([flows.txt], [dnl
3707 priority=75 tcp ip_frag=no    tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
3708 priority=75 tcp ip_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
3709 priority=50 tcp ip_frag=no              actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
3710 priority=50 tcp ip_frag=first           actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
3711 priority=50 tcp ip_frag=later           actions=output:6
3712 ])
3713 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3714
3715 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"
3716 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3717 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3718 later_flow="$base_flow,frag=later)"
3719
3720     # mode    no  first  later
3721 for tuple in \
3722     'normal    1     5      6' \
3723     'drop      1  drop   drop' \
3724     'nx-match  1     2      6'
3725 do
3726   set $tuple
3727   mode=$1
3728   no=$2
3729   first=$3
3730   later=$4
3731
3732   AT_CHECK([ovs-ofctl set-frags br0 $mode])
3733   for type in no first later; do
3734     eval flow=\$${type}_flow exp_output=\$$type
3735     printf "\n%s\n" "----$mode $type-----"
3736     AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3737     : > expout
3738     if test $mode = drop && test $type != no; then
3739         echo 'Packets dropped because they are IP fragments and the fragment handling mode is "drop".' >> expout
3740         echo "Datapath actions: $exp_output" >> expout
3741     elif test $type = later; then
3742         echo "Datapath actions: $exp_output" >> expout
3743     else
3744         echo "Datapath actions: set(tcp(src=80,dst=80)),$exp_output" >> expout
3745     fi
3746     AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
3747   done
3748 done
3749 OVS_VSWITCHD_STOP
3750 AT_CLEANUP
3751
3752 AT_SETUP([ofproto-dpif - fragment handling - upcall])
3753 OVS_VSWITCHD_START
3754 add_of_ports br0 1 2 3 4 5 6 90
3755 AT_DATA([flows.txt], [dnl
3756 priority=75 tcp ip_frag=no    tp_dst=80 actions=set_field:81->tcp_dst,output:1
3757 priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
3758 priority=50 tcp ip_frag=no              actions=set_field:81->tcp_dst,output:4
3759 priority=50 tcp ip_frag=first           actions=set_field:81->tcp_dst,output:5
3760 priority=50 tcp ip_frag=later           actions=output:6
3761 ])
3762 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3763
3764 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"
3765 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3766 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3767 later_flow="$base_flow,frag=later)"
3768
3769 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3770
3771 mode=normal
3772
3773 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3774 for type in no first later; do
3775   eval flow=\$${type}_flow
3776   printf "\n%s\n" "----$mode $type-----"
3777
3778   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3779 done
3780
3781 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3782 flow-dump from non-dpdk interfaces:
3783 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
3784 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),5
3785 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3786 ])
3787
3788 mode=drop
3789
3790 AT_CHECK([ovs-appctl revalidator/purge], [0])
3791 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3792 for type in no first later; do
3793   eval flow=\$${type}_flow
3794   printf "\n%s\n" "----$mode $type-----"
3795
3796   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3797 done
3798
3799 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3800 flow-dump from non-dpdk interfaces:
3801 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
3802 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
3803 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
3804 ])
3805
3806 mode=nx-match
3807
3808 AT_CHECK([ovs-appctl revalidator/purge], [0])
3809 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3810 for type in no first later; do
3811   eval flow=\$${type}_flow
3812   printf "\n%s\n" "----$mode $type-----"
3813
3814   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3815 done
3816
3817 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3818 flow-dump from non-dpdk interfaces:
3819 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
3820 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),2
3821 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3822 ])
3823
3824 OVS_VSWITCHD_STOP
3825 AT_CLEANUP
3826
3827 AT_SETUP([ofproto-dpif - fragment handling - actions])
3828 OVS_VSWITCHD_START
3829 add_of_ports br0 1 2 3 4 5 6 90
3830
3831 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])
3832 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3833 source field tcp_dst lacks correct prerequisites
3834 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3835 ])
3836
3837 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])
3838 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3839 destination field tcp_src lacks correct prerequisites
3840 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3841 ])
3842
3843 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
3844 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3845 set_field udp_src lacks correct prerequisities
3846 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3847 ])
3848
3849 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
3850 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3851 set_field udp_dst lacks correct prerequisities
3852 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3853 ])
3854
3855 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
3856 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3857 set_field sctp_src lacks correct prerequisities
3858 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3859 ])
3860
3861 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
3862 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3863 set_field sctp_dst lacks correct prerequisities
3864 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3865 ])
3866
3867 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])
3868 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3869 source field tcp_dst lacks correct prerequisites
3870 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3871 ])
3872
3873 AT_DATA([flows.txt], [dnl
3874 priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
3875 ])
3876 AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
3877
3878 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3879
3880 mode=normal
3881
3882 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3883 for frag in 4000 6000 6008 4010; do
3884   printf "\n%s\n" "----$mode $frag-----"
3885
3886   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"])
3887 done
3888
3889 dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
3890 dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
3891 dnl OVS-2.5, the wildcards and set_field mask are shared internally.
3892 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3893 flow-dump from non-dpdk interfaces:
3894 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
3895 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
3896 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
3897 ])
3898
3899 AT_CHECK([ovs-appctl revalidator/purge], [0])
3900 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3901 for frag in 4000 6000 6008 4010; do
3902   printf "\n%s\n" "----$mode $frag truncated transport header -----"
3903
3904   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
3905 done
3906
3907 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3908 flow-dump from non-dpdk interfaces:
3909 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
3910 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
3911 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
3912 ])
3913
3914 AT_CHECK([ovs-appctl revalidator/purge], [0])
3915 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3916 for frag in 4000 6000 6001 4002; do
3917   printf "\n%s\n" "----$mode $frag missing transport header-----"
3918
3919   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
3920 done
3921
3922 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3923 flow-dump from non-dpdk interfaces:
3924 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
3925 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
3926 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
3927 ])
3928
3929 OVS_VSWITCHD_STOP
3930 AT_CLEANUP
3931
3932 AT_SETUP([ofproto-dpif - exit])
3933 OVS_VSWITCHD_START
3934 add_of_ports br0 1 2 3 10 11 12 13 14
3935 AT_DATA([flows.txt], [dnl
3936 in_port=1 actions=output:10,exit,output:11
3937 in_port=2 actions=output:12,resubmit:1,output:12
3938 in_port=3 actions=output:13,resubmit:2,output:14
3939 ])
3940 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3941 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])
3942 AT_CHECK([tail -1 stdout], [0],
3943   [Datapath actions: 10
3944 ])
3945 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])
3946 AT_CHECK([tail -1 stdout], [0],
3947   [Datapath actions: 12,10
3948 ])
3949 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])
3950 AT_CHECK([tail -1 stdout], [0],
3951   [Datapath actions: 13,12,10
3952 ])
3953 OVS_VSWITCHD_STOP
3954 AT_CLEANUP
3955
3956
3957 AT_SETUP([ofproto-dpif - mirroring, select_all])
3958 AT_KEYWORDS([mirror mirrors mirroring])
3959 OVS_VSWITCHD_START
3960 add_of_ports br0 1 2 3
3961 ovs-vsctl \
3962         set Bridge br0 mirrors=@m --\
3963         --id=@p3 get Port p3 --\
3964         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
3965
3966 AT_DATA([flows.txt], [dnl
3967 in_port=1 actions=output:2
3968 in_port=2 actions=output:1
3969 ])
3970 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3971
3972 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)"
3973 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3974 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3975   [Datapath actions: 3,2
3976 ])
3977
3978 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)"
3979 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3980 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3981   [Datapath actions: 3,1
3982 ])
3983
3984 OVS_VSWITCHD_STOP
3985 AT_CLEANUP
3986
3987
3988 AT_SETUP([ofproto-dpif - mirroring, select_src])
3989 AT_KEYWORDS([mirror mirrors mirroring])
3990 OVS_VSWITCHD_START
3991 add_of_ports br0 1 2 3
3992 ovs-vsctl \
3993         set Bridge br0 mirrors=@m --\
3994         --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
3995         --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
3996
3997 AT_DATA([flows.txt], [dnl
3998 in_port=1 actions=output:2
3999 in_port=2 actions=output:1
4000 ])
4001 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4002
4003 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)"
4004 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4005 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4006   [Datapath actions: 3,2
4007 ])
4008
4009 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)"
4010 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4011 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4012   [Datapath actions: 1
4013 ])
4014 OVS_VSWITCHD_STOP
4015 AT_CLEANUP
4016
4017 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
4018 AT_KEYWORDS([mirror mirrors mirroring])
4019 OVS_VSWITCHD_START
4020 add_of_ports br0 1 2
4021 ovs-vsctl \
4022         set Bridge br0 mirrors=@m --\
4023         --id=@p2 get Port p2 --\
4024         --id=@m create Mirror name=mymirror select_all=true output_port=@p2
4025
4026 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4027
4028 # "in_port" defaults to OFPP_NONE if it's not specified.
4029 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"
4030 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4031 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4032   [Datapath actions: 1,2
4033 ])
4034
4035 OVS_VSWITCHD_STOP
4036 AT_CLEANUP
4037
4038
4039 AT_SETUP([ofproto-dpif - mirroring, select_dst])
4040 AT_KEYWORDS([mirror mirrors mirroring])
4041 OVS_VSWITCHD_START
4042 add_of_ports br0 1 2 3
4043 ovs-vsctl \
4044         set Bridge br0 mirrors=@m --\
4045         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4046         --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
4047
4048 AT_DATA([flows.txt], [dnl
4049 in_port=1 actions=output:2
4050 in_port=2 actions=output:1
4051 ])
4052 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4053
4054 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)"
4055 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4056 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4057   [Datapath actions: 2,3
4058 ])
4059
4060 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)"
4061 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4062 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4063   [Datapath actions: 1
4064 ])
4065
4066 OVS_VSWITCHD_STOP
4067 AT_CLEANUP
4068
4069
4070 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
4071 AT_KEYWORDS([mirror mirrors mirroring])
4072 OVS_VSWITCHD_START
4073 add_of_ports br0 1 2 3
4074 ovs-vsctl \
4075         set Bridge br0 mirrors=@m --\
4076         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4077         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
4078
4079 AT_DATA([flows.txt], [dnl
4080 in_port=1, actions=output:2
4081 ])
4082 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4083
4084 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)"
4085 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4086 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4087   [Datapath actions: 2
4088 ])
4089
4090 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))"
4091 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4092 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4093   [Datapath actions: 2
4094 ])
4095
4096 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))"
4097 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4098 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4099   [Datapath actions: 3,2
4100 ])
4101
4102 OVS_VSWITCHD_STOP
4103 AT_CLEANUP
4104
4105
4106 AT_SETUP([ofproto-dpif - mirroring, output_port])
4107 AT_KEYWORDS([mirror mirrors mirroring])
4108 OVS_VSWITCHD_START
4109 add_of_ports br0 1 2 3
4110 ovs-vsctl \
4111         set Bridge br0 mirrors=@m --\
4112         --id=@p3 get Port p3 --\
4113         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4114
4115 AT_DATA([flows.txt], [dnl
4116 in_port=1 actions=mod_vlan_vid:17,output:2
4117 in_port=2 actions=output:1
4118 ])
4119 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4120
4121 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)"
4122 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4123 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4124   [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
4125 ])
4126
4127 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)"
4128 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4129 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4130   [Datapath actions: 3,1
4131 ])
4132
4133 OVS_VSWITCHD_STOP
4134 AT_CLEANUP
4135
4136 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
4137 AT_KEYWORDS([mirror mirrors mirroring])
4138 OVS_VSWITCHD_START
4139 add_of_ports br0 1 2
4140 ovs-vsctl \
4141         set Bridge br0 mirrors=@m --\
4142         --id=@m create Mirror name=mymirror select_all=true output_vlan=12
4143
4144 AT_DATA([flows.txt], [dnl
4145 in_port=1 actions=output:2
4146 in_port=2 actions=mod_vlan_vid:17,output:1
4147 ])
4148 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4149
4150 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)"
4151 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4152 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4153
4154 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
4155 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4156 mv stdout expout
4157 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4158
4159 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)"
4160 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4161 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4162
4163 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
4164 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4165 mv stdout expout
4166 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4167
4168 OVS_VSWITCHD_STOP
4169 AT_CLEANUP
4170
4171 # This verifies that we don't get duplicate mirroring when mirror_packet()
4172 # might be invoked recursively, as a check against regression.
4173 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
4174 AT_KEYWORDS([mirror mirrors mirroring])
4175 OVS_VSWITCHD_START
4176 add_of_ports br0 1 2 3
4177 ovs-vsctl \
4178         -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4179         -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
4180         -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
4181         -- set Port br0 tag=0 \
4182         -- set Port p1 tag=0 \
4183         -- set Port p2 tag=500 \
4184         -- set Port p3 tag=501
4185
4186 flow='in_port=1'
4187 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4188 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4189 s/,/\
4190 /g' | sort], [0], [100
4191 2
4192 3
4193 ])
4194
4195 OVS_VSWITCHD_STOP
4196 AT_CLEANUP
4197
4198 # This test verifies that mirror state is preserved across recirculation.
4199 #
4200 # Otherwise, post-recirculation the ingress and the output to port 4
4201 # would cause the packet to be mirrored to port 3 a second time.
4202 AT_SETUP([ofproto-dpif - mirroring with recirculation])
4203 AT_KEYWORDS([mirror mirrors mirroring])
4204 OVS_VSWITCHD_START
4205 add_of_ports br0 1 2 3 4
4206 ovs-vsctl \
4207         set Bridge br0 mirrors=@m --\
4208         --id=@p3 get Port p3 --\
4209         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4210
4211 AT_DATA([flows.txt], [dnl
4212 in_port=1 actions=2,debug_recirc,4
4213 ])
4214 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4215
4216 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)"
4217 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4218 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4219 ])
4220 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4221 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4222 ])
4223
4224 OVS_VSWITCHD_STOP
4225 AT_CLEANUP
4226
4227 # This test verifies that the table ID is preserved across recirculation
4228 # when a resubmit action requires it (because the action is relative to
4229 # the current table rather than specifying a table).
4230 AT_SETUP([ofproto-dpif - resubmit with recirculation])
4231 OVS_VSWITCHD_START
4232 add_of_ports br0 1 2 3
4233
4234 AT_DATA([flows.txt], [dnl
4235 table=0 in_port=1  actions=2,resubmit(,1)
4236 table=1 in_port=1  actions=debug_recirc,resubmit:55
4237 table=1 in_port=55 actions=3
4238 ])
4239 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4240
4241 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)"
4242 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4243 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
4244 ])
4245 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4246 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
4247 ])
4248
4249 OVS_VSWITCHD_STOP
4250 AT_CLEANUP
4251
4252 # This test verifies that "resubmit", when it triggers recirculation
4253 # indirectly through the flow that it recursively invokes, is not
4254 # re-executed when execution continues later post-recirculation.
4255 AT_SETUP([ofproto-dpif - recirculation after resubmit])
4256 OVS_VSWITCHD_START
4257 add_of_ports br0 1 2
4258
4259 AT_DATA([flows.txt], [dnl
4260 table=0 in_port=1 actions=resubmit(,1),2
4261 table=1 in_port=1 actions=debug_recirc
4262 ])
4263 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4264
4265 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)"
4266 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4267 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
4268 ])
4269 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4270 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
4271 ])
4272
4273 OVS_VSWITCHD_STOP
4274 AT_CLEANUP
4275
4276 dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
4277 dnl
4278 dnl Checks the implementation of the continuation mechanism that allows the
4279 dnl packet processing pipeline to be paused and resumed.  Starts by creating
4280 dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
4281 dnl flows listed in ACTIONS0 to that bridge.  Then, injects a packet at port 1
4282 dnl in the bridge, resuming each time the pipeline pauses, and expects a single
4283 dnl packet to be output at each port 2 through N_PORTS0.  Then, as long as
4284 dnl ACTIONS0 still contains at least one "pause" action, removes one of them
4285 dnl and repeats the process.
4286 dnl
4287 dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
4288 dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
4289 dnl ACTIONS1 may also contain "pause" actions.  Packets are only ever injected
4290 dnl into port 1 on br0, so br1 only comes into action if a patch port (added
4291 dnl by EXTRA_SETUP) jumps from one bridge to another.
4292 dnl
4293 dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
4294 dnl both bridges, e.g. to configure mirrors or patch ports.
4295 m4_define([CHECK_CONTINUATION], [dnl
4296     AT_SETUP([ofproto-dpif - continuation - $1])
4297     AT_KEYWORDS([continuations pause resume])
4298     OVS_VSWITCHD_START
4299
4300     # count_matches STRING
4301     #
4302     # Prints on stdout the number of occurrences of STRING in stdin.
4303     count_matches () {
4304         sed -n ":start
4305     s/$[1]//p
4306     t start" | wc -l
4307     }
4308
4309     add_of_ports --pcap br0 `seq 1 $2`
4310     m4_if([$3], [0], [],
4311       [add_of_br 1
4312        add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
4313
4314     AT_CAPTURE_FILE([ofctl_monitor0.log])
4315     AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
4316     m4_if([$3], [0], [],
4317       [AT_CAPTURE_FILE([ofctl_monitor1.log])
4318        AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
4319
4320     actions0='$4'
4321     actions1='$5'
4322     $6
4323     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)"
4324     n_packets=0
4325     n_resumes=0
4326     while true; do
4327         printf "\n\nactions for br0:\n%s\n" "$actions0"
4328         m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
4329
4330         # Add flows.
4331         AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
4332         m4_if([$3], [0], [],
4333             [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
4334
4335         # Run a packet through the switch.
4336         AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
4337
4338         # Wait for the expected number of packets to show up.
4339         n_packets=`expr $n_packets + $2 - 1 + $3`
4340         echo "waiting for $n_packets packets..."
4341         OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
4342
4343         # Wait for the expected number of NXT_RESUMEs to be logged.
4344         n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
4345         echo "waiting for $n_resumes NXT_RESUMEs..."
4346         OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
4347
4348         # Eliminate one "pause" from the actions.
4349         #
4350         # If there were none left, then we're done.
4351         next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
4352         if test X"$actions0" = X"$next_actions0"; then
4353             next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
4354             if test X"$actions1" = X"$next_actions1"; then
4355                 break
4356             else
4357                 actions1=$next_actions1
4358             fi
4359         else
4360             actions0=$next_actions0
4361         fi
4362
4363         # Delete all the flows and verify that there are none, so that we
4364         # can be sure that our updated flow tables is actually in use
4365         # later.
4366         AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
4367           [NXST_FLOW reply:
4368 ])
4369         m4_if([$3], [0], [],
4370           [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
4371              [NXST_FLOW reply:
4372 ])])
4373     done
4374     OVS_VSWITCHD_STOP
4375     AT_CLEANUP
4376 ])
4377
4378 # Check that pause at the end of the pipeline works OK.
4379 #
4380 # (xlate_continuation() has a special case for no-op actions; this
4381 # fails without that special case.)
4382 CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
4383
4384 # Check that remaining actions are preserved following resume.
4385 CHECK_CONTINUATION([actions], [7], [0],
4386   [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
4387
4388 # Check that multiple levels of resubmit continue following resume.
4389 #
4390 # The "resubmit:55", which is relative to the current table, is
4391 # particularly interesting because it checks that the notion of the
4392 # current table is correctly preserved.
4393 CHECK_CONTINUATION([resubmit], [10], [0],
4394   [table=0 in_port=1  actions=pause 2 pause resubmit(,1) pause 10 pause
4395    table=1 in_port=1  actions=pause 3 pause resubmit(,2) pause 9 pause
4396    table=2 in_port=1  actions=pause 4 pause resubmit(,3) pause 8 pause
4397    table=3 in_port=1  actions=pause 5 pause resubmit:55  pause 7 pause
4398    table=3 in_port=55 actions=pause 6 pause])
4399
4400 # Check that the action set is preserved across pause/resume.
4401 CHECK_CONTINUATION([action set], [3], [0],
4402   [in_port=1 actions=1 pause resubmit(,1) pause 2
4403    table=1 actions=write_actions(3)])
4404
4405 # Check that metadata and the stack used by push and pop is preserved
4406 # across pause/resume.
4407 CHECK_CONTINUATION([data stack], [3], [0],
4408   [in_port=1 actions=pause dnl
4409                      set_field:1->reg0 dnl
4410                      pause dnl
4411                      set_field:2->reg1 dnl
4412                      pause dnl
4413                      output:NXM_NX_REG0[[]] dnl
4414                      pause dnl
4415                      push:NXM_NX_REG1[[]] dnl
4416                      dnl
4417                      pop:NXM_NX_REG2[[]] dnl
4418                      pause dnl
4419                      output:NXM_NX_REG2[[]] dnl
4420                      pause dnl
4421                      3])
4422
4423 # Check that mirror output occurs once and once only, even if
4424 # separated by pause/resume.
4425 CHECK_CONTINUATION([mirroring], [5], [0],
4426   [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
4427   [ovs-vsctl \
4428        set Bridge br0 mirrors=@m --\
4429        --id=@p2 get Port p2 --\
4430        --id=@p3 get Port p3 --\
4431        --id=@p4 get Port p4 --\
4432        --id=@p5 get Port p5 --\
4433        --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
4434
4435 # Check that pause works in the presence of patch ports.
4436 CHECK_CONTINUATION([patch ports], [4], [1],
4437   [table=0 in_port=1  actions=pause 2 resubmit(,1) pause 4
4438    table=1 in_port=1  actions=pause 3 pause 10 pause],
4439   [table=0 in_port=11 actions=pause 5 pause],
4440   [ovs-vsctl \
4441        -- add-port br0 patch10 \
4442        -- set interface patch10 type=patch options:peer=patch11 \
4443                                 ofport_request=10 \
4444        -- add-port br1 patch11 \
4445        -- set interface patch11 type=patch options:peer=patch10 \
4446                                 ofport_request=11])
4447
4448 # Two testcases below are for the ofproto/trace command
4449 # The first one tests all correct syntax:
4450 # ofproto/trace [dp_name] odp_flow [-generate|packet]
4451 # ofproto/trace br_name br_flow [-generate|packet]
4452 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
4453 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
4454 add_of_ports br0 1 2 3
4455
4456 AT_DATA([flows.txt], [dnl
4457 in_port=1 actions=output:2
4458 in_port=2 actions=output:1
4459 ])
4460 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4461
4462 odp_flow="in_port(p1)"
4463 br_flow="in_port=1"
4464 # Test command: ofproto/trace odp_flow with in_port as a name.
4465 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4466 AT_CHECK([tail -1 stdout], [0], [dnl
4467 Datapath actions: 2
4468 ])
4469
4470 odp_flow="in_port(1)"
4471 # Test command: ofproto/trace odp_flow
4472 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4473 AT_CHECK([tail -1 stdout], [0], [dnl
4474 Datapath actions: 2
4475 ])
4476
4477 # Test command: ofproto/trace dp_name odp_flow
4478 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
4479 AT_CHECK([tail -1 stdout], [0], [dnl
4480 Datapath actions: 2
4481 ])
4482 # Test commmand: ofproto/trace br_name br_flow
4483 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4484 AT_CHECK([tail -1 stdout], [0], [dnl
4485 Datapath actions: 2
4486 ])
4487
4488 # Delete the inserted flows
4489 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
4490 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
4491
4492 # This section below tests the [-generate] option
4493 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
4494 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"
4495
4496 # Test command: ofproto/trace odp_flow
4497 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4498 # Check for no MAC learning entry
4499 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4500  port  VLAN  MAC                Age
4501 ])
4502
4503 # Test command: ofproto/trace br_name br_flow
4504 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4505 # Check for no MAC learning entry
4506 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4507  port  VLAN  MAC                Age
4508 ])
4509
4510 # Test command: ofproto/trace odp_flow -generate
4511 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
4512 # Check for the MAC learning entry
4513 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4514  port  VLAN  MAC                Age
4515     3     0  50:54:00:00:00:05    ?
4516 ])
4517
4518 # Test command: ofproto/trace dp_name odp_flow -generate
4519 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4520   "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
4521   -generate], [0], [stdout])
4522 # Check for both MAC learning entries
4523 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4524  port  VLAN  MAC                Age
4525     3     0  50:54:00:00:00:05    ?
4526     1     0  50:54:00:00:00:06    ?
4527 ])
4528
4529 # Test command: ofproto/trace br_name br_flow -generate
4530 AT_CHECK([ovs-appctl ofproto/trace br0 \
4531   "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
4532   -generate], [0], [stdout])
4533 # Check for both MAC learning entries.
4534 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4535  port  VLAN  MAC                Age
4536     3     0  50:54:00:00:00:05    ?
4537     1     0  50:54:00:00:00:06    ?
4538     2     0  50:54:00:00:00:07    ?
4539 ])
4540
4541 # This section beflow tests the [packet] option
4542 # The ovs-tcpundump of packets between port1 and port2
4543 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4544 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
4545
4546 # Construct the MAC learning table
4547 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4548   "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
4549   -generate], [0], [stdout])
4550
4551 # Construct the MAC learning table
4552 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4553   "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
4554   -generate], [0], [stdout])
4555
4556 # Test command: ofproto/trace odp_flow packet
4557 AT_CHECK([ovs-appctl ofproto/trace \
4558   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4559 AT_CHECK([tail -1 stdout], [0], [dnl
4560 Datapath actions: 2
4561 ])
4562 AT_CHECK([head -n 2 stdout], [0], [dnl
4563 Bridge: br0
4564 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
4565 ])
4566
4567 # Test command: ofproto/trace dp_name odp_flow packet
4568 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4569   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4570 AT_CHECK([tail -1 stdout], [0], [dnl
4571 Datapath actions: 2
4572 ])
4573 AT_CHECK([head -n 2 stdout], [0], [dnl
4574 Bridge: br0
4575 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
4576 ])
4577
4578 # Test command: ofproto/trace br_name br_flow packet
4579 AT_CHECK([ovs-appctl ofproto/trace br0 \
4580   "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
4581 AT_CHECK([tail -1 stdout], [0], [dnl
4582 Datapath actions: 1
4583 ])
4584 AT_CHECK([head -n 2 stdout], [0], [dnl
4585 Bridge: br0
4586 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
4587 ])
4588
4589 OVS_VSWITCHD_STOP
4590 AT_CLEANUP
4591
4592 # The second test tests the corner cases
4593 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
4594 OVS_VSWITCHD_START
4595 add_of_ports br0 1 2
4596
4597 # Define flows
4598 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
4599 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
4600 # Define options
4601 generate="-generate"
4602 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4603
4604 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
4605 m4_foreach(
4606 [option],
4607 [[],
4608 ["$generate"],
4609 ["$pkt"]],
4610 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
4611   [2], [], [stderr])
4612 AT_CHECK([tail -2 stderr], [0], [dnl
4613 Cannot find the datapath
4614 ovs-appctl: ovs-vswitchd: server returned an error
4615 ])])
4616
4617 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
4618 m4_foreach(
4619 [option],
4620 [[],
4621 ["$generate"],
4622 ["$pkt"]],
4623 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
4624   [2], [], [stderr])
4625 AT_CHECK([tail -2 stderr], [0], [dnl
4626 Cannot find the datapath
4627 ovs-appctl: ovs-vswitchd: server returned an error
4628 ])])
4629
4630 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
4631 m4_foreach(
4632 [option],
4633 [[],
4634 ["$generate"],
4635 ["$pkt"]],
4636 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
4637   [2], [], [stderr])
4638 AT_CHECK([tail -2 stderr], [0], [dnl
4639 Cannot find the datapath
4640 ovs-appctl: ovs-vswitchd: server returned an error
4641 ])])
4642
4643 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
4644 m4_foreach(
4645 [option],
4646 [[],
4647 ["$generate"],
4648 ["$pkt"]],
4649 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
4650   [2], [], [stderr])
4651 AT_CHECK([tail -2 stderr], [0], [dnl
4652 Cannot find the datapath
4653 ovs-appctl: ovs-vswitchd: server returned an error
4654 ])])
4655
4656 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
4657 m4_foreach(
4658 [option],
4659 [[],
4660 ["$generate"],
4661 ["$pkt"]],
4662 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
4663   [2], [], [stderr])
4664 AT_CHECK([tail -2 stderr], [0], [dnl
4665 Unknown bridge name
4666 ovs-appctl: ovs-vswitchd: server returned an error
4667 ])])
4668
4669 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
4670 m4_foreach(
4671 [option],
4672 [[],
4673 ["$generate"],
4674 ["$pkt"]],
4675 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
4676   [2], [], [stderr])
4677 AT_CHECK([tail -2 stderr], [0], [dnl
4678 Must specify bridge name
4679 ovs-appctl: ovs-vswitchd: server returned an error
4680 ])])
4681
4682 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
4683 AT_CHECK([ovs-appctl ofproto/trace \
4684   ovs-dummy "$odp_flow" garbage_option],
4685   [2], [stdout],[stderr])
4686 AT_CHECK([tail -2 stderr], [0], [dnl
4687 Trailing garbage in packet data
4688 ovs-appctl: ovs-vswitchd: server returned an error
4689 ])
4690
4691 # Test incorrect command: ofproto/trace with 4 arguments
4692 AT_CHECK([ovs-appctl ofproto/trace \
4693   arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
4694 AT_CHECK([tail -2 stderr], [0], [dnl
4695 "ofproto/trace" command takes at most 3 arguments
4696 ovs-appctl: ovs-vswitchd: server returned an error
4697 ])
4698
4699 # Test incorrect command: ofproto/trace with 0 argument
4700 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
4701 AT_CHECK([tail -2 stderr], [0], [dnl
4702 "ofproto/trace" command requires at least 1 arguments
4703 ovs-appctl: ovs-vswitchd: server returned an error
4704 ])
4705
4706 OVS_VSWITCHD_STOP
4707 AT_CLEANUP
4708
4709 # The third test checks that the output of "ovs-dpctl -m" is valid to trace.
4710 AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
4711 OVS_VSWITCHD_START([dnl
4712     set Open_vSwitch . other_config:max-idle=10000 \
4713     -- add-port br0 p1 -- set Interface p1 type=dummy])
4714
4715 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)'])
4716 ovs-appctl revalidator/wait
4717 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
4718
4719 odp_flow=`cat dp_flows1.txt`
4720 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
4721 Bridge: br0
4722 Flow: <cleared>
4723 No match, packets dropped because OFPPC_NO_PACKET_IN is set on in_port.
4724
4725 Rule: table=254 cookie=0 priority=0,reg0=0x2
4726 OpenFlow actions=drop
4727
4728 Final flow: <cleared>
4729 Megaflow: <cleared>
4730 Datapath actions: drop
4731 ])
4732
4733 dnl Now, try again without megaflows:
4734 ovs-appctl upcall/disable-megaflows
4735
4736 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)'])
4737 ovs-appctl revalidator/wait
4738 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
4739
4740 odp_flow=`cat dp_flows2.txt`
4741 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
4742 Bridge: br0
4743 Flow: <cleared>
4744 No match, packets dropped because OFPPC_NO_PACKET_IN is set on in_port.
4745
4746 Rule: table=254 cookie=0 priority=0,reg0=0x2
4747 OpenFlow actions=drop
4748
4749 Final flow: <cleared>
4750 Megaflow: <cleared>
4751 Datapath actions: drop
4752 ])
4753
4754 OVS_VSWITCHD_STOP
4755 AT_CLEANUP
4756
4757 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
4758 OVS_VSWITCHD_START
4759 add_of_ports br0 1 2 3
4760
4761 AT_DATA([flows.txt], [dnl
4762 in_port=1 actions=output:2
4763 in_port=2 actions=output:1
4764 ])
4765 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4766
4767 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
4768 AT_CHECK([tail -1 stdout], [0], [dnl
4769 Datapath actions: push_vlan(vid=123,pcp=0),2
4770 ])
4771
4772 OVS_VSWITCHD_STOP
4773 AT_CLEANUP
4774
4775
4776 m4_define([OFPROTO_TRACE],
4777   [flow="$2"
4778    AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
4779    actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4780    expected="$4"
4781    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
4782      [0], [stdout])
4783    mv stdout expout
4784    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
4785      [0], [expout])])
4786
4787 AT_SETUP([ofproto-dpif - MAC learning])
4788 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
4789 add_of_ports br0 1 2 3
4790
4791 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)'
4792
4793 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
4794 OFPROTO_TRACE(
4795   [ovs-dummy],
4796   [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
4797   [-generate],
4798   [1,2,100])
4799
4800 # Check for the MAC learning entry.
4801 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4802  port  VLAN  MAC                Age
4803     3     0  50:54:00:00:00:05    ?
4804 ])
4805
4806 # Trace a packet arrival destined for the learned MAC.
4807 # (This will also learn a MAC.)
4808 OFPROTO_TRACE(
4809   [ovs-dummy],
4810   [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
4811   [-generate],
4812   [3])
4813
4814 # Check for both MAC learning entries.
4815 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4816  port  VLAN  MAC                Age
4817     3     0  50:54:00:00:00:05    ?
4818     1     0  50:54:00:00:00:06    ?
4819 ])
4820
4821 # Trace a packet arrival that updates the first learned MAC entry.
4822 OFPROTO_TRACE(
4823   [ovs-dummy],
4824   [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
4825   [-generate],
4826   [1,3,100])
4827
4828 # Check that the MAC learning entry was updated.
4829 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4830  port  VLAN  MAC                Age
4831     1     0  50:54:00:00:00:06    ?
4832     2     0  50:54:00:00:00:05    ?
4833 ])
4834
4835 # Add another bridge.
4836 AT_CHECK(
4837   [ovs-vsctl \
4838      -- add-br br1 \
4839      -- set bridge br1 datapath-type=dummy])
4840 add_of_ports br1 4 5
4841
4842 # Trace some packet arrivals in br1 to create MAC learning entries there too.
4843 OFPROTO_TRACE(
4844   [ovs-dummy],
4845   [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
4846   [-generate],
4847   [5,101])
4848 OFPROTO_TRACE(
4849   [ovs-dummy],
4850   [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
4851   [-generate],
4852   [4,101])
4853
4854 # Check that the MAC learning entries were added.
4855 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4856  port  VLAN  MAC                Age
4857     4     0  50:54:00:00:00:06    ?
4858     5     0  50:54:00:00:00:07    ?
4859 ])
4860
4861 # Delete port p1 and see that its MAC learning entry disappeared, and
4862 # that the MAC learning entry for the same MAC was also deleted from br1.
4863 AT_CHECK([ovs-vsctl del-port p1])
4864 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4865  port  VLAN  MAC                Age
4866     2     0  50:54:00:00:00:05    ?
4867 ])
4868 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4869  port  VLAN  MAC                Age
4870     5     0  50:54:00:00:00:07    ?
4871 ])
4872
4873 OVS_VSWITCHD_STOP
4874 AT_CLEANUP
4875
4876 AT_SETUP([ofproto-dpif - MAC table overflow])
4877 OVS_VSWITCHD_START(
4878   [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
4879 add_of_ports br0 1 2 3
4880
4881 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)'
4882
4883 AT_CHECK([ovs-appctl time/stop])
4884
4885 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
4886 for i in 0 1 2 3 4 5 6 7 8 9; do
4887     OFPROTO_TRACE(
4888       [ovs-dummy],
4889       [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
4890       [-generate],
4891       [1,2,100])
4892     ovs-appctl time/warp 1000
4893 done
4894
4895 # Check for the MAC learning entries.
4896 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4897   [0], [dnl
4898     3     0  50:54:00:00:00:00
4899     3     0  50:54:00:00:00:01
4900     3     0  50:54:00:00:00:02
4901     3     0  50:54:00:00:00:03
4902     3     0  50:54:00:00:00:04
4903     3     0  50:54:00:00:00:05
4904     3     0  50:54:00:00:00:06
4905     3     0  50:54:00:00:00:07
4906     3     0  50:54:00:00:00:08
4907     3     0  50:54:00:00:00:09
4908  port  VLAN  MAC                Age
4909 ])
4910
4911 # Trace another ARP packet on another MAC.
4912 OFPROTO_TRACE(
4913   [ovs-dummy],
4914   [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
4915   [-generate],
4916   [1,2,100])
4917
4918 # Check that the new one chased the oldest one out of the table.
4919 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
4920   [0], [dnl
4921     3     0  50:54:00:00:00:01    ?
4922     3     0  50:54:00:00:00:02    ?
4923     3     0  50:54:00:00:00:03    ?
4924     3     0  50:54:00:00:00:04    ?
4925     3     0  50:54:00:00:00:05    ?
4926     3     0  50:54:00:00:00:06    ?
4927     3     0  50:54:00:00:00:07    ?
4928     3     0  50:54:00:00:00:08    ?
4929     3     0  50:54:00:00:00:09    ?
4930     3     0  50:54:00:00:00:10    ?
4931  port  VLAN  MAC                Age
4932 ])
4933 OVS_VSWITCHD_STOP
4934 AT_CLEANUP
4935
4936 AT_SETUP([ofproto-dpif - MAC table overflow fairness])
4937 OVS_VSWITCHD_START(
4938   [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
4939 add_of_ports br0 1 2 3 4 5 6
4940
4941 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)'
4942
4943 AT_CHECK([ovs-appctl time/stop])
4944
4945 # Trace packets with 2 different source MACs arriving on each of the 5
4946 # ports, filling up the 10-entry learning table.
4947 for i in 0 1 2 3 4 5 6 7 8 9; do
4948     p=`expr $i / 2 + 1`
4949     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
4950     ovs-appctl time/warp 1000
4951 done
4952
4953 # Check for the MAC learning entries.
4954 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4955   [0], [dnl
4956     1     0  50:54:00:00:00:00
4957     1     0  50:54:00:00:00:01
4958     2     0  50:54:00:00:00:02
4959     2     0  50:54:00:00:00:03
4960     3     0  50:54:00:00:00:04
4961     3     0  50:54:00:00:00:05
4962     4     0  50:54:00:00:00:06
4963     4     0  50:54:00:00:00:07
4964     5     0  50:54:00:00:00:08
4965     5     0  50:54:00:00:00:09
4966  port  VLAN  MAC                Age
4967 ])
4968
4969 # Now trace 16 new MACs on another port.
4970 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
4971     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
4972     ovs-appctl time/warp 1000
4973 done
4974
4975 # Check the results.
4976 #
4977 # Our eviction algorithm on overflow is that an arbitrary (but deterministic)
4978 # one of the ports with the most learned MACs loses the least recently used
4979 # one.  Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
4980 # MAC each, and the other 2 of the old ports with 2 MACs each.
4981 #
4982 # (If someone changes lib/heap.c to do something different with equal-priority
4983 # nodes, then the output below could change, but it would still follow the
4984 # rules explained above.)
4985 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4986   [0], [dnl
4987     1     0  50:54:00:00:00:01
4988     2     0  50:54:00:00:00:03
4989     3     0  50:54:00:00:00:04
4990     3     0  50:54:00:00:00:05
4991     4     0  50:54:00:00:00:07
4992     5     0  50:54:00:00:00:08
4993     5     0  50:54:00:00:00:09
4994     6     0  50:54:00:00:0d:ff
4995     6     0  50:54:00:00:0e:ff
4996     6     0  50:54:00:00:0f:ff
4997  port  VLAN  MAC                Age
4998 ])
4999 OVS_VSWITCHD_STOP
5000 AT_CLEANUP
5001
5002 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
5003 #
5004 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
5005 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
5006   [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5007   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5008
5009   on_exit 'kill `cat test-sflow.pid`'
5010   AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
5011   AT_CAPTURE_FILE([sflow.log])
5012   PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5013   ovs-appctl time/stop
5014
5015   add_of_ports br0 1 2
5016   ovs-vsctl \
5017      set Interface br0 options:ifindex=1002 -- \
5018      set Interface p1 options:ifindex=1004 -- \
5019      set Interface p2 options:ifindex=1003 -- \
5020      set Bridge br0 sflow=@sf -- \
5021      --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
5022        header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
5023
5024   dnl open with ARP packets to seed the bridge-learning.  The output
5025   dnl ifIndex numbers should be reported predictably after that.
5026   dnl Since we set sampling=1 we should see all of these packets
5027   dnl reported. Sorting the output by data-source and seqNo makes
5028   dnl it deterministic. Ensuring that we send at least two packets
5029   dnl into each port means we get to check the seq nos are
5030   dnl incrementing correctly.
5031   dnl because packets from different ports can be handled by separate
5032   dnl threads, put some sleeps
5033
5034   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)'
5035   sleep 1
5036   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)'
5037   sleep 1
5038   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)'
5039   sleep 1
5040   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)'
5041   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)'
5042
5043   dnl sleep long enough to get more than one counter sample
5044   dnl from each datasource so we can check sequence numbers
5045   ovs-appctl time/warp 3000 100
5046   OVS_VSWITCHD_STOP
5047   OVS_APP_EXIT_AND_WAIT([test-sflow])
5048
5049   AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5050         /g']], [0], [dnl
5051 HEADER
5052         dgramSeqNo=1
5053         ds=127.0.0.1>2:1000
5054         fsSeqNo=1
5055         in_vlan=0
5056         in_priority=0
5057         out_vlan=0
5058         out_priority=0
5059         meanSkip=1
5060         samplePool=1
5061         dropEvents=0
5062         in_ifindex=1004
5063         in_format=0
5064         out_ifindex=2
5065         out_format=2
5066         hdr_prot=1
5067         pkt_len=64
5068         stripped=4
5069         hdr_len=60
5070         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-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
5071 HEADER
5072         dgramSeqNo=1
5073         ds=127.0.0.1>2:1000
5074         fsSeqNo=2
5075         in_vlan=0
5076         in_priority=0
5077         out_vlan=0
5078         out_priority=0
5079         meanSkip=1
5080         samplePool=2
5081         dropEvents=0
5082         in_ifindex=1003
5083         in_format=0
5084         out_ifindex=2
5085         out_format=2
5086         hdr_prot=1
5087         pkt_len=64
5088         stripped=4
5089         hdr_len=60
5090         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-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
5091 HEADER
5092         dgramSeqNo=1
5093         ds=127.0.0.1>2:1000
5094         fsSeqNo=3
5095         in_vlan=0
5096         in_priority=0
5097         out_vlan=0
5098         out_priority=0
5099         meanSkip=1
5100         samplePool=3
5101         dropEvents=0
5102         in_ifindex=1004
5103         in_format=0
5104         out_ifindex=1003
5105         out_format=0
5106         hdr_prot=1
5107         pkt_len=64
5108         stripped=4
5109         hdr_len=60
5110         hdr=50-54-00-00-00-07-50-54-00-00-00-05-08-00-45-00-00-1C-00-00-00-00-40-01-F9-8D-C0-A8-00-01-C0-A8-00-02-08-00-F7-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
5111 HEADER
5112         dgramSeqNo=1
5113         ds=127.0.0.1>2:1000
5114         fsSeqNo=4
5115         in_vlan=0
5116         in_priority=0
5117         out_vlan=0
5118         out_priority=0
5119         meanSkip=1
5120         samplePool=4
5121         dropEvents=0
5122         in_ifindex=1003
5123         in_format=0
5124         out_ifindex=1004
5125         out_format=0
5126         hdr_prot=1
5127         pkt_len=64
5128         stripped=4
5129         hdr_len=60
5130         hdr=50-54-00-00-00-05-50-54-00-00-00-07-08-00-45-00-00-1C-00-00-00-00-40-01-F9-8D-C0-A8-00-02-C0-A8-00-01-00-00-FF-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
5131 HEADER
5132         dgramSeqNo=1
5133         ds=127.0.0.1>2:1000
5134         fsSeqNo=5
5135         in_vlan=0
5136         in_priority=0
5137         out_vlan=0
5138         out_priority=0
5139         meanSkip=1
5140         samplePool=5
5141         dropEvents=0
5142         in_ifindex=1003
5143         in_format=0
5144         out_ifindex=1004
5145         out_format=0
5146         hdr_prot=1
5147         pkt_len=64
5148         stripped=4
5149         hdr_len=60
5150         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-00-00-00-00-00-00
5151 ])
5152
5153   AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -18 | sed 's/ /\
5154         /g']], [0], [dnl
5155 IFCOUNTERS
5156         dgramSeqNo=2
5157         ds=127.0.0.1>0:1002
5158         csSeqNo=1
5159         ifindex=1002
5160         type=6
5161         ifspeed=100000000
5162         direction=0
5163         status=0
5164         in_octets=0
5165         in_unicasts=0
5166         in_multicasts=4294967295
5167         in_broadcasts=4294967295
5168         in_discards=4294967295
5169         in_errors=4294967295
5170         in_unknownprotos=4294967295
5171         out_octets=120
5172         out_unicasts=2
5173         out_multicasts=4294967295
5174         out_broadcasts=4294967295
5175         out_discards=4294967295
5176         out_errors=4294967295
5177         promiscuous=0
5178 IFCOUNTERS
5179         dgramSeqNo=2
5180         ds=127.0.0.1>0:1003
5181         csSeqNo=1
5182         ifindex=1003
5183         type=6
5184         ifspeed=100000000
5185         direction=0
5186         status=0
5187         in_octets=138
5188         in_unicasts=3
5189         in_multicasts=4294967295
5190         in_broadcasts=4294967295
5191         in_discards=4294967295
5192         in_errors=4294967295
5193         in_unknownprotos=4294967295
5194         out_octets=120
5195         out_unicasts=2
5196         out_multicasts=4294967295
5197         out_broadcasts=4294967295
5198         out_discards=4294967295
5199         out_errors=4294967295
5200         promiscuous=0
5201 IFCOUNTERS
5202         dgramSeqNo=2
5203         ds=127.0.0.1>0:1004
5204         csSeqNo=1
5205         ifindex=1004
5206         type=6
5207         ifspeed=100000000
5208         direction=0
5209         status=0
5210         in_octets=84
5211         in_unicasts=2
5212         in_multicasts=4294967295
5213         in_broadcasts=4294967295
5214         in_discards=4294967295
5215         in_errors=4294967295
5216         in_unknownprotos=4294967295
5217         out_octets=180
5218         out_unicasts=3
5219         out_multicasts=4294967295
5220         out_broadcasts=4294967295
5221         out_discards=4294967295
5222         out_errors=4294967295
5223         promiscuous=0
5224 IFCOUNTERS
5225         dgramSeqNo=3
5226         ds=127.0.0.1>0:1002
5227         csSeqNo=2
5228         ifindex=1002
5229         type=6
5230         ifspeed=100000000
5231         direction=0
5232         status=0
5233         in_octets=0
5234         in_unicasts=0
5235         in_multicasts=4294967295
5236         in_broadcasts=4294967295
5237         in_discards=4294967295
5238         in_errors=4294967295
5239         in_unknownprotos=4294967295
5240         out_octets=120
5241         out_unicasts=2
5242         out_multicasts=4294967295
5243         out_broadcasts=4294967295
5244         out_discards=4294967295
5245         out_errors=4294967295
5246         promiscuous=0
5247 IFCOUNTERS
5248         dgramSeqNo=3
5249         ds=127.0.0.1>0:1003
5250         csSeqNo=2
5251         ifindex=1003
5252         type=6
5253         ifspeed=100000000
5254         direction=0
5255         status=0
5256         in_octets=138
5257         in_unicasts=3
5258         in_multicasts=4294967295
5259         in_broadcasts=4294967295
5260         in_discards=4294967295
5261         in_errors=4294967295
5262         in_unknownprotos=4294967295
5263         out_octets=120
5264         out_unicasts=2
5265         out_multicasts=4294967295
5266         out_broadcasts=4294967295
5267         out_discards=4294967295
5268         out_errors=4294967295
5269         promiscuous=0
5270 IFCOUNTERS
5271         dgramSeqNo=3
5272         ds=127.0.0.1>0:1004
5273         csSeqNo=2
5274         ifindex=1004
5275         type=6
5276         ifspeed=100000000
5277         direction=0
5278         status=0
5279         in_octets=84
5280         in_unicasts=2
5281         in_multicasts=4294967295
5282         in_broadcasts=4294967295
5283         in_discards=4294967295
5284         in_errors=4294967295
5285         in_unknownprotos=4294967295
5286         out_octets=180
5287         out_unicasts=3
5288         out_multicasts=4294967295
5289         out_broadcasts=4294967295
5290         out_discards=4294967295
5291         out_errors=4294967295
5292         promiscuous=0
5293 OPENFLOWPORT
5294         datapath_id=18364758544493064720
5295         port_no=1
5296 OPENFLOWPORT
5297         datapath_id=18364758544493064720
5298         port_no=1
5299 OPENFLOWPORT
5300         datapath_id=18364758544493064720
5301         port_no=2
5302 OPENFLOWPORT
5303         datapath_id=18364758544493064720
5304         port_no=2
5305 OPENFLOWPORT
5306         datapath_id=18364758544493064720
5307         port_no=65534
5308 OPENFLOWPORT
5309         datapath_id=18364758544493064720
5310         port_no=65534
5311 PORTNAME
5312         portName=br0
5313 PORTNAME
5314         portName=br0
5315 PORTNAME
5316         portName=p1
5317 PORTNAME
5318         portName=p1
5319 PORTNAME
5320         portName=p2
5321 PORTNAME
5322         portName=p2
5323 ])])
5324
5325 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
5326 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
5327 AT_CLEANUP
5328
5329 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
5330 AT_SKIP_IF([test $HAVE_IPV6 = no])
5331 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
5332 AT_CLEANUP
5333
5334 dnl Test sFlow LAG structures
5335 AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
5336 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
5337 OVS_VSWITCHD_START([dnl
5338                     add-bond br0 bond p1 p2 --                          \
5339                     set Port bond lacp=active bond-mode=active-backup   \
5340                     other_config:lacp-time="fast"                       \
5341                     other_config:lacp-system-id=11:22:33:44:55:66       \
5342                     other_config:lacp-system-priority=54321 --          \
5343                     set Interface p1 type=dummy                         \
5344                     other_config:lacp-port-id=11                        \
5345                     other_config:lacp-port-priority=111                 \
5346                     other_config:lacp-aggregation-key=3333 --           \
5347                     set Interface p2 type=dummy                         \
5348                     other_config:lacp-port-id=22                        \
5349                     other_config:lacp-port-priority=222                 \
5350                     other_config:lacp-aggregation-key=3333 ])
5351
5352 on_exit 'kill `cat test-sflow.pid`'
5353 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5354 AT_CAPTURE_FILE([sflow.log])
5355 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5356
5357 ovs-appctl time/stop
5358
5359 ovs-vsctl \
5360       set Interface p1 options:ifindex=1003 --                  \
5361       set Bridge br0 sflow=@sf --                               \
5362       --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\"   \
5363       header=128 sampling=1 polling=1
5364
5365 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5366 AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
5367 AT_CHECK([ovs-appctl revalidator/purge], [0])
5368 OVS_VSWITCHD_STOP
5369 OVS_APP_EXIT_AND_WAIT([test-sflow])
5370 AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
5371         /g']], [0], [dnl
5372 LACPCOUNTERS
5373         sysID=11:22:33:44:55:66
5374         partnerID=00:00:00:00:00:00
5375         aggID=3333
5376         actorAdmin=0x7
5377         actorOper=0xbf
5378         partnerAdmin=0x0
5379         partnerOper=0x2
5380         LACPDUsRx=0
5381         markerPDUsRx=4294967295
5382         markerRespPDUsRx=4294967295
5383         unknownRx=4294967295
5384         illegalRx=0
5385         LACPDUsTx=1
5386         markerPDUsTx=4294967295
5387         markerRespPDUsTx=4294967295
5388 ])
5389
5390 AT_CLEANUP
5391
5392 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
5393 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5394 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5395
5396 dnl set up sFlow logging
5397 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5398 AT_CAPTURE_FILE([sflow.log])
5399 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5400 ovs-appctl time/stop
5401
5402 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
5403 AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
5404                     options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
5405 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
5406
5407 AT_CHECK([ovs-ofctl add-flow br0 action=3])
5408
5409 dnl enable sflow
5410 ovs-vsctl \
5411    set Bridge br0 sflow=@sf -- \
5412    --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5413      header=128 sampling=1 polling=0
5414
5415 dnl introduce a packet that will be flooded to the tunnel
5416 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)'])
5417
5418 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5419 for i in `seq 1 30`; do
5420     ovs-appctl time/warp 100
5421 done
5422
5423 OVS_APP_EXIT_AND_WAIT([test-sflow])
5424
5425 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5426         /g']], [0], [dnl
5427 HEADER
5428         dgramSeqNo=1
5429         ds=127.0.0.1>2:1000
5430         fsSeqNo=1
5431         tunnel4_out_length=0
5432         tunnel4_out_protocol=47
5433         tunnel4_out_src=0.0.0.0
5434         tunnel4_out_dst=1.1.1.1
5435         tunnel4_out_src_port=0
5436         tunnel4_out_dst_port=0
5437         tunnel4_out_tcp_flags=0
5438         tunnel4_out_tos=1
5439         tunnel_out_vni=456
5440         in_vlan=0
5441         in_priority=0
5442         out_vlan=0
5443         out_priority=0
5444         meanSkip=1
5445         samplePool=1
5446         dropEvents=0
5447         in_ifindex=0
5448         in_format=0
5449         out_ifindex=1
5450         out_format=2
5451         hdr_prot=1
5452         pkt_len=64
5453         stripped=4
5454         hdr_len=60
5455         hdr=50-54-00-00-00-0A-50-54-00-00-00-09-08-00-45-01-00-1C-00-00-00-00-80-01-12-CA-0A-0A-0A-02-0A-0A-0A-01-08-00-F7-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
5456 ])
5457
5458 OVS_VSWITCHD_STOP
5459 AT_CLEANUP
5460
5461 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
5462 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5463
5464 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
5465
5466 dnl set up sFlow logging
5467 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5468 AT_CAPTURE_FILE([sflow.log])
5469 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5470 ovs-appctl time/stop
5471
5472 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5473 AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
5474 AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
5475                        options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
5476                     -- add-port int-br vm1 -- set Interface vm1 type=dummy \
5477                        options:ifindex=2011 ofport_request=5
5478                        ], [0])
5479
5480 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
5481 dummy@ovs-dummy: hit:0 missed:0
5482         br0:
5483                 br0 65534/100: (dummy)
5484                 p0 1/1: (dummy: ifindex=1010)
5485         int-br:
5486                 int-br 65534/2: (dummy)
5487                 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
5488                 vm1 5/3: (dummy: ifindex=2011)
5489 ])
5490
5491 dnl set up route to 1.1.2.92 via br0 and action=normal
5492 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
5493 ])
5494 AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
5495 ])
5496 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5497
5498 dnl Prime ARP Cache for 1.1.2.92
5499 AT_CHECK([ovs-appctl netdev-dummy/receive br0 'recirc_id(0),in_port(100),eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
5500
5501 dnl configure sflow on int-br only
5502 ovs-vsctl \
5503    set Bridge int-br sflow=@sf -- \
5504    --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5505      header=128 sampling=1 polling=0
5506
5507 dnl set up route to 192.168.1.2 via br0
5508 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
5509 ])
5510 AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
5511 ])
5512
5513 dnl add rule for int-br to force packet onto tunnel. There is no ifindex
5514 dnl for this port so the sFlow output will just report that it went to
5515 dnl 1 output (out_format=2, out_ifindex=1)
5516 AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
5517
5518 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)'])
5519
5520 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5521 for i in `seq 1 30`; do
5522     ovs-appctl time/warp 100
5523 done
5524
5525 OVS_APP_EXIT_AND_WAIT([test-sflow])
5526
5527 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5528         /g']], [0], [dnl
5529 HEADER
5530         dgramSeqNo=1
5531         ds=127.0.0.1>2:1000
5532         fsSeqNo=1
5533         tunnel4_out_length=0
5534         tunnel4_out_protocol=47
5535         tunnel4_out_src=1.1.2.88
5536         tunnel4_out_dst=1.1.2.92
5537         tunnel4_out_src_port=0
5538         tunnel4_out_dst_port=0
5539         tunnel4_out_tcp_flags=0
5540         tunnel4_out_tos=0
5541         tunnel_out_vni=456
5542         in_vlan=0
5543         in_priority=0
5544         out_vlan=0
5545         out_priority=0
5546         meanSkip=1
5547         samplePool=1
5548         dropEvents=0
5549         in_ifindex=2011
5550         in_format=0
5551         out_ifindex=1
5552         out_format=2
5553         hdr_prot=1
5554         pkt_len=64
5555         stripped=4
5556         hdr_len=60
5557         hdr=50-54-00-00-00-0A-50-54-00-00-00-05-08-00-45-00-00-1C-00-00-00-00-80-01-B6-8D-C0-A8-01-01-C0-A8-02-02-08-00-F7-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
5558 ])
5559
5560 OVS_VSWITCHD_STOP
5561 AT_CLEANUP
5562
5563 AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
5564 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5565 OVS_VSWITCHD_START
5566 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5567 add_of_ports br0 1 2
5568 AT_DATA([flows.txt], [dnl
5569 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
5570 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
5571 ])
5572 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5573
5574 dnl set up sFlow logging
5575 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5576 AT_CAPTURE_FILE([sflow.log])
5577 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5578 ovs-appctl time/stop
5579
5580 dnl configure sflow
5581 ovs-vsctl \
5582    set Bridge br0 sflow=@sf -- \
5583    --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5584      header=128 sampling=1 polling=0
5585
5586 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)'])
5587 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)'])
5588
5589 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5590 for i in `seq 1 30`; do
5591     ovs-appctl time/warp 100
5592 done
5593
5594 OVS_APP_EXIT_AND_WAIT([test-sflow])
5595
5596 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5597         /g']], [0], [dnl
5598 HEADER
5599         dgramSeqNo=1
5600         ds=127.0.0.1>2:1000
5601         fsSeqNo=1
5602         mpls_label_0=789
5603         mpls_tc_0=4
5604         mpls_ttl_0=32
5605         mpls_bos_0=0
5606         mpls_label_1=11
5607         mpls_tc_1=3
5608         mpls_ttl_1=64
5609         mpls_bos_1=1
5610         in_vlan=0
5611         in_priority=0
5612         out_vlan=0
5613         out_priority=0
5614         meanSkip=1
5615         samplePool=1
5616         dropEvents=0
5617         in_ifindex=0
5618         in_format=0
5619         out_ifindex=1
5620         out_format=2
5621         hdr_prot=1
5622         pkt_len=64
5623         stripped=4
5624         hdr_len=60
5625         hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
5626 HEADER
5627         dgramSeqNo=1
5628         ds=127.0.0.1>2:1000
5629         fsSeqNo=2
5630         mpls_label_0=789
5631         mpls_tc_0=4
5632         mpls_ttl_0=32
5633         mpls_bos_0=1
5634         in_vlan=0
5635         in_priority=0
5636         out_vlan=0
5637         out_priority=0
5638         meanSkip=1
5639         samplePool=2
5640         dropEvents=0
5641         in_ifindex=0
5642         in_format=0
5643         out_ifindex=1
5644         out_format=2
5645         hdr_prot=1
5646         pkt_len=64
5647         stripped=4
5648         hdr_len=60
5649         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-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
5650 ])
5651
5652 OVS_VSWITCHD_STOP
5653 AT_CLEANUP
5654
5655
5656 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
5657 #
5658 # Test that basic NetFlow reports flow statistics correctly:
5659 # The initial packet of a flow are correctly accounted.
5660 # Later packets within a flow are correctly accounted.
5661 # Flow actions changing (in this case, due to MAC learning)
5662 # cause a record to be sent.
5663 m4_define([CHECK_NETFLOW_EXPIRATION],
5664   [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5665   add_of_ports br0 1 2
5666
5667   ovs-appctl time/stop
5668   on_exit 'kill `cat test-netflow.pid`'
5669   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
5670   AT_CAPTURE_FILE([netflow.log])
5671   PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
5672
5673   ovs-vsctl \
5674      set Bridge br0 netflow=@nf -- \
5675      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
5676        engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
5677
5678   for delay in 1000 30000; do
5679       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)'
5680       sleep 1  # ensure the order in which these two packets are processed
5681       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)'
5682
5683       ovs-appctl time/warp $delay
5684   done
5685
5686   ovs-appctl time/warp 6000
5687   ovs-appctl revalidator/wait
5688   OVS_VSWITCHD_STOP
5689   OVS_APP_EXIT_AND_WAIT([test-netflow])
5690
5691   AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 60 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
5692
5693   AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 2, 1 pkts, 60 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
5694
5695   combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 120 bytes, ICMP 0:0" netflow.log | wc -l`
5696   separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 60 bytes, ICMP 0:0" netflow.log | wc -l`
5697   AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
5698
5699 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
5700 CHECK_NETFLOW_EXPIRATION([127.0.0.1])
5701 AT_CLEANUP
5702
5703 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
5704 AT_SKIP_IF([test $HAVE_IPV6 = no])
5705 CHECK_NETFLOW_EXPIRATION([[[::1]]])
5706 AT_CLEANUP
5707
5708 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
5709 #
5710 # Test that basic NetFlow reports active expirations correctly.
5711 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
5712   [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5713   add_of_ports br0 1 2
5714
5715   on_exit 'kill `cat test-netflow.pid`'
5716   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
5717   AT_CAPTURE_FILE([netflow.log])
5718   PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
5719
5720   ovs-vsctl \
5721      set Bridge br0 netflow=@nf -- \
5722      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
5723        engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
5724
5725   AT_CHECK([ovs-appctl time/stop])
5726   n=1
5727   while test $n -le 60; do
5728       n=`expr $n + 1`
5729
5730       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)'
5731       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)'
5732
5733       ovs-appctl time/warp 1000
5734   done
5735
5736   ovs-appctl time/warp 10000
5737
5738   ovs-appctl revalidator/wait
5739   OVS_VSWITCHD_STOP
5740   OVS_APP_EXIT_AND_WAIT([test-netflow])
5741
5742   # Count the number of reported packets:
5743   # - From source to destination before MAC learning kicks in (just one).
5744   # - From source to destination after that.
5745   # - From destination to source.
5746   n_learn=0
5747   n_in=0
5748   n_out=0
5749   n_other=0
5750   n_recs=0
5751   none=0
5752   while read line; do
5753       pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
5754       case $pkts in
5755            [[0-9]]*) ;;
5756        *) continue ;;
5757       esac
5758
5759       case $line in
5760           "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
5761               counter=n_learn
5762           ;;
5763       "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
5764           counter=n_in
5765           ;;
5766       "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
5767           counter=n_out
5768           ;;
5769       *)
5770           counter=n_other
5771           ;;
5772       esac
5773       eval $counter=\`expr \$$counter + \$pkts\`
5774       n_recs=`expr $n_recs + 1`
5775   done < netflow.log
5776
5777   # There should be exactly 1 MAC learning packet,
5778   # exactly 59 other packets in that direction,
5779   # and exactly 60 packets in the other direction.
5780   AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
5781 ])])
5782
5783 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
5784 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
5785 AT_CLEANUP
5786
5787 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
5788 AT_SKIP_IF([test $HAVE_IPV6 = no])
5789 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
5790 AT_CLEANUP
5791
5792 dnl In the absence of an IPFIX collector to verify protocol correctness, simply
5793 dnl configure bridge IPFIX and ensure that sample action generation works at the
5794 dnl datapath level.
5795 AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
5796 OVS_VSWITCHD_START
5797 add_of_ports br0 1 2
5798
5799 dnl Sample every packet using bridge-based sampling.
5800 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
5801                     --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
5802                               sampling=1], [0], [ignore])
5803
5804 dnl Send some packets that should be sampled.
5805 for i in `seq 1 3`; do
5806     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)'])
5807 done
5808 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
5809 flow-dump from non-dpdk interfaces:
5810 packets:2, bytes:120, used:0.001s, actions:sample(sample=100.0%,actions(userspace(pid=0,ipfix(output_port=4294967295))))
5811 ])
5812
5813 dnl Remove the IPFIX configuration.
5814 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
5815 AT_CHECK([ovs-appctl revalidator/purge])
5816
5817 dnl Send some more packets, to ensure that these are not sampled.
5818 for i in `seq 1 3`; do
5819     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)'])
5820 done
5821 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
5822 flow-dump from non-dpdk interfaces:
5823 packets:2, bytes:120, used:0.001s, actions:drop
5824 ])
5825
5826 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
5827 AT_CLEANUP
5828
5829 dnl Bridge IPFIX statistics check
5830 AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
5831 OVS_VSWITCHD_START
5832 add_of_ports br0 1 2
5833
5834 dnl Negative test check.
5835 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
5836 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
5837 NXST_IPFIX_BRIDGE request (xid=0x2):
5838 ])
5839
5840 dnl Sample every packet using bridge-based sampling.
5841 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
5842                     --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
5843                               sampling=1], [0], [ignore])
5844
5845 dnl Send some packets that should be sampled.
5846 for i in `seq 1 20`; do
5847     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)'])
5848 done
5849
5850 dnl There are 4 extra IPFIX template packets.
5851 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
5852 NXST_IPFIX_BRIDGE reply (xid=0x2):
5853   bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=12
5854                 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=12
5855 ])
5856
5857 dnl Remove the IPFIX configuration.
5858 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
5859 AT_CHECK([ovs-appctl revalidator/purge])
5860
5861 dnl Send some more packets, to ensure that these are not sampled.
5862 for i in `seq 1 2`; do
5863     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)'])
5864 done
5865 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
5866 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
5867 NXST_IPFIX_BRIDGE request (xid=0x2):
5868 ])
5869
5870 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
5871 AT_CLEANUP
5872
5873 dnl Flow IPFIX sanity check
5874 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
5875 OVS_VSWITCHD_START
5876 add_of_ports br0 1 2
5877
5878 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
5879                     -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
5880                     -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
5881          [0], [ignore])
5882
5883 AT_DATA([flows.txt], [dnl
5884 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
5885 ])
5886
5887 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
5888
5889 dnl Send some packets that should be sampled.
5890 for i in `seq 1 3`; do
5891     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)'])
5892 done
5893 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
5894 flow-dump from non-dpdk interfaces:
5895 packets:2, bytes:120, used:0.001s, actions:sample(sample=100.0%,actions(userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=4294967295)))),2
5896 ])
5897
5898 dnl Remove the flow which contains sample action.
5899 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
5900 AT_CHECK([ovs-appctl revalidator/purge])
5901
5902 dnl Send some more packets, to ensure that these are not sampled.
5903 for i in `seq 1 3`; do
5904     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)'])
5905 done
5906 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
5907 flow-dump from non-dpdk interfaces:
5908 packets:2, bytes:120, used:0.001s, actions:drop
5909 ])
5910
5911 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
5912 AT_CLEANUP
5913
5914 dnl Flow IPFIX sanity check for tunnel set
5915 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
5916 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5917 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
5918                     options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
5919                     options:key=5 ofport_request=1\
5920                     -- add-port br0 p2 -- set Interface p2 type=stt \
5921                     options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
5922                     options:key=6 ofport_request=2\
5923                     -- add-port br0 p3 -- set Interface p3 type=dummy \
5924                     ofport_request=3 \
5925                     -- --id=@br0 get Bridge br0 \
5926                     -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
5927                     -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
5928                    [<0>
5929 <1>
5930 ])
5931
5932 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
5933
5934 dnl Add openflow sample action without sampling_port.
5935 AT_DATA([flows.txt], [dnl
5936 in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
5937 ])
5938 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
5939
5940 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])
5941 AT_CHECK([tail -1 stdout], [0], [dnl
5942 Datapath actions: sample(sample=100.0%,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
5943 ])
5944
5945 dnl Remove the flow which contains sample action.
5946 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
5947 AT_CHECK([ovs-appctl revalidator/purge])
5948
5949 dnl Add openflow sample action with sampling_port which is
5950 dnl equal to output port.
5951 AT_DATA([flows2.txt], [dnl
5952 in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
5953 ])
5954 AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
5955
5956 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])
5957 dnl Make sure flow sample action in datapath is behind set tunnel
5958 dnl action at egress point of tunnel port.
5959 AT_CHECK([tail -1 stdout], [0], [dnl
5960 Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),sample(sample=100.0%,actions(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
5961 ])
5962
5963 dnl Remove the flow which contains sample action.
5964 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
5965 AT_CHECK([ovs-appctl revalidator/purge])
5966
5967 dnl Add a rule with two sample actions and each sample action
5968 dnl has a sampling_port
5969 AT_DATA([flows3.txt], [dnl
5970 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
5971 ])
5972 AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
5973
5974 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])
5975 dnl Make sure flow sample action in datapath is behind set tunnel
5976 dnl action at egress point of tunnel port.
5977 AT_CHECK([tail -1 stdout], [0], [dnl
5978 Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),sample(sample=100.0%,actions(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,flags(df|key))),sample(sample=100.0%,actions(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
5979 ])
5980
5981 dnl Remove the flow which contains sample action.
5982 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
5983 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
5984
5985 OVS_VSWITCHD_STOP
5986 AT_CLEANUP
5987
5988 dnl Flow based IPFIX statistics check
5989 AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
5990 OVS_VSWITCHD_START
5991 add_of_ports br0 1 2
5992
5993 dnl Negative test check.
5994 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
5995 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
5996 NXST_IPFIX_FLOW request (xid=0x2):
5997 ])
5998
5999 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6000                     -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6001                     -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6002          [0], [ignore])
6003
6004 AT_DATA([flows.txt], [dnl
6005 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
6006 ])
6007
6008 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6009
6010 dnl Send some packets that should be sampled.
6011 for i in `seq 1 20`; do
6012     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)'])
6013 done
6014
6015 dnl There are 4 extra IPFIX template packets.
6016 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
6017 NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
6018   id   1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=12
6019           pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=12
6020 ])
6021
6022 dnl Remove the flow which contains sample action.
6023 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
6024 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
6025 AT_CHECK([ovs-appctl revalidator/purge])
6026
6027 dnl Send some more packets, to ensure that these are not sampled.
6028 for i in `seq 1 3`; do
6029     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)'])
6030 done
6031 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
6032 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6033 NXST_IPFIX_FLOW request (xid=0x2):
6034 ])
6035
6036 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6037 AT_CLEANUP
6038
6039 AT_SETUP([ofproto-dpif - flow stats])
6040 OVS_VSWITCHD_START
6041 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
6042 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
6043
6044 ovs-appctl time/stop
6045
6046 for i in `seq 1 10`; do
6047     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)'
6048 done
6049
6050 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6051 AT_CHECK([ovs-appctl revalidator/purge], [0])
6052 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
6053 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
6054  cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6055  cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
6056 ])
6057 OVS_VSWITCHD_STOP
6058 AT_CLEANUP
6059
6060 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
6061 OVS_VSWITCHD_START
6062 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
6063 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
6064
6065 ovs-appctl time/stop
6066
6067 for i in `seq 1 10`; do
6068     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)'
6069 done
6070
6071 ovs-appctl time/warp 100
6072 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
6073 ovs-appctl time/warp 1000
6074
6075 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
6076 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
6077  cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6078  cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
6079 ])
6080 OVS_VSWITCHD_STOP
6081 AT_CLEANUP
6082
6083 AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
6084 OVS_VSWITCHD_START
6085
6086 # get_ages DURATION HARD IDLE
6087 #
6088 # Fetch the flow duration, hard age, and idle age into the variables
6089 # whose names are given as arguments.  Rounds DURATION down to the
6090 # nearest integer.  If hard_age doesn't appear in the output, sets
6091 # HARD to "none".  If idle_age doesn't appear in the output, sets IDLE
6092 # to 0.
6093 get_ages () {
6094     AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
6095
6096     duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
6097     AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
6098     AS_VAR_COPY([$1], [duration])
6099
6100     hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
6101     if test X"$hard" = X; then
6102         hard=none
6103     else
6104         AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
6105     fi
6106     AS_VAR_COPY([$2], [hard])
6107
6108     idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
6109     if test X"$idle" = X; then
6110         idle=0
6111     else
6112         AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
6113     fi
6114     AS_VAR_COPY([$3], [idle])
6115 }
6116
6117 # Add a flow and get its initial hard and idle age.
6118 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
6119 get_ages duration1 hard1 idle1
6120
6121 ovs-appctl time/stop
6122 # Warp time forward by 10 seconds, then modify the flow's actions.
6123 ovs-appctl time/warp 10000
6124 get_ages duration2 hard2 idle2
6125 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
6126
6127 # Warp time forward by 10 seconds.
6128 ovs-appctl time/warp 10000
6129 get_ages duration3 hard3 idle3
6130
6131 # Warp time forward 10 more seconds, then pass some packets through the flow,
6132 # then warp forward a few more times because idle times are only updated
6133 # occasionally.
6134 ovs-appctl time/warp 10000
6135 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)'
6136 ovs-appctl time/warp 3000 1000
6137 sleep 1
6138 get_ages duration4 hard4 idle4
6139
6140 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
6141 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
6142 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
6143
6144 # Duration should increase steadily over time.
6145 AT_CHECK([test $duration1 -lt $duration2])
6146 AT_CHECK([test $duration2 -lt $duration3])
6147 AT_CHECK([test $duration3 -lt $duration4])
6148
6149 # Hard age should be "none" initially because it's the same as flow_duration,
6150 # then it should increase.
6151 AT_CHECK([test $hard1 = none])
6152 AT_CHECK([test $hard2 = none])
6153 AT_CHECK([test $hard3 != none])
6154 AT_CHECK([test $hard4 != none])
6155 AT_CHECK([test $hard3 -lt $hard4])
6156
6157 # Idle age should increase from 1 to 2 to 3, then decrease.
6158 AT_CHECK([test $idle1 -lt $idle2])
6159 AT_CHECK([test $idle2 -lt $idle3])
6160 AT_CHECK([test $idle3 -gt $idle4])
6161
6162 # Check some invariant relationships.
6163 AT_CHECK([test $duration1 = $idle1])
6164 AT_CHECK([test $duration2 = $idle2])
6165 AT_CHECK([test $duration3 = $idle3])
6166 AT_CHECK([test $idle3 -gt $hard3])
6167 AT_CHECK([test $idle4 -lt $hard4])
6168 AT_CHECK([test $hard4 -lt $duration4])
6169
6170 OVS_VSWITCHD_STOP
6171 AT_CLEANUP
6172
6173 AT_SETUP([ofproto-dpif - fin_timeout])
6174 OVS_VSWITCHD_START
6175 ovs-appctl time/stop
6176 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
6177 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
6178 [NXST_FLOW reply:
6179  idle_timeout=60, actions=fin_timeout(idle_timeout=5)
6180 ])
6181
6182 # Check that a TCP SYN packet does not change the timeout.  (Because
6183 # flow stats updates are mainly what implements the fin_timeout
6184 # feature, we warp forward a couple of times to ensure that flow stats
6185 # run before re-checking the flow table.)
6186 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
6187 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
6188 warped
6189 ])
6190 AT_CHECK([ovs-appctl revalidator/purge], [0])
6191 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
6192 [NXST_FLOW reply:
6193  n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
6194 ])
6195 # Check that a TCP FIN packet does change the timeout.
6196 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
6197 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
6198 warped
6199 ])
6200 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
6201 [NXST_FLOW reply:
6202  n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
6203 ])
6204 OVS_VSWITCHD_STOP
6205 AT_CLEANUP
6206
6207 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
6208 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
6209 add_of_ports br0 1 2
6210 add_of_ports br1 3
6211
6212 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
6213 dummy@br0
6214 dummy@br1
6215 ])
6216 OVS_VSWITCHD_STOP
6217 AT_CLEANUP
6218
6219 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
6220 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
6221                    [--dummy-numa="0,0,0,0,1,1,1,1"])
6222 add_pmd_of_ports br0 1 2
6223 add_of_ports br1 3
6224
6225 AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
6226 dummy@ovs-dummy: hit:0 missed:0
6227         br0:
6228                 br0 65534/100: (dummy)
6229                 p1 1/1: (dummy-pmd: <cleared>)
6230                 p2 2/2: (dummy-pmd: <cleared>)
6231         br1:
6232                 br1 65534/101: (dummy)
6233                 p3 3/3: (dummy)
6234 ])
6235 OVS_VSWITCHD_STOP
6236 AT_CLEANUP
6237
6238 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
6239 # bump max-idle to avoid the flows being reclaimed behind us
6240 OVS_VSWITCHD_START([add-br br1 -- \
6241                     set bridge br1 datapath-type=dummy fail-mode=secure -- \
6242                     set Open_vSwitch . other_config:max-idle=10000], [], [],
6243                     [--dummy-numa="0,0,0,0,1,1,1,1"])
6244 add_of_ports br0 1
6245 add_pmd_of_ports br0 2
6246 add_of_ports br1 3
6247
6248 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)'])
6249 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)'])
6250 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)'])
6251 ovs-appctl revalidator/wait
6252 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
6253 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
6254 recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
6255 ])
6256
6257 AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
6258 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
6259 ])
6260
6261 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
6262 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(p1),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
6263 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(p2),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=0/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
6264 ])
6265
6266 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
6267 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(p3),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
6268 ])
6269
6270 OVS_VSWITCHD_STOP
6271 AT_CLEANUP
6272
6273 m4_define([OFPROTO_DPIF_GET_FLOW],
6274   [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
6275
6276    OVS_VSWITCHD_START([add-br br1 -- \
6277                        set bridge br1 datapath-type=dummy fail-mode=secure -- \
6278                        set Open_vSwitch . other_config:max-idle=10000], [], [],
6279                        [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
6280
6281    func=`echo -n "$1_" | cut -c 4-`
6282    add_${func}of_ports br0 1 2
6283
6284    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)'])
6285    ovs-appctl revalidator/wait
6286    AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
6287
6288    UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
6289    AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
6290 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
6291 ])
6292
6293    OVS_VSWITCHD_STOP
6294    AT_CLEANUP])
6295
6296 OFPROTO_DPIF_GET_FLOW([])
6297 OFPROTO_DPIF_GET_FLOW([ - pmd])
6298
6299 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
6300 OVS_VSWITCHD_START([dnl
6301    add-port br0 p1 -- set Interface p1 type=dummy
6302 ])
6303 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6304 on_exit 'kill `cat ovs-ofctl.pid`'
6305
6306 AT_CAPTURE_FILE([ofctl_monitor.log])
6307 AT_DATA([flows.txt], [dnl
6308 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
6309 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
6310 ])
6311 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6312
6313 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
6314 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
6315 dnl
6316 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
6317 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)
6318 dnl         (label 20, exp 0, [S], ttl 32)
6319 dnl         (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
6320 dnl     192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6321
6322 for dl_src in 00 01; do
6323     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"])
6324 done
6325 sleep 1  # wait for the datapath flow installed
6326 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
6327 recirc_id(0),in_port(1),eth(src=60:66:66:66:66:00),eth_type(0x8847),mpls(label=20,tc=0,ttl=32,bos=0,label=20,tc=0,ttl=32,bos=1), actions:userspace(pid=0,slow_path(controller))
6328 recirc_id(0),in_port(1),eth(src=60:66:66:66:66:01),eth_type(0x8847),mpls(label=20/0x0,tc=0/0,ttl=32/0x0,bos=0/1,label=20/0xfffff,tc=0/7,ttl=32/0xff,bos=1/1), actions:userspace(pid=0,slow_path(controller))
6329 ])
6330
6331 OVS_VSWITCHD_STOP
6332 AT_CLEANUP
6333
6334
6335 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
6336 OVS_VSWITCHD_START([dnl
6337    add-port br0 p1 -- set Interface p1 type=dummy
6338 ])
6339 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6340 on_exit 'kill `cat ovs-ofctl.pid`'
6341
6342 AT_CAPTURE_FILE([ofctl_monitor.log])
6343 AT_DATA([flows.txt], [dnl
6344 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
6345 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
6346 ])
6347 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6348
6349 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
6350 dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
6351 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
6352 dnl
6353 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
6354 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)
6355 dnl         (label 20, exp 0, ttl 32)
6356 dnl         (label 20, exp 0, ttl 32)
6357 dnl         (label 20, exp 0, [S], ttl 32)
6358 dnl         (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
6359 dnl     192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6360
6361 for dl_src in 00 01; do
6362     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"])
6363 done
6364 sleep 1  # wait for the datapath flow installed
6365 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
6366 recirc_id(0),in_port(1),eth(src=60:66:66:66:66:00),eth_type(0x8847),mpls(label=20,tc=0,ttl=32,bos=0,label=20,tc=0,ttl=32,bos=1), actions:userspace(pid=0,slow_path(controller))
6367 recirc_id(0),in_port(1),eth(src=60:66:66:66:66:01),eth_type(0x8847),mpls(label=20/0x0,tc=0/0,ttl=32/0x0,bos=0/1,label=20/0xfffff,tc=0/7,ttl=32/0xff,bos=1/1), actions:userspace(pid=0,slow_path(controller))
6368 ])
6369
6370 OVS_VSWITCHD_STOP
6371 AT_CLEANUP
6372
6373 AT_SETUP([ofproto-dpif - patch ports])
6374 OVS_VSWITCHD_START([add-br br1 \
6375 -- set bridge br1 datapath-type=dummy fail-mode=secure \
6376 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
6377 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6378
6379 add_of_ports br0 2
6380 add_of_ports br1 3
6381
6382 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
6383 ], [])
6384 AT_CHECK([ovs-appctl time/stop])
6385 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6386
6387 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
6388 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
6389
6390 for i in $(seq 1 10); do
6391     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)'
6392     if [[ $i -eq 1 ]]; then
6393         sleep 1
6394     fi
6395 done
6396
6397 for i in $(seq 1 5); do
6398     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)'
6399     if [[ $i -eq 1 ]]; then
6400         sleep 1
6401     fi
6402 done
6403
6404 AT_CHECK([ovs-appctl time/warp 500], [0],
6405 [warped
6406 ])
6407 sleep 1  # wait for log writer
6408
6409 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6410 dummy@ovs-dummy: hit:13 missed:2
6411         br0:
6412                 br0 65534/100: (dummy)
6413                 p2 2/2: (dummy)
6414                 pbr0 1/none: (patch: peer=pbr1)
6415         br1:
6416                 br1 65534/101: (dummy)
6417                 p3 3/3: (dummy)
6418                 pbr1 1/none: (patch: peer=pbr0)
6419 ])
6420
6421 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
6422 recirc_id(0),in_port(100),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
6423 recirc_id(0),in_port(101),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
6424 ])
6425
6426 AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
6427 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(100),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:9, bytes:540, used:0.0s, actions:101,3,2
6428 ])
6429 AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
6430 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(101),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:4, bytes:240, used:0.0s, actions:100,2,3
6431 ])
6432
6433 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
6434 OFPST_PORT reply (xid=0x4): 1 ports
6435   port  1: rx pkts=5, bytes=300, drop=?, errs=?, frame=?, over=?, crc=?
6436            tx pkts=10, bytes=600, drop=?, errs=?, coll=?
6437 ])
6438
6439 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
6440 OFPST_PORT reply (xid=0x4): 1 ports
6441   port  1: rx pkts=10, bytes=600, drop=?, errs=?, frame=?, over=?, crc=?
6442            tx pkts=5, bytes=300, drop=?, errs=?, coll=?
6443 ])
6444
6445 OVS_VSWITCHD_STOP
6446 AT_CLEANUP
6447
6448 AT_SETUP([ofproto-dpif - patch ports - stack])
6449 OVS_VSWITCHD_START([add-br br1 \
6450 -- set bridge br1 datapath-type=dummy fail-mode=secure \
6451 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
6452 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6453
6454 add_of_ports br0 2
6455 add_of_ports br1 3
6456
6457 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
6458 ], [])
6459 AT_CHECK([ovs-appctl time/stop])
6460 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6461
6462 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"])
6463 # Try to pop from empty stack, and push and leave data to stack.
6464 AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
6465
6466 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)'
6467
6468 AT_CHECK([ovs-appctl time/warp 500], [0],
6469 [warped
6470 ])
6471
6472 OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
6473
6474 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6475 dummy@ovs-dummy: hit:0 missed:1
6476         br0:
6477                 br0 65534/100: (dummy)
6478                 p2 2/2: (dummy)
6479                 pbr0 1/none: (patch: peer=pbr1)
6480         br1:
6481                 br1 65534/101: (dummy)
6482                 p3 3/3: (dummy)
6483                 pbr1 1/none: (patch: peer=pbr0)
6484 ])
6485
6486 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
6487 recirc_id(0),in_port(100),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:101,set(ipv4(src=255.255.255.254)),2
6488 ])
6489
6490 AT_CHECK([grep -e '|nx_match|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
6491 Failed to pop from an empty stack. On flow
6492 ])
6493
6494 OVS_VSWITCHD_STOP(["/Failed to pop from an empty stack/d"])
6495 AT_CLEANUP
6496
6497 AT_SETUP([ofproto-dpif - port duration])
6498 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
6499 add_of_ports br0 1 2
6500
6501 ovs-appctl time/stop
6502 ovs-appctl time/warp 10000
6503
6504 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
6505 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
6506 [dnl
6507            duration=?s
6508            duration=?s
6509            duration=?s
6510 ])
6511 OVS_VSWITCHD_STOP
6512 AT_CLEANUP
6513
6514 dnl ----------------------------------------------------------------------
6515 AT_BANNER([ofproto-dpif -- megaflows])
6516
6517 AT_SETUP([ofproto-dpif megaflow - port classification])
6518 OVS_VSWITCHD_START
6519 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6520 add_of_ports br0 1 2
6521 AT_DATA([flows.txt], [dnl
6522 table=0 in_port=1 actions=output(2)
6523 ])
6524 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6525 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)'])
6526 sleep 1
6527 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)'])
6528 sleep 1
6529 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6530 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
6531 ])
6532 OVS_VSWITCHD_STOP
6533 AT_CLEANUP
6534
6535 AT_SETUP([ofproto-dpif megaflow - L2 classification])
6536 OVS_VSWITCHD_START
6537 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6538 add_of_ports br0 1 2
6539 AT_DATA([flows.txt], [dnl
6540 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
6541 ])
6542 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6543 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)'])
6544 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)'])
6545 sleep 1
6546 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6547 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
6548 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
6549 ])
6550 OVS_VSWITCHD_STOP
6551 AT_CLEANUP
6552
6553 AT_SETUP([ofproto-dpif megaflow - L3 classification])
6554 OVS_VSWITCHD_START
6555 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6556 add_of_ports br0 1 2
6557 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], [])
6558 AT_DATA([flows.txt], [dnl
6559 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
6560 ])
6561 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6562 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)'])
6563 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)'])
6564 sleep 1
6565 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6566 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
6567 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,frag=no), actions: <del>
6568 ])
6569 OVS_VSWITCHD_STOP
6570 AT_CLEANUP
6571
6572 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
6573 OVS_VSWITCHD_START
6574 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6575 add_of_ports br0 1 2
6576 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], [])
6577 AT_DATA([flows.txt], [dnl
6578 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
6579 ])
6580 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6581 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)'])
6582 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)'])
6583 sleep 1
6584 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6585 recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5,frag=no), actions: <del>
6586 recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:5:4:3:2:1/ffff:ffff:ffff:fffc::,frag=no), actions: <del>
6587 ])
6588 OVS_VSWITCHD_STOP
6589 AT_CLEANUP
6590
6591 AT_SETUP([ofproto-dpif megaflow - L4 classification])
6592 OVS_VSWITCHD_START
6593 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6594 add_of_ports br0 1 2
6595 AT_DATA([flows.txt], [dnl
6596 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
6597 ])
6598 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6599 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)'])
6600 sleep 1
6601 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)'])
6602 sleep 1
6603 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6604 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=1,frag=no),icmp(type=8), actions: <del>
6605 ])
6606 OVS_VSWITCHD_STOP
6607 AT_CLEANUP
6608
6609 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
6610   [AT_SETUP([ofproto-dpif megaflow - normal$1])
6611    OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
6612    AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6613    func=`echo -n "$1_" | cut -c 4-`
6614    add_${func}of_ports br0 1 2
6615    AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6616    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)'])
6617    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)'])
6618    sleep 1
6619    AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6620 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
6621 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
6622 ])
6623    OVS_VSWITCHD_STOP
6624    AT_CLEANUP])
6625
6626 OFPROTO_DPIF_MEGAFLOW_NORMAL([])
6627 OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
6628
6629 AT_SETUP([ofproto-dpif megaflow - mpls])
6630 OVS_VSWITCHD_START
6631 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6632 add_of_ports br0 1 2
6633 AT_DATA([flows.txt], [dnl
6634 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
6635 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6636 ])
6637 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6638 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)'])
6639 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)'])
6640 sleep 1
6641 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
6642 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1), actions:push_mpls(label=11,tc=3,ttl=64,bos=0,eth_type=0x8847),2
6643 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x8847),mpls(label=11/0x0,tc=3/0,ttl=64/0x0,bos=1/1), actions:pop_mpls(eth_type=0x800),2
6644 ])
6645 OVS_VSWITCHD_STOP
6646 AT_CLEANUP
6647
6648 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
6649 m4_define([CHECK_MEGAFLOW_NETFLOW],
6650   [OVS_VSWITCHD_START
6651   AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6652   add_of_ports br0 1 2
6653
6654   dnl NetFlow configuration disables wildcarding relevant fields
6655   on_exit 'kill `cat test-netflow.pid`'
6656   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6657   AT_CAPTURE_FILE([netflow.log])
6658   PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6659   ovs-vsctl \
6660      set Bridge br0 netflow=@nf -- \
6661      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6662        engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6663
6664   AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6665   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)'])
6666   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)'])
6667   sleep 1
6668   AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6669 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
6670 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
6671 ])
6672   OVS_APP_EXIT_AND_WAIT([test-netflow])
6673   OVS_VSWITCHD_STOP])
6674
6675 AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
6676 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
6677 AT_CLEANUP
6678
6679 AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
6680 AT_SKIP_IF([test $HAVE_IPV6 = no])
6681 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
6682 AT_CLEANUP
6683
6684 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
6685   [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
6686    OVS_VSWITCHD_START(
6687      [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
6688       add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
6689       set interface p2 type=$1 ofport_request=2 -- \
6690       set interface p3 type=$1 ofport_request=3], [], [],
6691       [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
6692    AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
6693 ])
6694    AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6695
6696    AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6697    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)'])
6698    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)'])
6699    sleep 1
6700    AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6701 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
6702 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
6703 ])
6704    OVS_VSWITCHD_STOP
6705    AT_CLEANUP])
6706
6707 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
6708 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
6709
6710 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
6711 OVS_VSWITCHD_START(
6712   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
6713    add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
6714    set interface p2 type=dummy ofport_request=2 -- \
6715    set interface p3 type=dummy ofport_request=3])
6716 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
6717 ])
6718 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6719
6720 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6721 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)'])
6722 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)'])
6723 sleep 1
6724 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6725 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
6726 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
6727 ])
6728 OVS_VSWITCHD_STOP
6729 AT_CLEANUP
6730
6731 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
6732 # Create bond0 on br0 with interfaces p0 and p1
6733 #    and bond1 on br1 with interfaces p2 and p3
6734 # with p0 patched to p2 and p1 patched to p3.
6735 OVS_VSWITCHD_START(
6736   [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
6737                             other-config:lacp-time=fast \
6738                             other-config:bond-rebalance-interval=0 -- \
6739    set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
6740    set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
6741    add-br br1 -- \
6742    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
6743    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
6744                   fail-mode=secure -- \
6745    add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
6746                             other-config:lacp-time=fast \
6747                             other-config:bond-rebalance-interval=0 -- \
6748    set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
6749    set interface p3 type=patch options:peer=p1 ofport_request=4 --])
6750
6751 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
6752 ])
6753 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6754 add_of_ports br0 7
6755 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6756 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
6757 ovs-appctl time/stop
6758 ovs-appctl time/warp 5000
6759 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)'])
6760 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)'])
6761 sleep 1
6762 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6763 recirc_id(0),in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
6764 recirc_id(0),in_port(7),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
6765 ])
6766 OVS_VSWITCHD_STOP
6767 AT_CLEANUP
6768
6769 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
6770 OVS_VSWITCHD_START
6771 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6772 add_of_ports br0 1 2
6773 AT_DATA([flows.txt], [dnl
6774 table=0 in_port=1,ip actions=resubmit(90)
6775 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
6776 ])
6777 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6778 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)'])
6779 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)'])
6780 sleep 1
6781 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6782 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
6783 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
6784 ])
6785 OVS_VSWITCHD_STOP
6786 AT_CLEANUP
6787
6788 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
6789 OVS_VSWITCHD_START
6790 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6791 add_of_ports br0 1 2
6792 AT_DATA([flows.txt], [dnl
6793 table=0 in_port=1,ip actions=resubmit(,1)
6794 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
6795 ])
6796 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6797 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)'])
6798 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=
6799 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
6800 sleep 1
6801 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6802 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
6803 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
6804 ])
6805 OVS_VSWITCHD_STOP
6806 AT_CLEANUP
6807
6808 AT_SETUP([ofproto-dpif megaflow - goto_table action])
6809 OVS_VSWITCHD_START
6810 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6811 add_of_ports br0 1 2
6812 AT_DATA([flows.txt], [dnl
6813 table=0 in_port=1,ip actions=goto_table(1)
6814 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
6815 ])
6816 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
6817 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)'])
6818 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)'])
6819 sleep 1
6820 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6821 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
6822 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
6823 ])
6824 OVS_VSWITCHD_STOP
6825 AT_CLEANUP
6826
6827 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
6828 AT_KEYWORDS([mirror mirrors mirroring])
6829 OVS_VSWITCHD_START
6830 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6831 add_of_ports br0 1 2 3
6832 ovs-vsctl \
6833         set Bridge br0 mirrors=@m --\
6834         --id=@p3 get Port p3 --\
6835         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
6836
6837 AT_DATA([flows.txt], [dnl
6838 in_port=1 actions=output:2
6839 ])
6840 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6841 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)'])
6842 sleep 1
6843 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)'])
6844 sleep 1
6845 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6846 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
6847 ])
6848 OVS_VSWITCHD_STOP
6849 AT_CLEANUP
6850
6851 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
6852 OVS_VSWITCHD_START
6853 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6854 add_of_ports br0 1 2 3
6855 ovs-vsctl \
6856         set Bridge br0 mirrors=@m --\
6857         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
6858         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
6859
6860 AT_DATA([flows.txt], [dnl
6861 in_port=1 actions=output:2
6862 ])
6863 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6864 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))'])
6865 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)'])
6866 sleep 1
6867 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6868 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
6869 recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=11,pcp=7/0x0),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
6870 ])
6871 OVS_VSWITCHD_STOP
6872 AT_CLEANUP
6873
6874 AT_SETUP([ofproto-dpif megaflow - move action])
6875 OVS_VSWITCHD_START
6876 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6877 add_of_ports br0 1 2
6878 AT_DATA([flows.txt], [dnl
6879 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
6880 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
6881 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
6882 ])
6883 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6884 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)'])
6885 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)'])
6886 sleep 1
6887 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6888 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
6889 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
6890 ])
6891 OVS_VSWITCHD_STOP
6892 AT_CLEANUP
6893
6894 AT_SETUP([ofproto-dpif megaflow - push action])
6895 OVS_VSWITCHD_START
6896 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6897 add_of_ports br0 1 2
6898 AT_DATA([flows.txt], [dnl
6899 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
6900 ])
6901 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6902 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)'])
6903 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)'])
6904 sleep 1
6905 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6906 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
6907 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
6908 ])
6909 OVS_VSWITCHD_STOP
6910 AT_CLEANUP
6911
6912 AT_SETUP([ofproto-dpif megaflow - learning])
6913 OVS_VSWITCHD_START
6914 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6915 add_of_ports br0 1 2
6916 AT_DATA([flows.txt], [dnl
6917 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
6918 ])
6919 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6920 ovs-appctl time/stop
6921 # We send each packet twice because the first packet in each flow causes the
6922 # flow table to change and thus revalidations, which (depending on timing)
6923 # can keep a megaflow from being installed.  The revalidations are done by
6924 # the second iteration, allowing the flows to be installed.
6925 for i in 1 2; do
6926     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)'])
6927     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)'])
6928     ovs-appctl time/warp 100
6929 done
6930 sleep 1
6931 dnl The original flow is missing due to a revalidation.
6932 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6933 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
6934 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
6935 ])
6936 OVS_VSWITCHD_STOP
6937 AT_CLEANUP
6938
6939 AT_SETUP([ofproto-dpif megaflow - tunnels])
6940 OVS_VSWITCHD_START(
6941   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
6942 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6943 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
6944      options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
6945 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
6946           ofport_request=3])
6947 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
6948      options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
6949      ofport_request=4 options:key=flow])
6950 AT_DATA([flows.txt], [dnl
6951 in_port=1,actions=output(2)
6952 in_port=3,actions=output(4)
6953 ])
6954 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6955 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
6956 dnl will cause the packet to be dropped.
6957 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)'])
6958 sleep 1
6959 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)'])
6960 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)'])
6961 sleep 1
6962 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)'])
6963 sleep 1
6964 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6965 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
6966 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
6967 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
6968 ])
6969 OVS_VSWITCHD_STOP
6970 AT_CLEANUP
6971
6972 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
6973 OVS_VSWITCHD_START
6974 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6975 add_of_ports br0 1 2
6976 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], [])
6977 AT_DATA([flows.txt], [dnl
6978 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
6979 ])
6980 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6981 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)'])
6982 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)'])
6983 sleep 1
6984 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
6985 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
6986 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,ttl=64,frag=no), actions: <del>
6987 ])
6988 OVS_VSWITCHD_STOP
6989 AT_CLEANUP
6990
6991 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
6992 OVS_VSWITCHD_START
6993 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6994 add_of_ports br0 1 2
6995 AT_DATA([flows.txt], [dnl
6996 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
6997 ])
6998 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6999 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)'])
7000 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)'])
7001 sleep 1
7002 dnl The first packet is essentially a no-op, as the new destination MAC is the
7003 dnl same as the original.  The second entry actually updates the destination
7004 dnl MAC.
7005 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7006 recirc_id(0),in_port(1),eth(dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions:2
7007 recirc_id(0),in_port(1),eth(dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions:set(eth(dst=50:54:00:00:00:0a)),2
7008 ])
7009 OVS_VSWITCHD_STOP
7010 AT_CLEANUP
7011
7012 m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
7013   [AT_SETUP([ofproto-dpif megaflow - disabled$1])
7014    OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7015    AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7016    func=`echo -n "$1_" | cut -c 4-`
7017    add_${func}of_ports br0 1 2
7018    AT_DATA([flows.txt], [dnl
7019 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
7020 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
7021 ])
7022    AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
7023 ], [])
7024    AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7025 ], [])
7026    AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
7027    AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7028    for i in 1 2 3 4; do
7029        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)'])
7030        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)'])
7031        if [[ $i -eq 1 ]]; then
7032            sleep 1
7033        fi
7034    done
7035    sleep 1
7036    AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7037 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions:2
7038 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions:drop
7039 ])
7040    AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
7041 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:180, used:0.0s, actions:2
7042 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:180, used:0.0s, actions:drop
7043 ])
7044    OVS_VSWITCHD_STOP
7045    AT_CLEANUP])
7046
7047 OFPROTO_DPIF_MEGAFLOW_DISABLED([])
7048 OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
7049
7050 AT_SETUP([ofproto-dpif - datapath port number change])
7051 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
7052 add_of_ports br0 1
7053
7054 # Trace a flow that should output to p1.
7055 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
7056   [0], [stdout])
7057 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
7058 ])
7059
7060 # Change p1's port number to 5.
7061 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
7062
7063 # Trace a flow that should output to p1 in its new location.
7064 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
7065   [0], [stdout])
7066 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
7067 ])
7068 OVS_VSWITCHD_STOP
7069 AT_CLEANUP
7070
7071 # Tests the bundling with various bfd and cfm configurations.
7072 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
7073 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
7074                     add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
7075                     add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
7076                     set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
7077                     set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
7078                     set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
7079                     set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
7080                     set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
7081                     set Interface p0 cfm_mpid=1 -- \
7082                     set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
7083
7084 ovs-appctl time/stop
7085 # advance the clock to stablize everything.
7086 ovs-appctl time/warp 5000 100
7087 # cfm/show should show 'recv' fault.
7088 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
7089         fault: recv
7090 ])
7091 # bfd/show should show 'up'.
7092 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
7093         Local Session State: up
7094         Remote Session State: up
7095         Local Session State: up
7096         Remote Session State: up
7097 ])
7098 # bond/show should show 'may-enable: true' for all slaves.
7099 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
7100         may_enable: true
7101         may_enable: true
7102         may_enable: true
7103         may_enable: true
7104 ])
7105
7106 # now disable the bfd on p1.
7107 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
7108 # advance the clock to stablize everything.
7109 ovs-appctl time/warp 5000 100
7110 # cfm/show should show 'recv' fault.
7111 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
7112         fault: recv
7113 ])
7114 # bfd/show should show 'down'.
7115 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
7116         Local Session State: down
7117         Remote Session State: down
7118 ])
7119 # bond/show should show 'may-enable: false' for p0.
7120 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
7121         may_enable: false
7122         may_enable: true
7123 ])
7124
7125 # now enable the bfd on p1 and disable bfd on p0.
7126 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
7127 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
7128 # advance the clock to stablize everything.
7129 ovs-appctl time/warp 5000 100
7130 # cfm/show should show 'recv' fault.
7131 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
7132         fault: recv
7133 ])
7134 # bfd/show should show 'down'.
7135 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
7136         Local Session State: down
7137         Remote Session State: down
7138 ])
7139 # bond/show should show 'may-enable: false' for p0 and p1.
7140 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
7141         may_enable: false
7142         may_enable: true
7143         may_enable: false
7144         may_enable: true
7145 ])
7146
7147 OVS_VSWITCHD_STOP
7148 AT_CLEANUP
7149
7150 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
7151 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
7152
7153 # enable bfd on p0.
7154 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
7155 # check log.
7156 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
7157 # disable bfd on p0.
7158 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
7159 # check log.
7160 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
7161 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])
7162
7163 # enable cfm on p0.
7164 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
7165 # check log.
7166 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
7167 # disable cfm on p0.
7168 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
7169 # check log.
7170 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
7171 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])
7172
7173 # enable both bfd and cfm on p0.
7174 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
7175 # check log.
7176 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
7177 # disable bfd on p0.
7178 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
7179 # check log, there should not be the log of thread terminated.
7180 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
7181 ])
7182 # reenable bfd on p0.
7183 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
7184 # check log, should still be on log of thread created.
7185 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
7186 monitor thread created
7187 ])
7188 # disable bfd and cfm together.
7189 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
7190 # check log.
7191 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
7192
7193 OVS_VSWITCHD_STOP
7194 AT_CLEANUP
7195
7196 # this test helps avoid the deadlock between the main thread and monitor thread.
7197 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
7198 OVS_VSWITCHD_START
7199
7200 for i in `seq 1 199`
7201 do
7202     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])
7203 done
7204
7205 OVS_VSWITCHD_STOP
7206 AT_CLEANUP
7207 \f
7208 AT_BANNER([ofproto-dpif - flow translation resource limits])
7209
7210 dnl Resubmits to later tables do not count against the depth limit, so we
7211 dnl can do 99 of them even though the maximum depth is 64.
7212 AT_SETUP([ofproto-dpif - forward resubmit])
7213 OVS_VSWITCHD_START
7214 (for i in `seq 0 99`; do
7215     j=`expr $i + 1`
7216     echo "table=$i, actions=resubmit(,$j)"
7217  done
7218  echo "table=100, actions=local") > flows
7219 AT_CHECK([ovs-ofctl add-flows br0 flows])
7220 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
7221   [0], [stdout])
7222 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
7223 ])
7224 OVS_VSWITCHD_STOP
7225 AT_CLEANUP
7226
7227 dnl Resubmits to the same or an earlier table count against the depth limit,
7228 dnl so only 64 of them are allowed.
7229 AT_SETUP([ofproto-dpif - backward resubmit])
7230 OVS_VSWITCHD_START
7231 (echo "table=0, actions=resubmit(,66)"
7232  for i in `seq 2 66`; do
7233     j=`expr $i - 1`
7234     echo "table=$i, actions=resubmit(,$j)"
7235  done
7236  echo "table=1, actions=local") > flows
7237 AT_CHECK([ovs-ofctl add-flows br0 flows])
7238 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
7239   [0], [stdout])
7240 AT_CHECK([tail -1 stdout], [0],
7241   [Translation failed (Recursion too deep), packet is dropped.
7242 ])
7243 AT_CHECK([grep -c 'over max translation depth 64' stdout],
7244   [0], [1
7245 ])
7246 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
7247 AT_CLEANUP
7248
7249 AT_SETUP([ofproto-dpif - infinite resubmit])
7250 OVS_VSWITCHD_START
7251 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
7252 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
7253   [0], [stdout])
7254 AT_CHECK([tail -1 stdout], [0],
7255   [Translation failed (Recursion too deep), packet is dropped.
7256 ])
7257 AT_CHECK([grep -c 'over max translation depth 64' stdout],
7258   [0], [1
7259 ])
7260 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
7261 AT_CLEANUP
7262
7263 AT_SETUP([ofproto-dpif - exponential resubmit chain])
7264 OVS_VSWITCHD_START
7265 add_of_ports br0 1
7266 (for i in `seq 1 64`; do
7267      j=`expr $i + 1`
7268      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
7269  done
7270  echo "in_port=65, actions=local") > flows
7271  AT_CHECK([ovs-ofctl add-flows br0 flows])
7272 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
7273 AT_CHECK([tail -1 stdout], [0],
7274   [Translation failed (Too many resubmits), packet is dropped.
7275 ])
7276 AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
7277 ])
7278 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
7279 AT_CLEANUP
7280
7281 AT_SETUP([ofproto-dpif - too many output actions])
7282 OVS_VSWITCHD_START
7283 add_of_ports br0 1
7284 (for i in `seq 1 12`; do
7285      j=`expr $i + 1`
7286      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
7287  done
7288  echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
7289 AT_CHECK([ovs-ofctl add-flows br0 flows])
7290 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
7291 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
7292   [0], [1
7293 ])
7294 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
7295 ])
7296 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
7297 AT_CLEANUP
7298
7299 AT_SETUP([ofproto-dpif - stack too deep])
7300 OVS_VSWITCHD_START
7301 add_of_ports br0 1
7302 (for i in `seq 1 12`; do
7303      j=`expr $i + 1`
7304      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
7305  done
7306  push="push:NXM_NX_REG0[[]]"
7307  echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
7308  AT_CHECK([ovs-ofctl add-flows br0 flows])
7309 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
7310 AT_CHECK([tail -1 stdout], [0],
7311   [Translation failed (Stack too deep), packet is dropped.
7312 ])
7313 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
7314 ])
7315 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
7316 AT_CLEANUP
7317
7318
7319 AT_SETUP([ofproto-dpif packet-out controller])
7320 OVS_VSWITCHD_START
7321 add_of_ports br0 1 2
7322
7323 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
7324
7325 AT_CAPTURE_FILE([ofctl_monitor.log])
7326 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
7327
7328 for i in 1 2 3; do
7329         AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
7330 done
7331
7332 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
7333 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7334 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
7335 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7336 dnl
7337 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
7338 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7339 dnl
7340 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
7341 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7342 ])
7343
7344 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
7345  dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
7346 NXST_FLOW reply:
7347 ])
7348
7349 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7350   table 0:
7351     active=1, lookup=0, matched=0
7352
7353   table 1:
7354     active=0, lookup=0, matched=0
7355 "
7356  for i in `seq 2 253`; do
7357      printf '  table %d: ditto\n' $i
7358  done) > expout
7359 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7360
7361 OVS_VSWITCHD_STOP
7362 AT_CLEANUP
7363
7364 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
7365 OVS_VSWITCHD_START(
7366   [-- \
7367    add-port br0 p1 -- \
7368    set interface p1 type=patch options:peer=p2 -- \
7369    add-br br1 -- \
7370    set bridge br1 datapath-type=dummy -- \
7371    set bridge br1 fail-mode=secure -- \
7372    set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
7373    add-port br1 p2 -- \
7374    set interface p2 type=patch options:peer=p1 --])
7375
7376 AT_CAPTURE_FILE([ofctl_monitor.log])
7377 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
7378
7379 for i in 1 2 3; do
7380         AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
7381 done
7382
7383 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
7384 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7385 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
7386 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7387 dnl
7388 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
7389 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7390 dnl
7391 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
7392 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7393 ])
7394
7395 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7396   table 0:
7397     active=0, lookup=0, matched=0
7398 "
7399  for i in `seq 1 253`; do
7400      printf '  table %d: ditto\n' $i
7401  done) > expout
7402 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7403
7404 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7405   table 0:
7406     active=0, lookup=3, matched=0
7407
7408   table 1:
7409     active=0, lookup=0, matched=0
7410 "
7411  for i in `seq 2 253`; do
7412      printf '  table %d: ditto\n' $i
7413  done) > expout
7414 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
7415
7416 OVS_VSWITCHD_STOP
7417 AT_CLEANUP
7418
7419
7420 AT_SETUP([ofproto-dpif packet-out goto_table])
7421 OVS_VSWITCHD_START
7422 add_of_ports br0 1 2
7423
7424 AT_DATA([flows.txt], [dnl
7425 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
7426 table=1 dl_dst=50:54:00:00:00:0a actions=controller
7427 ])
7428 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
7429
7430 AT_CAPTURE_FILE([ofctl_monitor.log])
7431 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
7432
7433 for i in 1 2 3; do
7434     ovs-appctl 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)'
7435 done
7436
7437 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
7438 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
7439 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7440 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
7441 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7442 dnl
7443 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
7444 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7445 dnl
7446 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
7447 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7448 ])
7449
7450 AT_CHECK([ovs-appctl revalidator/purge], [0])
7451 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
7452  n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=goto_table:1
7453  table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
7454 OFPST_FLOW reply (OF1.3):
7455 ])
7456
7457 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7458   table 0:
7459     active=1, lookup=3, matched=3
7460
7461   table 1: ditto
7462   table 2:
7463     active=0, lookup=0, matched=0
7464 "
7465  for i in `seq 3 253`; do
7466      printf '  table %d: ditto\n' $i
7467  done) > expout
7468 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7469
7470 OVS_VSWITCHD_STOP
7471 AT_CLEANUP
7472
7473
7474 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
7475 OVS_VSWITCHD_START
7476 add_of_ports br0 1 2
7477
7478 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
7479 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
7480
7481 AT_CAPTURE_FILE([ofctl_monitor.log])
7482 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
7483
7484 for i in 1 2 3; do
7485     ovs-appctl 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)'
7486 done
7487
7488 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
7489 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
7490 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7491 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
7492 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7493 dnl
7494 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
7495 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7496 dnl
7497 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
7498 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7499 ])
7500
7501 AT_CHECK([ovs-appctl revalidator/purge], [0])
7502 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
7503  table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
7504 OFPST_FLOW reply (OF1.1):
7505 ])
7506
7507 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7508   table 0:
7509     active=0, lookup=3, matched=0
7510
7511   table 1:
7512     active=1, lookup=3, matched=3
7513
7514   table 2:
7515     active=0, lookup=0, matched=0
7516 "
7517  for i in `seq 3 253`; do
7518      printf '  table %d: ditto\n' $i
7519  done) > expout
7520 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7521
7522 OVS_VSWITCHD_STOP
7523 AT_CLEANUP
7524
7525 AT_SETUP([ofproto-dpif - ICMPv6])
7526 OVS_VSWITCHD_START
7527 add_of_ports br0 1
7528
7529 AT_CAPTURE_FILE([ofctl_monitor.log])
7530
7531 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
7532
7533 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
7534
7535 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
7536
7537 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7538 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
7539 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
7540 ])
7541
7542 OVS_VSWITCHD_STOP
7543 AT_CLEANUP
7544
7545 AT_SETUP([ofproto-dpif - ICMPv6 type match])
7546 OVS_VSWITCHD_START
7547 add_of_ports br0 1 2 3
7548
7549 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
7550 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
7551
7552 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7553
7554 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)'])
7555 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)'])
7556 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)'])
7557 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)'])
7558
7559 AT_CHECK([ovs-appctl revalidator/purge], [0])
7560
7561 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7562 recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128), actions:2
7563 recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129), actions:3
7564 ])
7565
7566 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
7567  n_packets=2, n_bytes=124, icmp6,icmp_type=128 actions=output:2
7568  n_packets=2, n_bytes=124, icmp6,icmp_type=129 actions=output:3
7569 NXST_FLOW reply:
7570 ])
7571
7572 OVS_VSWITCHD_STOP
7573 AT_CLEANUP
7574
7575 AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
7576 OVS_VSWITCHD_START
7577 add_of_ports br0 1
7578 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])
7579
7580 AT_CAPTURE_FILE([ofctl_monitor.log])
7581
7582 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
7583
7584 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
7585
7586 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
7587
7588 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7589 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
7590 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
7591 ])
7592
7593 OVS_VSWITCHD_STOP
7594 AT_CLEANUP
7595
7596 # Tests the exact match of CFI bit in installed datapath flows matching VLAN.
7597 AT_SETUP([ofproto-dpif - vlan matching])
7598 OVS_VSWITCHD_START(
7599   [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
7600 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7601
7602 AT_CHECK([ovs-ofctl del-flows br0])
7603 AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
7604
7605 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))'])
7606
7607 OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
7608 AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
7609 recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=10),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
7610 ])
7611 OVS_VSWITCHD_STOP
7612 AT_CLEANUP
7613
7614 # Tests in place modification of installed datapath flows.
7615 AT_SETUP([ofproto-dpif - in place modification])
7616 OVS_VSWITCHD_START(
7617   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
7618 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7619
7620 AT_CHECK([ovs-ofctl del-flows br0])
7621 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
7622
7623 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
7624
7625 ovs-appctl time/stop
7626
7627 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)'])
7628
7629 # Wait for the flow setup to be done.
7630 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
7631
7632 for i in 1 2; do
7633     ovs-appctl 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)'
7634 done
7635
7636 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7637 recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:120, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
7638 ])
7639
7640 AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
7641
7642 ovs-appctl time/warp 500
7643 ovs-appctl time/warp 500
7644
7645 for i in 1 2 3; do
7646     ovs-appctl 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)'
7647 done
7648
7649 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7650 recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:300, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
7651 ])
7652
7653 AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
7654 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:push_vlan(vid=4,pcp=0),100
7655 ])
7656 OVS_VSWITCHD_STOP
7657 AT_CLEANUP
7658
7659 # Tests in place modification of installed datapath flows with vlans.
7660 AT_SETUP([ofproto-dpif - in place modification (vlan)])
7661 OVS_VSWITCHD_START(
7662   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
7663 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7664
7665 AT_CHECK([ovs-ofctl del-flows br0])
7666 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
7667
7668 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
7669
7670 ovs-appctl time/stop
7671
7672 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)'])
7673
7674 # Check that a correct datapath flow is created.
7675 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
7676
7677 for i in 1 2; do
7678     ovs-appctl 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)'
7679 done
7680
7681 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7682 recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:120, used:0.0s, actions:100
7683 ])
7684
7685 # Delete the flow.  Then check that the datapath flow is modified to
7686 # drop the packets.  A modified flow inherits the stats, a new
7687 # datapath flow would start from sero.
7688 AT_CHECK([ovs-ofctl del-flows br0])
7689
7690 ovs-appctl time/warp 500
7691 ovs-appctl time/warp 500
7692
7693 for i in 1 2 3; do
7694     ovs-appctl 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)'
7695 done
7696
7697 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7698 recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:300, used:0.0s, actions:drop
7699 ])
7700
7701 # Add a flow that matches the non-presence of a vlan tag, and check
7702 # that the datapath flow is modified accordingly.
7703 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
7704
7705 ovs-appctl time/warp 500
7706 ovs-appctl time/warp 500
7707
7708 for i in 1 2 3; do
7709     ovs-appctl 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)'
7710 done
7711
7712 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7713 recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:480, used:0.0s, actions:100
7714 ])
7715
7716 # Check that VLAN packets will not hit the same datapath megaflow.
7717
7718 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))'])
7719 OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
7720
7721 for i in 1 2; do
7722     ovs-appctl 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))'
7723 done
7724
7725 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7726 recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:480, used:0.0s, actions:100
7727 recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:120, used:0.0s, actions:drop
7728 ])
7729
7730 # Check that the new flow matches the CFI bit, while both vid and pcp
7731 # are wildcarded.
7732 AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
7733 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),eth_type(0x1234), actions:100
7734 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234)
7735 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:100
7736 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), actions:drop
7737 ])
7738 OVS_VSWITCHD_STOP
7739 AT_CLEANUP
7740
7741 AT_SETUP([ofproto-dpif - trace (unchanged)])
7742 OVS_VSWITCHD_START
7743 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
7744 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
7745 ])
7746 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
7747 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
7748 ])
7749 OVS_VSWITCHD_STOP
7750 AT_CLEANUP