]> git.proxmox.com Git - ovs.git/blob - tests/ofproto-dpif.at
tunnel: set udp dst-port in tunnel metadata
[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=38, 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=34, 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 # Check that parse failures after 'fields' parsing work
422 AT_CHECK([ovs-ofctl -O OpenFlow10 add-group br0 'group_id=1,type=select,fields(eth_dst),bukket=output:10'], [1], ,[dnl
423 ovs-ofctl: unknown keyword bukket
424 ])
425 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11'])
426 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
427
428 # Try a bunch of different flows and make sure that they get distributed
429 # at least somewhat.
430 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
431 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])
432 tail -1 stdout >> results
433 done
434 sort results | uniq -c
435 AT_CHECK([sort results | uniq], [0],
436 [Datapath actions: 10
437 Datapath actions: 11
438 ])
439
440 > results
441 # Try a bunch of different flows and make sure that they are not distributed
442 # as they only vary a field that is not hashed
443 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
444 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])
445 tail -1 stdout >> results
446 done
447 sort results | uniq -c
448 AT_CHECK([sort results | uniq | sed 's/1[[01]]/1?/'], [0],
449 [Datapath actions: 1?
450 ])
451
452 # Check that fields are rejected without "selection_method=hash".
453 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11'], 1, [], [dnl
454 ovs-ofctl: fields may only be specified with "selection_method=hash"
455 ])
456
457 # Check that selection_method_param without selection_method is rejected.
458 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method_param=1,bucket=output:10,bucket=output:11'], 1, [], [dnl
459 ovs-ofctl: selection_method_param is only allowed with "selection_method"
460 ])
461
462 OVS_VSWITCHD_STOP
463 AT_CLEANUP
464
465 AT_SETUP([ofproto-dpif - select group with dp_hash selection method])
466 OVS_VSWITCHD_START
467 add_of_ports br0 1 10 11
468 AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11'])
469 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip,nw_src=192.168.0.1 actions=group:1234'])
470
471 # Try a bunch of different flows and make sure that they get distributed
472 # at least somewhat.
473 for d in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
474 pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:01),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
475 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
476 done
477
478 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0x1)/dp_hash(0xXXXX\/0x1)/' | sed 's/packets.*actions:1/actions:1/' | strip_ufid | strip_used | sort], [0], [dnl
479 flow-dump from non-dpdk interfaces:
480 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:630, used:0.0s, actions:hash(hash_l4(0)),recirc(0x1)
481 recirc_id(0x1),dp_hash(0xXXXX/0x1),in_port(1),eth_type(0x0800),ipv4(frag=no), actions:10
482 recirc_id(0x1),dp_hash(0xXXXX/0x1),in_port(1),eth_type(0x0800),ipv4(frag=no), actions:11
483 ])
484
485 AT_CHECK([ovs-appctl revalidator/purge], [0])
486
487 # Try a bunch of different flows and make sure that they are not distributed
488 # as they only vary a field that is not hashed
489 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
490 pkt="in_port(1),eth(src=50:54:00:00:00:$d,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
491 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
492 done
493
494 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0x1)/dp_hash(0xXXXX\/0x1)/' | strip_ufid | strip_used | sort], [0], [dnl
495 flow-dump from non-dpdk interfaces:
496 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:630, used:0.0s, actions:hash(hash_l4(0)),recirc(0x2)
497 recirc_id(0x2),dp_hash(0xXXXX/0x1),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:630, used:0.0s, actions:11
498 ])
499
500 OVS_VSWITCHD_STOP
501 AT_CLEANUP
502
503 AT_SETUP([ofproto-dpif - fast failover group])
504 OVS_VSWITCHD_START
505 add_of_ports br0 1 10 11
506 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'])
507 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
508 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])
509 AT_CHECK([tail -1 stdout], [0],
510 [Datapath actions: drop
511 ])
512 OVS_VSWITCHD_STOP
513 AT_CLEANUP
514
515 AT_SETUP([ofproto-dpif - group stats single bucket])
516 OVS_VSWITCHD_START
517 add_of_ports br0 1 10 11
518 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
519 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
520 (
521 for i in `seq 0 2`;
522 do
523 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)"
524 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
525 done
526 )
527 AT_CHECK([ovs-appctl revalidator/purge], [0])
528 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
529 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
530 group_id=1234,ref_count=1,packet_count=3,byte_count=126,bucket0:packet_count=3,byte_count=126,bucket1:packet_count=0,byte_count=0
531 OFPST_GROUP reply (OF1.2):
532 ])
533 OVS_VSWITCHD_STOP
534 AT_CLEANUP
535
536 AT_SETUP([ofproto-dpif - group stats all buckets])
537 OVS_VSWITCHD_START
538 add_of_ports br0 1 10 11
539 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
540 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
541 (
542 for i in `seq 0 2`;
543 do
544 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)"
545 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
546 done
547 )
548 AT_CHECK([ovs-appctl revalidator/purge], [0])
549 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
550 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
551 group_id=1234,ref_count=1,packet_count=3,byte_count=126,bucket0:packet_count=3,byte_count=126,bucket1:packet_count=3,byte_count=126
552 OFPST_GROUP reply (OF1.2):
553 ])
554 OVS_VSWITCHD_STOP
555 AT_CLEANUP
556
557 AT_SETUP([ofproto-dpif - registers])
558 OVS_VSWITCHD_START
559 add_of_ports br0 20 21 22 33 90
560 AT_DATA([flows.txt], [dnl
561 in_port=90 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
562 in_port=91 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
563 in_port=92 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
564 in_port=93 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
565
566 in_port=2 actions=load:0x000db000->NXM_NX_REG0[[]]
567 in_port=3 actions=load:0xdea->NXM_NX_REG0[[20..31]]
568 in_port=4 actions=load:0xeef->NXM_NX_REG0[[0..11]]
569 in_port=5 actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
570 in_port=6 actions=load:0x22222222->NXM_NX_REG2[[]]
571 in_port=7 actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
572 in_port=8 actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
573 in_port=9,reg0=0xdeadbeef actions=output:20
574 in_port=10,reg1=0xdeadbeef actions=output:21
575 in_port=11,reg2=0xeef22dea actions=output:22
576
577 dnl Sanilty check all registers
578 in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
579 in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
580 in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
581 in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
582
583 ])
584 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
585 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])
586 AT_CHECK([tail -1 stdout], [0],
587 [Datapath actions: 20,21,22,33
588 ])
589 OVS_VSWITCHD_STOP
590 AT_CLEANUP
591
592 dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
593 dnl in the manner documented in ovs-ofctl(8).
594 AT_SETUP([ofproto-dpif - extended registers])
595 OVS_VSWITCHD_START
596 add_of_ports br0 1 2 3
597 AT_DATA([flows.txt], [dnl
598 table=0 actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
599 table=1,reg2=0xfedcba98,reg3=0x76543210 actions=2
600
601 # These low-priority rules shouldn't match. They're here only to make really
602 # sure that the test fails if either of the above rules fails to match.
603 table=0,priority=0 actions=3
604 table=1,priority=0 actions=3
605 ])
606 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
607 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])
608 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
609 ])
610 OVS_VSWITCHD_STOP
611 AT_CLEANUP
612
613 dnl Tests that the standardized xxregs are mapped onto the legacy OVS
614 dnl registers in the manner documented in ovs-ofctl(8).
615 AT_SETUP([ofproto-dpif - extended-extended registers])
616 OVS_VSWITCHD_START
617 add_of_ports br0 1 2 3
618 AT_DATA([flows.txt], [dnl
619 table=0 actions=load:0x0123456789abcdeffedcba9876543210->NXM_NX_XXREG1[[]],resubmit(,1)
620 table=1,reg4=0x01234567,reg5=0x89abcdef,reg6=0xfedcba98,reg7=0x76543210 actions=2
621
622 # These low-priority rules shouldn't match. They're here only to make really
623 # sure that the test fails if either of the above rules fails to match.
624 table=0,priority=0 actions=3
625 table=1,priority=0 actions=3
626 ])
627 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
628 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])
629 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
630 ])
631 OVS_VSWITCHD_STOP
632 AT_CLEANUP
633
634 AT_SETUP([ofproto-dpif - load and move order])
635 OVS_VSWITCHD_START
636 add_of_ports br0 1 10 11
637 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'])
638 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)'])
639 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])
640 AT_CHECK([tail -2 stdout], [0],
641 [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
642 Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
643 ])
644 OVS_VSWITCHD_STOP
645 AT_CLEANUP
646
647 dnl Tests that 1.5 copy-field can copy into the standardized xregs.
648 AT_SETUP([ofproto-dpif - copy-field into extended registers])
649 OVS_VSWITCHD_START
650 add_of_ports br0 1 2 3
651 AT_DATA([flows.txt], [dnl
652 table=0 actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
653 table=1,xreg0=0x0000505400000005 actions=2
654
655 # These low-priority rules shouldn't match. They're here only to make really
656 # sure that the test fails if either of the above rules fails to match.
657 table=0,priority=0 actions=3
658 table=1,priority=0 actions=3
659 ])
660 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
661 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])
662 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
663 ])
664 OVS_VSWITCHD_STOP
665 AT_CLEANUP
666
667 dnl Tests that 1.5 set-field with mask in the metadata register.
668 AT_SETUP([ofproto-dpif - masked set-field into metadata])
669 OVS_VSWITCHD_START
670 add_of_ports br0 1 2 3
671 AT_DATA([flows.txt], [dnl
672 table=0 actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
673 table=1 actions=set_field:0x6b/0xff->metadata,goto_table(2)
674 table=2,metadata=0xfafafafa5a5a5a6b actions=2
675
676 # These low-priority rules shouldn't match. They're here only to make really
677 # sure that the test fails if either of the above rules fails to match.
678 table=0,priority=0 actions=3
679 table=1,priority=0 actions=3
680 table=2,priority=0 actions=3
681 ])
682 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
683 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])
684 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
685 ])
686 OVS_VSWITCHD_STOP
687 AT_CLEANUP
688
689
690 AT_SETUP([ofproto-dpif - actset_output])
691 OVS_VSWITCHD_START
692 add_of_ports br0 1 2 3 4 5 6 7 8 9 10 11 12 13
693 AT_DATA([flows.txt], [dnl
694 table=0,actset_output=unset actions=write_actions(output(2)),goto_table(1)
695 table=1 actions=move:ONFOXM_ET_ACTSET_OUTPUT[[0..31]]->OXM_OF_PKT_REG0[[0..31]],goto_table(2)
696
697 # Verify that actset_output got set.
698 table=2,priority=20,actset_output=2 actions=4,goto_table(3)
699 table=2,priority=10 actions=5,goto_table(3)
700
701 # Verify that xreg0 got copied properly from actset_output.
702 table=3,priority=20,xreg0=2 actions=6,goto_table(4)
703 table=3,priority=10 actions=7,goto_table(4)
704
705 # Verify that xxreg0 got copied properly from actset_output.
706 table=3,priority=20,xxreg0=2 actions=6,goto_table(4)
707 table=3,priority=10 actions=7,goto_table(4)
708
709 # Verify that adding a group action unsets actset_output,
710 # even if output follows group.
711 table=4 actions=write_actions(group(5),output(10)),goto_table(5)
712 table=5,priority=20,actset_output=unset actions=8,goto_table(6)
713 table=5,priority=10 actions=9,goto_table(6)
714
715 # Verify that adding another output action doesn't change actset_output
716 # (since there's still a group).
717 table=6 actions=write_actions(output(3)),goto_table(7)
718 table=7,priority=20,actset_output=unset actions=10,goto_table(8)
719 table=7,priority=10 actions=11,goto_table(8)
720
721 # Verify that clearing the action set, then writing an output action,
722 # causes actset_output to be set again.
723 table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
724 table=9,priority=20,actset_output=2 actions=12
725 table=9,priority=10 actions=13
726 ])
727 AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=5,type=all,bucket=output:1'])
728 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
729 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])
730 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
731 ])
732 OVS_VSWITCHD_STOP
733 AT_CLEANUP
734 AT_SETUP([ofproto-dpif - push-pop])
735 OVS_VSWITCHD_START
736 add_of_ports br0 20 21 22 33 90
737 AT_DATA([flows.txt], [dnl
738 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
739 in_port=2 actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
740 in_port=3 actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
741 in_port=4 actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
742 in_port=5 actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
743
744 ])
745 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
746 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])
747 AT_CHECK([tail -1 stdout], [0],
748 [Datapath actions: 33,22,21,20
749 ])
750 OVS_VSWITCHD_STOP
751 AT_CLEANUP
752
753 AT_SETUP([ofproto-dpif - output])
754 OVS_VSWITCHD_START
755 add_of_ports br0 1 9 10 11 55 66 77 88
756 AT_DATA([flows.txt], [dnl
757 in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
758 in_port=2 actions=output:9
759 in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
760 in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
761 in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
762 in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
763 in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
764 in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
765 ])
766 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
767 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])
768 AT_CHECK([tail -1 stdout], [0],
769 [Datapath actions: 9,55,10,55,66,11,77,88,9,1
770 ])
771 OVS_VSWITCHD_STOP
772 AT_CLEANUP
773
774 AT_SETUP([ofproto-dpif - dec_ttl])
775 OVS_VSWITCHD_START
776 add_of_ports br0 1 2 3 4
777 AT_DATA([flows.txt], [dnl
778 table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
779 table=1 in_port=1 action=dec_ttl,output:3
780 ])
781 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
782 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])
783 AT_CHECK([tail -4 stdout], [0],
784 [Megaflow: recirc_id=0,ip,in_port=1,nw_ttl=2,nw_frag=no
785 Datapath actions: set(ipv4(ttl=1)),2,4
786 This flow is handled by the userspace slow path because it:
787 - Sends "packet-in" messages to the OpenFlow controller.
788 ])
789 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])
790 AT_CHECK([tail -2 stdout], [0],
791 [Megaflow: recirc_id=0,ip,in_port=1,nw_ttl=3,nw_frag=no
792 Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
793 ])
794 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])
795 AT_CHECK([tail -2 stdout], [0],
796 [Megaflow: recirc_id=0,ipv6,in_port=1,nw_ttl=128,nw_frag=no
797 Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
798 ])
799
800 AT_CAPTURE_FILE([ofctl_monitor.log])
801 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
802 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])
803 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
804 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
805 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
806 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
807 ])
808 OVS_VSWITCHD_STOP
809 AT_CLEANUP
810
811 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
812 dnl buffer to be resized just before pushing the id of the dec_ttl action.
813 dnl Thus the implementation must account for this by using the
814 dnl reallocated buffer rather than the original buffer.
815 dnl
816 dnl A number of similar rules are added to try and exercise
817 dnl xrealloc sufficiently that it returns a different base pointer
818 AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
819 OVS_VSWITCHD_START
820 add_of_ports br0 1
821 (for i in `seq 0 255`; do
822 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
823 done) > flows.txt
824 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
825 OVS_VSWITCHD_STOP
826 AT_CLEANUP
827
828 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
829 dnl buffer to be resized just before pushing the id of the dec_ttl action.
830 dnl Thus the implementation must account for this by using the
831 dnl reallocated buffer rather than the original buffer.
832 dnl
833 dnl A number of similar rules are added to try and exercise
834 dnl xrealloc sufficiently that it returns a different base pointer
835 AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
836 OVS_VSWITCHD_START
837 add_of_ports br0 1
838 (for i in `seq 0 255`; do
839 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
840 done) > flows.txt
841 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
842 OVS_VSWITCHD_STOP
843 AT_CLEANUP
844
845 dnl A note action at offset 24 in ofpacts will cause the ofpacts
846 dnl buffer to be resized just before pushing the id of the dec_ttl action.
847 dnl Thus the implementation must account for this by using the
848 dnl reallocated buffer rather than the original buffer.
849 dnl
850 dnl A number of similar rules are added to try and exercise
851 dnl xrealloc sufficiently that it returns a different base pointer
852 AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
853 OVS_VSWITCHD_START
854 add_of_ports br0 1
855 (for i in `seq 0 255`; do
856 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
857 done) > flows.txt
858 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
859 OVS_VSWITCHD_STOP
860 AT_CLEANUP
861
862 dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
863 dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
864 dnl Using `make check-valgrind' here checks for use-after-free in this
865 dnl codepath.
866 AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
867 OVS_VSWITCHD_START
868 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'])
869 OVS_VSWITCHD_STOP
870 AT_CLEANUP
871
872 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
873 OVS_VSWITCHD_START
874 add_of_ports br0 1 2
875
876 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
877
878 # "in_port" defaults to OFPP_NONE if it's not specified.
879 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"
880 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
881 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
882 1
883 2
884 100
885 ])
886
887 OVS_VSWITCHD_STOP
888 AT_CLEANUP
889
890 AT_SETUP([ofproto-dpif - DSCP])
891 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
892 add_of_ports br0 9
893 AT_DATA([flows.txt], [dnl
894 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
895 ])
896 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
897 AT_CHECK([ovs-vsctl -- \
898 set Port p1 qos=@newqos --\
899 --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
900 --id=@q1 create Queue dscp=1 --\
901 --id=@q2 create Queue dscp=2], [0], [ignore])
902 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])
903 AT_CHECK([tail -2 stdout], [0],
904 [Megaflow: recirc_id=0,skb_priority=0,ip,in_port=9,nw_tos=252,nw_frag=no
905 Datapath actions: dnl
906 100,dnl
907 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
908 set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
909 1,dnl
910 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
911 set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
912 set(ipv4(tos=0/0xfc)),1,100
913 ])
914 OVS_VSWITCHD_STOP
915 AT_CLEANUP
916
917 AT_SETUP([ofproto-dpif - output/flood flags])
918 OVS_VSWITCHD_START
919 add_of_ports br0 1 2 3 4 5 6 7
920
921 AT_DATA([flows.txt], [dnl
922 in_port=local actions=local,flood
923 in_port=1 actions=flood
924 in_port=2 actions=all
925 in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
926 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
927 ])
928 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
929 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
930 AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
931
932 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])
933 AT_CHECK([tail -1 stdout \
934 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
935 1
936 2
937 3
938 4
939 7
940 ])
941
942 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])
943 AT_CHECK([tail -1 stdout \
944 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
945 100
946 2
947 3
948 4
949 7
950 ])
951
952 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])
953 AT_CHECK([tail -1 stdout \
954 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
955 1
956 100
957 3
958 4
959 6
960 7
961 ])
962
963 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])
964 AT_CHECK([tail -1 stdout], [0],
965 [Datapath actions: 100,1,2,4,6,7
966 ])
967
968 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])
969 AT_CHECK([tail -1 stdout], [0],
970 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
971 ])
972 OVS_VSWITCHD_STOP
973 AT_CLEANUP
974
975 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
976 OVS_VSWITCHD_START([dnl
977 add-port br0 p1 -- set Interface p1 type=dummy
978 ])
979 on_exit 'kill `cat ovs-ofctl.pid`'
980
981 AT_CAPTURE_FILE([ofctl_monitor.log])
982
983 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
984
985 for i in 1 2 3 ; do
986 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)'
987 done
988 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
989 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
990 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
991 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
992 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:2e7e
993 dnl
994 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
995 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:2e7e
996 dnl
997 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
998 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:2e7e
999 ])
1000
1001 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1002 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1003 NXST_FLOW reply:
1004 ])
1005
1006 OVS_VSWITCHD_STOP
1007 AT_CLEANUP
1008
1009 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
1010 OVS_VSWITCHD_START([dnl
1011 add-port br0 p1 -- set Interface p1 type=dummy
1012 ])
1013 on_exit 'kill `cat ovs-ofctl.pid`'
1014
1015 AT_CAPTURE_FILE([ofctl_monitor.log])
1016 AT_CHECK([ovs-ofctl del-flows br0])
1017
1018 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1019
1020 dnl Test that missed packets are dropped
1021 for i in 1 2 3 ; do
1022 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)'
1023 done
1024 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1025
1026 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1027 ])
1028
1029 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1030 AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1031 OFPST_FLOW reply (OF1.3):
1032 ])
1033
1034 OVS_VSWITCHD_STOP
1035 AT_CLEANUP
1036
1037 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
1038 OVS_VSWITCHD_START([dnl
1039 add-port br0 p1 -- set Interface p1 type=dummy
1040 ])
1041 on_exit 'kill `cat ovs-ofctl.pid`'
1042
1043 AT_CAPTURE_FILE([ofctl_monitor.log])
1044 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1045
1046 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1047
1048 for i in 1 2 3 ; do
1049 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)'
1050 done
1051 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1052 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1053 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1054 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1055 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:2e5c
1056 dnl
1057 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1058 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:2e5c
1059 dnl
1060 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1061 tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:2e5c
1062 ])
1063
1064 AT_CHECK([ovs-appctl revalidator/purge], [0])
1065 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1066 n_packets=3, n_bytes=162, actions=goto_table:1
1067 OFPST_FLOW reply (OF1.2):
1068 ])
1069
1070 OVS_VSWITCHD_STOP
1071 AT_CLEANUP
1072
1073 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
1074 OVS_VSWITCHD_START([dnl
1075 add-port br0 p1 -- set Interface p1 type=dummy
1076 ])
1077 on_exit 'kill `cat ovs-ofctl.pid`'
1078
1079 AT_CAPTURE_FILE([ofctl_monitor.log])
1080 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1081
1082 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1083
1084 for i in 1 2 3 ; do
1085 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)'
1086 done
1087
1088 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1089 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1090 ])
1091
1092 AT_CHECK([ovs-appctl revalidator/purge], [0])
1093 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1094 n_packets=3, n_bytes=162, actions=resubmit(1,1)
1095 OFPST_FLOW reply (OF1.2):
1096 ])
1097
1098 OVS_VSWITCHD_STOP
1099 AT_CLEANUP
1100
1101 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1102 OVS_VSWITCHD_START([dnl
1103 add-port br0 p1 -- set Interface p1 type=dummy
1104 ])
1105 on_exit 'kill `cat ovs-ofctl.pid`'
1106
1107 AT_CAPTURE_FILE([ofctl_monitor.log])
1108 AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1109 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1110
1111 dnl Miss table 0, Hit table 1
1112 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1113
1114 for i in 1 2 3 ; do
1115 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)'
1116 done
1117 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1118 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1119
1120 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1121 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1122 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:2e70
1123 dnl
1124 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1125 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:2e70
1126 dnl
1127 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1128 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:2e70
1129 ])
1130
1131 dnl Hit table 0, Miss all other tables, sent to controller
1132 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1133
1134 for i in 1 2 3 ; do
1135 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)'
1136 done
1137 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1138 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1139
1140 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1141 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1142 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:2e70
1143 dnl
1144 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1145 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:2e70
1146 dnl
1147 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1148 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:2e70
1149 ])
1150
1151 AT_CHECK([ovs-appctl revalidator/purge], [0])
1152 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1153 table=1, n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1154 OFPST_FLOW reply (OF1.2):
1155 ])
1156
1157 OVS_VSWITCHD_STOP
1158 AT_CLEANUP
1159
1160 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1161 OVS_VSWITCHD_START([dnl
1162 add-port br0 p1 -- set Interface p1 type=dummy
1163 ])
1164 on_exit 'kill `cat ovs-ofctl.pid`'
1165
1166 AT_CAPTURE_FILE([ofctl_monitor.log])
1167 AT_DATA([flows.txt], [dnl
1168 table=0 actions=goto_table(1)
1169 table=2 dl_src=10:11:11:11:11:11 actions=controller
1170 ])
1171 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1172 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1173
1174 dnl Hit table 0, Miss table 1, Hit table 2
1175 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1176
1177 for i in 1 2 3 ; do
1178 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)'
1179 done
1180 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1181 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1182
1183 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1184 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1185 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:2e70
1186 dnl
1187 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1188 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:2e70
1189 dnl
1190 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1191 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:2e70
1192 ])
1193
1194 dnl Hit table 1, Miss all other tables, sent to controller
1195 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1196
1197 for i in 1 2 3 ; do
1198 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)'
1199 done
1200 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1201 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1202
1203 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1204 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1205 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:2e70
1206 dnl
1207 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1208 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:2e70
1209 dnl
1210 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1211 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:2e70
1212 ])
1213
1214 AT_CHECK([ovs-appctl revalidator/purge], [0])
1215 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1216 n_packets=6, n_bytes=324, actions=goto_table:1
1217 table=2, n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1218 OFPST_FLOW reply (OF1.2):
1219 ])
1220
1221 OVS_VSWITCHD_STOP
1222 AT_CLEANUP
1223
1224 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1225 OVS_VSWITCHD_START([dnl
1226 add-port br0 p1 -- set Interface p1 type=dummy
1227 ])
1228 on_exit 'kill `cat ovs-ofctl.pid`'
1229
1230 AT_CAPTURE_FILE([ofctl_monitor.log])
1231 AT_DATA([flows.txt], [dnl
1232 table=0 actions=resubmit(1,1)
1233 table=2 dl_src=10:11:11:11:11:11 actions=controller
1234 ])
1235 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1236 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1237
1238 dnl Hit table 0, Miss table 1, Dropped
1239 AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1240
1241 for i in 1 2 3 ; do
1242 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)'
1243 done
1244 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1245
1246 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1247 ])
1248
1249 dnl Hit table 1, Dropped
1250 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1251
1252 for i in 1 2 3 ; do
1253 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)'
1254 done
1255 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1256
1257 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1258 ])
1259
1260 AT_CHECK([ovs-appctl revalidator/purge], [0])
1261 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1262 n_packets=6, n_bytes=324, actions=resubmit(1,1)
1263 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1264 OFPST_FLOW reply (OF1.2):
1265 ])
1266
1267 OVS_VSWITCHD_STOP
1268 AT_CLEANUP
1269
1270 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1271 OVS_VSWITCHD_START([dnl
1272 add-port br0 p1 -- set Interface p1 type=dummy
1273 ])
1274 on_exit 'kill `cat ovs-ofctl.pid`'
1275
1276 AT_CAPTURE_FILE([ofctl_monitor.log])
1277 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1278
1279 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1280
1281 dnl Test that missed packets are dropped
1282 for i in 1 2 3 ; do
1283 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)'
1284 done
1285 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1286
1287 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1288 ])
1289
1290 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1291 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1292 NXST_FLOW reply:
1293 ])
1294
1295 OVS_VSWITCHD_STOP
1296 AT_CLEANUP
1297
1298 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1299 OVS_VSWITCHD_START([dnl
1300 add-port br0 p1 -- set Interface p1 type=dummy
1301 ])
1302 on_exit 'kill `cat ovs-ofctl.pid`'
1303
1304 AT_CAPTURE_FILE([ofctl_monitor.log])
1305 AT_CHECK([ovs-ofctl del-flows br0])
1306 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1307 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1308
1309 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1310
1311 dnl Test that missed packets are dropped
1312 for i in 1 2 3 ; do
1313 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)'
1314 done
1315 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1316
1317 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1318 ])
1319
1320 AT_CHECK([ovs-appctl revalidator/purge], [0])
1321 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1322 n_packets=3, n_bytes=162, actions=goto_table:1
1323 OFPST_FLOW reply (OF1.2):
1324 ])
1325
1326 OVS_VSWITCHD_STOP
1327 AT_CLEANUP
1328
1329 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1330 OVS_VSWITCHD_START([dnl
1331 add-port br0 p1 -- set Interface p1 type=dummy
1332 ])
1333 on_exit 'kill `cat ovs-ofctl.pid`'
1334
1335 AT_CAPTURE_FILE([ofctl_monitor.log])
1336 AT_CHECK([ovs-ofctl del-flows br0])
1337 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1338 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1339
1340 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1341
1342 dnl Test that missed packets are dropped
1343 for i in 1 2 3 ; do
1344 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)'
1345 done
1346 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1347
1348 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1349 ])
1350
1351 AT_CHECK([ovs-appctl revalidator/purge], [0])
1352 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1353 n_packets=3, n_bytes=162, actions=resubmit(1,1)
1354 OFPST_FLOW reply (OF1.2):
1355 ])
1356
1357 OVS_VSWITCHD_STOP
1358 AT_CLEANUP
1359
1360 AT_SETUP([ofproto-dpif - controller])
1361 OVS_VSWITCHD_START([dnl
1362 add-port br0 p1 -- set Interface p1 type=dummy
1363 ])
1364 on_exit 'kill `cat ovs-ofctl.pid`'
1365
1366 AT_CAPTURE_FILE([ofctl_monitor.log])
1367 AT_DATA([flows.txt], [dnl
1368 cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
1369 cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
1370 cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1371
1372 cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1373 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)
1374 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)
1375 cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1376 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)
1377 cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1378 cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
1379 cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
1380 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
1381 ])
1382 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1383
1384 dnl Flow miss.
1385 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1386
1387 for i in 1 2 3 ; do
1388 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)'
1389 done
1390 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1391 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1392
1393 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1394 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1395 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:2e70
1396 dnl
1397 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1398 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:2e70
1399 dnl
1400 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1401 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:2e70
1402 ])
1403
1404 dnl Singleton controller action.
1405 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1406
1407 for i in 1 2 3 ; do
1408 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)'
1409 done
1410 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1411 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1412
1413 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1414 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1415 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
1416 dnl
1417 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1418 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
1419 dnl
1420 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1421 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
1422 ])
1423
1424 dnl Modified controller action.
1425 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1426
1427 for i in 1 2 3 ; do
1428 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)'
1429 done
1430 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1431 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1432
1433 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1434 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1435 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:2e7e
1436 dnl
1437 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1438 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:2e7e
1439 dnl
1440 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1441 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:2e7e
1442 ])
1443
1444 dnl Modified VLAN controller action.
1445 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1446
1447 for i in 1 2 3; do
1448 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)'
1449 done
1450 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1451 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1452
1453 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1454 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1455 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
1456 dnl
1457 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1458 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
1459 dnl
1460 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1461 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
1462 ])
1463
1464 dnl Checksum TCP.
1465 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1466
1467 for i in 1 ; do
1468 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)'
1469 done
1470 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1471 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1472
1473 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1474 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1475 tcp,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
1476 dnl
1477 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=58 reg0=0x1,in_port=1 (via action) data_len=58 (unbuffered)
1478 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:2e7d
1479 dnl
1480 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=58 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=58 (unbuffered)
1481 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:2e7d
1482 dnl
1483 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=58 (unbuffered)
1484 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:2e7d
1485 dnl
1486 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=58 (unbuffered)
1487 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:4880
1488 dnl
1489 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1490 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:6082
1491 dnl
1492 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1493 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:6035
1494 dnl
1495 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1496 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:5fea
1497 dnl
1498 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=58 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=58 (unbuffered)
1499 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:5fea
1500 ])
1501
1502 dnl Checksum UDP.
1503 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1504
1505 for i in 1 ; do
1506 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'
1507 done
1508 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1509 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1510
1511 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1512 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1513 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
1514 dnl
1515 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
1516 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
1517 dnl
1518 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)
1519 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
1520 dnl
1521 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)
1522 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
1523 dnl
1524 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)
1525 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
1526 dnl
1527 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)
1528 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
1529 dnl
1530 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)
1531 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
1532 dnl
1533 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)
1534 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
1535 dnl
1536 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)
1537 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
1538 ])
1539
1540 dnl Modified ARP controller action.
1541 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1542
1543 for i in 1 2 3; do
1544 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)'
1545 done
1546
1547 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1548 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1549 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1550 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1551 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
1552 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1553 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
1554 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1555 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
1556 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1557 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
1558 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1559 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
1560 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1561 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
1562 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1563 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
1564 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1565 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
1566 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1567 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
1568 ])
1569
1570 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1571
1572 dnl Checksum SCTP.
1573 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1574
1575 for i in 1 ; do
1576 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'
1577 done
1578
1579 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1580 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1581 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1582 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1583 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
1584 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
1585 dnl
1586 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
1587 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
1588 dnl
1589 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)
1590 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
1591 dnl
1592 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)
1593 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
1594 dnl
1595 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)
1596 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
1597 dnl
1598 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)
1599 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
1600 dnl
1601 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)
1602 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
1603 dnl
1604 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)
1605 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
1606 dnl
1607 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)
1608 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
1609 ])
1610
1611 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1612 cookie=0x1, n_packets=3, n_bytes=212, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1613 cookie=0x2, n_packets=3, n_bytes=162, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1614 cookie=0x3, table=1, n_packets=3, n_bytes=212, in_port=80 actions=load:0x1->NXM_NX_REG0[[]],mod_vlan_vid:80,CONTROLLER:65535,resubmit(81,2)
1615 cookie=0x4, table=2, n_packets=3, n_bytes=212, in_port=81 actions=load:0x2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,CONTROLLER:65535,resubmit(82,3)
1616 cookie=0x5, table=3, n_packets=3, n_bytes=212, in_port=82 actions=load:0x3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,CONTROLLER:65535,resubmit(83,4)
1617 cookie=0x6, table=4, n_packets=3, n_bytes=212, in_port=83 actions=load:0x4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,CONTROLLER:65535,resubmit(84,5)
1618 cookie=0x7, table=5, n_packets=3, n_bytes=212, in_port=84 actions=load:0x5->NXM_NX_REG4[[]],load:0x6->NXM_NX_TUN_ID[[]],mod_nw_dst:84.84.84.84,CONTROLLER:65535,resubmit(85,6)
1619 cookie=0x8, table=6, n_packets=3, n_bytes=212, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1620 cookie=0x9, table=7, n_packets=3, n_bytes=212, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1621 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,CONTROLLER:65535
1622 cookie=0xd, n_packets=3, n_bytes=126, arp,dl_src=80:88:88:88:88:88 actions=load:0x2->NXM_OF_ARP_OP[[]],CONTROLLER:65535,load:0xc0a88001->NXM_OF_ARP_SPA[[]],CONTROLLER:65535,load:0x404444444441->NXM_NX_ARP_THA[[]],load:0x1010101->NXM_OF_ARP_SPA[[]],load:0x2020202->NXM_OF_ARP_TPA[[]],CONTROLLER:65535
1623 n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1624 NXST_FLOW reply:
1625 ])
1626
1627 OVS_VSWITCHD_STOP
1628 AT_CLEANUP
1629
1630 AT_SETUP([ofproto-dpif - MPLS handling])
1631 OVS_VSWITCHD_START([dnl
1632 add-port br0 p1 -- set Interface p1 type=dummy
1633 ])
1634 on_exit 'kill `cat ovs-ofctl.pid`'
1635
1636 AT_CAPTURE_FILE([ofctl_monitor.log])
1637 AT_DATA([flows.txt], [dnl
1638 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
1639 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
1640 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
1641 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
1642 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
1643 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
1644 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
1645 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
1646 cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
1647 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1648 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1649 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
1650
1651 cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1652 cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1653 cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1654 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
1655 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
1656 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
1657 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
1658
1659 cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1660 cookie=0xd table=1 arp actions=controller
1661
1662 cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1663 cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1664 cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1665 cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1666
1667 cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1668 cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1669 cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1670
1671 cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
1672 cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1673 cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1674
1675 cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1676 cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1677 cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1678
1679 cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1680 cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1681 cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1682
1683 cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1684 cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1685 cookie=0x5 dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
1686 ])
1687 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1688
1689 dnl Modified MPLS controller action.
1690 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1691
1692 for i in 1 2 3; do
1693 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)'
1694 done
1695 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1696 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1697
1698 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1699 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
1700 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
1701 dnl
1702 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
1703 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
1704 dnl
1705 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
1706 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
1707 ])
1708
1709 dnl Modified MPLS controller action.
1710 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1711
1712 for i in 1 2 3; do
1713 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)'
1714 done
1715 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1716 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1717
1718 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1719 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
1720 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
1721 dnl
1722 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
1723 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
1724 dnl
1725 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
1726 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
1727 ])
1728
1729 dnl Modified MPLS controller action.
1730 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1731
1732 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)
1733
1734 for i in 1 2 3; do
1735 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)'
1736 done
1737 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1738 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1739
1740 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1741 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1742 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
1743 dnl
1744 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1745 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
1746 dnl
1747 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1748 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
1749 ])
1750
1751 dnl Modified MPLS controller action.
1752 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1753
1754 for i in 1 2 3; do
1755 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))'
1756 done
1757 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1758 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1759
1760 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1761 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1762 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
1763 dnl
1764 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1765 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
1766 dnl
1767 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1768 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
1769 ])
1770
1771 dnl Modified MPLS controller action.
1772 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1773
1774 for i in 1 2 3; do
1775 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)'
1776 done
1777 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1778 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1779
1780 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1781 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1782 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
1783 dnl
1784 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1785 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
1786 dnl
1787 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1788 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
1789 ])
1790
1791 dnl Modified MPLS controller action.
1792 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1793
1794 for i in 1 2 3; do
1795 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)'
1796 done
1797 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1798 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1799
1800 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1801 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1802 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
1803 dnl
1804 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1805 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
1806 dnl
1807 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1808 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
1809 ])
1810
1811 dnl Modified MPLS controller action.
1812 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1813
1814 for i in 1 2 3; do
1815 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)'
1816 done
1817 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1818 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1819
1820 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1821 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1822 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
1823 dnl
1824 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1825 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
1826 dnl
1827 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1828 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
1829 ])
1830
1831 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1832
1833 dnl Modified MPLS controller action.
1834 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1835
1836 for i in 1 2 3; do
1837 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)'
1838 done
1839 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1840 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1841
1842 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1843 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1844 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
1845 dnl
1846 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1847 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
1848 dnl
1849 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1850 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
1851 ])
1852
1853 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1854
1855 dnl Modified MPLS controller action.
1856 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1857
1858 for i in 1 2 3; do
1859 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)'
1860 done
1861 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1862 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1863
1864 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1865 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1866 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
1867 dnl
1868 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1869 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
1870 dnl
1871 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1872 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
1873 ])
1874
1875 dnl Modified MPLS actions.
1876 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1877
1878 for i in 1 2 3; do
1879 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)'
1880 done
1881 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1882 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1883
1884 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1885 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
1886 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
1887 dnl
1888 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
1889 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
1890 dnl
1891 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
1892 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
1893 ])
1894
1895 dnl Modified MPLS ipv6 controller action.
1896 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1897
1898 for i in 1 2 3; do
1899 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)'
1900 done
1901 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1902 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1903
1904 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1905 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1906 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
1907 dnl
1908 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1909 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
1910 dnl
1911 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1912 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
1913 ])
1914
1915
1916 dnl Modified MPLS pop action.
1917 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
1918 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)
1919 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
1920
1921 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1922
1923 for i in 1 2 3; do
1924 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'
1925 done
1926 #for i in 2 3; do
1927 # 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)'
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([cat 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: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
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: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
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: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
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:01 > 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 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'
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: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
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: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
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: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
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:02 > 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 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'
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: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
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: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
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: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
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:03 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), 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 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'
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: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
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: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
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: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
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:04 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), 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 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'
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: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
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: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
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: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
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:05 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), 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 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'
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: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
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: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
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: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
2071 ])
2072
2073 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2074
2075 dnl Modified MPLS pop action.
2076 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2077 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)
2078 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2079 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2080 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2081
2082 for i in 1 2 3; do
2083 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'
2084 done
2085 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2086 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2087
2088 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2089 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2090 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
2091 dnl
2092 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2093 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
2094 dnl
2095 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2096 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
2097 ])
2098
2099 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2100
2101 dnl Modified MPLS pop action.
2102 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2103 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)
2104 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2105 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2106 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2107
2108 for i in 1 2 3; do
2109 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'
2110 done
2111 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2112 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2113
2114 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2115 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2116 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
2117 dnl
2118 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2119 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
2120 dnl
2121 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2122 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
2123 ])
2124
2125 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2126
2127 dnl Modified MPLS pop action.
2128 dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2129 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)
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 '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'
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): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2140 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
2141 dnl
2142 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2143 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
2144 dnl
2145 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2146 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
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:09 > 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 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'
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: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
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: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
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: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
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 a single MPLS label stack entry which tcpdump -vve shows as:
2179 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)
2180 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2181 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2182 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2183
2184 for i in 1 2 3; do
2185 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'
2186 done
2187 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2188 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2189
2190 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2191 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2192 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
2193 dnl
2194 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2195 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
2196 dnl
2197 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2198 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
2199 ])
2200
2201 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2202
2203 dnl Modified MPLS pop action.
2204 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2205 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)
2206 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2207 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2208 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2209
2210 for i in 1 2 3; do
2211 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'
2212 done
2213 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2214 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2215
2216 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2217 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2218 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
2219 dnl
2220 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2221 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
2222 dnl
2223 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2224 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
2225 ])
2226
2227 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2228
2229 dnl Modified MPLS pop action.
2230 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2231 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)
2232 dnl (label 20, exp 0, [S], ttl 31)
2233 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2234 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2235 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2236
2237 for i in 1 2 3; do
2238 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'
2239 done
2240 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2241 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2242
2243 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2244 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2245 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
2246 dnl
2247 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2248 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
2249 dnl
2250 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2251 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
2252 ])
2253
2254 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2255
2256 dnl Modified MPLS pop action.
2257 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2258 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)
2259 dnl (label 20, exp 0, [S], ttl 31)
2260 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2261 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2262 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2263
2264 for i in 1 2 3; do
2265 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'
2266 done
2267 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2268 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2269
2270 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2271 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2272 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
2273 dnl
2274 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2275 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
2276 dnl
2277 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2278 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
2279 ])
2280
2281 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2282
2283 dnl Modified MPLS pop action.
2284 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2285 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)
2286 dnl (label 20, exp 0, [S], ttl 31)
2287 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2288 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2289 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2290
2291 for i in 1 2 3; do
2292 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'
2293 done
2294 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2295 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2296
2297 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2298 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2299 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
2300 dnl
2301 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2302 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
2303 dnl
2304 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2305 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
2306 ])
2307
2308 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2309
2310 dnl Modified MPLS pop action.
2311 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2312 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)
2313 dnl (label 20, exp 0, [S], ttl 31)
2314 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2315 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2316 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2317
2318 for i in 1 2 3; do
2319 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'
2320 done
2321 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2322 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2323
2324 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2325 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2326 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
2327 dnl
2328 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2329 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
2330 dnl
2331 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2332 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
2333 ])
2334
2335 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2336
2337 dnl Modified MPLS pop action.
2338 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2339 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)
2340 dnl (label 20, exp 0, [S], ttl 31)
2341 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2342 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2343 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2344
2345 for i in 1 2 3; do
2346 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'
2347 done
2348
2349 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2350 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2351
2352 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2353 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2354 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
2355 dnl
2356 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2357 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
2358 dnl
2359 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2360 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
2361 ])
2362
2363 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2364
2365 dnl Modified MPLS pop action.
2366 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2367 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)
2368 dnl (label 20, exp 0, [S], ttl 31)
2369 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2370 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2371 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2372
2373 for i in 1 2 3; do
2374 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'
2375 done
2376 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2377 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2378
2379 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2380 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2381 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
2382 dnl
2383 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2384 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
2385 dnl
2386 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2387 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
2388 ])
2389
2390 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2391
2392 dnl Modified MPLS pop action.
2393 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2394 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)
2395 dnl (label 20, exp 0, ttl 31)
2396 dnl (label 20, exp 0, [S], ttl 30)
2397 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2398 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2399 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2400
2401 for i in 1 2 3; do
2402 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'
2403 done
2404 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2405 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2406
2407 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2408 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2409 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
2410 dnl
2411 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2412 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
2413 dnl
2414 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2415 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
2416 ])
2417
2418 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2419
2420 dnl Modified MPLS pop action.
2421 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2422 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)
2423 dnl (label 20, exp 0, ttl 31)
2424 dnl (label 20, exp 0, [S], ttl 30)
2425 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2426 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2427 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2428
2429 for i in 1 2 3; do
2430 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'
2431 done
2432 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2433 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2434
2435 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2436 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2437 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
2438 dnl
2439 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2440 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
2441 dnl
2442 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2443 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
2444 ])
2445
2446 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2447
2448 dnl Modified MPLS pop action.
2449 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2450 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)
2451 dnl (label 20, exp 0, ttl 31)
2452 dnl (label 20, exp 0, [S], ttl 30)
2453 dnl (tos 0x0, ttl 254, 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 0x7744 (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 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'
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([cat ofctl_monitor.log], [0], [dnl
2464 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2465 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
2466 dnl
2467 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2468 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
2469 dnl
2470 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2471 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
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:00 > 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 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'
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 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
2492 dnl
2493 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2494 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
2495 dnl
2496 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2497 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
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:04:01 > 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 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'
2511 done
2512 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2513 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2514
2515 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2516 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2517 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
2518 dnl
2519 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2520 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
2521 dnl
2522 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2523 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
2524 ])
2525
2526 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2527
2528 dnl Modified MPLS pop action.
2529 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2530 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)
2531 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2532 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2533 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2534
2535 for i in 1 2 3; do
2536 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'
2537 done
2538 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2539 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2540
2541 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2542 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2543 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
2544 dnl
2545 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2546 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
2547 dnl
2548 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2549 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
2550 ])
2551
2552 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2553
2554 dnl Modified MPLS pop action.
2555 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2556 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)
2557 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2558 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2559 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2560
2561 for i in 1 2 3; do
2562 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'
2563 done
2564
2565 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2566 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2567
2568 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2569 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2570 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
2571 dnl
2572 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2573 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
2574 dnl
2575 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2576 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
2577 ])
2578
2579 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2580
2581 dnl Modified MPLS pop action.
2582 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2583 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)
2584 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2585 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2586 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2587
2588 for i in 1 2 3; do
2589 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'
2590 done
2591 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2592 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2593
2594 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2595 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2596 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
2597 dnl
2598 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2599 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
2600 dnl
2601 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2602 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
2603 ])
2604
2605 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2606
2607 dnl Modified MPLS pop action.
2608 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2609 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)
2610 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2611 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2612 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2613
2614 for i in 1 2 3; do
2615 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'
2616 done
2617
2618 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2619 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2620
2621 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2622 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2623 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
2624 dnl
2625 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2626 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
2627 dnl
2628 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2629 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
2630 ])
2631
2632 AT_CHECK([ovs-appctl revalidator/purge], [0])
2633 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2634 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
2635 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
2636 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
2637 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:45 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,CONTROLLER:65535
2638 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:46 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),CONTROLLER:65535
2639 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:47 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,set_mpls_ttl(10),CONTROLLER:65535
2640 cookie=0xa, n_packets=3, n_bytes=102, dl_src=40:44:44:44:44:48 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),dec_mpls_ttl,CONTROLLER:65535
2641 cookie=0xa, n_packets=3, n_bytes=102, dl_src=41:44:44:44:44:42 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],pop_mpls:0x0800,CONTROLLER:65535
2642 cookie=0xa, n_packets=3, n_bytes=114, dl_src=40:44:44:44:44:44 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2643 cookie=0xa, n_packets=3, n_bytes=126, 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
2644 cookie=0xa, n_packets=3, n_bytes=54, dl_src=40:44:44:44:44:43 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2645 cookie=0xa, n_packets=3, n_bytes=54, mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
2646 cookie=0xb, n_packets=3, n_bytes=54, mpls,dl_src=50:55:55:55:55:55 actions=load:0x3e8->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
2647 cookie=0xc, n_packets=3, n_bytes=162, dl_src=70:77:77:77:77:77 actions=push_mpls:0x8848,load:0x3e8->OXM_OF_MPLS_LABEL[[]],load:0x7->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2648 cookie=0xd, n_packets=3, n_bytes=138, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
2649 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
2650 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
2651 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
2652 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
2653 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
2654 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
2655 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
2656 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
2657 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
2658 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
2659 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
2660 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2661 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
2662 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
2663 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
2664 cookie=0xd, table=1, n_packets=3, n_bytes=126, arp actions=CONTROLLER:65535
2665 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
2666 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
2667 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
2668 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
2669 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
2670 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
2671 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
2672 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
2673 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
2674 NXST_FLOW reply:
2675 ])
2676
2677 OVS_VSWITCHD_STOP
2678 AT_CLEANUP
2679
2680 AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2681 OVS_VSWITCHD_START([dnl
2682 add-port br0 p1 -- set Interface p1 type=dummy
2683 ])
2684 on_exit 'kill `cat ovs-ofctl.pid`'
2685
2686 AT_CAPTURE_FILE([ofctl_monitor.log])
2687 AT_DATA([flows.txt], [dnl
2688 table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2689 table=1 ip,ip_dscp=8 actions=controller
2690 ])
2691 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2692
2693
2694 dnl Modified MPLS pop action.
2695 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2696 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)
2697 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2698 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2699 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
2700
2701 for i in 1 2 3; do
2702 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'
2703 done
2704 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2705 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2706
2707 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2708 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2710 dnl
2711 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 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=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
2713 dnl
2714 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2715 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
2716 ])
2717
2718 AT_CHECK([ovs-appctl revalidator/purge], [0])
2719 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2720 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
2721 table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
2722 OFPST_FLOW reply (OF1.2):
2723 ])
2724
2725 OVS_VSWITCHD_STOP
2726 AT_CLEANUP
2727
2728 AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
2729 OVS_VSWITCHD_START([dnl
2730 add-port br0 p1 -- set Interface p1 type=dummy
2731 ])
2732 on_exit 'kill `cat ovs-ofctl.pid`'
2733
2734 dnl N.B: The first (and only) action that accesses L3 data after the
2735 dnl pop_mpls action is present in write_actions. This exercises recirculation
2736 dnl triggered in write_actions due to a previous action not in write actions.
2737 AT_CAPTURE_FILE([ofctl_monitor.log])
2738 AT_DATA([flows.txt], [dnl
2739 mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
2740 ])
2741 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2742
2743 dnl Modified MPLS pop action.
2744 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2745 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)
2746 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2747 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2748 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
2749
2750 for i in 1 2 3; do
2751 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'
2752 done
2753 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2754 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2755
2756 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2757 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2758 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
2759 dnl
2760 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2761 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
2762 dnl
2763 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2764 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
2765 ])
2766
2767 AT_CHECK([ovs-appctl revalidator/purge], [0])
2768 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2769 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
2770 OFPST_FLOW reply (OF1.2):
2771 ])
2772
2773 OVS_VSWITCHD_STOP
2774 AT_CLEANUP
2775
2776 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
2777 OVS_VSWITCHD_START([dnl
2778 add-port br0 p1 -- set Interface p1 type=dummy
2779 ])
2780 on_exit 'kill `cat ovs-ofctl.pid`'
2781
2782 AT_CAPTURE_FILE([ofctl_monitor.log])
2783 # A table-miss flow has priority 0 and no match
2784 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2785
2786 dnl Singleton controller action.
2787 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2788
2789 for i in 1 2 3 ; do
2790 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)'
2791 done
2792 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2793 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2794
2795 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2796 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
2797 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2798 dnl
2799 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
2800 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2801 dnl
2802 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
2803 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2804 ])
2805
2806 AT_CHECK([ovs-appctl revalidator/purge], [0])
2807 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2808 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
2809 NXST_FLOW reply:
2810 ])
2811
2812 OVS_VSWITCHD_STOP
2813 AT_CLEANUP
2814
2815
2816 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
2817 OVS_VSWITCHD_START([dnl
2818 add-port br0 p1 -- set Interface p1 type=dummy
2819 ])
2820 on_exit 'kill `cat ovs-ofctl.pid`'
2821
2822 AT_CAPTURE_FILE([ofctl_monitor.log])
2823 # A table-miss flow has priority 0 and no match
2824 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2825
2826 dnl Singleton controller action.
2827 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2828
2829 for i in 1 2 3 ; do
2830 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)'
2831 done
2832 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2833 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2834
2835 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2836
2837 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2838 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2839 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2840 dnl
2841 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2842 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2843 dnl
2844 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2845 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2846 ])
2847
2848 AT_CHECK([ovs-appctl revalidator/purge], [0])
2849 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2850 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
2851 OFPST_FLOW reply (OF1.3):
2852 ])
2853
2854 OVS_VSWITCHD_STOP
2855 AT_CLEANUP
2856
2857 AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
2858 OVS_VSWITCHD_START([dnl
2859 add-port br0 p1 -- set Interface p1 type=dummy
2860 ])
2861 on_exit 'kill `cat ovs-ofctl.pid`'
2862
2863 ovs-appctl time/stop
2864
2865 AT_CAPTURE_FILE([ofctl_monitor.log])
2866 # A table-miss flow has priority 0 and no match
2867 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2868
2869 dnl Singleton controller action.
2870 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2871
2872 # Become slave (OF 1.3), which should disable everything except port status.
2873 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2874
2875 # Ensure that ovs-vswitchd gets a chance to reply before sending another command.
2876 ovs-appctl time/warp 500 100
2877
2878 # Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
2879 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
2880
2881 ovs-appctl time/warp 500 100
2882 for i in 1 2 3 ; do
2883 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)'
2884 done
2885 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2886 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2887
2888 AT_CHECK([ovs-appctl revalidator/purge], [0])
2889 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2890 send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
2891 OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
2892 dnl
2893 send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
2894 master:
2895 PACKET_IN: (off)
2896 PORT_STATUS: (off)
2897 FLOW_REMOVED: (off)
2898 ROLE_STATUS: (off)
2899 TABLE_STATUS: (off)
2900 REQUESTFORWARD: (off)
2901
2902 slave:
2903 PACKET_IN: no_match
2904 PORT_STATUS: (off)
2905 FLOW_REMOVED: (off)
2906 ROLE_STATUS: (off)
2907 TABLE_STATUS: (off)
2908 REQUESTFORWARD: (off)
2909 dnl
2910 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2911 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2912 dnl
2913 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2914 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2915 dnl
2916 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2917 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2918 ])
2919
2920 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2921
2922 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2923 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
2924 OFPST_FLOW reply (OF1.3):
2925 ])
2926
2927 OVS_VSWITCHD_STOP
2928 AT_CLEANUP
2929
2930
2931 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
2932 OVS_VSWITCHD_START([dnl
2933 add-port br0 p1 -- set Interface p1 type=dummy
2934 ])
2935 on_exit 'kill `cat ovs-ofctl.pid`'
2936
2937 AT_CAPTURE_FILE([ofctl_monitor.log])
2938 # A table-miss flow has priority 0 and no match
2939 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2940
2941 dnl Singleton controller action.
2942 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2943
2944 for i in 1 2 3 ; do
2945 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)'
2946 done
2947 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2948 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2949
2950 AT_CHECK([ovs-appctl revalidator/purge], [0])
2951 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2952 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2953 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2954 dnl
2955 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2956 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2957 dnl
2958 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2959 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2960 ])
2961
2962 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2963
2964 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2965 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
2966 OFPST_FLOW reply (OF1.4):
2967 ])
2968
2969 OVS_VSWITCHD_STOP
2970 AT_CLEANUP
2971
2972
2973 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
2974 OVS_VSWITCHD_START([dnl
2975 add-port br0 p1 -- set Interface p1 type=dummy
2976 ])
2977 on_exit 'kill `cat ovs-ofctl.pid`'
2978
2979 AT_CAPTURE_FILE([ofctl_monitor.log])
2980 AT_DATA([flows.txt], [dnl
2981 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
2982 table=1 actions=output(CONTROLLER),goto_table(2)
2983 table=2 actions=group:1234
2984 ])
2985 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
2986 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
2987
2988 dnl Singleton controller action.
2989 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2990
2991 for i in 1 2 3 ; do
2992 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)'
2993 done
2994 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2995 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2996
2997 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2998
2999 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3000 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3001 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3002 dnl
3003 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3004 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3005 dnl
3006 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3007 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3008 dnl
3009 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3010 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3011 dnl
3012 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3013 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3014 dnl
3015 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3016 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3017 dnl
3018 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3019 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3020 dnl
3021 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3022 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3023 dnl
3024 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3025 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3026 ])
3027
3028 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3029
3030 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3031 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3032 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3033 table=2, n_packets=3, n_bytes=162, actions=group:1234
3034 OFPST_FLOW reply (OF1.3):
3035 ])
3036
3037 OVS_VSWITCHD_STOP
3038 AT_CLEANUP
3039
3040
3041 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3042 OVS_VSWITCHD_START([dnl
3043 add-port br0 p1 -- set Interface p1 type=dummy
3044 ])
3045 on_exit 'kill `cat ovs-ofctl.pid`'
3046
3047 AT_CAPTURE_FILE([ofctl_monitor.log])
3048 AT_DATA([flows.txt], [dnl
3049 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3050 table=1 actions=output(CONTROLLER),goto_table(2)
3051 table=2 actions=group:1234
3052 ])
3053 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3054 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3055
3056 dnl Singleton controller action.
3057 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3058
3059 for i in 1 2 3 ; do
3060 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)'
3061 done
3062 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3063 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3064
3065 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3066
3067 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3068 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3069 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3070 dnl
3071 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3072 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3073 dnl
3074 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3075 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3076 dnl
3077 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3078 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3079 dnl
3080 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3081 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3082 dnl
3083 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3084 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3085 dnl
3086 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3087 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3088 dnl
3089 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3090 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3091 dnl
3092 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3093 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3094 ])
3095
3096 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3097
3098 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3099 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3100 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3101 table=2, n_packets=3, n_bytes=162, actions=group:1234
3102 OFPST_FLOW reply (OF1.4):
3103 ])
3104
3105 OVS_VSWITCHD_STOP
3106 AT_CLEANUP
3107
3108
3109 AT_SETUP([ofproto-dpif - ARP modification slow-path])
3110 OVS_VSWITCHD_START
3111 add_of_ports br0 1 2
3112
3113 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3114 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'
3115
3116 # Input some packets that should follow the arp modification slow-path.
3117 for i in 1 2 3; do
3118 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)'
3119 done
3120 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3121
3122 # Check the packets that were output.
3123 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
3124 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
3125 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
3126 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
3127 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
3128 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
3129 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
3130 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
3131 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
3132 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
3133 ])
3134
3135 OVS_VSWITCHD_STOP
3136 AT_CLEANUP
3137
3138 AT_SETUP([ofproto-dpif - VLAN handling])
3139 OVS_VSWITCHD_START(
3140 [set Bridge br0 fail-mode=standalone -- \
3141 add-port br0 p1 trunks=10,12 -- \
3142 add-port br0 p2 tag=10 -- \
3143 add-port br0 p3 tag=12 \
3144 other-config:priority-tags=true -- \
3145 add-port br0 p4 tag=12 -- \
3146 add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
3147 add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
3148 add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
3149 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
3150 other-config:priority-tags=true -- \
3151 set Interface p1 type=dummy -- \
3152 set Interface p2 type=dummy -- \
3153 set Interface p3 type=dummy -- \
3154 set Interface p4 type=dummy -- \
3155 set Interface p5 type=dummy -- \
3156 set Interface p6 type=dummy -- \
3157 set Interface p7 type=dummy -- \
3158 set Interface p8 type=dummy --])
3159
3160 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3161 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
3162 dnl actions.
3163 for tuple in \
3164 "100 none 0 drop" \
3165 "100 0 0 drop" \
3166 "100 0 1 drop" \
3167 "100 10 0 1,5,6,7,8,pop_vlan,2" \
3168 "100 10 1 1,5,6,7,8,pop_vlan,2" \
3169 "100 11 0 5,7" \
3170 "100 11 1 5,7" \
3171 "100 12 0 1,5,6,pop_vlan,3,4,7,8" \
3172 "100 12 1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3173 "1 none 0 drop" \
3174 "1 0 0 drop" \
3175 "1 0 1 drop" \
3176 "1 10 0 5,6,7,8,100,pop_vlan,2" \
3177 "1 10 1 5,6,7,8,100,pop_vlan,2" \
3178 "1 11 0 drop" \
3179 "1 11 1 drop" \
3180 "1 12 0 5,6,100,pop_vlan,3,4,7,8" \
3181 "1 12 1 5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3182 "2 none 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3183 "2 0 0 pop_vlan,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3184 "2 0 1 pop_vlan,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
3185 "2 10 0 drop" \
3186 "2 10 1 drop" \
3187 "2 11 0 drop" \
3188 "2 11 1 drop" \
3189 "2 12 0 drop" \
3190 "2 12 1 drop" \
3191 "3 none 0 4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3192 "3 0 0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3193 "3 0 1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
3194 "3 10 0 drop" \
3195 "3 10 1 drop" \
3196 "3 11 0 drop" \
3197 "3 11 1 drop" \
3198 "3 12 0 drop" \
3199 "3 12 1 drop" \
3200 "4 none 0 3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3201 "4 0 0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3202 "4 0 1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
3203 "4 10 0 drop" \
3204 "4 10 1 drop" \
3205 "4 11 0 drop" \
3206 "4 11 1 drop" \
3207 "4 12 0 drop" \
3208 "4 12 1 drop" \
3209 "5 none 0 2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3210 "5 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3211 "5 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3212 "5 10 0 1,6,7,8,100,pop_vlan,2" \
3213 "5 10 1 1,6,7,8,100,pop_vlan,2" \
3214 "5 11 0 7,100" \
3215 "5 11 1 7,100" \
3216 "5 12 0 1,6,100,pop_vlan,3,4,7,8" \
3217 "5 12 1 1,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3218 "6 none 0 2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3219 "6 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3220 "6 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3221 "6 10 0 1,5,7,8,100,pop_vlan,2" \
3222 "6 10 1 1,5,7,8,100,pop_vlan,2" \
3223 "6 11 0 drop" \
3224 "6 11 1 drop" \
3225 "6 12 0 1,5,100,pop_vlan,3,4,7,8" \
3226 "6 12 1 1,5,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3227 "7 none 0 3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3228 "7 0 0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3229 "7 0 1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),1,5,6,100" \
3230 "7 10 0 1,5,6,8,100,pop_vlan,2" \
3231 "7 10 1 1,5,6,8,100,pop_vlan,2" \
3232 "7 11 0 5,100" \
3233 "7 11 1 5,100" \
3234 "7 12 0 1,5,6,100,pop_vlan,3,4,8" \
3235 "7 12 1 1,5,6,100,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
3236 "8 none 0 3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
3237 "8 0 0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
3238 "8 0 1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
3239 "8 10 0 1,5,6,7,100,pop_vlan,2" \
3240 "8 10 1 1,5,6,7,100,pop_vlan,2" \
3241 "8 11 0 drop" \
3242 "8 11 1 drop" \
3243 "8 12 0 1,5,6,100,pop_vlan,3,4,7" \
3244 "8 12 1 1,5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
3245 do
3246 set $tuple
3247 in_port=$1
3248 vlan=$2
3249 pcp=$3
3250 expected=$4
3251
3252 if test $vlan = none; then
3253 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
3254 else
3255 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))"
3256 fi
3257
3258 echo "----------------------------------------------------------------------"
3259 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3260
3261 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3262 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
3263
3264 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
3265 mv stdout expout
3266 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
3267 done
3268
3269 OVS_VSWITCHD_STOP
3270 AT_CLEANUP
3271
3272 AT_SETUP([ofproto-dpif - MPLS handling])
3273 OVS_VSWITCHD_START([dnl
3274 add-port br0 p1 -- set Interface p1 type=dummy
3275 ])
3276 on_exit 'kill `cat ovs-ofctl.pid`'
3277
3278 AT_CAPTURE_FILE([ofctl_monitor.log])
3279 AT_DATA([flows.txt], [dnl
3280 dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
3281 dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
3282 dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
3283 ])
3284 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3285
3286 dnl In this test, we push an MPLS tag to an ethernet packet.
3287 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3288
3289 for i in 1 2 3; do
3290 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)'
3291 done
3292 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3293 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3294
3295 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3296 OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3297 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
3298 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3299 00000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3300 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3301 00000030 00 00 50 00 00 00 2e 91-00 00
3302 dnl
3303 OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3304 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
3305 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3306 00000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3307 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3308 00000030 00 00 50 00 00 00 2e 91-00 00
3309 dnl
3310 OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3311 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
3312 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3313 00000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3314 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3315 00000030 00 00 50 00 00 00 2e 91-00 00
3316 ])
3317
3318 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3319 dnl copied exactly, except for the BOS bit.
3320 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3321
3322 for i in 1 2 3; do
3323 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)'
3324 done
3325 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3326 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3327
3328 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3329 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3330 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
3331 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3332 00000010 a0 40 00 00 a1 40
3333 dnl
3334 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3335 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
3336 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3337 00000010 a0 40 00 00 a1 40
3338 dnl
3339 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3340 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
3341 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3342 00000010 a0 40 00 00 a1 40
3343 ])
3344
3345 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3346 dnl copied exactly, except for the BOS bit. The ethertype should be updated
3347 dnl to the MPLS ethertype of the MPLS push action which differs to that
3348 dnl of the input packet.
3349 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3350
3351 for i in 1 2 3; do
3352 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)'
3353 done
3354 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3355 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3356
3357 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3358 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3359 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
3360 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3361 00000010 a0 40 00 00 a1 40
3362 dnl
3363 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3364 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
3365 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3366 00000010 a0 40 00 00 a1 40
3367 dnl
3368 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3369 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
3370 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3371 00000010 a0 40 00 00 a1 40
3372 ])
3373
3374 OVS_VSWITCHD_STOP
3375 AT_CLEANUP
3376
3377 AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3378 OVS_VSWITCHD_START([dnl
3379 add-port br0 p1 -- set Interface p1 type=dummy
3380 ])
3381 on_exit 'kill `cat ovs-ofctl.pid`'
3382
3383 AT_CAPTURE_FILE([ofctl_monitor.log])
3384 AT_DATA([flows.txt], [dnl
3385 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
3386 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
3387 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
3388 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
3389 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
3390 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
3391 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
3392 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
3393 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
3394 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
3395 ])
3396 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3397
3398 dnl Modified MPLS controller action.
3399 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3400 dnl both of these in the final flow
3401 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3402
3403 for i in 1 2 3; do
3404 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)'
3405 done
3406 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3407 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3408
3409 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3410 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3411 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
3412 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3413 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3414 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3415 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3416 dnl
3417 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3418 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
3419 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3420 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3421 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3422 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3423 dnl
3424 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3425 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
3426 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3427 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3428 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3429 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3430 ])
3431
3432 dnl Modified MPLS controller action.
3433 dnl In this test, the input packet is vlan-tagged, which should be stripped
3434 dnl before we push the MPLS and VLAN tags.
3435 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3436
3437 for i in 1 2 3; do
3438 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))'
3439 done
3440 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3441 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3442
3443 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3444 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3445 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
3446 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3447 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3448 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3449 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3450 dnl
3451 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3452 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
3453 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3454 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3455 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3456 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3457 dnl
3458 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3459 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
3460 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3461 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3462 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3463 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3464 ])
3465
3466 dnl Modified MPLS controller action.
3467 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3468 dnl both of these in the final flow
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: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)'
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=62 in_port=1 (via action) data_len=62 (unbuffered)
3479 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
3480 00000000 52 54 00 00 00 07 40 44-44 44 54 52 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 2e 91 00 00
3484 dnl
3485 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3486 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
3487 00000000 52 54 00 00 00 07 40 44-44 44 54 52 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 2e 91 00 00
3491 dnl
3492 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3493 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
3494 00000000 52 54 00 00 00 07 40 44-44 44 54 52 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 2e 91 00 00
3498 ])
3499
3500 dnl Modified MPLS controller action.
3501 dnl In this test, the input packet is vlan-tagged, which should be stripped
3502 dnl before we push the MPLS and VLAN tags.
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: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))'
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=62 in_port=1 (via action) data_len=62 (unbuffered)
3513 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
3514 00000000 50 54 00 00 00 07 40 44-44 44 54 53 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 2e 91 00 00
3518 dnl
3519 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3520 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
3521 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3522 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3523 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3524 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3525 dnl
3526 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3527 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
3528 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3529 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3530 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3531 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3532 ])
3533
3534 dnl Modified MPLS controller action.
3535 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3536 dnl actions are reordered, so we see both of these in the final flow.
3537 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3538
3539 for i in 1 2 3; do
3540 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)'
3541 done
3542 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3543 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3544
3545 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3546 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3547 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
3548 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3549 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3550 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3551 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3552 dnl
3553 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3554 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
3555 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3556 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3557 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3558 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3559 dnl
3560 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3561 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
3562 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3563 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3564 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3565 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3566 ])
3567
3568 dnl Modified MPLS controller action.
3569 dnl In this test, the input packet is vlan-tagged, which should be stripped
3570 dnl before we push the MPLS and VLAN tags.
3571 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3572
3573 for i in 1 2 3; do
3574 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))'
3575 done
3576 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3577 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3578
3579 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3580 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3581 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
3582 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3583 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3584 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3585 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3586 dnl
3587 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3588 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
3589 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3590 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3591 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3592 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3593 dnl
3594 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3595 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
3596 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3597 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3598 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3599 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3600 ])
3601
3602 dnl Modified MPLS controller action.
3603 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3604 dnl actions are reordered, so we see both of these in the final flow.
3605 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3606
3607 for i in 1 2 3; do
3608 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)'
3609 done
3610 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3611 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3612
3613 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3614 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3615 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
3616 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3617 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3618 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3619 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3620 dnl
3621 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3622 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
3623 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3624 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3625 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3626 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3627 dnl
3628 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3629 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
3630 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3631 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3632 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3633 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3634 ])
3635
3636 dnl Modified MPLS controller action.
3637 dnl In this test, the input packet is vlan-tagged, which should be stripped
3638 dnl before we push the MPLS and VLAN tags.
3639 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
3640
3641 for i in 1 2 3; do
3642 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))'
3643 done
3644 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3645 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3646
3647 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3648 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3649 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
3650 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3651 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3652 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3653 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3654 dnl
3655 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3656 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
3657 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3658 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3659 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3660 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3661 dnl
3662 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3663 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
3664 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3665 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3666 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3667 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3668 ])
3669
3670 dnl Modified MPLS controller action.
3671 dnl In this test, the input packet is vlan-tagged, which should be stripped
3672 dnl before we push the MPLS and VLAN tags.
3673 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3674
3675 for i in 1 2 3; do
3676 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))'
3677 done
3678 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3679 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3680
3681 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3682 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3683 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
3684 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3685 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3686 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3687 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3688 dnl
3689 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3690 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
3691 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3692 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3693 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3694 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3695 dnl
3696 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3697 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
3698 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3699 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3700 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3701 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3702 ])
3703
3704 dnl Modified MPLS controller action.
3705 dnl In this test, the input packet is vlan-tagged, which should be modified
3706 dnl before we push MPLS and VLAN tags.
3707 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3708
3709 for i in 1 2 3; do
3710 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))'
3711 done
3712 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3713 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3714
3715 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3716 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3717 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
3718 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3719 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3720 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3721 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3722 dnl
3723 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3724 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
3725 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3726 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3727 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3728 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3729 dnl
3730 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3731 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
3732 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3733 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3734 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3735 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3736 ])
3737
3738 AT_CHECK([ovs-appctl revalidator/purge], [0])
3739 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3740 cookie=0xa, n_packets=3, n_bytes=162, 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
3741 cookie=0xa, n_packets=3, n_bytes=162, 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
3742 cookie=0xa, n_packets=3, n_bytes=162, 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
3743 cookie=0xa, n_packets=3, n_bytes=162, 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
3744 cookie=0xa, n_packets=3, n_bytes=174, 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
3745 cookie=0xa, n_packets=3, n_bytes=174, 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
3746 cookie=0xa, n_packets=3, n_bytes=174, 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
3747 cookie=0xa, n_packets=3, n_bytes=174, 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
3748 cookie=0xa, n_packets=3, n_bytes=174, 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
3749 cookie=0xa, n_packets=3, n_bytes=174, 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
3750 OFPST_FLOW reply (OF1.2):
3751 ])
3752
3753 OVS_VSWITCHD_STOP
3754 AT_CLEANUP
3755
3756 AT_SETUP([ofproto-dpif - fragment handling - trace])
3757 OVS_VSWITCHD_START
3758 add_of_ports br0 1 2 3 4 5 6 90
3759 AT_DATA([flows.txt], [dnl
3760 priority=75 tcp ip_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
3761 priority=75 tcp ip_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
3762 priority=50 tcp ip_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
3763 priority=50 tcp ip_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
3764 priority=50 tcp ip_frag=later actions=output:6
3765 ])
3766 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3767
3768 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"
3769 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3770 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3771 later_flow="$base_flow,frag=later)"
3772
3773 # mode no first later
3774 for tuple in \
3775 'normal 1 5 6' \
3776 'drop 1 drop drop' \
3777 'nx-match 1 2 6'
3778 do
3779 set $tuple
3780 mode=$1
3781 no=$2
3782 first=$3
3783 later=$4
3784
3785 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3786 for type in no first later; do
3787 eval flow=\$${type}_flow exp_output=\$$type
3788 printf "\n%s\n" "----$mode $type-----"
3789 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3790 : > expout
3791 if test $mode = drop && test $type != no; then
3792 echo 'Packets dropped because they are IP fragments and the fragment handling mode is "drop".' >> expout
3793 echo "Datapath actions: $exp_output" >> expout
3794 elif test $type = later; then
3795 echo "Datapath actions: $exp_output" >> expout
3796 else
3797 echo "Datapath actions: set(tcp(src=80,dst=80)),$exp_output" >> expout
3798 fi
3799 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
3800 done
3801 done
3802 OVS_VSWITCHD_STOP
3803 AT_CLEANUP
3804
3805 AT_SETUP([ofproto-dpif - fragment handling - upcall])
3806 OVS_VSWITCHD_START
3807 add_of_ports br0 1 2 3 4 5 6 90
3808 AT_DATA([flows.txt], [dnl
3809 priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
3810 priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
3811 priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
3812 priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
3813 priority=50 tcp ip_frag=later actions=output:6
3814 ])
3815 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3816
3817 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"
3818 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3819 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3820 later_flow="$base_flow,frag=later)"
3821
3822 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3823
3824 mode=normal
3825
3826 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3827 for type in no first later; do
3828 eval flow=\$${type}_flow
3829 printf "\n%s\n" "----$mode $type-----"
3830
3831 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3832 done
3833
3834 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3835 flow-dump from non-dpdk interfaces:
3836 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
3837 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
3838 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3839 ])
3840
3841 mode=drop
3842
3843 AT_CHECK([ovs-appctl revalidator/purge], [0])
3844 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3845 for type in no first later; do
3846 eval flow=\$${type}_flow
3847 printf "\n%s\n" "----$mode $type-----"
3848
3849 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3850 done
3851
3852 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3853 flow-dump from non-dpdk interfaces:
3854 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
3855 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
3856 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
3857 ])
3858
3859 mode=nx-match
3860
3861 AT_CHECK([ovs-appctl revalidator/purge], [0])
3862 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3863 for type in no first later; do
3864 eval flow=\$${type}_flow
3865 printf "\n%s\n" "----$mode $type-----"
3866
3867 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3868 done
3869
3870 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3871 flow-dump from non-dpdk interfaces:
3872 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
3873 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
3874 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3875 ])
3876
3877 OVS_VSWITCHD_STOP
3878 AT_CLEANUP
3879
3880 AT_SETUP([ofproto-dpif - fragment handling - actions])
3881 OVS_VSWITCHD_START
3882 add_of_ports br0 1 2 3 4 5 6 90
3883
3884 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])
3885 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3886 source field tcp_dst lacks correct prerequisites
3887 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3888 ])
3889
3890 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])
3891 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3892 destination field tcp_src lacks correct prerequisites
3893 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3894 ])
3895
3896 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
3897 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3898 set_field udp_src lacks correct prerequisities
3899 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3900 ])
3901
3902 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
3903 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3904 set_field udp_dst lacks correct prerequisities
3905 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3906 ])
3907
3908 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
3909 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3910 set_field sctp_src lacks correct prerequisities
3911 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3912 ])
3913
3914 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
3915 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3916 set_field sctp_dst lacks correct prerequisities
3917 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3918 ])
3919
3920 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])
3921 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3922 source field tcp_dst lacks correct prerequisites
3923 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3924 ])
3925
3926 AT_DATA([flows.txt], [dnl
3927 priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
3928 ])
3929 AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
3930
3931 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3932
3933 mode=normal
3934
3935 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3936 for frag in 4000 6000 6008 4010; do
3937 printf "\n%s\n" "----$mode $frag-----"
3938
3939 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"])
3940 done
3941
3942 dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
3943 dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
3944 dnl OVS-2.5, the wildcards and set_field mask are shared internally.
3945 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3946 flow-dump from non-dpdk interfaces:
3947 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
3948 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
3949 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
3950 ])
3951
3952 AT_CHECK([ovs-appctl revalidator/purge], [0])
3953 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3954 for frag in 4000 6000 6008 4010; do
3955 printf "\n%s\n" "----$mode $frag truncated transport header -----"
3956
3957 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
3958 done
3959
3960 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3961 flow-dump from non-dpdk interfaces:
3962 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
3963 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
3964 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:38, used:0.001s, actions:1
3965 ])
3966
3967 AT_CHECK([ovs-appctl revalidator/purge], [0])
3968 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3969 for frag in 4000 6000 6001 4002; do
3970 printf "\n%s\n" "----$mode $frag missing transport header-----"
3971
3972 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
3973 done
3974
3975 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3976 flow-dump from non-dpdk interfaces:
3977 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
3978 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
3979 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:34, used:0.001s, actions:1
3980 ])
3981
3982 OVS_VSWITCHD_STOP
3983 AT_CLEANUP
3984
3985 AT_SETUP([ofproto-dpif - exit])
3986 OVS_VSWITCHD_START
3987 add_of_ports br0 1 2 3 10 11 12 13 14
3988 AT_DATA([flows.txt], [dnl
3989 in_port=1 actions=output:10,exit,output:11
3990 in_port=2 actions=output:12,resubmit:1,output:12
3991 in_port=3 actions=output:13,resubmit:2,output:14
3992 ])
3993 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3994 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])
3995 AT_CHECK([tail -1 stdout], [0],
3996 [Datapath actions: 10
3997 ])
3998 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])
3999 AT_CHECK([tail -1 stdout], [0],
4000 [Datapath actions: 12,10
4001 ])
4002 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])
4003 AT_CHECK([tail -1 stdout], [0],
4004 [Datapath actions: 13,12,10
4005 ])
4006 OVS_VSWITCHD_STOP
4007 AT_CLEANUP
4008
4009
4010 AT_SETUP([ofproto-dpif - mirroring, select_all])
4011 AT_KEYWORDS([mirror mirrors mirroring])
4012 OVS_VSWITCHD_START
4013 add_of_ports br0 1 2 3
4014 ovs-vsctl \
4015 set Bridge br0 mirrors=@m --\
4016 --id=@p3 get Port p3 --\
4017 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4018
4019 AT_DATA([flows.txt], [dnl
4020 in_port=1 actions=output:2
4021 in_port=2 actions=output:1
4022 ])
4023 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4024
4025 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)"
4026 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4027 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4028 [Datapath actions: 3,2
4029 ])
4030
4031 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)"
4032 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4033 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4034 [Datapath actions: 3,1
4035 ])
4036
4037 OVS_VSWITCHD_STOP
4038 AT_CLEANUP
4039
4040
4041 AT_SETUP([ofproto-dpif - mirroring, select_src])
4042 AT_KEYWORDS([mirror mirrors mirroring])
4043 OVS_VSWITCHD_START
4044 add_of_ports br0 1 2 3
4045 ovs-vsctl \
4046 set Bridge br0 mirrors=@m --\
4047 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4048 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
4049
4050 AT_DATA([flows.txt], [dnl
4051 in_port=1 actions=output:2
4052 in_port=2 actions=output:1
4053 ])
4054 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4055
4056 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)"
4057 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4058 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4059 [Datapath actions: 3,2
4060 ])
4061
4062 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)"
4063 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4064 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4065 [Datapath actions: 1
4066 ])
4067 OVS_VSWITCHD_STOP
4068 AT_CLEANUP
4069
4070 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
4071 AT_KEYWORDS([mirror mirrors mirroring])
4072 OVS_VSWITCHD_START
4073 add_of_ports br0 1 2
4074 ovs-vsctl \
4075 set Bridge br0 mirrors=@m --\
4076 --id=@p2 get Port p2 --\
4077 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
4078
4079 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4080
4081 # "in_port" defaults to OFPP_NONE if it's not specified.
4082 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"
4083 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4084 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4085 [Datapath actions: 1,2
4086 ])
4087
4088 OVS_VSWITCHD_STOP
4089 AT_CLEANUP
4090
4091
4092 AT_SETUP([ofproto-dpif - mirroring, select_dst])
4093 AT_KEYWORDS([mirror mirrors mirroring])
4094 OVS_VSWITCHD_START
4095 add_of_ports br0 1 2 3
4096 ovs-vsctl \
4097 set Bridge br0 mirrors=@m --\
4098 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4099 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
4100
4101 AT_DATA([flows.txt], [dnl
4102 in_port=1 actions=output:2
4103 in_port=2 actions=output:1
4104 ])
4105 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4106
4107 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)"
4108 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4109 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4110 [Datapath actions: 2,3
4111 ])
4112
4113 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)"
4114 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4115 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4116 [Datapath actions: 1
4117 ])
4118
4119 OVS_VSWITCHD_STOP
4120 AT_CLEANUP
4121
4122
4123 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
4124 AT_KEYWORDS([mirror mirrors mirroring])
4125 OVS_VSWITCHD_START
4126 add_of_ports br0 1 2 3
4127 ovs-vsctl \
4128 set Bridge br0 mirrors=@m --\
4129 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4130 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
4131
4132 AT_DATA([flows.txt], [dnl
4133 in_port=1, actions=output:2
4134 ])
4135 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4136
4137 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)"
4138 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4139 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4140 [Datapath actions: 2
4141 ])
4142
4143 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))"
4144 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4145 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4146 [Datapath actions: 2
4147 ])
4148
4149 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))"
4150 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4151 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4152 [Datapath actions: 3,2
4153 ])
4154
4155 OVS_VSWITCHD_STOP
4156 AT_CLEANUP
4157
4158
4159 AT_SETUP([ofproto-dpif - mirroring, output_port])
4160 AT_KEYWORDS([mirror mirrors mirroring])
4161 OVS_VSWITCHD_START
4162 add_of_ports br0 1 2 3
4163 ovs-vsctl \
4164 set Bridge br0 mirrors=@m --\
4165 --id=@p3 get Port p3 --\
4166 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4167
4168 AT_DATA([flows.txt], [dnl
4169 in_port=1 actions=mod_vlan_vid:17,output:2
4170 in_port=2 actions=output:1
4171 ])
4172 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4173
4174 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)"
4175 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4176 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4177 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
4178 ])
4179
4180 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)"
4181 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4182 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4183 [Datapath actions: 3,1
4184 ])
4185
4186 OVS_VSWITCHD_STOP
4187 AT_CLEANUP
4188
4189 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
4190 AT_KEYWORDS([mirror mirrors mirroring])
4191 OVS_VSWITCHD_START
4192 add_of_ports br0 1 2
4193 ovs-vsctl \
4194 set Bridge br0 mirrors=@m --\
4195 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
4196
4197 AT_DATA([flows.txt], [dnl
4198 in_port=1 actions=output:2
4199 in_port=2 actions=mod_vlan_vid:17,output:1
4200 ])
4201 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4202
4203 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)"
4204 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4205 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4206
4207 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
4208 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4209 mv stdout expout
4210 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4211
4212 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)"
4213 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4214 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4215
4216 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
4217 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4218 mv stdout expout
4219 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4220
4221 OVS_VSWITCHD_STOP
4222 AT_CLEANUP
4223
4224 # This verifies that we don't get duplicate mirroring when mirror_packet()
4225 # might be invoked recursively, as a check against regression.
4226 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
4227 AT_KEYWORDS([mirror mirrors mirroring])
4228 OVS_VSWITCHD_START
4229 add_of_ports br0 1 2 3
4230 ovs-vsctl \
4231 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4232 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
4233 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
4234 -- set Port br0 tag=0 \
4235 -- set Port p1 tag=0 \
4236 -- set Port p2 tag=500 \
4237 -- set Port p3 tag=501
4238
4239 flow='in_port=1'
4240 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4241 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4242 s/,/\
4243 /g' | sort], [0], [100
4244 2
4245 3
4246 ])
4247
4248 OVS_VSWITCHD_STOP
4249 AT_CLEANUP
4250
4251 # This test verifies that mirror state is preserved across recirculation.
4252 #
4253 # Otherwise, post-recirculation the ingress and the output to port 4
4254 # would cause the packet to be mirrored to port 3 a second time.
4255 AT_SETUP([ofproto-dpif - mirroring with recirculation])
4256 AT_KEYWORDS([mirror mirrors mirroring])
4257 OVS_VSWITCHD_START
4258 add_of_ports br0 1 2 3 4
4259 ovs-vsctl \
4260 set Bridge br0 mirrors=@m --\
4261 --id=@p3 get Port p3 --\
4262 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4263
4264 AT_DATA([flows.txt], [dnl
4265 in_port=1 actions=2,debug_recirc,4
4266 ])
4267 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4268
4269 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)"
4270 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4271 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4272 ])
4273 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4274 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4275 ])
4276
4277 OVS_VSWITCHD_STOP
4278 AT_CLEANUP
4279
4280 # Tests below verify the snaplen support for mirroring
4281 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen])
4282 AT_KEYWORDS([mirror mirrors mirroring])
4283 OVS_VSWITCHD_START
4284 add_of_ports br0 1 2 3
4285 ovs-vsctl \
4286 set Bridge br0 mirrors=@m --\
4287 --id=@p3 get Port p3 --\
4288 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4289
4290 AT_DATA([flows.txt], [dnl
4291 in_port=1 actions=output:2
4292 in_port=2 actions=output:1
4293 ])
4294 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4295
4296 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)"
4297 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4298 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4299 [Datapath actions: trunc(100),3,2
4300 ])
4301
4302 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)"
4303 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4304 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4305 [Datapath actions: trunc(100),3,1
4306 ])
4307
4308 OVS_VSWITCHD_STOP
4309 AT_CLEANUP
4310
4311 AT_SETUP([ofproto-dpif - mirroring, select_src with snaplen])
4312 AT_KEYWORDS([mirror mirrors mirroring])
4313 OVS_VSWITCHD_START
4314 add_of_ports br0 1 2 3
4315 ovs-vsctl \
4316 set Bridge br0 mirrors=@m --\
4317 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4318 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3 snaplen=100
4319
4320 AT_DATA([flows.txt], [dnl
4321 in_port=1 actions=output:2
4322 in_port=2 actions=output:1
4323 ])
4324 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4325
4326 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)"
4327 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4328 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4329 [Datapath actions: trunc(100),3,2
4330 ])
4331
4332 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)"
4333 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4334 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4335 [Datapath actions: 1
4336 ])
4337 OVS_VSWITCHD_STOP
4338 AT_CLEANUP
4339
4340 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port with snaplen])
4341 AT_KEYWORDS([mirror mirrors mirroring])
4342 OVS_VSWITCHD_START
4343 add_of_ports br0 1 2
4344 ovs-vsctl \
4345 set Bridge br0 mirrors=@m --\
4346 --id=@p2 get Port p2 --\
4347 --id=@m create Mirror name=mymirror select_all=true output_port=@p2 snaplen=100
4348
4349 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4350
4351 # "in_port" defaults to OFPP_NONE if it's not specified.
4352 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"
4353 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4354 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4355 [Datapath actions: 1,trunc(100),2
4356 ])
4357
4358 OVS_VSWITCHD_STOP
4359 AT_CLEANUP
4360
4361 AT_SETUP([ofproto-dpif - mirroring, select_dst with snaplen])
4362 AT_KEYWORDS([mirror mirrors mirroring])
4363 OVS_VSWITCHD_START
4364 add_of_ports br0 1 2 3
4365 ovs-vsctl \
4366 set Bridge br0 mirrors=@m --\
4367 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4368 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3 snaplen=100
4369
4370 AT_DATA([flows.txt], [dnl
4371 in_port=1 actions=output:2
4372 in_port=2 actions=output:1
4373 ])
4374 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4375
4376 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)"
4377 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4378 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4379 [Datapath actions: 2,trunc(100),3
4380 ])
4381
4382 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)"
4383 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4384 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4385 [Datapath actions: 1
4386 ])
4387
4388 OVS_VSWITCHD_STOP
4389 AT_CLEANUP
4390
4391 AT_SETUP([ofproto-dpif - mirroring, select_vlan with snaplen])
4392 AT_KEYWORDS([mirror mirrors mirroring])
4393 OVS_VSWITCHD_START
4394 add_of_ports br0 1 2 3
4395 ovs-vsctl \
4396 set Bridge br0 mirrors=@m --\
4397 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4398 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3 snaplen=100
4399
4400 AT_DATA([flows.txt], [dnl
4401 in_port=1, actions=output:2
4402 ])
4403 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4404
4405 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)"
4406 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4407 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4408 [Datapath actions: 2
4409 ])
4410
4411 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))"
4412 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4413 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4414 [Datapath actions: 2
4415 ])
4416
4417 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))"
4418 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4419 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4420 [Datapath actions: trunc(100),3,2
4421 ])
4422
4423 OVS_VSWITCHD_STOP
4424 AT_CLEANUP
4425
4426 AT_SETUP([ofproto-dpif - mirroring, output_port with snaplen])
4427 AT_KEYWORDS([mirror mirrors mirroring])
4428 OVS_VSWITCHD_START
4429 add_of_ports br0 1 2 3
4430 ovs-vsctl \
4431 set Bridge br0 mirrors=@m --\
4432 --id=@p3 get Port p3 --\
4433 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4434
4435 AT_DATA([flows.txt], [dnl
4436 in_port=1 actions=mod_vlan_vid:17,output:2
4437 in_port=2 actions=output:1
4438 ])
4439 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4440
4441 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)"
4442 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4443 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4444 [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2
4445 ])
4446
4447 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)"
4448 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4449 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4450 [Datapath actions: trunc(100),3,1
4451 ])
4452
4453 OVS_VSWITCHD_STOP
4454 AT_CLEANUP
4455
4456 AT_SETUP([ofproto-dpif - mirroring, output_vlan with snaplen])
4457 AT_KEYWORDS([mirror mirrors mirroring])
4458 OVS_VSWITCHD_START
4459 add_of_ports br0 1 2
4460 ovs-vsctl \
4461 set Bridge br0 mirrors=@m --\
4462 --id=@m create Mirror name=mymirror select_all=true output_vlan=12 snaplen=100
4463
4464 AT_DATA([flows.txt], [dnl
4465 in_port=1 actions=output:2
4466 in_port=2 actions=mod_vlan_vid:17,output:1
4467 ])
4468 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4469
4470 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)"
4471 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4472 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4473 dnl Expect: "trunc(100),100,trunc(100),2,trunc(100),1", with different order
4474 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])
4475
4476 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)"
4477 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4478 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4479 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])
4480
4481 OVS_VSWITCHD_STOP
4482 AT_CLEANUP
4483
4484 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors with snaplen])
4485 AT_KEYWORDS([mirror mirrors mirroring])
4486 OVS_VSWITCHD_START
4487 add_of_ports br0 1 2 3
4488 ovs-vsctl \
4489 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4490 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 snaplen=200 \
4491 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 snaplen=300 \
4492 -- set Port br0 tag=0 \
4493 -- set Port p1 tag=0 \
4494 -- set Port p2 tag=500 \
4495 -- set Port p3 tag=501
4496
4497 flow="in_port=1"
4498 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4499 AT_CHECK([tail -1 stdout | egrep "trunc\(200\),2,trunc\(300\),3,100|trunc\(300\),3,trunc\(200\),2,100"], [0], [stdout])
4500
4501 OVS_VSWITCHD_STOP
4502 AT_CLEANUP
4503
4504 # This test verifies that the table ID is preserved across recirculation
4505 # when a resubmit action requires it (because the action is relative to
4506 # the current table rather than specifying a table).
4507 AT_SETUP([ofproto-dpif - resubmit with recirculation])
4508 OVS_VSWITCHD_START
4509 add_of_ports br0 1 2 3
4510
4511 AT_DATA([flows.txt], [dnl
4512 table=0 in_port=1 actions=2,resubmit(,1)
4513 table=1 in_port=1 actions=debug_recirc,resubmit:55
4514 table=1 in_port=55 actions=3
4515 ])
4516 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4517
4518 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)"
4519 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4520 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
4521 ])
4522 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4523 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
4524 ])
4525
4526 OVS_VSWITCHD_STOP
4527 AT_CLEANUP
4528
4529 # This test verifies that "resubmit", when it triggers recirculation
4530 # indirectly through the flow that it recursively invokes, is not
4531 # re-executed when execution continues later post-recirculation.
4532 AT_SETUP([ofproto-dpif - recirculation after resubmit])
4533 OVS_VSWITCHD_START
4534 add_of_ports br0 1 2
4535
4536 AT_DATA([flows.txt], [dnl
4537 table=0 in_port=1 actions=resubmit(,1),2
4538 table=1 in_port=1 actions=debug_recirc
4539 ])
4540 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4541
4542 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)"
4543 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4544 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
4545 ])
4546 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4547 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
4548 ])
4549
4550 OVS_VSWITCHD_STOP
4551 AT_CLEANUP
4552
4553 dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
4554 dnl
4555 dnl Checks the implementation of the continuation mechanism that allows the
4556 dnl packet processing pipeline to be paused and resumed. Starts by creating
4557 dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
4558 dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
4559 dnl in the bridge, resuming each time the pipeline pauses, and expects a single
4560 dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
4561 dnl ACTIONS0 still contains at least one "pause" action, removes one of them
4562 dnl and repeats the process.
4563 dnl
4564 dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
4565 dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
4566 dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
4567 dnl into port 1 on br0, so br1 only comes into action if a patch port (added
4568 dnl by EXTRA_SETUP) jumps from one bridge to another.
4569 dnl
4570 dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
4571 dnl both bridges, e.g. to configure mirrors or patch ports.
4572 m4_define([CHECK_CONTINUATION], [dnl
4573 AT_SETUP([ofproto-dpif - continuation - $1])
4574 AT_KEYWORDS([continuations pause resume])
4575 OVS_VSWITCHD_START
4576
4577 # count_matches STRING
4578 #
4579 # Prints on stdout the number of occurrences of STRING in stdin.
4580 count_matches () {
4581 sed -n ":start
4582 s/$[1]//p
4583 t start" | wc -l
4584 }
4585
4586 add_of_ports --pcap br0 `seq 1 $2`
4587 m4_if([$3], [0], [],
4588 [add_of_br 1
4589 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
4590
4591 AT_CAPTURE_FILE([ofctl_monitor0.log])
4592 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
4593 m4_if([$3], [0], [],
4594 [AT_CAPTURE_FILE([ofctl_monitor1.log])
4595 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
4596
4597 actions0='$4'
4598 actions1='$5'
4599 $6
4600 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)"
4601 n_packets=0
4602 n_resumes=0
4603 while true; do
4604 printf "\n\nactions for br0:\n%s\n" "$actions0"
4605 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
4606
4607 # Add flows.
4608 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
4609 m4_if([$3], [0], [],
4610 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
4611
4612 # Make sure the datapath is up-to-date before sending the packet.
4613 ovs-appctl revalidator/wait
4614
4615 # Run a packet through the switch.
4616 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
4617
4618 # Wait for the expected number of packets to show up.
4619 n_packets=`expr $n_packets + $2 - 1 + $3`
4620 echo "waiting for $n_packets packets..."
4621 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
4622
4623 # Wait for the expected number of NXT_RESUMEs to be logged.
4624 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
4625 echo "waiting for $n_resumes NXT_RESUMEs..."
4626 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
4627
4628 # Eliminate one "pause" from the actions.
4629 #
4630 # If there were none left, then we're done.
4631 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
4632 if test X"$actions0" = X"$next_actions0"; then
4633 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
4634 if test X"$actions1" = X"$next_actions1"; then
4635 break
4636 else
4637 actions1=$next_actions1
4638 fi
4639 else
4640 actions0=$next_actions0
4641 fi
4642
4643 # Delete all the flows and verify that there are none, so that we
4644 # can be sure that our updated flow tables is actually in use
4645 # later.
4646 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
4647 [NXST_FLOW reply:
4648 ])
4649 m4_if([$3], [0], [],
4650 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
4651 [NXST_FLOW reply:
4652 ])])
4653 done
4654 OVS_VSWITCHD_STOP
4655 AT_CLEANUP
4656 ])
4657
4658 # Check that pause at the end of the pipeline works OK.
4659 #
4660 # (xlate_continuation() has a special case for no-op actions; this
4661 # fails without that special case.)
4662 CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
4663
4664 # Check that remaining actions are preserved following resume.
4665 CHECK_CONTINUATION([actions], [7], [0],
4666 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
4667
4668 # Check that multiple levels of resubmit continue following resume.
4669 #
4670 # The "resubmit:55", which is relative to the current table, is
4671 # particularly interesting because it checks that the notion of the
4672 # current table is correctly preserved.
4673 CHECK_CONTINUATION([resubmit], [10], [0],
4674 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
4675 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
4676 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
4677 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
4678 table=3 in_port=55 actions=pause 6 pause])
4679
4680 # Check that the action set is preserved across pause/resume.
4681 CHECK_CONTINUATION([action set], [3], [0],
4682 [in_port=1 actions=1 pause resubmit(,1) pause 2
4683 table=1 actions=write_actions(3)])
4684
4685 # Check that metadata and the stack used by push and pop is preserved
4686 # across pause/resume.
4687 CHECK_CONTINUATION([data stack], [3], [0],
4688 [in_port=1 actions=pause dnl
4689 set_field:1->reg0 dnl
4690 pause dnl
4691 set_field:2->reg1 dnl
4692 pause dnl
4693 output:NXM_NX_REG0[[]] dnl
4694 pause dnl
4695 push:NXM_NX_REG1[[]] dnl
4696 dnl
4697 pop:NXM_NX_REG2[[]] dnl
4698 pause dnl
4699 output:NXM_NX_REG2[[]] dnl
4700 pause dnl
4701 3])
4702
4703 # Check that mirror output occurs once and once only, even if
4704 # separated by pause/resume.
4705 CHECK_CONTINUATION([mirroring], [5], [0],
4706 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
4707 [ovs-vsctl \
4708 set Bridge br0 mirrors=@m --\
4709 --id=@p2 get Port p2 --\
4710 --id=@p3 get Port p3 --\
4711 --id=@p4 get Port p4 --\
4712 --id=@p5 get Port p5 --\
4713 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
4714
4715 # Check that pause works in the presence of patch ports.
4716 CHECK_CONTINUATION([patch ports], [4], [1],
4717 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
4718 table=1 in_port=1 actions=pause 3 pause 10 pause],
4719 [table=0 in_port=11 actions=pause 5 pause],
4720 [ovs-vsctl \
4721 -- add-port br0 patch10 \
4722 -- set interface patch10 type=patch options:peer=patch11 \
4723 ofport_request=10 \
4724 -- add-port br1 patch11 \
4725 -- set interface patch11 type=patch options:peer=patch10 \
4726 ofport_request=11])
4727
4728 # Two testcases below are for the ofproto/trace command
4729 # The first one tests all correct syntax:
4730 # ofproto/trace [dp_name] odp_flow [-generate|packet]
4731 # ofproto/trace br_name br_flow [-generate|packet]
4732 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
4733 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
4734 add_of_ports br0 1 2 3
4735
4736 AT_DATA([flows.txt], [dnl
4737 in_port=1 actions=output:2
4738 in_port=2 actions=output:1
4739 ])
4740 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4741
4742 odp_flow="in_port(p1)"
4743 br_flow="in_port=1"
4744 # Test command: ofproto/trace odp_flow with in_port as a name.
4745 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4746 AT_CHECK([tail -1 stdout], [0], [dnl
4747 Datapath actions: 2
4748 ])
4749
4750 odp_flow="in_port(1)"
4751 # Test command: ofproto/trace odp_flow
4752 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4753 AT_CHECK([tail -1 stdout], [0], [dnl
4754 Datapath actions: 2
4755 ])
4756
4757 # Test command: ofproto/trace dp_name odp_flow
4758 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
4759 AT_CHECK([tail -1 stdout], [0], [dnl
4760 Datapath actions: 2
4761 ])
4762 # Test commmand: ofproto/trace br_name br_flow
4763 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4764 AT_CHECK([tail -1 stdout], [0], [dnl
4765 Datapath actions: 2
4766 ])
4767
4768 # Delete the inserted flows
4769 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
4770 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
4771
4772 # This section below tests the [-generate] option
4773 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
4774 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"
4775
4776 # Test command: ofproto/trace odp_flow
4777 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4778 # Check for no MAC learning entry
4779 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4780 port VLAN MAC Age
4781 ])
4782
4783 # Test command: ofproto/trace br_name br_flow
4784 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4785 # Check for no MAC learning entry
4786 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4787 port VLAN MAC Age
4788 ])
4789
4790 # Test command: ofproto/trace odp_flow -generate
4791 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
4792 # Check for the MAC learning entry
4793 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4794 port VLAN MAC Age
4795 3 0 50:54:00:00:00:05 ?
4796 ])
4797
4798 # Test command: ofproto/trace dp_name odp_flow -generate
4799 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4800 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
4801 -generate], [0], [stdout])
4802 # Check for both MAC learning entries
4803 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4804 port VLAN MAC Age
4805 3 0 50:54:00:00:00:05 ?
4806 1 0 50:54:00:00:00:06 ?
4807 ])
4808
4809 # Test command: ofproto/trace br_name br_flow -generate
4810 AT_CHECK([ovs-appctl ofproto/trace br0 \
4811 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
4812 -generate], [0], [stdout])
4813 # Check for both MAC learning entries.
4814 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4815 port VLAN MAC Age
4816 3 0 50:54:00:00:00:05 ?
4817 1 0 50:54:00:00:00:06 ?
4818 2 0 50:54:00:00:00:07 ?
4819 ])
4820
4821 # This section beflow tests the [packet] option
4822 # The ovs-tcpundump of packets between port1 and port2
4823 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4824 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
4825
4826 # Construct the MAC learning table
4827 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4828 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
4829 -generate], [0], [stdout])
4830
4831 # Construct the MAC learning table
4832 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4833 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
4834 -generate], [0], [stdout])
4835
4836 # Test command: ofproto/trace odp_flow packet
4837 AT_CHECK([ovs-appctl ofproto/trace \
4838 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4839 AT_CHECK([tail -1 stdout], [0], [dnl
4840 Datapath actions: 2
4841 ])
4842 AT_CHECK([head -n 2 stdout], [0], [dnl
4843 Bridge: br0
4844 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
4845 ])
4846
4847 # Test command: ofproto/trace dp_name odp_flow packet
4848 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4849 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4850 AT_CHECK([tail -1 stdout], [0], [dnl
4851 Datapath actions: 2
4852 ])
4853 AT_CHECK([head -n 2 stdout], [0], [dnl
4854 Bridge: br0
4855 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
4856 ])
4857
4858 # Test command: ofproto/trace br_name br_flow packet
4859 AT_CHECK([ovs-appctl ofproto/trace br0 \
4860 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
4861 AT_CHECK([tail -1 stdout], [0], [dnl
4862 Datapath actions: 1
4863 ])
4864 AT_CHECK([head -n 2 stdout], [0], [dnl
4865 Bridge: br0
4866 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
4867 ])
4868
4869 OVS_VSWITCHD_STOP
4870 AT_CLEANUP
4871
4872 # The second test tests the corner cases
4873 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
4874 OVS_VSWITCHD_START
4875 add_of_ports br0 1 2
4876
4877 # Define flows
4878 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
4879 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
4880 # Define options
4881 generate="-generate"
4882 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4883
4884 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
4885 m4_foreach(
4886 [option],
4887 [[],
4888 ["$generate"],
4889 ["$pkt"]],
4890 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
4891 [2], [], [stderr])
4892 AT_CHECK([tail -2 stderr], [0], [dnl
4893 Cannot find the datapath
4894 ovs-appctl: ovs-vswitchd: server returned an error
4895 ])])
4896
4897 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
4898 m4_foreach(
4899 [option],
4900 [[],
4901 ["$generate"],
4902 ["$pkt"]],
4903 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
4904 [2], [], [stderr])
4905 AT_CHECK([tail -2 stderr], [0], [dnl
4906 Cannot find the datapath
4907 ovs-appctl: ovs-vswitchd: server returned an error
4908 ])])
4909
4910 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
4911 m4_foreach(
4912 [option],
4913 [[],
4914 ["$generate"],
4915 ["$pkt"]],
4916 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
4917 [2], [], [stderr])
4918 AT_CHECK([tail -2 stderr], [0], [dnl
4919 Cannot find the datapath
4920 ovs-appctl: ovs-vswitchd: server returned an error
4921 ])])
4922
4923 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
4924 m4_foreach(
4925 [option],
4926 [[],
4927 ["$generate"],
4928 ["$pkt"]],
4929 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
4930 [2], [], [stderr])
4931 AT_CHECK([tail -2 stderr], [0], [dnl
4932 Cannot find the datapath
4933 ovs-appctl: ovs-vswitchd: server returned an error
4934 ])])
4935
4936 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
4937 m4_foreach(
4938 [option],
4939 [[],
4940 ["$generate"],
4941 ["$pkt"]],
4942 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
4943 [2], [], [stderr])
4944 AT_CHECK([tail -2 stderr], [0], [dnl
4945 Unknown bridge name
4946 ovs-appctl: ovs-vswitchd: server returned an error
4947 ])])
4948
4949 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
4950 m4_foreach(
4951 [option],
4952 [[],
4953 ["$generate"],
4954 ["$pkt"]],
4955 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
4956 [2], [], [stderr])
4957 AT_CHECK([tail -2 stderr], [0], [dnl
4958 Must specify bridge name
4959 ovs-appctl: ovs-vswitchd: server returned an error
4960 ])])
4961
4962 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
4963 AT_CHECK([ovs-appctl ofproto/trace \
4964 ovs-dummy "$odp_flow" garbage_option],
4965 [2], [stdout],[stderr])
4966 AT_CHECK([tail -2 stderr], [0], [dnl
4967 Trailing garbage in packet data
4968 ovs-appctl: ovs-vswitchd: server returned an error
4969 ])
4970
4971 # Test incorrect command: ofproto/trace with 4 arguments
4972 AT_CHECK([ovs-appctl ofproto/trace \
4973 arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
4974 AT_CHECK([tail -2 stderr], [0], [dnl
4975 "ofproto/trace" command takes at most 3 arguments
4976 ovs-appctl: ovs-vswitchd: server returned an error
4977 ])
4978
4979 # Test incorrect command: ofproto/trace with 0 argument
4980 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
4981 AT_CHECK([tail -2 stderr], [0], [dnl
4982 "ofproto/trace" command requires at least 1 arguments
4983 ovs-appctl: ovs-vswitchd: server returned an error
4984 ])
4985
4986 OVS_VSWITCHD_STOP
4987 AT_CLEANUP
4988
4989 # The third test checks that the output of "ovs-dpctl -m" is valid to trace.
4990 AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
4991 OVS_VSWITCHD_START([dnl
4992 set Open_vSwitch . other_config:max-idle=10000 \
4993 -- add-port br0 p1 -- set Interface p1 type=dummy])
4994
4995 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)'])
4996 ovs-appctl revalidator/wait
4997 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
4998
4999 odp_flow=`cat dp_flows1.txt`
5000 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5001 Bridge: br0
5002 Flow: <cleared>
5003 No match, packets dropped because OFPPC_NO_PACKET_IN is set on in_port.
5004
5005 Rule: table=254 cookie=0 priority=0,reg0=0x2
5006 OpenFlow actions=drop
5007
5008 Final flow: <cleared>
5009 Megaflow: <cleared>
5010 Datapath actions: drop
5011 ])
5012
5013 dnl Now, try again without megaflows:
5014 ovs-appctl upcall/disable-megaflows
5015
5016 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)'])
5017 ovs-appctl revalidator/wait
5018 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
5019
5020 odp_flow=`cat dp_flows2.txt`
5021 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5022 Bridge: br0
5023 Flow: <cleared>
5024 No match, packets dropped because OFPPC_NO_PACKET_IN is set on in_port.
5025
5026 Rule: table=254 cookie=0 priority=0,reg0=0x2
5027 OpenFlow actions=drop
5028
5029 Final flow: <cleared>
5030 Megaflow: <cleared>
5031 Datapath actions: drop
5032 ])
5033
5034 OVS_VSWITCHD_STOP
5035 AT_CLEANUP
5036
5037 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
5038 OVS_VSWITCHD_START
5039 add_of_ports br0 1 2 3
5040
5041 AT_DATA([flows.txt], [dnl
5042 in_port=1 actions=output:2
5043 in_port=2 actions=output:1
5044 ])
5045 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5046
5047 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
5048 AT_CHECK([tail -1 stdout], [0], [dnl
5049 Datapath actions: push_vlan(vid=123,pcp=0),2
5050 ])
5051
5052 OVS_VSWITCHD_STOP
5053 AT_CLEANUP
5054
5055
5056 m4_define([OFPROTO_TRACE],
5057 [flow="$2"
5058 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
5059 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5060 expected="$4"
5061 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
5062 [0], [stdout])
5063 mv stdout expout
5064 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
5065 [0], [expout])])
5066
5067 AT_SETUP([ofproto-dpif - MAC learning])
5068 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5069 add_of_ports br0 1 2 3
5070
5071 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)'
5072
5073 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
5074 OFPROTO_TRACE(
5075 [ovs-dummy],
5076 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5077 [-generate],
5078 [1,2,100])
5079
5080 # Check for the MAC learning entry.
5081 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5082 port VLAN MAC Age
5083 3 0 50:54:00:00:00:05 ?
5084 ])
5085
5086 # Trace a packet arrival destined for the learned MAC.
5087 # (This will also learn a MAC.)
5088 OFPROTO_TRACE(
5089 [ovs-dummy],
5090 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
5091 [-generate],
5092 [3])
5093
5094 # Check for both MAC learning entries.
5095 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5096 port VLAN MAC Age
5097 3 0 50:54:00:00:00:05 ?
5098 1 0 50:54:00:00:00:06 ?
5099 ])
5100
5101 # Trace a packet arrival that updates the first learned MAC entry.
5102 OFPROTO_TRACE(
5103 [ovs-dummy],
5104 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5105 [-generate],
5106 [1,3,100])
5107
5108 # Check that the MAC learning entry was updated.
5109 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5110 port VLAN MAC Age
5111 1 0 50:54:00:00:00:06 ?
5112 2 0 50:54:00:00:00:05 ?
5113 ])
5114
5115 # Add another bridge.
5116 AT_CHECK(
5117 [ovs-vsctl \
5118 -- add-br br1 \
5119 -- set bridge br1 datapath-type=dummy])
5120 add_of_ports br1 4 5
5121
5122 # Trace some packet arrivals in br1 to create MAC learning entries there too.
5123 OFPROTO_TRACE(
5124 [ovs-dummy],
5125 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
5126 [-generate],
5127 [5,101])
5128 OFPROTO_TRACE(
5129 [ovs-dummy],
5130 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
5131 [-generate],
5132 [4,101])
5133
5134 # Check that the MAC learning entries were added.
5135 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5136 port VLAN MAC Age
5137 4 0 50:54:00:00:00:06 ?
5138 5 0 50:54:00:00:00:07 ?
5139 ])
5140
5141 # Delete port p1 and see that its MAC learning entry disappeared, and
5142 # that the MAC learning entry for the same MAC was also deleted from br1.
5143 AT_CHECK([ovs-vsctl del-port p1])
5144 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5145 port VLAN MAC Age
5146 2 0 50:54:00:00:00:05 ?
5147 ])
5148 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5149 port VLAN MAC Age
5150 5 0 50:54:00:00:00:07 ?
5151 ])
5152
5153 OVS_VSWITCHD_STOP
5154 AT_CLEANUP
5155
5156 AT_SETUP([ofproto-dpif - MAC table overflow])
5157 OVS_VSWITCHD_START(
5158 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
5159 add_of_ports br0 1 2 3
5160
5161 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)'
5162
5163 AT_CHECK([ovs-appctl time/stop])
5164
5165 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
5166 for i in 0 1 2 3 4 5 6 7 8 9; do
5167 OFPROTO_TRACE(
5168 [ovs-dummy],
5169 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
5170 [-generate],
5171 [1,2,100])
5172 ovs-appctl time/warp 1000
5173 done
5174
5175 # Check for the MAC learning entries.
5176 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5177 [0], [dnl
5178 3 0 50:54:00:00:00:00
5179 3 0 50:54:00:00:00:01
5180 3 0 50:54:00:00:00:02
5181 3 0 50:54:00:00:00:03
5182 3 0 50:54:00:00:00:04
5183 3 0 50:54:00:00:00:05
5184 3 0 50:54:00:00:00:06
5185 3 0 50:54:00:00:00:07
5186 3 0 50:54:00:00:00:08
5187 3 0 50:54:00:00:00:09
5188 port VLAN MAC Age
5189 ])
5190
5191 # Trace another ARP packet on another MAC.
5192 OFPROTO_TRACE(
5193 [ovs-dummy],
5194 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
5195 [-generate],
5196 [1,2,100])
5197
5198 # Check that the new one chased the oldest one out of the table.
5199 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
5200 [0], [dnl
5201 3 0 50:54:00:00:00:01 ?
5202 3 0 50:54:00:00:00:02 ?
5203 3 0 50:54:00:00:00:03 ?
5204 3 0 50:54:00:00:00:04 ?
5205 3 0 50:54:00:00:00:05 ?
5206 3 0 50:54:00:00:00:06 ?
5207 3 0 50:54:00:00:00:07 ?
5208 3 0 50:54:00:00:00:08 ?
5209 3 0 50:54:00:00:00:09 ?
5210 3 0 50:54:00:00:00:10 ?
5211 port VLAN MAC Age
5212 ])
5213 OVS_VSWITCHD_STOP
5214 AT_CLEANUP
5215
5216 AT_SETUP([ofproto-dpif - MAC table overflow fairness])
5217 OVS_VSWITCHD_START(
5218 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
5219 add_of_ports br0 1 2 3 4 5 6
5220
5221 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)'
5222
5223 AT_CHECK([ovs-appctl time/stop])
5224
5225 # Trace packets with 2 different source MACs arriving on each of the 5
5226 # ports, filling up the 10-entry learning table.
5227 for i in 0 1 2 3 4 5 6 7 8 9; do
5228 p=`expr $i / 2 + 1`
5229 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
5230 ovs-appctl time/warp 1000
5231 done
5232
5233 # Check for the MAC learning entries.
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:00
5237 1 0 50:54:00:00:00:01
5238 2 0 50:54:00:00:00:02
5239 2 0 50:54:00:00:00:03
5240 3 0 50:54:00:00:00:04
5241 3 0 50:54:00:00:00:05
5242 4 0 50:54:00:00:00:06
5243 4 0 50:54:00:00:00:07
5244 5 0 50:54:00:00:00:08
5245 5 0 50:54:00:00:00:09
5246 port VLAN MAC Age
5247 ])
5248
5249 # Now trace 16 new MACs on another port.
5250 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
5251 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
5252 ovs-appctl time/warp 1000
5253 done
5254
5255 # Check the results.
5256 #
5257 # Our eviction algorithm on overflow is that an arbitrary (but deterministic)
5258 # one of the ports with the most learned MACs loses the least recently used
5259 # one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
5260 # MAC each, and the other 2 of the old ports with 2 MACs each.
5261 #
5262 # (If someone changes lib/heap.c to do something different with equal-priority
5263 # nodes, then the output below could change, but it would still follow the
5264 # rules explained above.)
5265 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5266 [0], [dnl
5267 1 0 50:54:00:00:00:01
5268 2 0 50:54:00:00:00:03
5269 3 0 50:54:00:00:00:04
5270 3 0 50:54:00:00:00:05
5271 4 0 50:54:00:00:00:07
5272 5 0 50:54:00:00:00:08
5273 5 0 50:54:00:00:00:09
5274 6 0 50:54:00:00:0d:ff
5275 6 0 50:54:00:00:0e:ff
5276 6 0 50:54:00:00:0f:ff
5277 port VLAN MAC Age
5278 ])
5279 OVS_VSWITCHD_STOP
5280 AT_CLEANUP
5281
5282 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
5283 #
5284 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
5285 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
5286 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5287 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5288
5289 on_exit 'kill `cat test-sflow.pid`'
5290 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
5291 AT_CAPTURE_FILE([sflow.log])
5292 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5293 ovs-appctl time/stop
5294
5295 add_of_ports br0 1 2
5296 ovs-vsctl \
5297 set Interface br0 options:ifindex=1002 -- \
5298 set Interface p1 options:ifindex=1004 -- \
5299 set Interface p2 options:ifindex=1003 -- \
5300 set Bridge br0 sflow=@sf -- \
5301 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
5302 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
5303
5304 dnl open with ARP packets to seed the bridge-learning. The output
5305 dnl ifIndex numbers should be reported predictably after that.
5306 dnl Since we set sampling=1 we should see all of these packets
5307 dnl reported. Sorting the output by data-source and seqNo makes
5308 dnl it deterministic. Ensuring that we send at least two packets
5309 dnl into each port means we get to check the seq nos are
5310 dnl incrementing correctly.
5311 dnl because packets from different ports can be handled by separate
5312 dnl threads, put some sleeps
5313
5314 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)'
5315 sleep 1
5316 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)'
5317 sleep 1
5318 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)'
5319 sleep 1
5320 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)'
5321 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)'
5322
5323 dnl sleep long enough to get more than one counter sample
5324 dnl from each datasource so we can check sequence numbers
5325 ovs-appctl time/warp 2000 100
5326 OVS_VSWITCHD_STOP
5327 OVS_APP_EXIT_AND_WAIT([test-sflow])
5328
5329 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5330 /g']], [0], [dnl
5331 HEADER
5332 dgramSeqNo=1
5333 ds=127.0.0.1>2:1000
5334 fsSeqNo=1
5335 in_vlan=0
5336 in_priority=0
5337 out_vlan=0
5338 out_priority=0
5339 meanSkip=1
5340 samplePool=1
5341 dropEvents=0
5342 in_ifindex=1004
5343 in_format=0
5344 out_ifindex=2
5345 out_format=2
5346 hdr_prot=1
5347 pkt_len=46
5348 stripped=4
5349 hdr_len=42
5350 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
5351 HEADER
5352 dgramSeqNo=1
5353 ds=127.0.0.1>2:1000
5354 fsSeqNo=2
5355 in_vlan=0
5356 in_priority=0
5357 out_vlan=0
5358 out_priority=0
5359 meanSkip=1
5360 samplePool=2
5361 dropEvents=0
5362 in_ifindex=1003
5363 in_format=0
5364 out_ifindex=2
5365 out_format=2
5366 hdr_prot=1
5367 pkt_len=46
5368 stripped=4
5369 hdr_len=42
5370 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
5371 HEADER
5372 dgramSeqNo=1
5373 ds=127.0.0.1>2:1000
5374 fsSeqNo=3
5375 in_vlan=0
5376 in_priority=0
5377 out_vlan=0
5378 out_priority=0
5379 meanSkip=1
5380 samplePool=3
5381 dropEvents=0
5382 in_ifindex=1004
5383 in_format=0
5384 out_ifindex=1003
5385 out_format=0
5386 hdr_prot=1
5387 pkt_len=46
5388 stripped=4
5389 hdr_len=42
5390 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
5391 HEADER
5392 dgramSeqNo=1
5393 ds=127.0.0.1>2:1000
5394 fsSeqNo=4
5395 in_vlan=0
5396 in_priority=0
5397 out_vlan=0
5398 out_priority=0
5399 meanSkip=1
5400 samplePool=4
5401 dropEvents=0
5402 in_ifindex=1003
5403 in_format=0
5404 out_ifindex=1004
5405 out_format=0
5406 hdr_prot=1
5407 pkt_len=46
5408 stripped=4
5409 hdr_len=42
5410 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
5411 HEADER
5412 dgramSeqNo=1
5413 ds=127.0.0.1>2:1000
5414 fsSeqNo=5
5415 in_vlan=0
5416 in_priority=0
5417 out_vlan=0
5418 out_priority=0
5419 meanSkip=1
5420 samplePool=5
5421 dropEvents=0
5422 in_ifindex=1003
5423 in_format=0
5424 out_ifindex=1004
5425 out_format=0
5426 hdr_prot=1
5427 pkt_len=58
5428 stripped=4
5429 hdr_len=54
5430 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
5431 ])
5432
5433 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -18 | sed 's/ /\
5434 /g']], [0], [dnl
5435 IFCOUNTERS
5436 dgramSeqNo=1
5437 ds=127.0.0.1>0:1002
5438 csSeqNo=1
5439 ifindex=1002
5440 type=6
5441 ifspeed=100000000
5442 direction=0
5443 status=0
5444 in_octets=0
5445 in_unicasts=0
5446 in_multicasts=4294967295
5447 in_broadcasts=4294967295
5448 in_discards=4294967295
5449 in_errors=4294967295
5450 in_unknownprotos=4294967295
5451 out_octets=84
5452 out_unicasts=2
5453 out_multicasts=4294967295
5454 out_broadcasts=4294967295
5455 out_discards=4294967295
5456 out_errors=4294967295
5457 promiscuous=0
5458 IFCOUNTERS
5459 dgramSeqNo=1
5460 ds=127.0.0.1>0:1003
5461 csSeqNo=1
5462 ifindex=1003
5463 type=6
5464 ifspeed=100000000
5465 direction=0
5466 status=0
5467 in_octets=138
5468 in_unicasts=3
5469 in_multicasts=4294967295
5470 in_broadcasts=4294967295
5471 in_discards=4294967295
5472 in_errors=4294967295
5473 in_unknownprotos=4294967295
5474 out_octets=84
5475 out_unicasts=2
5476 out_multicasts=4294967295
5477 out_broadcasts=4294967295
5478 out_discards=4294967295
5479 out_errors=4294967295
5480 promiscuous=0
5481 IFCOUNTERS
5482 dgramSeqNo=1
5483 ds=127.0.0.1>0:1004
5484 csSeqNo=1
5485 ifindex=1004
5486 type=6
5487 ifspeed=100000000
5488 direction=0
5489 status=0
5490 in_octets=84
5491 in_unicasts=2
5492 in_multicasts=4294967295
5493 in_broadcasts=4294967295
5494 in_discards=4294967295
5495 in_errors=4294967295
5496 in_unknownprotos=4294967295
5497 out_octets=138
5498 out_unicasts=3
5499 out_multicasts=4294967295
5500 out_broadcasts=4294967295
5501 out_discards=4294967295
5502 out_errors=4294967295
5503 promiscuous=0
5504 IFCOUNTERS
5505 dgramSeqNo=2
5506 ds=127.0.0.1>0:1002
5507 csSeqNo=2
5508 ifindex=1002
5509 type=6
5510 ifspeed=100000000
5511 direction=0
5512 status=0
5513 in_octets=0
5514 in_unicasts=0
5515 in_multicasts=4294967295
5516 in_broadcasts=4294967295
5517 in_discards=4294967295
5518 in_errors=4294967295
5519 in_unknownprotos=4294967295
5520 out_octets=84
5521 out_unicasts=2
5522 out_multicasts=4294967295
5523 out_broadcasts=4294967295
5524 out_discards=4294967295
5525 out_errors=4294967295
5526 promiscuous=0
5527 IFCOUNTERS
5528 dgramSeqNo=2
5529 ds=127.0.0.1>0:1003
5530 csSeqNo=2
5531 ifindex=1003
5532 type=6
5533 ifspeed=100000000
5534 direction=0
5535 status=0
5536 in_octets=138
5537 in_unicasts=3
5538 in_multicasts=4294967295
5539 in_broadcasts=4294967295
5540 in_discards=4294967295
5541 in_errors=4294967295
5542 in_unknownprotos=4294967295
5543 out_octets=84
5544 out_unicasts=2
5545 out_multicasts=4294967295
5546 out_broadcasts=4294967295
5547 out_discards=4294967295
5548 out_errors=4294967295
5549 promiscuous=0
5550 IFCOUNTERS
5551 dgramSeqNo=2
5552 ds=127.0.0.1>0:1004
5553 csSeqNo=2
5554 ifindex=1004
5555 type=6
5556 ifspeed=100000000
5557 direction=0
5558 status=0
5559 in_octets=84
5560 in_unicasts=2
5561 in_multicasts=4294967295
5562 in_broadcasts=4294967295
5563 in_discards=4294967295
5564 in_errors=4294967295
5565 in_unknownprotos=4294967295
5566 out_octets=138
5567 out_unicasts=3
5568 out_multicasts=4294967295
5569 out_broadcasts=4294967295
5570 out_discards=4294967295
5571 out_errors=4294967295
5572 promiscuous=0
5573 OPENFLOWPORT
5574 datapath_id=18364758544493064720
5575 port_no=1
5576 OPENFLOWPORT
5577 datapath_id=18364758544493064720
5578 port_no=1
5579 OPENFLOWPORT
5580 datapath_id=18364758544493064720
5581 port_no=2
5582 OPENFLOWPORT
5583 datapath_id=18364758544493064720
5584 port_no=2
5585 OPENFLOWPORT
5586 datapath_id=18364758544493064720
5587 port_no=65534
5588 OPENFLOWPORT
5589 datapath_id=18364758544493064720
5590 port_no=65534
5591 PORTNAME
5592 portName=br0
5593 PORTNAME
5594 portName=br0
5595 PORTNAME
5596 portName=p1
5597 PORTNAME
5598 portName=p1
5599 PORTNAME
5600 portName=p2
5601 PORTNAME
5602 portName=p2
5603 ])])
5604
5605 AT_SETUP([ofproto-dpif - basic truncate action])
5606 OVS_VSWITCHD_START
5607 add_of_ports br0 1 2 3 4 5
5608
5609 AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
5610 AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
5611 AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
5612 AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
5613 AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
5614
5615 AT_DATA([flows.txt], [dnl
5616 in_port=3,actions=drop
5617 in_port=5,actions=drop
5618 in_port=1,actions=output(port=2,max_len=64),output:4
5619 ])
5620 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5621
5622 dnl Datapath actions
5623 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])
5624 AT_CHECK([tail -1 stdout], [0],
5625 [Datapath actions: trunc(64),2,4
5626 ])
5627
5628 dnl An 170 byte packet
5629 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
5630
5631 AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
5632 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
5633 ])
5634
5635 AT_CHECK([ovs-appctl revalidator/purge], [0])
5636 dnl packet with truncated size
5637 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5638 n_bytes=64
5639 ])
5640 dnl packet with original size
5641 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5642 n_bytes=170
5643 ])
5644
5645 dnl More complicated case
5646 AT_CHECK([ovs-ofctl del-flows br0])
5647 AT_DATA([flows.txt], [dnl
5648 in_port=3,actions=drop
5649 in_port=5,actions=drop
5650 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
5651 ])
5652 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5653
5654 dnl Datapath actions
5655 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])
5656 AT_CHECK([tail -1 stdout], [0],
5657 [Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
5658 ])
5659
5660 dnl An 170 byte packet
5661 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
5662
5663 AT_CHECK([ovs-appctl revalidator/purge], [0])
5664 dnl packet size: 64 + 128 + 170 = 362
5665 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5666 n_bytes=362
5667 ])
5668 dnl packet size: 60 + 170 = 230
5669 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5670 n_bytes=230
5671 ])
5672
5673 dnl syntax checking
5674 AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
5675 ovs-ofctl: output to unsupported truncate port: ALL
5676 ])
5677
5678 OVS_VSWITCHD_STOP
5679 AT_CLEANUP
5680
5681 AT_SETUP([ofproto-dpif - truncate and output to patch port])
5682 OVS_VSWITCHD_START([add-br br1 \
5683 -- set bridge br1 datapath-type=dummy fail-mode=secure \
5684 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 ofport_request=1 \
5685 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
5686
5687 add_of_ports br0 2
5688
5689 AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
5690 AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
5691
5692 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
5693 [0], [stdout])
5694 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
5695 ])
5696 dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
5697 AT_CHECK([grep "output_trunc does not support port: [[0-9]]*" stdout], [0], [stdout])
5698
5699 OVS_VSWITCHD_STOP
5700 AT_CLEANUP
5701
5702 AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
5703 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
5704 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
5705 options:key=5 ofport_request=1\
5706 -- add-port br0 p2 -- set Interface p2 type=dummy \
5707 ofport_request=2])
5708 AT_DATA([flows.txt], [dnl
5709 actions=output(max_len=100, port=1)
5710 ])
5711 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
5712 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5713
5714 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
5715 br0 65534/100: (dummy-internal)
5716 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
5717 p2 2/2: (dummy)
5718 ])
5719
5720 dnl Basic
5721 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])
5722 AT_CHECK([tail -1 stdout], [0],
5723 [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
5724 ])
5725
5726 OVS_VSWITCHD_STOP
5727 AT_CLEANUP
5728
5729 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
5730 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
5731 AT_CLEANUP
5732
5733 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
5734 AT_SKIP_IF([test $HAVE_IPV6 = no])
5735 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
5736 AT_CLEANUP
5737
5738 dnl Test sFlow LAG structures
5739 AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
5740 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
5741 OVS_VSWITCHD_START([dnl
5742 add-bond br0 bond p1 p2 -- \
5743 set Port bond lacp=active bond-mode=active-backup \
5744 other_config:lacp-time="fast" \
5745 other_config:lacp-system-id=11:22:33:44:55:66 \
5746 other_config:lacp-system-priority=54321 -- \
5747 set Interface p1 type=dummy \
5748 other_config:lacp-port-id=11 \
5749 other_config:lacp-port-priority=111 \
5750 other_config:lacp-aggregation-key=3333 -- \
5751 set Interface p2 type=dummy \
5752 other_config:lacp-port-id=22 \
5753 other_config:lacp-port-priority=222 \
5754 other_config:lacp-aggregation-key=3333 ])
5755
5756 on_exit 'kill `cat test-sflow.pid`'
5757 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5758 AT_CAPTURE_FILE([sflow.log])
5759 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5760
5761 ovs-appctl time/stop
5762
5763 ovs-vsctl \
5764 set Interface p1 options:ifindex=1003 -- \
5765 set Bridge br0 sflow=@sf -- \
5766 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5767 header=128 sampling=1 polling=1
5768
5769 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5770 AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
5771 AT_CHECK([ovs-appctl revalidator/purge], [0])
5772 OVS_VSWITCHD_STOP
5773 OVS_APP_EXIT_AND_WAIT([test-sflow])
5774 AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
5775 /g']], [0], [dnl
5776 LACPCOUNTERS
5777 sysID=11:22:33:44:55:66
5778 partnerID=00:00:00:00:00:00
5779 aggID=3333
5780 actorAdmin=0x7
5781 actorOper=0xbf
5782 partnerAdmin=0x0
5783 partnerOper=0x2
5784 LACPDUsRx=0
5785 markerPDUsRx=4294967295
5786 markerRespPDUsRx=4294967295
5787 unknownRx=4294967295
5788 illegalRx=0
5789 LACPDUsTx=1
5790 markerPDUsTx=4294967295
5791 markerRespPDUsTx=4294967295
5792 ])
5793
5794 AT_CLEANUP
5795
5796 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
5797 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5798 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5799
5800 dnl set up sFlow logging
5801 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5802 AT_CAPTURE_FILE([sflow.log])
5803 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5804 ovs-appctl time/stop
5805
5806 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
5807 AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
5808 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
5809 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
5810
5811 AT_CHECK([ovs-ofctl add-flow br0 action=3])
5812
5813 dnl enable sflow
5814 ovs-vsctl \
5815 set Bridge br0 sflow=@sf -- \
5816 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5817 header=128 sampling=1 polling=0
5818
5819 dnl introduce a packet that will be flooded to the tunnel
5820 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)'])
5821
5822 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5823 for i in `seq 1 30`; do
5824 ovs-appctl time/warp 100
5825 done
5826
5827 OVS_APP_EXIT_AND_WAIT([test-sflow])
5828
5829 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5830 /g']], [0], [dnl
5831 HEADER
5832 dgramSeqNo=1
5833 ds=127.0.0.1>2:1000
5834 fsSeqNo=1
5835 tunnel4_out_length=0
5836 tunnel4_out_protocol=47
5837 tunnel4_out_src=0.0.0.0
5838 tunnel4_out_dst=1.1.1.1
5839 tunnel4_out_src_port=0
5840 tunnel4_out_dst_port=0
5841 tunnel4_out_tcp_flags=0
5842 tunnel4_out_tos=1
5843 tunnel_out_vni=456
5844 in_vlan=0
5845 in_priority=0
5846 out_vlan=0
5847 out_priority=0
5848 meanSkip=1
5849 samplePool=1
5850 dropEvents=0
5851 in_ifindex=0
5852 in_format=0
5853 out_ifindex=1
5854 out_format=2
5855 hdr_prot=1
5856 pkt_len=46
5857 stripped=4
5858 hdr_len=42
5859 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
5860 ])
5861
5862 OVS_VSWITCHD_STOP
5863 AT_CLEANUP
5864
5865 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
5866 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5867
5868 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
5869
5870 dnl set up sFlow logging
5871 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5872 AT_CAPTURE_FILE([sflow.log])
5873 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5874 ovs-appctl time/stop
5875
5876 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5877 AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
5878 AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
5879 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
5880 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
5881 options:ifindex=2011 ofport_request=5
5882 ], [0])
5883
5884 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
5885 dummy@ovs-dummy: hit:0 missed:0
5886 br0:
5887 br0 65534/100: (dummy-internal)
5888 p0 1/1: (dummy: ifindex=1010)
5889 int-br:
5890 int-br 65534/2: (dummy-internal)
5891 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
5892 vm1 5/3: (dummy: ifindex=2011)
5893 ])
5894
5895 dnl set up route to 1.1.2.92 via br0 and action=normal
5896 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
5897 ])
5898 AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
5899 ])
5900 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5901
5902 dnl Prime ARP Cache for 1.1.2.92
5903 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)'])
5904
5905 dnl configure sflow on int-br only
5906 ovs-vsctl \
5907 set Bridge int-br sflow=@sf -- \
5908 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5909 header=128 sampling=1 polling=0
5910
5911 dnl set up route to 192.168.1.2 via br0
5912 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
5913 ])
5914 AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
5915 ])
5916
5917 dnl add rule for int-br to force packet onto tunnel. There is no ifindex
5918 dnl for this port so the sFlow output will just report that it went to
5919 dnl 1 output (out_format=2, out_ifindex=1)
5920 AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
5921
5922 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)'])
5923
5924 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5925 for i in `seq 1 30`; do
5926 ovs-appctl time/warp 100
5927 done
5928
5929 OVS_APP_EXIT_AND_WAIT([test-sflow])
5930
5931 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5932 /g']], [0], [dnl
5933 HEADER
5934 dgramSeqNo=1
5935 ds=127.0.0.1>2:1000
5936 fsSeqNo=1
5937 tunnel4_out_length=0
5938 tunnel4_out_protocol=47
5939 tunnel4_out_src=1.1.2.88
5940 tunnel4_out_dst=1.1.2.92
5941 tunnel4_out_src_port=0
5942 tunnel4_out_dst_port=0
5943 tunnel4_out_tcp_flags=0
5944 tunnel4_out_tos=0
5945 tunnel_out_vni=456
5946 in_vlan=0
5947 in_priority=0
5948 out_vlan=0
5949 out_priority=0
5950 meanSkip=1
5951 samplePool=1
5952 dropEvents=0
5953 in_ifindex=2011
5954 in_format=0
5955 out_ifindex=1
5956 out_format=2
5957 hdr_prot=1
5958 pkt_len=46
5959 stripped=4
5960 hdr_len=42
5961 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
5962 ])
5963
5964 OVS_VSWITCHD_STOP
5965 AT_CLEANUP
5966
5967 AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
5968 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5969 OVS_VSWITCHD_START
5970 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5971 add_of_ports br0 1 2
5972 AT_DATA([flows.txt], [dnl
5973 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
5974 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
5975 ])
5976 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5977
5978 dnl set up sFlow logging
5979 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5980 AT_CAPTURE_FILE([sflow.log])
5981 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5982 ovs-appctl time/stop
5983
5984 dnl configure sflow
5985 ovs-vsctl \
5986 set Bridge br0 sflow=@sf -- \
5987 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5988 header=128 sampling=1 polling=0
5989
5990 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)'])
5991 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)'])
5992
5993 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5994 for i in `seq 1 30`; do
5995 ovs-appctl time/warp 100
5996 done
5997
5998 OVS_APP_EXIT_AND_WAIT([test-sflow])
5999
6000 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6001 /g']], [0], [dnl
6002 HEADER
6003 dgramSeqNo=1
6004 ds=127.0.0.1>2:1000
6005 fsSeqNo=1
6006 mpls_label_0=789
6007 mpls_tc_0=4
6008 mpls_ttl_0=32
6009 mpls_bos_0=0
6010 mpls_label_1=11
6011 mpls_tc_1=3
6012 mpls_ttl_1=64
6013 mpls_bos_1=1
6014 in_vlan=0
6015 in_priority=0
6016 out_vlan=0
6017 out_priority=0
6018 meanSkip=1
6019 samplePool=1
6020 dropEvents=0
6021 in_ifindex=0
6022 in_format=0
6023 out_ifindex=1
6024 out_format=2
6025 hdr_prot=1
6026 pkt_len=22
6027 stripped=4
6028 hdr_len=18
6029 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40
6030 HEADER
6031 dgramSeqNo=1
6032 ds=127.0.0.1>2:1000
6033 fsSeqNo=2
6034 mpls_label_0=789
6035 mpls_tc_0=4
6036 mpls_ttl_0=32
6037 mpls_bos_0=1
6038 in_vlan=0
6039 in_priority=0
6040 out_vlan=0
6041 out_priority=0
6042 meanSkip=1
6043 samplePool=2
6044 dropEvents=0
6045 in_ifindex=0
6046 in_format=0
6047 out_ifindex=1
6048 out_format=2
6049 hdr_prot=1
6050 pkt_len=38
6051 stripped=4
6052 hdr_len=34
6053 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
6054 ])
6055
6056 OVS_VSWITCHD_STOP
6057 AT_CLEANUP
6058
6059
6060 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
6061 #
6062 # Test that basic NetFlow reports flow statistics correctly:
6063 # The initial packet of a flow are correctly accounted.
6064 # Later packets within a flow are correctly accounted.
6065 # Flow actions changing (in this case, due to MAC learning)
6066 # cause a record to be sent.
6067 m4_define([CHECK_NETFLOW_EXPIRATION],
6068 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6069 add_of_ports br0 1 2
6070
6071 ovs-appctl time/stop
6072 on_exit 'kill `cat test-netflow.pid`'
6073 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6074 AT_CAPTURE_FILE([netflow.log])
6075 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6076
6077 ovs-vsctl \
6078 set Bridge br0 netflow=@nf -- \
6079 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6080 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6081
6082 for delay in 1000 30000; do
6083 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)'
6084 sleep 1 # ensure the order in which these two packets are processed
6085 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)'
6086
6087 ovs-appctl time/warp $delay
6088 done
6089
6090 ovs-appctl time/warp 6000
6091 ovs-appctl revalidator/wait
6092 OVS_VSWITCHD_STOP
6093 OVS_APP_EXIT_AND_WAIT([test-netflow])
6094
6095 AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 42 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
6096
6097 AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 2, 1 pkts, 42 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
6098
6099 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 84 bytes, ICMP 0:0" netflow.log | wc -l`
6100 separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 42 bytes, ICMP 0:0" netflow.log | wc -l`
6101 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
6102
6103 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
6104 CHECK_NETFLOW_EXPIRATION([127.0.0.1])
6105 AT_CLEANUP
6106
6107 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
6108 AT_SKIP_IF([test $HAVE_IPV6 = no])
6109 CHECK_NETFLOW_EXPIRATION([[[::1]]])
6110 AT_CLEANUP
6111
6112 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
6113 #
6114 # Test that basic NetFlow reports active expirations correctly.
6115 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
6116 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6117 add_of_ports br0 1 2
6118
6119 on_exit 'kill `cat test-netflow.pid`'
6120 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6121 AT_CAPTURE_FILE([netflow.log])
6122 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6123
6124 ovs-vsctl \
6125 set Bridge br0 netflow=@nf -- \
6126 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6127 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
6128
6129 AT_CHECK([ovs-appctl time/stop])
6130 n=1
6131 while test $n -le 60; do
6132 n=`expr $n + 1`
6133
6134 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)'
6135 ovs-appctl netdev-dummy/receive p2 'in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=1234)'
6136
6137 ovs-appctl time/warp 1000
6138 done
6139
6140 ovs-appctl time/warp 10000
6141
6142 ovs-appctl revalidator/wait
6143 OVS_VSWITCHD_STOP
6144 OVS_APP_EXIT_AND_WAIT([test-netflow])
6145
6146 # Count the number of reported packets:
6147 # - From source to destination before MAC learning kicks in (just one).
6148 # - From source to destination after that.
6149 # - From destination to source.
6150 n_learn=0
6151 n_in=0
6152 n_out=0
6153 n_other=0
6154 n_recs=0
6155 none=0
6156 while read line; do
6157 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
6158 case $pkts in
6159 [[0-9]]*) ;;
6160 *) continue ;;
6161 esac
6162
6163 case $line in
6164 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6165 counter=n_learn
6166 ;;
6167 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6168 counter=n_in
6169 ;;
6170 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
6171 counter=n_out
6172 ;;
6173 *)
6174 counter=n_other
6175 ;;
6176 esac
6177 eval $counter=\`expr \$$counter + \$pkts\`
6178 n_recs=`expr $n_recs + 1`
6179 done < netflow.log
6180
6181 # There should be exactly 1 MAC learning packet,
6182 # exactly 59 other packets in that direction,
6183 # and exactly 60 packets in the other direction.
6184 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
6185 ])])
6186
6187 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
6188 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
6189 AT_CLEANUP
6190
6191 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
6192 AT_SKIP_IF([test $HAVE_IPV6 = no])
6193 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
6194 AT_CLEANUP
6195
6196 dnl In the absence of an IPFIX collector to verify protocol correctness, simply
6197 dnl configure bridge IPFIX and ensure that sample action generation works at the
6198 dnl datapath level.
6199 AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
6200 OVS_VSWITCHD_START
6201 add_of_ports br0 1 2
6202
6203 dnl Sample every packet using bridge-based sampling.
6204 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
6205 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
6206 sampling=1], [0], [ignore])
6207
6208 dnl Send some packets that should be sampled.
6209 for i in `seq 1 3`; do
6210 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)'])
6211 done
6212 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6213 flow-dump from non-dpdk interfaces:
6214 packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(userspace(pid=0,ipfix(output_port=4294967295))))
6215 ])
6216
6217 dnl Remove the IPFIX configuration.
6218 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
6219 AT_CHECK([ovs-appctl revalidator/purge])
6220
6221 dnl Send some more packets, to ensure that these are not sampled.
6222 for i in `seq 1 3`; do
6223 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)'])
6224 done
6225 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6226 flow-dump from non-dpdk interfaces:
6227 packets:2, bytes:68, used:0.001s, actions:drop
6228 ])
6229
6230 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6231 AT_CLEANUP
6232
6233 dnl Bridge IPFIX statistics check
6234 AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
6235 OVS_VSWITCHD_START
6236 add_of_ports br0 1 2
6237
6238 dnl Negative test check.
6239 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
6240 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6241 NXST_IPFIX_BRIDGE request (xid=0x2):
6242 ])
6243
6244 dnl Sample every packet using bridge-based sampling.
6245 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
6246 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
6247 sampling=1], [0], [ignore])
6248
6249 dnl Send some packets that should be sampled.
6250 for i in `seq 1 20`; do
6251 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)'])
6252 done
6253
6254 dnl There are 4 extra IPFIX template packets.
6255 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
6256 NXST_IPFIX_BRIDGE reply (xid=0x2):
6257 bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
6258 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
6259 ])
6260
6261 dnl Remove the IPFIX configuration.
6262 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
6263 AT_CHECK([ovs-appctl revalidator/purge])
6264
6265 dnl Send some more packets, to ensure that these are not sampled.
6266 for i in `seq 1 2`; do
6267 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)'])
6268 done
6269 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
6270 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6271 NXST_IPFIX_BRIDGE request (xid=0x2):
6272 ])
6273
6274 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6275 AT_CLEANUP
6276
6277 dnl Flow IPFIX sanity check
6278 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
6279 OVS_VSWITCHD_START
6280 add_of_ports br0 1 2
6281
6282 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6283 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6284 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6285 [0], [ignore])
6286
6287 AT_DATA([flows.txt], [dnl
6288 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
6289 ])
6290
6291 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6292
6293 dnl Send some packets that should be sampled.
6294 for i in `seq 1 3`; do
6295 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)'])
6296 done
6297 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6298 flow-dump from non-dpdk interfaces:
6299 packets:2, bytes:68, 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
6300 ])
6301
6302 dnl Remove the flow which contains sample action.
6303 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
6304 AT_CHECK([ovs-appctl revalidator/purge])
6305
6306 dnl Send some more packets, to ensure that these are not sampled.
6307 for i in `seq 1 3`; do
6308 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)'])
6309 done
6310 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6311 flow-dump from non-dpdk interfaces:
6312 packets:2, bytes:68, used:0.001s, actions:drop
6313 ])
6314
6315 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6316 AT_CLEANUP
6317
6318 dnl Flow IPFIX sanity check for tunnel set
6319 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
6320 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6321 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6322 options:key=5 ofport_request=1\
6323 -- add-port br0 p2 -- set Interface p2 type=stt \
6324 options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
6325 options:key=6 ofport_request=2\
6326 -- add-port br0 p3 -- set Interface p3 type=dummy \
6327 ofport_request=3 \
6328 -- --id=@br0 get Bridge br0 \
6329 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6330 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6331 [<0>
6332 <1>
6333 ])
6334
6335 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6336
6337 dnl Add openflow sample action without sampling_port.
6338 AT_DATA([flows.txt], [dnl
6339 in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
6340 ])
6341 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6342
6343 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])
6344 AT_CHECK([tail -1 stdout], [0], [dnl
6345 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
6346 ])
6347
6348 dnl Remove the flow which contains sample action.
6349 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6350 AT_CHECK([ovs-appctl revalidator/purge])
6351
6352 dnl Add openflow sample action with sampling_port which is
6353 dnl equal to output port.
6354 AT_DATA([flows2.txt], [dnl
6355 in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
6356 ])
6357 AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
6358
6359 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])
6360 dnl Make sure flow sample action in datapath is behind set tunnel
6361 dnl action at egress point of tunnel port.
6362 AT_CHECK([tail -1 stdout], [0], [dnl
6363 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
6364 ])
6365
6366 dnl Remove the flow which contains sample action.
6367 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6368 AT_CHECK([ovs-appctl revalidator/purge])
6369
6370 dnl Add a rule with two sample actions and each sample action
6371 dnl has a sampling_port
6372 AT_DATA([flows3.txt], [dnl
6373 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
6374 ])
6375 AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
6376
6377 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])
6378 dnl Make sure flow sample action in datapath is behind set tunnel
6379 dnl action at egress point of tunnel port.
6380 AT_CHECK([tail -1 stdout], [0], [dnl
6381 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,tp_dst=7471,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
6382 ])
6383
6384 dnl Remove the flow which contains sample action.
6385 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6386 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
6387
6388 OVS_VSWITCHD_STOP
6389 AT_CLEANUP
6390
6391 dnl Flow based IPFIX statistics check
6392 AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
6393 OVS_VSWITCHD_START
6394 add_of_ports br0 1 2
6395
6396 dnl Negative test check.
6397 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
6398 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6399 NXST_IPFIX_FLOW request (xid=0x2):
6400 ])
6401
6402 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6403 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6404 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6405 [0], [ignore])
6406
6407 AT_DATA([flows.txt], [dnl
6408 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
6409 ])
6410
6411 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6412
6413 dnl Send some packets that should be sampled.
6414 for i in `seq 1 20`; do
6415 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)'])
6416 done
6417
6418 dnl There are 4 extra IPFIX template packets.
6419 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
6420 NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
6421 id 1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
6422 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
6423 ])
6424
6425 dnl Remove the flow which contains sample action.
6426 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
6427 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
6428 AT_CHECK([ovs-appctl revalidator/purge])
6429
6430 dnl Send some more packets, to ensure that these are not sampled.
6431 for i in `seq 1 3`; do
6432 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)'])
6433 done
6434 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
6435 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6436 NXST_IPFIX_FLOW request (xid=0x2):
6437 ])
6438
6439 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6440 AT_CLEANUP
6441
6442 AT_SETUP([ofproto-dpif - flow stats])
6443 OVS_VSWITCHD_START
6444 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
6445 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
6446
6447 ovs-appctl time/stop
6448
6449 for i in `seq 1 10`; do
6450 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)'
6451 done
6452
6453 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6454 AT_CHECK([ovs-appctl revalidator/purge], [0])
6455 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
6456 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
6457 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6458 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=540, idle_age=1, ip actions=NORMAL
6459 ])
6460 OVS_VSWITCHD_STOP
6461 AT_CLEANUP
6462
6463 AT_SETUP([ofproto-dpif - flow stats reset_counts])
6464 OVS_VSWITCHD_START
6465 flow="ip,actions=NORMAL"
6466
6467 ovs-appctl time/stop
6468
6469 AT_CHECK([ovs-ofctl add-flow br0 $flow])
6470
6471 warp_and_dump_NXM () {
6472 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6473 AT_CHECK([ovs-appctl revalidator/purge], [0])
6474
6475 AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0], [0], [stdout])
6476 if [[ $5 -gt 0 ]]; then
6477 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, hard_age=$5, ip actions=NORMAL"
6478 else
6479 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, ip actions=NORMAL"
6480 fi
6481 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
6482 $expected
6483 ])
6484 }
6485
6486 warp_and_dump_OF () {
6487 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6488 AT_CHECK([ovs-appctl revalidator/purge], [0])
6489
6490 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0], [0], [stdout])
6491 if [[ $1 -lt 13 -o "$5X" = "X" ]]; then
6492 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, ip actions=NORMAL"
6493 else
6494 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $5 ip actions=NORMAL"
6495 fi
6496 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
6497 $expected
6498 ])
6499 }
6500
6501 send_packet () {
6502 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)'
6503 }
6504
6505 # OpenFlow 1.0, implicit reset_counts
6506 send_packet
6507 warp_and_dump_NXM 1 1 54 1
6508 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 add-flow br0 $flow])
6509 # add-flow resets duration and counts,
6510 # but idle age is inherited from the old flow
6511 warp_and_dump_NXM 1 0 0 2
6512
6513 send_packet
6514 warp_and_dump_NXM 2 1 54 1
6515 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 mod-flows br0 $flow])
6516 # mod-flows resets hard_age, but not counts
6517 # but duration and idle_age is inherited from the old flow
6518 warp_and_dump_NXM 3 1 54 2 1
6519
6520 # OpenFlow 1.1, implicit reset_counts
6521 send_packet
6522 warp_and_dump_OF 11 4 2 108
6523 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 add-flow br0 $flow])
6524 # add-flow resets duration and counts,
6525 # but idle age is inherited from the old flow
6526 warp_and_dump_NXM 1 0 0 2
6527 warp_and_dump_OF 11 2 0 0
6528
6529 send_packet
6530 warp_and_dump_OF 11 3 1 54
6531 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 mod-flows br0 $flow])
6532 # mod-flows resets hard_age, but not counts
6533 # but duration and idle_age is inherited from the old flow
6534 warp_and_dump_NXM 4 1 54 2 1
6535 warp_and_dump_OF 11 5 1 54
6536
6537 # OpenFlow 1.2, explicit reset_counts
6538 send_packet
6539 warp_and_dump_OF 12 6 2 108
6540 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 $flow])
6541 # add-flow without flags resets duration, but not counts,
6542 # idle age is inherited from the old flow
6543 warp_and_dump_NXM 1 2 108 2
6544 warp_and_dump_OF 12 2 2 108
6545
6546 send_packet
6547 warp_and_dump_OF 12 3 3 162
6548 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 $flow])
6549 # mod-flows without flags does not reset duration nor counts,
6550 # idle age is inherited from the old flow
6551 warp_and_dump_NXM 4 3 162 2 1
6552 warp_and_dump_OF 12 5 3 162
6553
6554 send_packet
6555 warp_and_dump_OF 12 6 4 216
6556 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 reset_counts,$flow])
6557 # add-flow with reset_counts resets both duration and counts,
6558 # idle age is inherited from the old flow
6559 warp_and_dump_NXM 1 0 0 2
6560 warp_and_dump_OF 12 2 0 0
6561
6562 send_packet
6563 warp_and_dump_OF 12 3 1 54
6564 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 reset_counts,$flow])
6565 # mod-flows with reset_counts resets counts, but not duration,
6566 # idle age is inherited from the old flow
6567 warp_and_dump_NXM 4 0 0 2 1
6568 warp_and_dump_OF 12 5 0 0
6569
6570 # OpenFlow > 1.3, explicit reset_counts
6571 flow_mods_reset_counts () {
6572 # Reset to a known state
6573 AT_CHECK([ovs-ofctl add-flow br0 $flow])
6574
6575 send_packet
6576 warp_and_dump_OF $1 1 1 54 reset_counts
6577 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
6578 # add-flow without flags resets duration, but not counts,
6579 # idle age is inherited from the old flow
6580 warp_and_dump_NXM 1 1 54 2
6581 warp_and_dump_OF $1 2 1 54
6582
6583 send_packet
6584 warp_and_dump_OF $1 3 2 108
6585 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
6586 # mod-flows without flags does not reset duration nor counts,
6587 # idle age is inherited from the old flow
6588 warp_and_dump_NXM 4 2 108 2 1
6589 warp_and_dump_OF $1 5 2 108
6590
6591 send_packet
6592 warp_and_dump_OF $1 6 3 162
6593 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
6594 # add-flow with reset_counts resets both duration and counts,
6595 # idle age is inherited from the old flow
6596 warp_and_dump_NXM 1 0 0 2
6597 warp_and_dump_OF $1 2 0 0 reset_counts
6598
6599 send_packet
6600 warp_and_dump_OF $1 3 1 54 reset_counts
6601 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
6602 # mod-flows with reset_counts resets counts, but not duration,
6603 # idle age is inherited from the old flow
6604 warp_and_dump_NXM 4 0 0 2 1
6605 warp_and_dump_OF $1 5 0 0 reset_counts
6606
6607 # Modify flow having reset_counts flag without reset_counts
6608 send_packet
6609 warp_and_dump_OF $1 6 1 54 reset_counts
6610 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
6611 warp_and_dump_NXM 7 1 54 2 1
6612 warp_and_dump_OF $1 8 1 54 reset_counts
6613
6614 # Add flow having reset_counts flag without reset_counts
6615 send_packet
6616 warp_and_dump_OF $1 9 2 108 reset_counts
6617 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
6618 warp_and_dump_NXM 1 2 108 2
6619 warp_and_dump_OF $1 2 2 108
6620
6621 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
6622 send_packet
6623 warp_and_dump_OF $1 3 3 162
6624 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
6625 warp_and_dump_NXM 4 0 0 2 1
6626 warp_and_dump_OF $1 5 0 0
6627 }
6628
6629 # OpenFlow versions >= 1.3 should behave the same way
6630 flow_mods_reset_counts 13
6631 flow_mods_reset_counts 14
6632 flow_mods_reset_counts 15
6633
6634 OVS_VSWITCHD_STOP
6635 AT_CLEANUP
6636
6637 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
6638 OVS_VSWITCHD_START
6639 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
6640 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
6641
6642 ovs-appctl time/stop
6643
6644 for i in `seq 1 10`; do
6645 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)'
6646 done
6647
6648 ovs-appctl time/warp 100
6649 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
6650 ovs-appctl time/warp 1000
6651
6652 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
6653 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
6654 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6655 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=540, idle_age=1, ip actions=NORMAL
6656 ])
6657 OVS_VSWITCHD_STOP
6658 AT_CLEANUP
6659
6660 AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
6661 OVS_VSWITCHD_START
6662
6663 # get_ages DURATION HARD IDLE
6664 #
6665 # Fetch the flow duration, hard age, and idle age into the variables
6666 # whose names are given as arguments. Rounds DURATION down to the
6667 # nearest integer. If hard_age doesn't appear in the output, sets
6668 # HARD to "none". If idle_age doesn't appear in the output, sets IDLE
6669 # to 0.
6670 get_ages () {
6671 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
6672
6673 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
6674 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
6675 AS_VAR_COPY([$1], [duration])
6676
6677 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
6678 if test X"$hard" = X; then
6679 hard=none
6680 else
6681 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
6682 fi
6683 AS_VAR_COPY([$2], [hard])
6684
6685 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
6686 if test X"$idle" = X; then
6687 idle=0
6688 else
6689 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
6690 fi
6691 AS_VAR_COPY([$3], [idle])
6692 }
6693
6694 # Add a flow and get its initial hard and idle age.
6695 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
6696 get_ages duration1 hard1 idle1
6697
6698 ovs-appctl time/stop
6699 # Warp time forward by 10 seconds, then modify the flow's actions.
6700 ovs-appctl time/warp 10000
6701 get_ages duration2 hard2 idle2
6702 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
6703
6704 # Warp time forward by 10 seconds.
6705 ovs-appctl time/warp 10000
6706 get_ages duration3 hard3 idle3
6707
6708 # Warp time forward 10 more seconds, then pass some packets through the flow,
6709 # then warp forward a few more times because idle times are only updated
6710 # occasionally.
6711 ovs-appctl time/warp 10000
6712 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)'
6713 ovs-appctl time/warp 3000 1000
6714 sleep 1
6715 get_ages duration4 hard4 idle4
6716
6717 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
6718 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
6719 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
6720
6721 # Duration should increase steadily over time.
6722 AT_CHECK([test $duration1 -lt $duration2])
6723 AT_CHECK([test $duration2 -lt $duration3])
6724 AT_CHECK([test $duration3 -lt $duration4])
6725
6726 # Hard age should be "none" initially because it's the same as flow_duration,
6727 # then it should increase.
6728 AT_CHECK([test $hard1 = none])
6729 AT_CHECK([test $hard2 = none])
6730 AT_CHECK([test $hard3 != none])
6731 AT_CHECK([test $hard4 != none])
6732 AT_CHECK([test $hard3 -lt $hard4])
6733
6734 # Idle age should increase from 1 to 2 to 3, then decrease.
6735 AT_CHECK([test $idle1 -lt $idle2])
6736 AT_CHECK([test $idle2 -lt $idle3])
6737 AT_CHECK([test $idle3 -gt $idle4])
6738
6739 # Check some invariant relationships.
6740 AT_CHECK([test $duration1 = $idle1])
6741 AT_CHECK([test $duration2 = $idle2])
6742 AT_CHECK([test $duration3 = $idle3])
6743 AT_CHECK([test $idle3 -gt $hard3])
6744 AT_CHECK([test $idle4 -lt $hard4])
6745 AT_CHECK([test $hard4 -lt $duration4])
6746
6747 OVS_VSWITCHD_STOP
6748 AT_CLEANUP
6749
6750 AT_SETUP([ofproto-dpif - fin_timeout])
6751 OVS_VSWITCHD_START
6752 ovs-appctl time/stop
6753 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
6754 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
6755 [NXST_FLOW reply:
6756 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
6757 ])
6758
6759 # Check that a TCP SYN packet does not change the timeout. (Because
6760 # flow stats updates are mainly what implements the fin_timeout
6761 # feature, we warp forward a couple of times to ensure that flow stats
6762 # run before re-checking the flow table.)
6763 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
6764 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
6765 warped
6766 ])
6767 AT_CHECK([ovs-appctl revalidator/purge], [0])
6768 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
6769 [NXST_FLOW reply:
6770 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
6771 ])
6772 # Check that a TCP FIN packet does change the timeout.
6773 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
6774 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
6775 warped
6776 ])
6777 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
6778 [NXST_FLOW reply:
6779 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
6780 ])
6781 OVS_VSWITCHD_STOP
6782 AT_CLEANUP
6783
6784 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
6785 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
6786 add_of_ports br0 1 2
6787 add_of_ports br1 3
6788
6789 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
6790 dummy@br0
6791 dummy@br1
6792 ])
6793 OVS_VSWITCHD_STOP
6794 AT_CLEANUP
6795
6796 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
6797 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
6798 [--dummy-numa="0,0,0,0,1,1,1,1"])
6799 add_pmd_of_ports br0 1 2
6800 add_of_ports br1 3
6801
6802 AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
6803 dummy@ovs-dummy: hit:0 missed:0
6804 br0:
6805 br0 65534/100: (dummy-internal)
6806 p1 1/1: (dummy-pmd: <cleared>)
6807 p2 2/2: (dummy-pmd: <cleared>)
6808 br1:
6809 br1 65534/101: (dummy-internal)
6810 p3 3/3: (dummy)
6811 ])
6812 OVS_VSWITCHD_STOP
6813 AT_CLEANUP
6814
6815 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
6816 # bump max-idle to avoid the flows being reclaimed behind us
6817 OVS_VSWITCHD_START([add-br br1 -- \
6818 set bridge br1 datapath-type=dummy fail-mode=secure -- \
6819 set Open_vSwitch . other_config:max-idle=10000], [], [],
6820 [--dummy-numa="0,0,0,0,1,1,1,1"])
6821 add_of_ports br0 1
6822 add_pmd_of_ports br0 2
6823 add_of_ports br1 3
6824
6825 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)'])
6826 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)'])
6827 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)'])
6828 ovs-appctl revalidator/wait
6829 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
6830 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
6831 recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
6832 ])
6833
6834 AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
6835 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
6836 ])
6837
6838 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
6839 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p1),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
6840 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p2),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
6841 ])
6842
6843 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
6844 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p3),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
6845 ])
6846
6847 OVS_VSWITCHD_STOP
6848 AT_CLEANUP
6849
6850 m4_define([OFPROTO_DPIF_GET_FLOW],
6851 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
6852
6853 OVS_VSWITCHD_START([add-br br1 -- \
6854 set bridge br1 datapath-type=dummy fail-mode=secure -- \
6855 set Open_vSwitch . other_config:max-idle=10000], [], [],
6856 [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
6857
6858 func=`echo -n "$1_" | cut -c 4-`
6859 add_${func}of_ports br0 1 2
6860
6861 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)'])
6862 ovs-appctl revalidator/wait
6863 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
6864
6865 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
6866 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
6867 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
6868 ])
6869
6870 OVS_VSWITCHD_STOP
6871 AT_CLEANUP])
6872
6873 OFPROTO_DPIF_GET_FLOW([])
6874 OFPROTO_DPIF_GET_FLOW([ - pmd])
6875
6876 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
6877 OVS_VSWITCHD_START([dnl
6878 add-port br0 p1 -- set Interface p1 type=dummy
6879 ])
6880 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6881 on_exit 'kill `cat ovs-ofctl.pid`'
6882
6883 AT_CAPTURE_FILE([ofctl_monitor.log])
6884 AT_DATA([flows.txt], [dnl
6885 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
6886 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
6887 ])
6888 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6889
6890 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
6891 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
6892 dnl
6893 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
6894 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)
6895 dnl (label 20, exp 0, [S], ttl 32)
6896 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
6897 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6898
6899 for dl_src in 00 01; do
6900 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"])
6901 done
6902 sleep 1 # wait for the datapath flow installed
6903 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
6904 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))
6905 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))
6906 ])
6907
6908 OVS_VSWITCHD_STOP
6909 AT_CLEANUP
6910
6911
6912 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
6913 OVS_VSWITCHD_START([dnl
6914 add-port br0 p1 -- set Interface p1 type=dummy
6915 ])
6916 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6917 on_exit 'kill `cat ovs-ofctl.pid`'
6918
6919 AT_CAPTURE_FILE([ofctl_monitor.log])
6920 AT_DATA([flows.txt], [dnl
6921 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
6922 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
6923 ])
6924 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6925
6926 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
6927 dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
6928 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
6929 dnl
6930 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
6931 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)
6932 dnl (label 20, exp 0, ttl 32)
6933 dnl (label 20, exp 0, ttl 32)
6934 dnl (label 20, exp 0, [S], ttl 32)
6935 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
6936 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6937
6938 for dl_src in 00 01; do
6939 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"])
6940 done
6941 sleep 1 # wait for the datapath flow installed
6942 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
6943 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))
6944 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))
6945 ])
6946
6947 OVS_VSWITCHD_STOP
6948 AT_CLEANUP
6949
6950 AT_SETUP([ofproto-dpif - patch ports])
6951 OVS_VSWITCHD_START([add-br br1 \
6952 -- set bridge br1 datapath-type=dummy fail-mode=secure \
6953 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
6954 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6955
6956 add_of_ports br0 2
6957 add_of_ports br1 3
6958
6959 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
6960 ], [])
6961 AT_CHECK([ovs-appctl time/stop])
6962 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6963
6964 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
6965 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
6966
6967 for i in $(seq 1 10); do
6968 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)'
6969 if [[ $i -eq 1 ]]; then
6970 sleep 1
6971 fi
6972 done
6973
6974 for i in $(seq 1 5); do
6975 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)'
6976 if [[ $i -eq 1 ]]; then
6977 sleep 1
6978 fi
6979 done
6980
6981 AT_CHECK([ovs-appctl time/warp 500], [0],
6982 [warped
6983 ])
6984 sleep 1 # wait for log writer
6985
6986 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6987 dummy@ovs-dummy: hit:13 missed:2
6988 br0:
6989 br0 65534/100: (dummy-internal)
6990 p2 2/2: (dummy)
6991 pbr0 1/none: (patch: peer=pbr1)
6992 br1:
6993 br1 65534/101: (dummy-internal)
6994 p3 3/3: (dummy)
6995 pbr1 1/none: (patch: peer=pbr0)
6996 ])
6997
6998 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
6999 recirc_id(0),in_port(100),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
7000 recirc_id(0),in_port(101),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
7001 ])
7002
7003 AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
7004 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(100),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:378, used:0.0s, actions:101,3,2
7005 ])
7006 AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
7007 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(101),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:168, used:0.0s, actions:100,2,3
7008 ])
7009
7010 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
7011 OFPST_PORT reply (xid=0x4): 1 ports
7012 port 1: rx pkts=5, bytes=210, drop=?, errs=?, frame=?, over=?, crc=?
7013 tx pkts=10, bytes=420, drop=?, errs=?, coll=?
7014 ])
7015
7016 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
7017 OFPST_PORT reply (xid=0x4): 1 ports
7018 port 1: rx pkts=10, bytes=420, drop=?, errs=?, frame=?, over=?, crc=?
7019 tx pkts=5, bytes=210, drop=?, errs=?, coll=?
7020 ])
7021
7022 OVS_VSWITCHD_STOP
7023 AT_CLEANUP
7024
7025 AT_SETUP([ofproto-dpif - patch ports - stack])
7026 OVS_VSWITCHD_START([add-br br1 \
7027 -- set bridge br1 datapath-type=dummy fail-mode=secure \
7028 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
7029 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
7030
7031 add_of_ports br0 2
7032 add_of_ports br1 3
7033
7034 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7035 ], [])
7036 AT_CHECK([ovs-appctl time/stop])
7037 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7038
7039 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"])
7040 # Try to pop from empty stack, and push and leave data to stack.
7041 AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
7042
7043 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)'
7044
7045 AT_CHECK([ovs-appctl time/warp 500], [0],
7046 [warped
7047 ])
7048
7049 OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
7050
7051 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
7052 dummy@ovs-dummy: hit:0 missed:1
7053 br0:
7054 br0 65534/100: (dummy-internal)
7055 p2 2/2: (dummy)
7056 pbr0 1/none: (patch: peer=pbr1)
7057 br1:
7058 br1 65534/101: (dummy-internal)
7059 p3 3/3: (dummy)
7060 pbr1 1/none: (patch: peer=pbr0)
7061 ])
7062
7063 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7064 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
7065 ])
7066
7067 AT_CHECK([grep -e '|nx_match|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
7068 Failed to pop from an empty stack. On flow
7069 ])
7070
7071 OVS_VSWITCHD_STOP(["/Failed to pop from an empty stack/d"])
7072 AT_CLEANUP
7073
7074 AT_SETUP([ofproto-dpif - port duration])
7075 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
7076 add_of_ports br0 1 2
7077
7078 ovs-appctl time/stop
7079 ovs-appctl time/warp 10000
7080
7081 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
7082 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
7083 [dnl
7084 duration=?s
7085 duration=?s
7086 duration=?s
7087 ])
7088 OVS_VSWITCHD_STOP
7089 AT_CLEANUP
7090
7091 dnl ----------------------------------------------------------------------
7092 AT_BANNER([ofproto-dpif -- megaflows])
7093
7094 AT_SETUP([ofproto-dpif megaflow - port classification])
7095 OVS_VSWITCHD_START
7096 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7097 add_of_ports br0 1 2
7098 AT_DATA([flows.txt], [dnl
7099 table=0 in_port=1 actions=output(2)
7100 ])
7101 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7102 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)'])
7103 sleep 1
7104 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)'])
7105 sleep 1
7106 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7107 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
7108 ])
7109 OVS_VSWITCHD_STOP
7110 AT_CLEANUP
7111
7112 AT_SETUP([ofproto-dpif megaflow - L2 classification])
7113 OVS_VSWITCHD_START
7114 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7115 add_of_ports br0 1 2
7116 AT_DATA([flows.txt], [dnl
7117 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
7118 ])
7119 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7120 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)'])
7121 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)'])
7122 sleep 1
7123 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7124 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7125 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7126 ])
7127 OVS_VSWITCHD_STOP
7128 AT_CLEANUP
7129
7130 AT_SETUP([ofproto-dpif megaflow - L3 classification])
7131 OVS_VSWITCHD_START
7132 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7133 add_of_ports br0 1 2
7134 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], [])
7135 AT_DATA([flows.txt], [dnl
7136 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
7137 ])
7138 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7139 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)'])
7140 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)'])
7141 sleep 1
7142 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7143 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
7144 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,frag=no), actions: <del>
7145 ])
7146 OVS_VSWITCHD_STOP
7147 AT_CLEANUP
7148
7149 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
7150 OVS_VSWITCHD_START
7151 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7152 add_of_ports br0 1 2
7153 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], [])
7154 AT_DATA([flows.txt], [dnl
7155 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
7156 ])
7157 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7158 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)'])
7159 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)'])
7160 sleep 1
7161 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7162 recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5,frag=no), actions: <del>
7163 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>
7164 ])
7165 OVS_VSWITCHD_STOP
7166 AT_CLEANUP
7167
7168 AT_SETUP([ofproto-dpif megaflow - L4 classification])
7169 OVS_VSWITCHD_START
7170 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7171 add_of_ports br0 1 2
7172 AT_DATA([flows.txt], [dnl
7173 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
7174 ])
7175 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7176 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)'])
7177 sleep 1
7178 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)'])
7179 sleep 1
7180 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7181 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=1,frag=no),icmp(type=8), actions: <del>
7182 ])
7183 OVS_VSWITCHD_STOP
7184 AT_CLEANUP
7185
7186 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
7187 [AT_SETUP([ofproto-dpif megaflow - normal$1])
7188 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7189 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7190 func=`echo -n "$1_" | cut -c 4-`
7191 add_${func}of_ports br0 1 2
7192 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7193 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)'])
7194 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)'])
7195 sleep 1
7196 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7197 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>
7198 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>
7199 ])
7200 OVS_VSWITCHD_STOP
7201 AT_CLEANUP])
7202
7203 OFPROTO_DPIF_MEGAFLOW_NORMAL([])
7204 OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
7205
7206 AT_SETUP([ofproto-dpif megaflow - mpls])
7207 OVS_VSWITCHD_START
7208 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7209 add_of_ports br0 1 2
7210 AT_DATA([flows.txt], [dnl
7211 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
7212 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
7213 ])
7214 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7215 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1)'])
7216 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)'])
7217 sleep 1
7218 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
7219 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
7220 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
7221 ])
7222 OVS_VSWITCHD_STOP
7223 AT_CLEANUP
7224
7225 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
7226 m4_define([CHECK_MEGAFLOW_NETFLOW],
7227 [OVS_VSWITCHD_START
7228 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7229 add_of_ports br0 1 2
7230
7231 dnl NetFlow configuration disables wildcarding relevant fields
7232 on_exit 'kill `cat test-netflow.pid`'
7233 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
7234 AT_CAPTURE_FILE([netflow.log])
7235 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
7236 ovs-vsctl \
7237 set Bridge br0 netflow=@nf -- \
7238 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
7239 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
7240
7241 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7242 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)'])
7243 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)'])
7244 sleep 1
7245 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7246 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>
7247 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>
7248 ])
7249 OVS_APP_EXIT_AND_WAIT([test-netflow])
7250 OVS_VSWITCHD_STOP])
7251
7252 AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
7253 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
7254 AT_CLEANUP
7255
7256 AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
7257 AT_SKIP_IF([test $HAVE_IPV6 = no])
7258 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
7259 AT_CLEANUP
7260
7261 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
7262 [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
7263 OVS_VSWITCHD_START(
7264 [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
7265 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
7266 set interface p2 type=$1 ofport_request=2 -- \
7267 set interface p3 type=$1 ofport_request=3], [], [],
7268 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
7269 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7270 ])
7271 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7272
7273 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
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(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
7279 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>
7280 ])
7281 OVS_VSWITCHD_STOP
7282 AT_CLEANUP])
7283
7284 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
7285 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
7286
7287 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
7288 OVS_VSWITCHD_START(
7289 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
7290 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
7291 set interface p2 type=dummy ofport_request=2 -- \
7292 set interface p3 type=dummy ofport_request=3])
7293 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7294 ])
7295 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7296
7297 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
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 sleep 1
7301 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7302 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>
7303 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>
7304 ])
7305 OVS_VSWITCHD_STOP
7306 AT_CLEANUP
7307
7308 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
7309 # Create bond0 on br0 with interfaces p0 and p1
7310 # and bond1 on br1 with interfaces p2 and p3
7311 # with p0 patched to p2 and p1 patched to p3.
7312 OVS_VSWITCHD_START(
7313 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
7314 other-config:lacp-time=fast \
7315 other-config:bond-rebalance-interval=0 -- \
7316 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
7317 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
7318 add-br br1 -- \
7319 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
7320 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
7321 fail-mode=secure -- \
7322 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
7323 other-config:lacp-time=fast \
7324 other-config:bond-rebalance-interval=0 -- \
7325 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
7326 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
7327
7328 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7329 ])
7330 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7331 add_of_ports br0 7
7332 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7333 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
7334 ovs-appctl time/stop
7335 ovs-appctl time/warp 5000
7336 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)'])
7337 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)'])
7338 sleep 1
7339 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7340 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>
7341 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>
7342 ])
7343 OVS_VSWITCHD_STOP
7344 AT_CLEANUP
7345
7346 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
7347 OVS_VSWITCHD_START
7348 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7349 add_of_ports br0 1 2
7350 AT_DATA([flows.txt], [dnl
7351 table=0 in_port=1,ip actions=resubmit(90)
7352 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
7353 ])
7354 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7355 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)'])
7356 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)'])
7357 sleep 1
7358 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7359 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7360 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7361 ])
7362 OVS_VSWITCHD_STOP
7363 AT_CLEANUP
7364
7365 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
7366 OVS_VSWITCHD_START
7367 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7368 add_of_ports br0 1 2
7369 AT_DATA([flows.txt], [dnl
7370 table=0 in_port=1,ip actions=resubmit(,1)
7371 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
7372 ])
7373 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7374 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)'])
7375 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=
7376 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
7377 sleep 1
7378 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7379 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7380 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7381 ])
7382 OVS_VSWITCHD_STOP
7383 AT_CLEANUP
7384
7385 AT_SETUP([ofproto-dpif megaflow - goto_table action])
7386 OVS_VSWITCHD_START
7387 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7388 add_of_ports br0 1 2
7389 AT_DATA([flows.txt], [dnl
7390 table=0 in_port=1,ip actions=goto_table(1)
7391 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
7392 ])
7393 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
7394 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)'])
7395 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)'])
7396 sleep 1
7397 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7398 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7399 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7400 ])
7401 OVS_VSWITCHD_STOP
7402 AT_CLEANUP
7403
7404 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
7405 AT_KEYWORDS([mirror mirrors mirroring])
7406 OVS_VSWITCHD_START
7407 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7408 add_of_ports br0 1 2 3
7409 ovs-vsctl \
7410 set Bridge br0 mirrors=@m --\
7411 --id=@p3 get Port p3 --\
7412 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
7413
7414 AT_DATA([flows.txt], [dnl
7415 in_port=1 actions=output:2
7416 ])
7417 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7418 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)'])
7419 sleep 1
7420 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)'])
7421 sleep 1
7422 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7423 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
7424 ])
7425 OVS_VSWITCHD_STOP
7426 AT_CLEANUP
7427
7428 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
7429 OVS_VSWITCHD_START
7430 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7431 add_of_ports br0 1 2 3
7432 ovs-vsctl \
7433 set Bridge br0 mirrors=@m --\
7434 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
7435 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
7436
7437 AT_DATA([flows.txt], [dnl
7438 in_port=1 actions=output:2
7439 ])
7440 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7441 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))'])
7442 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)'])
7443 sleep 1
7444 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7445 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
7446 recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=11,pcp=7/0x0),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
7447 ])
7448 OVS_VSWITCHD_STOP
7449 AT_CLEANUP
7450
7451 AT_SETUP([ofproto-dpif megaflow - move action])
7452 OVS_VSWITCHD_START
7453 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7454 add_of_ports br0 1 2
7455 AT_DATA([flows.txt], [dnl
7456 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
7457 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
7458 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
7459 ])
7460 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7461 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)'])
7462 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)'])
7463 sleep 1
7464 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7465 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
7466 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
7467 ])
7468 OVS_VSWITCHD_STOP
7469 AT_CLEANUP
7470
7471 AT_SETUP([ofproto-dpif megaflow - push action])
7472 OVS_VSWITCHD_START
7473 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7474 add_of_ports br0 1 2
7475 AT_DATA([flows.txt], [dnl
7476 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
7477 ])
7478 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7479 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)'])
7480 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)'])
7481 sleep 1
7482 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7483 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
7484 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
7485 ])
7486 OVS_VSWITCHD_STOP
7487 AT_CLEANUP
7488
7489 AT_SETUP([ofproto-dpif megaflow - learning])
7490 OVS_VSWITCHD_START
7491 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7492 add_of_ports br0 1 2
7493 AT_DATA([flows.txt], [dnl
7494 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
7495 ])
7496 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7497 ovs-appctl time/stop
7498 # We send each packet twice because the first packet in each flow causes the
7499 # flow table to change and thus revalidations, which (depending on timing)
7500 # can keep a megaflow from being installed. The revalidations are done by
7501 # the second iteration, allowing the flows to be installed.
7502 for i in 1 2; do
7503 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)'])
7504 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)'])
7505 ovs-appctl time/warp 100
7506 done
7507 sleep 1
7508 dnl The original flow is missing due to a revalidation.
7509 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7510 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7511 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7512 ])
7513 OVS_VSWITCHD_STOP
7514 AT_CLEANUP
7515
7516 AT_SETUP([ofproto-dpif megaflow - tunnels])
7517 OVS_VSWITCHD_START(
7518 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
7519 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7520 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
7521 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
7522 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
7523 ofport_request=3])
7524 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
7525 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
7526 ofport_request=4 options:key=flow])
7527 AT_DATA([flows.txt], [dnl
7528 in_port=1,actions=output(2)
7529 in_port=3,actions=output(4)
7530 ])
7531 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7532 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
7533 dnl will cause the packet to be dropped.
7534 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)'])
7535 sleep 1
7536 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)'])
7537 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)'])
7538 sleep 1
7539 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)'])
7540 sleep 1
7541 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7542 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
7543 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
7544 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
7545 ])
7546 OVS_VSWITCHD_STOP
7547 AT_CLEANUP
7548
7549 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
7550 OVS_VSWITCHD_START
7551 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7552 add_of_ports br0 1 2
7553 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], [])
7554 AT_DATA([flows.txt], [dnl
7555 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
7556 ])
7557 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7558 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)'])
7559 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)'])
7560 sleep 1
7561 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7562 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
7563 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,ttl=64,frag=no), actions: <del>
7564 ])
7565 OVS_VSWITCHD_STOP
7566 AT_CLEANUP
7567
7568 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
7569 OVS_VSWITCHD_START
7570 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7571 add_of_ports br0 1 2
7572 AT_DATA([flows.txt], [dnl
7573 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
7574 ])
7575 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7576 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)'])
7577 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)'])
7578 sleep 1
7579 dnl The first packet is essentially a no-op, as the new destination MAC is the
7580 dnl same as the original. The second entry actually updates the destination
7581 dnl MAC.
7582 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7583 recirc_id(0),in_port(1),eth(dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions:2
7584 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
7585 ])
7586 OVS_VSWITCHD_STOP
7587 AT_CLEANUP
7588
7589 m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
7590 [AT_SETUP([ofproto-dpif megaflow - disabled$1])
7591 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7592 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7593 func=`echo -n "$1_" | cut -c 4-`
7594 add_${func}of_ports br0 1 2
7595 AT_DATA([flows.txt], [dnl
7596 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
7597 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
7598 ])
7599 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
7600 ], [])
7601 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7602 ], [])
7603 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
7604 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7605 for i in 1 2 3 4; do
7606 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)'])
7607 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)'])
7608 if [[ $i -eq 1 ]]; then
7609 sleep 1
7610 fi
7611 done
7612 sleep 1
7613 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7614 skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),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
7615 skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),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
7616 ])
7617 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
7618 skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),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:126, used:0.0s, actions:2
7619 skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),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:126, used:0.0s, actions:drop
7620 ])
7621 OVS_VSWITCHD_STOP
7622 AT_CLEANUP])
7623
7624 OFPROTO_DPIF_MEGAFLOW_DISABLED([])
7625 OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
7626
7627 AT_SETUP([ofproto-dpif - datapath port number change])
7628 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
7629 add_of_ports br0 1
7630
7631 # Trace a flow that should output to p1.
7632 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
7633 [0], [stdout])
7634 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
7635 ])
7636
7637 # Change p1's port number to 5.
7638 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
7639
7640 # Trace a flow that should output to p1 in its new location.
7641 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
7642 [0], [stdout])
7643 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
7644 ])
7645 OVS_VSWITCHD_STOP
7646 AT_CLEANUP
7647
7648 # Tests the bundling with various bfd and cfm configurations.
7649 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
7650 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
7651 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
7652 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
7653 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
7654 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
7655 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
7656 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
7657 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
7658 set Interface p0 cfm_mpid=1 -- \
7659 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
7660
7661 ovs-appctl time/stop
7662 # advance the clock to stablize everything.
7663 ovs-appctl time/warp 5000 100
7664 # cfm/show should show 'recv' fault.
7665 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
7666 fault: recv
7667 ])
7668 # bfd/show should show 'up'.
7669 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
7670 Local Session State: up
7671 Remote Session State: up
7672 Local Session State: up
7673 Remote Session State: up
7674 ])
7675 # bond/show should show 'may-enable: true' for all slaves.
7676 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
7677 may_enable: true
7678 may_enable: true
7679 may_enable: true
7680 may_enable: true
7681 ])
7682
7683 # now disable the bfd on p1.
7684 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
7685 # advance the clock to stablize everything.
7686 ovs-appctl time/warp 5000 100
7687 # cfm/show should show 'recv' fault.
7688 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
7689 fault: recv
7690 ])
7691 # bfd/show should show 'down'.
7692 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
7693 Local Session State: down
7694 Remote Session State: down
7695 ])
7696 # bond/show should show 'may-enable: false' for p0.
7697 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
7698 may_enable: false
7699 may_enable: true
7700 ])
7701
7702 # now enable the bfd on p1 and disable bfd on p0.
7703 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
7704 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
7705 # advance the clock to stablize everything.
7706 ovs-appctl time/warp 5000 100
7707 # cfm/show should show 'recv' fault.
7708 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
7709 fault: recv
7710 ])
7711 # bfd/show should show 'down'.
7712 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
7713 Local Session State: down
7714 Remote Session State: down
7715 ])
7716 # bond/show should show 'may-enable: false' for p0 and p1.
7717 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
7718 may_enable: false
7719 may_enable: true
7720 may_enable: false
7721 may_enable: true
7722 ])
7723
7724 OVS_VSWITCHD_STOP
7725 AT_CLEANUP
7726
7727 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
7728 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
7729
7730 # enable bfd on p0.
7731 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
7732 # check log.
7733 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
7734 # disable bfd on p0.
7735 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
7736 # check log.
7737 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
7738 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])
7739
7740 # enable cfm on p0.
7741 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
7742 # check log.
7743 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
7744 # disable cfm on p0.
7745 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
7746 # check log.
7747 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
7748 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])
7749
7750 # enable both bfd and cfm on p0.
7751 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
7752 # check log.
7753 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
7754 # disable bfd on p0.
7755 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
7756 # check log, there should not be the log of thread terminated.
7757 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
7758 ])
7759 # reenable bfd on p0.
7760 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
7761 # check log, should still be on log of thread created.
7762 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
7763 monitor thread created
7764 ])
7765 # disable bfd and cfm together.
7766 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
7767 # check log.
7768 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
7769
7770 OVS_VSWITCHD_STOP
7771 AT_CLEANUP
7772
7773 # this test helps avoid the deadlock between the main thread and monitor thread.
7774 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
7775 OVS_VSWITCHD_START
7776
7777 for i in `seq 1 199`
7778 do
7779 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])
7780 done
7781
7782 OVS_VSWITCHD_STOP
7783 AT_CLEANUP
7784 \f
7785 AT_BANNER([ofproto-dpif - flow translation resource limits])
7786
7787 dnl Resubmits to later tables do not count against the depth limit, so we
7788 dnl can do 99 of them even though the maximum depth is 64.
7789 AT_SETUP([ofproto-dpif - forward resubmit])
7790 OVS_VSWITCHD_START
7791 (for i in `seq 0 99`; do
7792 j=`expr $i + 1`
7793 echo "table=$i, actions=resubmit(,$j)"
7794 done
7795 echo "table=100, actions=local") > flows
7796 AT_CHECK([ovs-ofctl add-flows br0 flows])
7797 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
7798 [0], [stdout])
7799 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
7800 ])
7801 OVS_VSWITCHD_STOP
7802 AT_CLEANUP
7803
7804 dnl Resubmits to the same or an earlier table count against the depth limit,
7805 dnl so only 64 of them are allowed.
7806 AT_SETUP([ofproto-dpif - backward resubmit])
7807 OVS_VSWITCHD_START
7808 (echo "table=0, actions=resubmit(,66)"
7809 for i in `seq 2 66`; do
7810 j=`expr $i - 1`
7811 echo "table=$i, actions=resubmit(,$j)"
7812 done
7813 echo "table=1, actions=local") > flows
7814 AT_CHECK([ovs-ofctl add-flows br0 flows])
7815 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
7816 [0], [stdout])
7817 AT_CHECK([tail -1 stdout], [0],
7818 [Translation failed (Recursion too deep), packet is dropped.
7819 ])
7820 AT_CHECK([grep -c 'over max translation depth 64' stdout],
7821 [0], [1
7822 ])
7823 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
7824 AT_CLEANUP
7825
7826 AT_SETUP([ofproto-dpif - infinite resubmit])
7827 OVS_VSWITCHD_START
7828 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
7829 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
7830 [0], [stdout])
7831 AT_CHECK([tail -1 stdout], [0],
7832 [Translation failed (Recursion too deep), packet is dropped.
7833 ])
7834 AT_CHECK([grep -c 'over max translation depth 64' stdout],
7835 [0], [1
7836 ])
7837 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
7838 AT_CLEANUP
7839
7840 AT_SETUP([ofproto-dpif - exponential resubmit chain])
7841 OVS_VSWITCHD_START
7842 add_of_ports br0 1
7843 (for i in `seq 1 64`; do
7844 j=`expr $i + 1`
7845 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
7846 done
7847 echo "in_port=65, actions=local") > flows
7848 AT_CHECK([ovs-ofctl add-flows br0 flows])
7849 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
7850 AT_CHECK([tail -1 stdout], [0],
7851 [Translation failed (Too many resubmits), packet is dropped.
7852 ])
7853 AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
7854 ])
7855 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
7856 AT_CLEANUP
7857
7858 AT_SETUP([ofproto-dpif - too many output actions])
7859 OVS_VSWITCHD_START
7860 add_of_ports br0 1
7861 (for i in `seq 1 12`; do
7862 j=`expr $i + 1`
7863 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
7864 done
7865 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
7866 AT_CHECK([ovs-ofctl add-flows br0 flows])
7867 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
7868 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
7869 [0], [1
7870 ])
7871 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
7872 ])
7873 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
7874 AT_CLEANUP
7875
7876 AT_SETUP([ofproto-dpif - stack too deep])
7877 OVS_VSWITCHD_START
7878 add_of_ports br0 1
7879 (for i in `seq 1 12`; do
7880 j=`expr $i + 1`
7881 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
7882 done
7883 push="push:NXM_NX_REG0[[]]"
7884 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
7885 AT_CHECK([ovs-ofctl add-flows br0 flows])
7886 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
7887 AT_CHECK([tail -1 stdout], [0],
7888 [Translation failed (Stack too deep), packet is dropped.
7889 ])
7890 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
7891 ])
7892 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
7893 AT_CLEANUP
7894
7895
7896 AT_SETUP([ofproto-dpif packet-out controller])
7897 OVS_VSWITCHD_START
7898 add_of_ports br0 1 2
7899
7900 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
7901
7902 AT_CAPTURE_FILE([ofctl_monitor.log])
7903 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
7904
7905 for i in 1 2 3; do
7906 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
7907 done
7908
7909 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
7910 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7911 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
7912 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7913 dnl
7914 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
7915 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7916 dnl
7917 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
7918 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7919 ])
7920
7921 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
7922 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
7923 NXST_FLOW reply:
7924 ])
7925
7926 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7927 table 0:
7928 active=1, lookup=0, matched=0
7929
7930 table 1:
7931 active=0, lookup=0, matched=0
7932 "
7933 for i in `seq 2 253`; do
7934 printf ' table %d: ditto\n' $i
7935 done) > expout
7936 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7937
7938 OVS_VSWITCHD_STOP
7939 AT_CLEANUP
7940
7941 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
7942 OVS_VSWITCHD_START(
7943 [-- \
7944 add-port br0 p1 -- \
7945 set interface p1 type=patch options:peer=p2 -- \
7946 add-br br1 -- \
7947 set bridge br1 datapath-type=dummy -- \
7948 set bridge br1 fail-mode=secure -- \
7949 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
7950 add-port br1 p2 -- \
7951 set interface p2 type=patch options:peer=p1 --])
7952
7953 AT_CAPTURE_FILE([ofctl_monitor.log])
7954 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
7955
7956 for i in 1 2 3; do
7957 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
7958 done
7959
7960 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
7961 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7962 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
7963 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7964 dnl
7965 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
7966 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7967 dnl
7968 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
7969 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
7970 ])
7971
7972 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7973 table 0:
7974 active=0, lookup=0, matched=0
7975 "
7976 for i in `seq 1 253`; do
7977 printf ' table %d: ditto\n' $i
7978 done) > expout
7979 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7980
7981 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7982 table 0:
7983 active=0, lookup=3, matched=0
7984
7985 table 1:
7986 active=0, lookup=0, matched=0
7987 "
7988 for i in `seq 2 253`; do
7989 printf ' table %d: ditto\n' $i
7990 done) > expout
7991 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
7992
7993 OVS_VSWITCHD_STOP
7994 AT_CLEANUP
7995
7996
7997 AT_SETUP([ofproto-dpif packet-out goto_table])
7998 OVS_VSWITCHD_START
7999 add_of_ports br0 1 2
8000
8001 AT_DATA([flows.txt], [dnl
8002 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
8003 table=1 dl_dst=50:54:00:00:00:0a actions=controller
8004 ])
8005 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
8006
8007 AT_CAPTURE_FILE([ofctl_monitor.log])
8008 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8009
8010 for i in 1 2 3; do
8011 ovs-appctl 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)'
8012 done
8013
8014 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
8015 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8016 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8017 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8018 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8019 dnl
8020 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8021 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8022 dnl
8023 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8024 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8025 ])
8026
8027 AT_CHECK([ovs-appctl revalidator/purge], [0])
8028 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
8029 n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=goto_table:1
8030 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8031 OFPST_FLOW reply (OF1.3):
8032 ])
8033
8034 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8035 table 0:
8036 active=1, lookup=3, matched=3
8037
8038 table 1: ditto
8039 table 2:
8040 active=0, lookup=0, matched=0
8041 "
8042 for i in `seq 3 253`; do
8043 printf ' table %d: ditto\n' $i
8044 done) > expout
8045 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8046
8047 OVS_VSWITCHD_STOP
8048 AT_CLEANUP
8049
8050
8051 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
8052 OVS_VSWITCHD_START
8053 add_of_ports br0 1 2
8054
8055 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
8056 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
8057
8058 AT_CAPTURE_FILE([ofctl_monitor.log])
8059 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8060
8061 for i in 1 2 3; do
8062 ovs-appctl 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)'
8063 done
8064
8065 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
8066 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8067 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8068 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8069 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8070 dnl
8071 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8072 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8073 dnl
8074 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8075 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8076 ])
8077
8078 AT_CHECK([ovs-appctl revalidator/purge], [0])
8079 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
8080 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8081 OFPST_FLOW reply (OF1.1):
8082 ])
8083
8084 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8085 table 0:
8086 active=0, lookup=3, matched=0
8087
8088 table 1:
8089 active=1, lookup=3, matched=3
8090
8091 table 2:
8092 active=0, lookup=0, matched=0
8093 "
8094 for i in `seq 3 253`; do
8095 printf ' table %d: ditto\n' $i
8096 done) > expout
8097 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8098
8099 OVS_VSWITCHD_STOP
8100 AT_CLEANUP
8101
8102 AT_SETUP([ofproto-dpif - ICMPv6])
8103 OVS_VSWITCHD_START
8104 add_of_ports br0 1
8105
8106 AT_CAPTURE_FILE([ofctl_monitor.log])
8107
8108 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8109
8110 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
8111
8112 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8113
8114 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8115 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
8116 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
8117 ])
8118
8119 OVS_VSWITCHD_STOP
8120 AT_CLEANUP
8121
8122 AT_SETUP([ofproto-dpif - ICMPv6 type match])
8123 OVS_VSWITCHD_START
8124 add_of_ports br0 1 2 3
8125
8126 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
8127 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
8128
8129 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8130
8131 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)'])
8132 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)'])
8133 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)'])
8134 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)'])
8135
8136 AT_CHECK([ovs-appctl revalidator/purge], [0])
8137
8138 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8139 recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128), actions:2
8140 recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129), actions:3
8141 ])
8142
8143 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
8144 n_packets=2, n_bytes=124, icmp6,icmp_type=128 actions=output:2
8145 n_packets=2, n_bytes=124, icmp6,icmp_type=129 actions=output:3
8146 NXST_FLOW reply:
8147 ])
8148
8149 OVS_VSWITCHD_STOP
8150 AT_CLEANUP
8151
8152 AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
8153 OVS_VSWITCHD_START
8154 add_of_ports br0 1
8155 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])
8156
8157 AT_CAPTURE_FILE([ofctl_monitor.log])
8158
8159 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8160
8161 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
8162
8163 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8164
8165 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8166 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
8167 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
8168 ])
8169
8170 OVS_VSWITCHD_STOP
8171 AT_CLEANUP
8172
8173 # Tests the exact match of CFI bit in installed datapath flows matching VLAN.
8174 AT_SETUP([ofproto-dpif - vlan matching])
8175 OVS_VSWITCHD_START(
8176 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
8177 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8178
8179 AT_CHECK([ovs-ofctl del-flows br0])
8180 AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
8181
8182 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))'])
8183
8184 OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
8185 AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
8186 recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=10),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
8187 ])
8188 OVS_VSWITCHD_STOP
8189 AT_CLEANUP
8190
8191 # Tests in place modification of installed datapath flows.
8192 AT_SETUP([ofproto-dpif - in place modification])
8193 OVS_VSWITCHD_START(
8194 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8195 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8196
8197 AT_CHECK([ovs-ofctl del-flows br0])
8198 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
8199
8200 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
8201
8202 ovs-appctl time/stop
8203
8204 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)'])
8205
8206 # Wait for the flow setup to be done.
8207 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
8208
8209 for i in 1 2; do
8210 ovs-appctl 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)'
8211 done
8212
8213 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8214 recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
8215 ])
8216
8217 AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
8218
8219 ovs-appctl time/warp 500
8220 ovs-appctl time/warp 500
8221
8222 for i in 1 2 3; do
8223 ovs-appctl 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)'
8224 done
8225
8226 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8227 recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
8228 ])
8229
8230 AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
8231 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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
8232 ])
8233 OVS_VSWITCHD_STOP
8234 AT_CLEANUP
8235
8236 # Tests in place modification of installed datapath flows with vlans.
8237 AT_SETUP([ofproto-dpif - in place modification (vlan)])
8238 OVS_VSWITCHD_START(
8239 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8240 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8241
8242 AT_CHECK([ovs-ofctl del-flows br0])
8243 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
8244
8245 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
8246
8247 ovs-appctl time/stop
8248
8249 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)'])
8250
8251 # Check that a correct datapath flow is created.
8252 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
8253
8254 for i in 1 2; do
8255 ovs-appctl 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)'
8256 done
8257
8258 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8259 recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:100
8260 ])
8261
8262 # Delete the flow. Then check that the datapath flow is modified to
8263 # drop the packets. A modified flow inherits the stats, a new
8264 # datapath flow would start from sero.
8265 AT_CHECK([ovs-ofctl del-flows br0])
8266
8267 ovs-appctl time/warp 500
8268 ovs-appctl time/warp 500
8269
8270 for i in 1 2 3; do
8271 ovs-appctl 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)'
8272 done
8273
8274 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8275 recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:drop
8276 ])
8277
8278 # Add a flow that matches the non-presence of a vlan tag, and check
8279 # that the datapath flow is modified accordingly.
8280 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
8281
8282 ovs-appctl time/warp 500
8283 ovs-appctl time/warp 500
8284
8285 for i in 1 2 3; do
8286 ovs-appctl 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)'
8287 done
8288
8289 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8290 recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
8291 ])
8292
8293 # Check that VLAN packets will not hit the same datapath megaflow.
8294
8295 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))'])
8296 OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
8297
8298 for i in 1 2; do
8299 ovs-appctl 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))'
8300 done
8301
8302 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8303 recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
8304 recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:36, used:0.0s, actions:drop
8305 ])
8306
8307 # Check that the new flow matches the CFI bit, while both vid and pcp
8308 # are wildcarded.
8309 AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
8310 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),eth_type(0x1234), actions:100
8311 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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)
8312 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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
8313 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
8314 ])
8315 OVS_VSWITCHD_STOP
8316 AT_CLEANUP
8317
8318 AT_SETUP([ofproto-dpif - trace (unchanged)])
8319 OVS_VSWITCHD_START
8320 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
8321 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
8322 ])
8323 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
8324 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
8325 ])
8326
8327 OVS_VSWITCHD_STOP
8328 AT_CLEANUP
8329
8330 AT_SETUP([ofproto-dpif - conntrack - controller])
8331 OVS_VSWITCHD_START
8332
8333 add_of_ports br0 1 2
8334
8335 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8336
8337 dnl Allow new connections on p1->p2, but not on p2->p1.
8338 AT_DATA([flows.txt], [dnl
8339 dnl Table 0
8340 dnl
8341 table=0,priority=100,arp,action=normal
8342 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
8343 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
8344 table=0,priority=1,action=drop
8345 dnl
8346 dnl Table 1
8347 dnl
8348 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
8349 table=1,priority=1,action=drop
8350 ])
8351
8352 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8353
8354 AT_CAPTURE_FILE([ofctl_monitor.log])
8355 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8356
8357 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8358
8359 dnl OK, now start a new connection from port 1.
8360 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8361
8362 dnl Now try a reply from port 2.
8363 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8364
8365 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8366 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8367
8368 dnl Check this output. We only see the latter two packets, not the first.
8369 dnl Note that the first packet doesn't have the ct_state bits set. This
8370 dnl happens because the ct_state field is available only after recirc.
8371 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8372 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
8373 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:e9d6
8374 dnl
8375 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,in_port=2 (via action) data_len=42 (unbuffered)
8376 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:e9d6
8377 ])
8378
8379 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8380
8381 dnl OK, now start a second connection from port 1
8382 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=4)'])
8383
8384 dnl Now try a reply from port 2.
8385 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=4,dst=3)'])
8386
8387
8388 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8389 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8390
8391 dnl Check this output. We should see both packets
8392 dnl Note that the first packet doesn't have the ct_state bits set. This
8393 dnl happens because the ct_state field is available only after recirc.
8394 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8395 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
8396 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=4 udp_csum:e9d2
8397 dnl
8398 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,in_port=2 (via action) data_len=42 (unbuffered)
8399 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:e9d2
8400 ])
8401
8402 OVS_VSWITCHD_STOP
8403 AT_CLEANUP
8404
8405 AT_SETUP([ofproto-dpif - conntrack - ipv6])
8406 OVS_VSWITCHD_START
8407
8408 add_of_ports br0 1 2
8409
8410 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8411
8412 dnl Allow new connections on p1->p2, but not on p2->p1.
8413 AT_DATA([flows.txt], [dnl
8414 dnl Table 0
8415 dnl
8416 table=0,priority=100,arp,action=normal
8417 table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
8418 table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
8419 table=0,priority=1,action=drop
8420 dnl Table 1
8421 dnl
8422 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
8423 table=1,priority=1,action=drop
8424 ])
8425
8426 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8427
8428 AT_CAPTURE_FILE([ofctl_monitor.log])
8429 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8430
8431 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x86dd),ipv6(src=2001:db8::2,dst=2001:db8::1,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=2,dst=1)'])
8432
8433 dnl OK, now start a new connection from port 1.
8434 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x86dd),ipv6(src=2001:db8::1,dst=2001:db8::2,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=1,dst=2)'])
8435
8436 dnl Now try a reply from port 2.
8437 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x86dd),ipv6(src=2001:db8::2,dst=2001:db8::1,label=0,proto=17,tclass=0x70,hlimit=128,frag=no),udp(src=2,dst=1)'])
8438
8439 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8440 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8441
8442 dnl Check this output. We only see the latter two packets, not the first.
8443 dnl Note that the first packet doesn't have the ct_state bits set. This
8444 dnl happens because the ct_state field is available only after recirc.
8445 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8446 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
8447 udp6,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,ipv6_src=2001:db8::1,ipv6_dst=2001:db8::2,ipv6_label=0x00000,nw_tos=112,nw_ecn=0,nw_ttl=128,tp_src=1,tp_dst=2 udp_csum:a466
8448 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=62 ct_state=est|rpl|trk,in_port=2 (via action) data_len=62 (unbuffered)
8449 udp6,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,ipv6_src=2001:db8::2,ipv6_dst=2001:db8::1,ipv6_label=0x00000,nw_tos=112,nw_ecn=0,nw_ttl=128,tp_src=2,tp_dst=1 udp_csum:a466
8450 ])
8451
8452 OVS_VSWITCHD_STOP
8453 AT_CLEANUP
8454
8455 AT_SETUP([ofproto-dpif - conntrack - output action])
8456 OVS_VSWITCHD_START
8457
8458 add_of_ports br0 1 2
8459
8460 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8461
8462 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
8463 AT_DATA([flows.txt], [dnl
8464 dnl The flows are in two separate tables for two reasons:
8465 dnl * To make the pipeline more clear.
8466 dnl * To make megaflows more consistent (we check megaflows below). The
8467 dnl unwildcarding in megaflows depends on the internal ordering of the
8468 dnl subtables, which are sorted using the system qsort(). qsort()
8469 dnl is provided by libc and may or may not be stable, so we can't rely
8470 dnl on that. By having separate tables we have more control over which
8471 dnl subtables are visited, meaning consistent megaflows.
8472 dnl
8473 dnl Table 0
8474 dnl
8475 table=0,priority=100,arp,action=normal
8476 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
8477 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
8478 table=0,priority=1,action=drop
8479 dnl
8480 dnl Table 1
8481 dnl
8482 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
8483 table=1,priority=1,action=drop
8484 ])
8485
8486 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8487
8488
8489 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8490
8491 dnl OK, now start a new connection from port 1.
8492 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8493
8494 dnl Now try a reply from port 2.
8495 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8496
8497 dnl OK, now start a second connection from port 1
8498 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8499
8500 dnl Now try a reply from port 2.
8501 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8502
8503
8504 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
8505 ct_state(+new-est+trk),recirc_id(0x1),in_port(2),eth_type(0x0800),ipv4(frag=no), actions:drop
8506 ct_state(-new+est+trk),recirc_id(0x1),in_port(2),eth_type(0x0800),ipv4(proto=17,frag=no), actions:1
8507 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
8508 recirc_id(0),in_port(2),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct,recirc(0x1)
8509 ])
8510
8511 OVS_VSWITCHD_STOP
8512 AT_CLEANUP
8513
8514 AT_SETUP([ofproto-dpif - conntrack - expiration])
8515 OVS_VSWITCHD_START
8516
8517 add_of_ports br0 1 2
8518
8519 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8520
8521 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
8522 AT_DATA([flows.txt], [dnl
8523 dnl Table 0
8524 dnl
8525 table=0,priority=100,arp,action=normal
8526 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
8527 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
8528 table=0,priority=1,action=drop
8529 dnl
8530 dnl Table 1
8531 dnl
8532 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
8533 table=1,priority=1,action=drop
8534 ])
8535
8536 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8537
8538 AT_CAPTURE_FILE([ofctl_monitor.log])
8539 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8540
8541 AT_CHECK([ovs-appctl time/stop])
8542
8543 dnl Start a new connection from port 1.
8544 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8545
8546 dnl Now try a reply from port 2.
8547 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8548
8549 ovs-appctl time/warp 100000
8550
8551 dnl Now try another reply from port 2.
8552 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8553
8554 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
8555 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8556
8557 dnl Check this output. Only one reply must be there
8558 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8559 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,in_port=2 (via action) data_len=42 (unbuffered)
8560 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:e9d6
8561 dnl
8562 OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
8563 ])
8564
8565 OVS_VSWITCHD_STOP
8566 AT_CLEANUP
8567
8568 AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
8569 OVS_VSWITCHD_START
8570
8571 add_of_ports br0 1 2
8572
8573 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8574
8575 AT_DATA([flows.txt], [dnl
8576 ipv6,ct_state=-trk,action=ct(table=0,zone=0)
8577 ct_state=+trk,action=controller
8578 ])
8579
8580 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8581
8582 AT_CAPTURE_FILE([ofctl_monitor.log])
8583 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8584
8585 AT_CHECK([ovs-appctl time/stop])
8586
8587 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
8588
8589 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
8590 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8591
8592 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8593 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,in_port=2 (via action) data_len=86 (unbuffered)
8594 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
8595 ])
8596
8597 OVS_VSWITCHD_STOP
8598 AT_CLEANUP
8599
8600 AT_SETUP([ofproto-dpif - conntrack - zones])
8601 OVS_VSWITCHD_START
8602
8603 add_of_ports br0 1 2 3 4
8604
8605 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8606
8607 dnl Allow new connections on p1->p2 or p3->p4.
8608 dnl Allow only established connections p2->p1 and p4->p3
8609 dnl p1,p2 and p3,p4 are on different zones
8610 AT_DATA([flows.txt], [dnl
8611 dnl Table 0
8612 dnl
8613 table=0,priority=100,arp,action=normal
8614 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
8615 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
8616 table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
8617 table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
8618 table=0,priority=1,action=drop
8619 dnl
8620 dnl Table 1
8621 dnl
8622 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
8623 table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
8624 table=1,priority=1,action=drop
8625 ])
8626
8627 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8628
8629 AT_CAPTURE_FILE([ofctl_monitor.log])
8630 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8631
8632 dnl Basic "only established" test on ports 1,2
8633
8634 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8635 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8636 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8637
8638 dnl Now use the same 5-tuples but on ports 3,4
8639
8640 AT_CHECK([ovs-appctl netdev-dummy/receive p4 'in_port(4),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8641 AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8642 AT_CHECK([ovs-appctl netdev-dummy/receive p4 'in_port(4),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8643
8644 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
8645 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8646
8647 dnl Check this output. We only see the latter two packets (for each zone), not the first.
8648 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8649 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
8650 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:e9d6
8651 dnl
8652 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,in_port=2 (via action) data_len=42 (unbuffered)
8653 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:e9d6
8654 dnl
8655 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=3 (via action) data_len=42 (unbuffered)
8656 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:e9d6
8657 dnl
8658 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_zone=1,in_port=4 (via action) data_len=42 (unbuffered)
8659 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:e9d6
8660 ])
8661
8662 OVS_VSWITCHD_STOP
8663 AT_CLEANUP
8664
8665 AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
8666 OVS_VSWITCHD_START
8667
8668 add_of_ports br0 1 2
8669
8670 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8671
8672 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
8673 AT_DATA([flows.txt], [dnl
8674 dnl Table 0
8675 dnl
8676 table=0,priority=100,arp,action=normal
8677 table=0,priority=10,udp,action=ct(table=1,zone=0)
8678 table=0,priority=1,action=drop
8679 dnl
8680 dnl Table 1
8681 dnl
8682 table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
8683 table=1,priority=10,ct_state=+trk+est,udp,action=controller
8684 table=1,priority=1,action=drop
8685 ])
8686
8687 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8688
8689 AT_CAPTURE_FILE([ofctl_monitor.log])
8690 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8691
8692 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8693
8694 dnl OK, now start a new connection from port 1.
8695 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8696
8697 dnl Now try a reply from port 2.
8698 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8699
8700 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8701 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8702
8703 dnl Check this output. We only see the latter two packets, not the first.
8704 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8705 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=new|trk,in_port=1 (via action) data_len=42 (unbuffered)
8706 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:e9d6
8707 dnl
8708 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,in_port=2 (via action) data_len=42 (unbuffered)
8709 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:e9d6
8710 ])
8711
8712 OVS_VSWITCHD_STOP
8713 AT_CLEANUP
8714
8715 AT_SETUP([ofproto-dpif - conntrack - ICMP related])
8716 OVS_VSWITCHD_START
8717
8718 add_of_ports br0 1 2
8719
8720 dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
8721 AT_DATA([flows.txt], [dnl
8722 dnl Table 0
8723 dnl
8724 table=0,priority=100,arp,action=normal
8725 table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
8726 table=0,priority=10,ip,in_port=2,action=ct(table=1)
8727 table=0,priority=1,action=drop
8728 dnl
8729 dnl Table 1
8730 dnl
8731 table=1,priority=10,in_port=1,ct_state=+trk,action=controller
8732 table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
8733 table=1,priority=1,action=drop
8734 ])
8735
8736 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8737
8738 AT_CAPTURE_FILE([ofctl_monitor.log])
8739 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8740
8741 dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
8742 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
8743
8744 dnl 2. Send and UDP packet to port 5555
8745 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
8746
8747 dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
8748 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
8749
8750 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8751 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8752
8753 dnl Check this output. We only see the first and the last packet
8754 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8755 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=47 ct_state=new|trk,in_port=1 (via action) data_len=47 (unbuffered)
8756 udp,vlan_tci=0x0000,dl_src=e6:4c:47:35:28:c9,dl_dst=c6:f9:4e:cb:72:db,nw_src=172.16.0.1,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=41614,tp_dst=5555 udp_csum:2096
8757 dnl
8758 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=75 ct_state=rel|rpl|trk,in_port=2 (via action) data_len=75 (unbuffered)
8759 icmp,vlan_tci=0x0000,dl_src=c6:f9:4e:cb:72:db,dl_dst=e6:4c:47:35:28:c9,nw_src=172.16.0.2,nw_dst=172.16.0.1,nw_tos=192,nw_ecn=0,nw_ttl=64,icmp_type=3,icmp_code=3 icmp_csum:553f
8760 ])
8761
8762 OVS_VSWITCHD_STOP
8763 AT_CLEANUP
8764
8765 AT_SETUP([ofproto-dpif - conntrack - ct_mark])
8766 OVS_VSWITCHD_START
8767
8768 add_of_ports br0 1 2
8769
8770 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8771
8772 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
8773 AT_DATA([flows.txt], [dnl
8774 dnl Table 0
8775 dnl
8776 table=0,arp,action=normal
8777 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
8778 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
8779 table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
8780 table=0,ip,in_port=2,actions=ct(table=1)
8781 table=0,priority=0,action=drop
8782 dnl
8783 dnl Table 1
8784 dnl
8785 table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
8786 table=1,priority=1,action=drop
8787 ])
8788
8789 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8790
8791 AT_CAPTURE_FILE([ofctl_monitor.log])
8792 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8793
8794 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8795 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=4)'])
8796 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=5,dst=6)'])
8797
8798 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8799 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=4,dst=3)'])
8800 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=6,dst=5)'])
8801
8802 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
8803 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8804
8805 dnl Check this output.
8806 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8807 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 ct_mark=0x1,in_port=1 (via action) data_len=42 (unbuffered)
8808 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=1,tp_dst=2 udp_csum:e9d6
8809 dnl
8810 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 ct_mark=0x3,in_port=1 (via action) data_len=42 (unbuffered)
8811 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=4 udp_csum:e9d2
8812 dnl
8813 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 ct_mark=0x5,in_port=1 (via action) data_len=42 (unbuffered)
8814 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=5,tp_dst=6 udp_csum:e9ce
8815 dnl
8816 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_mark=0x1,in_port=2 (via action) data_len=42 (unbuffered)
8817 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:e9d6
8818 dnl
8819 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_mark=0x3,in_port=2 (via action) data_len=42 (unbuffered)
8820 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:e9d2
8821 ])
8822
8823 OVS_VSWITCHD_STOP
8824 AT_CLEANUP
8825
8826 AT_SETUP([ofproto-dpif - conntrack - ct_label])
8827 OVS_VSWITCHD_START
8828
8829 add_of_ports br0 1 2
8830
8831 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8832
8833 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
8834 AT_DATA([flows.txt], [dnl
8835 dnl Table 0
8836 dnl
8837 table=0,arp,action=normal
8838 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
8839 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
8840 table=0,ip,in_port=2,actions=ct(table=1)
8841 dnl
8842 dnl Table 1
8843 dnl
8844 table=1,priority=10,ct_state=+trk+rpl,actions=controller
8845 table=1,priority=1,action=drop
8846 ])
8847
8848 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8849
8850 AT_CAPTURE_FILE([ofctl_monitor.log])
8851 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8852
8853 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8854 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=4)'])
8855
8856 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8857 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=4,dst=3)'])
8858
8859 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8860 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8861
8862 dnl Check this output.
8863 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8864 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_label=0x1,in_port=2 (via action) data_len=42 (unbuffered)
8865 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:e9d6
8866 dnl
8867 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_label=0x2,in_port=2 (via action) data_len=42 (unbuffered)
8868 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4,tp_dst=3 udp_csum:e9d2
8869 ])
8870
8871 OVS_VSWITCHD_STOP
8872 AT_CLEANUP
8873
8874 AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
8875 OVS_VSWITCHD_START
8876
8877 add_of_ports br0 1 2
8878
8879 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8880
8881 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
8882 AT_DATA([flows.txt], [dnl
8883 dnl The flows are in two separate tables for two reasons:
8884 dnl * To make the pipeline more clear.
8885 dnl * To make megaflows more consistent (we check megaflows below). The
8886 dnl unwildcarding in megaflows depends on the internal ordering of the
8887 dnl subtables, which are sorted using the system qsort(). qsort()
8888 dnl is provided by libc and may or may not be stable, so we can't rely
8889 dnl on that. By having separate tables we have more control over which
8890 dnl subtables are visited, meaning consistent megaflows.
8891 dnl
8892 dnl Table 0
8893 dnl
8894 table=0,arp,action=normal
8895 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
8896 table=0,ip,in_port=2,actions=ct(table=1)
8897 table=0,priority=0,action=drop
8898 dnl
8899 dnl Table 1
8900 dnl
8901 table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
8902 table=1,priority=1,action=drop
8903 ])
8904
8905 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8906
8907 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8908 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=1)'])
8909
8910 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
8911 ct_state(+rpl+trk),ct_label(0x1),recirc_id(0x1),in_port(2),eth_type(0x0800),ipv4(frag=no), actions:1
8912 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=no),udp(src=1), actions:ct(commit,label=0x1),2
8913 recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
8914 ])
8915
8916 OVS_VSWITCHD_STOP
8917 AT_CLEANUP
8918
8919 AT_SETUP([ofproto-dpif - conntrack - no output])
8920 OVS_VSWITCHD_START
8921
8922 add_of_ports br0 1
8923
8924 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8925
8926 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
8927 AT_DATA([flows.txt], [dnl
8928 in_port=1,udp,action=ct(commit,zone=0)
8929 ])
8930
8931 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8932
8933 dnl Start a new connection from port 1.
8934 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=1,dst=2)'])
8935
8936 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
8937 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
8938 ])
8939
8940 OVS_VSWITCHD_STOP
8941 AT_CLEANUP
8942
8943 AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
8944 OVS_VSWITCHD_START
8945
8946 add_of_ports br0 1 2
8947
8948 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8949
8950 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
8951 AT_DATA([flows.txt], [dnl
8952 dnl Table 0
8953 dnl
8954 table=0,priority=100,arp,action=normal
8955 table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
8956 table=0,priority=10,in_port=2,ip,action=ct(table=1)
8957 table=0,priority=1,action=drop
8958 dnl
8959 dnl Table 1
8960 dnl
8961 dnl The following two flows are separated to explicitly count the packets
8962 dnl that create a new connection
8963 table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
8964 table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
8965 dnl
8966 table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
8967 table=1,ip,ct_state=+trk+inv,action=drop
8968 ])
8969
8970 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8971
8972 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
8973 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
8974 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
8975 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
8976 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
8977 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
8978 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
8979 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
8980 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
8981
8982 AT_CHECK([ovs-appctl revalidator/purge])
8983 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
8984 dnl Only one new connection
8985 n_packets=1
8986 ])
8987
8988 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
8989 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
8990 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
8991 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
8992 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
8993 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
8994 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
8995 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
8996 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
8997
8998 AT_CHECK([ovs-appctl revalidator/purge])
8999 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9000 dnl Two new connections
9001 n_packets=2
9002 ])
9003
9004 OVS_VSWITCHD_STOP
9005 AT_CLEANUP
9006
9007 AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
9008 OVS_VSWITCHD_START
9009
9010 add_of_ports br0 1 2
9011
9012 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9013
9014 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9015 AT_DATA([flows.txt], [dnl
9016 dnl Table 0
9017 dnl
9018 table=0,priority=100,arp,action=normal
9019 table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
9020 table=0,priority=10,in_port=2,tcp,action=ct(table=1)
9021 table=0,priority=1,action=drop
9022 dnl
9023 dnl Table 1
9024 dnl
9025 table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
9026 table=1,priority=1,action=drop
9027 ])
9028
9029 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9030
9031 AT_CHECK([ovs-appctl revalidator/purge])
9032 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9033 dnl No dropped packets
9034 n_packets=0
9035 ])
9036
9037 AT_CAPTURE_FILE([ofctl_monitor.log])
9038 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9039
9040 dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
9041 dnl sure that the connection tracker is able to pick up already established
9042 dnl connections that use window scaling.
9043 dnl
9044 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
9045 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
9046 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
9047 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
9048 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
9049 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a08004500022afc284000400626a10a0101020a01010100020001396bb35b8cadbdb45018000a941f0000 dnl
9050 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9051 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9052 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9053 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9054 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9055 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9056 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9057 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9058 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9059 6666666666666666666666666666666666666666666666666666660a'])
9060 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
9061 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a5054000000090800450001fdf2ca40004006302c0a0101010a010102000100028cadbdb4396bb55d5018000aa60c0000 dnl
9062 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9063 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9064 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9065 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9066 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9067 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9068 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9069 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9070 6565656565656565656565656565656565656565656565656565656565656565656565650a'])
9071 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
9072 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
9073 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
9074 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
9075 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
9076
9077 AT_CHECK([ovs-appctl revalidator/purge])
9078
9079 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9080
9081 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9082 ])
9083
9084 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9085 dnl No dropped packets
9086 n_packets=0
9087 ])
9088
9089 OVS_VSWITCHD_STOP
9090 AT_CLEANUP
9091
9092 AT_SETUP([ofproto - set mtu])
9093 OVS_VSWITCHD_START
9094
9095 add_of_ports br0 1
9096
9097 # Check that initial MTU is 1500 for 'br0' and 'p1'.
9098 AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
9099 1500
9100 ])
9101 AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
9102 1500
9103 ])
9104
9105 # Request new MTU for 'p1'
9106 AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
9107
9108 # Check that the new MTU is applied
9109 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p1 mtu=1600])
9110 # The internal port 'br0' should have the same MTU value as p1, becase it's
9111 # the new bridge minimum.
9112 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
9113
9114 AT_CHECK([ovs-vsctl del-port br0 p1])
9115
9116 # When 'p1' is deleted, the internal port should return to the default MTU
9117 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1500])
9118
9119 # New port with 'mtu_request' in the same transaction.
9120 AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
9121 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1600])
9122 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
9123
9124 # Explicitly set mtu_request on the internal interface. This should prevent
9125 # the MTU from being overriden.
9126 AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
9127 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
9128
9129 # The new MTU on p2 should not affect br0.
9130 AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
9131 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1400])
9132 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
9133
9134 # Remove explicit mtu_request from br0. Now it should track the bridge
9135 # minimum again.
9136 AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
9137 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1400])
9138
9139 OVS_VSWITCHD_STOP
9140 AT_CLEANUP
9141
9142 AT_SETUP([ofproto - fragment prerequisites])
9143 OVS_VSWITCHD_START
9144
9145 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9146
9147 add_of_ports br0 1
9148
9149 AT_DATA([flows.txt], [dnl
9150 priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
9151 priority=1,in_port=1,udp,action=drop
9152 ])
9153
9154 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9155
9156 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
9157
9158 ovs-appctl time/stop
9159 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
9160 ovs-appctl time/warp 5000
9161
9162 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9163 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
9164 ])
9165
9166 dnl Change the flow table. This will trigger revalidation of all the flows.
9167 AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
9168 AT_CHECK([ovs-appctl revalidator/wait], [0])
9169
9170 dnl We don't want revalidators to delete any flow. If the flow has been
9171 dnl deleted it means that there's some inconsistency with the revalidation.
9172 AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
9173
9174 OVS_VSWITCHD_STOP
9175 AT_CLEANUP