miniflow: Use 64-bit data.
[cascardo/ovs.git] / tests / ofproto-dpif.at
1 AT_BANNER([ofproto-dpif])
2
3 AT_SETUP([ofproto-dpif - revalidator/wait])
4 OVS_VSWITCHD_START
5 AT_CHECK([ovs-appctl revalidator/wait])
6 OVS_VSWITCHD_STOP
7 AT_CLEANUP
8
9 AT_SETUP([ofproto-dpif, active-backup bonding])
10 # Create br0 with interfaces p1, p2 and p7, creating bond0 with p1 and p2
11 #    and br1 with interfaces p3, p4 and p8.
12 # toggle p1,p2 of bond0 up and down to test bonding in active-backup mode.
13 OVS_VSWITCHD_START(
14   [add-bond br0 bond0 p1 p2 bond_mode=active-backup --\
15    set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
16    set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
17    add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
18    add-br br1 -- \
19    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
20    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
21                   fail-mode=secure -- \
22    add-port br1 p3 -- set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
23    add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
24    add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
25 WAIT_FOR_DUMMY_PORTS([p3], [p4])
26 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
27
28 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
29 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
30 ovs-appctl netdev-dummy/set-admin-state up
31 ovs-appctl time/warp 100
32 ovs-appctl netdev-dummy/set-admin-state p2 down
33 ovs-appctl time/stop
34 ovs-appctl time/warp 100
35 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
36 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
37 ovs-appctl time/warp 100
38 ovs-appctl netdev-dummy/set-admin-state p2 up
39 ovs-appctl netdev-dummy/set-admin-state p1 down
40 ovs-appctl time/warp 100
41 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0d),eth_type(0x0800),ipv4(src=10.0.0.5,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
42 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(src=10.0.0.6,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
43 ovs-appctl time/warp 200 100
44 sleep 1
45 AT_CHECK([cat ovs-vswitchd.log | grep 'in_port=[[348]]' | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
46 recirc_id=0,ip,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions: <del>
47 recirc_id=0,ip,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions: <del>
48 recirc_id=0,ip,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0d,nw_frag=no, actions: <del>
49 recirc_id=0,ip,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0e,nw_frag=no, actions: <del>
50 recirc_id=0,rarp,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=ff:ff:ff:ff:ff:ff, actions: <del>
51 recirc_id=0,rarp,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=ff:ff:ff:ff:ff:ff, 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 # Should generate recirc_id(0x12d),dp_hash(0xc1261ba2/0xff).
190 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)"])
191
192 # Collects flow stats.
193 AT_CHECK([ovs-appctl revalidator/purge], [0])
194
195 # Checks the flow stats in br1, should only be one flow with non-zero
196 # 'n_packets' from internal table.
197 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
198 table_id=254, n_packets=1, n_bytes=64, priority=20,recirc_id=0x12d,dp_hash=0xa2/0xff,actions=output
199 ])
200
201 # Checks the flow stats in br-int, should be only one match.
202 AT_CHECK([ovs-ofctl dump-flows br-int | ofctl_strip | sort], [0], [dnl
203  n_packets=1, n_bytes=60, priority=1,in_port=5 actions=mod_vlan_vid:1,output:101
204  priority=2,in_port=5,dl_vlan=1 actions=drop
205 NXST_FLOW reply:
206 ])
207
208 OVS_VSWITCHD_STOP()
209 AT_CLEANUP
210
211 AT_SETUP([ofproto-dpif - resubmit])
212 OVS_VSWITCHD_START
213 ADD_OF_PORTS([br0], [1], [10], [11], [12], [13], [14], [15],
214                     [16], [17], [18], [19], [20], [21])
215 AT_DATA([flows.txt], [dnl
216 table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21)
217 table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18)
218 table=0 in_port=3 priority=2000 icmp actions=output(20)
219 table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15)
220 table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2)
221 table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2)
222 ])
223 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
224 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])
225 AT_CHECK([tail -1 stdout], [0],
226   [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
227 ])
228 OVS_VSWITCHD_STOP
229 AT_CLEANUP
230
231 AT_SETUP([ofproto-dpif - goto table])
232 OVS_VSWITCHD_START
233 ADD_OF_PORTS([br0], [1], [10], [11])
234 echo "table=0 in_port=1 actions=output(10),goto_table(1)" > flows.txt
235 for i in `seq 1 63`; do echo "table=$i actions=goto_table($(($i+1)))"; done >> flows.txt
236 echo "table=64 actions=output(11)" >> flows.txt
237 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
238 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])
239 AT_CHECK([tail -1 stdout], [0],
240   [Datapath actions: 10,11
241 ])
242 OVS_VSWITCHD_STOP
243 AT_CLEANUP
244
245 AT_SETUP([ofproto-dpif - write actions])
246 OVS_VSWITCHD_START
247 ADD_OF_PORTS([br0], [1], [10], [11], [12], [13])
248 AT_DATA([flows.txt], [dnl
249 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
250 table=1 ip actions=write_actions(output(13)),goto_table(2)
251 table=2 ip actions=set_field:192.168.3.91->ip_src,output(11)
252 ])
253 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
254 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])
255 AT_CHECK([tail -2 stdout], [0],
256   [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
257 Datapath actions: 10,set(ipv4(src=192.168.3.91)),11,set(ipv4(src=192.168.3.90)),13
258 ])
259 OVS_VSWITCHD_STOP
260 AT_CLEANUP
261
262 AT_SETUP([ofproto-dpif - clear actions])
263 OVS_VSWITCHD_START
264 ADD_OF_PORTS([br0], [1], [10], [11], [12])
265 AT_DATA([flows.txt], [dnl
266 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
267 table=1 tcp actions=set_field:91->tp_src,output(11),clear_actions
268 ])
269 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
270 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])
271 AT_CHECK([tail -2 stdout], [0],
272   [Megaflow: recirc_id=0,tcp,in_port=1,nw_frag=no,tp_src=8
273 Datapath actions: 10,set(tcp(src=91)),11
274 ])
275 OVS_VSWITCHD_STOP
276 AT_CLEANUP
277
278 AT_SETUP([ofproto-dpif - group chaining not supported])
279 OVS_VSWITCHD_START
280 ADD_OF_PORTS([br0], [1], [10], [11])
281 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,group:123,bucket=output:11'],
282   [1], [], [stderr])
283 AT_CHECK([STRIP_XIDS stderr | sed 1q], [0],
284   [OFPT_ERROR (OF1.2): OFPGMFC_CHAINING_UNSUPPORTED
285 ])
286 OVS_VSWITCHD_STOP
287 AT_CLEANUP
288
289 AT_SETUP([ofproto-dpif - all group in action list])
290 OVS_VSWITCHD_START
291 ADD_OF_PORTS([br0], [1], [10], [11])
292 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'])
293 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
294 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])
295 # Must match on the source address to be able to restore it's value for
296 # the second bucket
297 AT_CHECK([tail -2 stdout], [0],
298   [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
299 Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
300 ])
301 OVS_VSWITCHD_STOP
302 AT_CLEANUP
303
304 AT_SETUP([ofproto-dpif - indirect group in action list])
305 OVS_VSWITCHD_START
306 ADD_OF_PORTS([br0], [1], [10])
307 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
308 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
309 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])
310 AT_CHECK([tail -1 stdout], [0],
311   [Datapath actions: 10
312 ])
313 OVS_VSWITCHD_STOP
314 AT_CLEANUP
315
316 AT_SETUP([ofproto-dpif - all group in action set])
317 OVS_VSWITCHD_START
318 ADD_OF_PORTS([br0], [1], [10], [11])
319 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'])
320 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
321 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])
322 # Must match on the source address to be able to restore it's value for
323 # the third bucket
324 AT_CHECK([tail -2 stdout], [0],
325   [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
326 Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
327 ])
328 OVS_VSWITCHD_STOP
329 AT_CLEANUP
330
331 AT_SETUP([ofproto-dpif - indirect group in action set])
332 OVS_VSWITCHD_START
333 ADD_OF_PORTS([br0], [1], [10])
334 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
335 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
336 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])
337 AT_CHECK([tail -1 stdout], [0],
338   [Datapath actions: 10
339 ])
340 OVS_VSWITCHD_STOP
341 AT_CLEANUP
342
343 AT_SETUP([ofproto-dpif - select group])
344 OVS_VSWITCHD_START
345 ADD_OF_PORTS([br0], [1], [10], [11])
346 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
347 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
348
349 # Try a bunch of different flows and make sure that they get distributed
350 # at least somewhat.
351 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
352     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])
353     tail -1 stdout >> results
354 done
355 sort results | uniq -c
356 AT_CHECK([sort results | uniq], [0],
357   [Datapath actions: 10
358 Datapath actions: 11
359 ])
360 OVS_VSWITCHD_STOP
361 AT_CLEANUP
362
363 AT_SETUP([ofproto-dpif - select group with watch port])
364 OVS_VSWITCHD_START
365 ADD_OF_PORTS([br0], [1], [10], [11])
366 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
367 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
368 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])
369 AT_CHECK([tail -1 stdout], [0],
370   [Datapath actions: 11
371 ])
372 OVS_VSWITCHD_STOP
373 AT_CLEANUP
374
375 AT_SETUP([ofproto-dpif - select group with weight])
376 OVS_VSWITCHD_START
377 ADD_OF_PORTS([br0], [1], [10], [11], [12])
378 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'])
379 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
380 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])
381 AT_CHECK([tail -1 stdout], [0],
382   [Datapath actions: 11
383 ])
384 OVS_VSWITCHD_STOP
385 AT_CLEANUP
386
387 AT_SETUP([ofproto-dpif - fast failover group])
388 OVS_VSWITCHD_START
389 ADD_OF_PORTS([br0], [1], [10], [11])
390 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'])
391 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
392 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])
393 AT_CHECK([tail -1 stdout], [0],
394   [Datapath actions: drop
395 ])
396 OVS_VSWITCHD_STOP
397 AT_CLEANUP
398
399 AT_SETUP([ofproto-dpif - group stats single bucket])
400 OVS_VSWITCHD_START
401 ADD_OF_PORTS([br0], [1], [10], [11])
402 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
403 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
404 (
405 for i in `seq 0 2`;
406     do
407     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)"
408     AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
409     done
410 )
411 AT_CHECK([ovs-appctl revalidator/purge], [0])
412 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
413 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
414  group_id=1234,ref_count=0,packet_count=3,byte_count=180,bucket0:packet_count=3,byte_count=180,bucket1:packet_count=0,byte_count=0
415 OFPST_GROUP reply (OF1.2):
416 ])
417 OVS_VSWITCHD_STOP
418 AT_CLEANUP
419
420 AT_SETUP([ofproto-dpif - group stats all buckets])
421 OVS_VSWITCHD_START
422 ADD_OF_PORTS([br0], [1], [10], [11])
423 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
424 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
425 (
426 for i in `seq 0 2`;
427     do
428     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)"
429     AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
430     done
431 )
432 AT_CHECK([ovs-appctl revalidator/purge], [0])
433 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
434 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
435  group_id=1234,ref_count=0,packet_count=3,byte_count=180,bucket0:packet_count=3,byte_count=180,bucket1:packet_count=3,byte_count=180
436 OFPST_GROUP reply (OF1.2):
437 ])
438 OVS_VSWITCHD_STOP
439 AT_CLEANUP
440
441 AT_SETUP([ofproto-dpif - registers])
442 OVS_VSWITCHD_START
443 ADD_OF_PORTS([br0], [20], [21], [22], [33], [90])
444 AT_DATA([flows.txt], [dnl
445 in_port=90                 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
446 in_port=91                 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
447 in_port=92                 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
448 in_port=93                 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
449
450 in_port=2                  actions=load:0x000db000->NXM_NX_REG0[[]]
451 in_port=3                  actions=load:0xdea->NXM_NX_REG0[[20..31]]
452 in_port=4                  actions=load:0xeef->NXM_NX_REG0[[0..11]]
453 in_port=5                  actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
454 in_port=6                  actions=load:0x22222222->NXM_NX_REG2[[]]
455 in_port=7                  actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
456 in_port=8                  actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
457 in_port=9,reg0=0xdeadbeef  actions=output:20
458 in_port=10,reg1=0xdeadbeef actions=output:21
459 in_port=11,reg2=0xeef22dea actions=output:22
460
461 dnl Sanilty check all registers
462 in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
463 in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
464 in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
465 in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
466
467 ])
468 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
469 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])
470 AT_CHECK([tail -1 stdout], [0],
471   [Datapath actions: 20,21,22,33
472 ])
473 OVS_VSWITCHD_STOP
474 AT_CLEANUP
475
476 dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
477 dnl in the manner documented in ovs-ofctl(8).
478 AT_SETUP([ofproto-dpif - extended registers])
479 OVS_VSWITCHD_START
480 ADD_OF_PORTS([br0], [1], [2], [3])
481 AT_DATA([flows.txt], [dnl
482 table=0     actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
483 table=1,reg2=0xfedcba98,reg3=0x76543210   actions=2
484
485 # These low-priority rules shouldn't match.  They're here only to make really
486 # sure that the test fails if either of the above rules fails to match.
487 table=0,priority=0                        actions=3
488 table=1,priority=0                        actions=3
489 ])
490 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
491 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])
492 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
493 ])
494 OVS_VSWITCHD_STOP
495 AT_CLEANUP
496
497 AT_SETUP([ofproto-dpif - load and move order])
498 OVS_VSWITCHD_START
499 ADD_OF_PORTS([br0], [1], [10], [11])
500 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'])
501 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)'])
502 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])
503 AT_CHECK([tail -2 stdout], [0],
504   [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
505 Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
506 ])
507 OVS_VSWITCHD_STOP
508 AT_CLEANUP
509
510 dnl Tests that 1.5 copy-field can copy into the standardized xregs.
511 AT_SETUP([ofproto-dpif - copy-field into extended registers])
512 OVS_VSWITCHD_START
513 ADD_OF_PORTS([br0], [1], [2], [3])
514 AT_DATA([flows.txt], [dnl
515 table=0     actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
516 table=1,xreg0=0x0000505400000005   actions=2
517
518 # These low-priority rules shouldn't match.  They're here only to make really
519 # sure that the test fails if either of the above rules fails to match.
520 table=0,priority=0                        actions=3
521 table=1,priority=0                        actions=3
522 ])
523 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
524 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])
525 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
526 ])
527 OVS_VSWITCHD_STOP
528 AT_CLEANUP
529
530 dnl Tests that 1.5 set-field with mask in the metadata register.
531 AT_SETUP([ofproto-dpif - masked set-field into metadata])
532 OVS_VSWITCHD_START
533 ADD_OF_PORTS([br0], [1], [2], [3])
534 AT_DATA([flows.txt], [dnl
535 table=0     actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
536 table=1     actions=set_field:0x6b/0xff->metadata,goto_table(2)
537 table=2,metadata=0xfafafafa5a5a5a6b  actions=2
538
539 # These low-priority rules shouldn't match.  They're here only to make really
540 # sure that the test fails if either of the above rules fails to match.
541 table=0,priority=0                        actions=3
542 table=1,priority=0                        actions=3
543 table=2,priority=0                        actions=3
544 ])
545 AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
546 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])
547 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
548 ])
549 OVS_VSWITCHD_STOP
550 AT_CLEANUP
551
552
553 AT_SETUP([ofproto-dpif - actset_output])
554 OVS_VSWITCHD_START
555 ADD_OF_PORTS(
556   [br0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13])
557 AT_DATA([flows.txt], [dnl
558 table=0,actset_output=unset     actions=write_actions(output(2)),goto_table(1)
559 table=1     actions=move:ONFOXM_ET_ACTSET_OUTPUT[[0..31]]->OXM_OF_PKT_REG0[[0..31]],goto_table(2)
560
561 # Verify that actset_output got set.
562 table=2,priority=20,actset_output=2  actions=4,goto_table(3)
563 table=2,priority=10                  actions=5,goto_table(3)
564
565 # Verify that xreg0 got copied properly from actset_output.
566 table=3,priority=20,xreg0=2  actions=6,goto_table(4)
567 table=3,priority=10          actions=7,goto_table(4)
568
569 # Verify that adding a group action unsets actset_output.
570 table=4 actions=write_actions(group(5)),goto_table(5)
571 table=5,priority=20,actset_output=unset  actions=8,goto_table(6)
572 table=5,priority=10                      actions=9,goto_table(6)
573
574 # Verify that adding another output action doesn't change actset_output
575 # (since there's still a group).
576 table=6 actions=write_actions(output(3)),goto_table(7)
577 table=7,priority=20,actset_output=unset  actions=10,goto_table(8)
578 table=7,priority=10                      actions=11,goto_table(8)
579
580 # Verify that clearing the action set, then writing an output action,
581 # causes actset_output to be set again.
582 table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
583 table=9,priority=20,actset_output=2 actions=12
584 table=9,priority=10                 actions=13
585 ])
586 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
587 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])
588 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
589 ])
590 OVS_VSWITCHD_STOP
591 AT_CLEANUP
592 AT_SETUP([ofproto-dpif - push-pop])
593 OVS_VSWITCHD_START
594 ADD_OF_PORTS([br0], [20], [21], [22], [33], [90])
595 AT_DATA([flows.txt], [dnl
596 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
597 in_port=2            actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
598 in_port=3            actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
599 in_port=4            actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
600 in_port=5            actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
601
602 ])
603 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
604 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])
605 AT_CHECK([tail -1 stdout], [0],
606   [Datapath actions: 33,22,21,20
607 ])
608 OVS_VSWITCHD_STOP
609 AT_CLEANUP
610
611 AT_SETUP([ofproto-dpif - output])
612 OVS_VSWITCHD_START
613 ADD_OF_PORTS([br0], [1], [9], [10], [11], [55], [66], [77], [88])
614 AT_DATA([flows.txt], [dnl
615 in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
616 in_port=2 actions=output:9
617 in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
618 in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
619 in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
620 in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
621 in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
622 in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
623 ])
624 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
625 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])
626 AT_CHECK([tail -1 stdout], [0],
627   [Datapath actions: 9,55,10,55,66,11,77,88,9,1
628 ])
629 OVS_VSWITCHD_STOP
630 AT_CLEANUP
631
632 AT_SETUP([ofproto-dpif - dec_ttl])
633 OVS_VSWITCHD_START
634 ADD_OF_PORTS([br0], [1], [2], [3], [4])
635 AT_DATA([flows.txt], [dnl
636 table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
637 table=1 in_port=1 action=dec_ttl,output:3
638 ])
639 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
640 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])
641 AT_CHECK([tail -4 stdout], [0],
642   [Megaflow: recirc_id=0,ip,in_port=1,nw_ttl=2,nw_frag=no
643 Datapath actions: set(ipv4(ttl=1)),2,4
644 This flow is handled by the userspace slow path because it:
645         - Sends "packet-in" messages to the OpenFlow controller.
646 ])
647 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])
648 AT_CHECK([tail -2 stdout], [0],
649   [Megaflow: recirc_id=0,ip,in_port=1,nw_ttl=3,nw_frag=no
650 Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
651 ])
652 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)'], [0], [stdout])
653 AT_CHECK([tail -2 stdout], [0],
654   [Megaflow: recirc_id=0,ipv6,in_port=1,nw_ttl=128,nw_frag=no
655 Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
656 ])
657
658 AT_CAPTURE_FILE([ofctl_monitor.log])
659 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
660 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])
661 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
662 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
663 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
664 ip,in_port=0,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
665 ])
666 OVS_VSWITCHD_STOP
667 AT_CLEANUP
668
669 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
670 dnl buffer to be resized just before pushing the id of the dec_ttl action.
671 dnl Thus the implementation must account for this by using the
672 dnl reallocated buffer rather than the original buffer.
673 dnl
674 dnl A number of similar rules are added to try and exercise
675 dnl xrealloc sufficiently that it returns a different base pointer
676 AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
677 OVS_VSWITCHD_START
678 ADD_OF_PORTS([br0], [1])
679 (for i in `seq 0 255`; do
680   printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
681  done) > flows.txt
682 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
683 OVS_VSWITCHD_STOP
684 AT_CLEANUP
685
686 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
687 dnl buffer to be resized just before pushing the id of the dec_ttl action.
688 dnl Thus the implementation must account for this by using the
689 dnl reallocated buffer rather than the original buffer.
690 dnl
691 dnl A number of similar rules are added to try and exercise
692 dnl xrealloc sufficiently that it returns a different base pointer
693 AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
694 OVS_VSWITCHD_START
695 ADD_OF_PORTS([br0], [1])
696 (for i in `seq 0 255`; do
697   printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
698  done) > flows.txt
699 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
700 OVS_VSWITCHD_STOP
701 AT_CLEANUP
702
703 dnl A note action at offset 24 in ofpacts will cause the ofpacts
704 dnl buffer to be resized just before pushing the id of the dec_ttl action.
705 dnl Thus the implementation must account for this by using the
706 dnl reallocated buffer rather than the original buffer.
707 dnl
708 dnl A number of similar rules are added to try and exercise
709 dnl xrealloc sufficiently that it returns a different base pointer
710 AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
711 OVS_VSWITCHD_START
712 ADD_OF_PORTS([br0], [1])
713 (for i in `seq 0 255`; do
714   printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
715  done) > flows.txt
716 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
717 OVS_VSWITCHD_STOP
718 AT_CLEANUP
719
720 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
721 OVS_VSWITCHD_START
722 ADD_OF_PORTS([br0], [1], [2])
723
724 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
725
726 # "in_port" defaults to OFPP_NONE if it's not specified.
727 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"
728 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
729 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
730 1
731 2
732 100
733 ])
734
735 OVS_VSWITCHD_STOP
736 AT_CLEANUP
737
738 AT_SETUP([ofproto-dpif - DSCP])
739 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
740 ADD_OF_PORTS([br0], [9])
741 AT_DATA([flows.txt], [dnl
742 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
743 ])
744 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
745 AT_CHECK([ovs-vsctl -- \
746         set Port p1 qos=@newqos --\
747         --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
748         --id=@q1 create Queue dscp=1 --\
749         --id=@q2 create Queue dscp=2], [0], [ignore])
750 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])
751 AT_CHECK([tail -2 stdout], [0],
752   [Megaflow: recirc_id=0,skb_priority=0,ip,in_port=9,nw_tos=252,nw_frag=no
753 Datapath actions: dnl
754 100,dnl
755 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
756 set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
757 1,dnl
758 set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
759 set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
760 set(ipv4(tos=0/0xfc)),1,100
761 ])
762 OVS_VSWITCHD_STOP
763 AT_CLEANUP
764
765 AT_SETUP([ofproto-dpif - output/flood flags])
766 OVS_VSWITCHD_START
767 ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [7])
768
769 AT_DATA([flows.txt], [dnl
770 in_port=local actions=local,flood
771 in_port=1 actions=flood
772 in_port=2 actions=all
773 in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
774 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
775 ])
776 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
777 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
778 AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
779
780 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])
781 AT_CHECK([tail -1 stdout \
782 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
783 1
784 2
785 3
786 4
787 7
788 ])
789
790 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])
791 AT_CHECK([tail -1 stdout \
792 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
793 100
794 2
795 3
796 4
797 7
798 ])
799
800 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])
801 AT_CHECK([tail -1 stdout \
802 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
803 1
804 100
805 3
806 4
807 6
808 7
809 ])
810
811 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])
812 AT_CHECK([tail -1 stdout], [0],
813   [Datapath actions: 100,1,2,4,6,7
814 ])
815
816 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])
817 AT_CHECK([tail -1 stdout], [0],
818   [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
819 ])
820 OVS_VSWITCHD_STOP
821 AT_CLEANUP
822
823 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
824 OVS_VSWITCHD_START([dnl
825    add-port br0 p1 -- set Interface p1 type=dummy
826 ])
827 ON_EXIT([kill `cat ovs-ofctl.pid`])
828
829 AT_CAPTURE_FILE([ofctl_monitor.log])
830
831 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
832
833 for i in 1 2 3 ; do
834     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)'
835 done
836 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
837 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
838 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
839 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
840 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:0
841 dnl
842 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
843 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:0
844 dnl
845 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
846 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:0
847 ])
848
849 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
850 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
851 NXST_FLOW reply:
852 ])
853
854 OVS_VSWITCHD_STOP
855 AT_CLEANUP
856
857 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
858 OVS_VSWITCHD_START([dnl
859    add-port br0 p1 -- set Interface p1 type=dummy
860 ])
861 ON_EXIT([kill `cat ovs-ofctl.pid`])
862
863 AT_CAPTURE_FILE([ofctl_monitor.log])
864 AT_CHECK([ovs-ofctl del-flows br0])
865
866 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
867
868 dnl Test that missed packets are droped
869 for i in 1 2 3 ; do
870     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)'
871 done
872 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
873
874 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
875 ])
876
877 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
878 AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
879 OFPST_FLOW reply (OF1.3):
880 ])
881
882 OVS_VSWITCHD_STOP
883 AT_CLEANUP
884
885 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
886 OVS_VSWITCHD_START([dnl
887    add-port br0 p1 -- set Interface p1 type=dummy
888 ])
889 ON_EXIT([kill `cat ovs-ofctl.pid`])
890
891 AT_CAPTURE_FILE([ofctl_monitor.log])
892 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
893
894 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
895
896 for i in 1 2 3 ; do
897     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)'
898 done
899 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
900 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
901 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
902 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
903 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:0
904 dnl
905 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
906 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:0
907 dnl
908 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
909 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:0
910 ])
911
912 AT_CHECK([ovs-appctl revalidator/purge], [0])
913 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
914  n_packets=3, n_bytes=180, actions=goto_table:1
915 OFPST_FLOW reply (OF1.2):
916 ])
917
918 OVS_VSWITCHD_STOP
919 AT_CLEANUP
920
921 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
922 OVS_VSWITCHD_START([dnl
923    add-port br0 p1 -- set Interface p1 type=dummy
924 ])
925 ON_EXIT([kill `cat ovs-ofctl.pid`])
926
927 AT_CAPTURE_FILE([ofctl_monitor.log])
928 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
929
930 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
931
932 for i in 1 2 3 ; do
933     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)'
934 done
935
936 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
937 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
938 ])
939
940 AT_CHECK([ovs-appctl revalidator/purge], [0])
941 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
942  n_packets=3, n_bytes=180, actions=resubmit(1,1)
943 OFPST_FLOW reply (OF1.2):
944 ])
945
946 OVS_VSWITCHD_STOP
947 AT_CLEANUP
948
949 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
950 OVS_VSWITCHD_START([dnl
951    add-port br0 p1 -- set Interface p1 type=dummy
952 ])
953 ON_EXIT([kill `cat ovs-ofctl.pid`])
954
955 AT_CAPTURE_FILE([ofctl_monitor.log])
956 AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
957 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
958
959 dnl Miss table 0, Hit table 1
960 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
961
962 for i in 1 2 3 ; do
963     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)'
964 done
965 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
966 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
967
968 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
969 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
970 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
971 dnl
972 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
973 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
974 dnl
975 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
976 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
977 ])
978
979 dnl Hit table 0, Miss all other tables, sent to controller
980 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --no-chdir --pidfile 2> ofctl_monitor.log])
981
982 for i in 1 2 3 ; do
983     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)'
984 done
985 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
986 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
987
988 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
989 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
990 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
991 dnl
992 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
993 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
994 dnl
995 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
996 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
997 ])
998
999 AT_CHECK([ovs-appctl revalidator/purge], [0])
1000 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1001  table=1, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1002 OFPST_FLOW reply (OF1.2):
1003 ])
1004
1005 OVS_VSWITCHD_STOP
1006 AT_CLEANUP
1007
1008 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1009 OVS_VSWITCHD_START([dnl
1010    add-port br0 p1 -- set Interface p1 type=dummy
1011 ])
1012 ON_EXIT([kill `cat ovs-ofctl.pid`])
1013
1014 AT_CAPTURE_FILE([ofctl_monitor.log])
1015 AT_DATA([flows.txt], [dnl
1016 table=0 actions=goto_table(1)
1017 table=2 dl_src=10:11:11:11:11:11 actions=controller
1018 ])
1019 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1020 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1021
1022 dnl Hit table 0, Miss table 1, Hit table 2
1023 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1024
1025 for i in 1 2 3 ; do
1026     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)'
1027 done
1028 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1029 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1030
1031 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1032 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1033 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
1034 dnl
1035 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1036 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
1037 dnl
1038 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1039 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
1040 ])
1041
1042 dnl Hit table 1, Miss all other tables, sent to controller
1043 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1044
1045 for i in 1 2 3 ; do
1046     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)'
1047 done
1048 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1049 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1050
1051 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1052 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1053 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
1054 dnl
1055 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1056 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
1057 dnl
1058 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1059 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
1060 ])
1061
1062 AT_CHECK([ovs-appctl revalidator/purge], [0])
1063 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1064  n_packets=6, n_bytes=360, actions=goto_table:1
1065  table=2, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1066 OFPST_FLOW reply (OF1.2):
1067 ])
1068
1069 OVS_VSWITCHD_STOP
1070 AT_CLEANUP
1071
1072 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1073 OVS_VSWITCHD_START([dnl
1074    add-port br0 p1 -- set Interface p1 type=dummy
1075 ])
1076 ON_EXIT([kill `cat ovs-ofctl.pid`])
1077
1078 AT_CAPTURE_FILE([ofctl_monitor.log])
1079 AT_DATA([flows.txt], [dnl
1080 table=0 actions=resubmit(1,1)
1081 table=2 dl_src=10:11:11:11:11:11 actions=controller
1082 ])
1083 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1084 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1085
1086 dnl Hit table 0, Miss table 1, Dropped
1087 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1088
1089 for i in 1 2 3 ; do
1090     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)'
1091 done
1092 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1093
1094 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1095 ])
1096
1097 dnl Hit table 1, Dropped
1098 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1099
1100 for i in 1 2 3 ; do
1101     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00: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)'
1102 done
1103 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1104
1105 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1106 ])
1107
1108 AT_CHECK([ovs-appctl revalidator/purge], [0])
1109 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1110  n_packets=6, n_bytes=360, actions=resubmit(1,1)
1111  table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1112 OFPST_FLOW reply (OF1.2):
1113 ])
1114
1115 OVS_VSWITCHD_STOP
1116 AT_CLEANUP
1117
1118 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1119 OVS_VSWITCHD_START([dnl
1120    add-port br0 p1 -- set Interface p1 type=dummy
1121 ])
1122 ON_EXIT([kill `cat ovs-ofctl.pid`])
1123
1124 AT_CAPTURE_FILE([ofctl_monitor.log])
1125 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1126
1127 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1128
1129 dnl Test that missed packets are droped
1130 for i in 1 2 3 ; do
1131     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)'
1132 done
1133 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1134
1135 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1136 ])
1137
1138 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1139 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1140 NXST_FLOW reply:
1141 ])
1142
1143 OVS_VSWITCHD_STOP
1144 AT_CLEANUP
1145
1146 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1147 OVS_VSWITCHD_START([dnl
1148    add-port br0 p1 -- set Interface p1 type=dummy
1149 ])
1150 ON_EXIT([kill `cat ovs-ofctl.pid`])
1151
1152 AT_CAPTURE_FILE([ofctl_monitor.log])
1153 AT_CHECK([ovs-ofctl del-flows br0])
1154 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1155 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1156
1157 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1158
1159 dnl Test that missed packets are droped
1160 for i in 1 2 3 ; do
1161     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)'
1162 done
1163 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1164
1165 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1166 ])
1167
1168 AT_CHECK([ovs-appctl revalidator/purge], [0])
1169 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1170  n_packets=3, n_bytes=180, actions=goto_table:1
1171 OFPST_FLOW reply (OF1.2):
1172 ])
1173
1174 OVS_VSWITCHD_STOP
1175 AT_CLEANUP
1176
1177 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1178 OVS_VSWITCHD_START([dnl
1179    add-port br0 p1 -- set Interface p1 type=dummy
1180 ])
1181 ON_EXIT([kill `cat ovs-ofctl.pid`])
1182
1183 AT_CAPTURE_FILE([ofctl_monitor.log])
1184 AT_CHECK([ovs-ofctl del-flows br0])
1185 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1186 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1187
1188 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1189
1190 dnl Test that missed packets are droped
1191 for i in 1 2 3 ; do
1192     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)'
1193 done
1194 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1195
1196 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1197 ])
1198
1199 AT_CHECK([ovs-appctl revalidator/purge], [0])
1200 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1201  n_packets=3, n_bytes=180, actions=resubmit(1,1)
1202 OFPST_FLOW reply (OF1.2):
1203 ])
1204
1205 OVS_VSWITCHD_STOP
1206 AT_CLEANUP
1207
1208 AT_SETUP([ofproto-dpif - controller])
1209 OVS_VSWITCHD_START([dnl
1210    add-port br0 p1 -- set Interface p1 type=dummy
1211 ])
1212 ON_EXIT([kill `cat ovs-ofctl.pid`])
1213
1214 AT_CAPTURE_FILE([ofctl_monitor.log])
1215 AT_DATA([flows.txt], [dnl
1216 cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
1217 cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
1218 cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1219
1220 cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1221 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)
1222 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)
1223 cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1224 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)
1225 cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1226 cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
1227 cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
1228 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
1229 ])
1230 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1231
1232 dnl Flow miss.
1233 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1234
1235 for i in 1 2 3 ; do
1236     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
1237 done
1238 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1239 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1240
1241 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1242 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1243 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
1244 dnl
1245 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1246 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
1247 dnl
1248 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1249 tcp,in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
1250 ])
1251
1252 dnl Singleton controller action.
1253 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1254
1255 for i in 1 2 3 ; do
1256     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)'
1257 done
1258 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1259 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1260
1261 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1262 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1263 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
1264 dnl
1265 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1266 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
1267 dnl
1268 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1269 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
1270 ])
1271
1272 dnl Modified controller action.
1273 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1274
1275 for i in 1 2 3 ; do
1276     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)'
1277 done
1278 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1279 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1280
1281 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1282 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1283 tcp,in_port=0,dl_vlan=15,dl_vlan_pcp=0,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:0
1284 dnl
1285 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1286 tcp,in_port=0,dl_vlan=15,dl_vlan_pcp=0,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:0
1287 dnl
1288 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1289 tcp,in_port=0,dl_vlan=15,dl_vlan_pcp=0,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:0
1290 ])
1291
1292 dnl Modified VLAN controller action.
1293 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1294
1295 for i in 1 2 3; do
1296     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)'
1297 done
1298 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1299 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1300
1301 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1302 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1303 ip,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1304 dnl
1305 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1306 ip,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1307 dnl
1308 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1309 ip,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:44:41,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=16,nw_tos=0,nw_ecn=0,nw_ttl=64
1310 ])
1311
1312 dnl Checksum TCP.
1313 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1314
1315 for i in 1 ; do
1316     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)'
1317 done
1318 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1319 ovs-appctl -t ovs-ofctl exit
1320
1321 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1322 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1323 tcp,in_port=0,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:0
1324 dnl
1325 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 in_port=1 reg0=0x1 (via action) data_len=64 (unbuffered)
1326 tcp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:0
1327 dnl
1328 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 in_port=1 reg0=0x1 reg1=0x2 (via action) data_len=64 (unbuffered)
1329 tcp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:0
1330 dnl
1331 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 (via action) data_len=64 (unbuffered)
1332 tcp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:0
1333 dnl
1334 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 (via action) data_len=64 (unbuffered)
1335 tcp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:1a03
1336 dnl
1337 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
1338 tcp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:3205
1339 dnl
1340 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
1341 tcp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=11,tcp_flags=fin tcp_csum:31b8
1342 dnl
1343 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
1344 tcp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86,tcp_flags=fin tcp_csum:316d
1345 dnl
1346 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
1347 tcp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86,tcp_flags=fin tcp_csum:316d
1348 ])
1349
1350 dnl Checksum UDP.
1351 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1352
1353 for i in 1 ; do
1354     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'
1355 done
1356 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1357 ovs-appctl -t ovs-ofctl exit
1358
1359 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1360 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1361 udp,in_port=0,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
1362 dnl
1363 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 in_port=1 reg0=0x1 (via action) data_len=64 (unbuffered)
1364 udp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1365 dnl
1366 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 in_port=1 reg0=0x1 reg1=0x2 (via action) data_len=64 (unbuffered)
1367 udp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1368 dnl
1369 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 (via action) data_len=64 (unbuffered)
1370 udp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:1234
1371 dnl
1372 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 (via action) data_len=64 (unbuffered)
1373 udp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:2c37
1374 dnl
1375 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
1376 udp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=8,tp_dst=11 udp_csum:4439
1377 dnl
1378 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
1379 udp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=11 udp_csum:43ec
1380 dnl
1381 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
1382 udp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 udp_csum:43a1
1383 dnl
1384 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered)
1385 udp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 udp_csum:43a1
1386 ])
1387
1388 dnl Modified ARP controller action.
1389 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1390
1391 for i in 1 2 3; do
1392     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)'
1393 done
1394
1395 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1396 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1397 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1398 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1399 arp,in_port=0,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
1400 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1401 arp,in_port=0,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
1402 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1403 arp,in_port=0,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
1404 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1405 arp,in_port=0,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
1406 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1407 arp,in_port=0,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
1408 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1409 arp,in_port=0,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
1410 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1411 arp,in_port=0,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
1412 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1413 arp,in_port=0,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
1414 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1415 arp,in_port=0,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
1416 ])
1417
1418 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1419
1420 dnl Checksum SCTP.
1421 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1422
1423 for i in 1 ; do
1424     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'
1425 done
1426
1427 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
1428 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1429 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1430 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1431 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
1432 sctp,in_port=0,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
1433 dnl
1434 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 in_port=1 reg0=0x1 (via action) data_len=102 (unbuffered)
1435 sctp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1436 dnl
1437 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=102 in_port=1 reg0=0x1 reg1=0x2 (via action) data_len=102 (unbuffered)
1438 sctp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1439 dnl
1440 NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=102 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 (via action) data_len=102 (unbuffered)
1441 sctp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1442 dnl
1443 NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=102 in_port=1 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 (via action) data_len=102 (unbuffered)
1444 sctp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1445 dnl
1446 NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=102 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=102 (unbuffered)
1447 sctp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1112,tp_dst=2223 sctp_csum:d9d79157
1448 dnl
1449 NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=102 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=102 (unbuffered)
1450 sctp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=2223 sctp_csum:7f12662e
1451 dnl
1452 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=102 (unbuffered)
1453 sctp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 sctp_csum:a7e86f67
1454 dnl
1455 NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=102 (unbuffered)
1456 sctp,in_port=0,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=85,tp_dst=86 sctp_csum:a7e86f67
1457 ])
1458
1459 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1460  cookie=0x1, n_packets=3, n_bytes=218, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1461  cookie=0x2, n_packets=3, n_bytes=180, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1462  cookie=0x3, table=1, n_packets=3, n_bytes=218, in_port=80 actions=load:0x1->NXM_NX_REG0[[]],mod_vlan_vid:80,CONTROLLER:65535,resubmit(81,2)
1463  cookie=0x4, table=2, n_packets=3, n_bytes=218, in_port=81 actions=load:0x2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,CONTROLLER:65535,resubmit(82,3)
1464  cookie=0x5, table=3, n_packets=3, n_bytes=218, in_port=82 actions=load:0x3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,CONTROLLER:65535,resubmit(83,4)
1465  cookie=0x6, table=4, n_packets=3, n_bytes=218, in_port=83 actions=load:0x4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,CONTROLLER:65535,resubmit(84,5)
1466  cookie=0x7, table=5, n_packets=3, n_bytes=218, in_port=84 actions=load:0x5->NXM_NX_REG4[[]],load:0x6->NXM_NX_TUN_ID[[]],mod_nw_dst:84.84.84.84,CONTROLLER:65535,resubmit(85,6)
1467  cookie=0x8, table=6, n_packets=3, n_bytes=218, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1468  cookie=0x9, table=7, n_packets=3, n_bytes=218, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1469  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,CONTROLLER:65535
1470  cookie=0xd, n_packets=3, n_bytes=180, arp,dl_src=80:88:88:88:88:88 actions=load:0x2->NXM_OF_ARP_OP[[]],CONTROLLER:65535,load:0xc0a88001->NXM_OF_ARP_SPA[[]],CONTROLLER:65535,load:0x404444444441->NXM_NX_ARP_THA[[]],load:0x1010101->NXM_OF_ARP_SPA[[]],load:0x2020202->NXM_OF_ARP_TPA[[]],CONTROLLER:65535
1471  n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1472 NXST_FLOW reply:
1473 ])
1474
1475 OVS_VSWITCHD_STOP
1476 AT_CLEANUP
1477
1478 AT_SETUP([ofproto-dpif - MPLS handling])
1479 OVS_VSWITCHD_START([dnl
1480    add-port br0 p1 -- set Interface p1 type=dummy
1481 ])
1482 ON_EXIT([kill `cat ovs-ofctl.pid`])
1483
1484 AT_CAPTURE_FILE([ofctl_monitor.log])
1485 AT_DATA([flows.txt], [dnl
1486 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
1487 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
1488 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
1489 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
1490 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
1491 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
1492 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
1493 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
1494 cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
1495 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1496 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1497 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
1498
1499 cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1500 cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1501 cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1502 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
1503 cookie=0xd dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,256,0,OXM_OF_IPV4_SRC[[0..7]]),controller
1504 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
1505 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
1506
1507 cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1508 cookie=0xd table=1 arp actions=controller
1509
1510 cookie=0xd dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48,controller
1511 cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1512 cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1513
1514 cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1515 cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1516 cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1517
1518 cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
1519 cookie=0xd dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1520 cookie=0xd dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1521
1522 cookie=0xd dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1523 cookie=0xd dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1524 cookie=0xd dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1525
1526 cookie=0xd dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1527 cookie=0xd dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1528 cookie=0xd dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1529
1530 cookie=0xd dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1531 cookie=0xd dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1532 cookie=0xd dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
1533 ])
1534 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1535
1536 dnl Modified MPLS controller action.
1537 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1538
1539 for i in 1 2 3; do
1540     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)'
1541 done
1542 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1543 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1544
1545 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1546 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1547 mpls,in_port=0,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
1548 dnl
1549 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1550 mpls,in_port=0,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
1551 dnl
1552 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1553 mpls,in_port=0,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
1554 ])
1555
1556 dnl Modified MPLS controller action.
1557 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1558
1559 for i in 1 2 3; do
1560     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)'
1561 done
1562 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1563 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1564
1565 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1566 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1567 ip,in_port=0,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
1568 dnl
1569 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1570 ip,in_port=0,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
1571 dnl
1572 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1573 ip,in_port=0,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
1574 ])
1575
1576 dnl Modified MPLS controller action.
1577 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1578
1579 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)
1580
1581 for i in 1 2 3; do
1582     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)'
1583 done
1584 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1585 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1586
1587 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1588 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1589 mpls,in_port=0,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
1590 dnl
1591 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1592 mpls,in_port=0,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
1593 dnl
1594 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1595 mpls,in_port=0,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
1596 ])
1597
1598 dnl Modified MPLS controller action.
1599 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1600
1601 for i in 1 2 3; do
1602     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))'
1603 done
1604 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1605 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1606
1607 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1608 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1609 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=7,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1610 dnl
1611 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1612 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=7,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1613 dnl
1614 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1615 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=7,dl_src=40:44:44:44:44:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1616 ])
1617
1618 dnl Modified MPLS controller action.
1619 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1620
1621 for i in 1 2 3; do
1622     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)'
1623 done
1624 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1625 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1626
1627 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1628 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1629 mpls,in_port=0,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
1630 dnl
1631 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1632 mpls,in_port=0,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
1633 dnl
1634 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1635 mpls,in_port=0,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
1636 ])
1637
1638 dnl Modified MPLS controller action.
1639 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1640
1641 for i in 1 2 3; do
1642     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)'
1643 done
1644 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1645 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1646
1647 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1648 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1649 mpls,in_port=0,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
1650 dnl
1651 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1652 mpls,in_port=0,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
1653 dnl
1654 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1655 mpls,in_port=0,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
1656 ])
1657
1658 dnl Modified MPLS controller action.
1659 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1660
1661 for i in 1 2 3; do
1662     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)'
1663 done
1664 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1665 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1666
1667 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1668 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1669 mpls,in_port=0,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
1670 dnl
1671 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1672 mpls,in_port=0,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
1673 dnl
1674 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1675 mpls,in_port=0,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
1676 ])
1677
1678 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1679
1680 dnl Modified MPLS controller action.
1681 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1682
1683 for i in 1 2 3; do
1684     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)'
1685 done
1686 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1687 ovs-appctl -t ovs-ofctl exit
1688
1689 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1690 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1691 mplsm,in_port=0,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
1692 dnl
1693 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1694 mplsm,in_port=0,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
1695 dnl
1696 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1697 mplsm,in_port=0,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
1698 ])
1699
1700 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1701
1702 dnl Modified MPLS controller action.
1703 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1704
1705 for i in 1 2 3; do
1706     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)'
1707 done
1708 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1709 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1710
1711 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1712 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1713 mpls,in_port=0,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
1714 dnl
1715 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1716 mpls,in_port=0,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
1717 dnl
1718 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1719 mpls,in_port=0,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
1720 ])
1721
1722 dnl Modified MPLS actions.
1723 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1724
1725 for i in 1 2 3; do
1726     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)'
1727 done
1728 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1729 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1730
1731 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1732 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1733 mpls,in_port=0,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
1734 dnl
1735 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1736 mpls,in_port=0,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
1737 dnl
1738 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1739 mpls,in_port=0,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
1740 ])
1741
1742 dnl Modified MPLS ipv6 controller action.
1743 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1744
1745 for i in 1 2 3; do
1746     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)'
1747 done
1748 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1749 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1750
1751 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1752 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1753 mplsm,in_port=0,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
1754 dnl
1755 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1756 mplsm,in_port=0,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
1757 dnl
1758 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1759 mplsm,in_port=0,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
1760 ])
1761
1762
1763 dnl Modified MPLS pop action.
1764 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
1765 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)
1766 dnl             (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
1767
1768 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1769
1770 for i in 1 2 3; do
1771     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'
1772 done
1773 #for i in 2 3; do
1774 #    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)'
1775 #done
1776 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1777 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1778
1779 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1780 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1781 tcp,in_port=0,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
1782 dnl
1783 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1784 tcp,in_port=0,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
1785 dnl
1786 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1787 tcp,in_port=0,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
1788 ])
1789
1790 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1791
1792 dnl Modified MPLS pop action.
1793 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1794 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)
1795 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1796 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1797 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1798
1799 for i in 1 2 3; do
1800     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'
1801 done
1802 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1803 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1804
1805 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1806 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1807 tcp,in_port=0,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
1808 dnl
1809 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1810 tcp,in_port=0,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
1811 dnl
1812 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1813 tcp,in_port=0,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
1814 ])
1815
1816 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1817
1818 dnl Modified MPLS pop action.
1819 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1820 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)
1821 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1822 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1823 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1824
1825 for i in 1 2 3; do
1826     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'
1827 done
1828 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1829 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1830
1831 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1832 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1833 tcp,in_port=0,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
1834 dnl
1835 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1836 tcp,in_port=0,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
1837 dnl
1838 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1839 tcp,in_port=0,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
1840 ])
1841
1842 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1843
1844 dnl Modified MPLS pop action.
1845 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1846 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)
1847 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1848 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1849 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1850
1851 for i in 1 2 3; do
1852     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'
1853 done
1854 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1855 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1856
1857 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1858 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1859 tcp,in_port=0,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
1860 dnl
1861 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1862 tcp,in_port=0,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
1863 dnl
1864 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1865 tcp,in_port=0,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
1866 ])
1867
1868 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1869
1870 dnl Modified MPLS pop action.
1871 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1872 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)
1873 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1874 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1875 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1876
1877 for i in 1 2 3; do
1878     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'
1879 done
1880 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1881 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1882
1883 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1884 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1885 tcp,in_port=0,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
1886 dnl
1887 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1888 tcp,in_port=0,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
1889 dnl
1890 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1891 tcp,in_port=0,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
1892 ])
1893
1894 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1895
1896 dnl Modified MPLS pop action.
1897 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1898 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)
1899 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1900 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1901 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1902
1903 for i in 1 2 3; do
1904     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'
1905 done
1906 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1907 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1908
1909 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1910 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1911 tcp,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,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:76db
1912 dnl
1913 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1914 tcp,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,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:76db
1915 dnl
1916 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1917 tcp,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,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:76db
1918 ])
1919
1920 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1921
1922 dnl Modified MPLS pop action.
1923 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1924 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)
1925 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1926 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1927 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1928
1929 for i in 1 2 3; do
1930     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'
1931 done
1932 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1933 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1934
1935 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1936 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1937 tcp,in_port=0,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
1938 dnl
1939 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1940 tcp,in_port=0,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
1941 dnl
1942 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1943 tcp,in_port=0,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
1944 ])
1945
1946 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1947
1948 dnl Modified MPLS pop action.
1949 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1950 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)
1951 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1952 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1953 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1954
1955 for i in 1 2 3; do
1956     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'
1957 done
1958 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1959 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1960
1961 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1962 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1963 tcp,in_port=0,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
1964 dnl
1965 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1966 tcp,in_port=0,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
1967 dnl
1968 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1969 tcp,in_port=0,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
1970 ])
1971
1972 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1973
1974 dnl Modified MPLS pop action.
1975 dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
1976 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)
1977 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1978
1979 for i in 1 2 3; do
1980     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'
1981 done
1982 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1983 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1984
1985 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1986 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
1987 arp,in_port=0,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
1988 dnl
1989 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
1990 arp,in_port=0,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
1991 dnl
1992 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
1993 arp,in_port=0,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
1994 ])
1995
1996 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1997
1998 dnl Modified MPLS pop action.
1999 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2000 dnl 60:66:66:66:00:09 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2001 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2002 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2003 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2004
2005 for i in 1 2 3; do
2006     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 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'
2007 done
2008 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2009 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2010
2011 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2012 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2013 tcp,in_port=0,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
2014 dnl
2015 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2016 tcp,in_port=0,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
2017 dnl
2018 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2019 tcp,in_port=0,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
2020 ])
2021
2022 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2023
2024 dnl Modified MPLS pop action.
2025 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2026 dnl 60:66:66:66:00:0a > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2027 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2028 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2029 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2030
2031 for i in 1 2 3; do
2032     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 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'
2033 done
2034 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2035 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2036
2037 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2038 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2039 tcp,in_port=0,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
2040 dnl
2041 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2042 tcp,in_port=0,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
2043 dnl
2044 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2045 tcp,in_port=0,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
2046 ])
2047
2048 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2049
2050 dnl Modified MPLS pop action.
2051 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2052 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)
2053 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2054 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2055 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2056
2057 for i in 1 2 3; do
2058     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'
2059 done
2060 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2061 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2062
2063 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2064 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2065 tcp,in_port=0,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
2066 dnl
2067 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2068 tcp,in_port=0,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
2069 dnl
2070 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2071 tcp,in_port=0,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
2072 ])
2073
2074 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2075
2076 dnl Modified MPLS pop action.
2077 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2078 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)
2079 dnl             (label 20, exp 0, [S], ttl 31)
2080 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2081 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2082 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2083
2084 for i in 1 2 3; do
2085     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'
2086 done
2087 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2088 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2089
2090 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2091 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2092 mplsm,in_port=0,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
2093 dnl
2094 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2095 mplsm,in_port=0,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
2096 dnl
2097 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2098 mplsm,in_port=0,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
2099 ])
2100
2101 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2102
2103 dnl Modified MPLS pop action.
2104 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2105 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)
2106 dnl             (label 20, exp 0, [S], ttl 31)
2107 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2108 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2109 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2110
2111 for i in 1 2 3; do
2112     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'
2113 done
2114 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2115 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2116
2117 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2118 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2119 mpls,in_port=0,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
2120 dnl
2121 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2122 mpls,in_port=0,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
2123 dnl
2124 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2125 mpls,in_port=0,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
2126 ])
2127
2128 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2129
2130 dnl Modified MPLS pop action.
2131 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2132 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)
2133 dnl             (label 20, exp 0, [S], ttl 31)
2134 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2135 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2136 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2137
2138 for i in 1 2 3; do
2139     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'
2140 done
2141 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2142 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2143
2144 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2145 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2146 mplsm,in_port=0,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
2147 dnl
2148 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2149 mplsm,in_port=0,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
2150 dnl
2151 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2152 mplsm,in_port=0,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
2153 ])
2154
2155 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2156
2157 dnl Modified MPLS pop action.
2158 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2159 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)
2160 dnl             (label 20, exp 0, [S], ttl 31)
2161 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2162 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2163 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2164
2165 for i in 1 2 3; do
2166     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'
2167 done
2168 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2169 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2170
2171 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2172 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2173 tcp,in_port=0,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
2174 dnl
2175 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2176 tcp,in_port=0,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
2177 dnl
2178 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2179 tcp,in_port=0,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
2180 ])
2181
2182 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2183
2184 dnl Modified MPLS pop action.
2185 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2186 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)
2187 dnl             (label 20, exp 0, [S], ttl 31)
2188 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2189 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2190 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2191
2192 for i in 1 2 3; do
2193     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'
2194 done
2195 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2196 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2197
2198 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2199 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2200 tcp,in_port=0,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
2201 dnl
2202 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2203 tcp,in_port=0,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
2204 dnl
2205 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2206 tcp,in_port=0,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
2207 ])
2208
2209 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2210
2211 dnl Modified MPLS pop action.
2212 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2213 dnl 60:66:66:66:02:10 > 50:54:00:00:02:10, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2214 dnl             (label 20, exp 0, [S], ttl 31)
2215 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2216 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2217 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2218
2219 for i in 1 2 3; do
2220     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'
2221 done
2222 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2223 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2224
2225 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2226 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2227 tcp,in_port=0,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
2228 dnl
2229 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2230 tcp,in_port=0,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
2231 dnl
2232 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2233 tcp,in_port=0,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
2234 ])
2235
2236 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2237
2238 dnl Modified MPLS pop action.
2239 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2240 dnl 60:66:66:66:03:00 > 50:54:00:00:00:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2241 dnl             (label 20, exp 0, ttl 31)
2242 dnl             (label 20, exp 0, [S], ttl 30)
2243 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2244 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2245 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2246
2247 for i in 1 2 3; do
2248     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'
2249 done
2250 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2251 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2252
2253 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2254 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2255 mplsm,in_port=0,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
2256 dnl
2257 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2258 mplsm,in_port=0,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
2259 dnl
2260 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2261 mplsm,in_port=0,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
2262 ])
2263
2264 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2265
2266 dnl Modified MPLS pop action.
2267 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2268 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)
2269 dnl             (label 20, exp 0, ttl 31)
2270 dnl             (label 20, exp 0, [S], ttl 30)
2271 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2272 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2273 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2274
2275 for i in 1 2 3; do
2276     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'
2277 done
2278 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2279 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2280
2281 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2282 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2283 mpls,in_port=0,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
2284 dnl
2285 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2286 mpls,in_port=0,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
2287 dnl
2288 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2289 mpls,in_port=0,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
2290 ])
2291
2292 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2293
2294 dnl Modified MPLS pop action.
2295 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2296 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)
2297 dnl             (label 20, exp 0, ttl 31)
2298 dnl             (label 20, exp 0, [S], ttl 30)
2299 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2300 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2301 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2302
2303 for i in 1 2 3; do
2304     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'
2305 done
2306 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2307 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2308
2309 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2310 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2311 mplsm,in_port=0,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
2312 dnl
2313 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2314 mplsm,in_port=0,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
2315 dnl
2316 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2317 mplsm,in_port=0,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
2318 ])
2319
2320 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2321
2322 dnl Modified MPLS pop action.
2323 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2324 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)
2325 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2326 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2327 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2328
2329 for i in 1 2 3; do
2330     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'
2331 done
2332 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2333 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2334
2335 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2336 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2337 mpls,in_port=0,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
2338 dnl
2339 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2340 mpls,in_port=0,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
2341 dnl
2342 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2343 mpls,in_port=0,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
2344 ])
2345
2346 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2347
2348 dnl Modified MPLS pop action.
2349 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2350 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)
2351 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2352 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2353 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2354
2355 for i in 1 2 3; do
2356     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'
2357 done
2358 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2359 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2360
2361 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2362 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2363 mplsm,in_port=0,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
2364 dnl
2365 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2366 mplsm,in_port=0,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
2367 dnl
2368 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2369 mplsm,in_port=0,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
2370 ])
2371
2372 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2373
2374 dnl Modified MPLS pop action.
2375 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2376 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)
2377 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2378 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2379 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2380
2381 for i in 1 2 3; do
2382     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'
2383 done
2384 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2385 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2386
2387 AT_CHECK([STRIP_METADATA  ofctl_monitor.log], [0], [dnl
2388 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2389 mplsm,in_port=0,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
2390 dnl
2391 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2392 mplsm,in_port=0,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
2393 dnl
2394 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2395 mplsm,in_port=0,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
2396 ])
2397
2398 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2399
2400 dnl Modified MPLS pop action.
2401 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2402 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)
2403 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2404 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2405 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2406
2407 for i in 1 2 3; do
2408     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'
2409 done
2410 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2411 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2412
2413 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2414 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2415 mpls,in_port=0,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
2416 dnl
2417 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2418 mpls,in_port=0,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
2419 dnl
2420 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2421 mpls,in_port=0,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
2422 ])
2423
2424 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2425
2426 dnl Modified MPLS pop action.
2427 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2428 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)
2429 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2430 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2431 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2432
2433 for i in 1 2 3; do
2434     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'
2435 done
2436 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2437 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2438
2439 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2440 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2441 mplsm,in_port=0,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
2442 dnl
2443 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2444 mplsm,in_port=0,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
2445 dnl
2446 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2447 mplsm,in_port=0,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
2448 ])
2449
2450 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2451
2452 dnl Modified MPLS pop action.
2453 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2454 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)
2455 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2456 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2457 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2458
2459 for i in 1 2 3; do
2460     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'
2461 done
2462 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2463 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2464
2465 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2466 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2467 mpls,in_port=0,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
2468 dnl
2469 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2470 mpls,in_port=0,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
2471 dnl
2472 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2473 mpls,in_port=0,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
2474 ])
2475
2476 AT_CHECK([ovs-appctl revalidator/purge], [0])
2477 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2478  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:42 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2479  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:43 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2480  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:44 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2481  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:45 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,CONTROLLER:65535
2482  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:46 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),CONTROLLER:65535
2483  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:47 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],dec_mpls_ttl,set_mpls_ttl(10),CONTROLLER:65535
2484  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:44:48 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],set_mpls_ttl(10),dec_mpls_ttl,CONTROLLER:65535
2485  cookie=0xa, n_packets=3, n_bytes=180, dl_src=41:44:44:44:44:42 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],pop_mpls:0x0800,CONTROLLER:65535
2486  cookie=0xa, n_packets=3, n_bytes=180, mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
2487  cookie=0xb, n_packets=3, n_bytes=180, mpls,dl_src=50:55:55:55:55:55 actions=load:0x3e8->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
2488  cookie=0xc, n_packets=3, n_bytes=180, dl_src=70:77:77:77:77:77 actions=push_mpls:0x8848,load:0x3e8->OXM_OF_MPLS_LABEL[[]],load:0x7->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2489  cookie=0xd, n_packets=3, n_bytes=180, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
2490  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
2491  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
2492  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
2493  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
2494  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,256,0,NXM_OF_IP_SRC[[0..7]]),CONTROLLER:65535
2495  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
2496  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
2497  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48,CONTROLLER:65535
2498  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
2499  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
2500  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,CONTROLLER:65535
2501  cookie=0xd, 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
2502  cookie=0xd, 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
2503  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,CONTROLLER:65535
2504  cookie=0xd, 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
2505  cookie=0xd, 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
2506  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
2507  cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2508  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
2509  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
2510  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
2511  cookie=0xd, 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
2512  cookie=0xd, 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
2513  cookie=0xd, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,CONTROLLER:65535
2514  cookie=0xd, 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
2515  cookie=0xd, 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
2516  cookie=0xd, table=1, n_packets=3, n_bytes=168, arp actions=CONTROLLER:65535
2517 NXST_FLOW reply:
2518 ])
2519
2520 OVS_VSWITCHD_STOP
2521 AT_CLEANUP
2522
2523 AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2524 OVS_VSWITCHD_START([dnl
2525    add-port br0 p1 -- set Interface p1 type=dummy
2526 ])
2527 ON_EXIT([kill `cat ovs-ofctl.pid`])
2528
2529 AT_CAPTURE_FILE([ofctl_monitor.log])
2530 AT_DATA([flows.txt], [dnl
2531 table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2532 table=1 ip,ip_dscp=8 actions=controller
2533 ])
2534 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2535
2536
2537 dnl Modified MPLS pop action.
2538 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2539 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)
2540 dnl             (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2541 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2542 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2543
2544 for i in 1 2 3; do
2545     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'
2546 done
2547 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2548 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2549
2550 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2551 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2552 tcp,in_port=0,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
2553 dnl
2554 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2555 tcp,in_port=0,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
2556 dnl
2557 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2558 tcp,in_port=0,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
2559 ])
2560
2561 AT_CHECK([ovs-appctl revalidator/purge], [0])
2562 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2563  n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
2564  table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
2565 OFPST_FLOW reply (OF1.2):
2566 ])
2567
2568 OVS_VSWITCHD_STOP
2569 AT_CLEANUP
2570
2571 AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
2572 OVS_VSWITCHD_START([dnl
2573    add-port br0 p1 -- set Interface p1 type=dummy
2574 ])
2575 ON_EXIT([kill `cat ovs-ofctl.pid`])
2576
2577 dnl N.B: The first (and only) action that accesses L3 data after the
2578 dnl pop_mpls action is present in write_actions. This exercises recirculation
2579 dnl triggered in write_actions due to a previous action not in write actions.
2580 AT_CAPTURE_FILE([ofctl_monitor.log])
2581 AT_DATA([flows.txt], [dnl
2582 mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
2583 ])
2584 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2585
2586 dnl Modified MPLS pop action.
2587 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2588 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)
2589 dnl             (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2590 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2591 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2592
2593 for i in 1 2 3; do
2594     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'
2595 done
2596 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2597 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2598
2599 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2600 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=254 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2601 tcp,in_port=0,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
2602 dnl
2603 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=254 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2604 tcp,in_port=0,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
2605 dnl
2606 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=254 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2607 tcp,in_port=0,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
2608 ])
2609
2610 AT_CHECK([ovs-appctl revalidator/purge], [0])
2611 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2612  n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
2613 OFPST_FLOW reply (OF1.2):
2614 ])
2615
2616 OVS_VSWITCHD_STOP
2617 AT_CLEANUP
2618
2619 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
2620 OVS_VSWITCHD_START([dnl
2621    add-port br0 p1 -- set Interface p1 type=dummy
2622 ])
2623 ON_EXIT([kill `cat ovs-ofctl.pid`])
2624
2625 AT_CAPTURE_FILE([ofctl_monitor.log])
2626 # A table-miss flow has priority 0 and no match
2627 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2628
2629 dnl Singleton controller action.
2630 AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2631
2632 for i in 1 2 3 ; do
2633     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)'
2634 done
2635 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2636 ovs-appctl -t ovs-ofctl exit
2637
2638 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2639 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2640 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2641 dnl
2642 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2643 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2644 dnl
2645 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2646 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2647 ])
2648
2649 AT_CHECK([ovs-appctl revalidator/purge], [0])
2650 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2651  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2652 NXST_FLOW reply:
2653 ])
2654
2655 OVS_VSWITCHD_STOP
2656 AT_CLEANUP
2657
2658
2659 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
2660 OVS_VSWITCHD_START([dnl
2661    add-port br0 p1 -- set Interface p1 type=dummy
2662 ])
2663 ON_EXIT([kill `cat ovs-ofctl.pid`])
2664
2665 AT_CAPTURE_FILE([ofctl_monitor.log])
2666 # A table-miss flow has priority 0 and no match
2667 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2668
2669 dnl Singleton controller action.
2670 AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2671
2672 for i in 1 2 3 ; do
2673     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)'
2674 done
2675 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2676 ovs-appctl -t ovs-ofctl exit
2677
2678 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2679
2680 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2681 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2682 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2683 dnl
2684 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2685 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2686 dnl
2687 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2688 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2689 ])
2690
2691 AT_CHECK([ovs-appctl revalidator/purge], [0])
2692 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2693  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2694 OFPST_FLOW reply (OF1.3):
2695 ])
2696
2697 OVS_VSWITCHD_STOP
2698 AT_CLEANUP
2699
2700 AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
2701 OVS_VSWITCHD_START([dnl
2702    add-port br0 p1 -- set Interface p1 type=dummy
2703 ])
2704 ON_EXIT([kill `cat ovs-ofctl.pid`])
2705
2706 ovs-appctl time/stop
2707
2708 AT_CAPTURE_FILE([ofctl_monitor.log])
2709 # A table-miss flow has priority 0 and no match
2710 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2711
2712 dnl Singleton controller action.
2713 AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2714
2715 # Become slave (OF 1.3), which should disable everything except port status.
2716 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2717
2718 # Ensure that ovs-vswitchd gets a chance to reply before sending another command.
2719 ovs-appctl time/warp 500 100
2720
2721 # Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
2722 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
2723
2724 ovs-appctl time/warp 500 100
2725 for i in 1 2 3 ; do
2726     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)'
2727 done
2728 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2729 ovs-appctl -t ovs-ofctl exit
2730
2731 AT_CHECK([ovs-appctl revalidator/purge], [0])
2732 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2733 send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
2734 OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
2735 dnl
2736 send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
2737  master:
2738        PACKET_IN: (off)
2739      PORT_STATUS: (off)
2740     FLOW_REMOVED: (off)
2741
2742  slave:
2743        PACKET_IN: no_match
2744      PORT_STATUS: (off)
2745     FLOW_REMOVED: (off)
2746 dnl
2747 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2748 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2749 dnl
2750 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2751 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2752 dnl
2753 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2754 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2755 ])
2756
2757 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2758
2759 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2760  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2761 OFPST_FLOW reply (OF1.3):
2762 ])
2763
2764 OVS_VSWITCHD_STOP
2765 AT_CLEANUP
2766
2767
2768 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
2769 OVS_VSWITCHD_START([dnl
2770    add-port br0 p1 -- set Interface p1 type=dummy
2771 ])
2772 ON_EXIT([kill `cat ovs-ofctl.pid`])
2773
2774 AT_CAPTURE_FILE([ofctl_monitor.log])
2775 # A table-miss flow has priority 0 and no match
2776 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2777
2778 dnl Singleton controller action.
2779 AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2780
2781 for i in 1 2 3 ; do
2782     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)'
2783 done
2784 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2785 ovs-appctl -t ovs-ofctl exit
2786
2787 AT_CHECK([ovs-appctl revalidator/purge], [0])
2788 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2789 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2790 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2791 dnl
2792 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2793 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2794 dnl
2795 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2796 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2797 ])
2798
2799 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2800
2801 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2802  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2803 OFPST_FLOW reply (OF1.4):
2804 ])
2805
2806 OVS_VSWITCHD_STOP
2807 AT_CLEANUP
2808
2809
2810
2811 AT_SETUP([ofproto-dpif - packet-in reason in group table (Openflow 1.3)])
2812 OVS_VSWITCHD_START([dnl
2813    add-port br0 p1 -- set Interface p1 type=dummy
2814 ])
2815 ON_EXIT([kill `cat ovs-ofctl.pid`])
2816
2817 AT_CAPTURE_FILE([ofctl_monitor.log])
2818 # A table-miss flow has priority 0 and no match
2819 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
2820 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'in_port=1 actions=group:1234'])
2821
2822 dnl Singleton controller action.
2823 AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2824
2825 for i in 1 2 3 ; do
2826     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)'
2827 done
2828 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2829 ovs-appctl -t ovs-ofctl exit
2830
2831 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2832
2833 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2834 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2835 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2836 dnl
2837 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2838 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2839 dnl
2840 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2841 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2842 ])
2843
2844 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2845
2846 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2847  n_packets=3, n_bytes=180, in_port=1 actions=group:1234
2848 OFPST_FLOW reply (OF1.3):
2849 ])
2850
2851 OVS_VSWITCHD_STOP
2852 AT_CLEANUP
2853
2854
2855 AT_SETUP([ofproto-dpif - packet-in reason in group table (Openflow 1.4)])
2856 OVS_VSWITCHD_START([dnl
2857    add-port br0 p1 -- set Interface p1 type=dummy
2858 ])
2859 ON_EXIT([kill `cat ovs-ofctl.pid`])
2860
2861 AT_CAPTURE_FILE([ofctl_monitor.log])
2862 # A table-miss flow has priority 0 and no match
2863 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
2864 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'in_port=1 actions=group:1234'])
2865
2866 dnl Singleton controller action.
2867 AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2868
2869 for i in 1 2 3 ; do
2870     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)'
2871 done
2872 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2873 ovs-appctl -t ovs-ofctl exit
2874
2875 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2876
2877 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2878 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
2879 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2880 dnl
2881 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
2882 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2883 dnl
2884 OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
2885 tcp,in_port=0,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
2886 ])
2887
2888 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2889
2890 AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2891  n_packets=3, n_bytes=180, in_port=1 actions=group:1234
2892 OFPST_FLOW reply (OF1.4):
2893 ])
2894
2895 OVS_VSWITCHD_STOP
2896 AT_CLEANUP
2897
2898 AT_SETUP([ofproto-dpif - ARP modification slow-path])
2899 OVS_VSWITCHD_START
2900 ADD_OF_PORTS([br0], [1], [2])
2901
2902 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
2903 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'
2904
2905 # Input some packets that should follow the arp modification slow-path.
2906 for i in 1 2 3; do
2907     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)'
2908 done
2909 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2910
2911 # Check the packets that were output.
2912 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
2913 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
2914 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
2915 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
2916 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
2917 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
2918 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
2919 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
2920 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
2921 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
2922 ])
2923
2924 OVS_VSWITCHD_STOP
2925 AT_CLEANUP
2926
2927 AT_SETUP([ofproto-dpif - VLAN handling])
2928 OVS_VSWITCHD_START(
2929   [set Bridge br0 fail-mode=standalone -- \
2930    add-port br0 p1                                  trunks=10,12 -- \
2931    add-port br0 p2                           tag=10              -- \
2932    add-port br0 p3                           tag=12              \
2933                    other-config:priority-tags=true               -- \
2934    add-port br0 p4                           tag=12              -- \
2935    add-port br0 p5 vlan_mode=native-tagged   tag=10              -- \
2936    add-port br0 p6 vlan_mode=native-tagged   tag=10 trunks=10,12 -- \
2937    add-port br0 p7 vlan_mode=native-untagged tag=12              -- \
2938    add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
2939                    other-config:priority-tags=true               -- \
2940    set Interface p1 type=dummy -- \
2941    set Interface p2 type=dummy -- \
2942    set Interface p3 type=dummy -- \
2943    set Interface p4 type=dummy -- \
2944    set Interface p5 type=dummy -- \
2945    set Interface p6 type=dummy -- \
2946    set Interface p7 type=dummy -- \
2947    set Interface p8 type=dummy --])
2948
2949 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
2950 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
2951 dnl actions.
2952 for tuple in \
2953         "100 none 0 drop" \
2954         "100 0    0 drop" \
2955         "100 0    1 drop" \
2956         "100 10   0 1,5,6,7,8,pop_vlan,2" \
2957         "100 10   1 1,5,6,7,8,pop_vlan,2" \
2958         "100 11   0 5,7" \
2959         "100 11   1 5,7" \
2960         "100 12   0 1,5,6,pop_vlan,3,4,7,8" \
2961         "100 12   1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
2962         "1  none 0 drop" \
2963         "1  0    0 drop" \
2964         "1  0    1 drop" \
2965         "1  10   0 5,6,7,8,100,pop_vlan,2" \
2966         "1  10   1 5,6,7,8,100,pop_vlan,2" \
2967         "1  11   0 drop" \
2968         "1  11   1 drop" \
2969         "1  12   0 5,6,100,pop_vlan,3,4,7,8" \
2970         "1  12   1 5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
2971         "2  none 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
2972         "2  0    0 pop_vlan,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
2973         "2  0    1 pop_vlan,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
2974         "2  10   0 drop" \
2975         "2  10   1 drop" \
2976         "2  11   0 drop" \
2977         "2  11   1 drop" \
2978         "2  12   0 drop" \
2979         "2  12   1 drop" \
2980         "3  none 0 4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
2981         "3  0    0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
2982         "3  0    1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
2983         "3  10   0 drop" \
2984         "3  10   1 drop" \
2985         "3  11   0 drop" \
2986         "3  11   1 drop" \
2987         "3  12   0 drop" \
2988         "3  12   1 drop" \
2989         "4  none 0 3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
2990         "4  0    0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
2991         "4  0    1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
2992         "4  10   0 drop" \
2993         "4  10   1 drop" \
2994         "4  11   0 drop" \
2995         "4  11   1 drop" \
2996         "4  12   0 drop" \
2997         "4  12   1 drop" \
2998         "5  none 0 2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
2999         "5  0    0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3000         "5  0    1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3001         "5  10   0 1,6,7,8,100,pop_vlan,2" \
3002         "5  10   1 1,6,7,8,100,pop_vlan,2" \
3003         "5  11   0 7,100" \
3004         "5  11   1 7,100" \
3005         "5  12   0 1,6,100,pop_vlan,3,4,7,8" \
3006         "5  12   1 1,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3007         "6  none 0 2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3008         "6  0    0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3009         "6  0    1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3010         "6  10   0 1,5,7,8,100,pop_vlan,2" \
3011         "6  10   1 1,5,7,8,100,pop_vlan,2" \
3012         "6  11   0 drop" \
3013         "6  11   1 drop" \
3014         "6  12   0 1,5,100,pop_vlan,3,4,7,8" \
3015         "6  12   1 1,5,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3016         "7  none 0 3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3017         "7  0    0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3018         "7  0    1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),1,5,6,100" \
3019         "7  10   0 1,5,6,8,100,pop_vlan,2" \
3020         "7  10   1 1,5,6,8,100,pop_vlan,2" \
3021         "7  11   0 5,100" \
3022         "7  11   1 5,100" \
3023         "7  12   0 1,5,6,100,pop_vlan,3,4,8" \
3024         "7  12   1 1,5,6,100,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
3025         "8  none 0 3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
3026         "8  0    0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
3027         "8  0    1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
3028         "8  10   0 1,5,6,7,100,pop_vlan,2" \
3029         "8  10   1 1,5,6,7,100,pop_vlan,2" \
3030         "8  11   0 drop" \
3031         "8  11   1 drop" \
3032         "8  12   0 1,5,6,100,pop_vlan,3,4,7" \
3033         "8  12   1 1,5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
3034 do
3035   set $tuple
3036   in_port=$1
3037   vlan=$2
3038   pcp=$3
3039   expected=$4
3040
3041   if test $vlan = none; then
3042     flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
3043   else
3044     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))"
3045   fi
3046
3047   echo "----------------------------------------------------------------------"
3048   echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3049
3050   AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3051   actual=`tail -1 stdout | sed 's/Datapath actions: //'`
3052
3053   AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
3054   mv stdout expout
3055   AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
3056 done
3057
3058 OVS_VSWITCHD_STOP
3059 AT_CLEANUP
3060
3061 AT_SETUP([ofproto-dpif - MPLS handling])
3062 OVS_VSWITCHD_START([dnl
3063    add-port br0 p1 -- set Interface p1 type=dummy
3064 ])
3065 ON_EXIT([kill `cat ovs-ofctl.pid`])
3066
3067 AT_CAPTURE_FILE([ofctl_monitor.log])
3068 AT_DATA([flows.txt], [dnl
3069 dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
3070 dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
3071 dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
3072 ])
3073 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3074
3075 dnl In this test, we push an MPLS tag to an ethernet packet.
3076 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3077
3078 for i in 1 2 3; do
3079     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)'
3080 done
3081 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3082 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3083
3084 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3085 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3086 mpls,in_port=0,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
3087 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3088 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3089 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3090 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3091 dnl
3092 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3093 mpls,in_port=0,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
3094 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3095 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3096 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3097 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3098 dnl
3099 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3100 mpls,in_port=0,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
3101 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
3102 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
3103 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
3104 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3105 ])
3106
3107 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3108 dnl copied exactly, except for the BOS bit.
3109 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3110
3111 for i in 1 2 3; do
3112     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)'
3113 done
3114 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3115 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3116
3117 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3118 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3119 mpls,in_port=0,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
3120 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3121 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3122 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3123 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3124 dnl
3125 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3126 mpls,in_port=0,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
3127 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3128 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3129 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3130 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3131 dnl
3132 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3133 mpls,in_port=0,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
3134 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
3135 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3136 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3137 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3138 ])
3139
3140 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3141 dnl copied exactly, except for the BOS bit. The ethertype should be updated
3142 dnl to the MPLS ethertype of the MPLS push action which differs to that
3143 dnl of the input packet.
3144 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3145
3146 for i in 1 2 3; do
3147     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)'
3148 done
3149 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3150 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
3151
3152 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3153 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3154 mplsm,in_port=0,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
3155 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3156 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3157 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3158 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3159 dnl
3160 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3161 mplsm,in_port=0,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
3162 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3163 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3164 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3165 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3166 dnl
3167 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3168 mplsm,in_port=0,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
3169 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
3170 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
3171 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3172 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3173 ])
3174
3175 OVS_VSWITCHD_STOP
3176 AT_CLEANUP
3177
3178 AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3179 OVS_VSWITCHD_START([dnl
3180    add-port br0 p1 -- set Interface p1 type=dummy
3181 ])
3182 ON_EXIT([kill `cat ovs-ofctl.pid`])
3183
3184 AT_CAPTURE_FILE([ofctl_monitor.log])
3185 AT_DATA([flows.txt], [dnl
3186 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
3187 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
3188 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
3189 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
3190 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
3191 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
3192 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
3193 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
3194 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
3195 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
3196 ])
3197 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3198
3199 dnl Modified MPLS controller action.
3200 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3201 dnl both of these in the final flow
3202 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3203
3204 for i in 1 2 3; do
3205     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)'
3206 done
3207 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3208 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3209
3210 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3211 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3212 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3213 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3214 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3215 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3216 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3217 00000040  00 00 00 00
3218 dnl
3219 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3220 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3221 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3222 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3223 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3224 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3225 00000040  00 00 00 00
3226 dnl
3227 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3228 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3229 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
3230 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3231 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3232 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3233 00000040  00 00 00 00
3234 ])
3235
3236 dnl Modified MPLS controller action.
3237 dnl In this test, the input packet in vlan-tagged, which should be stripped
3238 dnl before we push the MPLS and VLAN tags.
3239 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3240
3241 for i in 1 2 3; do
3242     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))'
3243 done
3244 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3245 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3246
3247 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3248 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3249 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3250 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3251 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3252 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3253 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3254 dnl
3255 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3256 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3257 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3258 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3259 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3260 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3261 dnl
3262 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3263 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3264 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
3265 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3266 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3267 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3268 ])
3269
3270 dnl Modified MPLS controller action.
3271 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3272 dnl both of these in the final flow
3273 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3274
3275 for i in 1 2 3; do
3276     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)'
3277 done
3278 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3279 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3280
3281 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3282 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3283 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3284 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3285 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3286 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3287 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3288 00000040  00 00 00 00
3289 dnl
3290 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3291 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3292 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3293 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3294 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3295 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3296 00000040  00 00 00 00
3297 dnl
3298 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3299 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3300 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
3301 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3302 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3303 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3304 00000040  00 00 00 00
3305 ])
3306
3307 dnl Modified MPLS controller action.
3308 dnl In this test, the input packet in vlan-tagged, which should be stripped
3309 dnl before we push the MPLS and VLAN tags.
3310 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3311
3312 for i in 1 2 3; do
3313     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))'
3314 done
3315 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3316 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3317
3318 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3319 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3320 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3321 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3322 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3323 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3324 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3325 dnl
3326 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3327 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3328 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3329 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3330 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3331 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3332 dnl
3333 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3334 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3335 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
3336 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3337 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3338 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3339 ])
3340
3341 dnl Modified MPLS controller action.
3342 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3343 dnl actions are reordered, so we see both of these in the final flow.
3344 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3345
3346 for i in 1 2 3; do
3347     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)'
3348 done
3349 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3350 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3351
3352 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3353 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3354 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3355 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3356 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3357 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3358 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3359 00000040  00 00 00 00
3360 dnl
3361 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3362 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3363 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3364 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3365 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3366 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3367 00000040  00 00 00 00
3368 dnl
3369 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3370 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3371 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3372 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3373 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3374 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3375 00000040  00 00 00 00
3376 ])
3377
3378 dnl Modified MPLS controller action.
3379 dnl In this test, the input packet in vlan-tagged, which should be stripped
3380 dnl before we push the MPLS and VLAN tags.
3381 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3382
3383 for i in 1 2 3; do
3384     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))'
3385 done
3386 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3387 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3388
3389 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3390 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3391 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3392 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3393 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3394 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3395 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3396 dnl
3397 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3398 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3399 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3400 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3401 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3402 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3403 dnl
3404 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3405 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3406 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3407 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3408 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3409 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3410 ])
3411
3412 dnl Modified MPLS controller action.
3413 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3414 dnl actions are reordered, so we see both of these in the final flow.
3415 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3416
3417 for i in 1 2 3; do
3418     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)'
3419 done
3420 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3421 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3422
3423 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3424 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3425 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3426 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3427 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3428 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3429 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3430 00000040  00 00 00 00
3431 dnl
3432 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3433 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3434 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3435 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3436 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3437 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3438 00000040  00 00 00 00
3439 dnl
3440 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3441 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3442 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3443 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3444 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3445 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3446 00000040  00 00 00 00
3447 ])
3448
3449 dnl Modified MPLS controller action.
3450 dnl In this test, the input packet in vlan-tagged, which should be stripped
3451 dnl before we push the MPLS and VLAN tags.
3452 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
3453
3454 for i in 1 2 3; do
3455     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))'
3456 done
3457 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3458 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3459
3460 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3461 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3462 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3463 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3464 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3465 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3466 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3467 dnl
3468 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3469 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3470 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3471 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3472 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3473 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3474 dnl
3475 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3476 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3477 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3478 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3479 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3480 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3481 ])
3482
3483 dnl Modified MPLS controller action.
3484 dnl In this test, the input packet in vlan-tagged, which should be stripped
3485 dnl before we push the MPLS and VLAN tags.
3486 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3487
3488 for i in 1 2 3; do
3489     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))'
3490 done
3491 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3492 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3493
3494 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3495 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3496 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3497 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3498 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3499 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3500 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3501 dnl
3502 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3503 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3504 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3505 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3506 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3507 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3508 dnl
3509 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3510 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3511 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3512 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3513 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3514 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3515 ])
3516
3517 dnl Modified MPLS controller action.
3518 dnl In this test, the input packet in vlan-tagged, which should be modified
3519 dnl before we push MPLS and VLAN tags.
3520 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3521
3522 for i in 1 2 3; do
3523     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))'
3524 done
3525 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3526 ovs-appctl -t ovs-ofctl exit
3527
3528 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3529 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3530 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3531 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3532 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3533 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3534 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3535 dnl
3536 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3537 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3538 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3539 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3540 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3541 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3542 dnl
3543 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3544 mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1
3545 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3546 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3547 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3548 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3549 ])
3550
3551 AT_CHECK([ovs-appctl revalidator/purge], [0])
3552 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3553  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:50 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,CONTROLLER:65535
3554  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:51 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,CONTROLLER:65535
3555  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:52 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,CONTROLLER:65535
3556  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:53 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,CONTROLLER:65535
3557  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:54 actions=push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
3558  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:55 actions=push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
3559  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:56 actions=push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
3560  cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:57 actions=push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
3561  cookie=0xa, n_packets=3, n_bytes=180, vlan_tci=0x1000/0x1000,dl_src=40:44:44:44:54:58 actions=load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
3562  cookie=0xa, n_packets=3, n_bytes=180, vlan_tci=0x1000/0x1000,dl_src=40:44:44:44:54:59 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],set_field:1->vlan_pcp,load:0x63->OXM_OF_VLAN_VID[[]],CONTROLLER:65535
3563 OFPST_FLOW reply (OF1.2):
3564 ])
3565
3566 OVS_VSWITCHD_STOP
3567 AT_CLEANUP
3568
3569 AT_SETUP([ofproto-dpif - fragment handling - trace])
3570 OVS_VSWITCHD_START
3571 ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [90])
3572 AT_DATA([flows.txt], [dnl
3573 priority=75 tcp ip_frag=no    tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
3574 priority=75 tcp ip_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
3575 priority=50 tcp ip_frag=no              actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
3576 priority=50 tcp ip_frag=first           actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
3577 priority=50 tcp ip_frag=later           actions=output:6
3578 ])
3579 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3580
3581 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"
3582 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3583 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3584 later_flow="$base_flow,frag=later)"
3585
3586     # mode    no  first  later
3587 for tuple in \
3588     'normal    1     5      6' \
3589     'drop      1  drop   drop' \
3590     'nx-match  1     2      6'
3591 do
3592   set $tuple
3593   mode=$1
3594   no=$2
3595   first=$3
3596   later=$4
3597
3598   AT_CHECK([ovs-ofctl set-frags br0 $mode])
3599   for type in no first later; do
3600     eval flow=\$${type}_flow exp_output=\$$type
3601     printf "\n%s\n" "----$mode $type-----"
3602     AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3603     : > expout
3604     if test $mode = drop && test $type != no; then
3605         echo 'Packets dropped because they are IP fragments and the fragment handling mode is "drop".' >> expout
3606         echo "Datapath actions: $exp_output" >> expout
3607     elif test $type = later; then
3608         echo "Datapath actions: $exp_output" >> expout
3609     else
3610         echo "Datapath actions: set(tcp(src=80,dst=80)),$exp_output" >> expout
3611     fi
3612     AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
3613   done
3614 done
3615 OVS_VSWITCHD_STOP
3616 AT_CLEANUP
3617
3618 AT_SETUP([ofproto-dpif - fragment handling - upcall])
3619 OVS_VSWITCHD_START
3620 ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [90])
3621 AT_DATA([flows.txt], [dnl
3622 priority=75 tcp ip_frag=no    tp_dst=80 actions=set_field:81->tcp_dst,output:1
3623 priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
3624 priority=50 tcp ip_frag=no              actions=set_field:81->tcp_dst,output:4
3625 priority=50 tcp ip_frag=first           actions=set_field:81->tcp_dst,output:5
3626 priority=50 tcp ip_frag=later           actions=output:6
3627 ])
3628 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3629
3630 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"
3631 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3632 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3633 later_flow="$base_flow,frag=later)"
3634
3635 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3636
3637 mode=normal
3638
3639 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3640 for type in no first later; do
3641   eval flow=\$${type}_flow
3642   printf "\n%s\n" "----$mode $type-----"
3643
3644   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3645 done
3646
3647 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3648 flow-dump from non-dpdk interfaces:
3649 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
3650 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),5
3651 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3652 ])
3653
3654 mode=drop
3655
3656 AT_CHECK([ovs-appctl revalidator/purge], [0])
3657 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3658 for type in no first later; do
3659   eval flow=\$${type}_flow
3660   printf "\n%s\n" "----$mode $type-----"
3661
3662   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3663 done
3664
3665 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3666 flow-dump from non-dpdk interfaces:
3667 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
3668 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
3669 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
3670 ])
3671
3672 mode=nx-match
3673
3674 AT_CHECK([ovs-appctl revalidator/purge], [0])
3675 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3676 for type in no first later; do
3677   eval flow=\$${type}_flow
3678   printf "\n%s\n" "----$mode $type-----"
3679
3680   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3681 done
3682
3683 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3684 flow-dump from non-dpdk interfaces:
3685 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
3686 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),2
3687 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3688 ])
3689
3690 OVS_VSWITCHD_STOP
3691 AT_CLEANUP
3692
3693 AT_SETUP([ofproto-dpif - fragment handling - actions])
3694 OVS_VSWITCHD_START
3695 ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [90])
3696
3697 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])
3698 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3699 source field tcp_dst lacks correct prerequisites
3700 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3701 ])
3702
3703 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])
3704 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3705 destination field tcp_src lacks correct prerequisites
3706 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3707 ])
3708
3709 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
3710 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3711 set_field udp_src lacks correct prerequisities
3712 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3713 ])
3714
3715 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
3716 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3717 set_field udp_dst lacks correct prerequisities
3718 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3719 ])
3720
3721 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
3722 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3723 set_field sctp_src lacks correct prerequisities
3724 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3725 ])
3726
3727 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
3728 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3729 set_field sctp_dst lacks correct prerequisities
3730 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3731 ])
3732
3733 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])
3734 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3735 source field tcp_dst lacks correct prerequisites
3736 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3737 ])
3738
3739 AT_DATA([flows.txt], [dnl
3740 priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
3741 ])
3742 AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
3743
3744 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3745
3746 mode=normal
3747
3748 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3749 for frag in 4000 6000 6008 4010; do
3750   printf "\n%s\n" "----$mode $frag-----"
3751
3752   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"])
3753 done
3754
3755 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3756 flow-dump from non-dpdk interfaces:
3757 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=33419), packets:0, bytes:0, used:never, actions:set(tcp(src=33322)),1
3758 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419), packets:0, bytes:0, used:never, actions:set(tcp(src=33322)),1
3759 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
3760 ])
3761
3762 AT_CHECK([ovs-appctl revalidator/purge], [0])
3763 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3764 for frag in 4000 6000 6008 4010; do
3765   printf "\n%s\n" "----$mode $frag truncated transport header -----"
3766
3767   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
3768 done
3769
3770 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3771 flow-dump from non-dpdk interfaces:
3772 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0), packets:0, bytes:0, used:never, actions:set(tcp(src=42)),1
3773 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0), packets:0, bytes:0, used:never, actions:set(tcp(src=42)),1
3774 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
3775 ])
3776
3777 AT_CHECK([ovs-appctl revalidator/purge], [0])
3778 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3779 for frag in 4000 6000 6001 4002; do
3780   printf "\n%s\n" "----$mode $frag missing transport header-----"
3781
3782   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
3783 done
3784
3785 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3786 flow-dump from non-dpdk interfaces:
3787 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0), packets:0, bytes:0, used:never, actions:set(tcp(src=42)),1
3788 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0), packets:0, bytes:0, used:never, actions:set(tcp(src=42)),1
3789 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
3790 ])
3791
3792 OVS_VSWITCHD_STOP
3793 AT_CLEANUP
3794
3795 AT_SETUP([ofproto-dpif - exit])
3796 OVS_VSWITCHD_START
3797 ADD_OF_PORTS([br0], [1], [2], [3], [10], [11], [12], [13], [14])
3798 AT_DATA([flows.txt], [dnl
3799 in_port=1 actions=output:10,exit,output:11
3800 in_port=2 actions=output:12,resubmit:1,output:12
3801 in_port=3 actions=output:13,resubmit:2,output:14
3802 ])
3803 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3804 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])
3805 AT_CHECK([tail -1 stdout], [0],
3806   [Datapath actions: 10
3807 ])
3808 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])
3809 AT_CHECK([tail -1 stdout], [0],
3810   [Datapath actions: 12,10
3811 ])
3812 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])
3813 AT_CHECK([tail -1 stdout], [0],
3814   [Datapath actions: 13,12,10
3815 ])
3816 OVS_VSWITCHD_STOP
3817 AT_CLEANUP
3818
3819
3820 AT_SETUP([ofproto-dpif - mirroring, select_all])
3821 OVS_VSWITCHD_START
3822 ADD_OF_PORTS([br0], 1, 2, 3)
3823 ovs-vsctl \
3824         set Bridge br0 mirrors=@m --\
3825         --id=@p3 get Port p3 --\
3826         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
3827
3828 AT_DATA([flows.txt], [dnl
3829 in_port=1 actions=output:2
3830 in_port=2 actions=output:1
3831 ])
3832 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3833
3834 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)"
3835 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3836 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3837   [Datapath actions: 2,3
3838 ])
3839
3840 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)"
3841 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3842 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3843   [Datapath actions: 1,3
3844 ])
3845
3846 OVS_VSWITCHD_STOP
3847 AT_CLEANUP
3848
3849
3850 AT_SETUP([ofproto-dpif - mirroring, select_src])
3851 OVS_VSWITCHD_START
3852 ADD_OF_PORTS([br0], 1, 2, 3)
3853 ovs-vsctl \
3854         set Bridge br0 mirrors=@m --\
3855         --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
3856         --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
3857
3858 AT_DATA([flows.txt], [dnl
3859 in_port=1 actions=output:2
3860 in_port=2 actions=output:1
3861 ])
3862 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3863
3864 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)"
3865 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3866 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3867   [Datapath actions: 2,3
3868 ])
3869
3870 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)"
3871 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3872 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3873   [Datapath actions: 1
3874 ])
3875 OVS_VSWITCHD_STOP
3876 AT_CLEANUP
3877
3878 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
3879 OVS_VSWITCHD_START
3880 ADD_OF_PORTS([br0], 1, 2)
3881 ovs-vsctl \
3882         set Bridge br0 mirrors=@m --\
3883         --id=@p2 get Port p2 --\
3884         --id=@m create Mirror name=mymirror select_all=true output_port=@p2
3885
3886 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
3887
3888 # "in_port" defaults to OFPP_NONE if it's not specified.
3889 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"
3890 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
3891 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3892   [Datapath actions: 1,2
3893 ])
3894
3895 OVS_VSWITCHD_STOP
3896 AT_CLEANUP
3897
3898
3899 AT_SETUP([ofproto-dpif - mirroring, select_dst])
3900 OVS_VSWITCHD_START
3901 ADD_OF_PORTS([br0], 1, 2, 3)
3902 ovs-vsctl \
3903         set Bridge br0 mirrors=@m --\
3904         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
3905         --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
3906
3907 AT_DATA([flows.txt], [dnl
3908 in_port=1 actions=output:2
3909 in_port=2 actions=output:1
3910 ])
3911 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3912
3913 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)"
3914 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3915 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3916   [Datapath actions: 2,3
3917 ])
3918
3919 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)"
3920 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3921 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3922   [Datapath actions: 1
3923 ])
3924
3925 OVS_VSWITCHD_STOP
3926 AT_CLEANUP
3927
3928
3929 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
3930 OVS_VSWITCHD_START
3931 ADD_OF_PORTS([br0], 1, 2, 3)
3932 ovs-vsctl \
3933         set Bridge br0 mirrors=@m --\
3934         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
3935         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
3936
3937 AT_DATA([flows.txt], [dnl
3938 in_port=1, actions=output:2
3939 ])
3940 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3941
3942 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)"
3943 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3944 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3945   [Datapath actions: 2
3946 ])
3947
3948 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))"
3949 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3950 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3951   [Datapath actions: 2
3952 ])
3953
3954 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))"
3955 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3956 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3957   [Datapath actions: 2,3
3958 ])
3959
3960 OVS_VSWITCHD_STOP
3961 AT_CLEANUP
3962
3963
3964 AT_SETUP([ofproto-dpif - mirroring, output_port])
3965 OVS_VSWITCHD_START
3966 ADD_OF_PORTS([br0], 1, 2, 3)
3967 ovs-vsctl \
3968         set Bridge br0 mirrors=@m --\
3969         --id=@p3 get Port p3 --\
3970         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
3971
3972 AT_DATA([flows.txt], [dnl
3973 in_port=1 actions=mod_vlan_vid:17,output:2
3974 in_port=2 actions=output:1
3975 ])
3976 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3977
3978 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)"
3979 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3980 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3981   [Datapath actions: push_vlan(vid=17,pcp=0),2,pop_vlan,3
3982 ])
3983
3984 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)"
3985 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3986 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3987   [Datapath actions: 1,3
3988 ])
3989
3990 OVS_VSWITCHD_STOP
3991 AT_CLEANUP
3992
3993 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
3994 OVS_VSWITCHD_START
3995 ADD_OF_PORTS([br0], 1, 2)
3996 ovs-vsctl \
3997         set Bridge br0 mirrors=@m --\
3998         --id=@m create Mirror name=mymirror select_all=true output_vlan=12
3999
4000 AT_DATA([flows.txt], [dnl
4001 in_port=1 actions=output:2
4002 in_port=2 actions=mod_vlan_vid:17,output:1
4003 ])
4004 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4005
4006 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)"
4007 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4008 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4009
4010 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
4011 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4012 mv stdout expout
4013 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4014
4015 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)"
4016 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4017 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4018
4019 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
4020 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4021 mv stdout expout
4022 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4023
4024 OVS_VSWITCHD_STOP
4025 AT_CLEANUP
4026
4027 # Two testcases below are for the ofproto/trace command
4028 # The first one tests all correct syntax:
4029 # ofproto/trace [dp_name] odp_flow [-generate|packet]
4030 # ofproto/trace br_name br_flow [-generate|packet]
4031 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
4032 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
4033 ADD_OF_PORTS([br0], 1, 2, 3)
4034
4035 AT_DATA([flows.txt], [dnl
4036 in_port=1 actions=output:2
4037 in_port=2 actions=output:1
4038 ])
4039 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4040
4041 odp_flow="in_port(1)"
4042 br_flow="in_port=1"
4043 # Test command: ofproto/trace odp_flow with in_port as a name.
4044 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4045 AT_CHECK([tail -1 stdout], [0], [dnl
4046 Datapath actions: 2
4047 ])
4048
4049 odp_flow="in_port(1)"
4050 # Test command: ofproto/trace odp_flow
4051 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4052 AT_CHECK([tail -1 stdout], [0], [dnl
4053 Datapath actions: 2
4054 ])
4055
4056 # Test command: ofproto/trace dp_name odp_flow
4057 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
4058 AT_CHECK([tail -1 stdout], [0], [dnl
4059 Datapath actions: 2
4060 ])
4061 # Test commmand: ofproto/trace br_name br_flow
4062 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4063 AT_CHECK([tail -1 stdout], [0], [dnl
4064 Datapath actions: 2
4065 ])
4066
4067 # Delete the inserted flows
4068 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
4069 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
4070
4071 # This section below tests the [-generate] option
4072 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
4073 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"
4074
4075 # Test command: ofproto/trace odp_flow
4076 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4077 # Check for no MAC learning entry
4078 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4079  port  VLAN  MAC                Age
4080 ])
4081
4082 # Test command: ofproto/trace br_name br_flow
4083 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4084 # Check for no MAC learning entry
4085 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4086  port  VLAN  MAC                Age
4087 ])
4088
4089 # Test command: ofproto/trace odp_flow -generate
4090 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
4091 # Check for the MAC learning entry
4092 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4093  port  VLAN  MAC                Age
4094     3     0  50:54:00:00:00:05    ?
4095 ])
4096
4097 # Test command: ofproto/trace dp_name odp_flow -generate
4098 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4099   "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
4100   -generate], [0], [stdout])
4101 # Check for both MAC learning entries
4102 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4103  port  VLAN  MAC                Age
4104     3     0  50:54:00:00:00:05    ?
4105     1     0  50:54:00:00:00:06    ?
4106 ])
4107
4108 # Test command: ofproto/trace br_name br_flow -generate
4109 AT_CHECK([ovs-appctl ofproto/trace br0 \
4110   "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
4111   -generate], [0], [stdout])
4112 # Check for both MAC learning entries.
4113 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4114  port  VLAN  MAC                Age
4115     3     0  50:54:00:00:00:05    ?
4116     1     0  50:54:00:00:00:06    ?
4117     2     0  50:54:00:00:00:07    ?
4118 ])
4119
4120 # This section beflow tests the [packet] option
4121 # The ovs-tcpundump of packets between port1 and port2
4122 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4123 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
4124
4125 # Construct the MAC learning table
4126 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4127   "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
4128   -generate], [0], [stdout])
4129
4130 # Construct the MAC learning table
4131 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4132   "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
4133   -generate], [0], [stdout])
4134
4135 # Test command: ofproto/trace odp_flow packet
4136 AT_CHECK([ovs-appctl ofproto/trace \
4137   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4138 AT_CHECK([tail -1 stdout], [0], [dnl
4139 Datapath actions: 2
4140 ])
4141 AT_CHECK([head -n 2 stdout], [0], [dnl
4142 Bridge: br0
4143 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
4144 ])
4145
4146 # Test command: ofproto/trace dp_name odp_flow packet
4147 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4148   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4149 AT_CHECK([tail -1 stdout], [0], [dnl
4150 Datapath actions: 2
4151 ])
4152 AT_CHECK([head -n 2 stdout], [0], [dnl
4153 Bridge: br0
4154 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
4155 ])
4156
4157 # Test command: ofproto/trace br_name br_flow packet
4158 AT_CHECK([ovs-appctl ofproto/trace br0 \
4159   "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
4160 AT_CHECK([tail -1 stdout], [0], [dnl
4161 Datapath actions: 1
4162 ])
4163 AT_CHECK([head -n 2 stdout], [0], [dnl
4164 Bridge: br0
4165 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
4166 ])
4167
4168 OVS_VSWITCHD_STOP
4169 AT_CLEANUP
4170
4171 # The second test tests the corner cases
4172 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
4173 OVS_VSWITCHD_START
4174 ADD_OF_PORTS([br0], 1, 2)
4175
4176 # Define flows
4177 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
4178 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
4179 # Define options
4180 generate="-generate"
4181 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4182
4183 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
4184 m4_foreach(
4185 [option],
4186 [[],
4187 ["$generate"],
4188 ["$pkt"]],
4189 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
4190   [2], [], [stderr])
4191 AT_CHECK([tail -2 stderr], [0], [dnl
4192 Cannot find the datapath
4193 ovs-appctl: ovs-vswitchd: server returned an error
4194 ])])
4195
4196 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
4197 m4_foreach(
4198 [option],
4199 [[],
4200 ["$generate"],
4201 ["$pkt"]],
4202 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
4203   [2], [], [stderr])
4204 AT_CHECK([tail -2 stderr], [0], [dnl
4205 Cannot find the datapath
4206 ovs-appctl: ovs-vswitchd: server returned an error
4207 ])])
4208
4209 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
4210 m4_foreach(
4211 [option],
4212 [[],
4213 ["$generate"],
4214 ["$pkt"]],
4215 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
4216   [2], [], [stderr])
4217 AT_CHECK([tail -2 stderr], [0], [dnl
4218 Cannot find the datapath
4219 ovs-appctl: ovs-vswitchd: server returned an error
4220 ])])
4221
4222 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
4223 m4_foreach(
4224 [option],
4225 [[],
4226 ["$generate"],
4227 ["$pkt"]],
4228 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
4229   [2], [], [stderr])
4230 AT_CHECK([tail -2 stderr], [0], [dnl
4231 Cannot find the datapath
4232 ovs-appctl: ovs-vswitchd: server returned an error
4233 ])])
4234
4235 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
4236 m4_foreach(
4237 [option],
4238 [[],
4239 ["$generate"],
4240 ["$pkt"]],
4241 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
4242   [2], [], [stderr])
4243 AT_CHECK([tail -2 stderr], [0], [dnl
4244 Unknown bridge name
4245 ovs-appctl: ovs-vswitchd: server returned an error
4246 ])])
4247
4248 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
4249 m4_foreach(
4250 [option],
4251 [[],
4252 ["$generate"],
4253 ["$pkt"]],
4254 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
4255   [2], [], [stderr])
4256 AT_CHECK([tail -2 stderr], [0], [dnl
4257 Must specify bridge name
4258 ovs-appctl: ovs-vswitchd: server returned an error
4259 ])])
4260
4261 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
4262 AT_CHECK([ovs-appctl ofproto/trace \
4263   ovs-dummy "$odp_flow" garbage_option],
4264   [2], [stdout],[stderr])
4265 AT_CHECK([tail -2 stderr], [0], [dnl
4266 Trailing garbage in packet data
4267 ovs-appctl: ovs-vswitchd: server returned an error
4268 ])
4269
4270 # Test incorrect command: ofproto/trace with 4 arguments
4271 AT_CHECK([ovs-appctl ofproto/trace \
4272   arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
4273 AT_CHECK([tail -2 stderr], [0], [dnl
4274 "ofproto/trace" command takes at most 3 arguments
4275 ovs-appctl: ovs-vswitchd: server returned an error
4276 ])
4277
4278 # Test incorrect command: ofproto/trace with 0 argument
4279 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
4280 AT_CHECK([tail -2 stderr], [0], [dnl
4281 "ofproto/trace" command requires at least 1 arguments
4282 ovs-appctl: ovs-vswitchd: server returned an error
4283 ])
4284
4285 OVS_VSWITCHD_STOP
4286 AT_CLEANUP
4287
4288 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
4289 OVS_VSWITCHD_START
4290 ADD_OF_PORTS([br0], 1, 2, 3)
4291
4292 AT_DATA([flows.txt], [dnl
4293 in_port=1 actions=output:2
4294 in_port=2 actions=output:1
4295 ])
4296 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4297
4298 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
4299 AT_CHECK([tail -1 stdout], [0], [dnl
4300 Datapath actions: push_vlan(vid=123,pcp=0),2
4301 ])
4302
4303 OVS_VSWITCHD_STOP
4304 AT_CLEANUP
4305
4306
4307 m4_define([OFPROTO_TRACE],
4308   [flow="$2"
4309    AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
4310    actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4311    expected="$4"
4312    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
4313      [0], [stdout])
4314    mv stdout expout
4315    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
4316      [0], [expout])])
4317
4318 AT_SETUP([ofproto-dpif - MAC learning])
4319 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
4320 ADD_OF_PORTS([br0], 1, 2, 3)
4321
4322 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)'
4323
4324 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
4325 OFPROTO_TRACE(
4326   [ovs-dummy],
4327   [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
4328   [-generate],
4329   [1,2,100])
4330
4331 # Check for the MAC learning entry.
4332 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4333  port  VLAN  MAC                Age
4334     3     0  50:54:00:00:00:05    ?
4335 ])
4336
4337 # Trace a packet arrival destined for the learned MAC.
4338 # (This will also learn a MAC.)
4339 OFPROTO_TRACE(
4340   [ovs-dummy],
4341   [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
4342   [-generate],
4343   [3])
4344
4345 # Check for both MAC learning entries.
4346 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4347  port  VLAN  MAC                Age
4348     3     0  50:54:00:00:00:05    ?
4349     1     0  50:54:00:00:00:06    ?
4350 ])
4351
4352 # Trace a packet arrival that updates the first learned MAC entry.
4353 OFPROTO_TRACE(
4354   [ovs-dummy],
4355   [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
4356   [-generate],
4357   [1,3,100])
4358
4359 # Check that the MAC learning entry was updated.
4360 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4361  port  VLAN  MAC                Age
4362     1     0  50:54:00:00:00:06    ?
4363     2     0  50:54:00:00:00:05    ?
4364 ])
4365
4366 # Add another bridge.
4367 AT_CHECK(
4368   [ovs-vsctl \
4369      -- add-br br1 \
4370      -- set bridge br1 datapath-type=dummy])
4371 ADD_OF_PORTS([br1], 4, 5)
4372
4373 # Trace some packet arrivals in br1 to create MAC learning entries there too.
4374 OFPROTO_TRACE(
4375   [ovs-dummy],
4376   [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
4377   [-generate],
4378   [5,101])
4379 OFPROTO_TRACE(
4380   [ovs-dummy],
4381   [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
4382   [-generate],
4383   [4,101])
4384
4385 # Check that the MAC learning entries were added.
4386 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4387  port  VLAN  MAC                Age
4388     4     0  50:54:00:00:00:06    ?
4389     5     0  50:54:00:00:00:07    ?
4390 ])
4391
4392 # Delete port p1 and see that its MAC learning entry disappeared, and
4393 # that the MAC learning entry for the same MAC was also deleted from br1.
4394 AT_CHECK([ovs-vsctl del-port p1])
4395 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4396  port  VLAN  MAC                Age
4397     2     0  50:54:00:00:00:05    ?
4398 ])
4399 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4400  port  VLAN  MAC                Age
4401     5     0  50:54:00:00:00:07    ?
4402 ])
4403
4404 OVS_VSWITCHD_STOP
4405 AT_CLEANUP
4406
4407 AT_SETUP([ofproto-dpif - MAC table overflow])
4408 OVS_VSWITCHD_START(
4409   [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
4410 ADD_OF_PORTS([br0], 1, 2, 3)
4411
4412 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)'
4413
4414 AT_CHECK([ovs-appctl time/stop])
4415
4416 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
4417 for i in 0 1 2 3 4 5 6 7 8 9; do
4418     OFPROTO_TRACE(
4419       [ovs-dummy],
4420       [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
4421       [-generate],
4422       [1,2,100])
4423     ovs-appctl time/warp 1000
4424 done
4425
4426 # Check for the MAC learning entries.
4427 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4428   [0], [dnl
4429     3     0  50:54:00:00:00:00
4430     3     0  50:54:00:00:00:01
4431     3     0  50:54:00:00:00:02
4432     3     0  50:54:00:00:00:03
4433     3     0  50:54:00:00:00:04
4434     3     0  50:54:00:00:00:05
4435     3     0  50:54:00:00:00:06
4436     3     0  50:54:00:00:00:07
4437     3     0  50:54:00:00:00:08
4438     3     0  50:54:00:00:00:09
4439  port  VLAN  MAC                Age
4440 ])
4441
4442 # Trace another ARP packet on another MAC.
4443 OFPROTO_TRACE(
4444   [ovs-dummy],
4445   [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
4446   [-generate],
4447   [1,2,100])
4448
4449 # Check that the new one chased the oldest one out of the table.
4450 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
4451   [0], [dnl
4452     3     0  50:54:00:00:00:01    ?
4453     3     0  50:54:00:00:00:02    ?
4454     3     0  50:54:00:00:00:03    ?
4455     3     0  50:54:00:00:00:04    ?
4456     3     0  50:54:00:00:00:05    ?
4457     3     0  50:54:00:00:00:06    ?
4458     3     0  50:54:00:00:00:07    ?
4459     3     0  50:54:00:00:00:08    ?
4460     3     0  50:54:00:00:00:09    ?
4461     3     0  50:54:00:00:00:10    ?
4462  port  VLAN  MAC                Age
4463 ])
4464 OVS_VSWITCHD_STOP
4465 AT_CLEANUP
4466
4467 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR, ADDR_WITHOUT_BRACKETS)
4468 #
4469 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
4470 #
4471 # IP_VERSION_TYPE is used in AT_SETUP
4472 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
4473   [AT_SETUP([ofproto-dpif - sFlow packet sampling - $2 collector])
4474   AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
4475   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
4476
4477   ON_EXIT([kill `cat test-sflow.pid`])
4478   AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
4479   AT_CAPTURE_FILE([sflow.log])
4480   SFLOW_PORT=`parse_listening_port < test-sflow.log`
4481   ovs-appctl time/stop
4482
4483   ADD_OF_PORTS([br0], 1, 2)
4484   ovs-vsctl \
4485      set Interface br0 options:ifindex=1002 -- \
4486      set Interface p1 options:ifindex=1004 -- \
4487      set Interface p2 options:ifindex=1003 -- \
4488      set Bridge br0 sflow=@sf -- \
4489      --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
4490        header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
4491
4492   dnl open with ARP packets to seed the bridge-learning.  The output
4493   dnl ifIndex numbers should be reported predictably after that.
4494   dnl Since we set sampling=1 we should see all of these packets
4495   dnl reported. Sorting the output by data-source and seqNo makes
4496   dnl it deterministic. Ensuring that we send at least two packets
4497   dnl into each port means we get to check the seq nos are
4498   dnl incrementing correctly.
4499   dnl because packets from different ports can be handled by separate
4500   dnl threads, put some sleeps
4501
4502   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)'
4503   sleep 1
4504   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)'
4505   sleep 1
4506   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)'
4507   sleep 1
4508   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)'
4509   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)'
4510
4511   dnl sleep long enough to get more than one counter sample
4512   dnl from each datasource so we can check sequence numbers
4513   ovs-appctl time/warp 3000 100
4514   OVS_VSWITCHD_STOP
4515   ovs-appctl -t test-sflow exit
4516
4517   AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
4518         /g']], [0], [dnl
4519 HEADER
4520         dgramSeqNo=1
4521         ds=127.0.0.1>2:1000
4522         fsSeqNo=1
4523         in_vlan=0
4524         in_priority=0
4525         out_vlan=0
4526         out_priority=0
4527         meanSkip=1
4528         samplePool=1
4529         dropEvents=0
4530         in_ifindex=1004
4531         in_format=0
4532         out_ifindex=2
4533         out_format=2
4534         hdr_prot=1
4535         pkt_len=64
4536         stripped=4
4537         hdr_len=60
4538         hdr=FF-FF-FF-FF-FF-FF-50-54-00-00-00-05-08-06-00-01-08-00-06-04-00-01-50-54-00-00-00-05-C0-A8-00-02-00-00-00-00-00-00-C0-A8-00-01-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
4539 HEADER
4540         dgramSeqNo=1
4541         ds=127.0.0.1>2:1000
4542         fsSeqNo=2
4543         in_vlan=0
4544         in_priority=0
4545         out_vlan=0
4546         out_priority=0
4547         meanSkip=1
4548         samplePool=2
4549         dropEvents=0
4550         in_ifindex=1003
4551         in_format=0
4552         out_ifindex=2
4553         out_format=2
4554         hdr_prot=1
4555         pkt_len=64
4556         stripped=4
4557         hdr_len=60
4558         hdr=FF-FF-FF-FF-FF-FF-50-54-00-00-00-07-08-06-00-01-08-00-06-04-00-01-50-54-00-00-00-07-C0-A8-00-01-00-00-00-00-00-00-C0-A8-00-02-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
4559 HEADER
4560         dgramSeqNo=1
4561         ds=127.0.0.1>2:1000
4562         fsSeqNo=3
4563         in_vlan=0
4564         in_priority=0
4565         out_vlan=0
4566         out_priority=0
4567         meanSkip=1
4568         samplePool=3
4569         dropEvents=0
4570         in_ifindex=1004
4571         in_format=0
4572         out_ifindex=1003
4573         out_format=0
4574         hdr_prot=1
4575         pkt_len=64
4576         stripped=4
4577         hdr_len=60
4578         hdr=50-54-00-00-00-07-50-54-00-00-00-05-08-00-45-00-00-1C-00-00-00-00-40-01-F9-8D-C0-A8-00-01-C0-A8-00-02-08-00-F7-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
4579 HEADER
4580         dgramSeqNo=1
4581         ds=127.0.0.1>2:1000
4582         fsSeqNo=4
4583         in_vlan=0
4584         in_priority=0
4585         out_vlan=0
4586         out_priority=0
4587         meanSkip=1
4588         samplePool=4
4589         dropEvents=0
4590         in_ifindex=1003
4591         in_format=0
4592         out_ifindex=1004
4593         out_format=0
4594         hdr_prot=1
4595         pkt_len=64
4596         stripped=4
4597         hdr_len=60
4598         hdr=50-54-00-00-00-05-50-54-00-00-00-07-08-00-45-00-00-1C-00-00-00-00-40-01-F9-8D-C0-A8-00-02-C0-A8-00-01-00-00-FF-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
4599 HEADER
4600         dgramSeqNo=1
4601         ds=127.0.0.1>2:1000
4602         fsSeqNo=5
4603         in_vlan=0
4604         in_priority=0
4605         out_vlan=0
4606         out_priority=0
4607         meanSkip=1
4608         samplePool=5
4609         dropEvents=0
4610         in_ifindex=1003
4611         in_format=0
4612         out_ifindex=1004
4613         out_format=0
4614         hdr_prot=1
4615         pkt_len=64
4616         stripped=4
4617         hdr_len=60
4618         hdr=50-54-00-00-00-05-50-54-00-00-00-07-86-DD-67-00-00-00-00-00-0A-80-FE-80-00-00-00-00-00-00-00-00-00-00-00-00-00-01-FE-80-00-00-00-00-00-00-00-00-00-00-00-00-00-02-00-00-00-00-00-00
4619 ])
4620
4621   AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -18 | sed 's/ /\
4622         /g']], [0], [dnl
4623 IFCOUNTERS
4624         dgramSeqNo=2
4625         ds=127.0.0.1>0:1002
4626         csSeqNo=1
4627         ifindex=1002
4628         type=6
4629         ifspeed=100000000
4630         direction=0
4631         status=0
4632         in_octets=0
4633         in_unicasts=0
4634         in_multicasts=0
4635         in_broadcasts=4294967295
4636         in_discards=0
4637         in_errors=0
4638         in_unknownprotos=4294967295
4639         out_octets=120
4640         out_unicasts=2
4641         out_multicasts=4294967295
4642         out_broadcasts=4294967295
4643         out_discards=0
4644         out_errors=0
4645         promiscuous=0
4646 IFCOUNTERS
4647         dgramSeqNo=2
4648         ds=127.0.0.1>0:1003
4649         csSeqNo=1
4650         ifindex=1003
4651         type=6
4652         ifspeed=100000000
4653         direction=0
4654         status=0
4655         in_octets=138
4656         in_unicasts=3
4657         in_multicasts=0
4658         in_broadcasts=4294967295
4659         in_discards=0
4660         in_errors=0
4661         in_unknownprotos=4294967295
4662         out_octets=120
4663         out_unicasts=2
4664         out_multicasts=4294967295
4665         out_broadcasts=4294967295
4666         out_discards=0
4667         out_errors=0
4668         promiscuous=0
4669 IFCOUNTERS
4670         dgramSeqNo=2
4671         ds=127.0.0.1>0:1004
4672         csSeqNo=1
4673         ifindex=1004
4674         type=6
4675         ifspeed=100000000
4676         direction=0
4677         status=0
4678         in_octets=84
4679         in_unicasts=2
4680         in_multicasts=0
4681         in_broadcasts=4294967295
4682         in_discards=0
4683         in_errors=0
4684         in_unknownprotos=4294967295
4685         out_octets=180
4686         out_unicasts=3
4687         out_multicasts=4294967295
4688         out_broadcasts=4294967295
4689         out_discards=0
4690         out_errors=0
4691         promiscuous=0
4692 IFCOUNTERS
4693         dgramSeqNo=3
4694         ds=127.0.0.1>0:1002
4695         csSeqNo=2
4696         ifindex=1002
4697         type=6
4698         ifspeed=100000000
4699         direction=0
4700         status=0
4701         in_octets=0
4702         in_unicasts=0
4703         in_multicasts=0
4704         in_broadcasts=4294967295
4705         in_discards=0
4706         in_errors=0
4707         in_unknownprotos=4294967295
4708         out_octets=120
4709         out_unicasts=2
4710         out_multicasts=4294967295
4711         out_broadcasts=4294967295
4712         out_discards=0
4713         out_errors=0
4714         promiscuous=0
4715 IFCOUNTERS
4716         dgramSeqNo=3
4717         ds=127.0.0.1>0:1003
4718         csSeqNo=2
4719         ifindex=1003
4720         type=6
4721         ifspeed=100000000
4722         direction=0
4723         status=0
4724         in_octets=138
4725         in_unicasts=3
4726         in_multicasts=0
4727         in_broadcasts=4294967295
4728         in_discards=0
4729         in_errors=0
4730         in_unknownprotos=4294967295
4731         out_octets=120
4732         out_unicasts=2
4733         out_multicasts=4294967295
4734         out_broadcasts=4294967295
4735         out_discards=0
4736         out_errors=0
4737         promiscuous=0
4738 IFCOUNTERS
4739         dgramSeqNo=3
4740         ds=127.0.0.1>0:1004
4741         csSeqNo=2
4742         ifindex=1004
4743         type=6
4744         ifspeed=100000000
4745         direction=0
4746         status=0
4747         in_octets=84
4748         in_unicasts=2
4749         in_multicasts=0
4750         in_broadcasts=4294967295
4751         in_discards=0
4752         in_errors=0
4753         in_unknownprotos=4294967295
4754         out_octets=180
4755         out_unicasts=3
4756         out_multicasts=4294967295
4757         out_broadcasts=4294967295
4758         out_discards=0
4759         out_errors=0
4760         promiscuous=0
4761 OPENFLOWPORT
4762         datapath_id=18364758544493064720
4763         port_no=1
4764 OPENFLOWPORT
4765         datapath_id=18364758544493064720
4766         port_no=1
4767 OPENFLOWPORT
4768         datapath_id=18364758544493064720
4769         port_no=2
4770 OPENFLOWPORT
4771         datapath_id=18364758544493064720
4772         port_no=2
4773 OPENFLOWPORT
4774         datapath_id=18364758544493064720
4775         port_no=65534
4776 OPENFLOWPORT
4777         datapath_id=18364758544493064720
4778         port_no=65534
4779 PORTNAME
4780         portName=br0
4781 PORTNAME
4782         portName=br0
4783 PORTNAME
4784         portName=p1
4785 PORTNAME
4786         portName=p1
4787 PORTNAME
4788         portName=p2
4789 PORTNAME
4790         portName=p2
4791 ])
4792   AT_CLEANUP])
4793
4794 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1], [IPv4])
4795 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]], [IPv6])
4796
4797 dnl Test sFlow LAG structures
4798 AT_SETUP([ofproto-dpif - sFlow LACP structures])
4799 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
4800 OVS_VSWITCHD_START([dnl
4801                     add-bond br0 bond p1 p2 --                          \
4802                     set Port bond lacp=active bond-mode=active-backup   \
4803                     other_config:lacp-time="fast"                       \
4804                     other_config:lacp-system-id=11:22:33:44:55:66       \
4805                     other_config:lacp-system-priority=54321 --          \
4806                     set Interface p1 type=dummy                         \
4807                     other_config:lacp-port-id=11                        \
4808                     other_config:lacp-port-priority=111                 \
4809                     other_config:lacp-aggregation-key=3333 --           \
4810                     set Interface p2 type=dummy                         \
4811                     other_config:lacp-port-id=22                        \
4812                     other_config:lacp-port-priority=222                 \
4813                     other_config:lacp-aggregation-key=3333 ])
4814
4815 ON_EXIT([kill `cat test-sflow.pid`])
4816 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
4817 AT_CAPTURE_FILE([sflow.log])
4818 SFLOW_PORT=`parse_listening_port < test-sflow.log`
4819
4820 ovs-appctl time/stop
4821
4822 ovs-vsctl \
4823       set Interface p1 options:ifindex=1003 --                  \
4824       set Bridge br0 sflow=@sf --                               \
4825       --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\"   \
4826       header=128 sampling=1 polling=1
4827
4828 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
4829 AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
4830 AT_CHECK([ovs-appctl revalidator/purge], [0])
4831 OVS_VSWITCHD_STOP
4832 ovs-appctl -t test-sflow exit
4833 AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
4834         /g']], [0], [dnl
4835 LACPCOUNTERS
4836         sysID=11:22:33:44:55:66
4837         partnerID=00:00:00:00:00:00
4838         aggID=3333
4839         actorAdmin=0x7
4840         actorOper=0xbf
4841         partnerAdmin=0x0
4842         partnerOper=0x2
4843         LACPUDsRx=0
4844         markerPDUsRx=4294967295
4845         markerRespPDUsRx=4294967295
4846         unknownRx=4294967295
4847         illegalRx=0
4848         LACPUDsTx=1
4849         markerPDUsTx=4294967295
4850         markerRespPDUsTx=4294967295
4851 ])
4852
4853 AT_CLEANUP
4854
4855 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR, IP_VERSION_TYPE)
4856 #
4857 # Test that basic NetFlow reports flow statistics correctly:
4858 # The initial packet of a flow are correctly accounted.
4859 # Later packets within a flow are correctly accounted.
4860 # Flow actions changing (in this case, due to MAC learning)
4861 # cause a record to be sent.
4862 #
4863 # IP_VERSION_TYPE is used in AT_SETUP
4864 m4_define([CHECK_NETFLOW_EXPIRATION],
4865   [AT_SETUP([ofproto-dpif - NetFlow flow expiration - $2 collector])
4866   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
4867   ADD_OF_PORTS([br0], 1, 2)
4868
4869   ovs-appctl time/stop
4870   ON_EXIT([kill `cat test-netflow.pid`])
4871   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
4872   AT_CAPTURE_FILE([netflow.log])
4873   NETFLOW_PORT=`parse_listening_port < test-netflow.log`
4874
4875   ovs-vsctl \
4876      set Bridge br0 netflow=@nf -- \
4877      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
4878        engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
4879
4880   for delay in 1000 30000; do
4881       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)'
4882       sleep 1  # ensure the order in which these two packets are processed
4883       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)'
4884
4885       ovs-appctl time/warp $delay
4886   done
4887
4888   ovs-appctl time/warp 6000
4889   ovs-appctl revalidator/wait
4890   OVS_VSWITCHD_STOP
4891   ovs-appctl -t test-netflow exit
4892
4893   AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 60 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
4894
4895   AT_CHECK([test `grep "192.168.0.1 > 192.168.0.2, if 1 > 2, 1 pkts, 60 bytes, ICMP 8:0" netflow.log | wc -l` -eq 1])
4896
4897   combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 120 bytes, ICMP 0:0" netflow.log | wc -l`
4898   separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 60 bytes, ICMP 0:0" netflow.log | wc -l`
4899   AT_CHECK([test $separate = 2 || test $combined = 1], [0])
4900
4901   AT_CLEANUP])
4902
4903 CHECK_NETFLOW_EXPIRATION([127.0.0.1], [IPv4])
4904 CHECK_NETFLOW_EXPIRATION([[[::1]]], [IPv6])
4905
4906 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR, IP_VERSION_TYPE)
4907 #
4908 # Test that basic NetFlow reports active expirations correctly.
4909 #
4910 # IP_VERSION_TYPE is used in AT_SETUP
4911 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
4912   [AT_SETUP([ofproto-dpif - NetFlow active expiration - $2 collector])
4913
4914   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
4915   ADD_OF_PORTS([br0], 1, 2)
4916
4917   ON_EXIT([kill `cat test-netflow.pid`])
4918   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
4919   AT_CAPTURE_FILE([netflow.log])
4920   NETFLOW_PORT=`parse_listening_port < test-netflow.log`
4921
4922   ovs-vsctl \
4923      set Bridge br0 netflow=@nf -- \
4924      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
4925        engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
4926
4927   AT_CHECK([ovs-appctl time/stop])
4928   n=1
4929   while test $n -le 60; do
4930       n=`expr $n + 1`
4931
4932       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)'
4933       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)'
4934
4935       ovs-appctl time/warp 1000
4936   done
4937
4938   ovs-appctl time/warp 10000
4939
4940   ovs-appctl revalidator/wait
4941   OVS_VSWITCHD_STOP
4942   ovs-appctl -t test-netflow exit
4943
4944   # Count the number of reported packets:
4945   # - From source to destination before MAC learning kicks in (just one).
4946   # - From source to destination after that.
4947   # - From destination to source.
4948   n_learn=0
4949   n_in=0
4950   n_out=0
4951   n_other=0
4952   n_recs=0
4953   none=0
4954   while read line; do
4955       pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
4956       case $pkts in
4957            [[0-9]]*) ;;
4958        *) continue ;;
4959       esac
4960
4961       case $line in
4962           "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
4963               counter=n_learn
4964           ;;
4965       "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
4966           counter=n_in
4967           ;;
4968       "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
4969           counter=n_out
4970           ;;
4971       *)
4972           counter=n_other
4973           ;;
4974       esac
4975       eval $counter=\`expr \$$counter + \$pkts\`
4976       n_recs=`expr $n_recs + 1`
4977   done < netflow.log
4978
4979   # There should be exactly 1 MAC learning packet,
4980   # exactly 59 other packets in that direction,
4981   # and exactly 60 packets in the other direction.
4982   AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
4983 ])
4984
4985   AT_CLEANUP])
4986
4987 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1], [IPv4])
4988 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]], [IPv6])
4989
4990 AT_SETUP([ofproto-dpif - flow stats])
4991 OVS_VSWITCHD_START
4992 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
4993 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
4994
4995 ovs-appctl time/stop
4996
4997 for i in `seq 1 10`; do
4998     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)'
4999 done
5000
5001 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
5002 AT_CHECK([ovs-appctl revalidator/purge], [0])
5003 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5004 AT_CHECK([STRIP_XIDS stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
5005  cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
5006  cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
5007 ])
5008 OVS_VSWITCHD_STOP
5009 AT_CLEANUP
5010
5011 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
5012 OVS_VSWITCHD_START
5013 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
5014 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
5015
5016 ovs-appctl time/stop
5017
5018 for i in `seq 1 10`; do
5019     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)'
5020 done
5021
5022 ovs-appctl time/warp 100
5023 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
5024 ovs-appctl time/warp 1000
5025
5026 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5027 AT_CHECK([STRIP_XIDS stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
5028  cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
5029  cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
5030 ])
5031 OVS_VSWITCHD_STOP
5032 AT_CLEANUP
5033
5034 AT_SETUP([idle_age and hard_age increase over time])
5035 OVS_VSWITCHD_START
5036
5037 # get_ages DURATION HARD IDLE
5038 #
5039 # Fetch the flow duration, hard age, and idle age into the variables
5040 # whose names are given as arguments.  Rounds DURATION down to the
5041 # nearest integer.  If hard_age doesn't appear in the output, sets
5042 # HARD to "none".  If idle_age doesn't appear in the output, sets IDLE
5043 # to 0.
5044 get_ages () {
5045     AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5046
5047     duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
5048     AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
5049     AS_VAR_COPY([$1], [duration])
5050
5051     hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
5052     if test X"$hard" = X; then
5053         hard=none
5054     else
5055         AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
5056     fi
5057     AS_VAR_COPY([$2], [hard])
5058
5059     idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
5060     if test X"$idle" = X; then
5061         idle=0
5062     else
5063         AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
5064     fi
5065     AS_VAR_COPY([$3], [idle])
5066 }
5067
5068 # Add a flow and get its initial hard and idle age.
5069 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
5070 get_ages duration1 hard1 idle1
5071
5072 ovs-appctl time/stop
5073 # Warp time forward by 10 seconds, then modify the flow's actions.
5074 ovs-appctl time/warp 10000
5075 get_ages duration2 hard2 idle2
5076 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
5077
5078 # Warp time forward by 10 seconds.
5079 ovs-appctl time/warp 10000
5080 get_ages duration3 hard3 idle3
5081
5082 # Warp time forward 10 more seconds, then pass some packets through the flow,
5083 # then warp forward a few more times because idle times are only updated
5084 # occasionally.
5085 ovs-appctl time/warp 10000
5086 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)'
5087 ovs-appctl time/warp 3000 1000
5088 sleep 1
5089 get_ages duration4 hard4 idle4
5090
5091 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
5092 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
5093 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
5094
5095 # Duration should increase steadily over time.
5096 AT_CHECK([test $duration1 -lt $duration2])
5097 AT_CHECK([test $duration2 -lt $duration3])
5098 AT_CHECK([test $duration3 -lt $duration4])
5099
5100 # Hard age should be "none" initially because it's the same as flow_duration,
5101 # then it should increase.
5102 AT_CHECK([test $hard1 = none])
5103 AT_CHECK([test $hard2 = none])
5104 AT_CHECK([test $hard3 != none])
5105 AT_CHECK([test $hard4 != none])
5106 AT_CHECK([test $hard3 -lt $hard4])
5107
5108 # Idle age should increase from 1 to 2 to 3, then decrease.
5109 AT_CHECK([test $idle1 -lt $idle2])
5110 AT_CHECK([test $idle2 -lt $idle3])
5111 AT_CHECK([test $idle3 -gt $idle4])
5112
5113 # Check some invariant relationships.
5114 AT_CHECK([test $duration1 = $idle1])
5115 AT_CHECK([test $duration2 = $idle2])
5116 AT_CHECK([test $duration3 = $idle3])
5117 AT_CHECK([test $idle3 -gt $hard3])
5118 AT_CHECK([test $idle4 -lt $hard4])
5119 AT_CHECK([test $hard4 -lt $duration4])
5120
5121 OVS_VSWITCHD_STOP
5122 AT_CLEANUP
5123
5124 AT_SETUP([ofproto-dpif - fin_timeout])
5125 OVS_VSWITCHD_START
5126 ovs-appctl time/stop
5127 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
5128 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5129 [NXST_FLOW reply:
5130  idle_timeout=60, actions=fin_timeout(idle_timeout=5)
5131 ])
5132
5133 # Check that a TCP SYN packet does not change the timeout.  (Because
5134 # flow stats updates are mainly what implements the fin_timeout
5135 # feature, we warp forward a couple of times to ensure that flow stats
5136 # run before re-checking the flow table.)
5137 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
5138 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
5139 warped
5140 ])
5141 AT_CHECK([ovs-appctl revalidator/purge], [0])
5142 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5143 [NXST_FLOW reply:
5144  n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
5145 ])
5146 # Check that a TCP FIN packet does change the timeout.
5147 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
5148 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
5149 warped
5150 ])
5151 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5152 [NXST_FLOW reply:
5153  n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
5154 ])
5155 OVS_VSWITCHD_STOP
5156 AT_CLEANUP
5157
5158 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
5159 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
5160 ADD_OF_PORTS([br0], [1], [2])
5161 ADD_OF_PORTS([br1], [3])
5162
5163 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
5164 dummy@br0
5165 dummy@br1
5166 ])
5167 OVS_VSWITCHD_STOP
5168 AT_CLEANUP
5169
5170 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
5171 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
5172 ADD_OF_PORTS([br0], [1], [2])
5173 ADD_OF_PORTS([br1], [3])
5174
5175 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
5176 dummy@ovs-dummy: hit:0 missed:0
5177         br0:
5178                 br0 65534/100: (dummy)
5179                 p1 1/1: (dummy)
5180                 p2 2/2: (dummy)
5181         br1:
5182                 br1 65534/101: (dummy)
5183                 p3 3/3: (dummy)
5184 ])
5185 OVS_VSWITCHD_STOP
5186 AT_CLEANUP
5187
5188 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
5189 # bump max-idle to avoid the flows being reclaimed behind us
5190 OVS_VSWITCHD_START([add-br br1 -- \
5191                     set bridge br1 datapath-type=dummy fail-mode=secure -- \
5192                     set Open_vSwitch . other_config:max-idle=10000])
5193 ADD_OF_PORTS([br0], [1], [2])
5194 ADD_OF_PORTS([br1], [3])
5195
5196 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)'])
5197 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)'])
5198 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)'])
5199 ovs-appctl revalidator/wait
5200 AT_CHECK([ovs-appctl dpif/dump-flows br0 | STRIP_UFID | STRIP_USED | sort], [0], [dnl
5201 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
5202 recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
5203 ])
5204
5205 AT_CHECK([ovs-appctl dpif/dump-flows br1 | STRIP_UFID | STRIP_USED | sort], [0], [dnl
5206 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
5207 ])
5208
5209 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | STRIP_UFID | STRIP_USED | sort], [0], [dnl
5210 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(p1),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
5211 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(p2),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=0/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
5212 ])
5213
5214 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | STRIP_UFID | STRIP_USED | sort], [0], [dnl
5215 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(p3),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
5216 ])
5217
5218 OVS_VSWITCHD_STOP
5219 AT_CLEANUP
5220
5221 AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow])
5222
5223 OVS_VSWITCHD_START([add-br br1 -- \
5224                     set bridge br1 datapath-type=dummy fail-mode=secure -- \
5225                     set Open_vSwitch . other_config:max-idle=10000])
5226 ADD_OF_PORTS([br0], [1], [2])
5227
5228 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)'])
5229 ovs-appctl revalidator/wait
5230 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
5231
5232 UFID=`sed -n 's/\(ufid:[[0-9a-fA-F]]*\).*/\1/p' stdout`
5233 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
5234 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
5235 ])
5236
5237 OVS_VSWITCHD_STOP
5238 AT_CLEANUP
5239
5240 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
5241 OVS_VSWITCHD_START([dnl
5242    add-port br0 p1 -- set Interface p1 type=dummy
5243 ])
5244 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5245 ON_EXIT([kill `cat ovs-ofctl.pid`])
5246
5247 AT_CAPTURE_FILE([ofctl_monitor.log])
5248 AT_DATA([flows.txt], [dnl
5249 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
5250 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8849,controller
5251 ])
5252 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5253
5254 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
5255 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
5256 dnl
5257 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
5258 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)
5259 dnl         (label 20, exp 0, [S], ttl 32)
5260 dnl         (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
5261 dnl     192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
5262
5263 for dl_src in 00 01; do
5264     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"])
5265 done
5266 sleep 1  # wait for the datapath flow installed
5267 AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5268 recirc_id=0,mpls,in_port=1,dl_src=60:66:66:66:66:00,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=0,mpls_lse1=82208, actions:userspace(pid=0,slow_path(controller))
5269 recirc_id=0,mpls,in_port=1,dl_src=60:66:66:66:66:01,mpls_bos=0,mpls_lse1=82208, actions:userspace(pid=0,slow_path(controller))
5270 ])
5271
5272 OVS_VSWITCHD_STOP
5273 AT_CLEANUP
5274
5275
5276 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
5277 OVS_VSWITCHD_START([dnl
5278    add-port br0 p1 -- set Interface p1 type=dummy
5279 ])
5280 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5281 ON_EXIT([kill `cat ovs-ofctl.pid`])
5282
5283 AT_CAPTURE_FILE([ofctl_monitor.log])
5284 AT_DATA([flows.txt], [dnl
5285 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
5286 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8849,controller
5287 ])
5288 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5289
5290 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
5291 dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
5292 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
5293 dnl
5294 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
5295 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)
5296 dnl         (label 20, exp 0, ttl 32)
5297 dnl         (label 20, exp 0, ttl 32)
5298 dnl         (label 20, exp 0, [S], ttl 32)
5299 dnl         (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
5300 dnl     192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
5301
5302 for dl_src in 00 01; do
5303     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"])
5304 done
5305 sleep 1  # wait for the datapath flow installed
5306 AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5307 recirc_id=0,mpls,in_port=1,dl_src=60:66:66:66:66:00,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=0,mpls_lse1=82208, actions:userspace(pid=0,slow_path(controller))
5308 recirc_id=0,mpls,in_port=1,dl_src=60:66:66:66:66:01,mpls_bos=0,mpls_lse1=82208, actions:userspace(pid=0,slow_path(controller))
5309 ])
5310
5311 OVS_VSWITCHD_STOP
5312 AT_CLEANUP
5313
5314 AT_SETUP([ofproto-dpif - patch ports])
5315 OVS_VSWITCHD_START([add-br br1 \
5316 -- set bridge br1 datapath-type=dummy fail-mode=secure \
5317 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
5318 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
5319
5320 ADD_OF_PORTS([br0], [2])
5321 ADD_OF_PORTS([br1], [3])
5322
5323 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
5324 ], [])
5325 AT_CHECK([ovs-appctl time/stop])
5326 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5327
5328 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
5329 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
5330
5331 for i in $(seq 1 10); do
5332     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)'
5333     if [[ $i -eq 1 ]]; then
5334         sleep 1
5335     fi
5336 done
5337
5338 for i in $(seq 1 5); do
5339     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)'
5340     if [[ $i -eq 1 ]]; then
5341         sleep 1
5342     fi
5343 done
5344
5345 AT_CHECK([ovs-appctl time/warp 500], [0],
5346 [warped
5347 ])
5348 sleep 1  # wait for log writer
5349
5350 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
5351 dummy@ovs-dummy: hit:13 missed:2
5352         br0:
5353                 br0 65534/100: (dummy)
5354                 p2 2/2: (dummy)
5355                 pbr0 1/none: (patch: peer=pbr1)
5356         br1:
5357                 br1 65534/101: (dummy)
5358                 p3 3/3: (dummy)
5359                 pbr1 1/none: (patch: peer=pbr0)
5360 ])
5361
5362 AT_CHECK([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5363 recirc_id=0,ip,in_port=100,nw_frag=no, actions:101,3,2
5364 recirc_id=0,ip,in_port=101,nw_frag=no, actions:100,2,3
5365 ])
5366
5367 AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(100).*packets:9' | STRIP_UFID | FILTER_FLOW_DUMP], [0], [dnl
5368 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(100),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:9, bytes:540, used:0.0s, actions:101,3,2
5369 ])
5370 AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(101).*packets:4' | STRIP_UFID | FILTER_FLOW_DUMP], [0], [dnl
5371 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(101),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:4, bytes:240, used:0.0s, actions:100,2,3
5372 ])
5373
5374 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
5375 OFPST_PORT reply (xid=0x4): 1 ports
5376   port  1: rx pkts=5, bytes=300, drop=0, errs=0, frame=0, over=0, crc=0
5377            tx pkts=10, bytes=600, drop=0, errs=0, coll=0
5378 ])
5379
5380 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
5381 OFPST_PORT reply (xid=0x4): 1 ports
5382   port  1: rx pkts=10, bytes=600, drop=0, errs=0, frame=0, over=0, crc=0
5383            tx pkts=5, bytes=300, drop=0, errs=0, coll=0
5384 ])
5385
5386 OVS_VSWITCHD_STOP
5387 AT_CLEANUP
5388
5389 AT_SETUP([ofproto-dpif - port duration])
5390 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
5391 ADD_OF_PORTS([br0], 1, 2)
5392
5393 ovs-appctl time/stop
5394 ovs-appctl time/warp 10000
5395
5396 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
5397 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
5398 [dnl
5399            duration=?s
5400            duration=?s
5401            duration=?s
5402 ])
5403 OVS_VSWITCHD_STOP
5404 AT_CLEANUP
5405
5406 dnl ----------------------------------------------------------------------
5407 AT_BANNER([ofproto-dpif -- megaflows])
5408
5409 AT_SETUP([ofproto-dpif megaflow - port classification])
5410 OVS_VSWITCHD_START
5411 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5412 ADD_OF_PORTS([br0], [1], [2])
5413 AT_DATA([flows.txt], [dnl
5414 table=0 in_port=1 actions=output(2)
5415 ])
5416 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5417 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)'])
5418 sleep 1
5419 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)'])
5420 sleep 1
5421 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5422 recirc_id=0,ip,in_port=1,nw_frag=no, actions: <del>
5423 ])
5424 OVS_VSWITCHD_STOP
5425 AT_CLEANUP
5426
5427 AT_SETUP([ofproto-dpif megaflow - L2 classification])
5428 OVS_VSWITCHD_START
5429 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5430 ADD_OF_PORTS([br0], [1], [2])
5431 AT_DATA([flows.txt], [dnl
5432 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
5433 ])
5434 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5435 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)'])
5436 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)'])
5437 sleep 1
5438 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5439 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
5440 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:0b/ff:ff:00:00:00:02,nw_frag=no, actions: <del>
5441 ])
5442 OVS_VSWITCHD_STOP
5443 AT_CLEANUP
5444
5445 AT_SETUP([ofproto-dpif megaflow - L3 classification])
5446 OVS_VSWITCHD_START
5447 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5448 ADD_OF_PORTS([br0], [1], [2])
5449 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], [])
5450 AT_DATA([flows.txt], [dnl
5451 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
5452 ])
5453 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5454 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)'])
5455 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)'])
5456 sleep 1
5457 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5458 recirc_id=0,icmp,in_port=1,nw_src=10.0.0.4,nw_frag=no, actions: <del>
5459 recirc_id=0,ip,in_port=1,nw_src=10.0.0.2/0.0.0.2,nw_frag=no, actions: <del>
5460 ])
5461 OVS_VSWITCHD_STOP
5462 AT_CLEANUP
5463
5464 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
5465 OVS_VSWITCHD_START
5466 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5467 ADD_OF_PORTS([br0], [1], [2])
5468 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], [])
5469 AT_DATA([flows.txt], [dnl
5470 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
5471 ])
5472 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5473 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)'])
5474 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)'])
5475 sleep 1
5476 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5477 recirc_id=0,ipv6,in_port=1,ipv6_src=2001:db8:3c4d:1:2:3:4:5,nw_frag=no, actions: <del>
5478 recirc_id=0,ipv6,in_port=1,ipv6_src=2001:db8:3c4d:5:4:3:2:1/0:0:0:4::,nw_frag=no, actions: <del>
5479 ])
5480 OVS_VSWITCHD_STOP
5481 AT_CLEANUP
5482
5483 AT_SETUP([ofproto-dpif megaflow - L4 classification])
5484 OVS_VSWITCHD_START
5485 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5486 ADD_OF_PORTS([br0], [1], [2])
5487 AT_DATA([flows.txt], [dnl
5488 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
5489 ])
5490 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5491 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)'])
5492 sleep 1
5493 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)'])
5494 sleep 1
5495 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5496 recirc_id=0,icmp,in_port=1,nw_frag=no,icmp_type=0x8/0xff, actions: <del>
5497 ])
5498 OVS_VSWITCHD_STOP
5499 AT_CLEANUP
5500
5501 AT_SETUP([ofproto-dpif megaflow - normal])
5502 OVS_VSWITCHD_START
5503 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5504 ADD_OF_PORTS([br0], [1], [2])
5505 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5506 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)'])
5507 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)'])
5508 sleep 1
5509 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5510 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions: <del>
5511 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions: <del>
5512 ])
5513 OVS_VSWITCHD_STOP
5514 AT_CLEANUP
5515
5516 AT_SETUP([ofproto-dpif megaflow - mpls])
5517 OVS_VSWITCHD_START
5518 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5519 ADD_OF_PORTS([br0], [1], [2])
5520 AT_DATA([flows.txt], [dnl
5521 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
5522 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
5523 ])
5524 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5525 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)'])
5526 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)'])
5527 sleep 1
5528 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5529 recirc_id=0,mpls,in_port=1,dl_src=50:54:00:00:00:09,mpls_label=11,mpls_tc=3,mpls_ttl=64,mpls_bos=1, actions: <del>
5530 recirc_id=0,mpls,in_port=1,dl_src=50:54:00:00:00:0b,mpls_bos=1, actions: <del>
5531 ])
5532 OVS_VSWITCHD_STOP
5533 AT_CLEANUP
5534
5535 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR, IP_VERSION_TYPE)
5536 #
5537 # IP_VERSION_TYPE is used in AT_SETUP
5538 m4_define([CHECK_MEGAFLOW_NETFLOW],
5539   [AT_SETUP([ofproto-dpif megaflow - netflow - $2 collector])
5540   OVS_VSWITCHD_START
5541   AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5542   ADD_OF_PORTS([br0], [1], [2])
5543
5544   dnl NetFlow configuration disables wildcarding relevant fields
5545   ON_EXIT([kill `cat test-netflow.pid`])
5546   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
5547   AT_CAPTURE_FILE([netflow.log])
5548   NETFLOW_PORT=`parse_listening_port < test-netflow.log`
5549   ovs-vsctl \
5550      set Bridge br0 netflow=@nf -- \
5551      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
5552        engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
5553
5554   AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5555   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)'])
5556   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)'])
5557   sleep 1
5558   AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5559 recirc_id=0,icmp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_frag=no,icmp_type=0x8/0xff,icmp_code=0x0/0xff, actions: <del>
5560 recirc_id=0,icmp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_src=10.0.0.4,nw_dst=10.0.0.3,nw_tos=0,nw_frag=no,icmp_type=0x8/0xff,icmp_code=0x0/0xff, actions: <del>
5561 ])
5562   OVS_VSWITCHD_STOP
5563   AT_CLEANUP])
5564
5565 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
5566 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
5567
5568 AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding])
5569 OVS_VSWITCHD_START(
5570   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
5571    add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
5572    set interface p2 type=dummy ofport_request=2 -- \
5573    set interface p3 type=dummy ofport_request=3])
5574 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
5575 ])
5576 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5577
5578 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5579 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)'])
5580 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)'])
5581 sleep 1
5582 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5583 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions: <del>
5584 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions: <del>
5585 ])
5586 OVS_VSWITCHD_STOP
5587 AT_CLEANUP
5588
5589 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
5590 OVS_VSWITCHD_START(
5591   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
5592    add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
5593    set interface p2 type=dummy ofport_request=2 -- \
5594    set interface p3 type=dummy ofport_request=3])
5595 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
5596 ])
5597 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5598
5599 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5600 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)'])
5601 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)'])
5602 sleep 1
5603 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5604 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions: <del>
5605 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions: <del>
5606 ])
5607 OVS_VSWITCHD_STOP
5608 AT_CLEANUP
5609
5610 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
5611 # Create bond0 on br0 with interfaces p0 and p1
5612 #    and bond1 on br1 with interfaces p2 and p3
5613 # with p0 patched to p2 and p1 patched to p3.
5614 OVS_VSWITCHD_START(
5615   [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
5616                             other-config:lacp-time=fast \
5617                             other-config:bond-rebalance-interval=0 -- \
5618    set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
5619    set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
5620    add-br br1 -- \
5621    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
5622    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
5623                   fail-mode=secure -- \
5624    add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
5625                             other-config:lacp-time=fast \
5626                             other-config:bond-rebalance-interval=0 -- \
5627    set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
5628    set interface p3 type=patch options:peer=p1 ofport_request=4 --])
5629
5630 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
5631 ])
5632 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5633 ADD_OF_PORTS([br0], [7])
5634 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5635 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
5636 ovs-appctl time/stop
5637 ovs-appctl time/warp 5000
5638 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)'])
5639 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)'])
5640 sleep 1
5641 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5642 recirc_id=0,ip,in_port=7,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions: <del>
5643 recirc_id=0,ip,in_port=7,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions: <del>
5644 ])
5645 OVS_VSWITCHD_STOP
5646 AT_CLEANUP
5647
5648 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
5649 OVS_VSWITCHD_START
5650 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5651 ADD_OF_PORTS([br0], [1], [2])
5652 AT_DATA([flows.txt], [dnl
5653 table=0 in_port=1,ip actions=resubmit(90)
5654 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
5655 ])
5656 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5657 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)'])
5658 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)'])
5659 sleep 1
5660 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5661 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
5662 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:0b/ff:ff:00:00:00:02,nw_frag=no, actions: <del>
5663 ])
5664 OVS_VSWITCHD_STOP
5665 AT_CLEANUP
5666
5667 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
5668 OVS_VSWITCHD_START
5669 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5670 ADD_OF_PORTS([br0], [1], [2])
5671 AT_DATA([flows.txt], [dnl
5672 table=0 in_port=1,ip actions=resubmit(,1)
5673 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
5674 ])
5675 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5676 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)'])
5677 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=
5678 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
5679 sleep 1
5680 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5681 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
5682 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
5683 ])
5684 OVS_VSWITCHD_STOP
5685 AT_CLEANUP
5686
5687 AT_SETUP([ofproto-dpif megaflow - goto_table action])
5688 OVS_VSWITCHD_START
5689 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5690 ADD_OF_PORTS([br0], [1], [2])
5691 AT_DATA([flows.txt], [dnl
5692 table=0 in_port=1,ip actions=goto_table(1)
5693 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
5694 ])
5695 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
5696 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)'])
5697 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)'])
5698 sleep 1
5699 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5700 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
5701 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
5702 ])
5703 OVS_VSWITCHD_STOP
5704 AT_CLEANUP
5705
5706 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
5707 OVS_VSWITCHD_START
5708 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5709 ADD_OF_PORTS([br0], [1], [2], [3])
5710 ovs-vsctl \
5711         set Bridge br0 mirrors=@m --\
5712         --id=@p3 get Port p3 --\
5713         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
5714
5715 AT_DATA([flows.txt], [dnl
5716 in_port=1 actions=output:2
5717 ])
5718 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5719 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)'])
5720 sleep 1
5721 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)'])
5722 sleep 1
5723 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5724 recirc_id=0,ip,in_port=1,nw_frag=no, actions: <del>
5725 ])
5726 OVS_VSWITCHD_STOP
5727 AT_CLEANUP
5728
5729 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
5730 OVS_VSWITCHD_START
5731 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5732 ADD_OF_PORTS([br0], [1], [2], [3])
5733 ovs-vsctl \
5734         set Bridge br0 mirrors=@m --\
5735         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
5736         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
5737
5738 AT_DATA([flows.txt], [dnl
5739 in_port=1 actions=output:2
5740 ])
5741 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5742 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))'])
5743 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)'])
5744 sleep 1
5745 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5746 recirc_id=0,ip,in_port=1,dl_vlan=11,nw_frag=no, actions: <del>
5747 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,nw_frag=no, actions: <del>
5748 ])
5749 OVS_VSWITCHD_STOP
5750 AT_CLEANUP
5751
5752 AT_SETUP([ofproto-dpif megaflow - move action])
5753 OVS_VSWITCHD_START
5754 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5755 ADD_OF_PORTS([br0], [1], [2])
5756 AT_DATA([flows.txt], [dnl
5757 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
5758 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
5759 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
5760 ])
5761 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5762 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)'])
5763 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)'])
5764 sleep 1
5765 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5766 recirc_id=0,ip,in_port=1,nw_src=10.0.0.2,nw_frag=no, actions: <del>
5767 recirc_id=0,ip,in_port=1,nw_src=10.0.0.4,nw_frag=no, actions: <del>
5768 ])
5769 OVS_VSWITCHD_STOP
5770 AT_CLEANUP
5771
5772 AT_SETUP([ofproto-dpif megaflow - push action])
5773 OVS_VSWITCHD_START
5774 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5775 ADD_OF_PORTS([br0], [1], [2])
5776 AT_DATA([flows.txt], [dnl
5777 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
5778 ])
5779 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5780 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)'])
5781 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)'])
5782 sleep 1
5783 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5784 recirc_id=0,ip,in_port=1,nw_src=10.0.0.2,nw_frag=no, actions: <del>
5785 recirc_id=0,ip,in_port=1,nw_src=10.0.0.4,nw_frag=no, actions: <del>
5786 ])
5787 OVS_VSWITCHD_STOP
5788 AT_CLEANUP
5789
5790 AT_SETUP([ofproto-dpif megaflow - learning])
5791 OVS_VSWITCHD_START
5792 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5793 ADD_OF_PORTS([br0], [1], [2])
5794 AT_DATA([flows.txt], [dnl
5795 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
5796 ])
5797 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5798 ovs-appctl time/stop
5799 # We send each packet twice because the first packet in each flow causes the
5800 # flow table to change and thus revalidations, which (depending on timing)
5801 # can keep a megaflow from being installed.  The revalidations are done by
5802 # the second iteration, allowing the flows to be installed.
5803 for i in 1 2; do
5804     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)'])
5805     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)'])
5806     ovs-appctl time/warp 100
5807 done
5808 sleep 1
5809 dnl The original flow is missing due to a revalidation.
5810 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5811 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x0fff,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
5812 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x0fff,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
5813 ])
5814 OVS_VSWITCHD_STOP
5815 AT_CLEANUP
5816
5817 AT_SETUP([ofproto-dpif megaflow - tunnels])
5818 OVS_VSWITCHD_START(
5819   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
5820 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5821 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
5822      options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
5823 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
5824           ofport_request=3])
5825 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
5826      options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
5827      ofport_request=4 options:key=flow])
5828 AT_DATA([flows.txt], [dnl
5829 in_port=1,actions=output(2)
5830 in_port=3,actions=output(4)
5831 ])
5832 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5833 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
5834 dnl will cause the packet to be dropped.
5835 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)'])
5836 sleep 1
5837 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)'])
5838 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)'])
5839 sleep 1
5840 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)'])
5841 sleep 1
5842 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5843 recirc_id=0,ip,in_port=1,nw_ecn=1,nw_frag=no, actions: <del>
5844 recirc_id=0,ip,in_port=3,nw_tos=0,nw_ecn=1,nw_ttl=64,nw_frag=no, actions: <del>
5845 recirc_id=0,ip,in_port=3,nw_tos=252,nw_ecn=1,nw_ttl=128,nw_frag=no, actions: <del>
5846 ])
5847 OVS_VSWITCHD_STOP
5848 AT_CLEANUP
5849
5850 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
5851 OVS_VSWITCHD_START
5852 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5853 ADD_OF_PORTS([br0], [1], [2])
5854 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], [])
5855 AT_DATA([flows.txt], [dnl
5856 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
5857 ])
5858 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5859 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)'])
5860 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)'])
5861 sleep 1
5862 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5863 recirc_id=0,icmp,in_port=1,nw_src=10.0.0.4,nw_ttl=64,nw_frag=no, actions: <del>
5864 recirc_id=0,ip,in_port=1,nw_src=10.0.0.2/0.0.0.2,nw_frag=no, actions: <del>
5865 ])
5866 OVS_VSWITCHD_STOP
5867 AT_CLEANUP
5868
5869 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
5870 OVS_VSWITCHD_START
5871 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5872 ADD_OF_PORTS([br0], [1], [2])
5873 AT_DATA([flows.txt], [dnl
5874 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
5875 ])
5876 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5877 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)'])
5878 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)'])
5879 sleep 1
5880 dnl The first packet is essentially a no-op, as the new destination MAC is the
5881 dnl same as the original.  The second entry actually updates the destination
5882 dnl MAC.
5883 AT_CHECK([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5884 recirc_id=0,ip,in_port=1,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions:2
5885 recirc_id=0,ip,in_port=1,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions:set(eth(dst=50:54:00:00:00:0a)),2
5886 ])
5887 OVS_VSWITCHD_STOP
5888 AT_CLEANUP
5889
5890 AT_SETUP([ofproto-dpif megaflow - disabled])
5891 OVS_VSWITCHD_START
5892 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5893 ADD_OF_PORTS([br0], [1], [2])
5894 AT_DATA([flows.txt], [dnl
5895 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
5896 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
5897 ])
5898 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
5899 ], [])
5900 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
5901 ], [])
5902 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
5903 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5904 for i in 1 2 3 4; do
5905     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)'])
5906     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)'])
5907     if [[ $i -eq 1 ]]; then
5908         sleep 1
5909     fi
5910 done
5911 sleep 1
5912 AT_CHECK([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5913 pkt_mark=0,recirc_id=0,skb_priority=0,icmp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0, actions:2
5914 pkt_mark=0,recirc_id=0,skb_priority=0,icmp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_src=10.0.0.4,nw_dst=10.0.0.3,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0, actions:drop
5915 ])
5916 AT_CHECK([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_DUMP | grep 'packets:3'], [0], [dnl
5917 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:180, used:0.0s, actions:2
5918 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.4,dst=10.0.0.3,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:3, bytes:180, used:0.0s, actions:drop
5919 ])
5920 OVS_VSWITCHD_STOP
5921 AT_CLEANUP
5922
5923 AT_SETUP([ofproto-dpif - datapath port number change])
5924 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5925 ADD_OF_PORTS([br0], 1)
5926
5927 # Trace a flow that should output to p1.
5928 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
5929   [0], [stdout])
5930 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
5931 ])
5932
5933 # Change p1's port number to 5.
5934 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
5935
5936 # Trace a flow that should output to p1 in its new location.
5937 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
5938   [0], [stdout])
5939 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
5940 ])
5941 OVS_VSWITCHD_STOP
5942 AT_CLEANUP
5943
5944 # Tests the bundling with various bfd and cfm configurations.
5945 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
5946 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
5947                     add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
5948                     add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
5949                     set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
5950                     set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
5951                     set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
5952                     set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
5953                     set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
5954                     set Interface p0 cfm_mpid=1 -- \
5955                     set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
5956
5957 ovs-appctl time/stop
5958 # advance the clock to stablize everything.
5959 ovs-appctl time/warp 5000 100
5960 # cfm/show should show 'recv' fault.
5961 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
5962         fault: recv
5963 ])
5964 # bfd/show should show 'up'.
5965 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
5966         Local Session State: up
5967         Remote Session State: up
5968         Local Session State: up
5969         Remote Session State: up
5970 ])
5971 # bond/show should show 'may-enable: true' for all slaves.
5972 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
5973         may_enable: true
5974         may_enable: true
5975         may_enable: true
5976         may_enable: true
5977 ])
5978
5979 # now disable the bfd on p1.
5980 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
5981 # advance the clock to stablize everything.
5982 ovs-appctl time/warp 5000 100
5983 # cfm/show should show 'recv' fault.
5984 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
5985         fault: recv
5986 ])
5987 # bfd/show should show 'down'.
5988 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
5989         Local Session State: down
5990         Remote Session State: down
5991 ])
5992 # bond/show should show 'may-enable: false' for p0.
5993 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
5994         may_enable: false
5995         may_enable: true
5996 ])
5997
5998 # now enable the bfd on p1 and disable bfd on p0.
5999 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
6000 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
6001 # advance the clock to stablize everything.
6002 ovs-appctl time/warp 5000 100
6003 # cfm/show should show 'recv' fault.
6004 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
6005         fault: recv
6006 ])
6007 # bfd/show should show 'down'.
6008 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
6009         Local Session State: down
6010         Remote Session State: down
6011 ])
6012 # bond/show should show 'may-enable: false' for p0 and p1.
6013 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
6014         may_enable: false
6015         may_enable: true
6016         may_enable: false
6017         may_enable: true
6018 ])
6019
6020 OVS_VSWITCHD_STOP
6021 AT_CLEANUP
6022
6023 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
6024 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
6025
6026 # enable bfd on p0.
6027 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
6028 # check log.
6029 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
6030 # disable bfd on p0.
6031 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
6032 # check log.
6033 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
6034 AT_CHECK([cat ovs-vswitchd.log | sed -e '/^.*ofproto_dpif_monitor.*$/d' > ovs-vswitchd.log])
6035
6036 # enable cfm on p0.
6037 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
6038 # check log.
6039 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
6040 # disable cfm on p0.
6041 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
6042 # check log.
6043 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
6044 AT_CHECK([cat ovs-vswitchd.log | sed -e '/^.*ofproto_dpif_monitor.*$/d' > ovs-vswitchd.log])
6045
6046 # enable both bfd and cfm on p0.
6047 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
6048 # check log.
6049 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
6050 # disable bfd on p0.
6051 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
6052 # check log, there should not be the log of thread terminated.
6053 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
6054 ])
6055 # reenable bfd on p0.
6056 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
6057 # check log, should still be on log of thread created.
6058 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
6059 monitor thread created
6060 ])
6061 # disable bfd and cfm together.
6062 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
6063 # check log.
6064 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
6065
6066 OVS_VSWITCHD_STOP
6067 AT_CLEANUP
6068
6069 # this test helps avoid the deadlock between the main thread and monitor thread.
6070 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
6071 OVS_VSWITCHD_START
6072
6073 for i in `seq 1 199`
6074 do
6075     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])
6076 done
6077
6078 OVS_VSWITCHD_STOP
6079 AT_CLEANUP
6080 \f
6081 AT_BANNER([ofproto-dpif - flow translation resource limits])
6082
6083 AT_SETUP([ofproto-dpif - infinite resubmit])
6084 OVS_VSWITCHD_START
6085 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
6086 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
6087   [0], [stdout])
6088 AT_CHECK([tail -1 stdout], [0], [Datapath actions: drop
6089 ])
6090 AT_CHECK([grep -c 'resubmit actions recursed over 64 times' ovs-vswitchd.log],
6091   [0], [1
6092 ])
6093 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
6094 AT_CLEANUP
6095
6096 AT_SETUP([ofproto-dpif - exponential resubmit chain])
6097 OVS_VSWITCHD_START
6098 ADD_OF_PORTS([br0], 1)
6099 (for i in `seq 1 64`; do
6100      j=`expr $i + 1`
6101      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
6102  done
6103  echo "in_port=65, actions=local") > flows
6104  AT_CHECK([ovs-ofctl add-flows br0 flows])
6105 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
6106 AT_CHECK([grep -c 'over 4096 resubmit actions' ovs-vswitchd.log], [0], [1
6107 ])
6108 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
6109 AT_CLEANUP
6110
6111 AT_SETUP([ofproto-dpif - too many output actions])
6112 OVS_VSWITCHD_START
6113 ADD_OF_PORTS([br0], 1)
6114 (for i in `seq 1 12`; do
6115      j=`expr $i + 1`
6116      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
6117  done
6118  echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
6119 AT_CHECK([ovs-ofctl add-flows br0 flows])
6120 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
6121 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
6122   [0], [1
6123 ])
6124 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' ovs-vswitchd.log], [0], [1
6125 ])
6126 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
6127 AT_CLEANUP
6128
6129 AT_SETUP([ofproto-dpif - stack too deep])
6130 OVS_VSWITCHD_START
6131 ADD_OF_PORTS([br0], 1)
6132 (for i in `seq 1 12`; do
6133      j=`expr $i + 1`
6134      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
6135  done
6136  push="push:NXM_NX_REG0[[]]"
6137  echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
6138  AT_CHECK([ovs-ofctl add-flows br0 flows])
6139 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
6140 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' ovs-vswitchd.log], [0], [1
6141 ])
6142 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
6143 AT_CLEANUP
6144
6145
6146 AT_SETUP([ofproto-dpif packet-out controller])
6147 OVS_VSWITCHD_START
6148 ADD_OF_PORTS([br0], 1, 2)
6149
6150 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
6151
6152 AT_CAPTURE_FILE([ofctl_monitor.log])
6153 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6154
6155 for i in 1 2 3; do
6156         AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
6157 done
6158
6159 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
6160 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6161 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
6162 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6163 dnl
6164 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
6165 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6166 dnl
6167 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
6168 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6169 ])
6170
6171 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6172  dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
6173 NXST_FLOW reply:
6174 ])
6175
6176 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
6177   table 0:
6178     active=1, lookup=0, matched=0"
6179  x=1
6180  while test $x -lt 254; do
6181    echo "
6182   table $x:
6183     active=0, lookup=0, matched=0"
6184    x=`expr $x + 1`
6185  done) > expout
6186 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
6187
6188 OVS_VSWITCHD_STOP
6189 AT_CLEANUP
6190
6191 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
6192 OVS_VSWITCHD_START(
6193   [-- \
6194    add-port br0 p1 -- \
6195    set interface p1 type=patch options:peer=p2 -- \
6196    add-br br1 -- \
6197    set bridge br1 datapath-type=dummy -- \
6198    set bridge br1 fail-mode=secure -- \
6199    set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
6200    add-port br1 p2 -- \
6201    set interface p2 type=patch options:peer=p1 --])
6202
6203 AT_CAPTURE_FILE([ofctl_monitor.log])
6204 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6205
6206 for i in 1 2 3; do
6207         AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
6208 done
6209
6210 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
6211 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6212 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
6213 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6214 dnl
6215 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
6216 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6217 dnl
6218 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
6219 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6220 ])
6221
6222 (printf "OFPST_TABLE reply (OF1.3) (xid=0x2):"
6223  x=0
6224  while test $x -lt 254; do
6225    echo "
6226   table $x:
6227     active=0, lookup=0, matched=0"
6228    x=`expr $x + 1`
6229  done) > expout
6230 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
6231
6232 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
6233   table 0:
6234     active=0, lookup=3, matched=0"
6235  x=1
6236  while test $x -lt 254; do
6237    echo "
6238   table $x:
6239     active=0, lookup=0, matched=0"
6240    x=`expr $x + 1`
6241  done) > expout
6242 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
6243
6244 OVS_VSWITCHD_STOP
6245 AT_CLEANUP
6246
6247
6248 AT_SETUP([ofproto-dpif packet-out goto_table])
6249 OVS_VSWITCHD_START
6250 ADD_OF_PORTS([br0], 1, 2)
6251
6252 AT_DATA([flows.txt], [dnl
6253 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
6254 table=1 dl_dst=50:54:00:00:00:0a actions=controller
6255 ])
6256 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
6257
6258 AT_CAPTURE_FILE([ofctl_monitor.log])
6259 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6260
6261 for i in 1 2 3; do
6262     ovs-appctl 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)'
6263 done
6264
6265 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
6266 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
6267 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6268 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
6269 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6270 dnl
6271 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
6272 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6273 dnl
6274 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
6275 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6276 ])
6277
6278 AT_CHECK([ovs-appctl revalidator/purge], [0])
6279 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6280  n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=goto_table:1
6281  table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
6282 OFPST_FLOW reply (OF1.3):
6283 ])
6284
6285 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
6286   table 0:
6287     active=1, lookup=3, matched=3
6288
6289   table 1:
6290     active=1, lookup=3, matched=3"
6291  x=2
6292  while test $x -lt 254; do
6293    echo "
6294   table $x:
6295     active=0, lookup=0, matched=0"
6296    x=`expr $x + 1`
6297  done) > expout
6298 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
6299
6300 OVS_VSWITCHD_STOP
6301 AT_CLEANUP
6302
6303
6304 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
6305 OVS_VSWITCHD_START
6306 ADD_OF_PORTS([br0], 1, 2)
6307
6308 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
6309 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
6310
6311 AT_CAPTURE_FILE([ofctl_monitor.log])
6312 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6313
6314 for i in 1 2 3; do
6315     ovs-appctl 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)'
6316 done
6317
6318 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
6319 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
6320 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6321 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
6322 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6323 dnl
6324 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
6325 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6326 dnl
6327 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
6328 in_port=0,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
6329 ])
6330
6331 AT_CHECK([ovs-appctl revalidator/purge], [0])
6332 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6333  table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
6334 OFPST_FLOW reply (OF1.1):
6335 ])
6336
6337 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
6338   table 0:
6339     active=0, lookup=3, matched=0
6340
6341   table 1:
6342     active=1, lookup=3, matched=3"
6343  x=2
6344  while test $x -lt 254; do
6345    echo "
6346   table $x:
6347     active=0, lookup=0, matched=0"
6348    x=`expr $x + 1`
6349  done) > expout
6350 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
6351
6352 OVS_VSWITCHD_STOP
6353 AT_CLEANUP
6354
6355 AT_SETUP([ofproto-dpif - ICMPv6])
6356 OVS_VSWITCHD_START
6357 ADD_OF_PORTS([br0], 1)
6358
6359 AT_CAPTURE_FILE([ofctl_monitor.log])
6360
6361 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6362
6363 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
6364
6365 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
6366
6367 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6368 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
6369 icmp6,in_port=0,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
6370 ])
6371
6372 OVS_VSWITCHD_STOP
6373 AT_CLEANUP