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