]> git.proxmox.com Git - mirror_ovs.git/blob - tests/ofproto-dpif.at
ofproto-dpif: Mark packets as "untracked" after call to ct().
[mirror_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),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
47 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
48 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0d),eth_type(0x0800),ipv4(frag=no), actions: <del>
49 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(frag=no), actions: <del>
50 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), actions: <del>
51 recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035), actions: <del>
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=p1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout])
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,eth,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,eth,icmp6,in_port=1,nw_frag=no,icmp_type=0x87/0xff,icmp_code=0x0/0xff,nd_target=fe80::2020,nd_sll=66:55:44:33:22:11
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,eth,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,eth,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,eth,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),packet_type(ns=0,id=0),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),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:10
482 recirc_id(0x1),dp_hash(0xXXXX/0x1),in_port(1),packet_type(ns=0,id=0),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)/' | sed 's/\(actions:1\)[[01]]/\1X/' | strip_ufid | strip_used | sort], [0], [dnl
495 flow-dump from non-dpdk interfaces:
496 recirc_id(0),in_port(1),packet_type(ns=0,id=0),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),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:630, used:0.0s, actions:1X
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,eth,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
735 AT_SETUP([ofproto-dpif - push-pop])
736 OVS_VSWITCHD_START
737 add_of_ports br0 20 21 22 33 90
738 AT_DATA([flows.txt], [dnl
739 in_port=90 actions=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
740 in_port=2 actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
741 in_port=3 actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
742 in_port=4 actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
743 in_port=5 actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
744
745 ])
746 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
747 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])
748 AT_CHECK([tail -1 stdout], [0],
749 [Datapath actions: 33,22,21,20
750 ])
751 OVS_VSWITCHD_STOP
752 AT_CLEANUP
753
754 AT_SETUP([ofproto-dpif - output])
755 OVS_VSWITCHD_START
756 add_of_ports br0 1 9 10 11 55 66 77 88
757 AT_DATA([flows.txt], [dnl
758 in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
759 in_port=2 actions=output:9
760 in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
761 in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
762 in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
763 in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
764 in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
765 in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
766 ])
767 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
768 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])
769 AT_CHECK([tail -1 stdout], [0],
770 [Datapath actions: 9,55,10,55,66,11,77,88,9,1
771 ])
772 OVS_VSWITCHD_STOP
773 AT_CLEANUP
774
775 AT_SETUP([ofproto-dpif - dec_ttl])
776 OVS_VSWITCHD_START
777 add_of_ports br0 1 2 3 4
778 AT_DATA([flows.txt], [dnl
779 table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
780 table=1 in_port=1 action=dec_ttl,output:3
781 ])
782 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
783 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])
784 AT_CHECK([tail -4 stdout], [0],
785 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=2,nw_frag=no
786 Datapath actions: set(ipv4(ttl=1)),2,4
787 This flow is handled by the userspace slow path because it:
788 - Sends "packet-in" messages to the OpenFlow controller.
789 ])
790 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])
791 AT_CHECK([tail -2 stdout], [0],
792 [Megaflow: recirc_id=0,eth,ip,in_port=1,nw_ttl=3,nw_frag=no
793 Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
794 ])
795 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])
796 AT_CHECK([tail -2 stdout], [0],
797 [Megaflow: recirc_id=0,eth,ipv6,in_port=1,nw_ttl=128,nw_frag=no
798 Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
799 ])
800
801 AT_CAPTURE_FILE([ofctl_monitor.log])
802 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
803 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])
804 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
805 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
806 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
807 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
808 ])
809 OVS_VSWITCHD_STOP
810 AT_CLEANUP
811
812 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
813 dnl buffer to be resized just before pushing the id of the dec_ttl action.
814 dnl Thus the implementation must account for this by using the
815 dnl reallocated buffer rather than the original buffer.
816 dnl
817 dnl A number of similar rules are added to try and exercise
818 dnl xrealloc sufficiently that it returns a different base pointer
819 AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
820 OVS_VSWITCHD_START
821 add_of_ports br0 1
822 (for i in `seq 0 255`; do
823 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
824 done) > flows.txt
825 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
826 OVS_VSWITCHD_STOP
827 AT_CLEANUP
828
829 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
830 dnl buffer to be resized just before pushing the id of the dec_ttl action.
831 dnl Thus the implementation must account for this by using the
832 dnl reallocated buffer rather than the original buffer.
833 dnl
834 dnl A number of similar rules are added to try and exercise
835 dnl xrealloc sufficiently that it returns a different base pointer
836 AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
837 OVS_VSWITCHD_START
838 add_of_ports br0 1
839 (for i in `seq 0 255`; do
840 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
841 done) > flows.txt
842 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
843 OVS_VSWITCHD_STOP
844 AT_CLEANUP
845
846 dnl A note action at offset 24 in ofpacts will cause the ofpacts
847 dnl buffer to be resized just before pushing the id of the dec_ttl action.
848 dnl Thus the implementation must account for this by using the
849 dnl reallocated buffer rather than the original buffer.
850 dnl
851 dnl A number of similar rules are added to try and exercise
852 dnl xrealloc sufficiently that it returns a different base pointer
853 AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
854 OVS_VSWITCHD_START
855 add_of_ports br0 1
856 (for i in `seq 0 255`; do
857 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
858 done) > flows.txt
859 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
860 OVS_VSWITCHD_STOP
861 AT_CLEANUP
862
863 dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
864 dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
865 dnl Using `make check-valgrind' here checks for use-after-free in this
866 dnl codepath.
867 AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
868 OVS_VSWITCHD_START
869 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'])
870 OVS_VSWITCHD_STOP
871 AT_CLEANUP
872
873 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
874 OVS_VSWITCHD_START
875 add_of_ports br0 1 2
876
877 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
878
879 # "in_port" defaults to OFPP_NONE if it's not specified.
880 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"
881 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
882 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
883 1
884 2
885 100
886 ])
887
888 OVS_VSWITCHD_STOP
889 AT_CLEANUP
890
891 AT_SETUP([ofproto-dpif - DSCP])
892 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
893 add_of_ports br0 9
894 AT_DATA([flows.txt], [dnl
895 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
896 ])
897 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
898 AT_CHECK([ovs-vsctl -- \
899 set Port p1 qos=@newqos --\
900 --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
901 --id=@q1 create Queue dscp=1 --\
902 --id=@q2 create Queue dscp=2], [0], [ignore])
903 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])
904 AT_CHECK([tail -2 stdout], [0],
905 [Megaflow: recirc_id=0,skb_priority=0,eth,ip,in_port=9,nw_tos=252,nw_frag=no
906 Datapath actions: dnl
907 100,dnl
908 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
909 set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
910 1,dnl
911 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
912 set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
913 set(ipv4(tos=0/0xfc)),1,100
914 ])
915 OVS_VSWITCHD_STOP
916 AT_CLEANUP
917
918 AT_SETUP([ofproto-dpif - output/flood flags])
919 OVS_VSWITCHD_START
920 add_of_ports br0 1 2 3 4 5 6 7
921
922 AT_DATA([flows.txt], [dnl
923 in_port=local actions=local,flood
924 in_port=1 actions=flood
925 in_port=2 actions=all
926 in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
927 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
928 ])
929 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
930 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
931 AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
932
933 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])
934 AT_CHECK([tail -1 stdout \
935 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
936 1
937 2
938 3
939 4
940 7
941 ])
942
943 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])
944 AT_CHECK([tail -1 stdout \
945 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
946 100
947 2
948 3
949 4
950 7
951 ])
952
953 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])
954 AT_CHECK([tail -1 stdout \
955 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
956 1
957 100
958 3
959 4
960 6
961 7
962 ])
963
964 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])
965 AT_CHECK([tail -1 stdout], [0],
966 [Datapath actions: 100,1,2,4,6,7
967 ])
968
969 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])
970 AT_CHECK([tail -1 stdout], [0],
971 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
972 ])
973 OVS_VSWITCHD_STOP
974 AT_CLEANUP
975
976 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
977 OVS_VSWITCHD_START([dnl
978 add-port br0 p1 -- set Interface p1 type=dummy
979 ])
980 on_exit 'kill `cat ovs-ofctl.pid`'
981
982 AT_CAPTURE_FILE([ofctl_monitor.log])
983
984 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
985
986 for i in 1 2 3 ; do
987 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)'
988 done
989 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
990 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
991 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
992 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
993 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
994 dnl
995 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
996 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
997 dnl
998 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
999 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
1000 ])
1001
1002 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1003 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1004 NXST_FLOW reply:
1005 ])
1006
1007 OVS_VSWITCHD_STOP
1008 AT_CLEANUP
1009
1010 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
1011 OVS_VSWITCHD_START([dnl
1012 add-port br0 p1 -- set Interface p1 type=dummy
1013 ])
1014 on_exit 'kill `cat ovs-ofctl.pid`'
1015
1016 AT_CAPTURE_FILE([ofctl_monitor.log])
1017 AT_CHECK([ovs-ofctl del-flows br0])
1018
1019 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1020
1021 dnl Test that missed packets are dropped
1022 for i in 1 2 3 ; do
1023 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)'
1024 done
1025 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1026
1027 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1028 ])
1029
1030 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1031 AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1032 OFPST_FLOW reply (OF1.3):
1033 ])
1034
1035 OVS_VSWITCHD_STOP
1036 AT_CLEANUP
1037
1038 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
1039 OVS_VSWITCHD_START([dnl
1040 add-port br0 p1 -- set Interface p1 type=dummy
1041 ])
1042 on_exit 'kill `cat ovs-ofctl.pid`'
1043
1044 AT_CAPTURE_FILE([ofctl_monitor.log])
1045 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1046
1047 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1048
1049 for i in 1 2 3 ; do
1050 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)'
1051 done
1052 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1053 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1054 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1055 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1056 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
1057 dnl
1058 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1059 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
1060 dnl
1061 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1062 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
1063 ])
1064
1065 AT_CHECK([ovs-appctl revalidator/purge], [0])
1066 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1067 n_packets=3, n_bytes=162, actions=goto_table:1
1068 OFPST_FLOW reply (OF1.2):
1069 ])
1070
1071 OVS_VSWITCHD_STOP
1072 AT_CLEANUP
1073
1074 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
1075 OVS_VSWITCHD_START([dnl
1076 add-port br0 p1 -- set Interface p1 type=dummy
1077 ])
1078 on_exit 'kill `cat ovs-ofctl.pid`'
1079
1080 AT_CAPTURE_FILE([ofctl_monitor.log])
1081 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1082
1083 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1084
1085 for i in 1 2 3 ; do
1086 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)'
1087 done
1088
1089 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1090 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1091 ])
1092
1093 AT_CHECK([ovs-appctl revalidator/purge], [0])
1094 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1095 n_packets=3, n_bytes=162, actions=resubmit(1,1)
1096 OFPST_FLOW reply (OF1.2):
1097 ])
1098
1099 OVS_VSWITCHD_STOP
1100 AT_CLEANUP
1101
1102 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1103 OVS_VSWITCHD_START([dnl
1104 add-port br0 p1 -- set Interface p1 type=dummy
1105 ])
1106 on_exit 'kill `cat ovs-ofctl.pid`'
1107
1108 AT_CAPTURE_FILE([ofctl_monitor.log])
1109 AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1110 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1111
1112 dnl Miss table 0, Hit table 1
1113 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1114
1115 for i in 1 2 3 ; do
1116 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)'
1117 done
1118 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1119 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1120
1121 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1122 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1123 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
1124 dnl
1125 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1126 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
1127 dnl
1128 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1129 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
1130 ])
1131
1132 dnl Hit table 0, Miss all other tables, sent to controller
1133 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1134
1135 for i in 1 2 3 ; do
1136 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)'
1137 done
1138 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1139 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1140
1141 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1142 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1143 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
1144 dnl
1145 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1146 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
1147 dnl
1148 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1149 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
1150 ])
1151
1152 AT_CHECK([ovs-appctl revalidator/purge], [0])
1153 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1154 table=1, n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1155 OFPST_FLOW reply (OF1.2):
1156 ])
1157
1158 OVS_VSWITCHD_STOP
1159 AT_CLEANUP
1160
1161 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1162 OVS_VSWITCHD_START([dnl
1163 add-port br0 p1 -- set Interface p1 type=dummy
1164 ])
1165 on_exit 'kill `cat ovs-ofctl.pid`'
1166
1167 AT_CAPTURE_FILE([ofctl_monitor.log])
1168 AT_DATA([flows.txt], [dnl
1169 table=0 actions=goto_table(1)
1170 table=2 dl_src=10:11:11:11:11:11 actions=controller
1171 ])
1172 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1173 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1174
1175 dnl Hit table 0, Miss table 1, Hit table 2
1176 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1177
1178 for i in 1 2 3 ; do
1179 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)'
1180 done
1181 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1182 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1183
1184 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1185 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1186 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
1187 dnl
1188 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1189 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
1190 dnl
1191 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1192 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
1193 ])
1194
1195 dnl Hit table 1, Miss all other tables, sent to controller
1196 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1197
1198 for i in 1 2 3 ; do
1199 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)'
1200 done
1201 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1202 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1203
1204 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1205 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1206 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
1207 dnl
1208 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1209 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
1210 dnl
1211 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1212 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
1213 ])
1214
1215 AT_CHECK([ovs-appctl revalidator/purge], [0])
1216 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1217 n_packets=6, n_bytes=324, actions=goto_table:1
1218 table=2, n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1219 OFPST_FLOW reply (OF1.2):
1220 ])
1221
1222 OVS_VSWITCHD_STOP
1223 AT_CLEANUP
1224
1225 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1226 OVS_VSWITCHD_START([dnl
1227 add-port br0 p1 -- set Interface p1 type=dummy
1228 ])
1229 on_exit 'kill `cat ovs-ofctl.pid`'
1230
1231 AT_CAPTURE_FILE([ofctl_monitor.log])
1232 AT_DATA([flows.txt], [dnl
1233 table=0 actions=resubmit(1,1)
1234 table=2 dl_src=10:11:11:11:11:11 actions=controller
1235 ])
1236 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1237 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1238
1239 dnl Hit table 0, Miss table 1, Dropped
1240 AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1241
1242 for i in 1 2 3 ; do
1243 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)'
1244 done
1245 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1246
1247 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1248 ])
1249
1250 dnl Hit table 1, Dropped
1251 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1252
1253 for i in 1 2 3 ; do
1254 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)'
1255 done
1256 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1257
1258 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1259 ])
1260
1261 AT_CHECK([ovs-appctl revalidator/purge], [0])
1262 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1263 n_packets=6, n_bytes=324, actions=resubmit(1,1)
1264 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1265 OFPST_FLOW reply (OF1.2):
1266 ])
1267
1268 OVS_VSWITCHD_STOP
1269 AT_CLEANUP
1270
1271 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1272 OVS_VSWITCHD_START([dnl
1273 add-port br0 p1 -- set Interface p1 type=dummy
1274 ])
1275 on_exit 'kill `cat ovs-ofctl.pid`'
1276
1277 AT_CAPTURE_FILE([ofctl_monitor.log])
1278 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1279
1280 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1281
1282 dnl Test that missed packets are dropped
1283 for i in 1 2 3 ; do
1284 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)'
1285 done
1286 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1287
1288 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1289 ])
1290
1291 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1292 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1293 NXST_FLOW reply:
1294 ])
1295
1296 OVS_VSWITCHD_STOP
1297 AT_CLEANUP
1298
1299 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1300 OVS_VSWITCHD_START([dnl
1301 add-port br0 p1 -- set Interface p1 type=dummy
1302 ])
1303 on_exit 'kill `cat ovs-ofctl.pid`'
1304
1305 AT_CAPTURE_FILE([ofctl_monitor.log])
1306 AT_CHECK([ovs-ofctl del-flows br0])
1307 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1308 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1309
1310 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1311
1312 dnl Test that missed packets are dropped
1313 for i in 1 2 3 ; do
1314 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)'
1315 done
1316 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1317
1318 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1319 ])
1320
1321 AT_CHECK([ovs-appctl revalidator/purge], [0])
1322 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1323 n_packets=3, n_bytes=162, actions=goto_table:1
1324 OFPST_FLOW reply (OF1.2):
1325 ])
1326
1327 OVS_VSWITCHD_STOP
1328 AT_CLEANUP
1329
1330 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1331 OVS_VSWITCHD_START([dnl
1332 add-port br0 p1 -- set Interface p1 type=dummy
1333 ])
1334 on_exit 'kill `cat ovs-ofctl.pid`'
1335
1336 AT_CAPTURE_FILE([ofctl_monitor.log])
1337 AT_CHECK([ovs-ofctl del-flows br0])
1338 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1339 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1340
1341 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1342
1343 dnl Test that missed packets are dropped
1344 for i in 1 2 3 ; do
1345 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)'
1346 done
1347 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1348
1349 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1350 ])
1351
1352 AT_CHECK([ovs-appctl revalidator/purge], [0])
1353 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1354 n_packets=3, n_bytes=162, actions=resubmit(1,1)
1355 OFPST_FLOW reply (OF1.2):
1356 ])
1357
1358 OVS_VSWITCHD_STOP
1359 AT_CLEANUP
1360
1361 AT_SETUP([ofproto-dpif - controller])
1362 OVS_VSWITCHD_START([dnl
1363 add-port br0 p1 -- set Interface p1 type=dummy
1364 ])
1365 on_exit 'kill `cat ovs-ofctl.pid`'
1366
1367 AT_CAPTURE_FILE([ofctl_monitor.log])
1368 AT_DATA([flows.txt], [dnl
1369 cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
1370 cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
1371 cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1372
1373 cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1374 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)
1375 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)
1376 cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1377 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)
1378 cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1379 cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
1380 cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
1381 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
1382 ])
1383 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1384
1385 dnl Flow miss.
1386 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1387
1388 for i in 1 2 3 ; do
1389 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)'
1390 done
1391 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1392 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1393
1394 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1395 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1396 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
1397 dnl
1398 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1399 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
1400 dnl
1401 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
1402 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
1403 ])
1404
1405 dnl Singleton controller action.
1406 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1407
1408 for i in 1 2 3 ; do
1409 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)'
1410 done
1411 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1412 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1413
1414 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1415 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1416 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
1417 dnl
1418 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1419 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
1420 dnl
1421 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1422 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
1423 ])
1424
1425 dnl Modified controller action.
1426 AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1427
1428 for i in 1 2 3 ; do
1429 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)'
1430 done
1431 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1432 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1433
1434 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1435 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1436 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
1437 dnl
1438 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1439 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
1440 dnl
1441 OFPT_PACKET_IN (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1442 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
1443 ])
1444
1445 dnl Modified VLAN controller action.
1446 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1447
1448 for i in 1 2 3; do
1449 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)'
1450 done
1451 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1452 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1453
1454 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1455 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1456 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
1457 dnl
1458 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1459 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
1460 dnl
1461 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1462 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
1463 ])
1464
1465 dnl Checksum TCP.
1466 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1467
1468 for i in 1 ; do
1469 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)'
1470 done
1471 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1472 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1473
1474 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1475 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
1476 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
1477 dnl
1478 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=58 reg0=0x1,in_port=1 (via action) data_len=58 (unbuffered)
1479 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
1480 dnl
1481 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)
1482 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
1483 dnl
1484 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)
1485 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
1486 dnl
1487 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)
1488 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
1489 dnl
1490 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)
1491 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
1492 dnl
1493 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)
1494 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
1495 dnl
1496 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)
1497 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
1498 dnl
1499 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)
1500 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
1501 ])
1502
1503 dnl Checksum UDP.
1504 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1505
1506 for i in 1 ; do
1507 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'
1508 done
1509 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1510 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1511
1512 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1513 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1514 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
1515 dnl
1516 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
1517 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
1518 dnl
1519 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)
1520 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
1521 dnl
1522 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)
1523 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
1524 dnl
1525 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)
1526 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
1527 dnl
1528 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)
1529 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
1530 dnl
1531 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)
1532 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
1533 dnl
1534 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)
1535 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
1536 dnl
1537 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)
1538 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
1539 ])
1540
1541 dnl Modified ARP controller action.
1542 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1543
1544 for i in 1 2 3; do
1545 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)'
1546 done
1547
1548 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1549 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1550 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1551 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1552 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
1553 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1554 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
1555 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1556 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
1557 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1558 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
1559 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1560 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
1561 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1562 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
1563 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1564 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
1565 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1566 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
1567 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1568 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
1569 ])
1570
1571 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1572
1573 dnl Checksum SCTP.
1574 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1575
1576 for i in 1 ; do
1577 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'
1578 done
1579
1580 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1581 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1582 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1583 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1584 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
1585 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
1586 dnl
1587 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
1588 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
1589 dnl
1590 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)
1591 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
1592 dnl
1593 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)
1594 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
1595 dnl
1596 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)
1597 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
1598 dnl
1599 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)
1600 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
1601 dnl
1602 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)
1603 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
1604 dnl
1605 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)
1606 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
1607 dnl
1608 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)
1609 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
1610 ])
1611
1612 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1613 cookie=0x1, n_packets=3, n_bytes=212, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1614 cookie=0x2, n_packets=3, n_bytes=162, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1615 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)
1616 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)
1617 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)
1618 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)
1619 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)
1620 cookie=0x8, table=6, n_packets=3, n_bytes=212, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1621 cookie=0x9, table=7, n_packets=3, n_bytes=212, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1622 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
1623 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
1624 n_packets=3, n_bytes=162, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1625 NXST_FLOW reply:
1626 ])
1627
1628 OVS_VSWITCHD_STOP
1629 AT_CLEANUP
1630
1631 AT_SETUP([ofproto-dpif - controller action without megaflows])
1632 OVS_VSWITCHD_START
1633 add_of_ports br0 1
1634
1635 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,action=controller])
1636 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [dnl
1637 megaflows disabled
1638 ])
1639
1640 AT_CAPTURE_FILE([ofctl_monitor.log])
1641 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1642
1643 for i in 1 2; do
1644 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)'])
1645 done
1646
1647 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
1648 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1649
1650 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1651 flow-dump from non-dpdk interfaces:
1652 packets:1, bytes:14, used:0.001s, actions:userspace(pid=0,slow_path(controller))
1653 ])
1654
1655 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1656 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1657 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1658 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1659 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
1660 ])
1661
1662 AT_CHECK([ovs-appctl revalidator/purge])
1663 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1664
1665 dnl Add a controller meter.
1666 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=controller pktps stats bands=type=drop rate=1'])
1667
1668 dnl Advance time by 1 second.
1669 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1670
1671 for i in `seq 1 8`; do
1672 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)'])
1673 done
1674
1675 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1676 flow-dump from non-dpdk interfaces:
1677 packets:7, bytes:98, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,slow_path(controller))))
1678 ])
1679
1680 AT_CHECK([ovs-appctl time/warp 1], [0], [ignore])
1681 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1682
1683 dnl Out of 8 packets we sent, one executes the controller action via
1684 dnl miss upcall. Another one got passed the rate limiter.
1685 dnl The rest of packets are blocked by the rate limiter.
1686 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1687 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1688 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1689 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
1690 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x4321
1691 ])
1692 dnl Check meter stats to make it gives the same picture;
1693 dnl 7 packets hit the meter, but 6 packets are dropped by band0.
1694 AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
1695 OFPST_METER reply (OF1.3) (xid=0x2):
1696 meter:controller flow_count:0 packet_in_count:7 byte_in_count:98 duration:0.0s bands:
1697 0: packet_count:6 byte_count:84
1698 ])
1699
1700 OVS_VSWITCHD_STOP
1701 AT_CLEANUP
1702
1703 AT_SETUP([ofproto-dpif - MPLS handling])
1704 OVS_VSWITCHD_START([dnl
1705 add-port br0 p1 -- set Interface p1 type=dummy
1706 ])
1707 on_exit 'kill `cat ovs-ofctl.pid`'
1708
1709 AT_CAPTURE_FILE([ofctl_monitor.log])
1710 AT_DATA([flows.txt], [dnl
1711 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
1712 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
1713 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
1714 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
1715 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
1716 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
1717 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
1718 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
1719 cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
1720 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1721 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1722 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
1723
1724 cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1725 cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1726 cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1727 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
1728 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
1729 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
1730 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
1731
1732 cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1733 cookie=0xd table=1 arp actions=controller
1734
1735 cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1736 cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1737 cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1738 cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1739
1740 cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1741 cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1742 cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1743
1744 cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
1745 cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1746 cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1747
1748 cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1749 cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1750 cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1751
1752 cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1753 cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1754 cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1755
1756 cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1757 cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1758 cookie=0x5 dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
1759 ])
1760 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1761
1762 dnl Modified MPLS controller action.
1763 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1764
1765 for i in 1 2 3; do
1766 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)'
1767 done
1768 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1769 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1770
1771 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1772 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
1773 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
1774 dnl
1775 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
1776 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
1777 dnl
1778 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=46 in_port=1 (via action) data_len=46 (unbuffered)
1779 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
1780 ])
1781
1782 dnl Modified MPLS controller action.
1783 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1784
1785 for i in 1 2 3; do
1786 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)'
1787 done
1788 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1789 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1790
1791 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1792 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
1793 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
1794 dnl
1795 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
1796 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
1797 dnl
1798 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=34 in_port=1 (via action) data_len=34 (unbuffered)
1799 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
1800 ])
1801
1802 dnl Modified MPLS controller action.
1803 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1804
1805 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)
1806
1807 for i in 1 2 3; do
1808 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)'
1809 done
1810 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1811 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1812
1813 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1814 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1815 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
1816 dnl
1817 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1818 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
1819 dnl
1820 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1821 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
1822 ])
1823
1824 dnl Modified MPLS controller action.
1825 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1826
1827 for i in 1 2 3; do
1828 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))'
1829 done
1830 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1831 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1832
1833 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1834 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1835 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
1836 dnl
1837 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1838 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
1839 dnl
1840 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
1841 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
1842 ])
1843
1844 dnl Modified MPLS controller action.
1845 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1846
1847 for i in 1 2 3; do
1848 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)'
1849 done
1850 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1851 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1852
1853 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1854 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1855 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
1856 dnl
1857 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1858 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
1859 dnl
1860 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1861 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
1862 ])
1863
1864 dnl Modified MPLS controller action.
1865 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1866
1867 for i in 1 2 3; do
1868 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)'
1869 done
1870 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1871 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1872
1873 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1874 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1875 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
1876 dnl
1877 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1878 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
1879 dnl
1880 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1881 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
1882 ])
1883
1884 dnl Modified MPLS controller action.
1885 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1886
1887 for i in 1 2 3; do
1888 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)'
1889 done
1890 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1891 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1892
1893 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1894 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1895 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
1896 dnl
1897 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1898 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
1899 dnl
1900 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1901 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
1902 ])
1903
1904 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1905
1906 dnl Modified MPLS controller action.
1907 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1908
1909 for i in 1 2 3; do
1910 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)'
1911 done
1912 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1913 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1914
1915 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1916 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1917 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
1918 dnl
1919 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1920 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
1921 dnl
1922 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
1923 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
1924 ])
1925
1926 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1927
1928 dnl Modified MPLS controller action.
1929 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1930
1931 for i in 1 2 3; do
1932 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)'
1933 done
1934 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1935 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1936
1937 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1938 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1939 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
1940 dnl
1941 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1942 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
1943 dnl
1944 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=38 in_port=1 (via action) data_len=38 (unbuffered)
1945 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
1946 ])
1947
1948 dnl Modified MPLS actions.
1949 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1950
1951 for i in 1 2 3; do
1952 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)'
1953 done
1954 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1955 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1956
1957 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1958 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
1959 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
1960 dnl
1961 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
1962 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
1963 dnl
1964 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=18 in_port=1 (via action) data_len=18 (unbuffered)
1965 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
1966 ])
1967
1968 dnl Modified MPLS ipv6 controller action.
1969 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1970
1971 for i in 1 2 3; do
1972 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)'
1973 done
1974 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1975 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1976
1977 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1978 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1979 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
1980 dnl
1981 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1982 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
1983 dnl
1984 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1985 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
1986 ])
1987
1988
1989 dnl Modified MPLS pop action.
1990 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
1991 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)
1992 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
1993
1994 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1995
1996 for i in 1 2 3; do
1997 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'
1998 done
1999 #for i in 2 3; do
2000 # 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)'
2001 #done
2002 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2003 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2004
2005 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2006 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2007 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
2008 dnl
2009 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2010 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
2011 dnl
2012 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2013 tcp,vlan_tci=0x0000,dl_src=60:66:66:66: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
2014 ])
2015
2016 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2017
2018 dnl Modified MPLS pop action.
2019 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2020 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)
2021 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2022 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2023 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2024
2025 for i in 1 2 3; do
2026 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'
2027 done
2028 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2029 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2030
2031 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2032 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2033 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
2034 dnl
2035 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2036 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
2037 dnl
2038 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2039 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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
2040 ])
2041
2042 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2043
2044 dnl Modified MPLS pop action.
2045 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2046 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)
2047 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2048 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2049 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2050
2051 for i in 1 2 3; do
2052 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'
2053 done
2054 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2055 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2056
2057 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2058 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2059 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
2060 dnl
2061 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2062 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
2063 dnl
2064 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2065 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
2066 ])
2067
2068 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2069
2070 dnl Modified MPLS pop action.
2071 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2072 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)
2073 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2074 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2075 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2076
2077 for i in 1 2 3; do
2078 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'
2079 done
2080 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2081 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2082
2083 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2084 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2085 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
2086 dnl
2087 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2088 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
2089 dnl
2090 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2091 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
2092 ])
2093
2094 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2095
2096 dnl Modified MPLS pop action.
2097 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2098 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)
2099 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2100 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2101 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2102
2103 for i in 1 2 3; do
2104 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'
2105 done
2106 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2107 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2108
2109 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2110 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2111 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
2112 dnl
2113 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2114 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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
2115 dnl
2116 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2117 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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
2118 ])
2119
2120 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2121
2122 dnl Modified MPLS pop action.
2123 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2124 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)
2125 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2126 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2127 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2128
2129 for i in 1 2 3; do
2130 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'
2131 done
2132 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2133 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2134
2135 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2136 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2137 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
2138 dnl
2139 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2140 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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
2141 dnl
2142 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2143 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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
2144 ])
2145
2146 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2147
2148 dnl Modified MPLS pop action.
2149 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2150 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)
2151 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2152 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2153 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2154
2155 for i in 1 2 3; do
2156 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'
2157 done
2158 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2159 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2160
2161 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2162 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2163 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
2164 dnl
2165 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2166 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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
2167 dnl
2168 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2169 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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
2170 ])
2171
2172 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2173
2174 dnl Modified MPLS pop action.
2175 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2176 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)
2177 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2178 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2179 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2180
2181 for i in 1 2 3; do
2182 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'
2183 done
2184 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2185 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2186
2187 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2188 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2189 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
2190 dnl
2191 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2192 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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
2193 dnl
2194 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2195 tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00: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
2196 ])
2197
2198 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2199
2200 dnl Modified MPLS pop action.
2201 dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2202 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)
2203 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2204
2205 for i in 1 2 3; do
2206 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'
2207 done
2208 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2209 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2210
2211 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2212 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2213 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
2214 dnl
2215 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2216 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
2217 dnl
2218 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
2219 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
2220 ])
2221
2222 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2223
2224 dnl Modified MPLS pop action.
2225 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2226 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)
2227 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2228 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2229 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2230
2231 for i in 1 2 3; do
2232 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'
2233 done
2234 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2235 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2236
2237 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2238 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2239 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
2240 dnl
2241 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2242 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
2243 dnl
2244 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2245 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
2246 ])
2247
2248 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2249
2250 dnl Modified MPLS pop action.
2251 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2252 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)
2253 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2254 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2255 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2256
2257 for i in 1 2 3; do
2258 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'
2259 done
2260 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2261 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2262
2263 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2264 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2265 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
2266 dnl
2267 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2268 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
2269 dnl
2270 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2271 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
2272 ])
2273
2274 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2275
2276 dnl Modified MPLS pop action.
2277 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2278 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)
2279 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2280 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2281 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2282
2283 for i in 1 2 3; do
2284 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'
2285 done
2286 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2287 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2288
2289 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2290 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2291 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
2292 dnl
2293 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2294 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
2295 dnl
2296 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2297 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
2298 ])
2299
2300 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2301
2302 dnl Modified MPLS pop action.
2303 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2304 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)
2305 dnl (label 20, exp 0, [S], ttl 31)
2306 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2307 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2308 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2309
2310 for i in 1 2 3; do
2311 ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 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'
2312 done
2313 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2314 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2315
2316 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2317 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2318 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
2319 dnl
2320 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2321 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
2322 dnl
2323 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2324 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
2325 ])
2326
2327 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2328
2329 dnl Modified MPLS pop action.
2330 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2331 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)
2332 dnl (label 20, exp 0, [S], ttl 31)
2333 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2334 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2335 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2336
2337 for i in 1 2 3; do
2338 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'
2339 done
2340 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2341 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2342
2343 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2344 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2345 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
2346 dnl
2347 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2348 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
2349 dnl
2350 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2351 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
2352 ])
2353
2354 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2355
2356 dnl Modified MPLS pop action.
2357 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2358 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)
2359 dnl (label 20, exp 0, [S], ttl 31)
2360 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2361 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2362 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2363
2364 for i in 1 2 3; do
2365 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'
2366 done
2367 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2368 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2369
2370 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2371 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2372 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
2373 dnl
2374 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2375 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
2376 dnl
2377 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2378 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
2379 ])
2380
2381 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2382
2383 dnl Modified MPLS pop action.
2384 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2385 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)
2386 dnl (label 20, exp 0, [S], ttl 31)
2387 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2388 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2389 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2390
2391 for i in 1 2 3; do
2392 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'
2393 done
2394 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2395 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2396
2397 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2398 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2399 tcp,vlan_tci=0x0000,dl_src=60:66:66:66: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
2400 dnl
2401 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2402 tcp,vlan_tci=0x0000,dl_src=60:66:66:66: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
2403 dnl
2404 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2405 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
2406 ])
2407
2408 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2409
2410 dnl Modified MPLS pop action.
2411 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2412 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)
2413 dnl (label 20, exp 0, [S], ttl 31)
2414 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2415 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2416 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2417
2418 for i in 1 2 3; do
2419 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'
2420 done
2421
2422 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2423 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2424
2425 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2426 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2427 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
2428 dnl
2429 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2430 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
2431 dnl
2432 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2433 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
2434 ])
2435
2436 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2437
2438 dnl Modified MPLS pop action.
2439 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2440 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)
2441 dnl (label 20, exp 0, [S], ttl 31)
2442 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2443 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2444 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2445
2446 for i in 1 2 3; do
2447 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'
2448 done
2449 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2450 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2451
2452 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2453 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2454 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
2455 dnl
2456 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2457 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
2458 dnl
2459 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2460 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
2461 ])
2462
2463 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2464
2465 dnl Modified MPLS pop action.
2466 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2467 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)
2468 dnl (label 20, exp 0, ttl 31)
2469 dnl (label 20, exp 0, [S], ttl 30)
2470 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2471 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2472 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2473
2474 for i in 1 2 3; do
2475 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'
2476 done
2477 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2478 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2479
2480 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2481 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2482 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
2483 dnl
2484 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2485 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
2486 dnl
2487 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2488 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
2489 ])
2490
2491 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2492
2493 dnl Modified MPLS pop action.
2494 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2495 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)
2496 dnl (label 20, exp 0, ttl 31)
2497 dnl (label 20, exp 0, [S], ttl 30)
2498 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2499 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2500 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2501
2502 for i in 1 2 3; do
2503 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'
2504 done
2505 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2506 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2507
2508 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2509 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2510 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
2511 dnl
2512 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2513 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
2514 dnl
2515 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2516 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
2517 ])
2518
2519 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2520
2521 dnl Modified MPLS pop action.
2522 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2523 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)
2524 dnl (label 20, exp 0, ttl 31)
2525 dnl (label 20, exp 0, [S], ttl 30)
2526 dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2527 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2528 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2529
2530 for i in 1 2 3; do
2531 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'
2532 done
2533 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2534 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2535
2536 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2537 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2538 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
2539 dnl
2540 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2541 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
2542 dnl
2543 NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2544 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
2545 ])
2546
2547 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2548
2549 dnl Modified MPLS pop action.
2550 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2551 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)
2552 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2553 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2554 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2555
2556 for i in 1 2 3; do
2557 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'
2558 done
2559 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2560 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2561
2562 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2563 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2564 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
2565 dnl
2566 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2567 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
2568 dnl
2569 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2570 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
2571 ])
2572
2573 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2574
2575 dnl Modified MPLS pop action.
2576 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2577 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)
2578 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2579 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2580 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2581
2582 for i in 1 2 3; do
2583 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'
2584 done
2585 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2586 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2587
2588 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2589 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2590 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
2591 dnl
2592 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2593 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
2594 dnl
2595 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2596 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
2597 ])
2598
2599 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2600
2601 dnl Modified MPLS pop action.
2602 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2603 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)
2604 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2605 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2606 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2607
2608 for i in 1 2 3; do
2609 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'
2610 done
2611 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2612 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2613
2614 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2615 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2616 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
2617 dnl
2618 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2619 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
2620 dnl
2621 NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2622 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
2623 ])
2624
2625 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2626
2627 dnl Modified MPLS pop action.
2628 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2629 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)
2630 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2631 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2632 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2633
2634 for i in 1 2 3; do
2635 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'
2636 done
2637
2638 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2639 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2640
2641 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2642 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2643 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
2644 dnl
2645 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2646 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
2647 dnl
2648 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2649 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
2650 ])
2651
2652 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2653
2654 dnl Modified MPLS pop action.
2655 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2656 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)
2657 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2658 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2659 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2660
2661 for i in 1 2 3; do
2662 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'
2663 done
2664 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2665 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2666
2667 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2668 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2669 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
2670 dnl
2671 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2672 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
2673 dnl
2674 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2675 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
2676 ])
2677
2678 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2679
2680 dnl Modified MPLS pop action.
2681 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2682 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)
2683 dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2684 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2685 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
2686
2687 for i in 1 2 3; do
2688 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'
2689 done
2690
2691 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2692 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2693
2694 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2695 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2696 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
2697 dnl
2698 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2699 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
2700 dnl
2701 NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2702 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
2703 ])
2704
2705 AT_CHECK([ovs-appctl revalidator/purge], [0])
2706 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2707 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
2708 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
2709 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
2710 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
2711 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
2712 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
2713 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
2714 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
2715 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
2716 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
2717 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
2718 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
2719 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
2720 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
2721 cookie=0xd, n_packets=3, n_bytes=138, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
2722 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
2723 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
2724 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
2725 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
2726 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
2727 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
2728 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
2729 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
2730 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
2731 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
2732 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
2733 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2734 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
2735 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
2736 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
2737 cookie=0xd, table=1, n_packets=3, n_bytes=126, arp actions=CONTROLLER:65535
2738 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
2739 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
2740 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
2741 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
2742 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
2743 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
2744 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
2745 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
2746 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
2747 NXST_FLOW reply:
2748 ])
2749
2750 OVS_VSWITCHD_STOP
2751 AT_CLEANUP
2752
2753 AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2754 OVS_VSWITCHD_START([dnl
2755 add-port br0 p1 -- set Interface p1 type=dummy
2756 ])
2757 on_exit 'kill `cat ovs-ofctl.pid`'
2758
2759 AT_CAPTURE_FILE([ofctl_monitor.log])
2760 AT_DATA([flows.txt], [dnl
2761 table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2762 table=1 ip,ip_dscp=8 actions=controller
2763 ])
2764 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2765
2766
2767 dnl Modified MPLS pop action.
2768 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2769 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)
2770 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2771 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2772 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
2773
2774 for i in 1 2 3; do
2775 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'
2776 done
2777 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2778 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2779
2780 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2781 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2782 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
2783 dnl
2784 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2785 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
2786 dnl
2787 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2788 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
2789 ])
2790
2791 AT_CHECK([ovs-appctl revalidator/purge], [0])
2792 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2793 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
2794 table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
2795 OFPST_FLOW reply (OF1.2):
2796 ])
2797
2798 OVS_VSWITCHD_STOP
2799 AT_CLEANUP
2800
2801 AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
2802 OVS_VSWITCHD_START([dnl
2803 add-port br0 p1 -- set Interface p1 type=dummy
2804 ])
2805 on_exit 'kill `cat ovs-ofctl.pid`'
2806
2807 dnl N.B: The first (and only) action that accesses L3 data after the
2808 dnl pop_mpls action is present in write_actions. This exercises recirculation
2809 dnl triggered in write_actions due to a previous action not in write actions.
2810 AT_CAPTURE_FILE([ofctl_monitor.log])
2811 AT_DATA([flows.txt], [dnl
2812 mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
2813 ])
2814 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2815
2816 dnl Modified MPLS pop action.
2817 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2818 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)
2819 dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2820 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2821 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
2822
2823 for i in 1 2 3; do
2824 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'
2825 done
2826 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2827 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2828
2829 AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
2830 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2831 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
2832 dnl
2833 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2834 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
2835 dnl
2836 OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2837 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
2838 ])
2839
2840 AT_CHECK([ovs-appctl revalidator/purge], [0])
2841 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2842 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
2843 OFPST_FLOW reply (OF1.2):
2844 ])
2845
2846 OVS_VSWITCHD_STOP
2847 AT_CLEANUP
2848
2849 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
2850 OVS_VSWITCHD_START([dnl
2851 add-port br0 p1 -- set Interface p1 type=dummy
2852 ])
2853 on_exit 'kill `cat ovs-ofctl.pid`'
2854
2855 AT_CAPTURE_FILE([ofctl_monitor.log])
2856 # A table-miss flow has priority 0 and no match
2857 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2858
2859 dnl Singleton controller action.
2860 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2861
2862 for i in 1 2 3 ; do
2863 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)'
2864 done
2865 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2866 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2867
2868 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2869 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
2870 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
2871 dnl
2872 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
2873 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
2874 dnl
2875 OFPT_PACKET_IN (xid=0x0): total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
2876 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
2877 ])
2878
2879 AT_CHECK([ovs-appctl revalidator/purge], [0])
2880 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2881 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
2882 NXST_FLOW reply:
2883 ])
2884
2885 OVS_VSWITCHD_STOP
2886 AT_CLEANUP
2887
2888
2889 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
2890 OVS_VSWITCHD_START([dnl
2891 add-port br0 p1 -- set Interface p1 type=dummy
2892 ])
2893 on_exit 'kill `cat ovs-ofctl.pid`'
2894
2895 AT_CAPTURE_FILE([ofctl_monitor.log])
2896 # A table-miss flow has priority 0 and no match
2897 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2898
2899 dnl Singleton controller action.
2900 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2901
2902 for i in 1 2 3 ; do
2903 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)'
2904 done
2905 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2906 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2907
2908 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2909
2910 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2911 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2912 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
2913 dnl
2914 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2915 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
2916 dnl
2917 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2918 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
2919 ])
2920
2921 AT_CHECK([ovs-appctl revalidator/purge], [0])
2922 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2923 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
2924 OFPST_FLOW reply (OF1.3):
2925 ])
2926
2927 OVS_VSWITCHD_STOP
2928 AT_CLEANUP
2929
2930 AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
2931 OVS_VSWITCHD_START([dnl
2932 add-port br0 p1 -- set Interface p1 type=dummy
2933 ])
2934 on_exit 'kill `cat ovs-ofctl.pid`'
2935
2936 ovs-appctl time/stop
2937
2938 AT_CAPTURE_FILE([ofctl_monitor.log])
2939 # A table-miss flow has priority 0 and no match
2940 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2941
2942 dnl Singleton controller action.
2943 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2944
2945 # Become slave (OF 1.3), which should disable everything except port status.
2946 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2947
2948 # Ensure that ovs-vswitchd gets a chance to reply before sending another command.
2949 ovs-appctl time/warp 500 100
2950
2951 # Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
2952 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
2953
2954 ovs-appctl time/warp 500 100
2955 for i in 1 2 3 ; do
2956 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)'
2957 done
2958 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2959 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2960
2961 AT_CHECK([ovs-appctl revalidator/purge], [0])
2962 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2963 send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
2964 OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
2965 dnl
2966 send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
2967 master:
2968 PACKET_IN: (off)
2969 PORT_STATUS: (off)
2970 FLOW_REMOVED: (off)
2971 ROLE_STATUS: (off)
2972 TABLE_STATUS: (off)
2973 REQUESTFORWARD: (off)
2974
2975 slave:
2976 PACKET_IN: no_match
2977 PORT_STATUS: (off)
2978 FLOW_REMOVED: (off)
2979 ROLE_STATUS: (off)
2980 TABLE_STATUS: (off)
2981 REQUESTFORWARD: (off)
2982 dnl
2983 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2984 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
2985 dnl
2986 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2987 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
2988 dnl
2989 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
2990 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
2991 ])
2992
2993 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2994
2995 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2996 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
2997 OFPST_FLOW reply (OF1.3):
2998 ])
2999
3000 OVS_VSWITCHD_STOP
3001 AT_CLEANUP
3002
3003
3004 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
3005 OVS_VSWITCHD_START([dnl
3006 add-port br0 p1 -- set Interface p1 type=dummy
3007 ])
3008 on_exit 'kill `cat ovs-ofctl.pid`'
3009
3010 AT_CAPTURE_FILE([ofctl_monitor.log])
3011 # A table-miss flow has priority 0 and no match
3012 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
3013
3014 dnl Singleton controller action.
3015 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3016
3017 for i in 1 2 3 ; do
3018 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)'
3019 done
3020 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
3021 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3022
3023 AT_CHECK([ovs-appctl revalidator/purge], [0])
3024 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3025 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3026 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3027 dnl
3028 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3029 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3030 dnl
3031 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via no_match) data_len=54 (unbuffered)
3032 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3033 ])
3034
3035 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3036
3037 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3038 n_packets=3, n_bytes=162, priority=0 actions=CONTROLLER:65535
3039 OFPST_FLOW reply (OF1.4):
3040 ])
3041
3042 OVS_VSWITCHD_STOP
3043 AT_CLEANUP
3044
3045
3046 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3047 OVS_VSWITCHD_START([dnl
3048 add-port br0 p1 -- set Interface p1 type=dummy
3049 ])
3050 on_exit 'kill `cat ovs-ofctl.pid`'
3051
3052 AT_CAPTURE_FILE([ofctl_monitor.log])
3053 AT_DATA([flows.txt], [dnl
3054 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3055 table=1 actions=output(CONTROLLER),goto_table(2)
3056 table=2 actions=group:1234
3057 ])
3058 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3059 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3060
3061 dnl Singleton controller action.
3062 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3063
3064 for i in 1 2 3 ; do
3065 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)'
3066 done
3067 AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3068 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
3069 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3070
3071 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3072
3073 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3074 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3075 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3076 dnl
3077 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3078 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3079 dnl
3080 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3081 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3082 dnl
3083 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3084 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3085 dnl
3086 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3087 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3088 dnl
3089 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3090 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3091 dnl
3092 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3093 tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:2e7d
3094 dnl
3095 OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3096 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
3097 dnl
3098 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3099 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
3100 dnl
3101 OFPT_PACKET_IN (OF1.3) (xid=0x0): total_len=54 in_port=ANY (via action) data_len=54 (unbuffered)
3102 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
3103 ])
3104
3105 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3106
3107 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3108 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3109 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3110 table=2, n_packets=3, n_bytes=162, actions=group:1234
3111 OFPST_FLOW reply (OF1.3):
3112 ])
3113
3114 OVS_VSWITCHD_STOP
3115 AT_CLEANUP
3116
3117
3118 AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3119 OVS_VSWITCHD_START([dnl
3120 add-port br0 p1 -- set Interface p1 type=dummy
3121 ])
3122 on_exit 'kill `cat ovs-ofctl.pid`'
3123
3124 AT_CAPTURE_FILE([ofctl_monitor.log])
3125 AT_DATA([flows.txt], [dnl
3126 table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
3127 table=1 actions=output(CONTROLLER),goto_table(2)
3128 table=2 actions=group:1234
3129 ])
3130 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
3131 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3132
3133 dnl Singleton controller action.
3134 AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3135
3136 for i in 1 2 3 ; do
3137 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)'
3138 done
3139 AT_CHECK([ovs-ofctl packet-out br0 'in_port=NONE, packet=505400000007101111111111080045000028000000004006f97cc0a80001c0a800020008000a0000000000000000500200002e7d0000, actions=controller'])
3140 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 7])
3141 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3142
3143 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3144
3145 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
3146 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3147 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
3148 dnl
3149 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3150 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
3151 dnl
3152 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3153 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
3154 dnl
3155 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3156 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
3157 dnl
3158 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3159 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
3160 dnl
3161 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3162 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
3163 dnl
3164 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=54 in_port=1 (via action) data_len=54 (unbuffered)
3165 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
3166 dnl
3167 OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=54 in_port=1 (via group) data_len=54 (unbuffered)
3168 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
3169 dnl
3170 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=54 in_port=1 (via action_set) data_len=54 (unbuffered)
3171 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
3172 dnl
3173 OFPT_PACKET_IN (OF1.4) (xid=0x0): total_len=54 in_port=ANY (via packet_out) data_len=54 (unbuffered)
3174 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
3175 ])
3176
3177 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3178
3179 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3180 n_packets=3, n_bytes=162, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3181 table=1, n_packets=3, n_bytes=162, actions=CONTROLLER:65535,goto_table:2
3182 table=2, n_packets=3, n_bytes=162, actions=group:1234
3183 OFPST_FLOW reply (OF1.4):
3184 ])
3185
3186 OVS_VSWITCHD_STOP
3187 AT_CLEANUP
3188
3189
3190 AT_SETUP([ofproto-dpif - ARP modification slow-path])
3191 OVS_VSWITCHD_START
3192 add_of_ports br0 1 2
3193
3194 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3195 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'
3196
3197 # Input some packets that should follow the arp modification slow-path.
3198 for i in 1 2 3; do
3199 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)'
3200 done
3201 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3202
3203 # Check the packets that were output.
3204 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
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.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
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=00:00:00:00:00:00
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.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
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.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
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=00:00:00:00:00:00
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.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
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.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
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=00:00:00:00:00:00
3213 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
3214 ])
3215
3216 OVS_VSWITCHD_STOP
3217 AT_CLEANUP
3218
3219 AT_SETUP([ofproto-dpif - VLAN handling])
3220 OVS_VSWITCHD_START(
3221 [set Bridge br0 fail-mode=standalone -- \
3222 add-port br0 p1 trunks=10,12 -- \
3223 add-port br0 p2 tag=10 -- \
3224 add-port br0 p3 tag=12 \
3225 other-config:priority-tags=true -- \
3226 add-port br0 p4 tag=12 -- \
3227 add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
3228 add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
3229 add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
3230 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
3231 other-config:priority-tags=true -- \
3232 add-port br0 p9 vlan_mode=dot1q-tunnel tag=10 other-config:qinq-ethtype=802.1q -- \
3233 add-port br0 p10 vlan_mode=dot1q-tunnel tag=10 cvlans=10,12 other-config:qinq-ethtype=802.1q -- \
3234 add-port br0 p11 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q -- \
3235 add-port br0 p12 vlan_mode=dot1q-tunnel tag=12 other-config:qinq-ethtype=802.1q \
3236 other-config:priority-tags=true -- \
3237 set Interface p1 type=dummy -- \
3238 set Interface p2 type=dummy -- \
3239 set Interface p3 type=dummy -- \
3240 set Interface p4 type=dummy -- \
3241 set Interface p5 type=dummy -- \
3242 set Interface p6 type=dummy -- \
3243 set Interface p7 type=dummy -- \
3244 set Interface p8 type=dummy -- \
3245 set Interface p9 type=dummy -- \
3246 set Interface p10 type=dummy -- \
3247 set Interface p11 type=dummy -- \
3248 set Interface p12 type=dummy --])
3249
3250 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3251 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
3252 dnl actions.
3253 for tuple in \
3254 "100 none 0 drop" \
3255 "100 0 0 drop" \
3256 "100 0 1 drop" \
3257 "100 10 0 1,5,6,7,8,pop_vlan,2,9" \
3258 "100 10 1 1,5,6,7,8,pop_vlan,2,9" \
3259 "100 11 0 5,7" \
3260 "100 11 1 5,7" \
3261 "100 12 0 1,5,6,pop_vlan,3,4,7,8,11,12" \
3262 "100 12 1 1,5,6,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3263 "1 none 0 drop" \
3264 "1 0 0 drop" \
3265 "1 0 1 drop" \
3266 "1 10 0 5,6,7,8,100,pop_vlan,2,9" \
3267 "1 10 1 5,6,7,8,100,pop_vlan,2,9" \
3268 "1 11 0 drop" \
3269 "1 11 1 drop" \
3270 "1 12 0 5,6,100,pop_vlan,3,4,7,8,11,12" \
3271 "1 12 1 5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3272 "2 none 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3273 "2 0 0 pop_vlan,9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3274 "2 0 1 pop_vlan,9,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
3275 "2 10 0 drop" \
3276 "2 10 1 drop" \
3277 "2 11 0 drop" \
3278 "2 11 1 drop" \
3279 "2 12 0 drop" \
3280 "2 12 1 drop" \
3281 "3 none 0 4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3282 "3 0 0 pop_vlan,4,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3283 "3 0 1 8,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3284 "3 10 0 drop" \
3285 "3 10 1 drop" \
3286 "3 11 0 drop" \
3287 "3 11 1 drop" \
3288 "3 12 0 drop" \
3289 "3 12 1 drop" \
3290 "4 none 0 3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3291 "4 0 0 pop_vlan,3,7,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3292 "4 0 1 3,8,12,pop_vlan,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3293 "4 10 0 drop" \
3294 "4 10 1 drop" \
3295 "4 11 0 drop" \
3296 "4 11 1 drop" \
3297 "4 12 0 drop" \
3298 "4 12 1 drop" \
3299 "5 none 0 2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3300 "5 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3301 "5 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3302 "5 10 0 1,6,7,8,100,pop_vlan,2,9" \
3303 "5 10 1 1,6,7,8,100,pop_vlan,2,9" \
3304 "5 11 0 7,100" \
3305 "5 11 1 7,100" \
3306 "5 12 0 1,6,100,pop_vlan,3,4,7,8,11,12" \
3307 "5 12 1 1,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3308 "6 none 0 2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3309 "6 0 0 pop_vlan,2,9,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3310 "6 0 1 pop_vlan,2,9,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3311 "6 10 0 1,5,7,8,100,pop_vlan,2,9" \
3312 "6 10 1 1,5,7,8,100,pop_vlan,2,9" \
3313 "6 11 0 drop" \
3314 "6 11 1 drop" \
3315 "6 12 0 1,5,100,pop_vlan,3,4,7,8,11,12" \
3316 "6 12 1 1,5,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,8,12" \
3317 "7 none 0 3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3318 "7 0 0 pop_vlan,3,4,8,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3319 "7 0 1 3,8,12,pop_vlan,4,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3320 "7 10 0 1,5,6,8,100,pop_vlan,2,9" \
3321 "7 10 1 1,5,6,8,100,pop_vlan,2,9" \
3322 "7 11 0 5,100" \
3323 "7 11 1 5,100" \
3324 "7 12 0 1,5,6,100,pop_vlan,3,4,8,11,12" \
3325 "7 12 1 1,5,6,100,pop_vlan,4,11,push_vlan(vid=0,pcp=1),3,8,12" \
3326 "8 none 0 3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3327 "8 0 0 pop_vlan,3,4,7,11,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3328 "8 0 1 3,12,pop_vlan,4,7,11,push_vlan(vid=12,pcp=1),1,5,6,100" \
3329 "8 10 0 1,5,6,7,100,pop_vlan,2,9" \
3330 "8 10 1 1,5,6,7,100,pop_vlan,2,9" \
3331 "8 11 0 drop" \
3332 "8 11 1 drop" \
3333 "8 12 0 1,5,6,100,pop_vlan,3,4,7,11,12" \
3334 "8 12 1 1,5,6,100,pop_vlan,4,7,11,push_vlan(vid=0,pcp=1),3,12" \
3335 "9 none 0 2,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3336 "9 10 0 10,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3337 "9 11 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3338 "10 none 0 drop" \
3339 "10 0 0 drop" \
3340 "10 11 0 drop" \
3341 "10 12 0 9,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3342 "11 10 0 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100" \
3343 "11 10 1 7,8,12,push_vlan(vid=12,pcp=0),1,5,6,100"
3344 do
3345 set $tuple
3346 in_port=$1
3347 vlan=$2
3348 pcp=$3
3349 expected=$4
3350
3351 if test $vlan = none; then
3352 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
3353 else
3354 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))"
3355 fi
3356
3357 echo "----------------------------------------------------------------------"
3358 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3359
3360 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3361 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
3362
3363 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
3364 mv stdout expout
3365 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
3366 done
3367
3368 OVS_VSWITCHD_STOP
3369 AT_CLEANUP
3370
3371 AT_SETUP([ofproto-dpif - VLAN depth limit])
3372 OVS_VSWITCHD_START([dnl
3373 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3374 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
3375 add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3
3376 ])
3377
3378 AT_DATA([flows.txt], [dnl
3379 table=0 in_port=1,eth_type=0x8100,vlan_tci=0x0010/0x01ff actions=output:2
3380 table=0 in_port=1,eth_type=0xabcd,vlan_tci=0x0010/0x01ff actions=output:3
3381 ])
3382 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3383 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), \
3384 encap(eth_type(0x8100),vlan(vid=17,pcp=0),encap(eth_type(0xabcd)))"
3385
3386 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3387 AT_CHECK([tail -1 stdout], [0],
3388 [Datapath actions: 2
3389 ])
3390
3391 AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3392 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3393 AT_CHECK([tail -1 stdout], [0],
3394 [Datapath actions: 3
3395 ])
3396
3397 OVS_VSWITCHD_STOP
3398 AT_CLEANUP
3399
3400 AT_SETUP([ofproto-dpif - Multi-VLAN actions])
3401 OVS_VSWITCHD_START([dnl
3402 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
3403 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2
3404 ])
3405 AT_CHECK([ovs-vsctl set Open_vswitch `ovs-vsctl show | head -n1` other_config:vlan-limit=0])
3406
3407 AT_DATA([flows.txt], [dnl
3408 table=0 in_port=1,vlan_tci=0x1100/0x1fff actions=pop_vlan,output:2
3409 table=0 in_port=1,vlan_tci=0x1101/0x1fff actions=push_vlan:0x8100,set_field:0x1201/0x1fff->vlan_tci,output:2
3410 table=0 in_port=1,vlan_tci=0x1102/0x1fff actions=push_vlan:0x88a8,set_field:0x1202/0x1fff->vlan_tci,output:2
3411 table=0 in_port=1,vlan_tci=0x1103/0x1fff actions=set_field:0x1203/0x1fff->vlan_tci,output:2
3412 table=0 in_port=1,vlan_tci=0x1104/0x1fff actions=pop_vlan,goto_table:1
3413 table=1 vlan_tci=0 actions=output:2
3414 table=1 vlan_tci=0x1300/0x1fff actions=pop_vlan,output:2
3415 table=1 vlan_tci=0x1301/0x1fff actions=push_vlan:0x88a8,set_field:0x1401/0x1fff->vlan_tci,output:2
3416 table=1 vlan_tci=0x1302/0x1fff actions=set_field:0x1402/0x1fff->vlan_tci,output:2
3417 ])
3418
3419 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
3420
3421 check_act() {
3422 psd_hdr="in_port(1),eth(src=00:11:22:33:44:55,dst=00:22:44:66:88:00),"
3423 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$psd_hdr$1"], [0], [stdout])
3424 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $2
3425 ])
3426 }
3427
3428 check_act "eth_type(0x8100),vlan(vid=0x0100,pcp=0),encap(eth_type(0xabcd))" \
3429 "pop_vlan,2"
3430
3431 check_act "eth_type(0x8100),vlan(vid=0x0101,pcp=0),encap(eth_type(0xabcd))" \
3432 "push_vlan(vid=513,pcp=0),2"
3433
3434 check_act "eth_type(0x8100),vlan(vid=0x0102,pcp=0),encap(eth_type(0xabcd))" \
3435 "push_vlan(tpid=0x88a8,vid=514,pcp=0),2"
3436
3437 check_act "eth_type(0x8100),vlan(vid=0x0103,pcp=0),encap(eth_type(0xabcd))" \
3438 "pop_vlan,push_vlan(vid=515,pcp=0),2"
3439
3440 check_act "eth_type(0x8100),vlan(vid=0x0104,pcp=0),encap(eth_type(0xabcd))" \
3441 "pop_vlan,2"
3442
3443 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3444 vlan(vid=0x0300,pcp=0),encap(eth_type(0xabcd)))" "pop_vlan,pop_vlan,2"
3445
3446 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3447 vlan(vid=0x0301,pcp=0),encap(eth_type(0xabcd)))" \
3448 "pop_vlan,push_vlan(tpid=0x88a8,vid=1025,pcp=0),2"
3449
3450 check_act "eth_type(0x88a8),vlan(vid=0x0104,pcp=0),encap(eth_type(0x8100),\
3451 vlan(vid=0x0302,pcp=0),encap(eth_type(0xabcd)))" \
3452 "pop_vlan,pop_vlan,push_vlan(vid=1026,pcp=0),2"
3453
3454 OVS_VSWITCHD_STOP
3455 AT_CLEANUP
3456
3457 AT_SETUP([ofproto-dpif - MPLS handling])
3458 OVS_VSWITCHD_START([dnl
3459 add-port br0 p1 -- set Interface p1 type=dummy
3460 ])
3461 on_exit 'kill `cat ovs-ofctl.pid`'
3462
3463 AT_CAPTURE_FILE([ofctl_monitor.log])
3464 AT_DATA([flows.txt], [dnl
3465 dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
3466 dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
3467 dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
3468 ])
3469 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3470
3471 dnl In this test, we push an MPLS tag to an ethernet packet.
3472 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3473
3474 for i in 1 2 3; do
3475 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)'
3476 done
3477 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3478 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3479
3480 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3481 OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3482 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
3483 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3484 00000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3485 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3486 00000030 00 00 50 00 00 00 2e 91-00 00
3487 dnl
3488 OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3489 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
3490 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3491 00000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3492 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3493 00000030 00 00 50 00 00 00 2e 91-00 00
3494 dnl
3495 OFPT_PACKET_IN (OF1.2): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
3496 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
3497 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3498 00000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3499 00000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3500 00000030 00 00 50 00 00 00 2e 91-00 00
3501 ])
3502
3503 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3504 dnl copied exactly, except for the BOS bit.
3505 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3506
3507 for i in 1 2 3; do
3508 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)'
3509 done
3510 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3511 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3512
3513 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3514 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3515 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
3516 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3517 00000010 a0 40 00 00 a1 40
3518 dnl
3519 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3520 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
3521 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3522 00000010 a0 40 00 00 a1 40
3523 dnl
3524 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3525 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
3526 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3527 00000010 a0 40 00 00 a1 40
3528 ])
3529
3530 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3531 dnl copied exactly, except for the BOS bit. The ethertype should be updated
3532 dnl to the MPLS ethertype of the MPLS push action which differs to that
3533 dnl of the input packet.
3534 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3535
3536 for i in 1 2 3; do
3537 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)'
3538 done
3539 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3540 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3541
3542 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3543 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3544 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
3545 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3546 00000010 a0 40 00 00 a1 40
3547 dnl
3548 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3549 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
3550 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3551 00000010 a0 40 00 00 a1 40
3552 dnl
3553 OFPT_PACKET_IN (OF1.2): total_len=22 in_port=1 (via action) data_len=22 (unbuffered)
3554 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
3555 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3556 00000010 a0 40 00 00 a1 40
3557 ])
3558
3559 OVS_VSWITCHD_STOP
3560 AT_CLEANUP
3561
3562 AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3563 OVS_VSWITCHD_START([dnl
3564 add-port br0 p1 -- set Interface p1 type=dummy
3565 ])
3566 on_exit 'kill `cat ovs-ofctl.pid`'
3567
3568 AT_CAPTURE_FILE([ofctl_monitor.log])
3569 AT_DATA([flows.txt], [dnl
3570 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
3571 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
3572 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
3573 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
3574 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
3575 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
3576 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
3577 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
3578 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
3579 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
3580 ])
3581 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3582
3583 dnl Modified MPLS controller action.
3584 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3585 dnl both of these in the final flow
3586 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3587
3588 for i in 1 2 3; do
3589 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54: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)'
3590 done
3591 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3592 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3593
3594 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3595 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3596 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
3597 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3598 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3599 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3600 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3601 dnl
3602 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3603 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
3604 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3605 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3606 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3607 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3608 dnl
3609 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3610 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
3611 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3612 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3613 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3614 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3615 ])
3616
3617 dnl Modified MPLS controller action.
3618 dnl In this test, the input packet is vlan-tagged, which should be kept as
3619 dnl inner vlan.
3620 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3621
3622 for i in 1 2 3; do
3623 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54: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))'
3624 done
3625 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3626 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3627
3628 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3629 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3630 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
3631 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3632 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3633 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3634 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3635 00000040 00 00
3636 dnl
3637 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3638 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
3639 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3640 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3641 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3642 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3643 00000040 00 00
3644 dnl
3645 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3646 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
3647 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3648 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3649 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3650 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3651 00000040 00 00
3652 ])
3653
3654 dnl Modified MPLS controller action.
3655 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3656 dnl both of these in the final flow
3657 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3658
3659 for i in 1 2 3; do
3660 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)'
3661 done
3662 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3663 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3664
3665 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3666 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3667 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
3668 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3669 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3670 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3671 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3672 dnl
3673 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3674 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
3675 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3676 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3677 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3678 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3679 dnl
3680 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3681 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
3682 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3683 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3684 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3685 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3686 ])
3687
3688 dnl Modified MPLS controller action.
3689 dnl In this test, the input packet is vlan-tagged, which should be kept as
3690 dnl inner vlan.
3691 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3692
3693 for i in 1 2 3; do
3694 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))'
3695 done
3696 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3697 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3698
3699 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3700 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3701 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
3702 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3703 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3704 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3705 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3706 00000040 00 00
3707 dnl
3708 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3709 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
3710 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3711 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3712 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3713 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3714 00000040 00 00
3715 dnl
3716 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3717 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
3718 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3719 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3720 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3721 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3722 00000040 00 00
3723 ])
3724
3725 dnl Modified MPLS controller action.
3726 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3727 dnl actions are reordered, so we see both of these in the final flow.
3728 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3729
3730 for i in 1 2 3; do
3731 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)'
3732 done
3733 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3734 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3735
3736 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3737 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3738 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
3739 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3740 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3741 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3742 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3743 dnl
3744 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3745 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
3746 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3747 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3748 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3749 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3750 dnl
3751 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3752 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
3753 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3754 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3755 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3756 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3757 ])
3758
3759 dnl Modified MPLS controller action.
3760 dnl In this test, the input packet is vlan-tagged, which should be kept as
3761 dnl inner vlan.
3762 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3763
3764 for i in 1 2 3; do
3765 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))'
3766 done
3767 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3768 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3769
3770 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3771 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3772 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
3773 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3774 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3775 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3776 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3777 00000040 00 00
3778 dnl
3779 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3780 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
3781 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3782 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3783 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3784 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3785 00000040 00 00
3786 dnl
3787 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3788 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
3789 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3790 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3791 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3792 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3793 00000040 00 00
3794 ])
3795
3796 dnl Modified MPLS controller action.
3797 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3798 dnl actions are reordered, so we see both of these in the final flow.
3799 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3800
3801 for i in 1 2 3; do
3802 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)'
3803 done
3804 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3805 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3806
3807 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3808 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3809 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
3810 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3811 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3812 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3813 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3814 dnl
3815 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3816 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
3817 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3818 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3819 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3820 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3821 dnl
3822 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3823 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
3824 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3825 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3826 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3827 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3828 ])
3829
3830 dnl Modified MPLS controller action.
3831 dnl In this test, the input packet is vlan-tagged, which should be kept as
3832 dnl inner vlan.
3833 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
3834
3835 for i in 1 2 3; do
3836 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))'
3837 done
3838 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3839 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3840
3841 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3842 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3843 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
3844 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3845 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3846 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3847 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3848 00000040 00 00
3849 dnl
3850 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3851 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
3852 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3853 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3854 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3855 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3856 00000040 00 00
3857 dnl
3858 OFPT_PACKET_IN (OF1.2): total_len=66 in_port=1 (via action) data_len=66 (unbuffered)
3859 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
3860 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3861 00000010 81 00 e0 58 88 47 00 00-a1 40 45 00 00 28 00 00
3862 00000020 00 00 40 06 f9 7c c0 a8-00 01 c0 a8 00 02 00 00
3863 00000030 00 00 00 00 00 00 00 00-00 00 50 00 00 00 2e 91
3864 00000040 00 00
3865 ])
3866
3867 dnl Modified MPLS controller action.
3868 dnl In this test, the input packet is vlan-tagged, which should be kept as
3869 dnl inner vlan.
3870 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3871
3872 for i in 1 2 3; do
3873 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))'
3874 done
3875 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3876 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3877
3878 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3879 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3880 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
3881 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3882 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3883 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3884 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3885 dnl
3886 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3887 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
3888 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3889 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3890 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3891 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3892 dnl
3893 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3894 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
3895 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3896 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3897 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3898 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3899 ])
3900
3901 dnl Modified MPLS controller action.
3902 dnl In this test, the input packet is vlan-tagged, which should be modified
3903 dnl before we push MPLS and VLAN tags.
3904 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
3905
3906 for i in 1 2 3; do
3907 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))'
3908 done
3909 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3910 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3911
3912 AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
3913 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3914 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
3915 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3916 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3917 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3918 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3919 dnl
3920 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3921 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
3922 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3923 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3924 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3925 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3926 dnl
3927 OFPT_PACKET_IN (OF1.2): total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
3928 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
3929 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3930 00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3931 00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3932 00000030 00 00 00 00 00 00 50 00-00 00 2e 91 00 00
3933 ])
3934
3935 AT_CHECK([ovs-appctl revalidator/purge], [0])
3936 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3937 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
3938 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
3939 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
3940 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
3941 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
3942 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
3943 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
3944 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
3945 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
3946 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
3947 OFPST_FLOW reply (OF1.2):
3948 ])
3949
3950 OVS_VSWITCHD_STOP
3951 AT_CLEANUP
3952
3953 AT_SETUP([ofproto-dpif - fragment handling - trace])
3954 OVS_VSWITCHD_START
3955 add_of_ports br0 1 2 3 4 5 6 90
3956 AT_DATA([flows.txt], [dnl
3957 priority=75 tcp ip_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
3958 priority=75 tcp ip_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
3959 priority=50 tcp ip_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
3960 priority=50 tcp ip_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
3961 priority=50 tcp ip_frag=later actions=output:6
3962 ])
3963 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3964
3965 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"
3966 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3967 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3968 later_flow="$base_flow,frag=later)"
3969
3970 # mode no first later
3971 for tuple in \
3972 'normal 1 5 6' \
3973 'drop 1 drop drop' \
3974 'nx-match 1 2 6'
3975 do
3976 set $tuple
3977 mode=$1
3978 no=$2
3979 first=$3
3980 later=$4
3981
3982 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3983 for type in no first later; do
3984 eval flow=\$${type}_flow exp_output=\$$type
3985 printf "\n%s\n" "----$mode $type-----"
3986 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3987 : > expout
3988 if test $mode = drop && test $type != no; then
3989 echo ' 0. Packets are IP fragments and the fragment handling mode is "drop".' >> expout
3990 echo "Datapath actions: $exp_output" >> expout
3991 elif test $type = later; then
3992 echo "Datapath actions: $exp_output" >> expout
3993 else
3994 echo "Datapath actions: set(tcp(src=80,dst=80)),$exp_output" >> expout
3995 fi
3996 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
3997 done
3998 done
3999 OVS_VSWITCHD_STOP
4000 AT_CLEANUP
4001
4002 AT_SETUP([ofproto-dpif - fragment handling - upcall])
4003 OVS_VSWITCHD_START
4004 add_of_ports br0 1 2 3 4 5 6 90
4005 AT_DATA([flows.txt], [dnl
4006 priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
4007 priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
4008 priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
4009 priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
4010 priority=50 tcp ip_frag=later actions=output:6
4011 ])
4012 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
4013
4014 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"
4015 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
4016 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
4017 later_flow="$base_flow,frag=later)"
4018
4019 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4020
4021 mode=normal
4022
4023 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4024 for type in no first later; do
4025 eval flow=\$${type}_flow
4026 printf "\n%s\n" "----$mode $type-----"
4027
4028 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4029 done
4030
4031 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4032 flow-dump from non-dpdk interfaces:
4033 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4034 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),5
4035 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4036 ])
4037
4038 mode=drop
4039
4040 AT_CHECK([ovs-appctl revalidator/purge], [0])
4041 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4042 for type in no first later; do
4043 eval flow=\$${type}_flow
4044 printf "\n%s\n" "----$mode $type-----"
4045
4046 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4047 done
4048
4049 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4050 flow-dump from non-dpdk interfaces:
4051 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4052 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
4053 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
4054 ])
4055
4056 mode=nx-match
4057
4058 AT_CHECK([ovs-appctl revalidator/purge], [0])
4059 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4060 for type in no first later; do
4061 eval flow=\$${type}_flow
4062 printf "\n%s\n" "----$mode $type-----"
4063
4064 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
4065 done
4066
4067 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
4068 flow-dump from non-dpdk interfaces:
4069 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
4070 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),2
4071 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
4072 ])
4073
4074 OVS_VSWITCHD_STOP
4075 AT_CLEANUP
4076
4077 AT_SETUP([ofproto-dpif - fragment handling - actions])
4078 OVS_VSWITCHD_START
4079 add_of_ports br0 1 2 3 4 5 6 90
4080
4081 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])
4082 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4083 source field tcp_dst lacks correct prerequisites
4084 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4085 ])
4086
4087 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])
4088 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4089 destination field tcp_src lacks correct prerequisites
4090 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4091 ])
4092
4093 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
4094 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4095 set_field udp_src lacks correct prerequisites
4096 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4097 ])
4098
4099 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
4100 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4101 set_field udp_dst lacks correct prerequisites
4102 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4103 ])
4104
4105 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
4106 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4107 set_field sctp_src lacks correct prerequisites
4108 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4109 ])
4110
4111 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
4112 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4113 set_field sctp_dst lacks correct prerequisites
4114 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4115 ])
4116
4117 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])
4118 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
4119 source field tcp_dst lacks correct prerequisites
4120 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
4121 ])
4122
4123 AT_DATA([flows.txt], [dnl
4124 priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
4125 ])
4126 AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
4127
4128 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
4129
4130 mode=normal
4131
4132 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4133 for frag in 4000 6000 6008 4010; do
4134 printf "\n%s\n" "----$mode $frag-----"
4135
4136 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"])
4137 done
4138
4139 dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
4140 dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
4141 dnl OVS-2.5, the wildcards and set_field mask are shared internally.
4142 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4143 flow-dump from non-dpdk interfaces:
4144 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4145 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4146 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
4147 ])
4148
4149 AT_CHECK([ovs-appctl revalidator/purge], [0])
4150 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4151 for frag in 4000 6000 6008 4010; do
4152 printf "\n%s\n" "----$mode $frag truncated transport header -----"
4153
4154 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
4155 done
4156
4157 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4158 flow-dump from non-dpdk interfaces:
4159 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4160 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4161 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:38, used:0.001s, actions:1
4162 ])
4163
4164 AT_CHECK([ovs-appctl revalidator/purge], [0])
4165 AT_CHECK([ovs-ofctl set-frags br0 $mode])
4166 for frag in 4000 6000 6001 4002; do
4167 printf "\n%s\n" "----$mode $frag missing transport header-----"
4168
4169 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
4170 done
4171
4172 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
4173 flow-dump from non-dpdk interfaces:
4174 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4175 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
4176 recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:34, used:0.001s, actions:1
4177 ])
4178
4179 OVS_VSWITCHD_STOP
4180 AT_CLEANUP
4181
4182 AT_SETUP([ofproto-dpif - exit])
4183 OVS_VSWITCHD_START
4184 add_of_ports br0 1 2 3 10 11 12 13 14
4185 AT_DATA([flows.txt], [dnl
4186 in_port=1 actions=output:10,exit,output:11
4187 in_port=2 actions=output:12,resubmit:1,output:12
4188 in_port=3 actions=output:13,resubmit:2,output:14
4189 ])
4190 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4191 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])
4192 AT_CHECK([tail -1 stdout], [0],
4193 [Datapath actions: 10
4194 ])
4195 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])
4196 AT_CHECK([tail -1 stdout], [0],
4197 [Datapath actions: 12,10
4198 ])
4199 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])
4200 AT_CHECK([tail -1 stdout], [0],
4201 [Datapath actions: 13,12,10
4202 ])
4203 OVS_VSWITCHD_STOP
4204 AT_CLEANUP
4205
4206
4207 AT_SETUP([ofproto-dpif - mirroring, select_all])
4208 AT_KEYWORDS([mirror mirrors mirroring])
4209 OVS_VSWITCHD_START
4210 add_of_ports br0 1 2 3
4211 ovs-vsctl \
4212 set Bridge br0 mirrors=@m --\
4213 --id=@p3 get Port p3 --\
4214 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4215
4216 AT_DATA([flows.txt], [dnl
4217 in_port=1 actions=output:2
4218 in_port=2 actions=output:1
4219 ])
4220 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4221
4222 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)"
4223 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4224 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4225 [Datapath actions: 3,2
4226 ])
4227
4228 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)"
4229 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4230 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4231 [Datapath actions: 3,1
4232 ])
4233
4234 OVS_VSWITCHD_STOP
4235 AT_CLEANUP
4236
4237
4238 AT_SETUP([ofproto-dpif - mirroring, select_src])
4239 AT_KEYWORDS([mirror mirrors mirroring])
4240 OVS_VSWITCHD_START
4241 add_of_ports br0 1 2 3
4242 ovs-vsctl \
4243 set Bridge br0 mirrors=@m --\
4244 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4245 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
4246
4247 AT_DATA([flows.txt], [dnl
4248 in_port=1 actions=output:2
4249 in_port=2 actions=output:1
4250 ])
4251 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4252
4253 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)"
4254 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4255 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4256 [Datapath actions: 3,2
4257 ])
4258
4259 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)"
4260 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4261 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4262 [Datapath actions: 1
4263 ])
4264 OVS_VSWITCHD_STOP
4265 AT_CLEANUP
4266
4267 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
4268 AT_KEYWORDS([mirror mirrors mirroring])
4269 OVS_VSWITCHD_START
4270 add_of_ports br0 1 2
4271 ovs-vsctl \
4272 set Bridge br0 mirrors=@m --\
4273 --id=@p2 get Port p2 --\
4274 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
4275
4276 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4277
4278 # "in_port" defaults to OFPP_NONE if it's not specified.
4279 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"
4280 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4281 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4282 [Datapath actions: 1,2
4283 ])
4284
4285 OVS_VSWITCHD_STOP
4286 AT_CLEANUP
4287
4288
4289 AT_SETUP([ofproto-dpif - mirroring, select_dst])
4290 AT_KEYWORDS([mirror mirrors mirroring])
4291 OVS_VSWITCHD_START
4292 add_of_ports br0 1 2 3
4293 ovs-vsctl \
4294 set Bridge br0 mirrors=@m --\
4295 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4296 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
4297
4298 AT_DATA([flows.txt], [dnl
4299 in_port=1 actions=output:2
4300 in_port=2 actions=output:1
4301 ])
4302 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4303
4304 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)"
4305 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4306 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4307 [Datapath actions: 2,3
4308 ])
4309
4310 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)"
4311 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4312 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4313 [Datapath actions: 1
4314 ])
4315
4316 OVS_VSWITCHD_STOP
4317 AT_CLEANUP
4318
4319
4320 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
4321 AT_KEYWORDS([mirror mirrors mirroring])
4322 OVS_VSWITCHD_START
4323 add_of_ports br0 1 2 3
4324 ovs-vsctl \
4325 set Bridge br0 mirrors=@m --\
4326 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4327 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
4328
4329 AT_DATA([flows.txt], [dnl
4330 in_port=1, actions=output:2
4331 ])
4332 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4333
4334 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)"
4335 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4336 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4337 [Datapath actions: 2
4338 ])
4339
4340 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))"
4341 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4342 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4343 [Datapath actions: 2
4344 ])
4345
4346 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))"
4347 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4348 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4349 [Datapath actions: 3,2
4350 ])
4351
4352 OVS_VSWITCHD_STOP
4353 AT_CLEANUP
4354
4355
4356 AT_SETUP([ofproto-dpif - mirroring, output_port])
4357 AT_KEYWORDS([mirror mirrors mirroring])
4358 OVS_VSWITCHD_START
4359 add_of_ports br0 1 2 3
4360 ovs-vsctl \
4361 set Bridge br0 mirrors=@m --\
4362 --id=@p3 get Port p3 --\
4363 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4364
4365 AT_DATA([flows.txt], [dnl
4366 in_port=1 actions=mod_vlan_vid:17,output:2
4367 in_port=2 actions=output:1
4368 ])
4369 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4370
4371 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)"
4372 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4373 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4374 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
4375 ])
4376
4377 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)"
4378 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4379 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4380 [Datapath actions: 3,1
4381 ])
4382
4383 OVS_VSWITCHD_STOP
4384 AT_CLEANUP
4385
4386 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
4387 AT_KEYWORDS([mirror mirrors mirroring])
4388 OVS_VSWITCHD_START
4389 add_of_ports br0 1 2
4390 ovs-vsctl \
4391 set Bridge br0 mirrors=@m --\
4392 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
4393
4394 AT_DATA([flows.txt], [dnl
4395 in_port=1 actions=output:2
4396 in_port=2 actions=mod_vlan_vid:17,output:1
4397 ])
4398 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4399
4400 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)"
4401 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4402 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4403
4404 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
4405 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4406 mv stdout expout
4407 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4408
4409 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)"
4410 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4411 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4412
4413 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
4414 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4415 mv stdout expout
4416 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4417
4418 OVS_VSWITCHD_STOP
4419 AT_CLEANUP
4420
4421 # This verifies that we don't get duplicate mirroring when mirror_packet()
4422 # might be invoked recursively, as a check against regression.
4423 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
4424 AT_KEYWORDS([mirror mirrors mirroring])
4425 OVS_VSWITCHD_START
4426 add_of_ports br0 1 2 3
4427 ovs-vsctl \
4428 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4429 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
4430 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
4431 -- set Port br0 tag=0 \
4432 -- set Port p1 tag=0 \
4433 -- set Port p2 tag=500 \
4434 -- set Port p3 tag=501
4435
4436 flow='in_port=1'
4437 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4438 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4439 s/,/\
4440 /g' | sort], [0], [100
4441 2
4442 3
4443 ])
4444
4445 OVS_VSWITCHD_STOP
4446 AT_CLEANUP
4447
4448 # This test verifies that mirror state is preserved across recirculation.
4449 #
4450 # Otherwise, post-recirculation the ingress and the output to port 4
4451 # would cause the packet to be mirrored to port 3 a second time.
4452 AT_SETUP([ofproto-dpif - mirroring with recirculation])
4453 AT_KEYWORDS([mirror mirrors mirroring])
4454 OVS_VSWITCHD_START
4455 add_of_ports br0 1 2 3 4
4456 ovs-vsctl \
4457 set Bridge br0 mirrors=@m --\
4458 --id=@p3 get Port p3 --\
4459 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4460
4461 AT_DATA([flows.txt], [dnl
4462 in_port=1 actions=2,debug_recirc,4
4463 ])
4464 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4465
4466 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)"
4467 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4468 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4469 ])
4470 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4471 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4472 ])
4473
4474 OVS_VSWITCHD_STOP
4475 AT_CLEANUP
4476
4477 # Tests below verify the snaplen support for mirroring
4478 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen])
4479 AT_KEYWORDS([mirror mirrors mirroring])
4480 OVS_VSWITCHD_START
4481 add_of_ports br0 1 2 3
4482 ovs-vsctl \
4483 set Bridge br0 mirrors=@m --\
4484 --id=@p3 get Port p3 --\
4485 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4486
4487 AT_DATA([flows.txt], [dnl
4488 in_port=1 actions=output:2
4489 in_port=2 actions=output:1
4490 ])
4491 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4492
4493 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)"
4494 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4495 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4496 [Datapath actions: trunc(100),3,2
4497 ])
4498
4499 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)"
4500 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4501 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4502 [Datapath actions: trunc(100),3,1
4503 ])
4504
4505 OVS_VSWITCHD_STOP
4506 AT_CLEANUP
4507
4508 AT_SETUP([ofproto-dpif - mirroring, select_all with snaplen and reset snaplen])
4509 AT_KEYWORDS([mirror mirrors mirroring])
4510 OVS_VSWITCHD_START
4511 add_of_ports br0 1 2 3
4512 ovs-vsctl \
4513 set Bridge br0 mirrors=@m --\
4514 --id=@p3 get Port p3 --\
4515 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4516
4517 AT_DATA([flows.txt], [dnl
4518 in_port=1 actions=output:2
4519 in_port=2 actions=output:1
4520 ])
4521 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4522
4523 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)"
4524 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4525 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4526 [Datapath actions: trunc(100),3,2
4527 ])
4528
4529 ovs-vsctl set mirror mymirror snaplen=77
4530
4531 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)"
4532 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4533 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4534 [Datapath actions: trunc(77),3,1
4535 ])
4536
4537 ovs-vsctl set mirror mymirror snaplen=65535
4538
4539 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)"
4540 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4541 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4542 [Datapath actions: 3,1
4543 ])
4544
4545 OVS_VSWITCHD_STOP
4546 AT_CLEANUP
4547
4548 AT_SETUP([ofproto-dpif - mirroring, select_src with snaplen])
4549 AT_KEYWORDS([mirror mirrors mirroring])
4550 OVS_VSWITCHD_START
4551 add_of_ports br0 1 2 3
4552 ovs-vsctl \
4553 set Bridge br0 mirrors=@m --\
4554 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
4555 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3 snaplen=100
4556
4557 AT_DATA([flows.txt], [dnl
4558 in_port=1 actions=output:2
4559 in_port=2 actions=output:1
4560 ])
4561 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4562
4563 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)"
4564 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4565 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4566 [Datapath actions: trunc(100),3,2
4567 ])
4568
4569 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)"
4570 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4571 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4572 [Datapath actions: 1
4573 ])
4574 OVS_VSWITCHD_STOP
4575 AT_CLEANUP
4576
4577 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port with snaplen])
4578 AT_KEYWORDS([mirror mirrors mirroring])
4579 OVS_VSWITCHD_START
4580 add_of_ports br0 1 2
4581 ovs-vsctl \
4582 set Bridge br0 mirrors=@m --\
4583 --id=@p2 get Port p2 --\
4584 --id=@m create Mirror name=mymirror select_all=true output_port=@p2 snaplen=100
4585
4586 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4587
4588 # "in_port" defaults to OFPP_NONE if it's not specified.
4589 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"
4590 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4591 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4592 [Datapath actions: 1,trunc(100),2
4593 ])
4594
4595 OVS_VSWITCHD_STOP
4596 AT_CLEANUP
4597
4598 AT_SETUP([ofproto-dpif - mirroring, select_dst with snaplen])
4599 AT_KEYWORDS([mirror mirrors mirroring])
4600 OVS_VSWITCHD_START
4601 add_of_ports br0 1 2 3
4602 ovs-vsctl \
4603 set Bridge br0 mirrors=@m --\
4604 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4605 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3 snaplen=100
4606
4607 AT_DATA([flows.txt], [dnl
4608 in_port=1 actions=output:2
4609 in_port=2 actions=output:1
4610 ])
4611 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4612
4613 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)"
4614 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4615 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4616 [Datapath actions: 2,trunc(100),3
4617 ])
4618
4619 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)"
4620 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4621 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4622 [Datapath actions: 1
4623 ])
4624
4625 OVS_VSWITCHD_STOP
4626 AT_CLEANUP
4627
4628 AT_SETUP([ofproto-dpif - mirroring, select_vlan with snaplen])
4629 AT_KEYWORDS([mirror mirrors mirroring])
4630 OVS_VSWITCHD_START
4631 add_of_ports br0 1 2 3
4632 ovs-vsctl \
4633 set Bridge br0 mirrors=@m --\
4634 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4635 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3 snaplen=100
4636
4637 AT_DATA([flows.txt], [dnl
4638 in_port=1, actions=output:2
4639 ])
4640 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4641
4642 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)"
4643 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4644 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4645 [Datapath actions: 2
4646 ])
4647
4648 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))"
4649 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4650 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4651 [Datapath actions: 2
4652 ])
4653
4654 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))"
4655 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4656 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4657 [Datapath actions: trunc(100),3,2
4658 ])
4659
4660 OVS_VSWITCHD_STOP
4661 AT_CLEANUP
4662
4663 AT_SETUP([ofproto-dpif - mirroring, output_port with snaplen])
4664 AT_KEYWORDS([mirror mirrors mirroring])
4665 OVS_VSWITCHD_START
4666 add_of_ports br0 1 2 3
4667 ovs-vsctl \
4668 set Bridge br0 mirrors=@m --\
4669 --id=@p3 get Port p3 --\
4670 --id=@m create Mirror name=mymirror select_all=true output_port=@p3 snaplen=100
4671
4672 AT_DATA([flows.txt], [dnl
4673 in_port=1 actions=mod_vlan_vid:17,output:2
4674 in_port=2 actions=output:1
4675 ])
4676 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4677
4678 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)"
4679 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4680 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4681 [Datapath actions: trunc(100),3,push_vlan(vid=17,pcp=0),2
4682 ])
4683
4684 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)"
4685 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4686 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
4687 [Datapath actions: trunc(100),3,1
4688 ])
4689
4690 OVS_VSWITCHD_STOP
4691 AT_CLEANUP
4692
4693 AT_SETUP([ofproto-dpif - mirroring, output_vlan with snaplen])
4694 AT_KEYWORDS([mirror mirrors mirroring])
4695 OVS_VSWITCHD_START
4696 add_of_ports br0 1 2
4697 ovs-vsctl \
4698 set Bridge br0 mirrors=@m --\
4699 --id=@m create Mirror name=mymirror select_all=true output_vlan=12 snaplen=100
4700
4701 AT_DATA([flows.txt], [dnl
4702 in_port=1 actions=output:2
4703 in_port=2 actions=mod_vlan_vid:17,output:1
4704 ])
4705 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4706
4707 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)"
4708 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4709 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4710 dnl Expect: "trunc(100),100,trunc(100),2,trunc(100),1", with different order
4711 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])
4712
4713 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)"
4714 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4715 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4716 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])
4717
4718 OVS_VSWITCHD_STOP
4719 AT_CLEANUP
4720
4721 AT_SETUP([ofproto-dpif - multiple VLAN output mirrors with snaplen])
4722 AT_KEYWORDS([mirror mirrors mirroring])
4723 OVS_VSWITCHD_START
4724 add_of_ports br0 1 2 3
4725 ovs-vsctl \
4726 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4727 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 snaplen=200 \
4728 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 snaplen=300 \
4729 -- set Port br0 tag=0 \
4730 -- set Port p1 tag=0 \
4731 -- set Port p2 tag=500 \
4732 -- set Port p3 tag=501
4733
4734 flow="in_port=1"
4735 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4736 AT_CHECK([tail -1 stdout | egrep "trunc\(200\),2,trunc\(300\),3,100|trunc\(300\),3,trunc\(200\),2,100"], [0], [stdout])
4737
4738 OVS_VSWITCHD_STOP
4739 AT_CLEANUP
4740
4741 # This test verifies that the table ID is preserved across recirculation
4742 # when a resubmit action requires it (because the action is relative to
4743 # the current table rather than specifying a table).
4744 AT_SETUP([ofproto-dpif - resubmit with recirculation])
4745 OVS_VSWITCHD_START
4746 add_of_ports br0 1 2 3
4747
4748 AT_DATA([flows.txt], [dnl
4749 table=0 in_port=1 actions=2,resubmit(,1)
4750 table=1 in_port=1 actions=debug_recirc,resubmit:55
4751 table=1 in_port=55 actions=3
4752 ])
4753 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4754
4755 flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)"
4756 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4757 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
4758 ])
4759 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4760 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
4761 ])
4762
4763 OVS_VSWITCHD_STOP
4764 AT_CLEANUP
4765
4766
4767 # This test verifies that tunnel metadata is preserved across
4768 # recirculation. At the time of recirculation, fields such as "tun_id"
4769 # may be set before the tunnel is "valid" (ie, has a destination
4770 # address), but the field should still be available after recirculation.
4771 AT_SETUP([ofproto-dpif - resubmit with tun_id])
4772 OVS_VSWITCHD_START
4773 add_of_ports br0 1 2 3
4774
4775 AT_DATA([flows.txt], [dnl
4776 table=0 in_port=1 actions=2,load:6->NXM_NX_TUN_ID[[]],resubmit(,1)
4777 table=1 in_port=1 actions=debug_recirc,resubmit:55
4778 table=1 in_port=55 actions=3
4779 ])
4780 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4781
4782 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)"
4783 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4784 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: icmp,tun_id=0x6,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128,icmp_type=8,icmp_code=0
4785 ])
4786
4787 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4788 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: recirc_id=0x1,eth,icmp,tun_id=0x6,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128,icmp_type=8,icmp_code=0
4789 ])
4790
4791 OVS_VSWITCHD_STOP
4792 AT_CLEANUP
4793
4794
4795 # This test verifies that "resubmit", when it triggers recirculation
4796 # indirectly through the flow that it recursively invokes, is not
4797 # re-executed when execution continues later post-recirculation.
4798 AT_SETUP([ofproto-dpif - recirculation after resubmit])
4799 OVS_VSWITCHD_START
4800 add_of_ports br0 1 2
4801
4802 AT_DATA([flows.txt], [dnl
4803 table=0 in_port=1 actions=resubmit(,1),2
4804 table=1 in_port=1 actions=debug_recirc
4805 ])
4806 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4807
4808 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)"
4809 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4810 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
4811 ])
4812 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4813 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
4814 ])
4815
4816 OVS_VSWITCHD_STOP
4817 AT_CLEANUP
4818
4819 dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
4820 dnl
4821 dnl Checks the implementation of the continuation mechanism that allows the
4822 dnl packet processing pipeline to be paused and resumed. Starts by creating
4823 dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
4824 dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
4825 dnl in the bridge, resuming each time the pipeline pauses, and expects a single
4826 dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
4827 dnl ACTIONS0 still contains at least one "pause" action, removes one of them
4828 dnl and repeats the process.
4829 dnl
4830 dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
4831 dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
4832 dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
4833 dnl into port 1 on br0, so br1 only comes into action if a patch port (added
4834 dnl by EXTRA_SETUP) jumps from one bridge to another.
4835 dnl
4836 dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
4837 dnl both bridges, e.g. to configure mirrors or patch ports.
4838 m4_define([CHECK_CONTINUATION], [dnl
4839 AT_SETUP([ofproto-dpif - continuation - $1])
4840 AT_KEYWORDS([continuations pause resume])
4841 OVS_VSWITCHD_START
4842
4843 # count_matches STRING
4844 #
4845 # Prints on stdout the number of occurrences of STRING in stdin.
4846 count_matches () {
4847 sed -n ":start
4848 s/$[1]//p
4849 t start" | wc -l
4850 }
4851
4852 add_of_ports --pcap br0 `seq 1 $2`
4853 m4_if([$3], [0], [],
4854 [add_of_br 1
4855 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
4856
4857 AT_CAPTURE_FILE([ofctl_monitor0.log])
4858 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
4859 m4_if([$3], [0], [],
4860 [AT_CAPTURE_FILE([ofctl_monitor1.log])
4861 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
4862
4863 actions0='$4'
4864 actions1='$5'
4865 $6
4866 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)"
4867 n_packets=0
4868 n_resumes=0
4869 while true; do
4870 printf "\n\nactions for br0:\n%s\n" "$actions0"
4871 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
4872
4873 # Add flows.
4874 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
4875 m4_if([$3], [0], [],
4876 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
4877
4878 # Make sure the datapath is up-to-date before sending the packet.
4879 ovs-appctl revalidator/wait
4880
4881 # Run a packet through the switch.
4882 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
4883
4884 # Wait for the expected number of packets to show up.
4885 n_packets=`expr $n_packets + $2 - 1 + $3`
4886 echo "waiting for $n_packets packets..."
4887 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
4888
4889 # Wait for the expected number of NXT_RESUMEs to be logged.
4890 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
4891 echo "waiting for $n_resumes NXT_RESUMEs..."
4892 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
4893
4894 # Eliminate one "pause" from the actions.
4895 #
4896 # If there were none left, then we're done.
4897 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
4898 if test X"$actions0" = X"$next_actions0"; then
4899 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
4900 if test X"$actions1" = X"$next_actions1"; then
4901 break
4902 else
4903 actions1=$next_actions1
4904 fi
4905 else
4906 actions0=$next_actions0
4907 fi
4908
4909 # Delete all the flows and verify that there are none, so that we
4910 # can be sure that our updated flow tables is actually in use
4911 # later.
4912 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
4913 [NXST_FLOW reply:
4914 ])
4915 m4_if([$3], [0], [],
4916 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
4917 [NXST_FLOW reply:
4918 ])])
4919 done
4920 OVS_VSWITCHD_STOP
4921 AT_CLEANUP
4922 ])
4923
4924 # Check that pause at the end of the pipeline works OK.
4925 #
4926 # (xlate_continuation() has a special case for no-op actions; this
4927 # fails without that special case.)
4928 CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
4929
4930 # Check that remaining actions are preserved following resume.
4931 CHECK_CONTINUATION([actions], [7], [0],
4932 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
4933
4934 # Check that multiple levels of resubmit continue following resume.
4935 #
4936 # The "resubmit:55", which is relative to the current table, is
4937 # particularly interesting because it checks that the notion of the
4938 # current table is correctly preserved.
4939 CHECK_CONTINUATION([resubmit], [10], [0],
4940 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
4941 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
4942 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
4943 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
4944 table=3 in_port=55 actions=pause 6 pause])
4945
4946 # Check that the action set is preserved across pause/resume.
4947 CHECK_CONTINUATION([action set], [3], [0],
4948 [in_port=1 actions=1 pause resubmit(,1) pause 2
4949 table=1 actions=write_actions(3)])
4950
4951 # Check that metadata and the stack used by push and pop is preserved
4952 # across pause/resume.
4953 CHECK_CONTINUATION([data stack], [3], [0],
4954 [in_port=1 actions=pause dnl
4955 set_field:1->reg0 dnl
4956 pause dnl
4957 set_field:2->reg1 dnl
4958 pause dnl
4959 output:NXM_NX_REG0[[]] dnl
4960 pause dnl
4961 push:NXM_NX_REG1[[]] dnl
4962 dnl
4963 pop:NXM_NX_REG2[[]] dnl
4964 pause dnl
4965 output:NXM_NX_REG2[[]] dnl
4966 pause dnl
4967 3])
4968
4969 # Check that mirror output occurs once and once only, even if
4970 # separated by pause/resume.
4971 CHECK_CONTINUATION([mirroring], [5], [0],
4972 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
4973 [ovs-vsctl \
4974 set Bridge br0 mirrors=@m --\
4975 --id=@p2 get Port p2 --\
4976 --id=@p3 get Port p3 --\
4977 --id=@p4 get Port p4 --\
4978 --id=@p5 get Port p5 --\
4979 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
4980
4981 # Check that pause works in the presence of patch ports.
4982 CHECK_CONTINUATION([patch ports], [4], [1],
4983 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
4984 table=1 in_port=1 actions=pause 3 pause 10 pause],
4985 [table=0 in_port=11 actions=pause 5 pause],
4986 [ovs-vsctl \
4987 -- add-port br0 patch10 \
4988 -- set interface patch10 type=patch options:peer=patch11 \
4989 ofport_request=10 \
4990 -- add-port br1 patch11 \
4991 -- set interface patch11 type=patch options:peer=patch10 \
4992 ofport_request=11])
4993
4994
4995 # Check that pause works after the packet is cloned.
4996 AT_SETUP([ofproto-dpif - continuation after clone])
4997 AT_KEYWORDS([continuations clone pause resume])
4998 OVS_VSWITCHD_START
4999
5000 add_of_ports --pcap br0 `seq 1 3`
5001
5002 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)"
5003
5004 AT_DATA([flows.txt], [dnl
5005 table=0 in_port=1 actions=set_field:1->reg1 resubmit(,2)
5006 table=1 reg1=0x5 actions=controller(pause) resubmit(,3)
5007 table=1 reg1=0x1 actions=2
5008 table=2 in_port=1 actions=clone(set_field:5->reg1, resubmit(,1))
5009 table=3 reg1=0x1 actions=3
5010 table=3 reg1=0x5 actions=2
5011 ])
5012
5013 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5014
5015 AT_CAPTURE_FILE([ofctl_monitor0.log])
5016 ovs-ofctl monitor br0 resume --detach --no-chdir \
5017 --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log
5018
5019 # Run a packet through the switch.
5020 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
5021
5022 ovs-vsctl show
5023 ovs-ofctl dump-flows br0
5024
5025 # The packet should be recieved by port 2 and not port 3
5026 AT_CHECK([test 1 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
5027 AT_CHECK([test 0 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p3-tx.pcap | wc -l`])
5028
5029 # NXT_RESUMEs should be 1 and reg1 should be set to 0x5.
5030 OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor*.log | grep NXT_RESUME | grep -c reg1=0x5`])
5031
5032 OVS_VSWITCHD_STOP
5033 AT_CLEANUP
5034
5035 # Two testcases below are for the ofproto/trace command
5036 # The first one tests all correct syntax:
5037 # ofproto/trace [dp_name] odp_flow [-generate|packet]
5038 # ofproto/trace br_name br_flow [-generate|packet]
5039 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
5040 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5041 add_of_ports br0 1 2 3
5042
5043 AT_DATA([flows.txt], [dnl
5044 in_port=1 actions=output:2
5045 in_port=2 actions=output:1
5046 ])
5047 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5048
5049 odp_flow="in_port(p1)"
5050 br_flow="in_port=1"
5051 # Test command: ofproto/trace odp_flow with in_port as a name.
5052 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5053 AT_CHECK([tail -1 stdout], [0], [dnl
5054 Datapath actions: 2
5055 ])
5056
5057 odp_flow="in_port(1)"
5058 # Test command: ofproto/trace odp_flow
5059 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5060 AT_CHECK([tail -1 stdout], [0], [dnl
5061 Datapath actions: 2
5062 ])
5063
5064 # Test command: ofproto/trace dp_name odp_flow
5065 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
5066 AT_CHECK([tail -1 stdout], [0], [dnl
5067 Datapath actions: 2
5068 ])
5069 # Test commmand: ofproto/trace br_name br_flow
5070 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5071 AT_CHECK([tail -1 stdout], [0], [dnl
5072 Datapath actions: 2
5073 ])
5074
5075 # Delete the inserted flows
5076 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
5077 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
5078
5079 # This section below tests the [-generate] option
5080 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
5081 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"
5082
5083 # Test command: ofproto/trace odp_flow
5084 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
5085 # Check for no MAC learning entry
5086 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5087 port VLAN MAC Age
5088 ])
5089
5090 # Test command: ofproto/trace br_name br_flow
5091 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
5092 # Check for no MAC learning entry
5093 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5094 port VLAN MAC Age
5095 ])
5096
5097 # Test command: ofproto/trace odp_flow -generate
5098 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
5099 # Check for the MAC learning entry
5100 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5101 port VLAN MAC Age
5102 3 0 50:54:00:00:00:05 ?
5103 ])
5104
5105 # Test command: ofproto/trace dp_name odp_flow -generate
5106 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5107 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
5108 -generate], [0], [stdout])
5109 # Check for both MAC learning entries
5110 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5111 port VLAN MAC Age
5112 3 0 50:54:00:00:00:05 ?
5113 1 0 50:54:00:00:00:06 ?
5114 ])
5115
5116 # Test command: ofproto/trace br_name br_flow -generate
5117 AT_CHECK([ovs-appctl ofproto/trace br0 \
5118 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
5119 -generate], [0], [stdout])
5120 # Check for both MAC learning entries.
5121 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5122 port VLAN MAC Age
5123 3 0 50:54:00:00:00:05 ?
5124 1 0 50:54:00:00:00:06 ?
5125 2 0 50:54:00:00:00:07 ?
5126 ])
5127
5128 # This section beflow tests the [packet] option
5129 # The ovs-tcpundump of packets between port1 and port2
5130 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5131 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
5132
5133 # Construct the MAC learning table
5134 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5135 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
5136 -generate], [0], [stdout])
5137
5138 # Construct the MAC learning table
5139 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5140 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
5141 -generate], [0], [stdout])
5142
5143 # Test command: ofproto/trace odp_flow packet
5144 AT_CHECK([ovs-appctl ofproto/trace \
5145 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5146 AT_CHECK([tail -1 stdout], [0], [dnl
5147 Datapath actions: 2
5148 ])
5149 AT_CHECK([head -n 3 stdout], [0], [dnl
5150 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
5151
5152 bridge("br0")
5153 ])
5154
5155 # Test command: ofproto/trace dp_name odp_flow packet
5156 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
5157 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
5158 AT_CHECK([tail -1 stdout], [0], [dnl
5159 Datapath actions: 2
5160 ])
5161 AT_CHECK([head -n 3 stdout], [0], [dnl
5162 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
5163
5164 bridge("br0")
5165 ])
5166
5167 # Test command: ofproto/trace br_name br_flow packet
5168 AT_CHECK([ovs-appctl ofproto/trace br0 \
5169 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
5170 AT_CHECK([tail -1 stdout], [0], [dnl
5171 Datapath actions: 1
5172 ])
5173 AT_CHECK([head -n 3 stdout], [0], [dnl
5174 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
5175
5176 bridge("br0")
5177 ])
5178
5179 OVS_VSWITCHD_STOP
5180 AT_CLEANUP
5181
5182 # The second test tests the corner cases
5183 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
5184 OVS_VSWITCHD_START
5185 add_of_ports br0 1 2
5186
5187 # Define flows
5188 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
5189 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
5190 # Define options
5191 generate="-generate"
5192 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
5193
5194 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
5195 m4_foreach(
5196 [option],
5197 [[],
5198 ["$generate"],
5199 ["$pkt"]],
5200 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
5201 [2], [], [stderr])
5202 AT_CHECK([tail -2 stderr], [0], [dnl
5203 Cannot find the datapath
5204 ovs-appctl: ovs-vswitchd: server returned an error
5205 ])])
5206
5207 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
5208 m4_foreach(
5209 [option],
5210 [[],
5211 ["$generate"],
5212 ["$pkt"]],
5213 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
5214 [2], [], [stderr])
5215 AT_CHECK([tail -2 stderr], [0], [dnl
5216 Cannot find the datapath
5217 ovs-appctl: ovs-vswitchd: server returned an error
5218 ])])
5219
5220 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
5221 m4_foreach(
5222 [option],
5223 [[],
5224 ["$generate"],
5225 ["$pkt"]],
5226 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
5227 [2], [], [stderr])
5228 AT_CHECK([tail -2 stderr], [0], [dnl
5229 Cannot find the datapath
5230 ovs-appctl: ovs-vswitchd: server returned an error
5231 ])])
5232
5233 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
5234 m4_foreach(
5235 [option],
5236 [[],
5237 ["$generate"],
5238 ["$pkt"]],
5239 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
5240 [2], [], [stderr])
5241 AT_CHECK([tail -2 stderr], [0], [dnl
5242 Cannot find the datapath
5243 ovs-appctl: ovs-vswitchd: server returned an error
5244 ])])
5245
5246 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
5247 m4_foreach(
5248 [option],
5249 [[],
5250 ["$generate"],
5251 ["$pkt"]],
5252 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
5253 [2], [], [stderr])
5254 AT_CHECK([tail -2 stderr], [0], [dnl
5255 Unknown bridge name
5256 ovs-appctl: ovs-vswitchd: server returned an error
5257 ])])
5258
5259 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
5260 m4_foreach(
5261 [option],
5262 [[],
5263 ["$generate"],
5264 ["$pkt"]],
5265 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
5266 [2], [], [stderr])
5267 AT_CHECK([tail -2 stderr], [0], [dnl
5268 Must specify bridge name
5269 ovs-appctl: ovs-vswitchd: server returned an error
5270 ])])
5271
5272 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
5273 AT_CHECK([ovs-appctl ofproto/trace \
5274 ovs-dummy "$odp_flow" garbage_option],
5275 [2], [stdout],[stderr])
5276 AT_CHECK([tail -2 stderr], [0], [dnl
5277 Trailing garbage in packet data
5278 ovs-appctl: ovs-vswitchd: server returned an error
5279 ])
5280
5281 # Test incorrect command: ofproto/trace with 0 argument
5282 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
5283 AT_CHECK([tail -2 stderr], [0], [dnl
5284 "ofproto/trace" command requires at least 1 arguments
5285 ovs-appctl: ovs-vswitchd: server returned an error
5286 ])
5287
5288 OVS_VSWITCHD_STOP
5289 AT_CLEANUP
5290
5291 # The third test checks that the output of "ovs-dpctl -m" is valid to trace.
5292 AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
5293 OVS_VSWITCHD_START([dnl
5294 set Open_vSwitch . other_config:max-idle=10000 \
5295 -- add-port br0 p1 -- set Interface p1 type=dummy])
5296
5297 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)'])
5298 ovs-appctl revalidator/wait
5299 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
5300
5301 odp_flow=`cat dp_flows1.txt`
5302 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5303 Flow: <cleared>
5304
5305 bridge("br0")
5306 -------------
5307 0. No match.
5308 drop
5309
5310 Final flow: <cleared>
5311 Megaflow: <cleared>
5312 Datapath actions: drop
5313 ])
5314
5315 dnl Now, try again without megaflows:
5316 ovs-appctl upcall/disable-megaflows
5317
5318 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)'])
5319 ovs-appctl revalidator/wait
5320 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
5321
5322 odp_flow=`cat dp_flows2.txt`
5323 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
5324 Flow: <cleared>
5325
5326 bridge("br0")
5327 -------------
5328 0. No match.
5329 drop
5330
5331 Final flow: <cleared>
5332 Megaflow: <cleared>
5333 Datapath actions: drop
5334 ])
5335
5336 OVS_VSWITCHD_STOP
5337 AT_CLEANUP
5338
5339 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
5340 OVS_VSWITCHD_START
5341 add_of_ports br0 1 2 3
5342
5343 AT_DATA([flows.txt], [dnl
5344 in_port=1 actions=output:2
5345 in_port=2 actions=output:1
5346 ])
5347 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5348
5349 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
5350 AT_CHECK([tail -1 stdout], [0], [dnl
5351 Datapath actions: push_vlan(vid=123,pcp=0),2
5352 ])
5353
5354 OVS_VSWITCHD_STOP
5355 AT_CLEANUP
5356
5357
5358 m4_define([OFPROTO_TRACE],
5359 [flow="$2"
5360 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
5361 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
5362 expected="$4"
5363 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
5364 [0], [stdout])
5365 mv stdout expout
5366 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
5367 [0], [expout])])
5368
5369 AT_SETUP([ofproto-dpif - MAC learning])
5370 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
5371 add_of_ports br0 1 2 3
5372
5373 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)'
5374
5375 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
5376 OFPROTO_TRACE(
5377 [ovs-dummy],
5378 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5379 [-generate],
5380 [1,2,100])
5381
5382 # Check for the MAC learning entry.
5383 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5384 port VLAN MAC Age
5385 3 0 50:54:00:00:00:05 ?
5386 ])
5387
5388 # Trace a packet arrival destined for the learned MAC.
5389 # (This will also learn a MAC.)
5390 OFPROTO_TRACE(
5391 [ovs-dummy],
5392 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
5393 [-generate],
5394 [3])
5395
5396 # Check for both MAC learning entries.
5397 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5398 port VLAN MAC Age
5399 3 0 50:54:00:00:00:05 ?
5400 1 0 50:54:00:00:00:06 ?
5401 ])
5402
5403 # Trace a packet arrival that updates the first learned MAC entry.
5404 OFPROTO_TRACE(
5405 [ovs-dummy],
5406 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
5407 [-generate],
5408 [1,3,100])
5409
5410 # Check that the MAC learning entry was updated.
5411 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5412 port VLAN MAC Age
5413 1 0 50:54:00:00:00:06 ?
5414 2 0 50:54:00:00:00:05 ?
5415 ])
5416
5417 # Add another bridge.
5418 AT_CHECK(
5419 [ovs-vsctl \
5420 -- add-br br1 \
5421 -- set bridge br1 datapath-type=dummy])
5422 add_of_ports br1 4 5
5423
5424 # Trace some packet arrivals in br1 to create MAC learning entries there too.
5425 OFPROTO_TRACE(
5426 [ovs-dummy],
5427 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
5428 [-generate],
5429 [5,101])
5430 OFPROTO_TRACE(
5431 [ovs-dummy],
5432 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
5433 [-generate],
5434 [4,101])
5435
5436 # Check that the MAC learning entries were added.
5437 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5438 port VLAN MAC Age
5439 4 0 50:54:00:00:00:06 ?
5440 5 0 50:54:00:00:00:07 ?
5441 ])
5442
5443 # Delete port p1 and see that its MAC learning entry disappeared, and
5444 # that the MAC learning entry for the same MAC was also deleted from br1.
5445 AT_CHECK([ovs-vsctl del-port p1])
5446 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5447 port VLAN MAC Age
5448 2 0 50:54:00:00:00:05 ?
5449 ])
5450 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
5451 port VLAN MAC Age
5452 5 0 50:54:00:00:00:07 ?
5453 ])
5454
5455 OVS_VSWITCHD_STOP
5456 AT_CLEANUP
5457
5458 AT_SETUP([ofproto-dpif - MAC table overflow])
5459 OVS_VSWITCHD_START(
5460 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
5461 add_of_ports br0 1 2 3
5462
5463 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)'
5464
5465 AT_CHECK([ovs-appctl time/stop])
5466
5467 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
5468 for i in 0 1 2 3 4 5 6 7 8 9; do
5469 OFPROTO_TRACE(
5470 [ovs-dummy],
5471 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
5472 [-generate],
5473 [1,2,100])
5474 ovs-appctl time/warp 1000
5475 done
5476
5477 # Check for the MAC learning entries.
5478 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5479 [0], [dnl
5480 3 0 50:54:00:00:00:00
5481 3 0 50:54:00:00:00:01
5482 3 0 50:54:00:00:00:02
5483 3 0 50:54:00:00:00:03
5484 3 0 50:54:00:00:00:04
5485 3 0 50:54:00:00:00:05
5486 3 0 50:54:00:00:00:06
5487 3 0 50:54:00:00:00:07
5488 3 0 50:54:00:00:00:08
5489 3 0 50:54:00:00:00:09
5490 port VLAN MAC Age
5491 ])
5492
5493 # Trace another ARP packet on another MAC.
5494 OFPROTO_TRACE(
5495 [ovs-dummy],
5496 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
5497 [-generate],
5498 [1,2,100])
5499
5500 # Check that the new one chased the oldest one out of the table.
5501 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
5502 [0], [dnl
5503 3 0 50:54:00:00:00:01 ?
5504 3 0 50:54:00:00:00:02 ?
5505 3 0 50:54:00:00:00:03 ?
5506 3 0 50:54:00:00:00:04 ?
5507 3 0 50:54:00:00:00:05 ?
5508 3 0 50:54:00:00:00:06 ?
5509 3 0 50:54:00:00:00:07 ?
5510 3 0 50:54:00:00:00:08 ?
5511 3 0 50:54:00:00:00:09 ?
5512 3 0 50:54:00:00:00:10 ?
5513 port VLAN MAC Age
5514 ])
5515 OVS_VSWITCHD_STOP
5516 AT_CLEANUP
5517
5518 AT_SETUP([ofproto-dpif - MAC table overflow fairness])
5519 OVS_VSWITCHD_START(
5520 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
5521 add_of_ports br0 1 2 3 4 5 6
5522
5523 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)'
5524
5525 AT_CHECK([ovs-appctl time/stop])
5526
5527 # Trace packets with 2 different source MACs arriving on each of the 5
5528 # ports, filling up the 10-entry learning table.
5529 for i in 0 1 2 3 4 5 6 7 8 9; do
5530 p=`expr $i / 2 + 1`
5531 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
5532 ovs-appctl time/warp 1000
5533 done
5534
5535 # Check for the MAC learning entries.
5536 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5537 [0], [dnl
5538 1 0 50:54:00:00:00:00
5539 1 0 50:54:00:00:00:01
5540 2 0 50:54:00:00:00:02
5541 2 0 50:54:00:00:00:03
5542 3 0 50:54:00:00:00:04
5543 3 0 50:54:00:00:00:05
5544 4 0 50:54:00:00:00:06
5545 4 0 50:54:00:00:00:07
5546 5 0 50:54:00:00:00:08
5547 5 0 50:54:00:00:00:09
5548 port VLAN MAC Age
5549 ])
5550
5551 # Now trace 16 new MACs on another port.
5552 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
5553 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
5554 ovs-appctl time/warp 1000
5555 done
5556
5557 # Check the results.
5558 #
5559 # Our eviction algorithm on overflow is that an arbitrary (but deterministic)
5560 # one of the ports with the most learned MACs loses the least recently used
5561 # one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
5562 # MAC each, and the other 2 of the old ports with 2 MACs each.
5563 #
5564 # (If someone changes lib/heap.c to do something different with equal-priority
5565 # nodes, then the output below could change, but it would still follow the
5566 # rules explained above.)
5567 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
5568 [0], [dnl
5569 1 0 50:54:00:00:00:01
5570 2 0 50:54:00:00:00:03
5571 3 0 50:54:00:00:00:04
5572 3 0 50:54:00:00:00:05
5573 4 0 50:54:00:00:00:07
5574 5 0 50:54:00:00:00:08
5575 5 0 50:54:00:00:00:09
5576 6 0 50:54:00:00:0d:ff
5577 6 0 50:54:00:00:0e:ff
5578 6 0 50:54:00:00:0f:ff
5579 port VLAN MAC Age
5580 ])
5581 OVS_VSWITCHD_STOP
5582 AT_CLEANUP
5583
5584 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
5585 #
5586 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
5587 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
5588 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5589 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5590
5591 on_exit 'kill `cat test-sflow.pid`'
5592 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
5593 AT_CAPTURE_FILE([sflow.log])
5594 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
5595 ovs-appctl time/stop
5596
5597 add_of_ports br0 1 2
5598 ovs-vsctl \
5599 set Interface br0 options:ifindex=1002 -- \
5600 set Interface p1 options:ifindex=1004 -- \
5601 set Interface p2 options:ifindex=1003 -- \
5602 set Bridge br0 sflow=@sf -- \
5603 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
5604 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
5605
5606 dnl open with ARP packets to seed the bridge-learning. The output
5607 dnl ifIndex numbers should be reported predictably after that.
5608 dnl Since we set sampling=1 we should see all of these packets
5609 dnl reported. Sorting the output by data-source and seqNo makes
5610 dnl it deterministic. Ensuring that we send at least two packets
5611 dnl into each port means we get to check the seq nos are
5612 dnl incrementing correctly.
5613 dnl because packets from different ports can be handled by separate
5614 dnl threads, put some sleeps
5615
5616 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)'
5617 sleep 1
5618 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)'
5619 sleep 1
5620 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)'
5621 sleep 1
5622 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)'
5623 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)'
5624
5625 dnl sleep long enough to get more than one counter sample
5626 dnl from each datasource so we can check sequence numbers
5627 ovs-appctl time/warp 2000 100
5628 OVS_VSWITCHD_STOP
5629 OVS_APP_EXIT_AND_WAIT([test-sflow])
5630
5631 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5632 /g']], [0], [dnl
5633 HEADER
5634 dgramSeqNo=1
5635 ds=127.0.0.1>2:1000
5636 fsSeqNo=1
5637 in_vlan=0
5638 in_priority=0
5639 out_vlan=0
5640 out_priority=0
5641 meanSkip=1
5642 samplePool=1
5643 dropEvents=0
5644 in_ifindex=1004
5645 in_format=0
5646 out_ifindex=2
5647 out_format=2
5648 hdr_prot=1
5649 pkt_len=46
5650 stripped=4
5651 hdr_len=42
5652 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
5653 HEADER
5654 dgramSeqNo=1
5655 ds=127.0.0.1>2:1000
5656 fsSeqNo=2
5657 in_vlan=0
5658 in_priority=0
5659 out_vlan=0
5660 out_priority=0
5661 meanSkip=1
5662 samplePool=2
5663 dropEvents=0
5664 in_ifindex=1003
5665 in_format=0
5666 out_ifindex=2
5667 out_format=2
5668 hdr_prot=1
5669 pkt_len=46
5670 stripped=4
5671 hdr_len=42
5672 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
5673 HEADER
5674 dgramSeqNo=1
5675 ds=127.0.0.1>2:1000
5676 fsSeqNo=3
5677 in_vlan=0
5678 in_priority=0
5679 out_vlan=0
5680 out_priority=0
5681 meanSkip=1
5682 samplePool=3
5683 dropEvents=0
5684 in_ifindex=1004
5685 in_format=0
5686 out_ifindex=1003
5687 out_format=0
5688 hdr_prot=1
5689 pkt_len=46
5690 stripped=4
5691 hdr_len=42
5692 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
5693 HEADER
5694 dgramSeqNo=1
5695 ds=127.0.0.1>2:1000
5696 fsSeqNo=4
5697 in_vlan=0
5698 in_priority=0
5699 out_vlan=0
5700 out_priority=0
5701 meanSkip=1
5702 samplePool=4
5703 dropEvents=0
5704 in_ifindex=1003
5705 in_format=0
5706 out_ifindex=1004
5707 out_format=0
5708 hdr_prot=1
5709 pkt_len=46
5710 stripped=4
5711 hdr_len=42
5712 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
5713 HEADER
5714 dgramSeqNo=1
5715 ds=127.0.0.1>2:1000
5716 fsSeqNo=5
5717 in_vlan=0
5718 in_priority=0
5719 out_vlan=0
5720 out_priority=0
5721 meanSkip=1
5722 samplePool=5
5723 dropEvents=0
5724 in_ifindex=1003
5725 in_format=0
5726 out_ifindex=1004
5727 out_format=0
5728 hdr_prot=1
5729 pkt_len=58
5730 stripped=4
5731 hdr_len=54
5732 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
5733 ])
5734
5735 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'ETHCOUNTERS|IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -24 | sed 's/ /\
5736 /g']], [0], [dnl
5737 ETHCOUNTERS
5738 dot3StatsAlignmentErrors=4294967295
5739 dot3StatsFCSErrors=4294967295
5740 dot3StatsSingleCollisionFrames=4294967295
5741 dot3StatsMultipleCollisionFrames=4294967295
5742 dot3StatsSQETestErrors=4294967295
5743 dot3StatsDeferredTransmissions=4294967295
5744 dot3StatsLateCollisions=4294967295
5745 dot3StatsExcessiveCollisions=4294967295
5746 dot3StatsInternalMacTransmitErrors=4294967295
5747 dot3StatsCarrierSenseErrors=4294967295
5748 dot3StatsFrameTooLongs=4294967295
5749 dot3StatsInternalMacReceiveErrors=4294967295
5750 dot3StatsSymbolErrors=4294967295
5751 ETHCOUNTERS
5752 dot3StatsAlignmentErrors=4294967295
5753 dot3StatsFCSErrors=4294967295
5754 dot3StatsSingleCollisionFrames=4294967295
5755 dot3StatsMultipleCollisionFrames=4294967295
5756 dot3StatsSQETestErrors=4294967295
5757 dot3StatsDeferredTransmissions=4294967295
5758 dot3StatsLateCollisions=4294967295
5759 dot3StatsExcessiveCollisions=4294967295
5760 dot3StatsInternalMacTransmitErrors=4294967295
5761 dot3StatsCarrierSenseErrors=4294967295
5762 dot3StatsFrameTooLongs=4294967295
5763 dot3StatsInternalMacReceiveErrors=4294967295
5764 dot3StatsSymbolErrors=4294967295
5765 ETHCOUNTERS
5766 dot3StatsAlignmentErrors=4294967295
5767 dot3StatsFCSErrors=4294967295
5768 dot3StatsSingleCollisionFrames=4294967295
5769 dot3StatsMultipleCollisionFrames=4294967295
5770 dot3StatsSQETestErrors=4294967295
5771 dot3StatsDeferredTransmissions=4294967295
5772 dot3StatsLateCollisions=4294967295
5773 dot3StatsExcessiveCollisions=4294967295
5774 dot3StatsInternalMacTransmitErrors=4294967295
5775 dot3StatsCarrierSenseErrors=4294967295
5776 dot3StatsFrameTooLongs=4294967295
5777 dot3StatsInternalMacReceiveErrors=4294967295
5778 dot3StatsSymbolErrors=4294967295
5779 ETHCOUNTERS
5780 dot3StatsAlignmentErrors=4294967295
5781 dot3StatsFCSErrors=4294967295
5782 dot3StatsSingleCollisionFrames=4294967295
5783 dot3StatsMultipleCollisionFrames=4294967295
5784 dot3StatsSQETestErrors=4294967295
5785 dot3StatsDeferredTransmissions=4294967295
5786 dot3StatsLateCollisions=4294967295
5787 dot3StatsExcessiveCollisions=4294967295
5788 dot3StatsInternalMacTransmitErrors=4294967295
5789 dot3StatsCarrierSenseErrors=4294967295
5790 dot3StatsFrameTooLongs=4294967295
5791 dot3StatsInternalMacReceiveErrors=4294967295
5792 dot3StatsSymbolErrors=4294967295
5793 ETHCOUNTERS
5794 dot3StatsAlignmentErrors=4294967295
5795 dot3StatsFCSErrors=4294967295
5796 dot3StatsSingleCollisionFrames=4294967295
5797 dot3StatsMultipleCollisionFrames=4294967295
5798 dot3StatsSQETestErrors=4294967295
5799 dot3StatsDeferredTransmissions=4294967295
5800 dot3StatsLateCollisions=4294967295
5801 dot3StatsExcessiveCollisions=4294967295
5802 dot3StatsInternalMacTransmitErrors=4294967295
5803 dot3StatsCarrierSenseErrors=4294967295
5804 dot3StatsFrameTooLongs=4294967295
5805 dot3StatsInternalMacReceiveErrors=4294967295
5806 dot3StatsSymbolErrors=4294967295
5807 ETHCOUNTERS
5808 dot3StatsAlignmentErrors=4294967295
5809 dot3StatsFCSErrors=4294967295
5810 dot3StatsSingleCollisionFrames=4294967295
5811 dot3StatsMultipleCollisionFrames=4294967295
5812 dot3StatsSQETestErrors=4294967295
5813 dot3StatsDeferredTransmissions=4294967295
5814 dot3StatsLateCollisions=4294967295
5815 dot3StatsExcessiveCollisions=4294967295
5816 dot3StatsInternalMacTransmitErrors=4294967295
5817 dot3StatsCarrierSenseErrors=4294967295
5818 dot3StatsFrameTooLongs=4294967295
5819 dot3StatsInternalMacReceiveErrors=4294967295
5820 dot3StatsSymbolErrors=4294967295
5821 IFCOUNTERS
5822 dgramSeqNo=1
5823 ds=127.0.0.1>0:1003
5824 csSeqNo=1
5825 ifindex=1003
5826 type=6
5827 ifspeed=100000000
5828 direction=0
5829 status=0
5830 in_octets=138
5831 in_unicasts=3
5832 in_multicasts=4294967295
5833 in_broadcasts=4294967295
5834 in_discards=4294967295
5835 in_errors=4294967295
5836 in_unknownprotos=4294967295
5837 out_octets=84
5838 out_unicasts=2
5839 out_multicasts=4294967295
5840 out_broadcasts=4294967295
5841 out_discards=4294967295
5842 out_errors=4294967295
5843 promiscuous=0
5844 IFCOUNTERS
5845 dgramSeqNo=1
5846 ds=127.0.0.1>0:1004
5847 csSeqNo=1
5848 ifindex=1004
5849 type=6
5850 ifspeed=100000000
5851 direction=0
5852 status=0
5853 in_octets=84
5854 in_unicasts=2
5855 in_multicasts=4294967295
5856 in_broadcasts=4294967295
5857 in_discards=4294967295
5858 in_errors=4294967295
5859 in_unknownprotos=4294967295
5860 out_octets=138
5861 out_unicasts=3
5862 out_multicasts=4294967295
5863 out_broadcasts=4294967295
5864 out_discards=4294967295
5865 out_errors=4294967295
5866 promiscuous=0
5867 IFCOUNTERS
5868 dgramSeqNo=2
5869 ds=127.0.0.1>0:1002
5870 csSeqNo=1
5871 ifindex=1002
5872 type=6
5873 ifspeed=100000000
5874 direction=0
5875 status=0
5876 in_octets=0
5877 in_unicasts=0
5878 in_multicasts=4294967295
5879 in_broadcasts=4294967295
5880 in_discards=4294967295
5881 in_errors=4294967295
5882 in_unknownprotos=4294967295
5883 out_octets=84
5884 out_unicasts=2
5885 out_multicasts=4294967295
5886 out_broadcasts=4294967295
5887 out_discards=4294967295
5888 out_errors=4294967295
5889 promiscuous=0
5890 IFCOUNTERS
5891 dgramSeqNo=3
5892 ds=127.0.0.1>0:1002
5893 csSeqNo=2
5894 ifindex=1002
5895 type=6
5896 ifspeed=100000000
5897 direction=0
5898 status=0
5899 in_octets=0
5900 in_unicasts=0
5901 in_multicasts=4294967295
5902 in_broadcasts=4294967295
5903 in_discards=4294967295
5904 in_errors=4294967295
5905 in_unknownprotos=4294967295
5906 out_octets=84
5907 out_unicasts=2
5908 out_multicasts=4294967295
5909 out_broadcasts=4294967295
5910 out_discards=4294967295
5911 out_errors=4294967295
5912 promiscuous=0
5913 IFCOUNTERS
5914 dgramSeqNo=3
5915 ds=127.0.0.1>0:1003
5916 csSeqNo=2
5917 ifindex=1003
5918 type=6
5919 ifspeed=100000000
5920 direction=0
5921 status=0
5922 in_octets=138
5923 in_unicasts=3
5924 in_multicasts=4294967295
5925 in_broadcasts=4294967295
5926 in_discards=4294967295
5927 in_errors=4294967295
5928 in_unknownprotos=4294967295
5929 out_octets=84
5930 out_unicasts=2
5931 out_multicasts=4294967295
5932 out_broadcasts=4294967295
5933 out_discards=4294967295
5934 out_errors=4294967295
5935 promiscuous=0
5936 IFCOUNTERS
5937 dgramSeqNo=3
5938 ds=127.0.0.1>0:1004
5939 csSeqNo=2
5940 ifindex=1004
5941 type=6
5942 ifspeed=100000000
5943 direction=0
5944 status=0
5945 in_octets=84
5946 in_unicasts=2
5947 in_multicasts=4294967295
5948 in_broadcasts=4294967295
5949 in_discards=4294967295
5950 in_errors=4294967295
5951 in_unknownprotos=4294967295
5952 out_octets=138
5953 out_unicasts=3
5954 out_multicasts=4294967295
5955 out_broadcasts=4294967295
5956 out_discards=4294967295
5957 out_errors=4294967295
5958 promiscuous=0
5959 OPENFLOWPORT
5960 datapath_id=18364758544493064720
5961 port_no=1
5962 OPENFLOWPORT
5963 datapath_id=18364758544493064720
5964 port_no=1
5965 OPENFLOWPORT
5966 datapath_id=18364758544493064720
5967 port_no=2
5968 OPENFLOWPORT
5969 datapath_id=18364758544493064720
5970 port_no=2
5971 OPENFLOWPORT
5972 datapath_id=18364758544493064720
5973 port_no=65534
5974 OPENFLOWPORT
5975 datapath_id=18364758544493064720
5976 port_no=65534
5977 PORTNAME
5978 portName=br0
5979 PORTNAME
5980 portName=br0
5981 PORTNAME
5982 portName=p1
5983 PORTNAME
5984 portName=p1
5985 PORTNAME
5986 portName=p2
5987 PORTNAME
5988 portName=p2
5989 ])])
5990
5991 AT_SETUP([ofproto-dpif - basic truncate action])
5992 OVS_VSWITCHD_START
5993 add_of_ports br0 1 2 3 4 5
5994
5995 AT_CHECK([ovs-vsctl -- set Interface p1 type=dummy options:pcap=p1.pcap])
5996 AT_CHECK([ovs-vsctl -- set Interface p2 type=dummy options:pstream=punix:p2.sock])
5997 AT_CHECK([ovs-vsctl -- set Interface p3 type=dummy options:stream=unix:p2.sock])
5998 AT_CHECK([ovs-vsctl -- set Interface p4 type=dummy options:pstream=punix:p4.sock])
5999 AT_CHECK([ovs-vsctl -- set Interface p5 type=dummy options:stream=unix:p4.sock])
6000
6001 AT_DATA([flows.txt], [dnl
6002 in_port=3,actions=drop
6003 in_port=5,actions=drop
6004 in_port=1,actions=output(port=2,max_len=64),output:4
6005 ])
6006 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6007
6008 dnl Datapath actions
6009 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])
6010 AT_CHECK([tail -1 stdout], [0],
6011 [Datapath actions: trunc(64),2,4
6012 ])
6013
6014 dnl An 170 byte packet
6015 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6016
6017 AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
6018 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
6019 ])
6020
6021 AT_CHECK([ovs-appctl revalidator/purge], [0])
6022 dnl packet with truncated size
6023 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6024 n_bytes=64
6025 ])
6026 dnl packet with original size
6027 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6028 n_bytes=170
6029 ])
6030
6031 dnl More complicated case
6032 AT_CHECK([ovs-ofctl del-flows br0])
6033 AT_DATA([flows.txt], [dnl
6034 in_port=3,actions=drop
6035 in_port=5,actions=drop
6036 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
6037 ])
6038 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6039
6040 dnl Datapath actions
6041 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])
6042 AT_CHECK([tail -1 stdout], [0],
6043 [Datapath actions: trunc(64),2,trunc(128),2,trunc(60),4,2,4
6044 ])
6045
6046 dnl An 170 byte packet
6047 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '000c29c8a0a4005056c0000808004500009cb4a6000040019003c0a8da01c0a8da640800cb5fa762000556f431ad0009388e08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f'])
6048
6049 AT_CHECK([ovs-appctl revalidator/purge], [0])
6050 dnl packet size: 64 + 128 + 170 = 362
6051 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=3" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6052 n_bytes=362
6053 ])
6054 dnl packet size: 60 + 170 = 230
6055 AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=5" | sed -n 's/.*\(n\_bytes=[[0-9]]*\).*/\1/p'], [0], [dnl
6056 n_bytes=230
6057 ])
6058
6059 dnl syntax checking
6060 AT_CHECK([ovs-ofctl add-flow br0 'actions=output(port=ALL,max_len=100)'], [1], [], [dnl
6061 ovs-ofctl: output to unsupported truncate port: ALL
6062 ])
6063
6064 OVS_VSWITCHD_STOP
6065 AT_CLEANUP
6066
6067 AT_SETUP([ofproto-dpif - truncate and output to patch port])
6068 OVS_VSWITCHD_START([add-br br1 \
6069 -- set bridge br1 datapath-type=dummy fail-mode=secure \
6070 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 ofport_request=1 \
6071 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6072
6073 add_of_ports br0 2
6074
6075 AT_CHECK([ovs-ofctl add-flow br0 actions='output(port=1,max_len=100),output:2'])
6076 AT_CHECK([ovs-ofctl add-flow br1 actions=NORMAL])
6077
6078 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6079 [0], [stdout])
6080 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
6081 ])
6082 dnl the output(port=1,max_len=100) fails the translation, only output:2 in datapath
6083 AT_CHECK([grep "output_trunc does not support patch port [[0-9]]*" stdout], [0], [stdout])
6084
6085 OVS_VSWITCHD_STOP
6086 AT_CLEANUP
6087
6088 AT_SETUP([ofproto-dpif - truncate and output to gre tunnel])
6089 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6090 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6091 options:key=5 ofport_request=1\
6092 -- add-port br0 p2 -- set Interface p2 type=dummy \
6093 ofport_request=2])
6094 AT_DATA([flows.txt], [dnl
6095 actions=output(max_len=100, port=1)
6096 ])
6097 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6098 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6099
6100 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
6101 br0 65534/100: (dummy-internal)
6102 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
6103 p2 2/2: (dummy)
6104 ])
6105
6106 dnl Basic
6107 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])
6108 AT_CHECK([tail -1 stdout], [0],
6109 [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
6110 ])
6111
6112 OVS_VSWITCHD_STOP
6113 AT_CLEANUP
6114
6115 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
6116 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
6117 AT_CLEANUP
6118
6119 AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
6120 AT_SKIP_IF([test $HAVE_IPV6 = no])
6121 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
6122 AT_CLEANUP
6123
6124 dnl Test sFlow LAG structures
6125 AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
6126 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
6127 OVS_VSWITCHD_START([dnl
6128 add-bond br0 bond p1 p2 -- \
6129 set Port bond lacp=active bond-mode=active-backup \
6130 other_config:lacp-time="fast" \
6131 other_config:lacp-system-id=11:22:33:44:55:66 \
6132 other_config:lacp-system-priority=54321 -- \
6133 set Interface p1 type=dummy \
6134 other_config:lacp-port-id=11 \
6135 other_config:lacp-port-priority=111 \
6136 other_config:lacp-aggregation-key=3333 -- \
6137 set Interface p2 type=dummy \
6138 other_config:lacp-port-id=22 \
6139 other_config:lacp-port-priority=222 \
6140 other_config:lacp-aggregation-key=3333 ])
6141
6142 on_exit 'kill `cat test-sflow.pid`'
6143 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6144 AT_CAPTURE_FILE([sflow.log])
6145 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6146
6147 ovs-appctl time/stop
6148
6149 ovs-vsctl \
6150 set Interface p1 options:ifindex=1003 -- \
6151 set Bridge br0 sflow=@sf -- \
6152 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6153 header=128 sampling=1 polling=1
6154
6155 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6156 AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
6157 AT_CHECK([ovs-appctl revalidator/purge], [0])
6158 OVS_VSWITCHD_STOP
6159 OVS_APP_EXIT_AND_WAIT([test-sflow])
6160 AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
6161 /g']], [0], [dnl
6162 LACPCOUNTERS
6163 sysID=11:22:33:44:55:66
6164 partnerID=00:00:00:00:00:00
6165 aggID=3333
6166 actorAdmin=0x7
6167 actorOper=0xbf
6168 partnerAdmin=0x0
6169 partnerOper=0x2
6170 LACPDUsRx=0
6171 markerPDUsRx=4294967295
6172 markerRespPDUsRx=4294967295
6173 unknownRx=4294967295
6174 illegalRx=0
6175 LACPDUsTx=1
6176 markerPDUsTx=4294967295
6177 markerRespPDUsTx=4294967295
6178 ])
6179
6180 AT_CLEANUP
6181
6182 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
6183 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6184 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6185
6186 dnl set up sFlow logging
6187 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6188 AT_CAPTURE_FILE([sflow.log])
6189 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6190 ovs-appctl time/stop
6191
6192 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6193 AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
6194 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
6195 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
6196
6197 AT_CHECK([ovs-ofctl add-flow br0 action=3])
6198
6199 dnl enable sflow
6200 ovs-vsctl \
6201 set Bridge br0 sflow=@sf -- \
6202 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6203 header=128 sampling=1 polling=0
6204
6205 dnl introduce a packet that will be flooded to the tunnel
6206 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)'])
6207
6208 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6209 for i in `seq 1 30`; do
6210 ovs-appctl time/warp 100
6211 done
6212
6213 OVS_APP_EXIT_AND_WAIT([test-sflow])
6214
6215 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6216 /g']], [0], [dnl
6217 HEADER
6218 dgramSeqNo=1
6219 ds=127.0.0.1>2:1000
6220 fsSeqNo=1
6221 tunnel4_out_length=0
6222 tunnel4_out_protocol=47
6223 tunnel4_out_src=0.0.0.0
6224 tunnel4_out_dst=1.1.1.1
6225 tunnel4_out_src_port=0
6226 tunnel4_out_dst_port=0
6227 tunnel4_out_tcp_flags=0
6228 tunnel4_out_tos=1
6229 tunnel_out_vni=456
6230 in_vlan=0
6231 in_priority=0
6232 out_vlan=0
6233 out_priority=0
6234 meanSkip=1
6235 samplePool=1
6236 dropEvents=0
6237 in_ifindex=0
6238 in_format=0
6239 out_ifindex=1
6240 out_format=2
6241 hdr_prot=1
6242 pkt_len=46
6243 stripped=4
6244 hdr_len=42
6245 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
6246 ])
6247
6248 OVS_VSWITCHD_STOP
6249 AT_CLEANUP
6250
6251 AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
6252 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6253
6254 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
6255
6256 dnl set up sFlow logging
6257 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6258 AT_CAPTURE_FILE([sflow.log])
6259 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6260 ovs-appctl time/stop
6261
6262 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6263 AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
6264 AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
6265 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
6266 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
6267 options:ifindex=2011 ofport_request=5
6268 ], [0])
6269
6270 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6271 dummy@ovs-dummy: hit:0 missed:0
6272 br0:
6273 br0 65534/100: (dummy-internal)
6274 p0 1/1: (dummy: ifindex=1010)
6275 int-br:
6276 int-br 65534/2: (dummy-internal)
6277 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
6278 vm1 5/3: (dummy: ifindex=2011)
6279 ])
6280
6281 dnl set up route to 1.1.2.92 via br0 and action=normal
6282 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
6283 ])
6284 AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
6285 ])
6286 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6287
6288 dnl Prime ARP Cache for 1.1.2.92
6289 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)'])
6290
6291 dnl configure sflow on int-br only
6292 ovs-vsctl \
6293 set Bridge int-br sflow=@sf -- \
6294 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6295 header=128 sampling=1 polling=0
6296
6297 dnl set up route to 192.168.1.2 via br0
6298 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
6299 ])
6300 AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
6301 ])
6302
6303 dnl add rule for int-br to force packet onto tunnel. There is no ifindex
6304 dnl for this port so the sFlow output will just report that it went to
6305 dnl 1 output (out_format=2, out_ifindex=1)
6306 AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
6307
6308 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)'])
6309
6310 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6311 for i in `seq 1 30`; do
6312 ovs-appctl time/warp 100
6313 done
6314
6315 OVS_APP_EXIT_AND_WAIT([test-sflow])
6316
6317 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6318 /g']], [0], [dnl
6319 HEADER
6320 dgramSeqNo=1
6321 ds=127.0.0.1>2:1000
6322 fsSeqNo=1
6323 tunnel4_out_length=0
6324 tunnel4_out_protocol=47
6325 tunnel4_out_src=1.1.2.88
6326 tunnel4_out_dst=1.1.2.92
6327 tunnel4_out_src_port=0
6328 tunnel4_out_dst_port=0
6329 tunnel4_out_tcp_flags=0
6330 tunnel4_out_tos=0
6331 tunnel_out_vni=456
6332 in_vlan=0
6333 in_priority=0
6334 out_vlan=0
6335 out_priority=0
6336 meanSkip=1
6337 samplePool=1
6338 dropEvents=0
6339 in_ifindex=2011
6340 in_format=0
6341 out_ifindex=1
6342 out_format=2
6343 hdr_prot=1
6344 pkt_len=46
6345 stripped=4
6346 hdr_len=42
6347 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
6348 ])
6349
6350 OVS_VSWITCHD_STOP
6351 AT_CLEANUP
6352
6353 AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
6354 AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
6355 OVS_VSWITCHD_START
6356 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6357 add_of_ports br0 1 2
6358 AT_DATA([flows.txt], [dnl
6359 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
6360 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6361 ])
6362 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6363
6364 dnl set up sFlow logging
6365 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
6366 AT_CAPTURE_FILE([sflow.log])
6367 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
6368 ovs-appctl time/stop
6369
6370 dnl configure sflow
6371 ovs-vsctl \
6372 set Bridge br0 sflow=@sf -- \
6373 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
6374 header=128 sampling=1 polling=0
6375
6376 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)'])
6377 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)'])
6378
6379 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
6380 for i in `seq 1 30`; do
6381 ovs-appctl time/warp 100
6382 done
6383
6384 OVS_APP_EXIT_AND_WAIT([test-sflow])
6385
6386 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
6387 /g']], [0], [dnl
6388 HEADER
6389 dgramSeqNo=1
6390 ds=127.0.0.1>2:1000
6391 fsSeqNo=1
6392 mpls_label_0=789
6393 mpls_tc_0=4
6394 mpls_ttl_0=32
6395 mpls_bos_0=0
6396 mpls_label_1=11
6397 mpls_tc_1=3
6398 mpls_ttl_1=64
6399 mpls_bos_1=1
6400 in_vlan=0
6401 in_priority=0
6402 out_vlan=0
6403 out_priority=0
6404 meanSkip=1
6405 samplePool=1
6406 dropEvents=0
6407 in_ifindex=0
6408 in_format=0
6409 out_ifindex=1
6410 out_format=2
6411 hdr_prot=1
6412 pkt_len=22
6413 stripped=4
6414 hdr_len=18
6415 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40
6416 HEADER
6417 dgramSeqNo=1
6418 ds=127.0.0.1>2:1000
6419 fsSeqNo=2
6420 mpls_label_0=789
6421 mpls_tc_0=4
6422 mpls_ttl_0=32
6423 mpls_bos_0=1
6424 in_vlan=0
6425 in_priority=0
6426 out_vlan=0
6427 out_priority=0
6428 meanSkip=1
6429 samplePool=2
6430 dropEvents=0
6431 in_ifindex=0
6432 in_format=0
6433 out_ifindex=1
6434 out_format=2
6435 hdr_prot=1
6436 pkt_len=38
6437 stripped=4
6438 hdr_len=34
6439 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
6440 ])
6441
6442 OVS_VSWITCHD_STOP
6443 AT_CLEANUP
6444
6445
6446 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
6447 #
6448 # Test that basic NetFlow reports flow statistics correctly:
6449 # The initial packet of a flow are correctly accounted.
6450 # Later packets within a flow are correctly accounted.
6451 # Flow actions changing (in this case, due to MAC learning)
6452 # cause a record to be sent.
6453 m4_define([CHECK_NETFLOW_EXPIRATION],
6454 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6455 add_of_ports br0 1 2
6456
6457 ovs-appctl time/stop
6458 on_exit 'kill `cat test-netflow.pid`'
6459 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6460 AT_CAPTURE_FILE([netflow.log])
6461 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6462
6463 ovs-vsctl \
6464 set Bridge br0 netflow=@nf -- \
6465 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6466 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6467
6468 for delay in 1000 30000; do
6469 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)'
6470 sleep 1 # ensure the order in which these two packets are processed
6471 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)'
6472
6473 ovs-appctl time/warp $delay
6474 done
6475
6476 ovs-appctl time/warp 6000
6477 ovs-appctl revalidator/wait
6478 OVS_VSWITCHD_STOP
6479 OVS_APP_EXIT_AND_WAIT([test-netflow])
6480
6481 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])
6482
6483 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])
6484
6485 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 84 bytes, ICMP 0:0" netflow.log | wc -l`
6486 separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 42 bytes, ICMP 0:0" netflow.log | wc -l`
6487 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
6488
6489 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
6490 CHECK_NETFLOW_EXPIRATION([127.0.0.1])
6491 AT_CLEANUP
6492
6493 AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
6494 AT_SKIP_IF([test $HAVE_IPV6 = no])
6495 CHECK_NETFLOW_EXPIRATION([[[::1]]])
6496 AT_CLEANUP
6497
6498 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
6499 #
6500 # Test that basic NetFlow reports active expirations correctly.
6501 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
6502 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
6503 add_of_ports br0 1 2
6504
6505 on_exit 'kill `cat test-netflow.pid`'
6506 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
6507 AT_CAPTURE_FILE([netflow.log])
6508 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
6509
6510 ovs-vsctl \
6511 set Bridge br0 netflow=@nf -- \
6512 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6513 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
6514
6515 AT_CHECK([ovs-appctl time/stop])
6516 n=1
6517 while test $n -le 60; do
6518 n=`expr $n + 1`
6519
6520 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)'
6521 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)'
6522
6523 ovs-appctl time/warp 1000
6524 done
6525
6526 ovs-appctl time/warp 10000
6527
6528 ovs-appctl revalidator/wait
6529 OVS_VSWITCHD_STOP
6530 OVS_APP_EXIT_AND_WAIT([test-netflow])
6531
6532 # Count the number of reported packets:
6533 # - From source to destination before MAC learning kicks in (just one).
6534 # - From source to destination after that.
6535 # - From destination to source.
6536 n_learn=0
6537 n_in=0
6538 n_out=0
6539 n_other=0
6540 n_recs=0
6541 none=0
6542 while read line; do
6543 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
6544 case $pkts in
6545 [[0-9]]*) ;;
6546 *) continue ;;
6547 esac
6548
6549 case $line in
6550 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6551 counter=n_learn
6552 ;;
6553 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
6554 counter=n_in
6555 ;;
6556 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
6557 counter=n_out
6558 ;;
6559 *)
6560 counter=n_other
6561 ;;
6562 esac
6563 eval $counter=\`expr \$$counter + \$pkts\`
6564 n_recs=`expr $n_recs + 1`
6565 done < netflow.log
6566
6567 # There should be exactly 1 MAC learning packet,
6568 # exactly 59 other packets in that direction,
6569 # and exactly 60 packets in the other direction.
6570 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
6571 ])])
6572
6573 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
6574 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
6575 AT_CLEANUP
6576
6577 AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
6578 AT_SKIP_IF([test $HAVE_IPV6 = no])
6579 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
6580 AT_CLEANUP
6581
6582 dnl In the absence of an IPFIX collector to verify protocol correctness, simply
6583 dnl configure bridge IPFIX and ensure that sample action generation works at the
6584 dnl datapath level.
6585 AT_SETUP([ofproto-dpif - Bridge IPFIX sanity check])
6586 OVS_VSWITCHD_START
6587 add_of_ports br0 1 2
6588
6589 dnl Sample every packet using bridge-based sampling.
6590 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
6591 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
6592 sampling=1], [0], [ignore])
6593
6594 dnl Send some packets that should be sampled.
6595 for i in `seq 1 3`; do
6596 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)'])
6597 done
6598 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6599 flow-dump from non-dpdk interfaces:
6600 packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))
6601 ])
6602
6603 AT_CHECK([ovs-appctl revalidator/purge])
6604 dnl
6605 dnl Add a slowpath meter. The userspace action should be metered.
6606 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])
6607
6608 dnl Send some packets that should be sampled and metered.
6609 for i in `seq 1 3`; do
6610 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)'])
6611 done
6612 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6613 flow-dump from non-dpdk interfaces:
6614 packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))
6615 ])
6616
6617 dnl Remove the IPFIX configuration.
6618 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
6619 AT_CHECK([ovs-appctl revalidator/purge])
6620
6621 dnl Send some more packets, to ensure that these are not sampled.
6622 for i in `seq 1 3`; do
6623 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)'])
6624 done
6625 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6626 flow-dump from non-dpdk interfaces:
6627 packets:2, bytes:68, used:0.001s, actions:drop
6628 ])
6629
6630 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6631 AT_CLEANUP
6632
6633 dnl Bridge IPFIX statistics check
6634 AT_SETUP([ofproto-dpif - Bridge IPFIX statistics check])
6635 OVS_VSWITCHD_START
6636 add_of_ports br0 1 2
6637
6638 dnl Negative test check.
6639 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
6640 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6641 NXST_IPFIX_BRIDGE request (xid=0x2):
6642 ])
6643
6644 dnl Sample every packet using bridge-based sampling.
6645 AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
6646 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
6647 sampling=1], [0], [ignore])
6648
6649 dnl Send some packets that should be sampled.
6650 for i in `seq 1 20`; do
6651 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)'])
6652 done
6653
6654 dnl There are 4 extra IPFIX template packets.
6655 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
6656 NXST_IPFIX_BRIDGE reply (xid=0x2):
6657 bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
6658 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
6659 ])
6660
6661 dnl Remove the IPFIX configuration.
6662 AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
6663 AT_CHECK([ovs-appctl revalidator/purge])
6664
6665 dnl Send some more packets, to ensure that these are not sampled.
6666 for i in `seq 1 2`; do
6667 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)'])
6668 done
6669 AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
6670 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6671 NXST_IPFIX_BRIDGE request (xid=0x2):
6672 ])
6673
6674 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6675 AT_CLEANUP
6676
6677 dnl Flow IPFIX sanity check
6678 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check])
6679 OVS_VSWITCHD_START
6680 add_of_ports br0 1 2
6681
6682 # Check for regression against a bug where an invalid target caused an
6683 # assertion failure and a crash.
6684 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6685 -- --id=@ipfix create IPFIX targets=\"xyzzy\" \
6686 -- --id=@cs create Flow_Sample_Collector_Set id=0 bridge=@br0 ipfix=@ipfix],
6687 [0], [ignore])
6688
6689 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6690 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6691 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6692 [0], [ignore])
6693
6694 AT_DATA([flows.txt], [dnl
6695 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
6696 ])
6697
6698 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6699
6700 dnl Send some packets that should be sampled.
6701 for i in `seq 1 3`; do
6702 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)'])
6703 done
6704 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6705 flow-dump from non-dpdk interfaces:
6706 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
6707 ])
6708
6709 dnl Remove the flow which contains sample action.
6710 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
6711 AT_CHECK([ovs-appctl revalidator/purge])
6712
6713 dnl Send some more packets, to ensure that these are not sampled.
6714 for i in `seq 1 3`; do
6715 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)'])
6716 done
6717 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
6718 flow-dump from non-dpdk interfaces:
6719 packets:2, bytes:68, used:0.001s, actions:drop
6720 ])
6721
6722 OVS_VSWITCHD_STOP(["/sending to collector failed/d
6723 /xyzzy/d
6724 /no collectors/d"])
6725 AT_CLEANUP
6726
6727 dnl Flow IPFIX sanity check for tunnel set
6728 AT_SETUP([ofproto-dpif - Flow IPFIX sanity check - tunnel set])
6729 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
6730 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
6731 options:key=5 ofport_request=1\
6732 -- add-port br0 p2 -- set Interface p2 type=stt \
6733 options:remote_ip=1.1.1.2 options:local_ip=2.2.2.3 \
6734 options:key=6 ofport_request=2\
6735 -- add-port br0 p3 -- set Interface p3 type=dummy \
6736 ofport_request=3 \
6737 -- --id=@br0 get Bridge br0 \
6738 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6739 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6740 [<0>
6741 <1>
6742 ])
6743
6744 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
6745
6746 dnl Add openflow sample action without sampling_port.
6747 AT_DATA([flows.txt], [dnl
6748 in_port=3, actions=sample(probability=65535,collector_set_id=1),output:1
6749 ])
6750 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6751
6752 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])
6753 AT_CHECK([tail -1 stdout], [0], [dnl
6754 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
6755 ])
6756
6757 dnl Remove the flow which contains sample action.
6758 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6759 AT_CHECK([ovs-appctl revalidator/purge])
6760
6761 dnl Add openflow sample action with sampling_port which is
6762 dnl equal to output port.
6763 AT_DATA([flows2.txt], [dnl
6764 in_port=3, actions=sample(probability=65535,collector_set_id=1,sampling_port=1),output:1
6765 ])
6766 AT_CHECK([ovs-ofctl add-flows br0 flows2.txt], [0], [ignore])
6767
6768 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])
6769 dnl Make sure flow sample action in datapath is behind set tunnel
6770 dnl action at egress point of tunnel port.
6771 AT_CHECK([tail -1 stdout], [0], [dnl
6772 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
6773 ])
6774
6775 dnl Remove the flow which contains sample action.
6776 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6777 AT_CHECK([ovs-appctl revalidator/purge])
6778
6779 dnl Add a rule with two sample actions and each sample action
6780 dnl has a sampling_port
6781 AT_DATA([flows3.txt], [dnl
6782 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
6783 ])
6784 AT_CHECK([ovs-ofctl add-flows br0 flows3.txt], [0], [ignore])
6785
6786 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])
6787 dnl Make sure flow sample action in datapath is behind set tunnel
6788 dnl action at egress point of tunnel port.
6789 AT_CHECK([tail -1 stdout], [0], [dnl
6790 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
6791 ])
6792
6793 dnl Remove the flow which contains sample action.
6794 AT_CHECK([ovs-ofctl del-flows br0 in_port=3], [0], [ignore])
6795 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
6796
6797 OVS_VSWITCHD_STOP
6798 AT_CLEANUP
6799
6800 AT_SETUP([ofproto-dpif - clone action])
6801 OVS_VSWITCHD_START
6802 add_of_ports br0 1 2 3 4
6803
6804 dnl Reversible open flow clone actions, no datapath clone action should be generated.
6805 AT_DATA([flows.txt], [dnl
6806 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
6807 ])
6808 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6809
6810 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])
6811
6812 AT_CHECK([tail -1 stdout], [0], [dnl
6813 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
6814 ])
6815
6816 dnl Test flow xlate openflow clone action without using datapath clone action.
6817 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
6818
6819 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])
6820
6821 AT_CHECK([tail -1 stdout], [0], [dnl
6822 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
6823 ])
6824
6825 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
6826 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])
6827
6828 AT_CHECK([tail -1 stdout], [0], [dnl
6829 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(eth(src=80:81:81:81:81:81)),set(ipv4(src=10.10.10.2,dst=192.168.5.5)),3,set(eth(src=50:54:00:00:00:09)),set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
6830 ])
6831
6832 dnl Mixing reversible and irreversible open flow clone actions. Datapath clone action
6833 dnl should be generated when necessary.
6834
6835 dnl Restore the datapath support level.
6836 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone true], [0], [])
6837 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 10], [0], [])
6838
6839 AT_DATA([flows.txt], [dnl
6840 in_port=1, ip, actions=clone(set_field:192.168.3.3->ip_src),clone(set_field:192.168.4.4->ip_dst,output:2),clone(ct(commit),output:3),output:4
6841 ])
6842 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6843
6844 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])
6845
6846 AT_CHECK([tail -1 stdout], [0], [dnl
6847 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(ipv4(src=10.10.10.2,dst=10.10.10.1)),clone(ct(commit),3),4
6848 ])
6849
6850 AT_CHECK([ovs-appctl dpif/set-dp-features br0 clone false], [0], [ignore])
6851
6852 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])
6853
6854 AT_CHECK([tail -1 stdout], [0], [dnl
6855 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(ipv4(src=10.10.10.2,dst=10.10.10.1)),sample(sample=100.0%,actions(ct(commit),3)),4
6856 ])
6857
6858 AT_CHECK([ovs-appctl dpif/set-dp-features br0 sample_nesting 2], [0], [ignore])
6859 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])
6860
6861 AT_CHECK([tail -1 stdout], [0], [dnl
6862 Datapath actions: set(ipv4(src=10.10.10.2,dst=192.168.4.4)),2,set(ipv4(src=10.10.10.2,dst=10.10.10.1)),4
6863 ])
6864 AT_CHECK([grep "Failed to compose clone action" stdout], [0], [ignore])
6865
6866 OVS_VSWITCHD_STOP
6867 AT_CLEANUP
6868
6869 dnl Flow based IPFIX statistics check
6870 AT_SETUP([ofproto-dpif - Flow IPFIX statistics check])
6871 OVS_VSWITCHD_START
6872 add_of_ports br0 1 2
6873
6874 dnl Negative test check.
6875 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
6876 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6877 NXST_IPFIX_FLOW request (xid=0x2):
6878 ])
6879
6880 AT_CHECK([ovs-vsctl -- --id=@br0 get Bridge br0 \
6881 -- --id=@ipfix create IPFIX targets=\"127.0.0.1:4739\" \
6882 -- --id=@cs create Flow_Sample_Collector_Set id=1 bridge=@br0 ipfix=@ipfix],
6883 [0], [ignore])
6884
6885 AT_DATA([flows.txt], [dnl
6886 in_port=1, actions=sample(probability=65535,collector_set_id=1),output:2
6887 ])
6888
6889 AT_CHECK([ovs-ofctl add-flows br0 flows.txt], [0], [ignore])
6890
6891 dnl Send some packets that should be sampled.
6892 for i in `seq 1 20`; do
6893 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)'])
6894 done
6895
6896 dnl There are 4 extra IPFIX template packets.
6897 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
6898 NXST_IPFIX_FLOW reply (xid=0x2): 1 ids
6899 id 1: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 ok=0, tx pkts=24
6900 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=0
6901 ])
6902
6903 dnl Remove the flow which contains sample action.
6904 AT_CHECK([ovs-ofctl del-flows br0 in_port=1], [0], [ignore])
6905 AT_CHECK([ovs-vsctl destroy Flow_Sample_Collector_Set 1], [0], [ignore])
6906 AT_CHECK([ovs-appctl revalidator/purge])
6907
6908 dnl Send some more packets, to ensure that these are not sampled.
6909 for i in `seq 1 3`; do
6910 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)'])
6911 done
6912 AT_CHECK([ovs-ofctl dump-ipfix-flow br0], [0], [dnl
6913 OFPT_ERROR (xid=0x2): NXST_NOT_CONFIGURED
6914 NXST_IPFIX_FLOW request (xid=0x2):
6915 ])
6916
6917 OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
6918 AT_CLEANUP
6919
6920 AT_SETUP([ofproto-dpif - flow stats])
6921 OVS_VSWITCHD_START
6922 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
6923 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
6924
6925 ovs-appctl time/stop
6926
6927 for i in `seq 1 10`; do
6928 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)'
6929 done
6930
6931 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6932 AT_CHECK([ovs-appctl revalidator/purge], [0])
6933 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
6934 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
6935 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
6936 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=540, idle_age=1, ip actions=NORMAL
6937 ])
6938 OVS_VSWITCHD_STOP
6939 AT_CLEANUP
6940
6941 AT_SETUP([ofproto-dpif - flow stats reset_counts])
6942 OVS_VSWITCHD_START
6943 flow="ip,actions=NORMAL"
6944
6945 ovs-appctl time/stop
6946
6947 AT_CHECK([ovs-ofctl add-flow br0 $flow])
6948
6949 warp_and_dump_NXM () {
6950 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6951 AT_CHECK([ovs-appctl revalidator/purge], [0])
6952
6953 AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0], [0], [stdout])
6954 if [[ $5 -gt 0 ]]; then
6955 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, hard_age=$5, ip actions=NORMAL"
6956 else
6957 expected=" cookie=0x0, duration=$1s, table=0, n_packets=$2, n_bytes=$3, idle_age=$4, ip actions=NORMAL"
6958 fi
6959 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
6960 $expected
6961 ])
6962 }
6963
6964 warp_and_dump_OF () {
6965 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
6966 AT_CHECK([ovs-appctl revalidator/purge], [0])
6967
6968 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 dump-flows br0], [0], [stdout])
6969 if [[ $1 -lt 13 -o "$5X" = "X" ]]; then
6970 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, ip actions=NORMAL"
6971 else
6972 expected=" cookie=0x0, duration=$2s, table=0, n_packets=$3, n_bytes=$4, $5 ip actions=NORMAL"
6973 fi
6974 AT_CHECK_UNQUOTED([strip_xids < stdout | sed -n 's/duration=\([[0-9]]*\)\.*[[0-9]]*s/duration=\1s/p' | sort], [0], [dnl
6975 $expected
6976 ])
6977 }
6978
6979 send_packet () {
6980 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)'
6981 }
6982
6983 # OpenFlow 1.0, implicit reset_counts
6984 send_packet
6985 warp_and_dump_NXM 1 1 54 1
6986 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 add-flow br0 $flow])
6987 # add-flow resets duration and counts,
6988 # but idle age is inherited from the old flow
6989 warp_and_dump_NXM 1 0 0 2
6990
6991 send_packet
6992 warp_and_dump_NXM 2 1 54 1
6993 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow10 mod-flows br0 $flow])
6994 # mod-flows resets hard_age, but not counts
6995 # but duration and idle_age is inherited from the old flow
6996 warp_and_dump_NXM 3 1 54 2 1
6997
6998 # OpenFlow 1.1, implicit reset_counts
6999 send_packet
7000 warp_and_dump_OF 11 4 2 108
7001 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 add-flow br0 $flow])
7002 # add-flow resets duration and counts,
7003 # but idle age is inherited from the old flow
7004 warp_and_dump_NXM 1 0 0 2
7005 warp_and_dump_OF 11 2 0 0
7006
7007 send_packet
7008 warp_and_dump_OF 11 3 1 54
7009 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow11 mod-flows br0 $flow])
7010 # mod-flows resets hard_age, but not counts
7011 # but duration and idle_age is inherited from the old flow
7012 warp_and_dump_NXM 4 1 54 2 1
7013 warp_and_dump_OF 11 5 1 54
7014
7015 # OpenFlow 1.2, explicit reset_counts
7016 send_packet
7017 warp_and_dump_OF 12 6 2 108
7018 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 $flow])
7019 # add-flow without flags resets duration, but not counts,
7020 # idle age is inherited from the old flow
7021 warp_and_dump_NXM 1 2 108 2
7022 warp_and_dump_OF 12 2 2 108
7023
7024 send_packet
7025 warp_and_dump_OF 12 3 3 162
7026 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 $flow])
7027 # mod-flows without flags does not reset duration nor counts,
7028 # idle age is inherited from the old flow
7029 warp_and_dump_NXM 4 3 162 2 1
7030 warp_and_dump_OF 12 5 3 162
7031
7032 send_packet
7033 warp_and_dump_OF 12 6 4 216
7034 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 add-flow br0 reset_counts,$flow])
7035 # add-flow with reset_counts resets both duration and counts,
7036 # idle age is inherited from the old flow
7037 warp_and_dump_NXM 1 0 0 2
7038 warp_and_dump_OF 12 2 0 0
7039
7040 send_packet
7041 warp_and_dump_OF 12 3 1 54
7042 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow12 mod-flows br0 reset_counts,$flow])
7043 # mod-flows with reset_counts resets counts, but not duration,
7044 # idle age is inherited from the old flow
7045 warp_and_dump_NXM 4 0 0 2 1
7046 warp_and_dump_OF 12 5 0 0
7047
7048 # OpenFlow > 1.3, explicit reset_counts
7049 flow_mods_reset_counts () {
7050 # Reset to a known state
7051 AT_CHECK([ovs-ofctl add-flow br0 $flow])
7052
7053 send_packet
7054 warp_and_dump_OF $1 1 1 54 reset_counts
7055 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7056 # add-flow without flags resets duration, but not counts,
7057 # idle age is inherited from the old flow
7058 warp_and_dump_NXM 1 1 54 2
7059 warp_and_dump_OF $1 2 1 54
7060
7061 send_packet
7062 warp_and_dump_OF $1 3 2 108
7063 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7064 # mod-flows without flags does not reset duration nor counts,
7065 # idle age is inherited from the old flow
7066 warp_and_dump_NXM 4 2 108 2 1
7067 warp_and_dump_OF $1 5 2 108
7068
7069 send_packet
7070 warp_and_dump_OF $1 6 3 162
7071 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 reset_counts,$flow])
7072 # add-flow with reset_counts resets both duration and counts,
7073 # idle age is inherited from the old flow
7074 warp_and_dump_NXM 1 0 0 2
7075 warp_and_dump_OF $1 2 0 0 reset_counts
7076
7077 send_packet
7078 warp_and_dump_OF $1 3 1 54 reset_counts
7079 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7080 # mod-flows with reset_counts resets counts, but not duration,
7081 # idle age is inherited from the old flow
7082 warp_and_dump_NXM 4 0 0 2 1
7083 warp_and_dump_OF $1 5 0 0 reset_counts
7084
7085 # Modify flow having reset_counts flag without reset_counts
7086 send_packet
7087 warp_and_dump_OF $1 6 1 54 reset_counts
7088 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 $flow])
7089 warp_and_dump_NXM 7 1 54 2 1
7090 warp_and_dump_OF $1 8 1 54 reset_counts
7091
7092 # Add flow having reset_counts flag without reset_counts
7093 send_packet
7094 warp_and_dump_OF $1 9 2 108 reset_counts
7095 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 add-flow br0 $flow])
7096 warp_and_dump_NXM 1 2 108 2
7097 warp_and_dump_OF $1 2 2 108
7098
7099 # Modify flow w/o reset_counts flag with a flow_mod having reset_counts
7100 send_packet
7101 warp_and_dump_OF $1 3 3 162
7102 AT_CHECK_UNQUOTED([ovs-ofctl -O OpenFlow$1 mod-flows br0 reset_counts,$flow])
7103 warp_and_dump_NXM 4 0 0 2 1
7104 warp_and_dump_OF $1 5 0 0
7105 }
7106
7107 # OpenFlow versions >= 1.3 should behave the same way
7108 flow_mods_reset_counts 13
7109 flow_mods_reset_counts 14
7110 flow_mods_reset_counts 15
7111
7112 OVS_VSWITCHD_STOP
7113 AT_CLEANUP
7114
7115 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
7116 OVS_VSWITCHD_START
7117 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
7118 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
7119
7120 ovs-appctl time/stop
7121
7122 for i in `seq 1 10`; do
7123 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)'
7124 done
7125
7126 ovs-appctl time/warp 100
7127 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
7128 ovs-appctl time/warp 1000
7129
7130 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7131 AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
7132 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
7133 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=540, idle_age=1, ip actions=NORMAL
7134 ])
7135 OVS_VSWITCHD_STOP
7136 AT_CLEANUP
7137
7138 AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
7139 OVS_VSWITCHD_START
7140
7141 # get_ages DURATION HARD IDLE
7142 #
7143 # Fetch the flow duration, hard age, and idle age into the variables
7144 # whose names are given as arguments. Rounds DURATION down to the
7145 # nearest integer. If hard_age doesn't appear in the output, sets
7146 # HARD to "none". If idle_age doesn't appear in the output, sets IDLE
7147 # to 0.
7148 get_ages () {
7149 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
7150
7151 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
7152 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
7153 AS_VAR_COPY([$1], [duration])
7154
7155 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
7156 if test X"$hard" = X; then
7157 hard=none
7158 else
7159 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
7160 fi
7161 AS_VAR_COPY([$2], [hard])
7162
7163 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
7164 if test X"$idle" = X; then
7165 idle=0
7166 else
7167 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
7168 fi
7169 AS_VAR_COPY([$3], [idle])
7170 }
7171
7172 # Add a flow and get its initial hard and idle age.
7173 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
7174 get_ages duration1 hard1 idle1
7175
7176 ovs-appctl time/stop
7177 # Warp time forward by 10 seconds, then modify the flow's actions.
7178 ovs-appctl time/warp 10000
7179 get_ages duration2 hard2 idle2
7180 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
7181
7182 # Warp time forward by 10 seconds.
7183 ovs-appctl time/warp 10000
7184 get_ages duration3 hard3 idle3
7185
7186 # Warp time forward 10 more seconds, then pass some packets through the flow,
7187 # then warp forward a few more times because idle times are only updated
7188 # occasionally.
7189 ovs-appctl time/warp 10000
7190 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)'
7191 ovs-appctl time/warp 3000 1000
7192 sleep 1
7193 get_ages duration4 hard4 idle4
7194
7195 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
7196 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
7197 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
7198
7199 # Duration should increase steadily over time.
7200 AT_CHECK([test $duration1 -lt $duration2])
7201 AT_CHECK([test $duration2 -lt $duration3])
7202 AT_CHECK([test $duration3 -lt $duration4])
7203
7204 # Hard age should be "none" initially because it's the same as flow_duration,
7205 # then it should increase.
7206 AT_CHECK([test $hard1 = none])
7207 AT_CHECK([test $hard2 = none])
7208 AT_CHECK([test $hard3 != none])
7209 AT_CHECK([test $hard4 != none])
7210 AT_CHECK([test $hard3 -lt $hard4])
7211
7212 # Idle age should increase from 1 to 2 to 3, then decrease.
7213 AT_CHECK([test $idle1 -lt $idle2])
7214 AT_CHECK([test $idle2 -lt $idle3])
7215 AT_CHECK([test $idle3 -gt $idle4])
7216
7217 # Check some invariant relationships.
7218 AT_CHECK([test $duration1 = $idle1])
7219 AT_CHECK([test $duration2 = $idle2])
7220 AT_CHECK([test $duration3 = $idle3])
7221 AT_CHECK([test $idle3 -gt $hard3])
7222 AT_CHECK([test $idle4 -lt $hard4])
7223 AT_CHECK([test $hard4 -lt $duration4])
7224
7225 OVS_VSWITCHD_STOP
7226 AT_CLEANUP
7227
7228 AT_SETUP([ofproto-dpif - fin_timeout])
7229 OVS_VSWITCHD_START
7230 ovs-appctl time/stop
7231 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
7232 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7233 [NXST_FLOW reply:
7234 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7235 ])
7236
7237 # Check that a TCP SYN packet does not change the timeout. (Because
7238 # flow stats updates are mainly what implements the fin_timeout
7239 # feature, we warp forward a couple of times to ensure that flow stats
7240 # run before re-checking the flow table.)
7241 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
7242 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7243 warped
7244 ])
7245 AT_CHECK([ovs-appctl revalidator/purge], [0])
7246 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7247 [NXST_FLOW reply:
7248 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
7249 ])
7250 # Check that a TCP FIN packet does change the timeout.
7251 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
7252 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
7253 warped
7254 ])
7255 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
7256 [NXST_FLOW reply:
7257 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
7258 ])
7259 OVS_VSWITCHD_STOP
7260 AT_CLEANUP
7261
7262 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
7263 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
7264 add_of_ports br0 1 2
7265 add_of_ports br1 3
7266
7267 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
7268 dummy@br0
7269 dummy@br1
7270 ])
7271 OVS_VSWITCHD_STOP
7272 AT_CLEANUP
7273
7274 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
7275 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy], [], [],
7276 [--dummy-numa="0,0,0,0,1,1,1,1"])
7277 add_pmd_of_ports br0 1 2
7278 add_of_ports br1 3
7279
7280 AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
7281 dummy@ovs-dummy: hit:0 missed:0
7282 br0:
7283 br0 65534/100: (dummy-internal)
7284 p1 1/1: (dummy-pmd: <cleared>)
7285 p2 2/2: (dummy-pmd: <cleared>)
7286 br1:
7287 br1 65534/101: (dummy-internal)
7288 p3 3/3: (dummy)
7289 ])
7290 OVS_VSWITCHD_STOP
7291 AT_CLEANUP
7292
7293 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
7294 # bump max-idle to avoid the flows being reclaimed behind us
7295 OVS_VSWITCHD_START([add-br br1 -- \
7296 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7297 set Open_vSwitch . other_config:max-idle=10000], [], [],
7298 [--dummy-numa="0,0,0,0,1,1,1,1"])
7299 add_of_ports br0 1
7300 add_pmd_of_ports br0 2
7301 add_of_ports br1 3
7302
7303 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)'])
7304 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)'])
7305 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)'])
7306 ovs-appctl revalidator/wait
7307 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
7308 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7309 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7310 ])
7311
7312 AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
7313 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7314 ])
7315
7316 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
7317 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
7318 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p2),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=0/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
7319 ])
7320
7321 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
7322 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(p3),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
7323 ])
7324
7325 OVS_VSWITCHD_STOP
7326 AT_CLEANUP
7327
7328 m4_define([OFPROTO_DPIF_GET_FLOW],
7329 [AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow$1])
7330
7331 OVS_VSWITCHD_START([add-br br1 -- \
7332 set bridge br1 datapath-type=dummy fail-mode=secure -- \
7333 set Open_vSwitch . other_config:max-idle=10000], [], [],
7334 [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7335
7336 func=`echo -n "$1_" | cut -c 4-`
7337 add_${func}of_ports br0 1 2
7338
7339 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)'])
7340 ovs-appctl revalidator/wait
7341 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
7342
7343 UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
7344 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
7345 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
7346 ])
7347
7348 OVS_VSWITCHD_STOP
7349 AT_CLEANUP])
7350
7351 OFPROTO_DPIF_GET_FLOW([])
7352 OFPROTO_DPIF_GET_FLOW([ - pmd])
7353
7354 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
7355 OVS_VSWITCHD_START([dnl
7356 add-port br0 p1 -- set Interface p1 type=dummy
7357 ])
7358 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7359 on_exit 'kill `cat ovs-ofctl.pid`'
7360
7361 AT_CAPTURE_FILE([ofctl_monitor.log])
7362 AT_DATA([flows.txt], [dnl
7363 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
7364 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
7365 ])
7366 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7367
7368 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
7369 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
7370 dnl
7371 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
7372 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)
7373 dnl (label 20, exp 0, [S], ttl 32)
7374 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7375 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7376
7377 for dl_src in 00 01; do
7378 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"])
7379 done
7380 sleep 1 # wait for the datapath flow installed
7381 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7382 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:00),eth_type(0x8847),mpls(label=20,tc=0,ttl=32,bos=0,label=20,tc=0,ttl=32,bos=1), actions:userspace(pid=0,slow_path(controller))
7383 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:01),eth_type(0x8847),mpls(label=20/0x0,tc=0/0,ttl=32/0x0,bos=0/1,label=20/0xfffff,tc=0/7,ttl=32/0xff,bos=1/1), actions:userspace(pid=0,slow_path(controller))
7384 ])
7385
7386 OVS_VSWITCHD_STOP
7387 AT_CLEANUP
7388
7389
7390 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
7391 OVS_VSWITCHD_START([dnl
7392 add-port br0 p1 -- set Interface p1 type=dummy
7393 ])
7394 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7395 on_exit 'kill `cat ovs-ofctl.pid`'
7396
7397 AT_CAPTURE_FILE([ofctl_monitor.log])
7398 AT_DATA([flows.txt], [dnl
7399 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
7400 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
7401 ])
7402 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7403
7404 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
7405 dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
7406 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
7407 dnl
7408 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
7409 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)
7410 dnl (label 20, exp 0, ttl 32)
7411 dnl (label 20, exp 0, ttl 32)
7412 dnl (label 20, exp 0, [S], ttl 32)
7413 dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
7414 dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
7415
7416 for dl_src in 00 01; do
7417 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"])
7418 done
7419 sleep 1 # wait for the datapath flow installed
7420 AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7421 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:00),eth_type(0x8847),mpls(label=20,tc=0,ttl=32,bos=0,label=20,tc=0,ttl=32,bos=1), actions:userspace(pid=0,slow_path(controller))
7422 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=60:66:66:66:66:01),eth_type(0x8847),mpls(label=20/0x0,tc=0/0,ttl=32/0x0,bos=0/1,label=20/0xfffff,tc=0/7,ttl=32/0xff,bos=1/1), actions:userspace(pid=0,slow_path(controller))
7423 ])
7424
7425 OVS_VSWITCHD_STOP
7426 AT_CLEANUP
7427
7428 AT_SETUP([ofproto-dpif - patch ports])
7429 OVS_VSWITCHD_START([add-br br1 \
7430 -- set bridge br1 datapath-type=dummy fail-mode=secure \
7431 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
7432 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
7433
7434 add_of_ports br0 2
7435 add_of_ports br1 3
7436
7437 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7438 ], [])
7439 AT_CHECK([ovs-appctl time/stop])
7440 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7441
7442 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
7443 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
7444
7445 for i in $(seq 1 10); do
7446 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)'
7447 if [[ $i -eq 1 ]]; then
7448 sleep 1
7449 fi
7450 done
7451
7452 for i in $(seq 1 5); do
7453 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)'
7454 if [[ $i -eq 1 ]]; then
7455 sleep 1
7456 fi
7457 done
7458
7459 AT_CHECK([ovs-appctl time/warp 500], [0],
7460 [warped
7461 ])
7462 sleep 1 # wait for log writer
7463
7464 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
7465 dummy@ovs-dummy: hit:13 missed:2
7466 br0:
7467 br0 65534/100: (dummy-internal)
7468 p2 2/2: (dummy)
7469 pbr0 1/none: (patch: peer=pbr1)
7470 br1:
7471 br1 65534/101: (dummy-internal)
7472 p3 3/3: (dummy)
7473 pbr1 1/none: (patch: peer=pbr0)
7474 ])
7475
7476 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7477 recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:101,3,2
7478 recirc_id(0),in_port(101),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:100,2,3
7479 ])
7480
7481 AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
7482 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(100),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:9, bytes:378, used:0.0s, actions:101,3,2
7483 ])
7484 AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
7485 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(101),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:4, bytes:168, used:0.0s, actions:100,2,3
7486 ])
7487
7488 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
7489 OFPST_PORT reply (xid=0x4): 1 ports
7490 port 1: rx pkts=5, bytes=210, drop=?, errs=?, frame=?, over=?, crc=?
7491 tx pkts=10, bytes=420, drop=?, errs=?, coll=?
7492 ])
7493
7494 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
7495 OFPST_PORT reply (xid=0x4): 1 ports
7496 port 1: rx pkts=10, bytes=420, drop=?, errs=?, frame=?, over=?, crc=?
7497 tx pkts=5, bytes=210, drop=?, errs=?, coll=?
7498 ])
7499
7500 OVS_VSWITCHD_STOP
7501 AT_CLEANUP
7502
7503 AT_SETUP([ofproto-dpif - patch ports - stack])
7504 OVS_VSWITCHD_START([add-br br1 \
7505 -- set bridge br1 datapath-type=dummy fail-mode=secure \
7506 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
7507 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
7508
7509 add_of_ports br0 2
7510 add_of_ports br1 3
7511
7512 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
7513 ], [])
7514 AT_CHECK([ovs-appctl time/stop])
7515 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7516
7517 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"])
7518 # Try to pop from empty stack, and push and leave data to stack.
7519 AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
7520
7521 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)'
7522
7523 AT_CHECK([ovs-appctl time/warp 500], [0],
7524 [warped
7525 ])
7526
7527 OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
7528
7529 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
7530 dummy@ovs-dummy: hit:0 missed:1
7531 br0:
7532 br0 65534/100: (dummy-internal)
7533 p2 2/2: (dummy)
7534 pbr0 1/none: (patch: peer=pbr1)
7535 br1:
7536 br1 65534/101: (dummy-internal)
7537 p3 3/3: (dummy)
7538 pbr1 1/none: (patch: peer=pbr0)
7539 ])
7540
7541 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7542 recirc_id(0),in_port(100),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:101,set(ipv4(src=255.255.255.254)),2
7543 ])
7544
7545 AT_CHECK([grep -e '|ofproto_dpif_xlate|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
7546 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
7547 ])
7548
7549 OVS_VSWITCHD_STOP(["/stack underflow/d"])
7550 AT_CLEANUP
7551
7552 AT_SETUP([ofproto-dpif - port duration])
7553 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
7554 add_of_ports br0 1 2
7555
7556 ovs-appctl time/stop
7557 ovs-appctl time/warp 10000
7558
7559 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
7560 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
7561 [dnl
7562 duration=?s
7563 duration=?s
7564 duration=?s
7565 ])
7566 OVS_VSWITCHD_STOP
7567 AT_CLEANUP
7568
7569 dnl ----------------------------------------------------------------------
7570 AT_BANNER([ofproto-dpif -- megaflows])
7571
7572 AT_SETUP([ofproto-dpif megaflow - port classification])
7573 OVS_VSWITCHD_START
7574 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7575 add_of_ports br0 1 2
7576 AT_DATA([flows.txt], [dnl
7577 table=0 in_port=1 actions=output(2)
7578 ])
7579 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7580 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)'])
7581 sleep 1
7582 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)'])
7583 sleep 1
7584 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7585 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
7586 ])
7587 OVS_VSWITCHD_STOP
7588 AT_CLEANUP
7589
7590 AT_SETUP([ofproto-dpif megaflow - L2 classification])
7591 OVS_VSWITCHD_START
7592 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7593 add_of_ports br0 1 2
7594 AT_DATA([flows.txt], [dnl
7595 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
7596 ])
7597 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7598 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)'])
7599 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)'])
7600 sleep 1
7601 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7602 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7603 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7604 ])
7605 OVS_VSWITCHD_STOP
7606 AT_CLEANUP
7607
7608 AT_SETUP([ofproto-dpif megaflow - L3 classification])
7609 OVS_VSWITCHD_START
7610 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7611 add_of_ports br0 1 2
7612 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], [])
7613 AT_DATA([flows.txt], [dnl
7614 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
7615 ])
7616 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
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),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
7622 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,frag=no), actions: <del>
7623 ])
7624 OVS_VSWITCHD_STOP
7625 AT_CLEANUP
7626
7627 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
7628 OVS_VSWITCHD_START
7629 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7630 add_of_ports br0 1 2
7631 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], [])
7632 AT_DATA([flows.txt], [dnl
7633 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
7634 ])
7635 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7636 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)'])
7637 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)'])
7638 sleep 1
7639 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7640 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5,frag=no), actions: <del>
7641 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(src=2001:db8:3c4d:5:4:3:2:1/ffff:ffff:ffff:fffc::,frag=no), actions: <del>
7642 ])
7643 OVS_VSWITCHD_STOP
7644 AT_CLEANUP
7645
7646 AT_SETUP([ofproto-dpif megaflow - L4 classification])
7647 OVS_VSWITCHD_START
7648 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7649 add_of_ports br0 1 2
7650 AT_DATA([flows.txt], [dnl
7651 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
7652 ])
7653 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7654 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)'])
7655 sleep 1
7656 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)'])
7657 sleep 1
7658 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7659 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=1,frag=no),icmp(type=8), actions: <del>
7660 ])
7661 OVS_VSWITCHD_STOP
7662 AT_CLEANUP
7663
7664 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL],
7665 [AT_SETUP([ofproto-dpif megaflow - normal$1])
7666 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
7667 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7668 func=`echo -n "$1_" | cut -c 4-`
7669 add_${func}of_ports br0 1 2
7670 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7671 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)'])
7672 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)'])
7673 sleep 1
7674 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7675 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
7676 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
7677 ])
7678 OVS_VSWITCHD_STOP
7679 AT_CLEANUP])
7680
7681 OFPROTO_DPIF_MEGAFLOW_NORMAL([])
7682 OFPROTO_DPIF_MEGAFLOW_NORMAL([ - pmd])
7683
7684 AT_SETUP([ofproto-dpif megaflow - mpls])
7685 OVS_VSWITCHD_START
7686 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7687 add_of_ports br0 1 2
7688 AT_DATA([flows.txt], [dnl
7689 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
7690 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
7691 ])
7692 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7693 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)'])
7694 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)'])
7695 sleep 1
7696 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
7697 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1), actions:push_mpls(label=11,tc=3,ttl=64,bos=0,eth_type=0x8847),2
7698 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x8847),mpls(label=11/0x0,tc=3/0,ttl=64/0x0,bos=1/1), actions:pop_mpls(eth_type=0x800),2
7699 ])
7700 OVS_VSWITCHD_STOP
7701 AT_CLEANUP
7702
7703 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
7704 m4_define([CHECK_MEGAFLOW_NETFLOW],
7705 [OVS_VSWITCHD_START
7706 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7707 add_of_ports br0 1 2
7708
7709 dnl NetFlow configuration disables wildcarding relevant fields
7710 on_exit 'kill `cat test-netflow.pid`'
7711 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
7712 AT_CAPTURE_FILE([netflow.log])
7713 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
7714 ovs-vsctl \
7715 set Bridge br0 netflow=@nf -- \
7716 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
7717 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
7718
7719 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7720 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)'])
7721 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)'])
7722 sleep 1
7723 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7724 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
7725 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0/0xfc,frag=no),icmp(type=8,code=0), actions: <del>
7726 ])
7727 OVS_APP_EXIT_AND_WAIT([test-netflow])
7728 OVS_VSWITCHD_STOP])
7729
7730 AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
7731 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
7732 AT_CLEANUP
7733
7734 AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
7735 AT_SKIP_IF([test $HAVE_IPV6 = no])
7736 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
7737 AT_CLEANUP
7738
7739 m4_define([OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND],
7740 [AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding - $1])
7741 OVS_VSWITCHD_START(
7742 [add-port br0 p1 -- set Interface p1 type=$1 ofport_request=1 -- \
7743 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
7744 set interface p2 type=$1 ofport_request=2 -- \
7745 set interface p3 type=$1 ofport_request=3], [], [],
7746 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
7747 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7748 ])
7749 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7750
7751 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7752 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)'])
7753 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)'])
7754 sleep 1
7755 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7756 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
7757 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
7758 ])
7759 OVS_VSWITCHD_STOP
7760 AT_CLEANUP])
7761
7762 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy])
7763 OFPROTO_DPIF_MEGAFLOW_NORMAL_ACB_BOND([dummy-pmd])
7764
7765 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
7766 OVS_VSWITCHD_START(
7767 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
7768 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
7769 set interface p2 type=dummy ofport_request=2 -- \
7770 set interface p3 type=dummy ofport_request=3])
7771 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7772 ])
7773 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7774
7775 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7776 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)'])
7777 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)'])
7778 sleep 1
7779 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7780 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
7781 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
7782 ])
7783 OVS_VSWITCHD_STOP
7784 AT_CLEANUP
7785
7786 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
7787 # Create bond0 on br0 with interfaces p0 and p1
7788 # and bond1 on br1 with interfaces p2 and p3
7789 # with p0 patched to p2 and p1 patched to p3.
7790 OVS_VSWITCHD_START(
7791 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
7792 other-config:lacp-time=fast \
7793 other-config:bond-rebalance-interval=0 -- \
7794 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
7795 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
7796 add-br br1 -- \
7797 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
7798 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
7799 fail-mode=secure -- \
7800 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
7801 other-config:lacp-time=fast \
7802 other-config:bond-rebalance-interval=0 -- \
7803 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
7804 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
7805
7806 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
7807 ])
7808 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7809 add_of_ports br0 7
7810 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
7811 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
7812 ovs-appctl time/stop
7813 ovs-appctl time/warp 5000
7814 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)'])
7815 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)'])
7816 sleep 1
7817 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7818 recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
7819 recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
7820 ])
7821 OVS_VSWITCHD_STOP
7822 AT_CLEANUP
7823
7824 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
7825 OVS_VSWITCHD_START
7826 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7827 add_of_ports br0 1 2
7828 AT_DATA([flows.txt], [dnl
7829 table=0 in_port=1,ip actions=resubmit(90)
7830 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
7831 ])
7832 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7833 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)'])
7834 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)'])
7835 sleep 1
7836 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7837 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7838 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7839 ])
7840 OVS_VSWITCHD_STOP
7841 AT_CLEANUP
7842
7843 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
7844 OVS_VSWITCHD_START
7845 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7846 add_of_ports br0 1 2
7847 AT_DATA([flows.txt], [dnl
7848 table=0 in_port=1,ip actions=resubmit(,1)
7849 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
7850 ])
7851 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7852 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)'])
7853 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=
7854 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
7855 sleep 1
7856 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7857 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7858 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7859 ])
7860 OVS_VSWITCHD_STOP
7861 AT_CLEANUP
7862
7863 AT_SETUP([ofproto-dpif megaflow - goto_table action])
7864 OVS_VSWITCHD_START
7865 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7866 add_of_ports br0 1 2
7867 AT_DATA([flows.txt], [dnl
7868 table=0 in_port=1,ip actions=goto_table(1)
7869 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
7870 ])
7871 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
7872 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)'])
7873 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)'])
7874 sleep 1
7875 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7876 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7877 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7878 ])
7879 OVS_VSWITCHD_STOP
7880 AT_CLEANUP
7881
7882 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
7883 AT_KEYWORDS([mirror mirrors mirroring])
7884 OVS_VSWITCHD_START
7885 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7886 add_of_ports br0 1 2 3
7887 ovs-vsctl \
7888 set Bridge br0 mirrors=@m --\
7889 --id=@p3 get Port p3 --\
7890 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
7891
7892 AT_DATA([flows.txt], [dnl
7893 in_port=1 actions=output:2
7894 ])
7895 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7896 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)'])
7897 sleep 1
7898 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)'])
7899 sleep 1
7900 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7901 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
7902 ])
7903 OVS_VSWITCHD_STOP
7904 AT_CLEANUP
7905
7906 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
7907 OVS_VSWITCHD_START
7908 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7909 add_of_ports br0 1 2 3
7910 ovs-vsctl \
7911 set Bridge br0 mirrors=@m --\
7912 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
7913 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
7914
7915 AT_DATA([flows.txt], [dnl
7916 in_port=1 actions=output:2
7917 ])
7918 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7919 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))'])
7920 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)'])
7921 sleep 1
7922 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7923 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del>
7924 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=11,pcp=7/0x0),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
7925 ])
7926 OVS_VSWITCHD_STOP
7927 AT_CLEANUP
7928
7929 AT_SETUP([ofproto-dpif megaflow - move action])
7930 OVS_VSWITCHD_START
7931 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7932 add_of_ports br0 1 2
7933 AT_DATA([flows.txt], [dnl
7934 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
7935 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
7936 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
7937 ])
7938 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7939 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)'])
7940 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)'])
7941 sleep 1
7942 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7943 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
7944 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
7945 ])
7946 OVS_VSWITCHD_STOP
7947 AT_CLEANUP
7948
7949 AT_SETUP([ofproto-dpif megaflow - push action])
7950 OVS_VSWITCHD_START
7951 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7952 add_of_ports br0 1 2
7953 AT_DATA([flows.txt], [dnl
7954 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
7955 ])
7956 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7957 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)'])
7958 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)'])
7959 sleep 1
7960 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7961 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2,frag=no), actions: <del>
7962 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,frag=no), actions: <del>
7963 ])
7964 OVS_VSWITCHD_STOP
7965 AT_CLEANUP
7966
7967 AT_SETUP([ofproto-dpif megaflow - learning])
7968 OVS_VSWITCHD_START
7969 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7970 add_of_ports br0 1 2
7971 AT_DATA([flows.txt], [dnl
7972 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
7973 ])
7974 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
7975 ovs-appctl time/stop
7976 # We send each packet twice because the first packet in each flow causes the
7977 # flow table to change and thus revalidations, which (depending on timing)
7978 # can keep a megaflow from being installed. The revalidations are done by
7979 # the second iteration, allowing the flows to be installed.
7980 for i in 1 2; 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 ovs-appctl time/warp 100
7984 done
7985 sleep 1
7986 dnl The original flow is missing due to a revalidation.
7987 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
7988 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09),eth_type(0x0800),ipv4(frag=no), actions: <del>
7989 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b),eth_type(0x0800),ipv4(frag=no), actions: <del>
7990 ])
7991 OVS_VSWITCHD_STOP
7992 AT_CLEANUP
7993
7994 AT_SETUP([ofproto-dpif megaflow - tunnels])
7995 OVS_VSWITCHD_START(
7996 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
7997 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7998 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
7999 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
8000 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
8001 ofport_request=3])
8002 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
8003 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
8004 ofport_request=4 options:key=flow])
8005 AT_DATA([flows.txt], [dnl
8006 in_port=1,actions=output(2)
8007 in_port=3,actions=output(4)
8008 ])
8009 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8010 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
8011 dnl will cause the packet to be dropped.
8012 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)'])
8013 sleep 1
8014 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)'])
8015 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)'])
8016 sleep 1
8017 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)'])
8018 sleep 1
8019 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8020 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd/0x3,frag=no), actions: <del>
8021 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0x1,ttl=64,frag=no), actions: <del>
8022 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0xfd,ttl=128,frag=no), actions: <del>
8023 ])
8024 OVS_VSWITCHD_STOP
8025 AT_CLEANUP
8026
8027 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
8028 OVS_VSWITCHD_START
8029 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8030 add_of_ports br0 1 2
8031 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], [])
8032 AT_DATA([flows.txt], [dnl
8033 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
8034 ])
8035 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8036 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)'])
8037 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)'])
8038 sleep 1
8039 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
8040 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.2/255.255.255.252,frag=no), actions: <del>
8041 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=10.0.0.4,proto=1,ttl=64,frag=no), actions: <del>
8042 ])
8043 OVS_VSWITCHD_STOP
8044 AT_CLEANUP
8045
8046 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
8047 OVS_VSWITCHD_START
8048 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8049 add_of_ports br0 1 2
8050 AT_DATA([flows.txt], [dnl
8051 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
8052 ])
8053 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8054 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)'])
8055 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)'])
8056 sleep 1
8057 dnl The first packet is essentially a no-op, as the new destination MAC is the
8058 dnl same as the original. The second entry actually updates the destination
8059 dnl MAC.
8060 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8061 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions:2
8062 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions:set(eth(dst=50:54:00:00:00:0a)),2
8063 ])
8064 OVS_VSWITCHD_STOP
8065 AT_CLEANUP
8066
8067 m4_define([OFPROTO_DPIF_MEGAFLOW_DISABLED],
8068 [AT_SETUP([ofproto-dpif megaflow - disabled$1])
8069 OVS_VSWITCHD_START([], [], [], [m4_if([$1], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])])
8070 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8071 func=`echo -n "$1_" | cut -c 4-`
8072 add_${func}of_ports br0 1 2
8073 AT_DATA([flows.txt], [dnl
8074 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
8075 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
8076 ])
8077 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8078 ], [])
8079 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
8080 ], [])
8081 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
8082 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8083 for i in 1 2 3 4; do
8084 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)'])
8085 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)'])
8086 if [[ $i -eq 1 ]]; then
8087 sleep 1
8088 fi
8089 done
8090 sleep 1
8091 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8092 skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions:2
8093 skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions:drop
8094 ])
8095 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
8096 skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:126, used:0.0s, actions:2
8097 skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:126, used:0.0s, actions:drop
8098 ])
8099 OVS_VSWITCHD_STOP
8100 AT_CLEANUP])
8101
8102 OFPROTO_DPIF_MEGAFLOW_DISABLED([])
8103 OFPROTO_DPIF_MEGAFLOW_DISABLED([ - pmd])
8104
8105 AT_SETUP([ofproto-dpif - datapath port number change])
8106 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
8107 add_of_ports br0 1
8108
8109 # Trace a flow that should output to p1.
8110 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8111 [0], [stdout])
8112 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
8113 ])
8114
8115 # Change p1's port number to 5.
8116 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
8117
8118 # Trace a flow that should output to p1 in its new location.
8119 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
8120 [0], [stdout])
8121 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
8122 ])
8123 OVS_VSWITCHD_STOP
8124 AT_CLEANUP
8125
8126 # Tests the bundling with various bfd and cfm configurations.
8127 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
8128 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
8129 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
8130 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
8131 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
8132 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
8133 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
8134 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
8135 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
8136 set Interface p0 cfm_mpid=1 -- \
8137 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
8138
8139 ovs-appctl time/stop
8140 # advance the clock to stablize everything.
8141 ovs-appctl time/warp 5000 100
8142 # cfm/show should show 'recv' fault.
8143 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8144 fault: recv
8145 ])
8146 # bfd/show should show 'up'.
8147 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8148 Local Session State: up
8149 Remote Session State: up
8150 Local Session State: up
8151 Remote Session State: up
8152 ])
8153 # bond/show should show 'may-enable: true' for all slaves.
8154 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8155 may_enable: true
8156 may_enable: true
8157 may_enable: true
8158 may_enable: true
8159 ])
8160
8161 # now disable the bfd on p1.
8162 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
8163 # advance the clock to stablize everything.
8164 ovs-appctl time/warp 5000 100
8165 # cfm/show should show 'recv' fault.
8166 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8167 fault: recv
8168 ])
8169 # bfd/show should show 'down'.
8170 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8171 Local Session State: down
8172 Remote Session State: down
8173 ])
8174 # bond/show should show 'may-enable: false' for p0.
8175 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8176 may_enable: false
8177 may_enable: true
8178 ])
8179
8180 # now enable the bfd on p1 and disable bfd on p0.
8181 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
8182 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
8183 # advance the clock to stablize everything.
8184 ovs-appctl time/warp 5000 100
8185 # cfm/show should show 'recv' fault.
8186 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
8187 fault: recv
8188 ])
8189 # bfd/show should show 'down'.
8190 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
8191 Local Session State: down
8192 Remote Session State: down
8193 ])
8194 # bond/show should show 'may-enable: false' for p0 and p1.
8195 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
8196 may_enable: false
8197 may_enable: true
8198 may_enable: false
8199 may_enable: true
8200 ])
8201
8202 OVS_VSWITCHD_STOP
8203 AT_CLEANUP
8204
8205 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
8206 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
8207
8208 # enable bfd on p0.
8209 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8210 # check log.
8211 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8212 # disable bfd on p0.
8213 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8214 # check log.
8215 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8216 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])
8217
8218 # enable cfm on p0.
8219 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
8220 # check log.
8221 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8222 # disable cfm on p0.
8223 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
8224 # check log.
8225 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8226 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])
8227
8228 # enable both bfd and cfm on p0.
8229 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
8230 # check log.
8231 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
8232 # disable bfd on p0.
8233 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
8234 # check log, there should not be the log of thread terminated.
8235 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
8236 ])
8237 # reenable bfd on p0.
8238 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
8239 # check log, should still be on log of thread created.
8240 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
8241 monitor thread created
8242 ])
8243 # disable bfd and cfm together.
8244 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
8245 # check log.
8246 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
8247
8248 OVS_VSWITCHD_STOP
8249 AT_CLEANUP
8250
8251 # this test helps avoid the deadlock between the main thread and monitor thread.
8252 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
8253 OVS_VSWITCHD_START
8254
8255 for i in `seq 1 199`
8256 do
8257 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])
8258 done
8259
8260 OVS_VSWITCHD_STOP
8261 AT_CLEANUP
8262 \f
8263 AT_BANNER([ofproto-dpif - flow translation resource limits])
8264
8265 dnl Resubmits to later tables do not count against the depth limit, so we
8266 dnl can do 99 of them even though the maximum depth is 64.
8267 AT_SETUP([ofproto-dpif - forward resubmit])
8268 OVS_VSWITCHD_START
8269 (for i in `seq 0 99`; do
8270 j=`expr $i + 1`
8271 echo "table=$i, actions=resubmit(,$j)"
8272 done
8273 echo "table=100, actions=local") > flows
8274 AT_CHECK([ovs-ofctl add-flows br0 flows])
8275 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8276 [0], [stdout])
8277 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
8278 ])
8279 OVS_VSWITCHD_STOP
8280 AT_CLEANUP
8281
8282 dnl Resubmits to the same or an earlier table count against the depth limit,
8283 dnl so only 64 of them are allowed.
8284 AT_SETUP([ofproto-dpif - backward resubmit])
8285 OVS_VSWITCHD_START
8286 (echo "table=0, actions=resubmit(,66)"
8287 for i in `seq 2 66`; do
8288 j=`expr $i - 1`
8289 echo "table=$i, actions=resubmit(,$j)"
8290 done
8291 echo "table=1, actions=local") > flows
8292 AT_CHECK([ovs-ofctl add-flows br0 flows])
8293 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8294 [0], [stdout])
8295 AT_CHECK([tail -1 stdout], [0],
8296 [Translation failed (Recursion too deep), packet is dropped.
8297 ])
8298 AT_CHECK([grep -c 'over max translation depth 64' stdout],
8299 [0], [1
8300 ])
8301 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8302 AT_CLEANUP
8303
8304 AT_SETUP([ofproto-dpif - infinite resubmit])
8305 OVS_VSWITCHD_START
8306 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
8307 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
8308 [0], [stdout])
8309 AT_CHECK([tail -1 stdout], [0],
8310 [Translation failed (Recursion too deep), packet is dropped.
8311 ])
8312 AT_CHECK([grep -c 'over max translation depth 64' stdout],
8313 [0], [1
8314 ])
8315 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
8316 AT_CLEANUP
8317
8318 AT_SETUP([ofproto-dpif - exponential resubmit chain])
8319 OVS_VSWITCHD_START
8320 add_of_ports br0 1
8321 (for i in `seq 1 64`; do
8322 j=`expr $i + 1`
8323 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8324 done
8325 echo "in_port=65, actions=local") > flows
8326 AT_CHECK([ovs-ofctl add-flows br0 flows])
8327 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8328 AT_CHECK([tail -1 stdout], [0],
8329 [Translation failed (Too many resubmits), packet is dropped.
8330 ])
8331 AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
8332 ])
8333 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
8334 AT_CLEANUP
8335
8336 AT_SETUP([ofproto-dpif - too many output actions])
8337 OVS_VSWITCHD_START
8338 add_of_ports br0 1
8339 (for i in `seq 1 12`; do
8340 j=`expr $i + 1`
8341 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8342 done
8343 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
8344 AT_CHECK([ovs-ofctl add-flows br0 flows])
8345 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8346 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
8347 [0], [1
8348 ])
8349 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
8350 ])
8351 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
8352 AT_CLEANUP
8353
8354 AT_SETUP([ofproto-dpif - stack too deep])
8355 OVS_VSWITCHD_START
8356 add_of_ports br0 1
8357 (for i in `seq 1 12`; do
8358 j=`expr $i + 1`
8359 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
8360 done
8361 push="push:NXM_NX_REG0[[]]"
8362 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
8363 AT_CHECK([ovs-ofctl add-flows br0 flows])
8364 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
8365 AT_CHECK([tail -1 stdout], [0],
8366 [Translation failed (Stack too deep), packet is dropped.
8367 ])
8368 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
8369 ])
8370 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
8371 AT_CLEANUP
8372
8373
8374 AT_SETUP([ofproto-dpif packet-out controller])
8375 OVS_VSWITCHD_START
8376 add_of_ports br0 1 2
8377
8378 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
8379
8380 AT_CAPTURE_FILE([ofctl_monitor.log])
8381 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8382
8383 for i in 1 2 3; do
8384 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
8385 done
8386
8387 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8388 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8389 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
8390 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8391 dnl
8392 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (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): total_len=14 in_port=CONTROLLER (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 ])
8398
8399 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
8400 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8401 NXST_FLOW reply:
8402 ])
8403
8404 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8405 table 0:
8406 active=1, lookup=0, matched=0
8407
8408 table 1:
8409 active=0, lookup=0, matched=0
8410 "
8411 for i in `seq 2 253`; do
8412 printf ' table %d: ditto\n' $i
8413 done) > expout
8414 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8415
8416 OVS_VSWITCHD_STOP
8417 AT_CLEANUP
8418
8419 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
8420 OVS_VSWITCHD_START(
8421 [-- \
8422 add-port br0 p1 -- \
8423 set interface p1 type=patch options:peer=p2 -- \
8424 add-br br1 -- \
8425 set bridge br1 datapath-type=dummy -- \
8426 set bridge br1 fail-mode=secure -- \
8427 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
8428 add-port br1 p2 -- \
8429 set interface p2 type=patch options:peer=p1 --])
8430
8431 AT_CAPTURE_FILE([ofctl_monitor.log])
8432 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8433
8434 for i in 1 2 3; do
8435 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
8436 done
8437
8438 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8439 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8440 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
8441 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8442 dnl
8443 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) 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): cookie=0x0 total_len=14 in_port=1 (via no_match) 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 ])
8449
8450 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8451 table 0:
8452 active=0, lookup=0, matched=0
8453 "
8454 for i in `seq 1 253`; do
8455 printf ' table %d: ditto\n' $i
8456 done) > expout
8457 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
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=0, lookup=0, matched=0
8465 "
8466 for i in `seq 2 253`; do
8467 printf ' table %d: ditto\n' $i
8468 done) > expout
8469 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
8470
8471 OVS_VSWITCHD_STOP
8472 AT_CLEANUP
8473
8474 AT_SETUP([ofproto-dpif packet-out pipeline match field (OpenFlow 1.5)])
8475 OVS_VSWITCHD_START
8476
8477 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=8}->tun_metadata2"])
8478 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata3"])
8479 AT_DATA([flows.txt], [dnl
8480 table=0,in_port=1 actions=controller
8481 table=0,tun_id=3 actions=controller
8482 table=0,metadata=5 actions=controller
8483 table=0,reg0=1,reg4=2,reg8=3,reg12=5 actions=controller
8484 table=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 actions=controller
8485 table=0,tun_metadata3=0x11 actions=controller
8486 ])
8487 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
8488
8489 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
8490 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
8491 ovs-appctl -t ovs-ofctl ofctl/barrier
8492 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
8493 AT_CAPTURE_FILE([monitor.log])
8494
8495 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=1 packet=0001020304050010203040501111 actions=table"])
8496 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tunnel_id=3 packet=0001020304050010203040502222 actions=table"])
8497 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,metadata=5 packet=0001020304050010203040503333 actions=table"])
8498 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,reg0=1,reg4=2,reg8=3,reg12=5 packet=0001020304050010203040503333 actions=table"])
8499 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=0x01,tun_gbp_flags=0x03 packet=0001020304050010203040503333 actions=table"])
8500 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=2,tun_metadata2=0x22,tun_metadata3=0x11 packet=0001020304050010203040503333 actions=table"])
8501
8502 ovs-appctl -t ovs-ofctl ofctl/barrier
8503 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8504
8505 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
8506 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 in_port=1 (via packet_out) data_len=14 (unbuffered)
8507 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1111
8508 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_id=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
8509 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x2222
8510 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 metadata=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
8511 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
8512 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 reg0=0x1,reg4=0x2,reg8=0x3,reg12=0x5,in_port=2 (via packet_out) data_len=14 (unbuffered)
8513 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
8514 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_gbp_id=1,tun_gbp_flags=0x3,in_port=2 (via packet_out) data_len=14 (unbuffered)
8515 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
8516 OFPT_PACKET_IN (OF1.5): cookie=0x0 total_len=14 tun_metadata2=0x22,tun_metadata3=0x11,in_port=2 (via packet_out) data_len=14 (unbuffered)
8517 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x3333
8518 OFPT_BARRIER_REPLY (OF1.5):
8519 ])
8520
8521 OVS_VSWITCHD_STOP
8522 AT_CLEANUP
8523
8524 AT_SETUP([ofproto-dpif packet-out goto_table])
8525 OVS_VSWITCHD_START
8526 add_of_ports br0 1 2
8527
8528 AT_DATA([flows.txt], [dnl
8529 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
8530 table=1 dl_dst=50:54:00:00:00:0a actions=controller
8531 ])
8532 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
8533
8534 AT_CAPTURE_FILE([ofctl_monitor.log])
8535 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8536
8537 for i in 1 2 3; do
8538 ovs-appctl 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)'
8539 done
8540
8541 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
8542 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8543 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8544 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8545 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8546 dnl
8547 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8548 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8549 dnl
8550 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8551 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8552 ])
8553
8554 AT_CHECK([ovs-appctl revalidator/purge], [0])
8555 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
8556 n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=goto_table:1
8557 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8558 OFPST_FLOW reply (OF1.3):
8559 ])
8560
8561 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8562 table 0:
8563 active=1, lookup=3, matched=3
8564
8565 table 1: ditto
8566 table 2:
8567 active=0, lookup=0, matched=0
8568 "
8569 for i in `seq 3 253`; do
8570 printf ' table %d: ditto\n' $i
8571 done) > expout
8572 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8573
8574 OVS_VSWITCHD_STOP
8575 AT_CLEANUP
8576
8577
8578 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
8579 OVS_VSWITCHD_START
8580 add_of_ports br0 1 2
8581
8582 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
8583 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
8584
8585 AT_CAPTURE_FILE([ofctl_monitor.log])
8586 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8587
8588 for i in 1 2 3; do
8589 ovs-appctl 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)'
8590 done
8591
8592 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
8593 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8594 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8595 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8596 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8597 dnl
8598 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8599 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8600 dnl
8601 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=14 in_port=1 (via action) data_len=14 (unbuffered)
8602 vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
8603 ])
8604
8605 AT_CHECK([ovs-appctl revalidator/purge], [0])
8606 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
8607 table=1, n_packets=3, n_bytes=42, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
8608 OFPST_FLOW reply (OF1.1):
8609 ])
8610
8611 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
8612 table 0:
8613 active=0, lookup=3, matched=0
8614
8615 table 1:
8616 active=1, lookup=3, matched=3
8617
8618 table 2:
8619 active=0, lookup=0, matched=0
8620 "
8621 for i in `seq 3 253`; do
8622 printf ' table %d: ditto\n' $i
8623 done) > expout
8624 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
8625
8626 OVS_VSWITCHD_STOP
8627 AT_CLEANUP
8628
8629 AT_SETUP([ofproto-dpif - ICMPv6])
8630 OVS_VSWITCHD_START
8631 add_of_ports br0 1
8632
8633 AT_CAPTURE_FILE([ofctl_monitor.log])
8634
8635 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8636
8637 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
8638
8639 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8640
8641 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8642 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
8643 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
8644 ])
8645
8646 OVS_VSWITCHD_STOP
8647 AT_CLEANUP
8648
8649 AT_SETUP([ofproto-dpif - ICMPv6 type match])
8650 OVS_VSWITCHD_START
8651 add_of_ports br0 1 2 3
8652
8653 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
8654 AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
8655
8656 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8657
8658 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)'])
8659 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)'])
8660 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)'])
8661 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)'])
8662
8663 AT_CHECK([ovs-appctl revalidator/purge], [0])
8664
8665 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
8666 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128), actions:2
8667 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129), actions:3
8668 ])
8669
8670 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
8671 n_packets=2, n_bytes=124, icmp6,icmp_type=128 actions=output:2
8672 n_packets=2, n_bytes=124, icmp6,icmp_type=129 actions=output:3
8673 NXST_FLOW reply:
8674 ])
8675
8676 OVS_VSWITCHD_STOP
8677 AT_CLEANUP
8678
8679 AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
8680 OVS_VSWITCHD_START
8681 add_of_ports br0 1
8682 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])
8683
8684 AT_CAPTURE_FILE([ofctl_monitor.log])
8685
8686 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8687
8688 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
8689
8690 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
8691
8692 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8693 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
8694 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
8695 ])
8696
8697 OVS_VSWITCHD_STOP
8698 AT_CLEANUP
8699
8700 # Tests the exact match of CFI bit in installed datapath flows matching VLAN.
8701 AT_SETUP([ofproto-dpif - vlan matching])
8702 OVS_VSWITCHD_START(
8703 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
8704 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8705
8706 AT_CHECK([ovs-ofctl del-flows br0])
8707 AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
8708
8709 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))'])
8710
8711 OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
8712 AT_CHECK([grep 'in_port([[1]])' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
8713 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=10),encap(eth_type(0x0800),ipv4(frag=no)), actions: <del>
8714 ])
8715 OVS_VSWITCHD_STOP
8716 AT_CLEANUP
8717
8718 # Tests in place modification of installed datapath flows.
8719 AT_SETUP([ofproto-dpif - in place modification])
8720 OVS_VSWITCHD_START(
8721 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8722 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8723
8724 AT_CHECK([ovs-ofctl del-flows br0])
8725 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
8726
8727 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
8728
8729 ovs-appctl time/stop
8730
8731 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)'])
8732
8733 # Wait for the flow setup to be done.
8734 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
8735
8736 for i in 1 2; do
8737 ovs-appctl 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)'
8738 done
8739
8740 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8741 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
8742 ])
8743
8744 AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
8745
8746 ovs-appctl time/warp 500
8747 ovs-appctl time/warp 500
8748
8749 for i in 1 2 3; do
8750 ovs-appctl 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)'
8751 done
8752
8753 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8754 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
8755 ])
8756
8757 AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
8758 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:push_vlan(vid=4,pcp=0),100
8759 ])
8760 OVS_VSWITCHD_STOP
8761 AT_CLEANUP
8762
8763 # Tests in place modification of installed datapath flows with vlans.
8764 AT_SETUP([ofproto-dpif - in place modification (vlan)])
8765 OVS_VSWITCHD_START(
8766 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
8767 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
8768
8769 AT_CHECK([ovs-ofctl del-flows br0])
8770 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
8771
8772 ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
8773
8774 ovs-appctl time/stop
8775
8776 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)'])
8777
8778 # Check that a correct datapath flow is created.
8779 OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
8780
8781 for i in 1 2; do
8782 ovs-appctl 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)'
8783 done
8784
8785 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8786 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:2, bytes:28, used:0.0s, actions:100
8787 ])
8788
8789 # Delete the flow. Then check that the datapath flow is modified to
8790 # drop the packets. A modified flow inherits the stats, a new
8791 # datapath flow would start from sero.
8792 AT_CHECK([ovs-ofctl del-flows br0])
8793
8794 ovs-appctl time/warp 500
8795 ovs-appctl time/warp 500
8796
8797 for i in 1 2 3; do
8798 ovs-appctl 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)'
8799 done
8800
8801 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8802 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:5, bytes:70, used:0.0s, actions:drop
8803 ])
8804
8805 # Add a flow that matches the non-presence of a vlan tag, and check
8806 # that the datapath flow is modified accordingly.
8807 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
8808
8809 ovs-appctl time/warp 500
8810 ovs-appctl time/warp 500
8811
8812 for i in 1 2 3; do
8813 ovs-appctl 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)'
8814 done
8815
8816 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8817 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
8818 ])
8819
8820 # Check that VLAN packets will not hit the same datapath megaflow.
8821
8822 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))'])
8823 OVS_WAIT_UNTIL([grep 'flow_add:.*vlan(vid=99' ovs-vswitchd.log])
8824
8825 for i in 1 2; do
8826 ovs-appctl 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))'
8827 done
8828
8829 AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
8830 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), packets:8, bytes:112, used:0.0s, actions:100
8831 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:36, used:0.0s, actions:drop
8832 ])
8833
8834 # Check that the new flow matches the CFI bit, while both vid and pcp
8835 # are wildcarded.
8836 AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
8837 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x1234), actions:100
8838 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234)
8839 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:100
8840 dpif_netdev|DBG|flow_add: recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), actions:drop
8841 ])
8842 OVS_VSWITCHD_STOP
8843 AT_CLEANUP
8844
8845 AT_SETUP([ofproto-dpif - trace (unchanged)])
8846 OVS_VSWITCHD_START
8847 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
8848 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
8849 ])
8850 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
8851 AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
8852 ])
8853
8854 OVS_VSWITCHD_STOP
8855 AT_CLEANUP
8856
8857 AT_SETUP([ofproto-dpif - conntrack - controller])
8858 OVS_VSWITCHD_START
8859
8860 add_of_ports br0 1 2
8861
8862 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8863
8864 dnl Allow new UDP connections on p1 for dst port 2, drop everything else.
8865 AT_DATA([flows.txt], [dnl
8866 dnl Table 0
8867 dnl Store zone in reg4 and packet direction in reg3 (IN=1, OUT=2).
8868 dnl
8869 table=0,priority=100,arp,action=normal
8870 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)
8871 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)
8872 table=0,priority=1,action=drop
8873 dnl
8874 dnl Pass tracked traffic through ACL, drop everything else.
8875 dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers
8876 dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets
8877 dnl get the ACL lookup using the conntrack tuple and the inverted direction.
8878 dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
8879 dnl of the master connection, as storted in ct_mark.
8880 dnl
8881 dnl Incoming non-related packet in the original direction (ACL IN)
8882 table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5
8883 dnl Incoming non-related reply packet (CT ACL OUT)
8884 table=1 reg3=1, ip, ct_state=-rel+rpl+trk-inv action=set_field:2->reg0,resubmit(,3,ct),goto_table:4
8885 dnl Outgoing non-related packet (ACL OUT)
8886 table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit(,3),goto_table:5
8887 dnl Outgoing non-related reply packet (CT ACL IN)
8888 table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
8889 dnl
8890 dnl Related packet (CT ACL in the direction of the master connection.)
8891 table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
8892 dnl Drop everything else.
8893 table=1 priority=0, action=drop
8894 dnl
8895 dnl "ACL table"
8896 dnl
8897 dnl Stateful accept (1->reg2) all incoming (reg0=1) IP connections with
8898 dnl UDP destination port '2'. Store rule ID (1234) in reg1, verdict
8899 dnl in reg2.
8900 table=3 priority=10, reg0=1, udp, udp_dst=2 action=set_field:1234->reg1,set_field:1->reg2
8901 dnl Stateless drop (0->reg2) everything else in both directions. (Rule ID: 1235)
8902 table=3 priority=0, action=set_field:1235->reg1,set_field:0->reg2
8903 dnl
8904 dnl Re-process stateful traffic that was not accepted by a stateful rule as
8905 dnl normal traffic in the current direction. This should also delete the
8906 dnl now stale conntrack state, so that new state can be created in it's place.
8907 dnl
8908 dnl Stateful accepts go to next table.
8909 table=4 priority=100 reg2=1, action=goto_table:5
8910 dnl Everything else is reprocessed disregarding the CT state, using the actual
8911 dnl packet direction.
8912 table=4 priority=0 action=move:NXM_NX_REG3[[]]->NXM_NX_REG0[[]],resubmit(,3),goto_table:5
8913 dnl
8914 dnl "ACL verdict processing table."
8915 dnl
8916 dnl Handle stateful (reg2=1) / stateless (reg2=2) accepts and drops (reg2=0)
8917 dnl
8918 dnl Drop all non-accepted packets.
8919 table=5 reg2=0 priority=1000 action=drop
8920 dnl Commit new non-related IP connections.
8921 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
8922 dnl Commit new related connections in either direction, which inherit the mark
8923 dnl (the direction of the original direction master tuple) from the master
8924 dnl connection.
8925 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
8926 dnl Forward everything else, including stateless accepts.
8927 table=5 priority=0 action=goto_table:6
8928 dnl
8929 dnl "Forwarding table"
8930 dnl
8931 table=6 action=controller
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(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)'])
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(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)'])
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(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)'])
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 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8952 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=42 reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=42 (unbuffered)
8953 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
8954 dnl
8955 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)
8956 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
8957 ])
8958
8959 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8960
8961 dnl OK, now start a second connection from port 1
8962 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)'])
8963
8964 dnl Now try a reply from port 2.
8965 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)'])
8966
8967
8968 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
8969 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
8970
8971 dnl Check this output. We should see both packets
8972 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8973 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x0 total_len=42 reg0=0x1,reg1=0x4d2,reg2=0x1,reg3=0x1,reg4=0x1,in_port=1 (via action) data_len=42 (unbuffered)
8974 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
8975 dnl
8976 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)
8977 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
8978 ])
8979
8980 OVS_VSWITCHD_STOP
8981 AT_CLEANUP
8982
8983 AT_SETUP([ofproto-dpif - conntrack - force commit])
8984 OVS_VSWITCHD_START
8985
8986 add_of_ports br0 1 2
8987
8988 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
8989
8990 dnl Allow new connections on p1->p2, but not on p2->p1.
8991 AT_DATA([flows.txt], [dnl
8992 dnl Table 0
8993 dnl
8994 table=0,priority=100,arp,action=normal
8995 table=0,priority=10,in_port=1,udp,action=ct(commit),controller
8996 table=0,priority=10,in_port=2,udp,action=ct(table=1)
8997 table=0,priority=1,action=drop
8998 dnl
8999 dnl Table 1
9000 dnl
9001 table=1,priority=10,in_port=2,ct_state=+est,udp,action=ct(force,commit),controller
9002 table=1,priority=1,action=drop
9003 ])
9004
9005 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9006
9007 AT_CAPTURE_FILE([ofctl_monitor.log])
9008 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9009
9010 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)'])
9011
9012 dnl OK, now start a new connection from port 1.
9013 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)'])
9014
9015 dnl Now try a reply from port 2.
9016 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)'])
9017
9018 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9019 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9020
9021 dnl Check this output. We only see the latter two packets, not the first.
9022 dnl Note that the first packet doesn't have the ct_state bits set. This
9023 dnl happens because the ct_state field is available only after recirc.
9024 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9025 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9026 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
9027 dnl
9028 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 in_port=2 (via action) data_len=42 (unbuffered)
9029 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
9030 ])
9031
9032 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9033
9034 dnl OK, now start a second connection from port 1
9035 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)'])
9036
9037 dnl Now try a reply from port 2.
9038 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)'])
9039
9040 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9041 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9042
9043 dnl Check this output. We should see both packets
9044 dnl Note that the first packet doesn't have the ct_state bits set. This
9045 dnl happens because the ct_state field is available only after recirc.
9046 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9047 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9048 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
9049 dnl
9050 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 in_port=2 (via action) data_len=42 (unbuffered)
9051 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
9052 ])
9053
9054 dnl
9055 dnl Check that the directionality has been changed by force commit.
9056 dnl
9057 AT_CHECK([ovs-appctl dpctl/dump-conntrack | sort], [], [dnl
9058 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)
9059 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)
9060 ])
9061
9062 OVS_VSWITCHD_STOP
9063 AT_CLEANUP
9064
9065 AT_SETUP([ofproto-dpif - conntrack - ipv6])
9066 OVS_VSWITCHD_START
9067
9068 add_of_ports br0 1 2
9069
9070 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9071
9072 dnl Allow new connections on p1->p2, but not on p2->p1.
9073 AT_DATA([flows.txt], [dnl
9074 dnl Table 0
9075 dnl
9076 table=0,priority=100,arp,action=normal
9077 table=0,priority=10,in_port=1,udp6,action=ct(commit,zone=0),controller
9078 table=0,priority=10,in_port=2,udp6,action=ct(table=1,zone=0)
9079 table=0,priority=1,action=drop
9080 dnl Table 1
9081 dnl
9082 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp6,action=controller
9083 table=1,priority=1,action=drop
9084 ])
9085
9086 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9087
9088 AT_CAPTURE_FILE([ofctl_monitor.log])
9089 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9090
9091 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)'])
9092
9093 dnl OK, now start a new connection from port 1.
9094 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)'])
9095
9096 dnl Now try a reply from port 2.
9097 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)'])
9098
9099 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9100 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9101
9102 dnl Check this output. We only see the latter two packets, not the first.
9103 dnl Note that the first packet doesn't have the ct_state bits set. This
9104 dnl happens because the ct_state field is available only after recirc.
9105 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9106 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
9107 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
9108 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)
9109 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
9110 ])
9111
9112 OVS_VSWITCHD_STOP
9113 AT_CLEANUP
9114
9115 AT_SETUP([ofproto-dpif - conntrack - output action])
9116 OVS_VSWITCHD_START
9117
9118 add_of_ports br0 1 2
9119
9120 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9121
9122 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9123 AT_DATA([flows.txt], [dnl
9124 dnl The flows are in two separate tables for two reasons:
9125 dnl * To make the pipeline more clear.
9126 dnl * To make megaflows more consistent (we check megaflows below). The
9127 dnl unwildcarding in megaflows depends on the internal ordering of the
9128 dnl subtables, which are sorted using the system qsort(). qsort()
9129 dnl is provided by libc and may or may not be stable, so we can't rely
9130 dnl on that. By having separate tables we have more control over which
9131 dnl subtables are visited, meaning consistent megaflows.
9132 dnl
9133 dnl Table 0
9134 dnl
9135 table=0,priority=100,arp,action=normal
9136 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),2
9137 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9138 table=0,priority=1,action=drop
9139 dnl
9140 dnl Table 1
9141 dnl
9142 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=1
9143 table=1,priority=1,action=drop
9144 ])
9145
9146 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9147
9148
9149 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)'])
9150
9151 dnl OK, now start a new connection from port 1.
9152 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)'])
9153
9154 dnl Now try a reply from port 2.
9155 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)'])
9156
9157 dnl OK, now start a second connection from port 1
9158 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)'])
9159
9160 dnl Now try a reply from port 2.
9161 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)'])
9162
9163
9164 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9165 ct_state(+new-est+trk),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:drop
9166 ct_state(-new+est+trk),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:1
9167 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit),2
9168 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct,recirc(0x1)
9169 ])
9170
9171 OVS_VSWITCHD_STOP
9172 AT_CLEANUP
9173
9174 AT_SETUP([ofproto-dpif - conntrack - expiration])
9175 OVS_VSWITCHD_START
9176
9177 add_of_ports br0 1 2
9178
9179 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9180
9181 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9182 AT_DATA([flows.txt], [dnl
9183 dnl Table 0
9184 dnl
9185 table=0,priority=100,arp,action=normal
9186 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0)
9187 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9188 table=0,priority=1,action=drop
9189 dnl
9190 dnl Table 1
9191 dnl
9192 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9193 table=1,priority=1,action=drop
9194 ])
9195
9196 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9197
9198 AT_CAPTURE_FILE([ofctl_monitor.log])
9199 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9200
9201 AT_CHECK([ovs-appctl time/stop])
9202
9203 dnl Start a new connection from port 1.
9204 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)'])
9205
9206 dnl Now try a reply from port 2.
9207 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)'])
9208
9209 ovs-appctl time/warp 100000
9210
9211 dnl Now try another reply from port 2.
9212 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)'])
9213
9214 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 3])
9215 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9216
9217 dnl Check this output. Only one reply must be there
9218 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9219 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)
9220 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
9221 dnl
9222 OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
9223 ])
9224
9225 OVS_VSWITCHD_STOP
9226 AT_CLEANUP
9227
9228 AT_SETUP([ofproto-dpif - conntrack - untrackable traffic])
9229 OVS_VSWITCHD_START
9230
9231 add_of_ports br0 1 2
9232
9233 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9234
9235 AT_DATA([flows.txt], [dnl
9236 ipv6,ct_state=-trk,action=ct(table=0,zone=0)
9237 ct_state=+trk,action=controller
9238 ])
9239
9240 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9241
9242 AT_CAPTURE_FILE([ofctl_monitor.log])
9243 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9244
9245 AT_CHECK([ovs-appctl time/stop])
9246
9247 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'])
9248
9249 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 1])
9250 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9251
9252 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9253 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 ct_state=inv|trk,in_port=2 (via action) data_len=86 (unbuffered)
9254 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
9255 ])
9256
9257 OVS_VSWITCHD_STOP
9258 AT_CLEANUP
9259
9260 AT_SETUP([ofproto-dpif - conntrack - zones])
9261 OVS_VSWITCHD_START
9262
9263 add_of_ports br0 1 2 3 4
9264
9265 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9266
9267 dnl Allow new connections on p1->p2 or p3->p4.
9268 dnl Allow only established connections p2->p1 and p4->p3
9269 dnl p1,p2 and p3,p4 are on different zones
9270 AT_DATA([flows.txt], [dnl
9271 dnl Table 0
9272 dnl
9273 table=0,priority=100,arp,action=normal
9274 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller
9275 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9276 table=0,priority=10,in_port=3,udp,action=ct(commit,zone=1),controller
9277 table=0,priority=10,in_port=4,udp,action=ct(table=1,zone=1)
9278 table=0,priority=1,action=drop
9279 dnl
9280 dnl Table 1
9281 dnl
9282 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller
9283 table=1,priority=10,in_port=4,ct_state=+trk+est-new,udp,action=controller
9284 table=1,priority=1,action=drop
9285 ])
9286
9287 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9288
9289 AT_CAPTURE_FILE([ofctl_monitor.log])
9290 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9291
9292 dnl Basic "only established" test on ports 1,2
9293
9294 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)'])
9295 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)'])
9296 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)'])
9297
9298 dnl Now use the same 5-tuples but on ports 3,4
9299
9300 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)'])
9301 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)'])
9302 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)'])
9303
9304 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9305 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9306
9307 dnl Check this output. We only see the latter two packets (for each zone), not the first.
9308 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9309 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9310 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
9311 dnl
9312 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)
9313 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
9314 dnl
9315 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=3 (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): 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)
9319 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
9320 ])
9321
9322 OVS_VSWITCHD_STOP
9323 AT_CLEANUP
9324
9325 AT_SETUP([ofproto-dpif - conntrack - recirc,commit])
9326 OVS_VSWITCHD_START
9327
9328 add_of_ports br0 1 2
9329
9330 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9331
9332 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9333 AT_DATA([flows.txt], [dnl
9334 dnl Table 0
9335 dnl
9336 table=0,priority=100,arp,action=normal
9337 table=0,priority=10,udp,action=ct(table=1,zone=0)
9338 table=0,priority=1,action=drop
9339 dnl
9340 dnl Table 1
9341 dnl
9342 table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),controller
9343 table=1,priority=10,ct_state=+trk+est,udp,action=controller
9344 table=1,priority=1,action=drop
9345 ])
9346
9347 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9348
9349 AT_CAPTURE_FILE([ofctl_monitor.log])
9350 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9351
9352 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)'])
9353
9354 dnl OK, now start a new connection from port 1.
9355 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)'])
9356
9357 dnl Now try a reply from port 2.
9358 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)'])
9359
9360 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9361 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9362
9363 dnl Check this output. We only see the latter two packets, not the first.
9364 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9365 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9366 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
9367 dnl
9368 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)
9369 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
9370 ])
9371
9372 OVS_VSWITCHD_STOP
9373 AT_CLEANUP
9374
9375 AT_SETUP([ofproto-dpif - conntrack - ICMP related])
9376 OVS_VSWITCHD_START
9377
9378 add_of_ports br0 1 2
9379
9380 dnl Allow any traffic from ns0->ns1. Only allow nd, return traffic from ns1->ns0.
9381 AT_DATA([flows.txt], [dnl
9382 dnl Table 0
9383 dnl
9384 table=0,priority=100,arp,action=normal
9385 table=0,priority=10,ip,in_port=1,udp,action=ct(commit,table=1)
9386 table=0,priority=10,ip,in_port=2,action=ct(table=1)
9387 table=0,priority=1,action=drop
9388 dnl
9389 dnl Table 1
9390 dnl
9391 table=1,priority=10,in_port=1,ct_state=+trk,action=controller
9392 table=1,priority=10,in_port=2,ct_state=+trk-inv-new,action=controller
9393 table=1,priority=1,action=drop
9394 ])
9395
9396 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9397
9398 AT_CAPTURE_FILE([ofctl_monitor.log])
9399 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9400
9401 dnl 1. Send an ICMP port unreach reply for port 8738, without any previous request
9402 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'f64c473528c9c6f54ecb72db080045c0003d2e8700004001f351ac100004ac1000030303553f0000000045000021317040004011b138ac100003ac10000411112222000da5a06369616f0a'])
9403
9404 dnl 2. Send and UDP packet to port 5555
9405 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 1 ct\(commit,table=1\) 'c6f94ecb72dbe64c473528c9080045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
9406
9407 dnl 3. Send an ICMP port unreach reply for port 5555, related to the first packet
9408 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct\(table=1\) 'e64c473528c9c6f94ecb72db080045c0003d2e8700004001f355ac100002ac1000010303553f0000000045000021317040004011b138ac100001ac100002a28e15b3000d20966369616f0a'])
9409
9410 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9411 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9412
9413 dnl Check this output. We only see the first and the last packet
9414 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9415 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)
9416 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
9417 dnl
9418 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)
9419 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
9420 ])
9421
9422 OVS_VSWITCHD_STOP
9423 AT_CLEANUP
9424
9425 AT_SETUP([ofproto-dpif - conntrack - ct_mark])
9426 OVS_VSWITCHD_START
9427
9428 add_of_ports br0 1 2
9429
9430 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9431
9432 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9433 AT_DATA([flows.txt], [dnl
9434 dnl Table 0
9435 dnl
9436 table=0,arp,action=normal
9437 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_mark)),controller
9438 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:3->ct_mark)),controller
9439 table=0,ip,in_port=1,udp,tp_src=5,action=ct(commit,exec(set_field:5->ct_mark)),controller
9440 table=0,ip,in_port=2,actions=ct(table=1)
9441 table=0,priority=0,action=drop
9442 dnl
9443 dnl Table 1
9444 dnl
9445 table=1,priority=100,ct_state=+trk+rpl,ct_mark=0/4,actions=controller
9446 table=1,priority=1,action=drop
9447 ])
9448
9449 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9450
9451 AT_CAPTURE_FILE([ofctl_monitor.log])
9452 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9453
9454 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)'])
9455 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)'])
9456 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)'])
9457
9458 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)'])
9459 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)'])
9460 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)'])
9461
9462 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 10])
9463 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9464
9465 dnl Check this output.
9466 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9467 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9468 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
9469 dnl
9470 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9471 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
9472 dnl
9473 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9474 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
9475 dnl
9476 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)
9477 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
9478 dnl
9479 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)
9480 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
9481 ])
9482
9483 OVS_VSWITCHD_STOP
9484 AT_CLEANUP
9485
9486 AT_SETUP([ofproto-dpif - conntrack - ct_label])
9487 OVS_VSWITCHD_START
9488
9489 add_of_ports br0 1 2
9490
9491 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9492
9493 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9494 AT_DATA([flows.txt], [dnl
9495 dnl Table 0
9496 dnl
9497 table=0,arp,action=normal
9498 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:000000000000000001->ct_label))
9499 table=0,ip,in_port=1,udp,tp_src=3,action=ct(commit,exec(set_field:000000000000000002->ct_label))
9500 table=0,ip,in_port=2,actions=ct(table=1)
9501 dnl
9502 dnl Table 1
9503 dnl
9504 table=1,priority=10,ct_state=+trk+rpl,actions=controller
9505 table=1,priority=1,action=drop
9506 ])
9507
9508 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9509
9510 AT_CAPTURE_FILE([ofctl_monitor.log])
9511 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9512
9513 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)'])
9514 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)'])
9515
9516 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)'])
9517 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)'])
9518
9519 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
9520 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9521
9522 dnl Check this output.
9523 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9524 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)
9525 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
9526 dnl
9527 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)
9528 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
9529 ])
9530
9531 OVS_VSWITCHD_STOP
9532 AT_CLEANUP
9533
9534 AT_SETUP([ofproto-dpif - conntrack - ct_label datapath flow])
9535 OVS_VSWITCHD_START
9536
9537 add_of_ports br0 1 2
9538
9539 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9540
9541 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9542 AT_DATA([flows.txt], [dnl
9543 dnl The flows are in two separate tables for two reasons:
9544 dnl * To make the pipeline more clear.
9545 dnl * To make megaflows more consistent (we check megaflows below). The
9546 dnl unwildcarding in megaflows depends on the internal ordering of the
9547 dnl subtables, which are sorted using the system qsort(). qsort()
9548 dnl is provided by libc and may or may not be stable, so we can't rely
9549 dnl on that. By having separate tables we have more control over which
9550 dnl subtables are visited, meaning consistent megaflows.
9551 dnl
9552 dnl Table 0
9553 dnl
9554 table=0,arp,action=normal
9555 table=0,ip,in_port=1,udp,tp_src=1,action=ct(commit,exec(set_field:1->ct_label)),2
9556 table=0,ip,in_port=2,actions=ct(table=1)
9557 table=0,priority=0,action=drop
9558 dnl
9559 dnl Table 1
9560 dnl
9561 table=1,priority=10,ct_state=+trk+rpl,ct_label=0x1,actions=1
9562 table=1,priority=1,action=drop
9563 ])
9564
9565 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9566
9567 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)'])
9568 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)'])
9569
9570 # Give time for logs to appear.
9571 ovs-appctl revalidator/wait
9572
9573 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9574 ct_state(+rpl+trk),ct_label(0x1),recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:1
9575 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no),udp(src=1), actions:ct(commit,label=0x1),2
9576 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:ct,recirc(0x1)
9577 ])
9578
9579 OVS_VSWITCHD_STOP
9580 AT_CLEANUP
9581
9582 AT_SETUP([ofproto-dpif - conntrack - no output])
9583 OVS_VSWITCHD_START
9584
9585 add_of_ports br0 1
9586
9587 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9588
9589 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9590 AT_DATA([flows.txt], [dnl
9591 in_port=1,udp,action=ct(commit,zone=0)
9592 ])
9593
9594 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9595
9596 dnl Start a new connection from port 1.
9597 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)'])
9598
9599 AT_CHECK([cat ovs-vswitchd.log | strip_ufid | filter_flow_install], [0], [dnl
9600 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=no), actions:ct(commit)
9601 ])
9602
9603 OVS_VSWITCHD_STOP
9604 AT_CLEANUP
9605
9606 AT_SETUP([ofproto-dpif - conntrack - tcp port reuse])
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. Allow only established connections 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,ip,action=ct(commit,table=1)
9619 table=0,priority=10,in_port=2,ip,action=ct(table=1)
9620 table=0,priority=1,action=drop
9621 dnl
9622 dnl Table 1
9623 dnl
9624 dnl The following two flows are separated to explicitly count the packets
9625 dnl that create a new connection
9626 table=1,priority=100,cookie=0x1,in_port=1,ip,ct_state=+trk+new-inv-rpl,action=2
9627 table=1,priority=100,in_port=1,ip,ct_state=+trk-new-inv-rpl,action=2
9628 dnl
9629 table=1,priority=100,in_port=2,ip,ct_state=+trk+est+rpl-new-inv,action=1
9630 table=1,ip,ct_state=+trk+inv,action=drop
9631 ])
9632
9633 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9634
9635 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002ca4e5400040067fe20a0101010a0101020001000259b5d93f0000000060027210dd190000020405b4'])
9636 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c35468459b5d940601272101a4f0000020405b4'])
9637 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e6400040067fe50a0101010a0101020001000259b5d9407c35468550107210320c0000'])
9638 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000303b5f40004006e9640a0101020a010101000200017c35468559b5d9405018721074c200007061796c6f61640a'])
9639 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e7400040067fe40a0101010a0101020001000259b5d9407c35468d5010721032040000'])
9640 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6040004006e96b0a0101020a010101000200017c35468d59b5d9405011721032030000'])
9641 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e8400040067fe30a0101010a0101020001000259b5d9407c35468e5010721032030000'])
9642 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028a4e9400040067fe20a0101010a0101020001000259b5d9407c35468e5011721032020000'])
9643 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a0800450000283b6140004006e96a0a0101020a010101000200017c35468e59b5d9415010721032020000'])
9644
9645 AT_CHECK([ovs-appctl revalidator/purge])
9646 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9647 dnl Only one new connection
9648 n_packets=1
9649 ])
9650
9651 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a50540000000908004500002cc0a74000400664200a0101010a010102000100025b7dbf1f0000000060027210f5710000020405b4'])
9652 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a08004500002c00004000400624c80a0101020a010101000200017c36468f5b7dbf2060127210329b0000020405b4'])
9653 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a84000400664230a0101010a010102000100025b7dbf207c364690501072104a580000'])
9654 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000030392840004006eb9b0a0101020a010101000200017c3646905b7dbf20501872108d0e00007061796c6f61640a'])
9655 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0a94000400664220a0101010a010102000100025b7dbf207c364698501072104a500000'])
9656 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392940004006eba20a0101020a010101000200017c3646985b7dbf20501172104a4f0000'])
9657 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0aa4000400664210a0101010a010102000100025b7dbf207c364699501072104a4f0000'])
9658 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000a505400000009080045000028c0ab4000400664200a0101010a010102000100025b7dbf207c364699501172104a4e0000'])
9659 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000950540000000a080045000028392a40004006eba10a0101020a010101000200017c3646995b7dbf21501072104a4e0000'])
9660
9661 AT_CHECK([ovs-appctl revalidator/purge])
9662 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9663 dnl Two new connections
9664 n_packets=2
9665 ])
9666
9667 OVS_VSWITCHD_STOP
9668 AT_CLEANUP
9669
9670 AT_SETUP([ofproto-dpif - conntrack - tcp pick up])
9671 OVS_VSWITCHD_START
9672
9673 add_of_ports br0 1 2
9674
9675 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9676
9677 dnl Allow new connections on p1->p2. Allow only established connections p2->p1
9678 AT_DATA([flows.txt], [dnl
9679 dnl Table 0
9680 dnl
9681 table=0,priority=100,arp,action=normal
9682 table=0,priority=10,in_port=1,tcp,action=ct(commit,table=1)
9683 table=0,priority=10,in_port=2,tcp,action=ct(table=1)
9684 table=0,priority=1,action=drop
9685 dnl
9686 dnl Table 1
9687 dnl
9688 table=1,priority=10,cookie=0x1,ip,ct_state=+trk+inv,action=controller
9689 table=1,priority=1,action=drop
9690 ])
9691
9692 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9693
9694 AT_CHECK([ovs-appctl revalidator/purge])
9695 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9696 dnl No dropped packets
9697 n_packets=0
9698 ])
9699
9700 AT_CAPTURE_FILE([ofctl_monitor.log])
9701 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9702
9703 dnl The first two packets (SYN, SYN|ACK) are commented out. We're making
9704 dnl sure that the connection tracker is able to pick up already established
9705 dnl connections that use window scaling.
9706 dnl
9707 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000030fc2540004006289e0a0101020a01010100020001396bb359000000007002008080cc0000020405b401030307'])
9708 dnl AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a50540000000908004500003000004000400624c40a0101010a010102000100028cadbdb3396bb35a70120080365a0000020405b401030307'])
9709 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc264000400628a50a0101020a01010100020001396bb35a8cadbdb45010000a629b0000'])
9710 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000029fc274000400628a30a0101020a01010100020001396bb35a8cadbdb45018000a589200000a'])
9711 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c84000400632030a0101010a010102000100028cadbdb4396bb35b5010000a629a0000'])
9712 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a08004500022afc284000400626a10a0101020a01010100020001396bb35b8cadbdb45018000a941f0000 dnl
9713 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9714 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9715 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9716 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9717 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9718 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9719 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9720 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9721 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 dnl
9722 6666666666666666666666666666666666666666666666666666660a'])
9723 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2c94000400632020a0101010a010102000100028cadbdb4396bb55d5010000a60980000'])
9724 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a5054000000090800450001fdf2ca40004006302c0a0101010a010102000100028cadbdb4396bb55d5018000aa60c0000 dnl
9725 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9726 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9727 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9728 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9729 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9730 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9731 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9732 656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 dnl
9733 6565656565656565656565656565656565656565656565656565656565656565656565650a'])
9734 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc294000400628a20a0101020a01010100020001396bb55d8cadbf895010000a5ec30000'])
9735 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028fc2a4000400628a10a0101020a01010100020001396bb55d8cadbf895011000a5ec20000'])
9736 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cb4000400632000a0101010a010102000100028cadbf89396bb55e5010000a5ec20000'])
9737 AT_CHECK([ovs-appctl netdev-dummy/receive p2 '50540000000a505400000009080045000028f2cc4000400631ff0a0101010a010102000100028cadbf89396bb55e5011000a5ec10000'])
9738 AT_CHECK([ovs-appctl netdev-dummy/receive p1 '50540000000950540000000a080045000028258e40004006ff3d0a0101020a01010100020001396bb55e8cadbf8a5010000a5ec10000'])
9739
9740 AT_CHECK([ovs-appctl revalidator/purge])
9741
9742 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9743
9744 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9745 ])
9746
9747 AT_CHECK([ovs-ofctl dump-flows br0 | grep cookie=0x1 | grep -o "n_packets=[[0-9]]*"], [0], [dnl
9748 dnl No dropped packets
9749 n_packets=0
9750 ])
9751
9752 OVS_VSWITCHD_STOP
9753 AT_CLEANUP
9754
9755 dnl This is a truncated version of "ofproto-dpif - conntrack - controller",
9756 dnl with extra send-to-controller actions following ct_clear to show that
9757 dnl the connection tracking data has been cleared.
9758 AT_SETUP([ofproto-dpif - conntrack - ct_clear])
9759 OVS_VSWITCHD_START
9760
9761 add_of_ports br0 1 2
9762
9763 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg vconn:info ofproto_dpif:info])
9764
9765 dnl Allow new connections on p1->p2, but not on p2->p1.
9766 AT_DATA([flows.txt], [dnl
9767 dnl Table 0
9768 dnl
9769 table=0,priority=100,arp,action=normal
9770 table=0,priority=10,in_port=1,udp,action=ct(commit,zone=0),controller,ct_clear,controller
9771 table=0,priority=10,in_port=2,udp,action=ct(table=1,zone=0)
9772 table=0,priority=1,action=drop
9773 dnl
9774 dnl Table 1
9775 dnl
9776 table=1,priority=10,in_port=2,ct_state=+trk+est-new,udp,action=controller,ct_clear,controller
9777 table=1,priority=1,action=drop
9778 ])
9779
9780 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9781
9782 AT_CAPTURE_FILE([ofctl_monitor.log])
9783 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
9784
9785 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)'])
9786
9787 dnl OK, now start a new connection from port 1.
9788 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)'])
9789
9790 dnl Now try a reply from port 2.
9791 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)'])
9792
9793 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 8])
9794 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
9795
9796 dnl Check this output. We only see the latter two packets, not the first.
9797 dnl Note that the first packet doesn't have the ct_state bits set. This
9798 dnl happens because the ct_state field is available only after recirc.
9799 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
9800 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9801 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
9802 dnl
9803 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
9804 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
9805 dnl
9806 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)
9807 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
9808 dnl
9809 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=42 in_port=2 (via action) data_len=42 (unbuffered)
9810 udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:0a,dl_dst=50:54:00:00:00:09,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=2,tp_dst=1 udp_csum:e9d6
9811 ])
9812 OVS_VSWITCHD_STOP
9813 AT_CLEANUP
9814
9815 AT_SETUP([ofproto-dpif - conntrack - ofproto/trace])
9816 OVS_VSWITCHD_START
9817
9818 add_of_ports br0 1 2 3 4
9819
9820 AT_DATA([flows.txt], [dnl
9821 dnl Table 0
9822 dnl
9823 table=0,priority=100,arp,action=normal
9824 table=0,priority=10,udp,action=ct(table=1,zone=0)
9825 table=0,priority=10,tcp,action=ct(table=2,zone=1)
9826 table=0,priority=1,action=drop
9827 dnl
9828 dnl Table 1
9829 dnl
9830 table=1,priority=10,in_port=1,ct_state=+trk+new,udp,action=ct(commit,zone=0),2
9831 table=1,priority=10,in_port=1,ct_state=+trk+est,udp,action=2
9832 table=1,priority=10,in_port=2,ct_state=+trk+est,udp,action=1
9833 table=1,priority=1,action=drop
9834 dnl
9835 dnl Table 2
9836 dnl
9837 table=2,priority=10,in_port=1,tcp,ct_state=+trk+new,tcp,action=ct(commit,zone=1),ct(table=3,zone=2)
9838 table=2,priority=10,in_port=1,tcp,ct_state=+trk+est,tcp,action=ct(table=3,zone=2)
9839 table=2,priority=1,action=drop
9840 dnl
9841 dnl Table 3
9842 dnl
9843 table=3,priority=10,in_port=1,tcp,ct_state=+trk+new,tcp,action=ct(commit,zone=2),4
9844 table=3,priority=10,in_port=1,tcp,ct_state=+trk+est,tcp,action=3
9845 table=2,priority=1,action=drop
9846 ])
9847
9848 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9849
9850 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,udp'], [0], [stdout])
9851 AT_CHECK([tail -1 stdout], [0],
9852 [Datapath actions: drop
9853 ])
9854
9855 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,udp'], [0], [stdout])
9856 AT_CHECK([tail -1 stdout], [0],
9857 [Datapath actions: ct(commit),2
9858 ])
9859
9860 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp'], [0], [stdout])
9861 AT_CHECK([tail -1 stdout], [0],
9862 [Datapath actions: ct(commit,zone=2),4
9863 ])
9864
9865 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,tcp' --ct-next 'trk,est' --ct-next 'trk,est' ], [0], [stdout])
9866 AT_CHECK([tail -1 stdout], [0],
9867 [Datapath actions: 3
9868 ])
9869
9870 OVS_VSWITCHD_STOP
9871 AT_CLEANUP
9872
9873 AT_SETUP([ofproto - set mtu])
9874 OVS_VSWITCHD_START
9875
9876 add_of_ports br0 1
9877
9878 # Check that initial MTU is 1500 for 'br0' and 'p1'.
9879 AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
9880 1500
9881 ])
9882 AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
9883 1500
9884 ])
9885
9886 # Request new MTU for 'p1'
9887 AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
9888
9889 # Check that the new MTU is applied
9890 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p1 mtu=1600])
9891 # The internal port 'br0' should have the same MTU value as p1, becase it's
9892 # the new bridge minimum.
9893 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
9894
9895 AT_CHECK([ovs-vsctl del-port br0 p1])
9896
9897 # When 'p1' is deleted, the internal port should return to the default MTU
9898 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1500])
9899
9900 # New port with 'mtu_request' in the same transaction.
9901 AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600])
9902 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1600])
9903 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
9904
9905 # Explicitly set mtu_request on the internal interface. This should prevent
9906 # the MTU from being overriden.
9907 AT_CHECK([ovs-vsctl set int br0 mtu_request=1700])
9908 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
9909
9910 # The new MTU on p2 should not affect br0.
9911 AT_CHECK([ovs-vsctl set int p2 mtu_request=1400])
9912 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1400])
9913 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1700])
9914
9915 # Remove explicit mtu_request from br0. Now it should track the bridge
9916 # minimum again.
9917 AT_CHECK([ovs-vsctl set int br0 mtu_request=[[]]])
9918 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1400])
9919
9920 OVS_VSWITCHD_STOP
9921 AT_CLEANUP
9922
9923 AT_SETUP([ofproto - fragment prerequisites])
9924 OVS_VSWITCHD_START
9925
9926 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9927
9928 add_of_ports br0 1
9929
9930 AT_DATA([flows.txt], [dnl
9931 priority=10,in_port=1,udp,tp_src=67,tp_dst=68,action=drop
9932 priority=1,in_port=1,udp,action=drop
9933 ])
9934
9935 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
9936
9937 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=10000])
9938
9939 ovs-appctl time/stop
9940 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth_type(0x0800),ipv4(proto=17,frag=later)'])
9941 ovs-appctl time/warp 5000
9942
9943 AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9944 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=17,frag=later), actions:drop
9945 ])
9946
9947 dnl Change the flow table. This will trigger revalidation of all the flows.
9948 AT_CHECK([ovs-ofctl add-flow br0 priority=5,in_port=1,action=drop])
9949 AT_CHECK([ovs-appctl revalidator/wait], [0])
9950
9951 dnl We don't want revalidators to delete any flow. If the flow has been
9952 dnl deleted it means that there's some inconsistency with the revalidation.
9953 AT_CHECK([grep flow_del ovs-vswitchd.log], [1])
9954
9955 OVS_VSWITCHD_STOP
9956 AT_CLEANUP