]> git.proxmox.com Git - ovs.git/blob - tests/ofproto-dpif.at
Revert "tunneling: Avoid recirculation on datapath."
[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,vlan_tci1=0x0000,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:2e7e
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,vlan_tci1=0x0000,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:2e7e
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,vlan_tci1=0x0000,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:2e7e
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,vlan_tci1=0x0000,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
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,vlan_tci1=0x0000,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
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,vlan_tci1=0x0000,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
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,vlan_tci1=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:2e7d
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:4880
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:6082
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=11,tcp_flags=fin tcp_csum:6035
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86,tcp_flags=fin tcp_csum:5fea
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86,tcp_flags=fin tcp_csum:5fea
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,vlan_tci1=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:2c37
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:4439
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=11 udp_csum:43ec
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 udp_csum:43a1
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 udp_csum:43a1
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,vlan_tci1=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=2223 sctp_csum:dd778f5f
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 sctp_csum:62051f56
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,vlan_tci1=0x0000,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 sctp_csum:62051f56
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 - controller action without megaflows])
1631 OVS_VSWITCHD_START
1632 add_of_ports br0 1
1633
1634 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,action=controller])
1635 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [dnl
1636 megaflows disabled
1637 ])
1638
1639 AT_CAPTURE_FILE([ofctl_monitor.log])
1640 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1641
1642 for i in 1 2; do
1643 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)'])
1644 done
1645
1646 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
1647 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1648
1649 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1650 flow-dump from non-dpdk interfaces:
1651 packets:1, bytes:14, used:0.001s, actions:userspace(pid=0,slow_path(controller))
1652 ])
1653
1654 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1655 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1656 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1657 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1658 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1659 ])
1660
1661 AT_CHECK([ovs-appctl revalidator/purge])
1662 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1663
1664 dnl Add a controller meter.
1665 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=controller pktps stats bands=type=drop rate=1'])
1666
1667 dnl Advance time by 1 second.
1668 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1669
1670 for i in `seq 1 8`; do
1671 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x4321)'])
1672 done
1673
1674 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1675 flow-dump from non-dpdk interfaces:
1676 packets:7, bytes:98, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,slow_path(controller))))
1677 ])
1678
1679 AT_CHECK([ovs-appctl time/warp 1], [0], [ignore])
1680 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1681
1682 dnl Out of 8 packets we sent, one executes the controller action via
1683 dnl miss upcall. Another one got passed the rate limiter.
1684 dnl The rest of packets are blocked by the rate limiter.
1685 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1686 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1687 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1688 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1689 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1690 ])
1691 dnl Check meter stats to make it gives the same picture;
1692 dnl 7 packets hit the meter, but 6 packets are dropped by band0.
1693 AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
1694 OFPST_METER reply (OF1.3) (xid=0x2):
1695 meter:controller flow_count:0 packet_in_count:7 byte_in_count:98 duration:0.0s bands:
1696 0: packet_count:6 byte_count:84
1697 ])
1698
1699 OVS_VSWITCHD_STOP
1700 AT_CLEANUP
1701
1702 AT_SETUP([ofproto-dpif - MPLS handling])
1703 OVS_VSWITCHD_START([dnl
1704 add-port br0 p1 -- set Interface p1 type=dummy
1705 ])
1706 on_exit 'kill `cat ovs-ofctl.pid`'
1707
1708 AT_CAPTURE_FILE([ofctl_monitor.log])
1709 AT_DATA([flows.txt], [dnl
1710 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
1711 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
1712 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
1713 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
1714 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
1715 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
1716 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
1717 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
1718 cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
1719 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1720 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1721 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
1722
1723 cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1724 cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1725 cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1726 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
1727 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
1728 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
1729 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
1730
1731 cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1732 cookie=0xd table=1 arp actions=controller
1733
1734 cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1735 cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1736 cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1737 cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1738
1739 cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1740 cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1741 cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1742
1743 cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
1744 cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1745 cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1746
1747 cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1748 cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1749 cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1750
1751 cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1752 cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1753 cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1754
1755 cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1756 cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1757 cookie=0x5 dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
1758 ])
1759 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1760
1761 dnl Modified MPLS controller action.
1762 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1763
1764 for i in 1 2 3; do
1765 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)'
1766 done
1767 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1768 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1769
1770 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1771 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
1772 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
1773 dnl
1774 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
1775 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
1776 dnl
1777 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
1778 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
1779 ])
1780
1781 dnl Modified MPLS controller action.
1782 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1783
1784 for i in 1 2 3; do
1785 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=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)'
1786 done
1787 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1788 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1789
1790 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1791 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
1792 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
1793 dnl
1794 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
1795 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
1796 dnl
1797 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
1798 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
1799 ])
1800
1801 dnl Modified MPLS controller action.
1802 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1803
1804 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)
1805
1806 for i in 1 2 3; do
1807 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:43,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1)'
1808 done
1809 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1810 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1811
1812 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1813 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1814 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
1815 dnl
1816 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1817 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
1818 dnl
1819 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1820 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
1821 ])
1822
1823 dnl Modified MPLS controller action.
1824 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1825
1826 for i in 1 2 3; do
1827 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=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))'
1828 done
1829 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1830 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1831
1832 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1833 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1834 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1835 dnl
1836 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1837 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1838 dnl
1839 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1840 mpls,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1841 ])
1842
1843 dnl Modified MPLS controller action.
1844 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1845
1846 for i in 1 2 3; do
1847 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=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)'
1848 done
1849 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1850 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1851
1852 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1853 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1854 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
1855 dnl
1856 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1857 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
1858 dnl
1859 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1860 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
1861 ])
1862
1863 dnl Modified MPLS controller action.
1864 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1865
1866 for i in 1 2 3; do
1867 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)'
1868 done
1869 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1870 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1871
1872 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1873 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1874 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
1875 dnl
1876 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1877 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
1878 dnl
1879 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1880 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
1881 ])
1882
1883 dnl Modified MPLS controller action.
1884 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1885
1886 for i in 1 2 3; do
1887 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)'
1888 done
1889 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1890 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1891
1892 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1893 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1894 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
1895 dnl
1896 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1897 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
1898 dnl
1899 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1900 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
1901 ])
1902
1903 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1904
1905 dnl Modified MPLS controller action.
1906 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1907
1908 for i in 1 2 3; do
1909 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)'
1910 done
1911 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1912 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1913
1914 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1915 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1916 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
1917 dnl
1918 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1919 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
1920 dnl
1921 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1922 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
1923 ])
1924
1925 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1926
1927 dnl Modified MPLS controller action.
1928 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1929
1930 for i in 1 2 3; do
1931 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)'
1932 done
1933 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1934 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1935
1936 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1937 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1938 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
1939 dnl
1940 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1941 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
1942 dnl
1943 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1944 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
1945 ])
1946
1947 dnl Modified MPLS actions.
1948 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1949
1950 for i in 1 2 3; do
1951 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)'
1952 done
1953 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1954 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1955
1956 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1957 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
1958 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
1959 dnl
1960 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
1961 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
1962 dnl
1963 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
1964 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
1965 ])
1966
1967 dnl Modified MPLS ipv6 controller action.
1968 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1969
1970 for i in 1 2 3; do
1971 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)'
1972 done
1973 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1974 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1975
1976 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1977 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1978 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
1979 dnl
1980 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1981 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
1982 dnl
1983 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1984 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
1985 ])
1986
1987
1988 dnl Modified MPLS pop action.
1989 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
1990 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)
1991 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
1992
1993 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1994
1995 for i in 1 2 3; do
1996 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'
1997 done
1998 #for i in 2 3; do
1999 # 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)'
2000 #done
2001 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2002 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2003
2004 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2005 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2006 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
2007 dnl
2008 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2009 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
2010 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: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
2013 ])
2014
2015 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2016
2017 dnl Modified MPLS pop action.
2018 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2019 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)
2020 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2021 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2022 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2023
2024 for i in 1 2 3; do
2025 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'
2026 done
2027 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2028 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2029
2030 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2031 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2032 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
2033 dnl
2034 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2035 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
2036 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: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
2039 ])
2040
2041 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2042
2043 dnl Modified MPLS pop action.
2044 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2045 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)
2046 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2047 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2048 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2049
2050 for i in 1 2 3; do
2051 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'
2052 done
2053 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2054 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2055
2056 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2057 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2058 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
2059 dnl
2060 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2061 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
2062 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: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
2065 ])
2066
2067 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2068
2069 dnl Modified MPLS pop action.
2070 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2071 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)
2072 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2073 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2074 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2075
2076 for i in 1 2 3; do
2077 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'
2078 done
2079 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2080 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2081
2082 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2083 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2084 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
2085 dnl
2086 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2087 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
2088 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: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
2091 ])
2092
2093 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2094
2095 dnl Modified MPLS pop action.
2096 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2097 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)
2098 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2099 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2100 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2101
2102 for i in 1 2 3; do
2103 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'
2104 done
2105 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2106 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2107
2108 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2109 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2110 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
2111 dnl
2112 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2113 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
2114 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: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
2117 ])
2118
2119 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2120
2121 dnl Modified MPLS pop action.
2122 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2123 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)
2124 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2125 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2126 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2127
2128 for i in 1 2 3; do
2129 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'
2130 done
2131 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2132 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2133
2134 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2135 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2136 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
2137 dnl
2138 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2139 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
2140 dnl
2141 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2142 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
2143 ])
2144
2145 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2146
2147 dnl Modified MPLS pop action.
2148 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2149 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)
2150 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2151 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2152 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2153
2154 for i in 1 2 3; do
2155 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'
2156 done
2157 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2158 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2159
2160 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2161 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2162 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
2163 dnl
2164 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2165 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
2166 dnl
2167 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2168 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
2169 ])
2170
2171 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2172
2173 dnl Modified MPLS pop action.
2174 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2175 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)
2176 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2177 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2178 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2179
2180 for i in 1 2 3; do
2181 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'
2182 done
2183 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2184 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2185
2186 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2187 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2188 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
2189 dnl
2190 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2191 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
2192 dnl
2193 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2194 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
2195 ])
2196
2197 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2198
2199 dnl Modified MPLS pop action.
2200 dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2201 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)
2202 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2203
2204 for i in 1 2 3; do
2205 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'
2206 done
2207 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2208 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2209
2210 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2211 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2212 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
2213 dnl
2214 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2215 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
2216 dnl
2217 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2218 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
2219 ])
2220
2221 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2222
2223 dnl Modified MPLS pop action.
2224 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2225 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)
2226 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2227 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2228 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2229
2230 for i in 1 2 3; do
2231 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'
2232 done
2233 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2234 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2235
2236 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2237 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2238 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
2239 dnl
2240 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2241 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
2242 dnl
2243 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2244 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
2245 ])
2246
2247 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2248
2249 dnl Modified MPLS pop action.
2250 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2251 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)
2252 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2253 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2254 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2255
2256 for i in 1 2 3; do
2257 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'
2258 done
2259 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2260 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2261
2262 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2263 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2264 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
2265 dnl
2266 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2267 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
2268 dnl
2269 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2270 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
2271 ])
2272
2273 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2274
2275 dnl Modified MPLS pop action.
2276 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2277 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)
2278 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2279 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2280 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2281
2282 for i in 1 2 3; do
2283 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'
2284 done
2285 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2286 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2287
2288 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2289 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2290 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
2291 dnl
2292 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2293 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
2294 dnl
2295 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2296 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
2297 ])
2298
2299 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2300
2301 dnl Modified MPLS pop action.
2302 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2303 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)
2304 dnl (label 20, exp 0, [S], ttl 31)
2305 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2306 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2307 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2308
2309 for i in 1 2 3; do
2310 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'
2311 done
2312 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2313 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2314
2315 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2316 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2317 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
2318 dnl
2319 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2320 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
2321 dnl
2322 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2323 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
2324 ])
2325
2326 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2327
2328 dnl Modified MPLS pop action.
2329 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2330 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)
2331 dnl (label 20, exp 0, [S], ttl 31)
2332 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2333 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2334 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2335
2336 for i in 1 2 3; do
2337 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 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'
2338 done
2339 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2340 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2341
2342 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2343 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2344 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
2345 dnl
2346 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2347 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
2348 dnl
2349 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2350 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
2351 ])
2352
2353 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2354
2355 dnl Modified MPLS pop action.
2356 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2357 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)
2358 dnl (label 20, exp 0, [S], ttl 31)
2359 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2360 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2361 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2362
2363 for i in 1 2 3; do
2364 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'
2365 done
2366 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2367 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2368
2369 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2370 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2371 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
2372 dnl
2373 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2374 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
2375 dnl
2376 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2377 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
2378 ])
2379
2380 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2381
2382 dnl Modified MPLS pop action.
2383 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2384 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)
2385 dnl (label 20, exp 0, [S], ttl 31)
2386 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2387 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2388 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2389
2390 for i in 1 2 3; do
2391 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'
2392 done
2393 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2394 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2395
2396 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2397 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2398 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
2399 dnl
2400 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2401 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
2402 dnl
2403 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2404 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
2405 ])
2406
2407 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2408
2409 dnl Modified MPLS pop action.
2410 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2411 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)
2412 dnl (label 20, exp 0, [S], ttl 31)
2413 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2414 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2415 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2416
2417 for i in 1 2 3; do
2418 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'
2419 done
2420
2421 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2422 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2423
2424 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2425 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2426 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
2427 dnl
2428 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2429 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
2430 dnl
2431 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2432 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
2433 ])
2434
2435 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2436
2437 dnl Modified MPLS pop action.
2438 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2439 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)
2440 dnl (label 20, exp 0, [S], ttl 31)
2441 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2442 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2443 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2444
2445 for i in 1 2 3; do
2446 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'
2447 done
2448 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2449 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2450
2451 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2452 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2453 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
2454 dnl
2455 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2456 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
2457 dnl
2458 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2459 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
2460 ])
2461
2462 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2463
2464 dnl Modified MPLS pop action.
2465 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2466 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)
2467 dnl (label 20, exp 0, ttl 31)
2468 dnl (label 20, exp 0, [S], ttl 30)
2469 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2470 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2471 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2472
2473 for i in 1 2 3; do
2474 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'
2475 done
2476 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2477 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2478
2479 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2480 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2481 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
2482 dnl
2483 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2484 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
2485 dnl
2486 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2487 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
2488 ])
2489
2490 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2491
2492 dnl Modified MPLS pop action.
2493 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2494 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)
2495 dnl (label 20, exp 0, ttl 31)
2496 dnl (label 20, exp 0, [S], ttl 30)
2497 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2498 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2499 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2500
2501 for i in 1 2 3; do
2502 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'
2503 done
2504 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2505 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2506
2507 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2508 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2509 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
2510 dnl
2511 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2512 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
2513 dnl
2514 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2515 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
2516 ])
2517
2518 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2519
2520 dnl Modified MPLS pop action.
2521 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2522 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)
2523 dnl (label 20, exp 0, ttl 31)
2524 dnl (label 20, exp 0, [S], ttl 30)
2525 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2526 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2527 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2528
2529 for i in 1 2 3; do
2530 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'
2531 done
2532 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2533 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2534
2535 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2536 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2537 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
2538 dnl
2539 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2540 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
2541 dnl
2542 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2543 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
2544 ])
2545
2546 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2547
2548 dnl Modified MPLS pop action.
2549 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2550 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)
2551 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2552 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2553 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2554
2555 for i in 1 2 3; do
2556 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'
2557 done
2558 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2559 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2560
2561 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2562 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2563 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
2564 dnl
2565 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2566 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
2567 dnl
2568 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2569 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
2570 ])
2571
2572 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2573
2574 dnl Modified MPLS pop action.
2575 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2576 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)
2577 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2578 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2579 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2580
2581 for i in 1 2 3; do
2582 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'
2583 done
2584 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2585 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2586
2587 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2588 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2589 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
2590 dnl
2591 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2592 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
2593 dnl
2594 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2595 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
2596 ])
2597
2598 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2599
2600 dnl Modified MPLS pop action.
2601 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2602 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)
2603 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2604 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2605 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2606
2607 for i in 1 2 3; do
2608 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'
2609 done
2610 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2611 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2612
2613 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2614 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2615 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
2616 dnl
2617 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2618 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
2619 dnl
2620 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2621 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
2622 ])
2623
2624 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2625
2626 dnl Modified MPLS pop action.
2627 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2628 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)
2629 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2630 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2631 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2632
2633 for i in 1 2 3; do
2634 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'
2635 done
2636
2637 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2638 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2639
2640 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2641 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2642 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
2643 dnl
2644 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2645 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
2646 dnl
2647 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2648 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
2649 ])
2650
2651 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2652
2653 dnl Modified MPLS pop action.
2654 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2655 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)
2656 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2657 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2658 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2659
2660 for i in 1 2 3; do
2661 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'
2662 done
2663 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2664 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2665
2666 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2667 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2668 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
2669 dnl
2670 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2671 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
2672 dnl
2673 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2674 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
2675 ])
2676
2677 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2678
2679 dnl Modified MPLS pop action.
2680 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2681 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)
2682 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2683 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2684 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2685
2686 for i in 1 2 3; do
2687 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'
2688 done
2689
2690 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2691 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2692
2693 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2694 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2695 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
2696 dnl
2697 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2698 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
2699 dnl
2700 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2701 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
2702 ])
2703
2704 AT_CHECK([ovs-appctl revalidator/purge], [0])
2705 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2706 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
2707 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
2708 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
2709 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
2710 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
2711 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
2712 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
2713 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
2714 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
2715 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
2716 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
2717 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
2718 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
2719 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
2720 cookie=0xd, n_packets=3, n_bytes=138, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
2721 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
2722 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
2723 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
2724 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
2725 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
2726 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
2727 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
2728 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
2729 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
2730 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
2731 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
2732 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2733 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
2734 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
2735 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
2736 cookie=0xd, table=1, n_packets=3, n_bytes=126, arp actions=CONTROLLER:65535
2737 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
2738 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
2739 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
2740 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
2741 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
2742 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
2743 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
2744 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
2745 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
2746 NXST_FLOW reply:
2747 ])
2748
2749 OVS_VSWITCHD_STOP
2750 AT_CLEANUP
2751
2752 AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2753 OVS_VSWITCHD_START([dnl
2754 add-port br0 p1 -- set Interface p1 type=dummy
2755 ])
2756 on_exit 'kill `cat ovs-ofctl.pid`'
2757
2758 AT_CAPTURE_FILE([ofctl_monitor.log])
2759 AT_DATA([flows.txt], [dnl
2760 table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2761 table=1 ip,ip_dscp=8 actions=controller
2762 ])
2763 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2764
2765
2766 dnl Modified MPLS pop action.
2767 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2768 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)
2769 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2770 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2771 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
2772
2773 for i in 1 2 3; do
2774 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'
2775 done
2776 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2777 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2778
2779 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2780 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2781 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
2782 dnl
2783 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2784 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
2785 dnl
2786 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2787 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
2788 ])
2789
2790 AT_CHECK([ovs-appctl revalidator/purge], [0])
2791 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2792 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
2793 table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
2794 OFPST_FLOW reply (OF1.2):
2795 ])
2796
2797 OVS_VSWITCHD_STOP
2798 AT_CLEANUP
2799
2800 AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
2801 OVS_VSWITCHD_START([dnl
2802 add-port br0 p1 -- set Interface p1 type=dummy
2803 ])
2804 on_exit 'kill `cat ovs-ofctl.pid`'
2805
2806 dnl N.B: The first (and only) action that accesses L3 data after the
2807 dnl pop_mpls action is present in write_actions. This exercises recirculation
2808 dnl triggered in write_actions due to a previous action not in write actions.
2809 AT_CAPTURE_FILE([ofctl_monitor.log])
2810 AT_DATA([flows.txt], [dnl
2811 mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
2812 ])
2813 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2814
2815 dnl Modified MPLS pop action.
2816 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2817 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)
2818 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2819 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2820 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
2821
2822 for i in 1 2 3; do
2823 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'
2824 done
2825 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2826 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2827
2828 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2829 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2830 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
2831 dnl
2832 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2833 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
2834 dnl
2835 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2836 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
2837 ])
2838
2839 AT_CHECK([ovs-appctl revalidator/purge], [0])
2840 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2841 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
2842 OFPST_FLOW reply (OF1.2):
2843 ])
2844
2845 OVS_VSWITCHD_STOP
2846 AT_CLEANUP
2847
2848 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
2849 OVS_VSWITCHD_START([dnl
2850 add-port br0 p1 -- set Interface p1 type=dummy
2851 ])
2852 on_exit 'kill `cat ovs-ofctl.pid`'
2853
2854 AT_CAPTURE_FILE([ofctl_monitor.log])
2855 # A table-miss flow has priority 0 and no match
2856 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2857
2858 dnl Singleton controller action.
2859 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2860
2861 for i in 1 2 3 ; do
2862 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)'
2863 done
2864 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2865 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2866
2867 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2868 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
2869 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
2870 dnl
2871 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
2872 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
2873 dnl
2874 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
2875 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
2876 ])
2877
2878 AT_CHECK([ovs-appctl revalidator/purge], [0])
2879 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2880 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
2881 NXST_FLOW reply:
2882 ])
2883
2884 OVS_VSWITCHD_STOP
2885 AT_CLEANUP
2886
2887
2888 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
2889 OVS_VSWITCHD_START([dnl
2890 add-port br0 p1 -- set Interface p1 type=dummy
2891 ])
2892 on_exit 'kill `cat ovs-ofctl.pid`'
2893
2894 AT_CAPTURE_FILE([ofctl_monitor.log])
2895 # A table-miss flow has priority 0 and no match
2896 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2897
2898 dnl Singleton controller action.
2899 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2900
2901 for i in 1 2 3 ; do
2902 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)'
2903 done
2904 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2905 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2906
2907 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2908
2909 AT_CHECK([cat ofctl_monitor.log], [0], [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 revalidator/purge], [0])
2921 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2922 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
2923 OFPST_FLOW reply (OF1.3):
2924 ])
2925
2926 OVS_VSWITCHD_STOP
2927 AT_CLEANUP
2928
2929 AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
2930 OVS_VSWITCHD_START([dnl
2931 add-port br0 p1 -- set Interface p1 type=dummy
2932 ])
2933 on_exit 'kill `cat ovs-ofctl.pid`'
2934
2935 ovs-appctl time/stop
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=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2940
2941 dnl Singleton controller action.
2942 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2943
2944 # Become slave (OF 1.3), which should disable everything except port status.
2945 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2946
2947 # Ensure that ovs-vswitchd gets a chance to reply before sending another command.
2948 ovs-appctl time/warp 500 100
2949
2950 # Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
2951 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
2952
2953 ovs-appctl time/warp 500 100
2954 for i in 1 2 3 ; do
2955 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)'
2956 done
2957 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2958 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2959
2960 AT_CHECK([ovs-appctl revalidator/purge], [0])
2961 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2962 send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
2963 OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
2964 dnl
2965 send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
2966 master:
2967 PACKET_IN: (off)
2968 PORT_STATUS: (off)
2969 FLOW_REMOVED: (off)
2970 ROLE_STATUS: (off)
2971 TABLE_STATUS: (off)
2972 REQUESTFORWARD: (off)
2973
2974 slave:
2975 PACKET_IN: no_match
2976 PORT_STATUS: (off)
2977 FLOW_REMOVED: (off)
2978 ROLE_STATUS: (off)
2979 TABLE_STATUS: (off)
2980 REQUESTFORWARD: (off)
2981 dnl
2982 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2983 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
2984 dnl
2985 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2986 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
2987 dnl
2988 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2989 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
2990 ])
2991
2992 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2993
2994 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2995 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
2996 OFPST_FLOW reply (OF1.3):
2997 ])
2998
2999 OVS_VSWITCHD_STOP
3000 AT_CLEANUP
3001
3002
3003 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
3004 OVS_VSWITCHD_START([dnl
3005 add-port br0 p1 -- set Interface p1 type=dummy
3006 ])
3007 on_exit 'kill `cat ovs-ofctl.pid`'
3008
3009 AT_CAPTURE_FILE([ofctl_monitor.log])
3010 # A table-miss flow has priority 0 and no match
3011 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3012
3013 dnl Singleton controller action.
3014 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3015
3016 for i in 1 2 3 ; do
3017 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)'
3018 done
3019 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3020 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3021
3022 AT_CHECK([ovs-appctl revalidator/purge], [0])
3023 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3024 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) 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 dnl
3027 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3028 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
3029 dnl
3030 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3031 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
3032 ])
3033
3034 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3035
3036 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3037 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3038 OFPST_FLOW reply (OF1.4):
3039 ])
3040
3041 OVS_VSWITCHD_STOP
3042 AT_CLEANUP
3043
3044
3045 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3046 OVS_VSWITCHD_START([dnl
3047 add-port br0 p1 -- set Interface p1 type=dummy
3048 ])
3049 on_exit 'kill `cat ovs-ofctl.pid`'
3050
3051 AT_CAPTURE_FILE([ofctl_monitor.log])
3052 AT_DATA([flows.txt], [dnl
3053 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3054 table=1 actions=output(CONTROLLER),goto_table(2)
3055 table=2 actions=group:1234
3056 ])
3057 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3058 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3059
3060 dnl Singleton controller action.
3061 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3062
3063 for i in 1 2 3 ; do
3064 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)'
3065 done
3066 AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3067 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
3068 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3069
3070 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3071
3072 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3073 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3074 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
3075 dnl
3076 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3077 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3078 dnl
3079 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3080 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3081 dnl
3082 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3083 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3084 dnl
3085 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3086 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
3087 dnl
3088 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3089 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
3090 dnl
3091 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3092 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
3093 dnl
3094 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3095 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
3096 dnl
3097 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3098 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
3099 dnl
3100 OFPT_PACKET_IN (OF1.3) (xid=0x0): total_len=54 in_port=ANY (via action) data_len=54 (unbuffered)
3101 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
3102 ])
3103
3104 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3105
3106 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3107 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3108 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3109 table=2, n_packets=3, n_bytes=162, actions=group:1234
3110 OFPST_FLOW reply (OF1.3):
3111 ])
3112
3113 OVS_VSWITCHD_STOP
3114 AT_CLEANUP
3115
3116
3117 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3118 OVS_VSWITCHD_START([dnl
3119 add-port br0 p1 -- set Interface p1 type=dummy
3120 ])
3121 on_exit 'kill `cat ovs-ofctl.pid`'
3122
3123 AT_CAPTURE_FILE([ofctl_monitor.log])
3124 AT_DATA([flows.txt], [dnl
3125 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3126 table=1 actions=output(CONTROLLER),goto_table(2)
3127 table=2 actions=group:1234
3128 ])
3129 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3130 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3131
3132 dnl Singleton controller action.
3133 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3134
3135 for i in 1 2 3 ; do
3136 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)'
3137 done
3138 AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3139 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
3140 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3141
3142 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3143
3144 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3145 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3146 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
3147 dnl
3148 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3149 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
3150 dnl
3151 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3152 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
3153 dnl
3154 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3155 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
3156 dnl
3157 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3158 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
3159 dnl
3160 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3161 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
3162 dnl
3163 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3164 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
3165 dnl
3166 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3167 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
3168 dnl
3169 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3170 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
3171 dnl
3172 OFPT_PACKET_IN (OF1.4) (xid=0x0): total_len=54 in_port=ANY (via packet_out) data_len=54 (unbuffered)
3173 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
3174 ])
3175
3176 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3177
3178 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3179 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3180 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3181 table=2, n_packets=3, n_bytes=162, actions=group:1234
3182 OFPST_FLOW reply (OF1.4):
3183 ])
3184
3185 OVS_VSWITCHD_STOP
3186 AT_CLEANUP
3187
3188
3189 AT_SETUP([ofproto-dpif - ARP modification slow-path])
3190 OVS_VSWITCHD_START
3191 add_of_ports br0 1 2
3192
3193 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3194 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'
3195
3196 # Input some packets that should follow the arp modification slow-path.
3197 for i in 1 2 3; do
3198 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)'
3199 done
3200 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3201
3202 # Check the packets that were output.
3203 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
3204 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
3205 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
3206 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
3207 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
3208 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
3209 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
3210 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
3211 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
3212 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
3213 ])
3214
3215 OVS_VSWITCHD_STOP
3216 AT_CLEANUP
3217
3218 AT_SETUP([ofproto-dpif - VLAN handling])
3219 OVS_VSWITCHD_START(
3220 [set Bridge br0 fail-mode=standalone -- \
3221 add-port br0 p1 trunks=10,12 -- \
3222 add-port br0 p2 tag=10 -- \
3223 add-port br0 p3 tag=12 \
3224 other-config:priority-tags=true -- \
3225 add-port br0 p4 tag=12 -- \
3226 add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
3227 add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
3228 add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
3229 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
3230 other-config:priority-tags=true -- \
3231 add-port br0 p9 vlan_mode=dot1q-tunnel tag=10 other-config:qinq-ethtype=802.1q -- \
3232 add-port br0 p10 vlan_mode=dot1q-tunnel tag=10 cvlans=10,12 other-config:qinq-ethtype=802.1q -- \
3233 add-port br0 p11 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q -- \
3234 add-port br0 p12 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q \
3235 other-config:priority-tags=true -- \
3236 set Interface p1 type=dummy -- \
3237 set Interface p2 type=dummy -- \
3238 set Interface p3 type=dummy -- \
3239 set Interface p4 type=dummy -- \
3240 set Interface p5 type=dummy -- \
3241 set Interface p6 type=dummy -- \
3242 set Interface p7 type=dummy -- \
3243 set Interface p8 type=dummy -- \
3244 set Interface p9 type=dummy -- \
3245 set Interface p10 type=dummy -- \
3246 set Interface p11 type=dummy -- \
3247 set Interface p12 type=dummy --])
3248
3249 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3250 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
3251 dnl actions.
3252 for tuple in \
3253 "100 none 0 drop" \
3254 "100 0 0 drop" \
3255 "100 0 1 drop" \
3256 "100 10 0 1,5,6,7,8,pop_vlan,2,9" \
3257 "100 10 1 1,5,6,7,8,pop_vlan,2,9" \
3258 "100 11 0 5,7" \
3259 "100 11 1 5,7" \
3260 "100 12 0 1,5,6,pop_vlan,3,4,7,8,11,12" \
3261 "100 12 1 1,5,6,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3262 "1 none 0 drop" \
3263 "1 0 0 drop" \
3264 "1 0 1 drop" \
3265 "1 10 0 5,6,7,8,100,pop_vlan,2,9" \
3266 "1 10 1 5,6,7,8,100,pop_vlan,2,9" \
3267 "1 11 0 drop" \
3268 "1 11 1 drop" \
3269 "1 12 0 5,6,100,pop_vlan,3,4,7,8,11,12" \
3270 "1 12 1 5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3271 "2 none 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3272 "2 0 0 pop_vlan,9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3273 "2 0 1 pop_vlan,9,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
3274 "2 10 0 drop" \
3275 "2 10 1 drop" \
3276 "2 11 0 drop" \
3277 "2 11 1 drop" \
3278 "2 12 0 drop" \
3279 "2 12 1 drop" \
3280 "3 none 0 4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3281 "3 0 0 pop_vlan,4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3282 "3 0 1 8,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3283 "3 10 0 drop" \
3284 "3 10 1 drop" \
3285 "3 11 0 drop" \
3286 "3 11 1 drop" \
3287 "3 12 0 drop" \
3288 "3 12 1 drop" \
3289 "4 none 0 3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3290 "4 0 0 pop_vlan,3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3291 "4 0 1 3,8,12,pop_vlan,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3292 "4 10 0 drop" \
3293 "4 10 1 drop" \
3294 "4 11 0 drop" \
3295 "4 11 1 drop" \
3296 "4 12 0 drop" \
3297 "4 12 1 drop" \
3298 "5 none 0 2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3299 "5 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3300 "5 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3301 "5 10 0 1,6,7,8,100,pop_vlan,2,9" \
3302 "5 10 1 1,6,7,8,100,pop_vlan,2,9" \
3303 "5 11 0 7,100" \
3304 "5 11 1 7,100" \
3305 "5 12 0 1,6,100,pop_vlan,3,4,7,8,11,12" \
3306 "5 12 1 1,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3307 "6 none 0 2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3308 "6 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3309 "6 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3310 "6 10 0 1,5,7,8,100,pop_vlan,2,9" \
3311 "6 10 1 1,5,7,8,100,pop_vlan,2,9" \
3312 "6 11 0 drop" \
3313 "6 11 1 drop" \
3314 "6 12 0 1,5,100,pop_vlan,3,4,7,8,11,12" \
3315 "6 12 1 1,5,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3316 "7 none 0 3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3317 "7 0 0 pop_vlan,3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3318 "7 0 1 3,8,12,pop_vlan,4,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3319 "7 10 0 1,5,6,8,100,pop_vlan,2,9" \
3320 "7 10 1 1,5,6,8,100,pop_vlan,2,9" \
3321 "7 11 0 5,100" \
3322 "7 11 1 5,100" \
3323 "7 12 0 1,5,6,100,pop_vlan,3,4,8,11,12" \
3324 "7 12 1 1,5,6,100,pop_vlan,4,11,push_vlan(vid=0,pcp=1),3,8,12" \
3325 "8 none 0 3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3326 "8 0 0 pop_vlan,3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3327 "8 0 1 3,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3328 "8 10 0 1,5,6,7,100,pop_vlan,2,9" \
3329 "8 10 1 1,5,6,7,100,pop_vlan,2,9" \
3330 "8 11 0 drop" \
3331 "8 11 1 drop" \
3332 "8 12 0 1,5,6,100,pop_vlan,3,4,7,11,12" \
3333 "8 12 1 1,5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,12" \
3334 "9 none 0 2,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3335 "9 10 0 10,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3336 "9 11 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3337 "10 none 0 drop" \
3338 "10 0 0 drop" \
3339 "10 11 0 drop" \
3340 "10 12 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3341 "11 10 0 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3342 "11 10 1 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100"
3343 do
3344 set $tuple
3345 in_port=$1
3346 vlan=$2
3347 pcp=$3
3348 expected=$4
3349
3350 if test $vlan = none; then
3351 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
3352 else
3353 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))"
3354 fi
3355
3356 echo "----------------------------------------------------------------------"
3357 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3358
3359 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3360 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
3361
3362 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
3363 mv stdout expout
3364 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
3365 done
3366
3367 OVS_VSWITCHD_STOP
3368 AT_CLEANUP
3369
3370 AT_SETUP([ofproto-dpif - VLAN depth limit])
3371 OVS_VSWITCHD_START([dnl
3372 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3373 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
3374 add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3
3375 ])
3376
3377 AT_DATA([flows.txt], [dnl
3378 table=0 in_port=1,eth_type=0x8100,vlan_tci=0x0010/0x01ff actions=output:2
3379 table=0 in_port=1,eth_type=0xabcd,vlan_tci=0x0010/0x01ff actions=output:3
3380 ])
3381 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3382 flow="in_port(1),eth(src=00:11:22:33:44:55,dst=00:22:44:66:88:00),eth_type(0x8100),vlan(vid=16,pcp=0), \
3383 encap(eth_type(0x8100),vlan(vid=17,pcp=0),encap(eth_type(0xabcd)))"
3384
3385 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3386 AT_CHECK([tail -1 stdout], [0],
3387 [Datapath actions: 2
3388 ])
3389
3390 AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3391 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3392 AT_CHECK([tail -1 stdout], [0],
3393 [Datapath actions: 3
3394 ])
3395
3396 OVS_VSWITCHD_STOP
3397 AT_CLEANUP
3398
3399 AT_SETUP([ofproto-dpif - Multi-VLAN actions])
3400 OVS_VSWITCHD_START([dnl
3401 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3402 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2
3403 ])
3404 AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3405
3406 AT_DATA([flows.txt], [dnl
3407 table=0 in_port=1,vlan_tci=0x1100/0x1fff actions=pop_vlan,output:2
3408 table=0 in_port=1,vlan_tci=0x1101/0x1fff actions=push_vlan:0x8100,set_field:0x1201/0x1fff->vlan_tci,output:2
3409 table=0 in_port=1,vlan_tci=0x1102/0x1fff actions=push_vlan:0x88a8,set_field:0x1202/0x1fff->vlan_tci,output:2
3410 table=0 in_port=1,vlan_tci=0x1103/0x1fff actions=set_field:0x1203/0x1fff->vlan_tci,output:2
3411 table=0 in_port=1,vlan_tci=0x1104/0x1fff actions=pop_vlan,goto_table:1
3412 table=1 vlan_tci=0 actions=output:2
3413 table=1 vlan_tci=0x1300/0x1fff actions=pop_vlan,output:2
3414 table=1 vlan_tci=0x1301/0x1fff actions=push_vlan:0x88a8,set_field:0x1401/0x1fff->vlan_tci,output:2
3415 table=1 vlan_tci=0x1302/0x1fff actions=set_field:0x1402/0x1fff->vlan_tci,output:2
3416 ])
3417
3418 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3419
3420 check_act() {
3421 psd_hdr="in_port(1),eth(src=00:11:22:33:44:55,dst=00:22:44:66:88:00),"
3422 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$psd_hdr$1"], [0], [stdout])
3423 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $2
3424 ])
3425 }
3426
3427 check_act "eth_type(0x8100),vlan(vid=0x0100,pcp=0),encap(eth_type(0xabcd))" \
3428 "pop_vlan,2"
3429
3430 check_act "eth_type(0x8100),vlan(vid=0x0101,pcp=0),encap(eth_type(0xabcd))" \
3431 "push_vlan(vid=513,pcp=0),2"
3432
3433 check_act "eth_type(0x8100),vlan(vid=0x0102,pcp=0),encap(eth_type(0xabcd))" \
3434 "push_vlan(tpid=0x88a8,vid=514,pcp=0),2"
3435
3436 check_act "eth_type(0x8100),vlan(vid=0x0103,pcp=0),encap(eth_type(0xabcd))" \
3437 "pop_vlan,push_vlan(vid=515,pcp=0),2"
3438
3439 check_act "eth_type(0x8100),vlan(vid=0x0104,pcp=0),encap(eth_type(0xabcd))" \
3440 "pop_vlan,2"
3441
3442 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3443 vlan(vid=0x0300,pcp=0),encap(eth_type(0xabcd)))" "pop_vlan,pop_vlan,2"
3444
3445 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3446 vlan(vid=0x0301,pcp=0),encap(eth_type(0xabcd)))" \
3447 "pop_vlan,push_vlan(tpid=0x88a8,vid=1025,pcp=0),2"
3448
3449 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3450 vlan(vid=0x0302,pcp=0),encap(eth_type(0xabcd)))" \
3451 "pop_vlan,pop_vlan,push_vlan(vid=1026,pcp=0),2"
3452
3453 OVS_VSWITCHD_STOP
3454 AT_CLEANUP
3455
3456 AT_SETUP([ofproto-dpif - MPLS handling])
3457 OVS_VSWITCHD_START([dnl
3458 add-port br0 p1 -- set Interface p1 type=dummy
3459 ])
3460 on_exit 'kill `cat ovs-ofctl.pid`'
3461
3462 AT_CAPTURE_FILE([ofctl_monitor.log])
3463 AT_DATA([flows.txt], [dnl
3464 dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
3465 dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
3466 dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
3467 ])
3468 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3469
3470 dnl In this test, we push an MPLS tag to an ethernet packet.
3471 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3472
3473 for i in 1 2 3; do
3474 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)'
3475 done
3476 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3477 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3478
3479 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3480 OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3481 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
3482 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3483 00000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3484 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3485 00000030 00 00 50 00 00 00 2e 91-00 00
3486 dnl
3487 OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3488 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
3489 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3490 00000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3491 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3492 00000030 00 00 50 00 00 00 2e 91-00 00
3493 dnl
3494 OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3495 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
3496 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3497 00000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3498 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3499 00000030 00 00 50 00 00 00 2e 91-00 00
3500 ])
3501
3502 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3503 dnl copied exactly, except for the BOS bit.
3504 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3505
3506 for i in 1 2 3; do
3507 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)'
3508 done
3509 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3510 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3511
3512 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3513 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3514 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
3515 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3516 00000010 a0 40 00 00 a1 40
3517 dnl
3518 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3519 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
3520 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3521 00000010 a0 40 00 00 a1 40
3522 dnl
3523 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3524 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
3525 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3526 00000010 a0 40 00 00 a1 40
3527 ])
3528
3529 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3530 dnl copied exactly, except for the BOS bit. The ethertype should be updated
3531 dnl to the MPLS ethertype of the MPLS push action which differs to that
3532 dnl of the input packet.
3533 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3534
3535 for i in 1 2 3; do
3536 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)'
3537 done
3538 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3539 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3540
3541 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3542 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3543 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
3544 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3545 00000010 a0 40 00 00 a1 40
3546 dnl
3547 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3548 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
3549 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3550 00000010 a0 40 00 00 a1 40
3551 dnl
3552 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3553 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
3554 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3555 00000010 a0 40 00 00 a1 40
3556 ])
3557
3558 OVS_VSWITCHD_STOP
3559 AT_CLEANUP
3560
3561 AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3562 OVS_VSWITCHD_START([dnl
3563 add-port br0 p1 -- set Interface p1 type=dummy
3564 ])
3565 on_exit 'kill `cat ovs-ofctl.pid`'
3566
3567 AT_CAPTURE_FILE([ofctl_monitor.log])
3568 AT_DATA([flows.txt], [dnl
3569 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
3570 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
3571 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
3572 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
3573 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
3574 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
3575 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
3576 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
3577 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
3578 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
3579 ])
3580 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3581
3582 dnl Modified MPLS controller action.
3583 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3584 dnl both of these in the final flow
3585 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3586
3587 for i in 1 2 3; do
3588 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)'
3589 done
3590 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3591 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3592
3593 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [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,vlan_tci1=0x0000,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3596 00000000 50 54 00 00 00 07 40 44-44 44 54 50 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 dnl
3601 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3602 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3603 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3604 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3605 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3606 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3607 dnl
3608 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3609 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3610 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3611 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3612 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3613 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3614 ])
3615
3616 dnl Modified MPLS controller action.
3617 dnl In this test, the input packet is vlan-tagged, which should be kept as
3618 dnl inner vlan.
3619 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3620
3621 for i in 1 2 3; do
3622 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))'
3623 done
3624 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3625 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3626
3627 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3628 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3629 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3630 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3631 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3632 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3633 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3634 00000040 00 00
3635 dnl
3636 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3637 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3638 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3639 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3640 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3641 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3642 00000040 00 00
3643 dnl
3644 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3645 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3646 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3647 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3648 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3649 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3650 00000040 00 00
3651 ])
3652
3653 dnl Modified MPLS controller action.
3654 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3655 dnl both of these in the final flow
3656 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3657
3658 for i in 1 2 3; do
3659 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)'
3660 done
3661 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3662 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3663
3664 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3665 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3666 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3667 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3668 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3669 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3670 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3671 dnl
3672 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3673 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3674 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3675 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3676 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3677 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3678 dnl
3679 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3680 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3681 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3682 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3683 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3684 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3685 ])
3686
3687 dnl Modified MPLS controller action.
3688 dnl In this test, the input packet is vlan-tagged, which should be kept as
3689 dnl inner vlan.
3690 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3691
3692 for i in 1 2 3; do
3693 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))'
3694 done
3695 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3696 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3697
3698 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3699 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3700 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3701 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3702 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3703 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3704 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3705 00000040 00 00
3706 dnl
3707 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3708 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3709 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3710 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3711 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3712 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3713 00000040 00 00
3714 dnl
3715 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3716 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3717 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3718 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3719 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3720 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3721 00000040 00 00
3722 ])
3723
3724 dnl Modified MPLS controller action.
3725 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3726 dnl actions are reordered, so we see both of these in the final flow.
3727 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3728
3729 for i in 1 2 3; do
3730 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)'
3731 done
3732 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3733 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3734
3735 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3736 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3737 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3738 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3739 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3740 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3741 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3742 dnl
3743 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3744 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3745 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3746 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3747 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3748 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3749 dnl
3750 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3751 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3752 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3753 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3754 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3755 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3756 ])
3757
3758 dnl Modified MPLS controller action.
3759 dnl In this test, the input packet is vlan-tagged, which should be kept as
3760 dnl inner vlan.
3761 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3762
3763 for i in 1 2 3; do
3764 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))'
3765 done
3766 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3767 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3768
3769 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3770 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3771 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3772 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3773 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3774 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3775 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3776 00000040 00 00
3777 dnl
3778 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3779 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3780 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3781 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3782 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3783 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3784 00000040 00 00
3785 dnl
3786 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3787 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3788 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3789 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3790 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3791 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3792 00000040 00 00
3793 ])
3794
3795 dnl Modified MPLS controller action.
3796 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3797 dnl actions are reordered, so we see both of these in the final flow.
3798 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3799
3800 for i in 1 2 3; do
3801 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)'
3802 done
3803 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3804 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3805
3806 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3807 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3808 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3809 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3810 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3811 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3812 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3813 dnl
3814 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3815 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3816 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3817 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3818 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3819 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3820 dnl
3821 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3822 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3823 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3824 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3825 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3826 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3827 ])
3828
3829 dnl Modified MPLS controller action.
3830 dnl In this test, the input packet is vlan-tagged, which should be kept as
3831 dnl inner vlan.
3832 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
3833
3834 for i in 1 2 3; do
3835 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))'
3836 done
3837 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3838 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3839
3840 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3841 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3842 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3843 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3844 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3845 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3846 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3847 00000040 00 00
3848 dnl
3849 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3850 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3851 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3852 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3853 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3854 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3855 00000040 00 00
3856 dnl
3857 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3858 mpls,dl_vlan=99,dl_vlan_pcp=1,dl_vlan1=88,dl_vlan_pcp1=7,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3859 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3860 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3861 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3862 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3863 00000040 00 00
3864 ])
3865
3866 dnl Modified MPLS controller action.
3867 dnl In this test, the input packet is vlan-tagged, which should be kept as
3868 dnl inner vlan.
3869 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3870
3871 for i in 1 2 3; do
3872 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))'
3873 done
3874 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3875 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3876
3877 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3878 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3879 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3880 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3881 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3882 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3883 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3884 dnl
3885 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3886 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3887 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3888 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3889 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3890 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3891 dnl
3892 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3893 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3894 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3895 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3896 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3897 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3898 ])
3899
3900 dnl Modified MPLS controller action.
3901 dnl In this test, the input packet is vlan-tagged, which should be modified
3902 dnl before we push MPLS and VLAN tags.
3903 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3904
3905 for i in 1 2 3; do
3906 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))'
3907 done
3908 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3909 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3910
3911 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3912 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3913 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3914 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3915 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3916 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3917 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3918 dnl
3919 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3920 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3921 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3922 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3923 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3924 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3925 dnl
3926 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3927 mpls,dl_vlan=99,dl_vlan_pcp=1,vlan_tci1=0x0000,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3928 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3929 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3930 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3931 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3932 ])
3933
3934 AT_CHECK([ovs-appctl revalidator/purge], [0])
3935 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3936 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
3937 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
3938 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
3939 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
3940 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
3941 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
3942 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
3943 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
3944 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
3945 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
3946 OFPST_FLOW reply (OF1.2):
3947 ])
3948
3949 OVS_VSWITCHD_STOP
3950 AT_CLEANUP
3951
3952 AT_SETUP([ofproto-dpif - fragment handling - trace])
3953 OVS_VSWITCHD_START
3954 add_of_ports br0 1 2 3 4 5 6 90
3955 AT_DATA([flows.txt], [dnl
3956 priority=75 tcp ip_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
3957 priority=75 tcp ip_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
3958 priority=50 tcp ip_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
3959 priority=50 tcp ip_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
3960 priority=50 tcp ip_frag=later actions=output:6
3961 ])
3962 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3963
3964 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"
3965 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3966 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3967 later_flow="$base_flow,frag=later)"
3968
3969 # mode no first later
3970 for tuple in \
3971 'normal 1 5 6' \
3972 'drop 1 drop drop' \
3973 'nx-match 1 2 6'
3974 do
3975 set $tuple
3976 mode=$1
3977 no=$2
3978 first=$3
3979 later=$4
3980
3981 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3982 for type in no first later; do
3983 eval flow=\$${type}_flow exp_output=\$$type
3984 printf "\n%s\n" "----$mode $type-----"
3985 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3986 : > expout
3987 if test $mode = drop && test $type != no; then
3988 echo ' 0. Packets are IP fragments and the fragment handling mode is "drop".' >> expout
3989 echo "Datapath actions: $exp_output" >> expout
3990 elif test $type = later; then
3991 echo "Datapath actions: $exp_output" >> expout
3992 else
3993 echo "Datapath actions: set(tcp(src=80,dst=80)),$exp_output" >> expout
3994 fi
3995 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
3996 done
3997 done
3998 OVS_VSWITCHD_STOP
3999 AT_CLEANUP
4000
4001 AT_SETUP([ofproto-dpif - fragment handling - upcall])
4002 OVS_VSWITCHD_START
4003 add_of_ports br0 1 2 3 4 5 6 90
4004 AT_DATA([flows.txt], [dnl
4005 priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
4006 priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
4007 priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
4008 priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
4009 priority=50 tcp ip_frag=later actions=output:6
4010 ])
4011 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4012
4013 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"
4014 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4015 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4016 later_flow="$base_flow,frag=later)"
4017
4018 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4019
4020 mode=normal
4021
4022 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4023 for type in no first later; do
4024 eval flow=\$${type}_flow
4025 printf "\n%s\n" "----$mode $type-----"
4026
4027 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4028 done
4029
4030 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4031 flow-dump from non-dpdk interfaces:
4032 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
4033 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
4034 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4035 ])
4036
4037 mode=drop
4038
4039 AT_CHECK([ovs-appctl revalidator/purge], [0])
4040 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4041 for type in no first later; do
4042 eval flow=\$${type}_flow
4043 printf "\n%s\n" "----$mode $type-----"
4044
4045 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4046 done
4047
4048 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4049 flow-dump from non-dpdk interfaces:
4050 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
4051 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
4052 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
4053 ])
4054
4055 mode=nx-match
4056
4057 AT_CHECK([ovs-appctl revalidator/purge], [0])
4058 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4059 for type in no first later; do
4060 eval flow=\$${type}_flow
4061 printf "\n%s\n" "----$mode $type-----"
4062
4063 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4064 done
4065
4066 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4067 flow-dump from non-dpdk interfaces:
4068 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
4069 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
4070 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4071 ])
4072
4073 OVS_VSWITCHD_STOP
4074 AT_CLEANUP
4075
4076 AT_SETUP([ofproto-dpif - fragment handling - actions])
4077 OVS_VSWITCHD_START
4078 add_of_ports br0 1 2 3 4 5 6 90
4079
4080 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])
4081 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4082 source field tcp_dst lacks correct prerequisites
4083 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4084 ])
4085
4086 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])
4087 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4088 destination field tcp_src lacks correct prerequisites
4089 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4090 ])
4091
4092 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
4093 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4094 set_field udp_src lacks correct prerequisities
4095 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4096 ])
4097
4098 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
4099 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4100 set_field udp_dst lacks correct prerequisities
4101 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4102 ])
4103
4104 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
4105 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4106 set_field sctp_src lacks correct prerequisities
4107 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4108 ])
4109
4110 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
4111 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4112 set_field sctp_dst lacks correct prerequisities
4113 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4114 ])
4115
4116 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])
4117 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4118 source field tcp_dst lacks correct prerequisites
4119 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4120 ])
4121
4122 AT_DATA([flows.txt], [dnl
4123 priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
4124 ])
4125 AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
4126
4127 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4128
4129 mode=normal
4130
4131 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4132 for frag in 4000 6000 6008 4010; do
4133 printf "\n%s\n" "----$mode $frag-----"
4134
4135 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"])
4136 done
4137
4138 dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
4139 dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
4140 dnl OVS-2.5, the wildcards and set_field mask are shared internally.
4141 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4142 flow-dump from non-dpdk interfaces:
4143 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
4144 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
4145 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
4146 ])
4147
4148 AT_CHECK([ovs-appctl revalidator/purge], [0])
4149 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4150 for frag in 4000 6000 6008 4010; do
4151 printf "\n%s\n" "----$mode $frag truncated transport header -----"
4152
4153 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
4154 done
4155
4156 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4157 flow-dump from non-dpdk interfaces:
4158 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
4159 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
4160 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:38, used:0.001s, actions:1
4161 ])
4162
4163 AT_CHECK([ovs-appctl revalidator/purge], [0])
4164 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4165 for frag in 4000 6000 6001 4002; do
4166 printf "\n%s\n" "----$mode $frag missing transport header-----"
4167
4168 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
4169 done
4170
4171 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4172 flow-dump from non-dpdk interfaces:
4173 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
4174 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
4175 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:34, used:0.001s, actions:1
4176 ])
4177
4178 OVS_VSWITCHD_STOP
4179 AT_CLEANUP
4180
4181 AT_SETUP([ofproto-dpif - exit])
4182 OVS_VSWITCHD_START
4183 add_of_ports br0 1 2 3 10 11 12 13 14
4184 AT_DATA([flows.txt], [dnl
4185 in_port=1 actions=output:10,exit,output:11
4186 in_port=2 actions=output:12,resubmit:1,output:12
4187 in_port=3 actions=output:13,resubmit:2,output:14
4188 ])
4189 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4190 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])
4191 AT_CHECK([tail -1 stdout], [0],
4192 [Datapath actions: 10
4193 ])
4194 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])
4195 AT_CHECK([tail -1 stdout], [0],
4196 [Datapath actions: 12,10
4197 ])
4198 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])
4199 AT_CHECK([tail -1 stdout], [0],
4200 [Datapath actions: 13,12,10
4201 ])
4202 OVS_VSWITCHD_STOP
4203 AT_CLEANUP
4204
4205
4206 AT_SETUP([ofproto-dpif - mirroring, select_all])
4207 AT_KEYWORDS([mirror mirrors mirroring])
4208 OVS_VSWITCHD_START
4209 add_of_ports br0 1 2 3
4210 ovs-vsctl \
4211 set Bridge br0 mirrors=@m --\
4212 --id=@p3 get Port p3 --\
4213 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4214
4215 AT_DATA([flows.txt], [dnl
4216 in_port=1 actions=output:2
4217 in_port=2 actions=output:1
4218 ])
4219 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4220
4221 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)"
4222 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4223 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4224 [Datapath actions: 3,2
4225 ])
4226
4227 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)"
4228 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4229 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4230 [Datapath actions: 3,1
4231 ])
4232
4233 OVS_VSWITCHD_STOP
4234 AT_CLEANUP
4235
4236
4237 AT_SETUP([ofproto-dpif - mirroring, select_src])
4238 AT_KEYWORDS([mirror mirrors mirroring])
4239 OVS_VSWITCHD_START
4240 add_of_ports br0 1 2 3
4241 ovs-vsctl \
4242 set Bridge br0 mirrors=@m --\
4243 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4244 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
4245
4246 AT_DATA([flows.txt], [dnl
4247 in_port=1 actions=output:2
4248 in_port=2 actions=output:1
4249 ])
4250 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4251
4252 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)"
4253 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4254 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4255 [Datapath actions: 3,2
4256 ])
4257
4258 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)"
4259 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4260 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4261 [Datapath actions: 1
4262 ])
4263 OVS_VSWITCHD_STOP
4264 AT_CLEANUP
4265
4266 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
4267 AT_KEYWORDS([mirror mirrors mirroring])
4268 OVS_VSWITCHD_START
4269 add_of_ports br0 1 2
4270 ovs-vsctl \
4271 set Bridge br0 mirrors=@m --\
4272 --id=@p2 get Port p2 --\
4273 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
4274
4275 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4276
4277 # "in_port" defaults to OFPP_NONE if it's not specified.
4278 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"
4279 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4280 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4281 [Datapath actions: 1,2
4282 ])
4283
4284 OVS_VSWITCHD_STOP
4285 AT_CLEANUP
4286
4287
4288 AT_SETUP([ofproto-dpif - mirroring, select_dst])
4289 AT_KEYWORDS([mirror mirrors mirroring])
4290 OVS_VSWITCHD_START
4291 add_of_ports br0 1 2 3
4292 ovs-vsctl \
4293 set Bridge br0 mirrors=@m --\
4294 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4295 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
4296
4297 AT_DATA([flows.txt], [dnl
4298 in_port=1 actions=output:2
4299 in_port=2 actions=output:1
4300 ])
4301 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4302
4303 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)"
4304 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4305 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4306 [Datapath actions: 2,3
4307 ])
4308
4309 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)"
4310 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4311 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4312 [Datapath actions: 1
4313 ])
4314
4315 OVS_VSWITCHD_STOP
4316 AT_CLEANUP
4317
4318
4319 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
4320 AT_KEYWORDS([mirror mirrors mirroring])
4321 OVS_VSWITCHD_START
4322 add_of_ports br0 1 2 3
4323 ovs-vsctl \
4324 set Bridge br0 mirrors=@m --\
4325 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4326 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
4327
4328 AT_DATA([flows.txt], [dnl
4329 in_port=1, actions=output:2
4330 ])
4331 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4332
4333 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)"
4334 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4335 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4336 [Datapath actions: 2
4337 ])
4338
4339 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))"
4340 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4341 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4342 [Datapath actions: 2
4343 ])
4344
4345 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))"
4346 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4347 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4348 [Datapath actions: 3,2
4349 ])
4350
4351 OVS_VSWITCHD_STOP
4352 AT_CLEANUP
4353
4354
4355 AT_SETUP([ofproto-dpif - mirroring, output_port])
4356 AT_KEYWORDS([mirror mirrors mirroring])
4357 OVS_VSWITCHD_START
4358 add_of_ports br0 1 2 3
4359 ovs-vsctl \
4360 set Bridge br0 mirrors=@m --\
4361 --id=@p3 get Port p3 --\
4362 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4363
4364 AT_DATA([flows.txt], [dnl
4365 in_port=1 actions=mod_vlan_vid:17,output:2
4366 in_port=2 actions=output:1
4367 ])
4368 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4369
4370 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)"
4371 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4372 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4373 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
4374 ])
4375
4376 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)"
4377 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4378 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4379 [Datapath actions: 3,1
4380 ])
4381
4382 OVS_VSWITCHD_STOP
4383 AT_CLEANUP
4384
4385 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
4386 AT_KEYWORDS([mirror mirrors mirroring])
4387 OVS_VSWITCHD_START
4388 add_of_ports br0 1 2
4389 ovs-vsctl \
4390 set Bridge br0 mirrors=@m --\
4391 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
4392
4393 AT_DATA([flows.txt], [dnl
4394 in_port=1 actions=output:2
4395 in_port=2 actions=mod_vlan_vid:17,output:1
4396 ])
4397 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4398
4399 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)"
4400 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4401 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4402
4403 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
4404 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4405 mv stdout expout
4406 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4407
4408 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)"
4409 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4410 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4411
4412 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
4413 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4414 mv stdout expout
4415 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4416
4417 OVS_VSWITCHD_STOP
4418 AT_CLEANUP
4419
4420 # This verifies that we don't get duplicate mirroring when mirror_packet()
4421 # might be invoked recursively, as a check against regression.
4422 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
4423 AT_KEYWORDS([mirror mirrors mirroring])
4424 OVS_VSWITCHD_START
4425 add_of_ports br0 1 2 3
4426 ovs-vsctl \
4427 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4428 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
4429 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
4430 -- set Port br0 tag=0 \
4431 -- set Port p1 tag=0 \
4432 -- set Port p2 tag=500 \
4433 -- set Port p3 tag=501
4434
4435 flow='in_port=1'
4436 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4437 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4438 s/,/\
4439 /g' | sort], [0], [100
4440 2
4441 3
4442 ])
4443
4444 OVS_VSWITCHD_STOP
4445 AT_CLEANUP
4446
4447 # This test verifies that mirror state is preserved across recirculation.
4448 #
4449 # Otherwise, post-recirculation the ingress and the output to port 4
4450 # would cause the packet to be mirrored to port 3 a second time.
4451 AT_SETUP([ofproto-dpif - mirroring with recirculation])
4452 AT_KEYWORDS([mirror mirrors mirroring])
4453 OVS_VSWITCHD_START
4454 add_of_ports br0 1 2 3 4
4455 ovs-vsctl \
4456 set Bridge br0 mirrors=@m --\
4457 --id=@p3 get Port p3 --\
4458 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4459
4460 AT_DATA([flows.txt], [dnl
4461 in_port=1 actions=2,debug_recirc,4
4462 ])
4463 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4464
4465 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)"
4466 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4467 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4468 ])
4469 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4470 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4471 ])
4472
4473 OVS_VSWITCHD_STOP
4474 AT_CLEANUP
4475
4476 # Tests below verify the snaplen support for mirroring
4477 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen])
4478 AT_KEYWORDS([mirror mirrors mirroring])
4479 OVS_VSWITCHD_START
4480 add_of_ports br0 1 2 3
4481 ovs-vsctl \
4482 set Bridge br0 mirrors=@m --\
4483 --id=@p3 get Port p3 --\
4484 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4485
4486 AT_DATA([flows.txt], [dnl
4487 in_port=1 actions=output:2
4488 in_port=2 actions=output:1
4489 ])
4490 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4491
4492 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)"
4493 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4494 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4495 [Datapath actions: trunc(100),3,2
4496 ])
4497
4498 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)"
4499 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4500 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4501 [Datapath actions: trunc(100),3,1
4502 ])
4503
4504 OVS_VSWITCHD_STOP
4505 AT_CLEANUP
4506
4507 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen and reset snaplen])
4508 AT_KEYWORDS([mirror mirrors mirroring])
4509 OVS_VSWITCHD_START
4510 add_of_ports br0 1 2 3
4511 ovs-vsctl \
4512 set Bridge br0 mirrors=@m --\
4513 --id=@p3 get Port p3 --\
4514 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4515
4516 AT_DATA([flows.txt], [dnl
4517 in_port=1 actions=output:2
4518 in_port=2 actions=output:1
4519 ])
4520 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4521
4522 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)"
4523 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4524 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4525 [Datapath actions: trunc(100),3,2
4526 ])
4527
4528 ovs-vsctl set mirror mymirror snaplen=77
4529
4530 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)"
4531 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4532 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4533 [Datapath actions: trunc(77),3,1
4534 ])
4535
4536 ovs-vsctl set mirror mymirror snaplen=65535
4537
4538 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)"
4539 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4540 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4541 [Datapath actions: 3,1
4542 ])
4543
4544 OVS_VSWITCHD_STOP
4545 AT_CLEANUP
4546
4547 AT_SETUP([ofproto-dpif - mirroring, select_src with snaplen])
4548 AT_KEYWORDS([mirror mirrors mirroring])
4549 OVS_VSWITCHD_START
4550 add_of_ports br0 1 2 3
4551 ovs-vsctl \
4552 set Bridge br0 mirrors=@m --\
4553 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4554 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3 snaplen=100
4555
4556 AT_DATA([flows.txt], [dnl
4557 in_port=1 actions=output:2
4558 in_port=2 actions=output:1
4559 ])
4560 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4561
4562 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)"
4563 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4564 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4565 [Datapath actions: trunc(100),3,2
4566 ])
4567
4568 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)"
4569 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4570 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4571 [Datapath actions: 1
4572 ])
4573 OVS_VSWITCHD_STOP
4574 AT_CLEANUP
4575
4576 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port with snaplen])
4577 AT_KEYWORDS([mirror mirrors mirroring])
4578 OVS_VSWITCHD_START
4579 add_of_ports br0 1 2
4580 ovs-vsctl \
4581 set Bridge br0 mirrors=@m --\
4582 --id=@p2 get Port p2 --\
4583 --id=@m create Mirror name=mymirror select_all=true output_port=@p2 snaplen=100
4584
4585 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4586
4587 # "in_port" defaults to OFPP_NONE if it's not specified.
4588 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"
4589 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4590 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4591 [Datapath actions: 1,trunc(100),2
4592 ])
4593
4594 OVS_VSWITCHD_STOP
4595 AT_CLEANUP
4596
4597 AT_SETUP([ofproto-dpif - mirroring, select_dst with snaplen])
4598 AT_KEYWORDS([mirror mirrors mirroring])
4599 OVS_VSWITCHD_START
4600 add_of_ports br0 1 2 3
4601 ovs-vsctl \
4602 set Bridge br0 mirrors=@m --\
4603 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4604 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3 snaplen=100
4605
4606 AT_DATA([flows.txt], [dnl
4607 in_port=1 actions=output:2
4608 in_port=2 actions=output:1
4609 ])
4610 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4611
4612 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)"
4613 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4614 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4615 [Datapath actions: 2,trunc(100),3
4616 ])
4617
4618 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)"
4619 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4620 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4621 [Datapath actions: 1
4622 ])
4623
4624 OVS_VSWITCHD_STOP
4625 AT_CLEANUP
4626
4627 AT_SETUP([ofproto-dpif - mirroring, select_vlan with snaplen])
4628 AT_KEYWORDS([mirror mirrors mirroring])
4629 OVS_VSWITCHD_START
4630 add_of_ports br0 1 2 3
4631 ovs-vsctl \
4632 set Bridge br0 mirrors=@m --\
4633 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4634 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3 snaplen=100
4635
4636 AT_DATA([flows.txt], [dnl
4637 in_port=1, actions=output:2
4638 ])
4639 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4640
4641 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)"
4642 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4643 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4644 [Datapath actions: 2
4645 ])
4646
4647 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))"
4648 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4649 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4650 [Datapath actions: 2
4651 ])
4652
4653 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))"
4654 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4655 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4656 [Datapath actions: trunc(100),3,2
4657 ])
4658
4659 OVS_VSWITCHD_STOP
4660 AT_CLEANUP
4661
4662 AT_SETUP([ofproto-dpif - mirroring, output_port with snaplen])
4663 AT_KEYWORDS([mirror mirrors mirroring])
4664 OVS_VSWITCHD_START
4665 add_of_ports br0 1 2 3
4666 ovs-vsctl \
4667 set Bridge br0 mirrors=@m --\
4668 --id=@p3 get Port p3 --\
4669 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4670
4671 AT_DATA([flows.txt], [dnl
4672 in_port=1 actions=mod_vlan_vid:17,output:2
4673 in_port=2 actions=output:1
4674 ])
4675 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4676
4677 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)"
4678 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4679 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4680 [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2
4681 ])
4682
4683 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)"
4684 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4685 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4686 [Datapath actions: trunc(100),3,1
4687 ])
4688
4689 OVS_VSWITCHD_STOP
4690 AT_CLEANUP
4691
4692 AT_SETUP([ofproto-dpif - mirroring, output_vlan with snaplen])
4693 AT_KEYWORDS([mirror mirrors mirroring])
4694 OVS_VSWITCHD_START
4695 add_of_ports br0 1 2
4696 ovs-vsctl \
4697 set Bridge br0 mirrors=@m --\
4698 --id=@m create Mirror name=mymirror select_all=true output_vlan=12 snaplen=100
4699
4700 AT_DATA([flows.txt], [dnl
4701 in_port=1 actions=output:2
4702 in_port=2 actions=mod_vlan_vid:17,output:1
4703 ])
4704 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4705
4706 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)"
4707 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4708 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4709 dnl Expect: "trunc(100),100,trunc(100),2,trunc(100),1", with different order
4710 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])
4711
4712 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)"
4713 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4714 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4715 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])
4716
4717 OVS_VSWITCHD_STOP
4718 AT_CLEANUP
4719
4720 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors with snaplen])
4721 AT_KEYWORDS([mirror mirrors mirroring])
4722 OVS_VSWITCHD_START
4723 add_of_ports br0 1 2 3
4724 ovs-vsctl \
4725 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4726 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 snaplen=200 \
4727 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 snaplen=300 \
4728 -- set Port br0 tag=0 \
4729 -- set Port p1 tag=0 \
4730 -- set Port p2 tag=500 \
4731 -- set Port p3 tag=501
4732
4733 flow="in_port=1"
4734 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4735 AT_CHECK([tail -1 stdout | egrep "trunc\(200\),2,trunc\(300\),3,100|trunc\(300\),3,trunc\(200\),2,100"], [0], [stdout])
4736
4737 OVS_VSWITCHD_STOP
4738 AT_CLEANUP
4739
4740 # This test verifies that the table ID is preserved across recirculation
4741 # when a resubmit action requires it (because the action is relative to
4742 # the current table rather than specifying a table).
4743 AT_SETUP([ofproto-dpif - resubmit with recirculation])
4744 OVS_VSWITCHD_START
4745 add_of_ports br0 1 2 3
4746
4747 AT_DATA([flows.txt], [dnl
4748 table=0 in_port=1 actions=2,resubmit(,1)
4749 table=1 in_port=1 actions=debug_recirc,resubmit:55
4750 table=1 in_port=55 actions=3
4751 ])
4752 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4753
4754 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)"
4755 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4756 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
4757 ])
4758 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4759 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
4760 ])
4761
4762 OVS_VSWITCHD_STOP
4763 AT_CLEANUP
4764
4765 # This test verifies that "resubmit", when it triggers recirculation
4766 # indirectly through the flow that it recursively invokes, is not
4767 # re-executed when execution continues later post-recirculation.
4768 AT_SETUP([ofproto-dpif - recirculation after resubmit])
4769 OVS_VSWITCHD_START
4770 add_of_ports br0 1 2
4771
4772 AT_DATA([flows.txt], [dnl
4773 table=0 in_port=1 actions=resubmit(,1),2
4774 table=1 in_port=1 actions=debug_recirc
4775 ])
4776 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4777
4778 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)"
4779 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4780 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
4781 ])
4782 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4783 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
4784 ])
4785
4786 OVS_VSWITCHD_STOP
4787 AT_CLEANUP
4788
4789 dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
4790 dnl
4791 dnl Checks the implementation of the continuation mechanism that allows the
4792 dnl packet processing pipeline to be paused and resumed. Starts by creating
4793 dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
4794 dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
4795 dnl in the bridge, resuming each time the pipeline pauses, and expects a single
4796 dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
4797 dnl ACTIONS0 still contains at least one "pause" action, removes one of them
4798 dnl and repeats the process.
4799 dnl
4800 dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
4801 dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
4802 dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
4803 dnl into port 1 on br0, so br1 only comes into action if a patch port (added
4804 dnl by EXTRA_SETUP) jumps from one bridge to another.
4805 dnl
4806 dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
4807 dnl both bridges, e.g. to configure mirrors or patch ports.
4808 m4_define([CHECK_CONTINUATION], [dnl
4809 AT_SETUP([ofproto-dpif - continuation - $1])
4810 AT_KEYWORDS([continuations pause resume])
4811 OVS_VSWITCHD_START
4812
4813 # count_matches STRING
4814 #
4815 # Prints on stdout the number of occurrences of STRING in stdin.
4816 count_matches () {
4817 sed -n ":start
4818 s/$[1]//p
4819 t start" | wc -l
4820 }
4821
4822 add_of_ports --pcap br0 `seq 1 $2`
4823 m4_if([$3], [0], [],
4824 [add_of_br 1
4825 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
4826
4827 AT_CAPTURE_FILE([ofctl_monitor0.log])
4828 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
4829 m4_if([$3], [0], [],
4830 [AT_CAPTURE_FILE([ofctl_monitor1.log])
4831 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
4832
4833 actions0='$4'
4834 actions1='$5'
4835 $6
4836 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)"
4837 n_packets=0
4838 n_resumes=0
4839 while true; do
4840 printf "\n\nactions for br0:\n%s\n" "$actions0"
4841 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
4842
4843 # Add flows.
4844 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
4845 m4_if([$3], [0], [],
4846 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
4847
4848 # Make sure the datapath is up-to-date before sending the packet.
4849 ovs-appctl revalidator/wait
4850
4851 # Run a packet through the switch.
4852 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
4853
4854 # Wait for the expected number of packets to show up.
4855 n_packets=`expr $n_packets + $2 - 1 + $3`
4856 echo "waiting for $n_packets packets..."
4857 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
4858
4859 # Wait for the expected number of NXT_RESUMEs to be logged.
4860 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
4861 echo "waiting for $n_resumes NXT_RESUMEs..."
4862 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
4863
4864 # Eliminate one "pause" from the actions.
4865 #
4866 # If there were none left, then we're done.
4867 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
4868 if test X"$actions0" = X"$next_actions0"; then
4869 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
4870 if test X"$actions1" = X"$next_actions1"; then
4871 break
4872 else
4873 actions1=$next_actions1
4874 fi
4875 else
4876 actions0=$next_actions0
4877 fi
4878
4879 # Delete all the flows and verify that there are none, so that we
4880 # can be sure that our updated flow tables is actually in use
4881 # later.
4882 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
4883 [NXST_FLOW reply:
4884 ])
4885 m4_if([$3], [0], [],
4886 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
4887 [NXST_FLOW reply:
4888 ])])
4889 done
4890 OVS_VSWITCHD_STOP
4891 AT_CLEANUP
4892 ])
4893
4894 # Check that pause at the end of the pipeline works OK.
4895 #
4896 # (xlate_continuation() has a special case for no-op actions; this
4897 # fails without that special case.)
4898 CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
4899
4900 # Check that remaining actions are preserved following resume.
4901 CHECK_CONTINUATION([actions], [7], [0],
4902 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
4903
4904 # Check that multiple levels of resubmit continue following resume.
4905 #
4906 # The "resubmit:55", which is relative to the current table, is
4907 # particularly interesting because it checks that the notion of the
4908 # current table is correctly preserved.
4909 CHECK_CONTINUATION([resubmit], [10], [0],
4910 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
4911 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
4912 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
4913 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
4914 table=3 in_port=55 actions=pause 6 pause])
4915
4916 # Check that the action set is preserved across pause/resume.
4917 CHECK_CONTINUATION([action set], [3], [0],
4918 [in_port=1 actions=1 pause resubmit(,1) pause 2
4919 table=1 actions=write_actions(3)])
4920
4921 # Check that metadata and the stack used by push and pop is preserved
4922 # across pause/resume.
4923 CHECK_CONTINUATION([data stack], [3], [0],
4924 [in_port=1 actions=pause dnl
4925 set_field:1->reg0 dnl
4926 pause dnl
4927 set_field:2->reg1 dnl
4928 pause dnl
4929 output:NXM_NX_REG0[[]] dnl
4930 pause dnl
4931 push:NXM_NX_REG1[[]] dnl
4932 dnl
4933 pop:NXM_NX_REG2[[]] dnl
4934 pause dnl
4935 output:NXM_NX_REG2[[]] dnl
4936 pause dnl
4937 3])
4938
4939 # Check that mirror output occurs once and once only, even if
4940 # separated by pause/resume.
4941 CHECK_CONTINUATION([mirroring], [5], [0],
4942 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
4943 [ovs-vsctl \
4944 set Bridge br0 mirrors=@m --\
4945 --id=@p2 get Port p2 --\
4946 --id=@p3 get Port p3 --\
4947 --id=@p4 get Port p4 --\
4948 --id=@p5 get Port p5 --\
4949 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
4950
4951 # Check that pause works in the presence of patch ports.
4952 CHECK_CONTINUATION([patch ports], [4], [1],
4953 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
4954 table=1 in_port=1 actions=pause 3 pause 10 pause],
4955 [table=0 in_port=11 actions=pause 5 pause],
4956 [ovs-vsctl \
4957 -- add-port br0 patch10 \
4958 -- set interface patch10 type=patch options:peer=patch11 \
4959 ofport_request=10 \
4960 -- add-port br1 patch11 \
4961 -- set interface patch11 type=patch options:peer=patch10 \
4962 ofport_request=11])
4963
4964 # Two testcases below are for the ofproto/trace command
4965 # The first one tests all correct syntax:
4966 # ofproto/trace [dp_name] odp_flow [-generate|packet]
4967 # ofproto/trace br_name br_flow [-generate|packet]
4968 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
4969 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
4970 add_of_ports br0 1 2 3
4971
4972 AT_DATA([flows.txt], [dnl
4973 in_port=1 actions=output:2
4974 in_port=2 actions=output:1
4975 ])
4976 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4977
4978 odp_flow="in_port(p1)"
4979 br_flow="in_port=1"
4980 # Test command: ofproto/trace odp_flow with in_port as a name.
4981 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4982 AT_CHECK([tail -1 stdout], [0], [dnl
4983 Datapath actions: 2
4984 ])
4985
4986 odp_flow="in_port(1)"
4987 # Test command: ofproto/trace odp_flow
4988 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4989 AT_CHECK([tail -1 stdout], [0], [dnl
4990 Datapath actions: 2
4991 ])
4992
4993 # Test command: ofproto/trace dp_name odp_flow
4994 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
4995 AT_CHECK([tail -1 stdout], [0], [dnl
4996 Datapath actions: 2
4997 ])
4998 # Test commmand: ofproto/trace br_name br_flow
4999 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5000 AT_CHECK([tail -1 stdout], [0], [dnl
5001 Datapath actions: 2
5002 ])
5003
5004 # Delete the inserted flows
5005 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
5006 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
5007
5008 # This section below tests the [-generate] option
5009 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
5010 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"
5011
5012 # Test command: ofproto/trace odp_flow
5013 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5014 # Check for no MAC learning entry
5015 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5016 port VLAN MAC Age
5017 ])
5018
5019 # Test command: ofproto/trace br_name br_flow
5020 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5021 # Check for no MAC learning entry
5022 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5023 port VLAN MAC Age
5024 ])
5025
5026 # Test command: ofproto/trace odp_flow -generate
5027 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
5028 # Check for the MAC learning entry
5029 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5030 port VLAN MAC Age
5031 3 0 50:54:00:00:00:05 ?
5032 ])
5033
5034 # Test command: ofproto/trace dp_name odp_flow -generate
5035 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5036 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
5037 -generate], [0], [stdout])
5038 # Check for both MAC learning entries
5039 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5040 port VLAN MAC Age
5041 3 0 50:54:00:00:00:05 ?
5042 1 0 50:54:00:00:00:06 ?
5043 ])
5044
5045 # Test command: ofproto/trace br_name br_flow -generate
5046 AT_CHECK([ovs-appctl ofproto/trace br0 \
5047 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
5048 -generate], [0], [stdout])
5049 # Check for both MAC learning entries.
5050 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5051 port VLAN MAC Age
5052 3 0 50:54:00:00:00:05 ?
5053 1 0 50:54:00:00:00:06 ?
5054 2 0 50:54:00:00:00:07 ?
5055 ])
5056
5057 # This section beflow tests the [packet] option
5058 # The ovs-tcpundump of packets between port1 and port2
5059 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5060 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
5061
5062 # Construct the MAC learning table
5063 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5064 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
5065 -generate], [0], [stdout])
5066
5067 # Construct the MAC learning table
5068 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5069 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
5070 -generate], [0], [stdout])
5071
5072 # Test command: ofproto/trace odp_flow packet
5073 AT_CHECK([ovs-appctl ofproto/trace \
5074 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5075 AT_CHECK([tail -1 stdout], [0], [dnl
5076 Datapath actions: 2
5077 ])
5078 AT_CHECK([head -n 3 stdout], [0], [dnl
5079 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
5080
5081 bridge("br0")
5082 ])
5083
5084 # Test command: ofproto/trace dp_name odp_flow packet
5085 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5086 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5087 AT_CHECK([tail -1 stdout], [0], [dnl
5088 Datapath actions: 2
5089 ])
5090 AT_CHECK([head -n 3 stdout], [0], [dnl
5091 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
5092
5093 bridge("br0")
5094 ])
5095
5096 # Test command: ofproto/trace br_name br_flow packet
5097 AT_CHECK([ovs-appctl ofproto/trace br0 \
5098 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
5099 AT_CHECK([tail -1 stdout], [0], [dnl
5100 Datapath actions: 1
5101 ])
5102 AT_CHECK([head -n 3 stdout], [0], [dnl
5103 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
5104
5105 bridge("br0")
5106 ])
5107
5108 OVS_VSWITCHD_STOP
5109 AT_CLEANUP
5110
5111 # The second test tests the corner cases
5112 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
5113 OVS_VSWITCHD_START
5114 add_of_ports br0 1 2
5115
5116 # Define flows
5117 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
5118 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
5119 # Define options
5120 generate="-generate"
5121 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5122
5123 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
5124 m4_foreach(
5125 [option],
5126 [[],
5127 ["$generate"],
5128 ["$pkt"]],
5129 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
5130 [2], [], [stderr])
5131 AT_CHECK([tail -2 stderr], [0], [dnl
5132 Cannot find the datapath
5133 ovs-appctl: ovs-vswitchd: server returned an error
5134 ])])
5135
5136 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
5137 m4_foreach(
5138 [option],
5139 [[],
5140 ["$generate"],
5141 ["$pkt"]],
5142 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
5143 [2], [], [stderr])
5144 AT_CHECK([tail -2 stderr], [0], [dnl
5145 Cannot find the datapath
5146 ovs-appctl: ovs-vswitchd: server returned an error
5147 ])])
5148
5149 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
5150 m4_foreach(
5151 [option],
5152 [[],
5153 ["$generate"],
5154 ["$pkt"]],
5155 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
5156 [2], [], [stderr])
5157 AT_CHECK([tail -2 stderr], [0], [dnl
5158 Cannot find the datapath
5159 ovs-appctl: ovs-vswitchd: server returned an error
5160 ])])
5161
5162 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
5163 m4_foreach(
5164 [option],
5165 [[],
5166 ["$generate"],
5167 ["$pkt"]],
5168 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
5169 [2], [], [stderr])
5170 AT_CHECK([tail -2 stderr], [0], [dnl
5171 Cannot find the datapath
5172 ovs-appctl: ovs-vswitchd: server returned an error
5173 ])])
5174
5175 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
5176 m4_foreach(
5177 [option],
5178 [[],
5179 ["$generate"],
5180 ["$pkt"]],
5181 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
5182 [2], [], [stderr])
5183 AT_CHECK([tail -2 stderr], [0], [dnl
5184 Unknown bridge name
5185 ovs-appctl: ovs-vswitchd: server returned an error
5186 ])])
5187
5188 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
5189 m4_foreach(
5190 [option],
5191 [[],
5192 ["$generate"],
5193 ["$pkt"]],
5194 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
5195 [2], [], [stderr])
5196 AT_CHECK([tail -2 stderr], [0], [dnl
5197 Must specify bridge name
5198 ovs-appctl: ovs-vswitchd: server returned an error
5199 ])])
5200
5201 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
5202 AT_CHECK([ovs-appctl ofproto/trace \
5203 ovs-dummy "$odp_flow" garbage_option],
5204 [2], [stdout],[stderr])
5205 AT_CHECK([tail -2 stderr], [0], [dnl
5206 Trailing garbage in packet data
5207 ovs-appctl: ovs-vswitchd: server returned an error
5208 ])
5209
5210 # Test incorrect command: ofproto/trace with 4 arguments
5211 AT_CHECK([ovs-appctl ofproto/trace \
5212 arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
5213 AT_CHECK([tail -2 stderr], [0], [dnl
5214 "ofproto/trace" command takes at most 3 arguments
5215 ovs-appctl: ovs-vswitchd: server returned an error
5216 ])
5217
5218 # Test incorrect command: ofproto/trace with 0 argument
5219 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
5220 AT_CHECK([tail -2 stderr], [0], [dnl
5221 "ofproto/trace" command requires at least 1 arguments
5222 ovs-appctl: ovs-vswitchd: server returned an error
5223 ])
5224
5225 OVS_VSWITCHD_STOP
5226 AT_CLEANUP
5227
5228 # The third test checks that the output of "ovs-dpctl -m" is valid to trace.
5229 AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
5230 OVS_VSWITCHD_START([dnl
5231 set Open_vSwitch . other_config:max-idle=10000 \
5232 -- add-port br0 p1 -- set Interface p1 type=dummy])
5233
5234 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)'])
5235 ovs-appctl revalidator/wait
5236 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
5237
5238 odp_flow=`cat dp_flows1.txt`
5239 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5240 Flow: <cleared>
5241
5242 bridge("br0")
5243 -------------
5244 0. No match.
5245 drop
5246
5247 Final flow: <cleared>
5248 Megaflow: <cleared>
5249 Datapath actions: drop
5250 ])
5251
5252 dnl Now, try again without megaflows:
5253 ovs-appctl upcall/disable-megaflows
5254
5255 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)'])
5256 ovs-appctl revalidator/wait
5257 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
5258
5259 odp_flow=`cat dp_flows2.txt`
5260 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5261 Flow: <cleared>
5262
5263 bridge("br0")
5264 -------------
5265 0. No match.
5266 drop
5267
5268 Final flow: <cleared>
5269 Megaflow: <cleared>
5270 Datapath actions: drop
5271 ])
5272
5273 OVS_VSWITCHD_STOP
5274 AT_CLEANUP
5275
5276 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
5277 OVS_VSWITCHD_START
5278 add_of_ports br0 1 2 3
5279
5280 AT_DATA([flows.txt], [dnl
5281 in_port=1 actions=output:2
5282 in_port=2 actions=output:1
5283 ])
5284 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5285
5286 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
5287 AT_CHECK([tail -1 stdout], [0], [dnl
5288 Datapath actions: push_vlan(vid=123,pcp=0),2
5289 ])
5290
5291 OVS_VSWITCHD_STOP
5292 AT_CLEANUP
5293
5294
5295 m4_define([OFPROTO_TRACE],
5296 [flow="$2"
5297 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
5298 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5299 expected="$4"
5300 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
5301 [0], [stdout])
5302 mv stdout expout
5303 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
5304 [0], [expout])])
5305
5306 AT_SETUP([ofproto-dpif - MAC learning])
5307 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5308 add_of_ports br0 1 2 3
5309
5310 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)'
5311
5312 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
5313 OFPROTO_TRACE(
5314 [ovs-dummy],
5315 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5316 [-generate],
5317 [1,2,100])
5318
5319 # Check for the MAC learning entry.
5320 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5321 port VLAN MAC Age
5322 3 0 50:54:00:00:00:05 ?
5323 ])
5324
5325 # Trace a packet arrival destined for the learned MAC.
5326 # (This will also learn a MAC.)
5327 OFPROTO_TRACE(
5328 [ovs-dummy],
5329 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
5330 [-generate],
5331 [3])
5332
5333 # Check for both MAC learning entries.
5334 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5335 port VLAN MAC Age
5336 3 0 50:54:00:00:00:05 ?
5337 1 0 50:54:00:00:00:06 ?
5338 ])
5339
5340 # Trace a packet arrival that updates the first learned MAC entry.
5341 OFPROTO_TRACE(
5342 [ovs-dummy],
5343 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5344 [-generate],
5345 [1,3,100])
5346
5347 # Check that the MAC learning entry was updated.
5348 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5349 port VLAN MAC Age
5350 1 0 50:54:00:00:00:06 ?
5351 2 0 50:54:00:00:00:05 ?
5352 ])
5353
5354 # Add another bridge.
5355 AT_CHECK(
5356 [ovs-vsctl \
5357 -- add-br br1 \
5358 -- set bridge br1 datapath-type=dummy])
5359 add_of_ports br1 4 5
5360
5361 # Trace some packet arrivals in br1 to create MAC learning entries there too.
5362 OFPROTO_TRACE(
5363 [ovs-dummy],
5364 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
5365 [-generate],
5366 [5,101])
5367 OFPROTO_TRACE(
5368 [ovs-dummy],
5369 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
5370 [-generate],
5371 [4,101])
5372
5373 # Check that the MAC learning entries were added.
5374 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5375 port VLAN MAC Age
5376 4 0 50:54:00:00:00:06 ?
5377 5 0 50:54:00:00:00:07 ?
5378 ])
5379
5380 # Delete port p1 and see that its MAC learning entry disappeared, and
5381 # that the MAC learning entry for the same MAC was also deleted from br1.
5382 AT_CHECK([ovs-vsctl del-port p1])
5383 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5384 port VLAN MAC Age
5385 2 0 50:54:00:00:00:05 ?
5386 ])
5387 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5388 port VLAN MAC Age
5389 5 0 50:54:00:00:00:07 ?
5390 ])
5391
5392 OVS_VSWITCHD_STOP
5393 AT_CLEANUP
5394
5395 AT_SETUP([ofproto-dpif - MAC table overflow])
5396 OVS_VSWITCHD_START(
5397 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
5398 add_of_ports br0 1 2 3
5399
5400 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)'
5401
5402 AT_CHECK([ovs-appctl time/stop])
5403
5404 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
5405 for i in 0 1 2 3 4 5 6 7 8 9; do
5406 OFPROTO_TRACE(
5407 [ovs-dummy],
5408 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
5409 [-generate],
5410 [1,2,100])
5411 ovs-appctl time/warp 1000
5412 done
5413
5414 # Check for the MAC learning entries.
5415 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5416 [0], [dnl
5417 3 0 50:54:00:00:00:00
5418 3 0 50:54:00:00:00:01
5419 3 0 50:54:00:00:00:02
5420 3 0 50:54:00:00:00:03
5421 3 0 50:54:00:00:00:04
5422 3 0 50:54:00:00:00:05
5423 3 0 50:54:00:00:00:06
5424 3 0 50:54:00:00:00:07
5425 3 0 50:54:00:00:00:08
5426 3 0 50:54:00:00:00:09
5427 port VLAN MAC Age
5428 ])
5429
5430 # Trace another ARP packet on another MAC.
5431 OFPROTO_TRACE(
5432 [ovs-dummy],
5433 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
5434 [-generate],
5435 [1,2,100])
5436
5437 # Check that the new one chased the oldest one out of the table.
5438 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
5439 [0], [dnl
5440 3 0 50:54:00:00:00:01 ?
5441 3 0 50:54:00:00:00:02 ?
5442 3 0 50:54:00:00:00:03 ?
5443 3 0 50:54:00:00:00:04 ?
5444 3 0 50:54:00:00:00:05 ?
5445 3 0 50:54:00:00:00:06 ?
5446 3 0 50:54:00:00:00:07 ?
5447 3 0 50:54:00:00:00:08 ?
5448 3 0 50:54:00:00:00:09 ?
5449 3 0 50:54:00:00:00:10 ?
5450 port VLAN MAC Age
5451 ])
5452 OVS_VSWITCHD_STOP
5453 AT_CLEANUP
5454
5455 AT_SETUP([ofproto-dpif - MAC table overflow fairness])
5456 OVS_VSWITCHD_START(
5457 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
5458 add_of_ports br0 1 2 3 4 5 6
5459
5460 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)'
5461
5462 AT_CHECK([ovs-appctl time/stop])
5463
5464 # Trace packets with 2 different source MACs arriving on each of the 5
5465 # ports, filling up the 10-entry learning table.
5466 for i in 0 1 2 3 4 5 6 7 8 9; do
5467 p=`expr $i / 2 + 1`
5468 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
5469 ovs-appctl time/warp 1000
5470 done
5471
5472 # Check for the MAC learning entries.
5473 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5474 [0], [dnl
5475 1 0 50:54:00:00:00:00
5476 1 0 50:54:00:00:00:01
5477 2 0 50:54:00:00:00:02
5478 2 0 50:54:00:00:00:03
5479 3 0 50:54:00:00:00:04
5480 3 0 50:54:00:00:00:05
5481 4 0 50:54:00:00:00:06
5482 4 0 50:54:00:00:00:07
5483 5 0 50:54:00:00:00:08
5484 5 0 50:54:00:00:00:09
5485 port VLAN MAC Age
5486 ])
5487
5488 # Now trace 16 new MACs on another port.
5489 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
5490 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
5491 ovs-appctl time/warp 1000
5492 done
5493
5494 # Check the results.
5495 #
5496 # Our eviction algorithm on overflow is that an arbitrary (but deterministic)
5497 # one of the ports with the most learned MACs loses the least recently used
5498 # one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
5499 # MAC each, and the other 2 of the old ports with 2 MACs each.
5500 #
5501 # (If someone changes lib/heap.c to do something different with equal-priority
5502 # nodes, then the output below could change, but it would still follow the
5503 # rules explained above.)
5504 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5505 [0], [dnl
5506 1 0 50:54:00:00:00:01
5507 2 0 50:54:00:00:00:03
5508 3 0 50:54:00:00:00:04
5509 3 0 50:54:00:00:00:05
5510 4 0 50:54:00:00:00:07
5511 5 0 50:54:00:00:00:08
5512 5 0 50:54:00:00:00:09
5513 6 0 50:54:00:00:0d:ff
5514 6 0 50:54:00:00:0e:ff
5515 6 0 50:54:00:00:0f:ff
5516 port VLAN MAC Age
5517 ])
5518 OVS_VSWITCHD_STOP
5519 AT_CLEANUP
5520
5521 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
5522 #
5523 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
5524 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
5525 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5526 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5527
5528 on_exit 'kill `cat test-sflow.pid`'
5529 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
5530 AT_CAPTURE_FILE([sflow.log])
5531 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5532 ovs-appctl time/stop
5533
5534 add_of_ports br0 1 2
5535 ovs-vsctl \
5536 set Interface br0 options:ifindex=1002 -- \
5537 set Interface p1 options:ifindex=1004 -- \
5538 set Interface p2 options:ifindex=1003 -- \
5539 set Bridge br0 sflow=@sf -- \
5540 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
5541 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
5542
5543 dnl open with ARP packets to seed the bridge-learning. The output
5544 dnl ifIndex numbers should be reported predictably after that.
5545 dnl Since we set sampling=1 we should see all of these packets
5546 dnl reported. Sorting the output by data-source and seqNo makes
5547 dnl it deterministic. Ensuring that we send at least two packets
5548 dnl into each port means we get to check the seq nos are
5549 dnl incrementing correctly.
5550 dnl because packets from different ports can be handled by separate
5551 dnl threads, put some sleeps
5552
5553 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)'
5554 sleep 1
5555 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)'
5556 sleep 1
5557 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)'
5558 sleep 1
5559 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)'
5560 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)'
5561
5562 dnl sleep long enough to get more than one counter sample
5563 dnl from each datasource so we can check sequence numbers
5564 ovs-appctl time/warp 2000 100
5565 OVS_VSWITCHD_STOP
5566 OVS_APP_EXIT_AND_WAIT([test-sflow])
5567
5568 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5569 /g']], [0], [dnl
5570 HEADER
5571 dgramSeqNo=1
5572 ds=127.0.0.1>2:1000
5573 fsSeqNo=1
5574 in_vlan=0
5575 in_priority=0
5576 out_vlan=0
5577 out_priority=0
5578 meanSkip=1
5579 samplePool=1
5580 dropEvents=0
5581 in_ifindex=1004
5582 in_format=0
5583 out_ifindex=2
5584 out_format=2
5585 hdr_prot=1
5586 pkt_len=46
5587 stripped=4
5588 hdr_len=42
5589 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
5590 HEADER
5591 dgramSeqNo=1
5592 ds=127.0.0.1>2:1000
5593 fsSeqNo=2
5594 in_vlan=0
5595 in_priority=0
5596 out_vlan=0
5597 out_priority=0
5598 meanSkip=1
5599 samplePool=2
5600 dropEvents=0
5601 in_ifindex=1003
5602 in_format=0
5603 out_ifindex=2
5604 out_format=2
5605 hdr_prot=1
5606 pkt_len=46
5607 stripped=4
5608 hdr_len=42
5609 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
5610 HEADER
5611 dgramSeqNo=1
5612 ds=127.0.0.1>2:1000
5613 fsSeqNo=3
5614 in_vlan=0
5615 in_priority=0
5616 out_vlan=0
5617 out_priority=0
5618 meanSkip=1
5619 samplePool=3
5620 dropEvents=0
5621 in_ifindex=1004
5622 in_format=0
5623 out_ifindex=1003
5624 out_format=0
5625 hdr_prot=1
5626 pkt_len=46
5627 stripped=4
5628 hdr_len=42
5629 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
5630 HEADER
5631 dgramSeqNo=1
5632 ds=127.0.0.1>2:1000
5633 fsSeqNo=4
5634 in_vlan=0
5635 in_priority=0
5636 out_vlan=0
5637 out_priority=0
5638 meanSkip=1
5639 samplePool=4
5640 dropEvents=0
5641 in_ifindex=1003
5642 in_format=0
5643 out_ifindex=1004
5644 out_format=0
5645 hdr_prot=1
5646 pkt_len=46
5647 stripped=4
5648 hdr_len=42
5649 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
5650 HEADER
5651 dgramSeqNo=1
5652 ds=127.0.0.1>2:1000
5653 fsSeqNo=5
5654 in_vlan=0
5655 in_priority=0
5656 out_vlan=0
5657 out_priority=0
5658 meanSkip=1
5659 samplePool=5
5660 dropEvents=0
5661 in_ifindex=1003
5662 in_format=0
5663 out_ifindex=1004
5664 out_format=0
5665 hdr_prot=1
5666 pkt_len=58
5667 stripped=4
5668 hdr_len=54
5669 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
5670 ])
5671
5672 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'ETHCOUNTERS|IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -24 | sed 's/ /\
5673 /g']], [0], [dnl
5674 ETHCOUNTERS
5675 dot3StatsAlignmentErrors=4294967295
5676 dot3StatsFCSErrors=4294967295
5677 dot3StatsSingleCollisionFrames=4294967295
5678 dot3StatsMultipleCollisionFrames=4294967295
5679 dot3StatsSQETestErrors=4294967295
5680 dot3StatsDeferredTransmissions=4294967295
5681 dot3StatsLateCollisions=4294967295
5682 dot3StatsExcessiveCollisions=4294967295
5683 dot3StatsInternalMacTransmitErrors=4294967295
5684 dot3StatsCarrierSenseErrors=4294967295
5685 dot3StatsFrameTooLongs=4294967295
5686 dot3StatsInternalMacReceiveErrors=4294967295
5687 dot3StatsSymbolErrors=4294967295
5688 ETHCOUNTERS
5689 dot3StatsAlignmentErrors=4294967295
5690 dot3StatsFCSErrors=4294967295
5691 dot3StatsSingleCollisionFrames=4294967295
5692 dot3StatsMultipleCollisionFrames=4294967295
5693 dot3StatsSQETestErrors=4294967295
5694 dot3StatsDeferredTransmissions=4294967295
5695 dot3StatsLateCollisions=4294967295
5696 dot3StatsExcessiveCollisions=4294967295
5697 dot3StatsInternalMacTransmitErrors=4294967295
5698 dot3StatsCarrierSenseErrors=4294967295
5699 dot3StatsFrameTooLongs=4294967295
5700 dot3StatsInternalMacReceiveErrors=4294967295
5701 dot3StatsSymbolErrors=4294967295
5702 ETHCOUNTERS
5703 dot3StatsAlignmentErrors=4294967295
5704 dot3StatsFCSErrors=4294967295
5705 dot3StatsSingleCollisionFrames=4294967295
5706 dot3StatsMultipleCollisionFrames=4294967295
5707 dot3StatsSQETestErrors=4294967295
5708 dot3StatsDeferredTransmissions=4294967295
5709 dot3StatsLateCollisions=4294967295
5710 dot3StatsExcessiveCollisions=4294967295
5711 dot3StatsInternalMacTransmitErrors=4294967295
5712 dot3StatsCarrierSenseErrors=4294967295
5713 dot3StatsFrameTooLongs=4294967295
5714 dot3StatsInternalMacReceiveErrors=4294967295
5715 dot3StatsSymbolErrors=4294967295
5716 ETHCOUNTERS
5717 dot3StatsAlignmentErrors=4294967295
5718 dot3StatsFCSErrors=4294967295
5719 dot3StatsSingleCollisionFrames=4294967295
5720 dot3StatsMultipleCollisionFrames=4294967295
5721 dot3StatsSQETestErrors=4294967295
5722 dot3StatsDeferredTransmissions=4294967295
5723 dot3StatsLateCollisions=4294967295
5724 dot3StatsExcessiveCollisions=4294967295
5725 dot3StatsInternalMacTransmitErrors=4294967295
5726 dot3StatsCarrierSenseErrors=4294967295
5727 dot3StatsFrameTooLongs=4294967295
5728 dot3StatsInternalMacReceiveErrors=4294967295
5729 dot3StatsSymbolErrors=4294967295
5730 ETHCOUNTERS
5731 dot3StatsAlignmentErrors=4294967295
5732 dot3StatsFCSErrors=4294967295
5733 dot3StatsSingleCollisionFrames=4294967295
5734 dot3StatsMultipleCollisionFrames=4294967295
5735 dot3StatsSQETestErrors=4294967295
5736 dot3StatsDeferredTransmissions=4294967295
5737 dot3StatsLateCollisions=4294967295
5738 dot3StatsExcessiveCollisions=4294967295
5739 dot3StatsInternalMacTransmitErrors=4294967295
5740 dot3StatsCarrierSenseErrors=4294967295
5741 dot3StatsFrameTooLongs=4294967295
5742 dot3StatsInternalMacReceiveErrors=4294967295
5743 dot3StatsSymbolErrors=4294967295
5744 ETHCOUNTERS
5745 dot3StatsAlignmentErrors=4294967295
5746 dot3StatsFCSErrors=4294967295
5747 dot3StatsSingleCollisionFrames=4294967295
5748 dot3StatsMultipleCollisionFrames=4294967295
5749 dot3StatsSQETestErrors=4294967295
5750 dot3StatsDeferredTransmissions=4294967295
5751 dot3StatsLateCollisions=4294967295
5752 dot3StatsExcessiveCollisions=4294967295
5753 dot3StatsInternalMacTransmitErrors=4294967295
5754 dot3StatsCarrierSenseErrors=4294967295
5755 dot3StatsFrameTooLongs=4294967295
5756 dot3StatsInternalMacReceiveErrors=4294967295
5757 dot3StatsSymbolErrors=4294967295
5758 IFCOUNTERS
5759 dgramSeqNo=1
5760 ds=127.0.0.1>0:1003
5761 csSeqNo=1
5762 ifindex=1003
5763 type=6
5764 ifspeed=100000000
5765 direction=0
5766 status=0
5767 in_octets=138
5768 in_unicasts=3
5769 in_multicasts=4294967295
5770 in_broadcasts=4294967295
5771 in_discards=4294967295
5772 in_errors=4294967295
5773 in_unknownprotos=4294967295
5774 out_octets=84
5775 out_unicasts=2
5776 out_multicasts=4294967295
5777 out_broadcasts=4294967295
5778 out_discards=4294967295
5779 out_errors=4294967295
5780 promiscuous=0
5781 IFCOUNTERS
5782 dgramSeqNo=1
5783 ds=127.0.0.1>0:1004
5784 csSeqNo=1
5785 ifindex=1004
5786 type=6
5787 ifspeed=100000000
5788 direction=0
5789 status=0
5790 in_octets=84
5791 in_unicasts=2
5792 in_multicasts=4294967295
5793 in_broadcasts=4294967295
5794 in_discards=4294967295
5795 in_errors=4294967295
5796 in_unknownprotos=4294967295
5797 out_octets=138
5798 out_unicasts=3
5799 out_multicasts=4294967295
5800 out_broadcasts=4294967295
5801 out_discards=4294967295
5802 out_errors=4294967295
5803 promiscuous=0
5804 IFCOUNTERS
5805 dgramSeqNo=2
5806 ds=127.0.0.1>0:1002
5807 csSeqNo=1
5808 ifindex=1002
5809 type=6
5810 ifspeed=100000000
5811 direction=0
5812 status=0
5813 in_octets=0
5814 in_unicasts=0
5815 in_multicasts=4294967295
5816 in_broadcasts=4294967295
5817 in_discards=4294967295
5818 in_errors=4294967295
5819 in_unknownprotos=4294967295
5820 out_octets=84
5821 out_unicasts=2
5822 out_multicasts=4294967295
5823 out_broadcasts=4294967295
5824 out_discards=4294967295
5825 out_errors=4294967295
5826 promiscuous=0
5827 IFCOUNTERS
5828 dgramSeqNo=3
5829 ds=127.0.0.1>0:1002
5830 csSeqNo=2
5831 ifindex=1002
5832 type=6
5833 ifspeed=100000000
5834 direction=0
5835 status=0
5836 in_octets=0
5837 in_unicasts=0
5838 in_multicasts=4294967295
5839 in_broadcasts=4294967295
5840 in_discards=4294967295
5841 in_errors=4294967295
5842 in_unknownprotos=4294967295
5843 out_octets=84
5844 out_unicasts=2
5845 out_multicasts=4294967295
5846 out_broadcasts=4294967295
5847 out_discards=4294967295
5848 out_errors=4294967295
5849 promiscuous=0
5850 IFCOUNTERS
5851 dgramSeqNo=3
5852 ds=127.0.0.1>0:1003
5853 csSeqNo=2
5854 ifindex=1003
5855 type=6
5856 ifspeed=100000000
5857 direction=0
5858 status=0
5859 in_octets=138
5860 in_unicasts=3
5861 in_multicasts=4294967295
5862 in_broadcasts=4294967295
5863 in_discards=4294967295
5864 in_errors=4294967295
5865 in_unknownprotos=4294967295
5866 out_octets=84
5867 out_unicasts=2
5868 out_multicasts=4294967295
5869 out_broadcasts=4294967295
5870 out_discards=4294967295
5871 out_errors=4294967295
5872 promiscuous=0
5873 IFCOUNTERS
5874 dgramSeqNo=3
5875 ds=127.0.0.1>0:1004
5876 csSeqNo=2
5877 ifindex=1004
5878 type=6
5879 ifspeed=100000000
5880 direction=0
5881 status=0
5882 in_octets=84
5883 in_unicasts=2
5884 in_multicasts=4294967295
5885 in_broadcasts=4294967295
5886 in_discards=4294967295
5887 in_errors=4294967295
5888 in_unknownprotos=4294967295
5889 out_octets=138
5890 out_unicasts=3
5891 out_multicasts=4294967295
5892 out_broadcasts=4294967295
5893 out_discards=4294967295
5894 out_errors=4294967295
5895 promiscuous=0
5896 OPENFLOWPORT
5897 datapath_id=18364758544493064720
5898 port_no=1
5899 OPENFLOWPORT
5900 datapath_id=18364758544493064720
5901 port_no=1
5902 OPENFLOWPORT
5903 datapath_id=18364758544493064720
5904 port_no=2
5905 OPENFLOWPORT
5906 datapath_id=18364758544493064720
5907 port_no=2
5908 OPENFLOWPORT
5909 datapath_id=18364758544493064720
5910 port_no=65534
5911 OPENFLOWPORT
5912 datapath_id=18364758544493064720
5913 port_no=65534
5914 PORTNAME
5915 portName=br0
5916 PORTNAME
5917 portName=br0
5918 PORTNAME
5919 portName=p1
5920 PORTNAME
5921 portName=p1
5922 PORTNAME
5923 portName=p2
5924 PORTNAME
5925 portName=p2
5926 ])])
5927
5928 AT_SETUP([ofproto-dpif - basic truncate action])
5929 OVS_VSWITCHD_START
5930 add_of_ports br0 1 2 3 4 5
5931
5932 AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
5933 AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
5934 AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
5935 AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
5936 AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
5937
5938 AT_DATA([flows.txt], [dnl
5939 in_port=3,actions=drop
5940 in_port=5,actions=drop
5941 in_port=1,actions=output(port=2,max_len=64),output:4
5942 ])
5943 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5944
5945 dnl Datapath actions
5946 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])
5947 AT_CHECK([tail -1 stdout], [0],
5948 [Datapath actions: trunc(64),2,4
5949 ])
5950
5951 dnl An 170 byte packet
5952 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
5953
5954 AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
5955 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
5956 ])
5957
5958 AT_CHECK([ovs-appctl revalidator/purge], [0])
5959 dnl packet with truncated size
5960 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5961 n_bytes=64
5962 ])
5963 dnl packet with original size
5964 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5965 n_bytes=170
5966 ])
5967
5968 dnl More complicated case
5969 AT_CHECK([ovs-ofctl del-flows br0])
5970 AT_DATA([flows.txt], [dnl
5971 in_port=3,actions=drop
5972 in_port=5,actions=drop
5973 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
5974 ])
5975 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5976
5977 dnl Datapath actions
5978 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])
5979 AT_CHECK([tail -1 stdout], [0],
5980 [Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
5981 ])
5982
5983 dnl An 170 byte packet
5984 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
5985
5986 AT_CHECK([ovs-appctl revalidator/purge], [0])
5987 dnl packet size: 64 + 128 + 170 = 362
5988 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5989 n_bytes=362
5990 ])
5991 dnl packet size: 60 + 170 = 230
5992 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
5993 n_bytes=230
5994 ])
5995
5996 dnl syntax checking
5997 AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
5998 ovs-ofctl: output to unsupported truncate port: ALL
5999 ])
6000
6001 OVS_VSWITCHD_STOP
6002 AT_CLEANUP
6003
6004 AT_SETUP([ofproto-dpif - truncate and output to patch port])
6005 OVS_VSWITCHD_START([add-br br1 \
6006 -- set bridge br1 datapath-type=dummy fail-mode=secure \
6007 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 ofport_request=1 \
6008 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6009
6010 add_of_ports br0 2
6011
6012 AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
6013 AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
6014
6015 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6016 [0], [stdout])
6017 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
6018 ])
6019 dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
6020 AT_CHECK([grep "output_trunc does not support patch port [[0-9]]*" stdout], [0], [stdout])
6021
6022 OVS_VSWITCHD_STOP
6023 AT_CLEANUP
6024
6025 AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
6026 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6027 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6028 options:key=5 ofport_request=1\
6029 -- add-port br0 p2 -- set Interface p2 type=dummy \
6030 ofport_request=2])
6031 AT_DATA([flows.txt], [dnl
6032 actions=output(max_len=100, port=1)
6033 ])
6034 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6035 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6036
6037 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
6038 br0 65534/100: (dummy-internal)
6039 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
6040 p2 2/2: (dummy)
6041 ])
6042
6043 dnl Basic
6044 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])
6045 AT_CHECK([tail -1 stdout], [0],
6046 [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
6047 ])
6048
6049 OVS_VSWITCHD_STOP
6050 AT_CLEANUP
6051
6052 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
6053 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
6054 AT_CLEANUP
6055
6056 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
6057 AT_SKIP_IF([test $HAVE_IPV6 = no])
6058 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
6059 AT_CLEANUP
6060
6061 dnl Test sFlow LAG structures
6062 AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
6063 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
6064 OVS_VSWITCHD_START([dnl
6065 add-bond br0 bond p1 p2 -- \
6066 set Port bond lacp=active bond-mode=active-backup \
6067 other_config:lacp-time="fast" \
6068 other_config:lacp-system-id=11:22:33:44:55:66 \
6069 other_config:lacp-system-priority=54321 -- \
6070 set Interface p1 type=dummy \
6071 other_config:lacp-port-id=11 \
6072 other_config:lacp-port-priority=111 \
6073 other_config:lacp-aggregation-key=3333 -- \
6074 set Interface p2 type=dummy \
6075 other_config:lacp-port-id=22 \
6076 other_config:lacp-port-priority=222 \
6077 other_config:lacp-aggregation-key=3333 ])
6078
6079 on_exit 'kill `cat test-sflow.pid`'
6080 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6081 AT_CAPTURE_FILE([sflow.log])
6082 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6083
6084 ovs-appctl time/stop
6085
6086 ovs-vsctl \
6087 set Interface p1 options:ifindex=1003 -- \
6088 set Bridge br0 sflow=@sf -- \
6089 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6090 header=128 sampling=1 polling=1
6091
6092 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6093 AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
6094 AT_CHECK([ovs-appctl revalidator/purge], [0])
6095 OVS_VSWITCHD_STOP
6096 OVS_APP_EXIT_AND_WAIT([test-sflow])
6097 AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
6098 /g']], [0], [dnl
6099 LACPCOUNTERS
6100 sysID=11:22:33:44:55:66
6101 partnerID=00:00:00:00:00:00
6102 aggID=3333
6103 actorAdmin=0x7
6104 actorOper=0xbf
6105 partnerAdmin=0x0
6106 partnerOper=0x2
6107 LACPDUsRx=0
6108 markerPDUsRx=4294967295
6109 markerRespPDUsRx=4294967295
6110 unknownRx=4294967295
6111 illegalRx=0
6112 LACPDUsTx=1
6113 markerPDUsTx=4294967295
6114 markerRespPDUsTx=4294967295
6115 ])
6116
6117 AT_CLEANUP
6118
6119 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
6120 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6121 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6122
6123 dnl set up sFlow logging
6124 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6125 AT_CAPTURE_FILE([sflow.log])
6126 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6127 ovs-appctl time/stop
6128
6129 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6130 AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
6131 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
6132 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
6133
6134 AT_CHECK([ovs-ofctl add-flow br0 action=3])
6135
6136 dnl enable sflow
6137 ovs-vsctl \
6138 set Bridge br0 sflow=@sf -- \
6139 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6140 header=128 sampling=1 polling=0
6141
6142 dnl introduce a packet that will be flooded to the tunnel
6143 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)'])
6144
6145 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6146 for i in `seq 1 30`; do
6147 ovs-appctl time/warp 100
6148 done
6149
6150 OVS_APP_EXIT_AND_WAIT([test-sflow])
6151
6152 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6153 /g']], [0], [dnl
6154 HEADER
6155 dgramSeqNo=1
6156 ds=127.0.0.1>2:1000
6157 fsSeqNo=1
6158 tunnel4_out_length=0
6159 tunnel4_out_protocol=47
6160 tunnel4_out_src=0.0.0.0
6161 tunnel4_out_dst=1.1.1.1
6162 tunnel4_out_src_port=0
6163 tunnel4_out_dst_port=0
6164 tunnel4_out_tcp_flags=0
6165 tunnel4_out_tos=1
6166 tunnel_out_vni=456
6167 in_vlan=0
6168 in_priority=0
6169 out_vlan=0
6170 out_priority=0
6171 meanSkip=1
6172 samplePool=1
6173 dropEvents=0
6174 in_ifindex=0
6175 in_format=0
6176 out_ifindex=1
6177 out_format=2
6178 hdr_prot=1
6179 pkt_len=46
6180 stripped=4
6181 hdr_len=42
6182 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
6183 ])
6184
6185 OVS_VSWITCHD_STOP
6186 AT_CLEANUP
6187
6188 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
6189 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6190
6191 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
6192
6193 dnl set up sFlow logging
6194 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6195 AT_CAPTURE_FILE([sflow.log])
6196 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6197 ovs-appctl time/stop
6198
6199 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6200 AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
6201 AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
6202 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
6203 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
6204 options:ifindex=2011 ofport_request=5
6205 ], [0])
6206
6207 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6208 dummy@ovs-dummy: hit:0 missed:0
6209 br0:
6210 br0 65534/100: (dummy-internal)
6211 p0 1/1: (dummy: ifindex=1010)
6212 int-br:
6213 int-br 65534/2: (dummy-internal)
6214 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
6215 vm1 5/3: (dummy: ifindex=2011)
6216 ])
6217
6218 dnl set up route to 1.1.2.92 via br0 and action=normal
6219 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
6220 ])
6221 AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
6222 ])
6223 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6224
6225 dnl Prime ARP Cache for 1.1.2.92
6226 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)'])
6227
6228 dnl configure sflow on int-br only
6229 ovs-vsctl \
6230 set Bridge int-br sflow=@sf -- \
6231 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6232 header=128 sampling=1 polling=0
6233
6234 dnl set up route to 192.168.1.2 via br0
6235 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
6236 ])
6237 AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
6238 ])
6239
6240 dnl add rule for int-br to force packet onto tunnel. There is no ifindex
6241 dnl for this port so the sFlow output will just report that it went to
6242 dnl 1 output (out_format=2, out_ifindex=1)
6243 AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
6244
6245 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)'])
6246
6247 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6248 for i in `seq 1 30`; do
6249 ovs-appctl time/warp 100
6250 done
6251
6252 OVS_APP_EXIT_AND_WAIT([test-sflow])
6253
6254 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6255 /g']], [0], [dnl
6256 HEADER
6257 dgramSeqNo=1
6258 ds=127.0.0.1>2:1000
6259 fsSeqNo=1
6260 tunnel4_out_length=0
6261 tunnel4_out_protocol=47
6262 tunnel4_out_src=1.1.2.88
6263 tunnel4_out_dst=1.1.2.92
6264 tunnel4_out_src_port=0
6265 tunnel4_out_dst_port=0
6266 tunnel4_out_tcp_flags=0
6267 tunnel4_out_tos=0
6268 tunnel_out_vni=456
6269 in_vlan=0
6270 in_priority=0
6271 out_vlan=0
6272 out_priority=0
6273 meanSkip=1
6274 samplePool=1
6275 dropEvents=0
6276 in_ifindex=2011
6277 in_format=0
6278 out_ifindex=1
6279 out_format=2
6280 hdr_prot=1
6281 pkt_len=46
6282 stripped=4
6283 hdr_len=42
6284 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
6285 ])
6286
6287 OVS_VSWITCHD_STOP
6288 AT_CLEANUP
6289
6290 AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
6291 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6292 OVS_VSWITCHD_START
6293 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6294 add_of_ports br0 1 2
6295 AT_DATA([flows.txt], [dnl
6296 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
6297 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6298 ])
6299 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6300
6301 dnl set up sFlow logging
6302 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6303 AT_CAPTURE_FILE([sflow.log])
6304 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6305 ovs-appctl time/stop
6306
6307 dnl configure sflow
6308 ovs-vsctl \
6309 set Bridge br0 sflow=@sf -- \
6310 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6311 header=128 sampling=1 polling=0
6312
6313 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)'])
6314 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)'])
6315
6316 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6317 for i in `seq 1 30`; do
6318 ovs-appctl time/warp 100
6319 done
6320
6321 OVS_APP_EXIT_AND_WAIT([test-sflow])
6322
6323 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6324 /g']], [0], [dnl
6325 HEADER
6326 dgramSeqNo=1
6327 ds=127.0.0.1>2:1000
6328 fsSeqNo=1
6329 mpls_label_0=789
6330 mpls_tc_0=4
6331 mpls_ttl_0=32
6332 mpls_bos_0=0
6333 mpls_label_1=11
6334 mpls_tc_1=3
6335 mpls_ttl_1=64
6336 mpls_bos_1=1
6337 in_vlan=0
6338 in_priority=0
6339 out_vlan=0
6340 out_priority=0
6341 meanSkip=1
6342 samplePool=1
6343 dropEvents=0
6344 in_ifindex=0
6345 in_format=0
6346 out_ifindex=1
6347 out_format=2
6348 hdr_prot=1
6349 pkt_len=22
6350 stripped=4
6351 hdr_len=18
6352 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40
6353 HEADER
6354 dgramSeqNo=1
6355 ds=127.0.0.1>2:1000
6356 fsSeqNo=2
6357 mpls_label_0=789
6358 mpls_tc_0=4
6359 mpls_ttl_0=32
6360 mpls_bos_0=1
6361 in_vlan=0
6362 in_priority=0
6363 out_vlan=0
6364 out_priority=0
6365 meanSkip=1
6366 samplePool=2
6367 dropEvents=0
6368 in_ifindex=0
6369 in_format=0
6370 out_ifindex=1
6371 out_format=2
6372 hdr_prot=1
6373 pkt_len=38
6374 stripped=4
6375 hdr_len=34
6376 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
6377 ])
6378
6379 OVS_VSWITCHD_STOP
6380 AT_CLEANUP
6381
6382
6383 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
6384 #
6385 # Test that basic NetFlow reports flow statistics correctly:
6386 # The initial packet of a flow are correctly accounted.
6387 # Later packets within a flow are correctly accounted.
6388 # Flow actions changing (in this case, due to MAC learning)
6389 # cause a record to be sent.
6390 m4_define([CHECK_NETFLOW_EXPIRATION],
6391 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6392 add_of_ports br0 1 2
6393
6394 ovs-appctl time/stop
6395 on_exit 'kill `cat test-netflow.pid`'
6396 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6397 AT_CAPTURE_FILE([netflow.log])
6398 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6399
6400 ovs-vsctl \
6401 set Bridge br0 netflow=@nf -- \
6402 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6403 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6404
6405 for delay in 1000 30000; do
6406 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)'
6407 sleep 1 # ensure the order in which these two packets are processed
6408 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)'
6409
6410 ovs-appctl time/warp $delay
6411 done
6412
6413 ovs-appctl time/warp 6000
6414 ovs-appctl revalidator/wait
6415 OVS_VSWITCHD_STOP
6416 OVS_APP_EXIT_AND_WAIT([test-netflow])
6417
6418 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])
6419
6420 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])
6421
6422 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 84 bytes, ICMP 0:0" netflow.log | wc -l`
6423 separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 42 bytes, ICMP 0:0" netflow.log | wc -l`
6424 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
6425
6426 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
6427 CHECK_NETFLOW_EXPIRATION([127.0.0.1])
6428 AT_CLEANUP
6429
6430 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
6431 AT_SKIP_IF([test $HAVE_IPV6 = no])
6432 CHECK_NETFLOW_EXPIRATION([[[::1]]])
6433 AT_CLEANUP
6434
6435 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
6436 #
6437 # Test that basic NetFlow reports active expirations correctly.
6438 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
6439 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6440 add_of_ports br0 1 2
6441
6442 on_exit 'kill `cat test-netflow.pid`'
6443 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6444 AT_CAPTURE_FILE([netflow.log])
6445 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6446
6447 ovs-vsctl \
6448 set Bridge br0 netflow=@nf -- \
6449 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6450 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
6451
6452 AT_CHECK([ovs-appctl time/stop])
6453 n=1
6454 while test $n -le 60; do
6455 n=`expr $n + 1`
6456
6457 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)'
6458 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)'
6459
6460 ovs-appctl time/warp 1000
6461 done
6462
6463 ovs-appctl time/warp 10000
6464
6465 ovs-appctl revalidator/wait
6466 OVS_VSWITCHD_STOP
6467 OVS_APP_EXIT_AND_WAIT([test-netflow])
6468
6469 # Count the number of reported packets:
6470 # - From source to destination before MAC learning kicks in (just one).
6471 # - From source to destination after that.
6472 # - From destination to source.
6473 n_learn=0
6474 n_in=0
6475 n_out=0
6476 n_other=0
6477 n_recs=0
6478 none=0
6479 while read line; do
6480 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
6481 case $pkts in
6482 [[0-9]]*) ;;
6483 *) continue ;;
6484 esac
6485
6486 case $line in
6487 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6488 counter=n_learn
6489 ;;
6490 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6491 counter=n_in
6492 ;;
6493 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
6494 counter=n_out
6495 ;;
6496 *)
6497 counter=n_other
6498 ;;
6499 esac
6500 eval $counter=\`expr \$$counter + \$pkts\`
6501 n_recs=`expr $n_recs + 1`
6502 done < netflow.log
6503
6504 # There should be exactly 1 MAC learning packet,
6505 # exactly 59 other packets in that direction,
6506 # and exactly 60 packets in the other direction.
6507 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
6508 ])])
6509
6510 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
6511 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
6512 AT_CLEANUP
6513
6514 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
6515 AT_SKIP_IF([test $HAVE_IPV6 = no])
6516 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
6517 AT_CLEANUP
6518
6519 dnl In the absence of an IPFIX collector to verify protocol correctness, simply
6520 dnl configure bridge IPFIX and ensure that sample action generation works at the
6521 dnl datapath level.
6522 AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
6523 OVS_VSWITCHD_START
6524 add_of_ports br0 1 2
6525
6526 dnl Sample every packet using bridge-based sampling.
6527 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
6528 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
6529 sampling=1], [0], [ignore])
6530
6531 dnl Send some packets that should be sampled.
6532 for i in `seq 1 3`; do
6533 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)'])
6534 done
6535 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6536 flow-dump from non-dpdk interfaces:
6537 packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))
6538 ])
6539
6540 AT_CHECK([ovs-appctl revalidator/purge])
6541 dnl
6542 dnl Add a slowpath meter. The userspace action should be metered.
6543 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])
6544
6545 dnl Send some packets that should be sampled and metered.
6546 for i in `seq 1 3`; do
6547 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)'])
6548 done
6549 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6550 flow-dump from non-dpdk interfaces:
6551 packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))
6552 ])
6553
6554 dnl Remove the IPFIX configuration.
6555 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
6556 AT_CHECK([ovs-appctl revalidator/purge])
6557
6558 dnl Send some more packets, to ensure that these are not sampled.
6559 for i in `seq 1 3`; do
6560 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)'])
6561 done
6562 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6563 flow-dump from non-dpdk interfaces:
6564 packets:2, bytes:68, used:0.001s, actions:drop
6565 ])
6566
6567 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6568 AT_CLEANUP
6569
6570 dnl Bridge IPFIX statistics check
6571 AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
6572 OVS_VSWITCHD_START
6573 add_of_ports br0 1 2
6574
6575 dnl Negative test check.
6576 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
6577 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6578 NXST_IPFIX_BRIDGE request (xid=0x2):
6579 ])
6580
6581 dnl Sample every packet using bridge-based sampling.
6582 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
6583 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
6584 sampling=1], [0], [ignore])
6585
6586 dnl Send some packets that should be sampled.
6587 for i in `seq 1 20`; do
6588 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)'])
6589 done
6590
6591 dnl There are 4 extra IPFIX template packets.
6592 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
6593 NXST_IPFIX_BRIDGE reply (xid=0x2):
6594 bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
6595 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
6596 ])
6597
6598 dnl Remove the IPFIX configuration.
6599 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
6600 AT_CHECK([ovs-appctl revalidator/purge])
6601
6602 dnl Send some more packets, to ensure that these are not sampled.
6603 for i in `seq 1 2`; do
6604 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)'])
6605 done
6606 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
6607 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6608 NXST_IPFIX_BRIDGE request (xid=0x2):
6609 ])
6610
6611 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6612 AT_CLEANUP
6613
6614 dnl Flow IPFIX sanity check
6615 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
6616 OVS_VSWITCHD_START
6617 add_of_ports br0 1 2
6618
6619 # Check for regression against a bug where an invalid target caused an
6620 # assertion failure and a crash.
6621 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6622 -- --id=@ipfix create IPFIX targets=\"xyzzy\" \
6623 -- --id=@cs create Flow_Sample_Collector_Set id=0 bridge=@br0 ipfix=@ipfix],
6624 [0], [ignore])
6625
6626 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6627 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6628 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6629 [0], [ignore])
6630
6631 AT_DATA([flows.txt], [dnl
6632 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
6633 ])
6634
6635 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6636
6637 dnl Send some packets that should be sampled.
6638 for i in `seq 1 3`; do
6639 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)'])
6640 done
6641 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6642 flow-dump from non-dpdk interfaces:
6643 packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=4294967295)),2
6644 ])
6645
6646 dnl Remove the flow which contains sample action.
6647 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
6648 AT_CHECK([ovs-appctl revalidator/purge])
6649
6650 dnl Send some more packets, to ensure that these are not sampled.
6651 for i in `seq 1 3`; do
6652 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)'])
6653 done
6654 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6655 flow-dump from non-dpdk interfaces:
6656 packets:2, bytes:68, used:0.001s, actions:drop
6657 ])
6658
6659 OVS_VSWITCHD_STOP(["/sending to collector failed/d
6660 /xyzzy/d
6661 /no collectors/d"])
6662 AT_CLEANUP
6663
6664 dnl Flow IPFIX sanity check for tunnel set
6665 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
6666 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6667 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6668 options:key=5 ofport_request=1\
6669 -- add-port br0 p2 -- set Interface p2 type=stt \
6670 options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
6671 options:key=6 ofport_request=2\
6672 -- add-port br0 p3 -- set Interface p3 type=dummy \
6673 ofport_request=3 \
6674 -- --id=@br0 get Bridge br0 \
6675 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6676 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6677 [<0>
6678 <1>
6679 ])
6680
6681 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6682
6683 dnl Add openflow sample action without sampling_port.
6684 AT_DATA([flows.txt], [dnl
6685 in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
6686 ])
6687 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6688
6689 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])
6690 AT_CHECK([tail -1 stdout], [0], [dnl
6691 Datapath actions: userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=4294967295)),set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),1
6692 ])
6693
6694 dnl Remove the flow which contains sample action.
6695 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6696 AT_CHECK([ovs-appctl revalidator/purge])
6697
6698 dnl Add openflow sample action with sampling_port which is
6699 dnl equal to output port.
6700 AT_DATA([flows2.txt], [dnl
6701 in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
6702 ])
6703 AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
6704
6705 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])
6706 dnl Make sure flow sample action in datapath is behind set tunnel
6707 dnl action at egress point of tunnel port.
6708 AT_CHECK([tail -1 stdout], [0], [dnl
6709 Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=1),tunnel_out_port=1),1
6710 ])
6711
6712 dnl Remove the flow which contains sample action.
6713 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6714 AT_CHECK([ovs-appctl revalidator/purge])
6715
6716 dnl Add a rule with two sample actions and each sample action
6717 dnl has a sampling_port
6718 AT_DATA([flows3.txt], [dnl
6719 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
6720 ])
6721 AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
6722
6723 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])
6724 dnl Make sure flow sample action in datapath is behind set tunnel
6725 dnl action at egress point of tunnel port.
6726 AT_CHECK([tail -1 stdout], [0], [dnl
6727 Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=1),tunnel_out_port=1),1,set(tunnel(tun_id=0x6,src=2.2.2.3,dst=1.1.1.2,tos=0x1,ttl=64,tp_dst=7471,flags(df|key))),userspace(pid=0,flow_sample(probability=65535,collector_set_id=1,obs_domain_id=0,obs_point_id=0,output_port=7471),tunnel_out_port=7471),7471
6728 ])
6729
6730 dnl Remove the flow which contains sample action.
6731 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6732 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
6733
6734 OVS_VSWITCHD_STOP
6735 AT_CLEANUP
6736
6737 AT_SETUP([ofproto-dpif - clone action])
6738 OVS_VSWITCHD_START
6739 add_of_ports br0 1 2 3 4
6740
6741 AT_DATA([flows.txt], [dnl
6742 in_port=1, ip, actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(mod_dl_src:80:81:81:81:81:81,set_field:192.168.5.5->ip_dst,output:3),output:4
6743 ])
6744 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6745
6746 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
6747
6748 AT_CHECK([tail -1 stdout], [0], [dnl
6749 Datapath actions: clone(set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2),clone(set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3),4
6750 ])
6751
6752 dnl Test flow xlate openflow clone action without using datapath clone action.
6753 AT_CHECK([ovs-appctl dpif/disable-dp-clone br0], [0],
6754 [Datapath clone action disabled for bridge br0
6755 ])
6756
6757 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
6758
6759 AT_CHECK([tail -1 stdout], [0], [dnl
6760 Datapath actions: sample(sample=100.0%,actions(set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2)),sample(sample=100.0%,actions(set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3)),4
6761 ])
6762
6763 OVS_VSWITCHD_STOP
6764 AT_CLEANUP
6765
6766 dnl Flow based IPFIX statistics check
6767 AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
6768 OVS_VSWITCHD_START
6769 add_of_ports br0 1 2
6770
6771 dnl Negative test check.
6772 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
6773 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6774 NXST_IPFIX_FLOW request (xid=0x2):
6775 ])
6776
6777 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6778 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6779 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6780 [0], [ignore])
6781
6782 AT_DATA([flows.txt], [dnl
6783 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
6784 ])
6785
6786 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6787
6788 dnl Send some packets that should be sampled.
6789 for i in `seq 1 20`; do
6790 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)'])
6791 done
6792
6793 dnl There are 4 extra IPFIX template packets.
6794 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
6795 NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
6796 id 1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
6797 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
6798 ])
6799
6800 dnl Remove the flow which contains sample action.
6801 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
6802 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
6803 AT_CHECK([ovs-appctl revalidator/purge])
6804
6805 dnl Send some more packets, to ensure that these are not sampled.
6806 for i in `seq 1 3`; do
6807 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)'])
6808 done
6809 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
6810 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6811 NXST_IPFIX_FLOW request (xid=0x2):
6812 ])
6813
6814 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6815 AT_CLEANUP
6816
6817 AT_SETUP([ofproto-dpif - flow stats])
6818 OVS_VSWITCHD_START
6819 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
6820 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
6821
6822 ovs-appctl time/stop
6823
6824 for i in `seq 1 10`; do
6825 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)'
6826 done
6827
6828 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6829 AT_CHECK([ovs-appctl revalidator/purge], [0])
6830 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
6831 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
6832 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6833 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=540, idle_age=1, ip actions=NORMAL
6834 ])
6835 OVS_VSWITCHD_STOP
6836 AT_CLEANUP
6837
6838 AT_SETUP([ofproto-dpif - flow stats reset_counts])
6839 OVS_VSWITCHD_START
6840 flow="ip,actions=NORMAL"
6841
6842 ovs-appctl time/stop
6843
6844 AT_CHECK([ovs-ofctl add-flow br0 $flow])
6845
6846 warp_and_dump_NXM () {
6847 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6848 AT_CHECK([ovs-appctl revalidator/purge], [0])
6849
6850 AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0], [0], [stdout])
6851 if [[ $5 -gt 0 ]]; then
6852 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, hard_age=$5, ip actions=NORMAL"
6853 else
6854 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, ip actions=NORMAL"
6855 fi
6856 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
6857 $expected
6858 ])
6859 }
6860
6861 warp_and_dump_OF () {
6862 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6863 AT_CHECK([ovs-appctl revalidator/purge], [0])
6864
6865 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0], [0], [stdout])
6866 if [[ $1 -lt 13 -o "$5X" = "X" ]]; then
6867 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, ip actions=NORMAL"
6868 else
6869 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $5 ip actions=NORMAL"
6870 fi
6871 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
6872 $expected
6873 ])
6874 }
6875
6876 send_packet () {
6877 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)'
6878 }
6879
6880 # OpenFlow 1.0, implicit reset_counts
6881 send_packet
6882 warp_and_dump_NXM 1 1 54 1
6883 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 add-flow br0 $flow])
6884 # add-flow resets duration and counts,
6885 # but idle age is inherited from the old flow
6886 warp_and_dump_NXM 1 0 0 2
6887
6888 send_packet
6889 warp_and_dump_NXM 2 1 54 1
6890 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 mod-flows br0 $flow])
6891 # mod-flows resets hard_age, but not counts
6892 # but duration and idle_age is inherited from the old flow
6893 warp_and_dump_NXM 3 1 54 2 1
6894
6895 # OpenFlow 1.1, implicit reset_counts
6896 send_packet
6897 warp_and_dump_OF 11 4 2 108
6898 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 add-flow br0 $flow])
6899 # add-flow resets duration and counts,
6900 # but idle age is inherited from the old flow
6901 warp_and_dump_NXM 1 0 0 2
6902 warp_and_dump_OF 11 2 0 0
6903
6904 send_packet
6905 warp_and_dump_OF 11 3 1 54
6906 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 mod-flows br0 $flow])
6907 # mod-flows resets hard_age, but not counts
6908 # but duration and idle_age is inherited from the old flow
6909 warp_and_dump_NXM 4 1 54 2 1
6910 warp_and_dump_OF 11 5 1 54
6911
6912 # OpenFlow 1.2, explicit reset_counts
6913 send_packet
6914 warp_and_dump_OF 12 6 2 108
6915 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 $flow])
6916 # add-flow without flags resets duration, but not counts,
6917 # idle age is inherited from the old flow
6918 warp_and_dump_NXM 1 2 108 2
6919 warp_and_dump_OF 12 2 2 108
6920
6921 send_packet
6922 warp_and_dump_OF 12 3 3 162
6923 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 $flow])
6924 # mod-flows without flags does not reset duration nor counts,
6925 # idle age is inherited from the old flow
6926 warp_and_dump_NXM 4 3 162 2 1
6927 warp_and_dump_OF 12 5 3 162
6928
6929 send_packet
6930 warp_and_dump_OF 12 6 4 216
6931 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 reset_counts,$flow])
6932 # add-flow with reset_counts resets both duration and counts,
6933 # idle age is inherited from the old flow
6934 warp_and_dump_NXM 1 0 0 2
6935 warp_and_dump_OF 12 2 0 0
6936
6937 send_packet
6938 warp_and_dump_OF 12 3 1 54
6939 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 reset_counts,$flow])
6940 # mod-flows with reset_counts resets counts, but not duration,
6941 # idle age is inherited from the old flow
6942 warp_and_dump_NXM 4 0 0 2 1
6943 warp_and_dump_OF 12 5 0 0
6944
6945 # OpenFlow > 1.3, explicit reset_counts
6946 flow_mods_reset_counts () {
6947 # Reset to a known state
6948 AT_CHECK([ovs-ofctl add-flow br0 $flow])
6949
6950 send_packet
6951 warp_and_dump_OF $1 1 1 54 reset_counts
6952 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
6953 # add-flow without flags resets duration, but not counts,
6954 # idle age is inherited from the old flow
6955 warp_and_dump_NXM 1 1 54 2
6956 warp_and_dump_OF $1 2 1 54
6957
6958 send_packet
6959 warp_and_dump_OF $1 3 2 108
6960 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
6961 # mod-flows without flags does not reset duration nor counts,
6962 # idle age is inherited from the old flow
6963 warp_and_dump_NXM 4 2 108 2 1
6964 warp_and_dump_OF $1 5 2 108
6965
6966 send_packet
6967 warp_and_dump_OF $1 6 3 162
6968 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
6969 # add-flow with reset_counts resets both duration and counts,
6970 # idle age is inherited from the old flow
6971 warp_and_dump_NXM 1 0 0 2
6972 warp_and_dump_OF $1 2 0 0 reset_counts
6973
6974 send_packet
6975 warp_and_dump_OF $1 3 1 54 reset_counts
6976 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
6977 # mod-flows with reset_counts resets counts, but not duration,
6978 # idle age is inherited from the old flow
6979 warp_and_dump_NXM 4 0 0 2 1
6980 warp_and_dump_OF $1 5 0 0 reset_counts
6981
6982 # Modify flow having reset_counts flag without reset_counts
6983 send_packet
6984 warp_and_dump_OF $1 6 1 54 reset_counts
6985 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
6986 warp_and_dump_NXM 7 1 54 2 1
6987 warp_and_dump_OF $1 8 1 54 reset_counts
6988
6989 # Add flow having reset_counts flag without reset_counts
6990 send_packet
6991 warp_and_dump_OF $1 9 2 108 reset_counts
6992 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
6993 warp_and_dump_NXM 1 2 108 2
6994 warp_and_dump_OF $1 2 2 108
6995
6996 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
6997 send_packet
6998 warp_and_dump_OF $1 3 3 162
6999 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7000 warp_and_dump_NXM 4 0 0 2 1
7001 warp_and_dump_OF $1 5 0 0
7002 }
7003
7004 # OpenFlow versions >= 1.3 should behave the same way
7005 flow_mods_reset_counts 13
7006 flow_mods_reset_counts 14
7007 flow_mods_reset_counts 15
7008
7009 OVS_VSWITCHD_STOP
7010 AT_CLEANUP
7011
7012 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
7013 OVS_VSWITCHD_START
7014 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7015 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7016
7017 ovs-appctl time/stop
7018
7019 for i in `seq 1 10`; do
7020 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)'
7021 done
7022
7023 ovs-appctl time/warp 100
7024 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
7025 ovs-appctl time/warp 1000
7026
7027 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7028 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
7029 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
7030 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=540, idle_age=1, ip actions=NORMAL
7031 ])
7032 OVS_VSWITCHD_STOP
7033 AT_CLEANUP
7034
7035 AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
7036 OVS_VSWITCHD_START
7037
7038 # get_ages DURATION HARD IDLE
7039 #
7040 # Fetch the flow duration, hard age, and idle age into the variables
7041 # whose names are given as arguments. Rounds DURATION down to the
7042 # nearest integer. If hard_age doesn't appear in the output, sets
7043 # HARD to "none". If idle_age doesn't appear in the output, sets IDLE
7044 # to 0.
7045 get_ages () {
7046 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7047
7048 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
7049 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
7050 AS_VAR_COPY([$1], [duration])
7051
7052 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
7053 if test X"$hard" = X; then
7054 hard=none
7055 else
7056 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
7057 fi
7058 AS_VAR_COPY([$2], [hard])
7059
7060 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
7061 if test X"$idle" = X; then
7062 idle=0
7063 else
7064 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
7065 fi
7066 AS_VAR_COPY([$3], [idle])
7067 }
7068
7069 # Add a flow and get its initial hard and idle age.
7070 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
7071 get_ages duration1 hard1 idle1
7072
7073 ovs-appctl time/stop
7074 # Warp time forward by 10 seconds, then modify the flow's actions.
7075 ovs-appctl time/warp 10000
7076 get_ages duration2 hard2 idle2
7077 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
7078
7079 # Warp time forward by 10 seconds.
7080 ovs-appctl time/warp 10000
7081 get_ages duration3 hard3 idle3
7082
7083 # Warp time forward 10 more seconds, then pass some packets through the flow,
7084 # then warp forward a few more times because idle times are only updated
7085 # occasionally.
7086 ovs-appctl time/warp 10000
7087 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)'
7088 ovs-appctl time/warp 3000 1000
7089 sleep 1
7090 get_ages duration4 hard4 idle4
7091
7092 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
7093 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
7094 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
7095
7096 # Duration should increase steadily over time.
7097 AT_CHECK([test $duration1 -lt $duration2])
7098 AT_CHECK([test $duration2 -lt $duration3])
7099 AT_CHECK([test $duration3 -lt $duration4])
7100
7101 # Hard age should be "none" initially because it's the same as flow_duration,
7102 # then it should increase.
7103 AT_CHECK([test $hard1 = none])
7104 AT_CHECK([test $hard2 = none])
7105 AT_CHECK([test $hard3 != none])
7106 AT_CHECK([test $hard4 != none])
7107 AT_CHECK([test $hard3 -lt $hard4])
7108
7109 # Idle age should increase from 1 to 2 to 3, then decrease.
7110 AT_CHECK([test $idle1 -lt $idle2])
7111 AT_CHECK([test $idle2 -lt $idle3])
7112 AT_CHECK([test $idle3 -gt $idle4])
7113
7114 # Check some invariant relationships.
7115 AT_CHECK([test $duration1 = $idle1])
7116 AT_CHECK([test $duration2 = $idle2])
7117 AT_CHECK([test $duration3 = $idle3])
7118 AT_CHECK([test $idle3 -gt $hard3])
7119 AT_CHECK([test $idle4 -lt $hard4])
7120 AT_CHECK([test $hard4 -lt $duration4])
7121
7122 OVS_VSWITCHD_STOP
7123 AT_CLEANUP
7124
7125 AT_SETUP([ofproto-dpif - fin_timeout])
7126 OVS_VSWITCHD_START
7127 ovs-appctl time/stop
7128 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
7129 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7130 [NXST_FLOW reply:
7131 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7132 ])
7133
7134 # Check that a TCP SYN packet does not change the timeout. (Because
7135 # flow stats updates are mainly what implements the fin_timeout
7136 # feature, we warp forward a couple of times to ensure that flow stats
7137 # run before re-checking the flow table.)
7138 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
7139 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7140 warped
7141 ])
7142 AT_CHECK([ovs-appctl revalidator/purge], [0])
7143 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7144 [NXST_FLOW reply:
7145 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7146 ])
7147 # Check that a TCP FIN packet does change the timeout.
7148 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
7149 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7150 warped
7151 ])
7152 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7153 [NXST_FLOW reply:
7154 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
7155 ])
7156 OVS_VSWITCHD_STOP
7157 AT_CLEANUP
7158
7159 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
7160 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
7161 add_of_ports br0 1 2
7162 add_of_ports br1 3
7163
7164 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
7165 dummy@br0
7166 dummy@br1
7167 ])
7168 OVS_VSWITCHD_STOP
7169 AT_CLEANUP
7170
7171 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
7172 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
7173 [--dummy-numa="0,0,0,0,1,1,1,1"])
7174 add_pmd_of_ports br0 1 2
7175 add_of_ports br1 3
7176
7177 AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
7178 dummy@ovs-dummy: hit:0 missed:0
7179 br0:
7180 br0 65534/100: (dummy-internal)
7181 p1 1/1: (dummy-pmd: <cleared>)
7182 p2 2/2: (dummy-pmd: <cleared>)
7183 br1:
7184 br1 65534/101: (dummy-internal)
7185 p3 3/3: (dummy)
7186 ])
7187 OVS_VSWITCHD_STOP
7188 AT_CLEANUP
7189
7190 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
7191 # bump max-idle to avoid the flows being reclaimed behind us
7192 OVS_VSWITCHD_START([add-br br1 -- \
7193 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7194 set Open_vSwitch . other_config:max-idle=10000], [], [],
7195 [--dummy-numa="0,0,0,0,1,1,1,1"])
7196 add_of_ports br0 1
7197 add_pmd_of_ports br0 2
7198 add_of_ports br1 3
7199
7200 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)'])
7201 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)'])
7202 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)'])
7203 ovs-appctl revalidator/wait
7204 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7205 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7206 recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7207 ])
7208
7209 AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
7210 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7211 ])
7212
7213 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
7214 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
7215 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
7216 ])
7217
7218 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
7219 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
7220 ])
7221
7222 OVS_VSWITCHD_STOP
7223 AT_CLEANUP
7224
7225 m4_define([OFPROTO_DPIF_GET_FLOW],
7226 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
7227
7228 OVS_VSWITCHD_START([add-br br1 -- \
7229 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7230 set Open_vSwitch . other_config:max-idle=10000], [], [],
7231 [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7232
7233 func=`echo -n "$1_" | cut -c 4-`
7234 add_${func}of_ports br0 1 2
7235
7236 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)'])
7237 ovs-appctl revalidator/wait
7238 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
7239
7240 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
7241 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
7242 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7243 ])
7244
7245 OVS_VSWITCHD_STOP
7246 AT_CLEANUP])
7247
7248 OFPROTO_DPIF_GET_FLOW([])
7249 OFPROTO_DPIF_GET_FLOW([ - pmd])
7250
7251 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
7252 OVS_VSWITCHD_START([dnl
7253 add-port br0 p1 -- set Interface p1 type=dummy
7254 ])
7255 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7256 on_exit 'kill `cat ovs-ofctl.pid`'
7257
7258 AT_CAPTURE_FILE([ofctl_monitor.log])
7259 AT_DATA([flows.txt], [dnl
7260 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
7261 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
7262 ])
7263 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7264
7265 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
7266 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
7267 dnl
7268 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
7269 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)
7270 dnl (label 20, exp 0, [S], ttl 32)
7271 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7272 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7273
7274 for dl_src in 00 01; do
7275 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"])
7276 done
7277 sleep 1 # wait for the datapath flow installed
7278 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7279 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))
7280 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))
7281 ])
7282
7283 OVS_VSWITCHD_STOP
7284 AT_CLEANUP
7285
7286
7287 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
7288 OVS_VSWITCHD_START([dnl
7289 add-port br0 p1 -- set Interface p1 type=dummy
7290 ])
7291 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7292 on_exit 'kill `cat ovs-ofctl.pid`'
7293
7294 AT_CAPTURE_FILE([ofctl_monitor.log])
7295 AT_DATA([flows.txt], [dnl
7296 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
7297 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
7298 ])
7299 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7300
7301 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
7302 dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
7303 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
7304 dnl
7305 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
7306 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)
7307 dnl (label 20, exp 0, ttl 32)
7308 dnl (label 20, exp 0, ttl 32)
7309 dnl (label 20, exp 0, [S], ttl 32)
7310 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7311 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7312
7313 for dl_src in 00 01; do
7314 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"])
7315 done
7316 sleep 1 # wait for the datapath flow installed
7317 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7318 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))
7319 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))
7320 ])
7321
7322 OVS_VSWITCHD_STOP
7323 AT_CLEANUP
7324
7325 AT_SETUP([ofproto-dpif - patch ports])
7326 OVS_VSWITCHD_START([add-br br1 \
7327 -- set bridge br1 datapath-type=dummy fail-mode=secure \
7328 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
7329 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
7330
7331 add_of_ports br0 2
7332 add_of_ports br1 3
7333
7334 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7335 ], [])
7336 AT_CHECK([ovs-appctl time/stop])
7337 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7338
7339 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
7340 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
7341
7342 for i in $(seq 1 10); do
7343 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)'
7344 if [[ $i -eq 1 ]]; then
7345 sleep 1
7346 fi
7347 done
7348
7349 for i in $(seq 1 5); do
7350 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)'
7351 if [[ $i -eq 1 ]]; then
7352 sleep 1
7353 fi
7354 done
7355
7356 AT_CHECK([ovs-appctl time/warp 500], [0],
7357 [warped
7358 ])
7359 sleep 1 # wait for log writer
7360
7361 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
7362 dummy@ovs-dummy: hit:13 missed:2
7363 br0:
7364 br0 65534/100: (dummy-internal)
7365 p2 2/2: (dummy)
7366 pbr0 1/none: (patch: peer=pbr1)
7367 br1:
7368 br1 65534/101: (dummy-internal)
7369 p3 3/3: (dummy)
7370 pbr1 1/none: (patch: peer=pbr0)
7371 ])
7372
7373 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7374 recirc_id(0),in_port(100),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
7375 recirc_id(0),in_port(101),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
7376 ])
7377
7378 AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
7379 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
7380 ])
7381 AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
7382 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
7383 ])
7384
7385 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
7386 OFPST_PORT reply (xid=0x4): 1 ports
7387 port 1: rx pkts=5, bytes=210, drop=?, errs=?, frame=?, over=?, crc=?
7388 tx pkts=10, bytes=420, drop=?, errs=?, coll=?
7389 ])
7390
7391 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
7392 OFPST_PORT reply (xid=0x4): 1 ports
7393 port 1: rx pkts=10, bytes=420, drop=?, errs=?, frame=?, over=?, crc=?
7394 tx pkts=5, bytes=210, drop=?, errs=?, coll=?
7395 ])
7396
7397 OVS_VSWITCHD_STOP
7398 AT_CLEANUP
7399
7400 AT_SETUP([ofproto-dpif - patch ports - stack])
7401 OVS_VSWITCHD_START([add-br br1 \
7402 -- set bridge br1 datapath-type=dummy fail-mode=secure \
7403 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
7404 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
7405
7406 add_of_ports br0 2
7407 add_of_ports br1 3
7408
7409 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7410 ], [])
7411 AT_CHECK([ovs-appctl time/stop])
7412 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7413
7414 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"])
7415 # Try to pop from empty stack, and push and leave data to stack.
7416 AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
7417
7418 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)'
7419
7420 AT_CHECK([ovs-appctl time/warp 500], [0],
7421 [warped
7422 ])
7423
7424 OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
7425
7426 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
7427 dummy@ovs-dummy: hit:0 missed:1
7428 br0:
7429 br0 65534/100: (dummy-internal)
7430 p2 2/2: (dummy)
7431 pbr0 1/none: (patch: peer=pbr1)
7432 br1:
7433 br1 65534/101: (dummy-internal)
7434 p3 3/3: (dummy)
7435 pbr1 1/none: (patch: peer=pbr0)
7436 ])
7437
7438 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7439 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
7440 ])
7441
7442 AT_CHECK([grep -e '|ofproto_dpif_xlate|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
7443 stack underflow while processing icmp,in_port=LOCAL,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 on bridge br1
7444 ])
7445
7446 OVS_VSWITCHD_STOP(["/stack underflow/d"])
7447 AT_CLEANUP
7448
7449 AT_SETUP([ofproto-dpif - port duration])
7450 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
7451 add_of_ports br0 1 2
7452
7453 ovs-appctl time/stop
7454 ovs-appctl time/warp 10000
7455
7456 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
7457 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
7458 [dnl
7459 duration=?s
7460 duration=?s
7461 duration=?s
7462 ])
7463 OVS_VSWITCHD_STOP
7464 AT_CLEANUP
7465
7466 dnl ----------------------------------------------------------------------
7467 AT_BANNER([ofproto-dpif -- megaflows])
7468
7469 AT_SETUP([ofproto-dpif megaflow - port classification])
7470 OVS_VSWITCHD_START
7471 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7472 add_of_ports br0 1 2
7473 AT_DATA([flows.txt], [dnl
7474 table=0 in_port=1 actions=output(2)
7475 ])
7476 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7477 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)'])
7478 sleep 1
7479 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)'])
7480 sleep 1
7481 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7482 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
7483 ])
7484 OVS_VSWITCHD_STOP
7485 AT_CLEANUP
7486
7487 AT_SETUP([ofproto-dpif megaflow - L2 classification])
7488 OVS_VSWITCHD_START
7489 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7490 add_of_ports br0 1 2
7491 AT_DATA([flows.txt], [dnl
7492 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
7493 ])
7494 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7495 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)'])
7496 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)'])
7497 sleep 1
7498 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7499 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7500 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7501 ])
7502 OVS_VSWITCHD_STOP
7503 AT_CLEANUP
7504
7505 AT_SETUP([ofproto-dpif megaflow - L3 classification])
7506 OVS_VSWITCHD_START
7507 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7508 add_of_ports br0 1 2
7509 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], [])
7510 AT_DATA([flows.txt], [dnl
7511 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
7512 ])
7513 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7514 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)'])
7515 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)'])
7516 sleep 1
7517 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7518 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
7519 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,frag=no), actions: <del>
7520 ])
7521 OVS_VSWITCHD_STOP
7522 AT_CLEANUP
7523
7524 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
7525 OVS_VSWITCHD_START
7526 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7527 add_of_ports br0 1 2
7528 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], [])
7529 AT_DATA([flows.txt], [dnl
7530 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
7531 ])
7532 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7533 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)'])
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(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)'])
7535 sleep 1
7536 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7537 recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5,frag=no), actions: <del>
7538 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>
7539 ])
7540 OVS_VSWITCHD_STOP
7541 AT_CLEANUP
7542
7543 AT_SETUP([ofproto-dpif megaflow - L4 classification])
7544 OVS_VSWITCHD_START
7545 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7546 add_of_ports br0 1 2
7547 AT_DATA([flows.txt], [dnl
7548 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
7549 ])
7550 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7551 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)'])
7552 sleep 1
7553 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)'])
7554 sleep 1
7555 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7556 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=1,frag=no),icmp(type=8), actions: <del>
7557 ])
7558 OVS_VSWITCHD_STOP
7559 AT_CLEANUP
7560
7561 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
7562 [AT_SETUP([ofproto-dpif megaflow - normal$1])
7563 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7564 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7565 func=`echo -n "$1_" | cut -c 4-`
7566 add_${func}of_ports br0 1 2
7567 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7568 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)'])
7569 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)'])
7570 sleep 1
7571 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7572 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>
7573 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>
7574 ])
7575 OVS_VSWITCHD_STOP
7576 AT_CLEANUP])
7577
7578 OFPROTO_DPIF_MEGAFLOW_NORMAL([])
7579 OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
7580
7581 AT_SETUP([ofproto-dpif megaflow - mpls])
7582 OVS_VSWITCHD_START
7583 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7584 add_of_ports br0 1 2
7585 AT_DATA([flows.txt], [dnl
7586 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
7587 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
7588 ])
7589 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7590 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)'])
7591 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)'])
7592 sleep 1
7593 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
7594 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
7595 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
7596 ])
7597 OVS_VSWITCHD_STOP
7598 AT_CLEANUP
7599
7600 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
7601 m4_define([CHECK_MEGAFLOW_NETFLOW],
7602 [OVS_VSWITCHD_START
7603 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7604 add_of_ports br0 1 2
7605
7606 dnl NetFlow configuration disables wildcarding relevant fields
7607 on_exit 'kill `cat test-netflow.pid`'
7608 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
7609 AT_CAPTURE_FILE([netflow.log])
7610 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
7611 ovs-vsctl \
7612 set Bridge br0 netflow=@nf -- \
7613 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
7614 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
7615
7616 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7617 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)'])
7618 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)'])
7619 sleep 1
7620 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7621 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>
7622 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>
7623 ])
7624 OVS_APP_EXIT_AND_WAIT([test-netflow])
7625 OVS_VSWITCHD_STOP])
7626
7627 AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
7628 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
7629 AT_CLEANUP
7630
7631 AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
7632 AT_SKIP_IF([test $HAVE_IPV6 = no])
7633 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
7634 AT_CLEANUP
7635
7636 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
7637 [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
7638 OVS_VSWITCHD_START(
7639 [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
7640 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
7641 set interface p2 type=$1 ofport_request=2 -- \
7642 set interface p3 type=$1 ofport_request=3], [], [],
7643 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
7644 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7645 ])
7646 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7647
7648 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7649 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)'])
7650 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)'])
7651 sleep 1
7652 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7653 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>
7654 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>
7655 ])
7656 OVS_VSWITCHD_STOP
7657 AT_CLEANUP])
7658
7659 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
7660 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
7661
7662 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
7663 OVS_VSWITCHD_START(
7664 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
7665 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
7666 set interface p2 type=dummy ofport_request=2 -- \
7667 set interface p3 type=dummy ofport_request=3])
7668 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7669 ])
7670 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7671
7672 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7673 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)'])
7674 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)'])
7675 sleep 1
7676 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7677 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>
7678 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>
7679 ])
7680 OVS_VSWITCHD_STOP
7681 AT_CLEANUP
7682
7683 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
7684 # Create bond0 on br0 with interfaces p0 and p1
7685 # and bond1 on br1 with interfaces p2 and p3
7686 # with p0 patched to p2 and p1 patched to p3.
7687 OVS_VSWITCHD_START(
7688 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
7689 other-config:lacp-time=fast \
7690 other-config:bond-rebalance-interval=0 -- \
7691 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
7692 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
7693 add-br br1 -- \
7694 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
7695 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
7696 fail-mode=secure -- \
7697 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
7698 other-config:lacp-time=fast \
7699 other-config:bond-rebalance-interval=0 -- \
7700 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
7701 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
7702
7703 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7704 ])
7705 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7706 add_of_ports br0 7
7707 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7708 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
7709 ovs-appctl time/stop
7710 ovs-appctl time/warp 5000
7711 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)'])
7712 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)'])
7713 sleep 1
7714 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7715 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>
7716 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>
7717 ])
7718 OVS_VSWITCHD_STOP
7719 AT_CLEANUP
7720
7721 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
7722 OVS_VSWITCHD_START
7723 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7724 add_of_ports br0 1 2
7725 AT_DATA([flows.txt], [dnl
7726 table=0 in_port=1,ip actions=resubmit(90)
7727 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
7728 ])
7729 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7730 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)'])
7731 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)'])
7732 sleep 1
7733 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7734 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7735 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7736 ])
7737 OVS_VSWITCHD_STOP
7738 AT_CLEANUP
7739
7740 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
7741 OVS_VSWITCHD_START
7742 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7743 add_of_ports br0 1 2
7744 AT_DATA([flows.txt], [dnl
7745 table=0 in_port=1,ip actions=resubmit(,1)
7746 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
7747 ])
7748 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7749 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)'])
7750 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=
7751 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
7752 sleep 1
7753 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7754 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7755 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7756 ])
7757 OVS_VSWITCHD_STOP
7758 AT_CLEANUP
7759
7760 AT_SETUP([ofproto-dpif megaflow - goto_table action])
7761 OVS_VSWITCHD_START
7762 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7763 add_of_ports br0 1 2
7764 AT_DATA([flows.txt], [dnl
7765 table=0 in_port=1,ip actions=goto_table(1)
7766 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
7767 ])
7768 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
7769 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)'])
7770 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)'])
7771 sleep 1
7772 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7773 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7774 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7775 ])
7776 OVS_VSWITCHD_STOP
7777 AT_CLEANUP
7778
7779 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
7780 AT_KEYWORDS([mirror mirrors mirroring])
7781 OVS_VSWITCHD_START
7782 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7783 add_of_ports br0 1 2 3
7784 ovs-vsctl \
7785 set Bridge br0 mirrors=@m --\
7786 --id=@p3 get Port p3 --\
7787 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
7788
7789 AT_DATA([flows.txt], [dnl
7790 in_port=1 actions=output:2
7791 ])
7792 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7793 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)'])
7794 sleep 1
7795 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)'])
7796 sleep 1
7797 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7798 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
7799 ])
7800 OVS_VSWITCHD_STOP
7801 AT_CLEANUP
7802
7803 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
7804 OVS_VSWITCHD_START
7805 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7806 add_of_ports br0 1 2 3
7807 ovs-vsctl \
7808 set Bridge br0 mirrors=@m --\
7809 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
7810 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
7811
7812 AT_DATA([flows.txt], [dnl
7813 in_port=1 actions=output:2
7814 ])
7815 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7816 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))'])
7817 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)'])
7818 sleep 1
7819 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7820 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), actions: <del>
7821 recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=11,pcp=7/0x0),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
7822 ])
7823 OVS_VSWITCHD_STOP
7824 AT_CLEANUP
7825
7826 AT_SETUP([ofproto-dpif megaflow - move action])
7827 OVS_VSWITCHD_START
7828 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7829 add_of_ports br0 1 2
7830 AT_DATA([flows.txt], [dnl
7831 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
7832 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
7833 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
7834 ])
7835 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7836 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)'])
7837 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)'])
7838 sleep 1
7839 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7840 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
7841 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
7842 ])
7843 OVS_VSWITCHD_STOP
7844 AT_CLEANUP
7845
7846 AT_SETUP([ofproto-dpif megaflow - push action])
7847 OVS_VSWITCHD_START
7848 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7849 add_of_ports br0 1 2
7850 AT_DATA([flows.txt], [dnl
7851 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
7852 ])
7853 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7854 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)'])
7855 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)'])
7856 sleep 1
7857 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7858 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
7859 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
7860 ])
7861 OVS_VSWITCHD_STOP
7862 AT_CLEANUP
7863
7864 AT_SETUP([ofproto-dpif megaflow - learning])
7865 OVS_VSWITCHD_START
7866 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7867 add_of_ports br0 1 2
7868 AT_DATA([flows.txt], [dnl
7869 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
7870 ])
7871 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7872 ovs-appctl time/stop
7873 # We send each packet twice because the first packet in each flow causes the
7874 # flow table to change and thus revalidations, which (depending on timing)
7875 # can keep a megaflow from being installed. The revalidations are done by
7876 # the second iteration, allowing the flows to be installed.
7877 for i in 1 2; do
7878 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)'])
7879 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)'])
7880 ovs-appctl time/warp 100
7881 done
7882 sleep 1
7883 dnl The original flow is missing due to a revalidation.
7884 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7885 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7886 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7887 ])
7888 OVS_VSWITCHD_STOP
7889 AT_CLEANUP
7890
7891 AT_SETUP([ofproto-dpif megaflow - tunnels])
7892 OVS_VSWITCHD_START(
7893 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
7894 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7895 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
7896 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
7897 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
7898 ofport_request=3])
7899 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
7900 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
7901 ofport_request=4 options:key=flow])
7902 AT_DATA([flows.txt], [dnl
7903 in_port=1,actions=output(2)
7904 in_port=3,actions=output(4)
7905 ])
7906 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7907 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
7908 dnl will cause the packet to be dropped.
7909 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)'])
7910 sleep 1
7911 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)'])
7912 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)'])
7913 sleep 1
7914 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)'])
7915 sleep 1
7916 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7917 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
7918 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
7919 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
7920 ])
7921 OVS_VSWITCHD_STOP
7922 AT_CLEANUP
7923
7924 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
7925 OVS_VSWITCHD_START
7926 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7927 add_of_ports br0 1 2
7928 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], [])
7929 AT_DATA([flows.txt], [dnl
7930 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
7931 ])
7932 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7933 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)'])
7934 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)'])
7935 sleep 1
7936 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7937 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
7938 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,ttl=64,frag=no), actions: <del>
7939 ])
7940 OVS_VSWITCHD_STOP
7941 AT_CLEANUP
7942
7943 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
7944 OVS_VSWITCHD_START
7945 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7946 add_of_ports br0 1 2
7947 AT_DATA([flows.txt], [dnl
7948 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
7949 ])
7950 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7951 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)'])
7952 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)'])
7953 sleep 1
7954 dnl The first packet is essentially a no-op, as the new destination MAC is the
7955 dnl same as the original. The second entry actually updates the destination
7956 dnl MAC.
7957 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7958 recirc_id(0),in_port(1),eth(dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions:2
7959 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
7960 ])
7961 OVS_VSWITCHD_STOP
7962 AT_CLEANUP
7963
7964 m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
7965 [AT_SETUP([ofproto-dpif megaflow - disabled$1])
7966 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7967 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7968 func=`echo -n "$1_" | cut -c 4-`
7969 add_${func}of_ports br0 1 2
7970 AT_DATA([flows.txt], [dnl
7971 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
7972 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
7973 ])
7974 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
7975 ], [])
7976 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7977 ], [])
7978 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
7979 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7980 for i in 1 2 3 4; do
7981 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)'])
7982 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)'])
7983 if [[ $i -eq 1 ]]; then
7984 sleep 1
7985 fi
7986 done
7987 sleep 1
7988 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7989 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
7990 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
7991 ])
7992 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
7993 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
7994 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
7995 ])
7996 OVS_VSWITCHD_STOP
7997 AT_CLEANUP])
7998
7999 OFPROTO_DPIF_MEGAFLOW_DISABLED([])
8000 OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
8001
8002 AT_SETUP([ofproto-dpif - datapath port number change])
8003 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
8004 add_of_ports br0 1
8005
8006 # Trace a flow that should output to p1.
8007 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8008 [0], [stdout])
8009 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
8010 ])
8011
8012 # Change p1's port number to 5.
8013 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
8014
8015 # Trace a flow that should output to p1 in its new location.
8016 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8017 [0], [stdout])
8018 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
8019 ])
8020 OVS_VSWITCHD_STOP
8021 AT_CLEANUP
8022
8023 # Tests the bundling with various bfd and cfm configurations.
8024 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
8025 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
8026 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
8027 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
8028 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
8029 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
8030 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
8031 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
8032 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
8033 set Interface p0 cfm_mpid=1 -- \
8034 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
8035
8036 ovs-appctl time/stop
8037 # advance the clock to stablize everything.
8038 ovs-appctl time/warp 5000 100
8039 # cfm/show should show 'recv' fault.
8040 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8041 fault: recv
8042 ])
8043 # bfd/show should show 'up'.
8044 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8045 Local Session State: up
8046 Remote Session State: up
8047 Local Session State: up
8048 Remote Session State: up
8049 ])
8050 # bond/show should show 'may-enable: true' for all slaves.
8051 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8052 may_enable: true
8053 may_enable: true
8054 may_enable: true
8055 may_enable: true
8056 ])
8057
8058 # now disable the bfd on p1.
8059 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
8060 # advance the clock to stablize everything.
8061 ovs-appctl time/warp 5000 100
8062 # cfm/show should show 'recv' fault.
8063 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8064 fault: recv
8065 ])
8066 # bfd/show should show 'down'.
8067 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8068 Local Session State: down
8069 Remote Session State: down
8070 ])
8071 # bond/show should show 'may-enable: false' for p0.
8072 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8073 may_enable: false
8074 may_enable: true
8075 ])
8076
8077 # now enable the bfd on p1 and disable bfd on p0.
8078 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
8079 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
8080 # advance the clock to stablize everything.
8081 ovs-appctl time/warp 5000 100
8082 # cfm/show should show 'recv' fault.
8083 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8084 fault: recv
8085 ])
8086 # bfd/show should show 'down'.
8087 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8088 Local Session State: down
8089 Remote Session State: down
8090 ])
8091 # bond/show should show 'may-enable: false' for p0 and p1.
8092 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8093 may_enable: false
8094 may_enable: true
8095 may_enable: false
8096 may_enable: true
8097 ])
8098
8099 OVS_VSWITCHD_STOP
8100 AT_CLEANUP
8101
8102 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
8103 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
8104
8105 # enable bfd on p0.
8106 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8107 # check log.
8108 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8109 # disable bfd on p0.
8110 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8111 # check log.
8112 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8113 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])
8114
8115 # enable cfm on p0.
8116 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
8117 # check log.
8118 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8119 # disable cfm on p0.
8120 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
8121 # check log.
8122 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8123 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])
8124
8125 # enable both bfd and cfm on p0.
8126 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
8127 # check log.
8128 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8129 # disable bfd on p0.
8130 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8131 # check log, there should not be the log of thread terminated.
8132 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
8133 ])
8134 # reenable bfd on p0.
8135 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8136 # check log, should still be on log of thread created.
8137 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
8138 monitor thread created
8139 ])
8140 # disable bfd and cfm together.
8141 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
8142 # check log.
8143 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8144
8145 OVS_VSWITCHD_STOP
8146 AT_CLEANUP
8147
8148 # this test helps avoid the deadlock between the main thread and monitor thread.
8149 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
8150 OVS_VSWITCHD_START
8151
8152 for i in `seq 1 199`
8153 do
8154 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])
8155 done
8156
8157 OVS_VSWITCHD_STOP
8158 AT_CLEANUP
8159 \f
8160 AT_BANNER([ofproto-dpif - flow translation resource limits])
8161
8162 dnl Resubmits to later tables do not count against the depth limit, so we
8163 dnl can do 99 of them even though the maximum depth is 64.
8164 AT_SETUP([ofproto-dpif - forward resubmit])
8165 OVS_VSWITCHD_START
8166 (for i in `seq 0 99`; do
8167 j=`expr $i + 1`
8168 echo "table=$i, actions=resubmit(,$j)"
8169 done
8170 echo "table=100, actions=local") > flows
8171 AT_CHECK([ovs-ofctl add-flows br0 flows])
8172 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8173 [0], [stdout])
8174 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
8175 ])
8176 OVS_VSWITCHD_STOP
8177 AT_CLEANUP
8178
8179 dnl Resubmits to the same or an earlier table count against the depth limit,
8180 dnl so only 64 of them are allowed.
8181 AT_SETUP([ofproto-dpif - backward resubmit])
8182 OVS_VSWITCHD_START
8183 (echo "table=0, actions=resubmit(,66)"
8184 for i in `seq 2 66`; do
8185 j=`expr $i - 1`
8186 echo "table=$i, actions=resubmit(,$j)"
8187 done
8188 echo "table=1, actions=local") > flows
8189 AT_CHECK([ovs-ofctl add-flows br0 flows])
8190 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8191 [0], [stdout])
8192 AT_CHECK([tail -1 stdout], [0],
8193 [Translation failed (Recursion too deep), packet is dropped.
8194 ])
8195 AT_CHECK([grep -c 'over max translation depth 64' stdout],
8196 [0], [1
8197 ])
8198 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8199 AT_CLEANUP
8200
8201 AT_SETUP([ofproto-dpif - infinite resubmit])
8202 OVS_VSWITCHD_START
8203 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
8204 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8205 [0], [stdout])
8206 AT_CHECK([tail -1 stdout], [0],
8207 [Translation failed (Recursion too deep), packet is dropped.
8208 ])
8209 AT_CHECK([grep -c 'over max translation depth 64' stdout],
8210 [0], [1
8211 ])
8212 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8213 AT_CLEANUP
8214
8215 AT_SETUP([ofproto-dpif - exponential resubmit chain])
8216 OVS_VSWITCHD_START
8217 add_of_ports br0 1
8218 (for i in `seq 1 64`; do
8219 j=`expr $i + 1`
8220 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8221 done
8222 echo "in_port=65, actions=local") > flows
8223 AT_CHECK([ovs-ofctl add-flows br0 flows])
8224 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8225 AT_CHECK([tail -1 stdout], [0],
8226 [Translation failed (Too many resubmits), packet is dropped.
8227 ])
8228 AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
8229 ])
8230 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
8231 AT_CLEANUP
8232
8233 AT_SETUP([ofproto-dpif - too many output actions])
8234 OVS_VSWITCHD_START
8235 add_of_ports br0 1
8236 (for i in `seq 1 12`; do
8237 j=`expr $i + 1`
8238 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8239 done
8240 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
8241 AT_CHECK([ovs-ofctl add-flows br0 flows])
8242 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8243 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
8244 [0], [1
8245 ])
8246 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
8247 ])
8248 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
8249 AT_CLEANUP
8250
8251 AT_SETUP([ofproto-dpif - stack too deep])
8252 OVS_VSWITCHD_START
8253 add_of_ports br0 1
8254 (for i in `seq 1 12`; do
8255 j=`expr $i + 1`
8256 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8257 done
8258 push="push:NXM_NX_REG0[[]]"
8259 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
8260 AT_CHECK([ovs-ofctl add-flows br0 flows])
8261 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8262 AT_CHECK([tail -1 stdout], [0],
8263 [Translation failed (Stack too deep), packet is dropped.
8264 ])
8265 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
8266 ])
8267 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
8268 AT_CLEANUP
8269
8270
8271 AT_SETUP([ofproto-dpif packet-out controller])
8272 OVS_VSWITCHD_START
8273 add_of_ports br0 1 2
8274
8275 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
8276
8277 AT_CAPTURE_FILE([ofctl_monitor.log])
8278 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8279
8280 for i in 1 2 3; do
8281 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
8282 done
8283
8284 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8285 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8286 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
8287 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8288 dnl
8289 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
8290 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8291 dnl
8292 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
8293 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8294 ])
8295
8296 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
8297 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8298 NXST_FLOW reply:
8299 ])
8300
8301 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8302 table 0:
8303 active=1, lookup=0, matched=0
8304
8305 table 1:
8306 active=0, lookup=0, matched=0
8307 "
8308 for i in `seq 2 253`; do
8309 printf ' table %d: ditto\n' $i
8310 done) > expout
8311 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8312
8313 OVS_VSWITCHD_STOP
8314 AT_CLEANUP
8315
8316 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
8317 OVS_VSWITCHD_START(
8318 [-- \
8319 add-port br0 p1 -- \
8320 set interface p1 type=patch options:peer=p2 -- \
8321 add-br br1 -- \
8322 set bridge br1 datapath-type=dummy -- \
8323 set bridge br1 fail-mode=secure -- \
8324 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
8325 add-port br1 p2 -- \
8326 set interface p2 type=patch options:peer=p1 --])
8327
8328 AT_CAPTURE_FILE([ofctl_monitor.log])
8329 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8330
8331 for i in 1 2 3; do
8332 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
8333 done
8334
8335 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8336 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8337 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
8338 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8339 dnl
8340 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
8341 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8342 dnl
8343 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
8344 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8345 ])
8346
8347 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8348 table 0:
8349 active=0, lookup=0, matched=0
8350 "
8351 for i in `seq 1 253`; do
8352 printf ' table %d: ditto\n' $i
8353 done) > expout
8354 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8355
8356 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8357 table 0:
8358 active=0, lookup=3, matched=0
8359
8360 table 1:
8361 active=0, lookup=0, matched=0
8362 "
8363 for i in `seq 2 253`; do
8364 printf ' table %d: ditto\n' $i
8365 done) > expout
8366 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
8367
8368 OVS_VSWITCHD_STOP
8369 AT_CLEANUP
8370
8371
8372 AT_SETUP([ofproto-dpif packet-out goto_table])
8373 OVS_VSWITCHD_START
8374 add_of_ports br0 1 2
8375
8376 AT_DATA([flows.txt], [dnl
8377 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
8378 table=1 dl_dst=50:54:00:00:00:0a actions=controller
8379 ])
8380 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
8381
8382 AT_CAPTURE_FILE([ofctl_monitor.log])
8383 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8384
8385 for i in 1 2 3; do
8386 ovs-appctl 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)'
8387 done
8388
8389 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
8390 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8391 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8392 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8393 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8394 dnl
8395 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8396 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8397 dnl
8398 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8399 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8400 ])
8401
8402 AT_CHECK([ovs-appctl revalidator/purge], [0])
8403 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
8404 n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=goto_table:1
8405 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8406 OFPST_FLOW reply (OF1.3):
8407 ])
8408
8409 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8410 table 0:
8411 active=1, lookup=3, matched=3
8412
8413 table 1: ditto
8414 table 2:
8415 active=0, lookup=0, matched=0
8416 "
8417 for i in `seq 3 253`; do
8418 printf ' table %d: ditto\n' $i
8419 done) > expout
8420 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8421
8422 OVS_VSWITCHD_STOP
8423 AT_CLEANUP
8424
8425
8426 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
8427 OVS_VSWITCHD_START
8428 add_of_ports br0 1 2
8429
8430 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
8431 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
8432
8433 AT_CAPTURE_FILE([ofctl_monitor.log])
8434 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8435
8436 for i in 1 2 3; do
8437 ovs-appctl 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)'
8438 done
8439
8440 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
8441 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8442 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8443 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8444 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8445 dnl
8446 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8447 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8448 dnl
8449 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8450 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8451 ])
8452
8453 AT_CHECK([ovs-appctl revalidator/purge], [0])
8454 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
8455 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8456 OFPST_FLOW reply (OF1.1):
8457 ])
8458
8459 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8460 table 0:
8461 active=0, lookup=3, matched=0
8462
8463 table 1:
8464 active=1, lookup=3, matched=3
8465
8466 table 2:
8467 active=0, lookup=0, matched=0
8468 "
8469 for i in `seq 3 253`; do
8470 printf ' table %d: ditto\n' $i
8471 done) > expout
8472 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8473
8474 OVS_VSWITCHD_STOP
8475 AT_CLEANUP
8476
8477 AT_SETUP([ofproto-dpif - ICMPv6])
8478 OVS_VSWITCHD_START
8479 add_of_ports br0 1
8480
8481 AT_CAPTURE_FILE([ofctl_monitor.log])
8482
8483 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8484
8485 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
8486
8487 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8488
8489 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8490 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
8491 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
8492 ])
8493
8494 OVS_VSWITCHD_STOP
8495 AT_CLEANUP
8496
8497 AT_SETUP([ofproto-dpif - ICMPv6 type match])
8498 OVS_VSWITCHD_START
8499 add_of_ports br0 1 2 3
8500
8501 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
8502 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
8503
8504 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8505
8506 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)'])
8507 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)'])
8508 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)'])
8509 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)'])
8510
8511 AT_CHECK([ovs-appctl revalidator/purge], [0])
8512
8513 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8514 recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128), actions:2
8515 recirc_id(0),in_port(1),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129), actions:3
8516 ])
8517
8518 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
8519 n_packets=2, n_bytes=124, icmp6,icmp_type=128 actions=output:2
8520 n_packets=2, n_bytes=124, icmp6,icmp_type=129 actions=output:3
8521 NXST_FLOW reply:
8522 ])
8523
8524 OVS_VSWITCHD_STOP
8525 AT_CLEANUP
8526
8527 AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
8528 OVS_VSWITCHD_START
8529 add_of_ports br0 1
8530 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])
8531
8532 AT_CAPTURE_FILE([ofctl_monitor.log])
8533
8534 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8535
8536 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
8537
8538 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8539
8540 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8541 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
8542 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
8543 ])
8544
8545 OVS_VSWITCHD_STOP
8546 AT_CLEANUP
8547
8548 # Tests the exact match of CFI bit in installed datapath flows matching VLAN.
8549 AT_SETUP([ofproto-dpif - vlan matching])
8550 OVS_VSWITCHD_START(
8551 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
8552 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8553
8554 AT_CHECK([ovs-ofctl del-flows br0])
8555 AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
8556
8557 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))'])
8558
8559 OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
8560 AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
8561 recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=10),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
8562 ])
8563 OVS_VSWITCHD_STOP
8564 AT_CLEANUP
8565
8566 # Tests in place modification of installed datapath flows.
8567 AT_SETUP([ofproto-dpif - in place modification])
8568 OVS_VSWITCHD_START(
8569 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8570 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8571
8572 AT_CHECK([ovs-ofctl del-flows br0])
8573 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
8574
8575 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
8576
8577 ovs-appctl time/stop
8578
8579 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'])
8580
8581 # Wait for the flow setup to be done.
8582 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
8583
8584 for i in 1 2; do
8585 ovs-appctl 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)'
8586 done
8587
8588 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8589 recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
8590 ])
8591
8592 AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
8593
8594 ovs-appctl time/warp 500
8595 ovs-appctl time/warp 500
8596
8597 for i in 1 2 3; do
8598 ovs-appctl 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)'
8599 done
8600
8601 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8602 recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
8603 ])
8604
8605 AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
8606 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
8607 ])
8608 OVS_VSWITCHD_STOP
8609 AT_CLEANUP
8610
8611 # Tests in place modification of installed datapath flows with vlans.
8612 AT_SETUP([ofproto-dpif - in place modification (vlan)])
8613 OVS_VSWITCHD_START(
8614 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8615 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8616
8617 AT_CHECK([ovs-ofctl del-flows br0])
8618 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
8619
8620 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
8621
8622 ovs-appctl time/stop
8623
8624 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)'])
8625
8626 # Check that a correct datapath flow is created.
8627 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
8628
8629 for i in 1 2; do
8630 ovs-appctl 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)'
8631 done
8632
8633 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8634 recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:100
8635 ])
8636
8637 # Delete the flow. Then check that the datapath flow is modified to
8638 # drop the packets. A modified flow inherits the stats, a new
8639 # datapath flow would start from sero.
8640 AT_CHECK([ovs-ofctl del-flows br0])
8641
8642 ovs-appctl time/warp 500
8643 ovs-appctl time/warp 500
8644
8645 for i in 1 2 3; do
8646 ovs-appctl 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)'
8647 done
8648
8649 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8650 recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:drop
8651 ])
8652
8653 # Add a flow that matches the non-presence of a vlan tag, and check
8654 # that the datapath flow is modified accordingly.
8655 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
8656
8657 ovs-appctl time/warp 500
8658 ovs-appctl time/warp 500
8659
8660 for i in 1 2 3; do
8661 ovs-appctl 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)'
8662 done
8663
8664 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8665 recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
8666 ])
8667
8668 # Check that VLAN packets will not hit the same datapath megaflow.
8669
8670 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))'])
8671 OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
8672
8673 for i in 1 2; do
8674 ovs-appctl 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))'
8675 done
8676
8677 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8678 recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
8679 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
8680 ])
8681
8682 # Check that the new flow matches the CFI bit, while both vid and pcp
8683 # are wildcarded.
8684 AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
8685 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),eth_type(0x1234), actions:100
8686 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)
8687 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
8688 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
8689 ])
8690 OVS_VSWITCHD_STOP
8691 AT_CLEANUP
8692
8693 AT_SETUP([ofproto-dpif - trace (unchanged)])
8694 OVS_VSWITCHD_START
8695 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
8696 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
8697 ])
8698 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
8699 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
8700 ])
8701
8702 OVS_VSWITCHD_STOP
8703 AT_CLEANUP
8704
8705 AT_SETUP([ofproto-dpif - conntrack - controller])
8706 OVS_VSWITCHD_START
8707
8708 add_of_ports br0 1 2
8709
8710 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8711
8712 dnl Allow new UDP connections on p1 for dst port 2, drop everything else.
8713 AT_DATA([flows.txt], [dnl
8714 dnl Table 0
8715 dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2).
8716 dnl
8717 table=0,priority=100,arp,action=normal
8718 table=0,priority=10,in_port=1,ip,action=set_field:1->reg4,set_field:1->reg3,ct(zone=NXM_NX_REG4[[0..15]],table=1)
8719 table=0,priority=10,in_port=2,ip,action=set_field:1->reg4,set_field:2->reg3,ct(zone=NXM_NX_REG4[[0..15]],table=1)
8720 table=0,priority=1,action=drop
8721 dnl
8722 dnl Pass tracked traffic through ACL, drop everything else.
8723 dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers
8724 dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets
8725 dnl get the ACL lookup using the conntrack tuple and the inverted direction.
8726 dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
8727 dnl of the master connection, as storted in ct_mark.
8728 dnl
8729 dnl Incoming non-related packet in the original direction (ACL IN)
8730 table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5
8731 dnl Incoming non-related reply packet (CT ACL OUT)
8732 table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4
8733 dnl Outgoing non-related packet (ACL OUT)
8734 table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5
8735 dnl Outgoing non-related reply packet (CT ACL IN)
8736 table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
8737 dnl
8738 dnl Related packet (CT ACL in the direction of the master connection.)
8739 table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
8740 dnl Drop everything else.
8741 table=1 priority=0, action=drop
8742 dnl
8743 dnl "ACL table"
8744 dnl
8745 dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with
8746 dnl UDP destination port '2'. Store rule ID (1234) in reg1, verdict
8747 dnl in reg2.
8748 table=3 priority=10, reg0=1, udp, udp_dst=2 action=set_field:1234->reg1,set_field:1->reg2
8749 dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235)
8750 table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2
8751 dnl
8752 dnl Re-process stateful traffic that was not accepted by a stateful rule as
8753 dnl normal traffic in the current direction. This should also delete the
8754 dnl now stale conntrack state, so that new state can be created in it's place.
8755 dnl
8756 dnl Stateful accepts go to next table.
8757 table=4 priority=100 reg2=1, action=goto_table:5
8758 dnl Everything else is reprocessed disregarding the CT state, using the actual
8759 dnl packet direction.
8760 table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5
8761 dnl
8762 dnl "ACL verdict processing table."
8763 dnl
8764 dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0)
8765 dnl
8766 dnl Drop all non-accepted packets.
8767 table=5 reg2=0 priority=1000 action=drop
8768 dnl Commit new non-related IP connections.
8769 table=5 priority=10 reg2=1 ct_state=+new-rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,exec(move:NXM_NX_REG3[[0..31]]->NXM_NX_CT_MARK[[0..31]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
8770 dnl Commit new related connections in either direction, which inherit the mark
8771 dnl (the direction of the original direction master tuple) from the master
8772 dnl connection.
8773 table=5 priority=10 reg2=1 ct_state=+new+rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,exec(move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
8774 dnl Forward everything else, including stateless accepts.
8775 table=5 priority=0 action=goto_table:6
8776 dnl
8777 dnl "Forwarding table"
8778 dnl
8779 table=6 action=controller
8780 ])
8781
8782 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8783
8784 AT_CAPTURE_FILE([ofctl_monitor.log])
8785 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8786
8787 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)'])
8788
8789 dnl OK, now start a new connection from port 1.
8790 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)'])
8791
8792 dnl Now try a reply from port 2.
8793 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)'])
8794
8795 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8796 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8797
8798 dnl Check this output. We only see the latter two packets, not the first.
8799 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8800 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=42 ct_state=new|trk,ct_zone=1,ct_mark=0x1,ct_label=0x4d2000000000000000000000000,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=42 (unbuffered)
8801 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
8802 dnl
8803 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_zone=1,ct_mark=0x1,ct_label=0x4d2000000000000000000000000,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x2,reg4=0x1,in_port=2 (via action) data_len=42 (unbuffered)
8804 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
8805 ])
8806
8807 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8808
8809 dnl OK, now start a second connection from port 1
8810 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,ttl=64,frag=no),udp(src=3,dst=2)'])
8811
8812 dnl Now try a reply from port 2.
8813 AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:0a,dst=50:54:00:00:00:09),eth_type(0x0800),ipv4(src=10.1.1.2,dst=10.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=2,dst=3)'])
8814
8815
8816 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8817 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8818
8819 dnl Check this output. We should see both packets
8820 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8821 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=42 ct_state=new|trk,ct_zone=1,ct_mark=0x1,ct_label=0x4d2000000000000000000000000,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=2,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=42 (unbuffered)
8822 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=3,tp_dst=2 udp_csum:e9d4
8823 dnl
8824 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_zone=1,ct_mark=0x1,ct_label=0x4d2000000000000000000000000,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=2,reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x2,reg4=0x1,in_port=2 (via action) data_len=42 (unbuffered)
8825 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=3 udp_csum:e9d4
8826 ])
8827
8828 OVS_VSWITCHD_STOP
8829 AT_CLEANUP
8830
8831 AT_SETUP([ofproto-dpif - conntrack - force commit])
8832 OVS_VSWITCHD_START
8833
8834 add_of_ports br0 1 2
8835
8836 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8837
8838 dnl Allow new connections on p1->p2, but not on p2->p1.
8839 AT_DATA([flows.txt], [dnl
8840 dnl Table 0
8841 dnl
8842 table=0,priority=100,arp,action=normal
8843 table=0,priority=10,in_port=1,udp,action=ct(commit),controller
8844 table=0,priority=10,in_port=2,udp,action=ct(table=1)
8845 table=0,priority=1,action=drop
8846 dnl
8847 dnl Table 1
8848 dnl
8849 table=1,priority=10,in_port=2,ct_state=+est,udp,action=ct(force,commit),controller
8850 table=1,priority=1,action=drop
8851 ])
8852
8853 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8854
8855 AT_CAPTURE_FILE([ofctl_monitor.log])
8856 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8857
8858 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)'])
8859
8860 dnl OK, now start a new connection from port 1.
8861 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)'])
8862
8863 dnl Now try a reply from port 2.
8864 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)'])
8865
8866 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8867 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8868
8869 dnl Check this output. We only see the latter two packets, not the first.
8870 dnl Note that the first packet doesn't have the ct_state bits set. This
8871 dnl happens because the ct_state field is available only after recirc.
8872 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8873 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
8874 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
8875 dnl
8876 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,in_port=2 (via action) data_len=42 (unbuffered)
8877 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
8878 ])
8879
8880 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8881
8882 dnl OK, now start a second connection from port 1
8883 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)'])
8884
8885 dnl Now try a reply from port 2.
8886 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)'])
8887
8888 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8889 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8890
8891 dnl Check this output. We should see both packets
8892 dnl Note that the first packet doesn't have the ct_state bits set. This
8893 dnl happens because the ct_state field is available only after recirc.
8894 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8895 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
8896 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
8897 dnl
8898 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=4,in_port=2 (via action) data_len=42 (unbuffered)
8899 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
8900 ])
8901
8902 dnl
8903 dnl Check that the directionality has been changed by force commit.
8904 dnl
8905 AT_CHECK([ovs-appctl dpctl/dump-conntrack | sort], [], [dnl
8906 udp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=2,dport=1),reply=(src=10.1.1.1,dst=10.1.1.2,sport=1,dport=2)
8907 udp,orig=(src=10.1.1.2,dst=10.1.1.1,sport=4,dport=3),reply=(src=10.1.1.1,dst=10.1.1.2,sport=3,dport=4)
8908 ])
8909
8910 OVS_VSWITCHD_STOP
8911 AT_CLEANUP
8912
8913 AT_SETUP([ofproto-dpif - conntrack - ipv6])
8914 OVS_VSWITCHD_START
8915
8916 add_of_ports br0 1 2
8917
8918 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8919
8920 dnl Allow new connections on p1->p2, but not on p2->p1.
8921 AT_DATA([flows.txt], [dnl
8922 dnl Table 0
8923 dnl
8924 table=0,priority=100,arp,action=normal
8925 table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
8926 table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
8927 table=0,priority=1,action=drop
8928 dnl Table 1
8929 dnl
8930 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
8931 table=1,priority=1,action=drop
8932 ])
8933
8934 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8935
8936 AT_CAPTURE_FILE([ofctl_monitor.log])
8937 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8938
8939 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)'])
8940
8941 dnl OK, now start a new connection from port 1.
8942 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)'])
8943
8944 dnl Now try a reply from port 2.
8945 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)'])
8946
8947 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8948 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8949
8950 dnl Check this output. We only see the latter two packets, not the first.
8951 dnl Note that the first packet doesn't have the ct_state bits set. This
8952 dnl happens because the ct_state field is available only after recirc.
8953 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8954 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
8955 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
8956 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=62 ct_state=est|rpl|trk,ct_ipv6_src=2001:db8::1,ct_ipv6_dst=2001:db8::2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,in_port=2 (via action) data_len=62 (unbuffered)
8957 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
8958 ])
8959
8960 OVS_VSWITCHD_STOP
8961 AT_CLEANUP
8962
8963 AT_SETUP([ofproto-dpif - conntrack - output action])
8964 OVS_VSWITCHD_START
8965
8966 add_of_ports br0 1 2
8967
8968 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8969
8970 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
8971 AT_DATA([flows.txt], [dnl
8972 dnl The flows are in two separate tables for two reasons:
8973 dnl * To make the pipeline more clear.
8974 dnl * To make megaflows more consistent (we check megaflows below). The
8975 dnl unwildcarding in megaflows depends on the internal ordering of the
8976 dnl subtables, which are sorted using the system qsort(). qsort()
8977 dnl is provided by libc and may or may not be stable, so we can't rely
8978 dnl on that. By having separate tables we have more control over which
8979 dnl subtables are visited, meaning consistent megaflows.
8980 dnl
8981 dnl Table 0
8982 dnl
8983 table=0,priority=100,arp,action=normal
8984 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
8985 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
8986 table=0,priority=1,action=drop
8987 dnl
8988 dnl Table 1
8989 dnl
8990 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
8991 table=1,priority=1,action=drop
8992 ])
8993
8994 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8995
8996
8997 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)'])
8998
8999 dnl OK, now start a new connection from port 1.
9000 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)'])
9001
9002 dnl Now try a reply from port 2.
9003 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)'])
9004
9005 dnl OK, now start a second connection from port 1
9006 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)'])
9007
9008 dnl Now try a reply from port 2.
9009 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)'])
9010
9011
9012 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9013 ct_state(+new-est+trk),recirc_id(0x1),in_port(2),eth_type(0x0800),ipv4(frag=no), actions:drop
9014 ct_state(-new+est+trk),recirc_id(0x1),in_port(2),eth_type(0x0800),ipv4(proto=17,frag=no), actions:1
9015 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
9016 recirc_id(0),in_port(2),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct,recirc(0x1)
9017 ])
9018
9019 OVS_VSWITCHD_STOP
9020 AT_CLEANUP
9021
9022 AT_SETUP([ofproto-dpif - conntrack - expiration])
9023 OVS_VSWITCHD_START
9024
9025 add_of_ports br0 1 2
9026
9027 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9028
9029 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9030 AT_DATA([flows.txt], [dnl
9031 dnl Table 0
9032 dnl
9033 table=0,priority=100,arp,action=normal
9034 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
9035 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9036 table=0,priority=1,action=drop
9037 dnl
9038 dnl Table 1
9039 dnl
9040 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9041 table=1,priority=1,action=drop
9042 ])
9043
9044 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9045
9046 AT_CAPTURE_FILE([ofctl_monitor.log])
9047 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9048
9049 AT_CHECK([ovs-appctl time/stop])
9050
9051 dnl Start a new connection from port 1.
9052 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)'])
9053
9054 dnl Now try a reply from port 2.
9055 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)'])
9056
9057 ovs-appctl time/warp 100000
9058
9059 dnl Now try another reply from port 2.
9060 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)'])
9061
9062 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
9063 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9064
9065 dnl Check this output. Only one reply must be there
9066 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9067 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,in_port=2 (via action) data_len=42 (unbuffered)
9068 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
9069 dnl
9070 OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
9071 ])
9072
9073 OVS_VSWITCHD_STOP
9074 AT_CLEANUP
9075
9076 AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
9077 OVS_VSWITCHD_START
9078
9079 add_of_ports br0 1 2
9080
9081 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9082
9083 AT_DATA([flows.txt], [dnl
9084 ipv6,ct_state=-trk,action=ct(table=0,zone=0)
9085 ct_state=+trk,action=controller
9086 ])
9087
9088 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9089
9090 AT_CAPTURE_FILE([ofctl_monitor.log])
9091 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9092
9093 AT_CHECK([ovs-appctl time/stop])
9094
9095 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
9096
9097 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
9098 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9099
9100 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9101 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,in_port=2 (via action) data_len=86 (unbuffered)
9102 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
9103 ])
9104
9105 OVS_VSWITCHD_STOP
9106 AT_CLEANUP
9107
9108 AT_SETUP([ofproto-dpif - conntrack - zones])
9109 OVS_VSWITCHD_START
9110
9111 add_of_ports br0 1 2 3 4
9112
9113 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9114
9115 dnl Allow new connections on p1->p2 or p3->p4.
9116 dnl Allow only established connections p2->p1 and p4->p3
9117 dnl p1,p2 and p3,p4 are on different zones
9118 AT_DATA([flows.txt], [dnl
9119 dnl Table 0
9120 dnl
9121 table=0,priority=100,arp,action=normal
9122 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
9123 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9124 table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
9125 table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
9126 table=0,priority=1,action=drop
9127 dnl
9128 dnl Table 1
9129 dnl
9130 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9131 table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
9132 table=1,priority=1,action=drop
9133 ])
9134
9135 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9136
9137 AT_CAPTURE_FILE([ofctl_monitor.log])
9138 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9139
9140 dnl Basic "only established" test on ports 1,2
9141
9142 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)'])
9143 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)'])
9144 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)'])
9145
9146 dnl Now use the same 5-tuples but on ports 3,4
9147
9148 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)'])
9149 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)'])
9150 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)'])
9151
9152 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9153 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9154
9155 dnl Check this output. We only see the latter two packets (for each zone), not the first.
9156 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9157 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9158 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
9159 dnl
9160 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,in_port=2 (via action) data_len=42 (unbuffered)
9161 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
9162 dnl
9163 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=3 (via action) data_len=42 (unbuffered)
9164 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
9165 dnl
9166 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_zone=1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,in_port=4 (via action) data_len=42 (unbuffered)
9167 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
9168 ])
9169
9170 OVS_VSWITCHD_STOP
9171 AT_CLEANUP
9172
9173 AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
9174 OVS_VSWITCHD_START
9175
9176 add_of_ports br0 1 2
9177
9178 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9179
9180 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9181 AT_DATA([flows.txt], [dnl
9182 dnl Table 0
9183 dnl
9184 table=0,priority=100,arp,action=normal
9185 table=0,priority=10,udp,action=ct(table=1,zone=0)
9186 table=0,priority=1,action=drop
9187 dnl
9188 dnl Table 1
9189 dnl
9190 table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
9191 table=1,priority=10,ct_state=+trk+est,udp,action=controller
9192 table=1,priority=1,action=drop
9193 ])
9194
9195 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9196
9197 AT_CAPTURE_FILE([ofctl_monitor.log])
9198 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9199
9200 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)'])
9201
9202 dnl OK, now start a new connection from port 1.
9203 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)'])
9204
9205 dnl Now try a reply from port 2.
9206 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)'])
9207
9208 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9209 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9210
9211 dnl Check this output. We only see the latter two packets, not the first.
9212 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9213 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=new|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,in_port=1 (via action) data_len=42 (unbuffered)
9214 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
9215 dnl
9216 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,in_port=2 (via action) data_len=42 (unbuffered)
9217 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
9218 ])
9219
9220 OVS_VSWITCHD_STOP
9221 AT_CLEANUP
9222
9223 AT_SETUP([ofproto-dpif - conntrack - ICMP related])
9224 OVS_VSWITCHD_START
9225
9226 add_of_ports br0 1 2
9227
9228 dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
9229 AT_DATA([flows.txt], [dnl
9230 dnl Table 0
9231 dnl
9232 table=0,priority=100,arp,action=normal
9233 table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
9234 table=0,priority=10,ip,in_port=2,action=ct(table=1)
9235 table=0,priority=1,action=drop
9236 dnl
9237 dnl Table 1
9238 dnl
9239 table=1,priority=10,in_port=1,ct_state=+trk,action=controller
9240 table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
9241 table=1,priority=1,action=drop
9242 ])
9243
9244 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9245
9246 AT_CAPTURE_FILE([ofctl_monitor.log])
9247 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9248
9249 dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
9250 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
9251
9252 dnl 2. Send and UDP packet to port 5555
9253 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
9254
9255 dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
9256 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
9257
9258 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9259 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9260
9261 dnl Check this output. We only see the first and the last packet
9262 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9263 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=47 ct_state=new|trk,ct_nw_src=172.16.0.1,ct_nw_dst=172.16.0.2,ct_nw_proto=17,ct_tp_src=41614,ct_tp_dst=5555,in_port=1 (via action) data_len=47 (unbuffered)
9264 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
9265 dnl
9266 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=75 ct_state=rel|rpl|trk,ct_nw_src=172.16.0.1,ct_nw_dst=172.16.0.2,ct_nw_proto=17,ct_tp_src=41614,ct_tp_dst=5555,in_port=2 (via action) data_len=75 (unbuffered)
9267 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
9268 ])
9269
9270 OVS_VSWITCHD_STOP
9271 AT_CLEANUP
9272
9273 AT_SETUP([ofproto-dpif - conntrack - ct_mark])
9274 OVS_VSWITCHD_START
9275
9276 add_of_ports br0 1 2
9277
9278 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9279
9280 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9281 AT_DATA([flows.txt], [dnl
9282 dnl Table 0
9283 dnl
9284 table=0,arp,action=normal
9285 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
9286 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
9287 table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
9288 table=0,ip,in_port=2,actions=ct(table=1)
9289 table=0,priority=0,action=drop
9290 dnl
9291 dnl Table 1
9292 dnl
9293 table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
9294 table=1,priority=1,action=drop
9295 ])
9296
9297 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9298
9299 AT_CAPTURE_FILE([ofctl_monitor.log])
9300 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9301
9302 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)'])
9303 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)'])
9304 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)'])
9305
9306 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)'])
9307 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)'])
9308 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)'])
9309
9310 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
9311 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9312
9313 dnl Check this output.
9314 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9315 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 ct_mark=0x1,in_port=1 (via action) data_len=42 (unbuffered)
9316 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
9317 dnl
9318 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 ct_mark=0x3,in_port=1 (via action) data_len=42 (unbuffered)
9319 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
9320 dnl
9321 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 ct_mark=0x5,in_port=1 (via action) data_len=42 (unbuffered)
9322 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
9323 dnl
9324 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_mark=0x1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,in_port=2 (via action) data_len=42 (unbuffered)
9325 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
9326 dnl
9327 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_mark=0x3,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=4,in_port=2 (via action) data_len=42 (unbuffered)
9328 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
9329 ])
9330
9331 OVS_VSWITCHD_STOP
9332 AT_CLEANUP
9333
9334 AT_SETUP([ofproto-dpif - conntrack - ct_label])
9335 OVS_VSWITCHD_START
9336
9337 add_of_ports br0 1 2
9338
9339 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9340
9341 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9342 AT_DATA([flows.txt], [dnl
9343 dnl Table 0
9344 dnl
9345 table=0,arp,action=normal
9346 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
9347 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
9348 table=0,ip,in_port=2,actions=ct(table=1)
9349 dnl
9350 dnl Table 1
9351 dnl
9352 table=1,priority=10,ct_state=+trk+rpl,actions=controller
9353 table=1,priority=1,action=drop
9354 ])
9355
9356 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9357
9358 AT_CAPTURE_FILE([ofctl_monitor.log])
9359 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9360
9361 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)'])
9362 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)'])
9363
9364 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)'])
9365 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)'])
9366
9367 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9368 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9369
9370 dnl Check this output.
9371 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9372 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_label=0x1,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,in_port=2 (via action) data_len=42 (unbuffered)
9373 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
9374 dnl
9375 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_label=0x2,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=3,ct_tp_dst=4,in_port=2 (via action) data_len=42 (unbuffered)
9376 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
9377 ])
9378
9379 OVS_VSWITCHD_STOP
9380 AT_CLEANUP
9381
9382 AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
9383 OVS_VSWITCHD_START
9384
9385 add_of_ports br0 1 2
9386
9387 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9388
9389 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9390 AT_DATA([flows.txt], [dnl
9391 dnl The flows are in two separate tables for two reasons:
9392 dnl * To make the pipeline more clear.
9393 dnl * To make megaflows more consistent (we check megaflows below). The
9394 dnl unwildcarding in megaflows depends on the internal ordering of the
9395 dnl subtables, which are sorted using the system qsort(). qsort()
9396 dnl is provided by libc and may or may not be stable, so we can't rely
9397 dnl on that. By having separate tables we have more control over which
9398 dnl subtables are visited, meaning consistent megaflows.
9399 dnl
9400 dnl Table 0
9401 dnl
9402 table=0,arp,action=normal
9403 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
9404 table=0,ip,in_port=2,actions=ct(table=1)
9405 table=0,priority=0,action=drop
9406 dnl
9407 dnl Table 1
9408 dnl
9409 table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
9410 table=1,priority=1,action=drop
9411 ])
9412
9413 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9414
9415 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)'])
9416 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)'])
9417
9418 # Give time for logs to appear.
9419 ovs-appctl revalidator/wait
9420
9421 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9422 ct_state(+rpl+trk),ct_label(0x1),recirc_id(0x1),in_port(2),eth_type(0x0800),ipv4(frag=no), actions:1
9423 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=no),udp(src=1), actions:ct(commit,label=0x1),2
9424 recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
9425 ])
9426
9427 OVS_VSWITCHD_STOP
9428 AT_CLEANUP
9429
9430 AT_SETUP([ofproto-dpif - conntrack - no output])
9431 OVS_VSWITCHD_START
9432
9433 add_of_ports br0 1
9434
9435 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9436
9437 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9438 AT_DATA([flows.txt], [dnl
9439 in_port=1,udp,action=ct(commit,zone=0)
9440 ])
9441
9442 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9443
9444 dnl Start a new connection from port 1.
9445 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)'])
9446
9447 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9448 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
9449 ])
9450
9451 OVS_VSWITCHD_STOP
9452 AT_CLEANUP
9453
9454 AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
9455 OVS_VSWITCHD_START
9456
9457 add_of_ports br0 1 2
9458
9459 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9460
9461 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9462 AT_DATA([flows.txt], [dnl
9463 dnl Table 0
9464 dnl
9465 table=0,priority=100,arp,action=normal
9466 table=0,priority=10,in_port=1,ip,action=ct(commit,table=1)
9467 table=0,priority=10,in_port=2,ip,action=ct(table=1)
9468 table=0,priority=1,action=drop
9469 dnl
9470 dnl Table 1
9471 dnl
9472 dnl The following two flows are separated to explicitly count the packets
9473 dnl that create a new connection
9474 table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
9475 table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
9476 dnl
9477 table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
9478 table=1,ip,ct_state=+trk+inv,action=drop
9479 ])
9480
9481 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9482
9483 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
9484 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
9485 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
9486 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
9487 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
9488 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
9489 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
9490 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
9491 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
9492
9493 AT_CHECK([ovs-appctl revalidator/purge])
9494 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9495 dnl Only one new connection
9496 n_packets=1
9497 ])
9498
9499 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
9500 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
9501 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
9502 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
9503 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
9504 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
9505 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
9506 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
9507 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
9508
9509 AT_CHECK([ovs-appctl revalidator/purge])
9510 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9511 dnl Two new connections
9512 n_packets=2
9513 ])
9514
9515 OVS_VSWITCHD_STOP
9516 AT_CLEANUP
9517
9518 AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
9519 OVS_VSWITCHD_START
9520
9521 add_of_ports br0 1 2
9522
9523 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9524
9525 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9526 AT_DATA([flows.txt], [dnl
9527 dnl Table 0
9528 dnl
9529 table=0,priority=100,arp,action=normal
9530 table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
9531 table=0,priority=10,in_port=2,tcp,action=ct(table=1)
9532 table=0,priority=1,action=drop
9533 dnl
9534 dnl Table 1
9535 dnl
9536 table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
9537 table=1,priority=1,action=drop
9538 ])
9539
9540 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9541
9542 AT_CHECK([ovs-appctl revalidator/purge])
9543 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9544 dnl No dropped packets
9545 n_packets=0
9546 ])
9547
9548 AT_CAPTURE_FILE([ofctl_monitor.log])
9549 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9550
9551 dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
9552 dnl sure that the connection tracker is able to pick up already established
9553 dnl connections that use window scaling.
9554 dnl
9555 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
9556 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
9557 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
9558 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
9559 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
9560 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a08004500022afc284000400626a10a0101020a01010100020001396bb35b8cadbdb45018000a941f0000 dnl
9561 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9562 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9563 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9564 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9565 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9566 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9567 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9568 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9569 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9570 6666666666666666666666666666666666666666666666666666660a'])
9571 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
9572 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a5054000000090800450001fdf2ca40004006302c0a0101010a010102000100028cadbdb4396bb55d5018000aa60c0000 dnl
9573 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9574 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9575 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9576 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9577 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9578 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9579 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9580 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9581 6565656565656565656565656565656565656565656565656565656565656565656565650a'])
9582 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
9583 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
9584 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
9585 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
9586 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
9587
9588 AT_CHECK([ovs-appctl revalidator/purge])
9589
9590 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9591
9592 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9593 ])
9594
9595 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9596 dnl No dropped packets
9597 n_packets=0
9598 ])
9599
9600 OVS_VSWITCHD_STOP
9601 AT_CLEANUP
9602
9603 dnl This is a truncated version of "ofproto-dpif - conntrack - controller",
9604 dnl with extra send-to-controller actions following ct_clear to show that
9605 dnl the connection tracking data has been cleared.
9606 AT_SETUP([ofproto-dpif - conntrack - ct_clear])
9607 OVS_VSWITCHD_START
9608
9609 add_of_ports br0 1 2
9610
9611 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9612
9613 dnl Allow new connections on p1->p2, but not on p2->p1.
9614 AT_DATA([flows.txt], [dnl
9615 dnl Table 0
9616 dnl
9617 table=0,priority=100,arp,action=normal
9618 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller,ct_clear,controller
9619 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9620 table=0,priority=1,action=drop
9621 dnl
9622 dnl Table 1
9623 dnl
9624 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller,ct_clear,controller
9625 table=1,priority=1,action=drop
9626 ])
9627
9628 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9629
9630 AT_CAPTURE_FILE([ofctl_monitor.log])
9631 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9632
9633 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)'])
9634
9635 dnl OK, now start a new connection from port 1.
9636 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)'])
9637
9638 dnl Now try a reply from port 2.
9639 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)'])
9640
9641 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9642 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9643
9644 dnl Check this output. We only see the latter two packets, not the first.
9645 dnl Note that the first packet doesn't have the ct_state bits set. This
9646 dnl happens because the ct_state field is available only after recirc.
9647 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9648 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9649 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
9650 dnl
9651 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9652 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
9653 dnl
9654 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 ct_state=est|rpl|trk,ct_nw_src=10.1.1.1,ct_nw_dst=10.1.1.2,ct_nw_proto=17,ct_tp_src=1,ct_tp_dst=2,in_port=2 (via action) data_len=42 (unbuffered)
9655 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
9656 dnl
9657 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 in_port=2 (via action) data_len=42 (unbuffered)
9658 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
9659 ])
9660 OVS_VSWITCHD_STOP
9661 AT_CLEANUP
9662
9663 AT_SETUP([ofproto - set mtu])
9664 OVS_VSWITCHD_START
9665
9666 add_of_ports br0 1
9667
9668 # Check that initial MTU is 1500 for 'br0' and 'p1'.
9669 AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
9670 1500
9671 ])
9672 AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
9673 1500
9674 ])
9675
9676 # Request new MTU for 'p1'
9677 AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
9678
9679 # Check that the new MTU is applied
9680 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p1 mtu=1600])
9681 # The internal port 'br0' should have the same MTU value as p1, becase it's
9682 # the new bridge minimum.
9683 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
9684
9685 AT_CHECK([ovs-vsctl del-port br0 p1])
9686
9687 # When 'p1' is deleted, the internal port should return to the default MTU
9688 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1500])
9689
9690 # New port with 'mtu_request' in the same transaction.
9691 AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
9692 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1600])
9693 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
9694
9695 # Explicitly set mtu_request on the internal interface. This should prevent
9696 # the MTU from being overriden.
9697 AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
9698 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
9699
9700 # The new MTU on p2 should not affect br0.
9701 AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
9702 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1400])
9703 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
9704
9705 # Remove explicit mtu_request from br0. Now it should track the bridge
9706 # minimum again.
9707 AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
9708 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1400])
9709
9710 OVS_VSWITCHD_STOP
9711 AT_CLEANUP
9712
9713 AT_SETUP([ofproto - fragment prerequisites])
9714 OVS_VSWITCHD_START
9715
9716 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9717
9718 add_of_ports br0 1
9719
9720 AT_DATA([flows.txt], [dnl
9721 priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
9722 priority=1,in_port=1,udp,action=drop
9723 ])
9724
9725 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9726
9727 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
9728
9729 ovs-appctl time/stop
9730 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
9731 ovs-appctl time/warp 5000
9732
9733 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9734 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
9735 ])
9736
9737 dnl Change the flow table. This will trigger revalidation of all the flows.
9738 AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
9739 AT_CHECK([ovs-appctl revalidator/wait], [0])
9740
9741 dnl We don't want revalidators to delete any flow. If the flow has been
9742 dnl deleted it means that there's some inconsistency with the revalidation.
9743 AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
9744
9745 OVS_VSWITCHD_STOP
9746 AT_CLEANUP