ofproto-dpif.at: Avoid using GNU sed extensions
[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 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
3649 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
3650 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3651 ])
3652
3653 mode=drop
3654
3655 AT_CHECK([ovs-appctl revalidator/purge], [0])
3656 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3657 for type in no first later; do
3658   eval flow=\$${type}_flow
3659   printf "\n%s\n" "----$mode $type-----"
3660
3661   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3662 done
3663
3664 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3665 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
3666 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
3667 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
3668 ])
3669
3670 mode=nx-match
3671
3672 AT_CHECK([ovs-appctl revalidator/purge], [0])
3673 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3674 for type in no first later; do
3675   eval flow=\$${type}_flow
3676   printf "\n%s\n" "----$mode $type-----"
3677
3678   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3679 done
3680
3681 AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
3682 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
3683 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
3684 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3685 ])
3686
3687 OVS_VSWITCHD_STOP
3688 AT_CLEANUP
3689
3690 AT_SETUP([ofproto-dpif - fragment handling - actions])
3691 OVS_VSWITCHD_START
3692 ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [90])
3693
3694 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])
3695 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3696 source field tcp_dst lacks correct prerequisites
3697 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3698 ])
3699
3700 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])
3701 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3702 destination field tcp_src lacks correct prerequisites
3703 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3704 ])
3705
3706 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
3707 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3708 set_field udp_src lacks correct prerequisities
3709 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3710 ])
3711
3712 AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
3713 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3714 set_field udp_dst lacks correct prerequisities
3715 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3716 ])
3717
3718 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
3719 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3720 set_field sctp_src lacks correct prerequisities
3721 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3722 ])
3723
3724 AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
3725 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3726 set_field sctp_dst lacks correct prerequisities
3727 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3728 ])
3729
3730 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])
3731 AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3732 source field tcp_dst lacks correct prerequisites
3733 ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3734 ])
3735
3736 AT_DATA([flows.txt], [dnl
3737 priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
3738 ])
3739 AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
3740
3741 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3742
3743 mode=normal
3744
3745 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3746 for frag in 4000 6000 6008 4010; do
3747   printf "\n%s\n" "----$mode $frag-----"
3748
3749   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"])
3750 done
3751
3752 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3753 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
3754 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
3755 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
3756 ])
3757
3758 AT_CHECK([ovs-appctl revalidator/purge], [0])
3759 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3760 for frag in 4000 6000 6008 4010; do
3761   printf "\n%s\n" "----$mode $frag truncated transport header -----"
3762
3763   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
3764 done
3765
3766 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3767 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
3768 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
3769 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
3770 ])
3771
3772 AT_CHECK([ovs-appctl revalidator/purge], [0])
3773 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3774 for frag in 4000 6000 6001 4002; do
3775   printf "\n%s\n" "----$mode $frag missing transport header-----"
3776
3777   AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
3778 done
3779
3780 AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
3781 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
3782 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
3783 recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
3784 ])
3785
3786 OVS_VSWITCHD_STOP
3787 AT_CLEANUP
3788
3789 AT_SETUP([ofproto-dpif - exit])
3790 OVS_VSWITCHD_START
3791 ADD_OF_PORTS([br0], [1], [2], [3], [10], [11], [12], [13], [14])
3792 AT_DATA([flows.txt], [dnl
3793 in_port=1 actions=output:10,exit,output:11
3794 in_port=2 actions=output:12,resubmit:1,output:12
3795 in_port=3 actions=output:13,resubmit:2,output:14
3796 ])
3797 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3798 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])
3799 AT_CHECK([tail -1 stdout], [0],
3800   [Datapath actions: 10
3801 ])
3802 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])
3803 AT_CHECK([tail -1 stdout], [0],
3804   [Datapath actions: 12,10
3805 ])
3806 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])
3807 AT_CHECK([tail -1 stdout], [0],
3808   [Datapath actions: 13,12,10
3809 ])
3810 OVS_VSWITCHD_STOP
3811 AT_CLEANUP
3812
3813
3814 AT_SETUP([ofproto-dpif - mirroring, select_all])
3815 OVS_VSWITCHD_START
3816 ADD_OF_PORTS([br0], 1, 2, 3)
3817 ovs-vsctl \
3818         set Bridge br0 mirrors=@m --\
3819         --id=@p3 get Port p3 --\
3820         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
3821
3822 AT_DATA([flows.txt], [dnl
3823 in_port=1 actions=output:2
3824 in_port=2 actions=output:1
3825 ])
3826 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3827
3828 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)"
3829 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3830 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3831   [Datapath actions: 2,3
3832 ])
3833
3834 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)"
3835 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3836 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3837   [Datapath actions: 1,3
3838 ])
3839
3840 OVS_VSWITCHD_STOP
3841 AT_CLEANUP
3842
3843
3844 AT_SETUP([ofproto-dpif - mirroring, select_src])
3845 OVS_VSWITCHD_START
3846 ADD_OF_PORTS([br0], 1, 2, 3)
3847 ovs-vsctl \
3848         set Bridge br0 mirrors=@m --\
3849         --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
3850         --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
3851
3852 AT_DATA([flows.txt], [dnl
3853 in_port=1 actions=output:2
3854 in_port=2 actions=output:1
3855 ])
3856 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3857
3858 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)"
3859 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3860 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3861   [Datapath actions: 2,3
3862 ])
3863
3864 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)"
3865 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3866 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3867   [Datapath actions: 1
3868 ])
3869 OVS_VSWITCHD_STOP
3870 AT_CLEANUP
3871
3872 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
3873 OVS_VSWITCHD_START
3874 ADD_OF_PORTS([br0], 1, 2)
3875 ovs-vsctl \
3876         set Bridge br0 mirrors=@m --\
3877         --id=@p2 get Port p2 --\
3878         --id=@m create Mirror name=mymirror select_all=true output_port=@p2
3879
3880 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
3881
3882 # "in_port" defaults to OFPP_NONE if it's not specified.
3883 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"
3884 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
3885 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3886   [Datapath actions: 1,2
3887 ])
3888
3889 OVS_VSWITCHD_STOP
3890 AT_CLEANUP
3891
3892
3893 AT_SETUP([ofproto-dpif - mirroring, select_dst])
3894 OVS_VSWITCHD_START
3895 ADD_OF_PORTS([br0], 1, 2, 3)
3896 ovs-vsctl \
3897         set Bridge br0 mirrors=@m --\
3898         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
3899         --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
3900
3901 AT_DATA([flows.txt], [dnl
3902 in_port=1 actions=output:2
3903 in_port=2 actions=output:1
3904 ])
3905 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3906
3907 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)"
3908 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3909 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3910   [Datapath actions: 2,3
3911 ])
3912
3913 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)"
3914 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3915 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3916   [Datapath actions: 1
3917 ])
3918
3919 OVS_VSWITCHD_STOP
3920 AT_CLEANUP
3921
3922
3923 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
3924 OVS_VSWITCHD_START
3925 ADD_OF_PORTS([br0], 1, 2, 3)
3926 ovs-vsctl \
3927         set Bridge br0 mirrors=@m --\
3928         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
3929         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
3930
3931 AT_DATA([flows.txt], [dnl
3932 in_port=1, actions=output:2
3933 ])
3934 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3935
3936 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)"
3937 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3938 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3939   [Datapath actions: 2
3940 ])
3941
3942 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))"
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=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))"
3949 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3950 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3951   [Datapath actions: 2,3
3952 ])
3953
3954 OVS_VSWITCHD_STOP
3955 AT_CLEANUP
3956
3957
3958 AT_SETUP([ofproto-dpif - mirroring, output_port])
3959 OVS_VSWITCHD_START
3960 ADD_OF_PORTS([br0], 1, 2, 3)
3961 ovs-vsctl \
3962         set Bridge br0 mirrors=@m --\
3963         --id=@p3 get Port p3 --\
3964         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
3965
3966 AT_DATA([flows.txt], [dnl
3967 in_port=1 actions=mod_vlan_vid:17,output:2
3968 in_port=2 actions=output:1
3969 ])
3970 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3971
3972 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)"
3973 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3974 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3975   [Datapath actions: push_vlan(vid=17,pcp=0),2,pop_vlan,3
3976 ])
3977
3978 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)"
3979 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3980 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3981   [Datapath actions: 1,3
3982 ])
3983
3984 OVS_VSWITCHD_STOP
3985 AT_CLEANUP
3986
3987 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
3988 OVS_VSWITCHD_START
3989 ADD_OF_PORTS([br0], 1, 2)
3990 ovs-vsctl \
3991         set Bridge br0 mirrors=@m --\
3992         --id=@m create Mirror name=mymirror select_all=true output_vlan=12
3993
3994 AT_DATA([flows.txt], [dnl
3995 in_port=1 actions=output:2
3996 in_port=2 actions=mod_vlan_vid:17,output:1
3997 ])
3998 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3999
4000 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)"
4001 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4002 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4003
4004 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
4005 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4006 mv stdout expout
4007 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4008
4009 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)"
4010 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
4011 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4012
4013 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
4014 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
4015 mv stdout expout
4016 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
4017
4018 OVS_VSWITCHD_STOP
4019 AT_CLEANUP
4020
4021 # Two testcases below are for the ofproto/trace command
4022 # The first one tests all correct syntax:
4023 # ofproto/trace [dp_name] odp_flow [-generate|packet]
4024 # ofproto/trace br_name br_flow [-generate|packet]
4025 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
4026 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
4027 ADD_OF_PORTS([br0], 1, 2, 3)
4028
4029 AT_DATA([flows.txt], [dnl
4030 in_port=1 actions=output:2
4031 in_port=2 actions=output:1
4032 ])
4033 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4034
4035 odp_flow="in_port(1)"
4036 br_flow="in_port=1"
4037 # Test command: ofproto/trace odp_flow with in_port as a name.
4038 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4039 AT_CHECK([tail -1 stdout], [0], [dnl
4040 Datapath actions: 2
4041 ])
4042
4043 odp_flow="in_port(1)"
4044 # Test command: ofproto/trace odp_flow
4045 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4046 AT_CHECK([tail -1 stdout], [0], [dnl
4047 Datapath actions: 2
4048 ])
4049
4050 # Test command: ofproto/trace dp_name odp_flow
4051 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
4052 AT_CHECK([tail -1 stdout], [0], [dnl
4053 Datapath actions: 2
4054 ])
4055 # Test commmand: ofproto/trace br_name br_flow
4056 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4057 AT_CHECK([tail -1 stdout], [0], [dnl
4058 Datapath actions: 2
4059 ])
4060
4061 # Delete the inserted flows
4062 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
4063 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
4064
4065 # This section below tests the [-generate] option
4066 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
4067 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"
4068
4069 # Test command: ofproto/trace odp_flow
4070 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4071 # Check for no MAC learning entry
4072 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4073  port  VLAN  MAC                Age
4074 ])
4075
4076 # Test command: ofproto/trace br_name br_flow
4077 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4078 # Check for no MAC learning entry
4079 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4080  port  VLAN  MAC                Age
4081 ])
4082
4083 # Test command: ofproto/trace odp_flow -generate
4084 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
4085 # Check for the MAC learning entry
4086 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4087  port  VLAN  MAC                Age
4088     3     0  50:54:00:00:00:05    ?
4089 ])
4090
4091 # Test command: ofproto/trace dp_name odp_flow -generate
4092 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4093   "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
4094   -generate], [0], [stdout])
4095 # Check for both MAC learning entries
4096 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4097  port  VLAN  MAC                Age
4098     3     0  50:54:00:00:00:05    ?
4099     1     0  50:54:00:00:00:06    ?
4100 ])
4101
4102 # Test command: ofproto/trace br_name br_flow -generate
4103 AT_CHECK([ovs-appctl ofproto/trace br0 \
4104   "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
4105   -generate], [0], [stdout])
4106 # Check for both MAC learning entries.
4107 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4108  port  VLAN  MAC                Age
4109     3     0  50:54:00:00:00:05    ?
4110     1     0  50:54:00:00:00:06    ?
4111     2     0  50:54:00:00:00:07    ?
4112 ])
4113
4114 # This section beflow tests the [packet] option
4115 # The ovs-tcpundump of packets between port1 and port2
4116 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4117 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
4118
4119 # Construct the MAC learning table
4120 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4121   "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
4122   -generate], [0], [stdout])
4123
4124 # Construct the MAC learning table
4125 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4126   "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
4127   -generate], [0], [stdout])
4128
4129 # Test command: ofproto/trace odp_flow packet
4130 AT_CHECK([ovs-appctl ofproto/trace \
4131   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4132 AT_CHECK([tail -1 stdout], [0], [dnl
4133 Datapath actions: 2
4134 ])
4135 AT_CHECK([head -n 2 stdout], [0], [dnl
4136 Bridge: br0
4137 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
4138 ])
4139
4140 # Test command: ofproto/trace dp_name odp_flow packet
4141 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4142   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4143 AT_CHECK([tail -1 stdout], [0], [dnl
4144 Datapath actions: 2
4145 ])
4146 AT_CHECK([head -n 2 stdout], [0], [dnl
4147 Bridge: br0
4148 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
4149 ])
4150
4151 # Test command: ofproto/trace br_name br_flow packet
4152 AT_CHECK([ovs-appctl ofproto/trace br0 \
4153   "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
4154 AT_CHECK([tail -1 stdout], [0], [dnl
4155 Datapath actions: 1
4156 ])
4157 AT_CHECK([head -n 2 stdout], [0], [dnl
4158 Bridge: br0
4159 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
4160 ])
4161
4162 OVS_VSWITCHD_STOP
4163 AT_CLEANUP
4164
4165 # The second test tests the corner cases
4166 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
4167 OVS_VSWITCHD_START
4168 ADD_OF_PORTS([br0], 1, 2)
4169
4170 # Define flows
4171 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
4172 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
4173 # Define options
4174 generate="-generate"
4175 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4176
4177 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
4178 m4_foreach(
4179 [option],
4180 [[],
4181 ["$generate"],
4182 ["$pkt"]],
4183 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
4184   [2], [], [stderr])
4185 AT_CHECK([tail -2 stderr], [0], [dnl
4186 Cannot find the datapath
4187 ovs-appctl: ovs-vswitchd: server returned an error
4188 ])])
4189
4190 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
4191 m4_foreach(
4192 [option],
4193 [[],
4194 ["$generate"],
4195 ["$pkt"]],
4196 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
4197   [2], [], [stderr])
4198 AT_CHECK([tail -2 stderr], [0], [dnl
4199 Cannot find the datapath
4200 ovs-appctl: ovs-vswitchd: server returned an error
4201 ])])
4202
4203 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
4204 m4_foreach(
4205 [option],
4206 [[],
4207 ["$generate"],
4208 ["$pkt"]],
4209 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
4210   [2], [], [stderr])
4211 AT_CHECK([tail -2 stderr], [0], [dnl
4212 Cannot find the datapath
4213 ovs-appctl: ovs-vswitchd: server returned an error
4214 ])])
4215
4216 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
4217 m4_foreach(
4218 [option],
4219 [[],
4220 ["$generate"],
4221 ["$pkt"]],
4222 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
4223   [2], [], [stderr])
4224 AT_CHECK([tail -2 stderr], [0], [dnl
4225 Cannot find the datapath
4226 ovs-appctl: ovs-vswitchd: server returned an error
4227 ])])
4228
4229 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
4230 m4_foreach(
4231 [option],
4232 [[],
4233 ["$generate"],
4234 ["$pkt"]],
4235 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
4236   [2], [], [stderr])
4237 AT_CHECK([tail -2 stderr], [0], [dnl
4238 Unknown bridge name
4239 ovs-appctl: ovs-vswitchd: server returned an error
4240 ])])
4241
4242 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
4243 m4_foreach(
4244 [option],
4245 [[],
4246 ["$generate"],
4247 ["$pkt"]],
4248 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
4249   [2], [], [stderr])
4250 AT_CHECK([tail -2 stderr], [0], [dnl
4251 Must specify bridge name
4252 ovs-appctl: ovs-vswitchd: server returned an error
4253 ])])
4254
4255 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
4256 AT_CHECK([ovs-appctl ofproto/trace \
4257   ovs-dummy "$odp_flow" garbage_option],
4258   [2], [stdout],[stderr])
4259 AT_CHECK([tail -2 stderr], [0], [dnl
4260 Trailing garbage in packet data
4261 ovs-appctl: ovs-vswitchd: server returned an error
4262 ])
4263
4264 # Test incorrect command: ofproto/trace with 4 arguments
4265 AT_CHECK([ovs-appctl ofproto/trace \
4266   arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
4267 AT_CHECK([tail -2 stderr], [0], [dnl
4268 "ofproto/trace" command takes at most 3 arguments
4269 ovs-appctl: ovs-vswitchd: server returned an error
4270 ])
4271
4272 # Test incorrect command: ofproto/trace with 0 argument
4273 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
4274 AT_CHECK([tail -2 stderr], [0], [dnl
4275 "ofproto/trace" command requires at least 1 arguments
4276 ovs-appctl: ovs-vswitchd: server returned an error
4277 ])
4278
4279 OVS_VSWITCHD_STOP
4280 AT_CLEANUP
4281
4282 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
4283 OVS_VSWITCHD_START
4284 ADD_OF_PORTS([br0], 1, 2, 3)
4285
4286 AT_DATA([flows.txt], [dnl
4287 in_port=1 actions=output:2
4288 in_port=2 actions=output:1
4289 ])
4290 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4291
4292 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
4293 AT_CHECK([tail -1 stdout], [0], [dnl
4294 Datapath actions: push_vlan(vid=123,pcp=0),2
4295 ])
4296
4297 OVS_VSWITCHD_STOP
4298 AT_CLEANUP
4299
4300
4301 m4_define([OFPROTO_TRACE],
4302   [flow="$2"
4303    AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
4304    actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4305    expected="$4"
4306    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
4307      [0], [stdout])
4308    mv stdout expout
4309    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
4310      [0], [expout])])
4311
4312 AT_SETUP([ofproto-dpif - MAC learning])
4313 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
4314 ADD_OF_PORTS([br0], 1, 2, 3)
4315
4316 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)'
4317
4318 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
4319 OFPROTO_TRACE(
4320   [ovs-dummy],
4321   [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
4322   [-generate],
4323   [1,2,100])
4324
4325 # Check for the MAC learning entry.
4326 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4327  port  VLAN  MAC                Age
4328     3     0  50:54:00:00:00:05    ?
4329 ])
4330
4331 # Trace a packet arrival destined for the learned MAC.
4332 # (This will also learn a MAC.)
4333 OFPROTO_TRACE(
4334   [ovs-dummy],
4335   [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
4336   [-generate],
4337   [3])
4338
4339 # Check for both MAC learning entries.
4340 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4341  port  VLAN  MAC                Age
4342     3     0  50:54:00:00:00:05    ?
4343     1     0  50:54:00:00:00:06    ?
4344 ])
4345
4346 # Trace a packet arrival that updates the first learned MAC entry.
4347 OFPROTO_TRACE(
4348   [ovs-dummy],
4349   [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
4350   [-generate],
4351   [1,3,100])
4352
4353 # Check that the MAC learning entry was updated.
4354 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4355  port  VLAN  MAC                Age
4356     1     0  50:54:00:00:00:06    ?
4357     2     0  50:54:00:00:00:05    ?
4358 ])
4359
4360 # Add another bridge.
4361 AT_CHECK(
4362   [ovs-vsctl \
4363      -- add-br br1 \
4364      -- set bridge br1 datapath-type=dummy])
4365 ADD_OF_PORTS([br1], 4, 5)
4366
4367 # Trace some packet arrivals in br1 to create MAC learning entries there too.
4368 OFPROTO_TRACE(
4369   [ovs-dummy],
4370   [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
4371   [-generate],
4372   [5,101])
4373 OFPROTO_TRACE(
4374   [ovs-dummy],
4375   [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
4376   [-generate],
4377   [4,101])
4378
4379 # Check that the MAC learning entries were added.
4380 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4381  port  VLAN  MAC                Age
4382     4     0  50:54:00:00:00:06    ?
4383     5     0  50:54:00:00:00:07    ?
4384 ])
4385
4386 # Delete port p1 and see that its MAC learning entry disappeared, and
4387 # that the MAC learning entry for the same MAC was also deleted from br1.
4388 AT_CHECK([ovs-vsctl del-port p1])
4389 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4390  port  VLAN  MAC                Age
4391     2     0  50:54:00:00:00:05    ?
4392 ])
4393 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4394  port  VLAN  MAC                Age
4395     5     0  50:54:00:00:00:07    ?
4396 ])
4397
4398 OVS_VSWITCHD_STOP
4399 AT_CLEANUP
4400
4401 AT_SETUP([ofproto-dpif - MAC table overflow])
4402 OVS_VSWITCHD_START(
4403   [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
4404 ADD_OF_PORTS([br0], 1, 2, 3)
4405
4406 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)'
4407
4408 AT_CHECK([ovs-appctl time/stop])
4409
4410 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
4411 for i in 0 1 2 3 4 5 6 7 8 9; do
4412     OFPROTO_TRACE(
4413       [ovs-dummy],
4414       [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
4415       [-generate],
4416       [1,2,100])
4417     ovs-appctl time/warp 1000
4418 done
4419
4420 # Check for the MAC learning entries.
4421 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4422   [0], [dnl
4423     3     0  50:54:00:00:00:00
4424     3     0  50:54:00:00:00:01
4425     3     0  50:54:00:00:00:02
4426     3     0  50:54:00:00:00:03
4427     3     0  50:54:00:00:00:04
4428     3     0  50:54:00:00:00:05
4429     3     0  50:54:00:00:00:06
4430     3     0  50:54:00:00:00:07
4431     3     0  50:54:00:00:00:08
4432     3     0  50:54:00:00:00:09
4433  port  VLAN  MAC                Age
4434 ])
4435
4436 # Trace another ARP packet on another MAC.
4437 OFPROTO_TRACE(
4438   [ovs-dummy],
4439   [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
4440   [-generate],
4441   [1,2,100])
4442
4443 # Check that the new one chased the oldest one out of the table.
4444 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
4445   [0], [dnl
4446     3     0  50:54:00:00:00:01    ?
4447     3     0  50:54:00:00:00:02    ?
4448     3     0  50:54:00:00:00:03    ?
4449     3     0  50:54:00:00:00:04    ?
4450     3     0  50:54:00:00:00:05    ?
4451     3     0  50:54:00:00:00:06    ?
4452     3     0  50:54:00:00:00:07    ?
4453     3     0  50:54:00:00:00:08    ?
4454     3     0  50:54:00:00:00:09    ?
4455     3     0  50:54:00:00:00:10    ?
4456  port  VLAN  MAC                Age
4457 ])
4458 OVS_VSWITCHD_STOP
4459 AT_CLEANUP
4460
4461 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR, ADDR_WITHOUT_BRACKETS)
4462 #
4463 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
4464 #
4465 # IP_VERSION_TYPE is used in AT_SETUP
4466 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
4467   [AT_SETUP([ofproto-dpif - sFlow packet sampling - $2 collector])
4468   AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
4469   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
4470
4471   ON_EXIT([kill `cat test-sflow.pid`])
4472   AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
4473   AT_CAPTURE_FILE([sflow.log])
4474   SFLOW_PORT=`parse_listening_port < test-sflow.log`
4475   ovs-appctl time/stop
4476
4477   ADD_OF_PORTS([br0], 1, 2)
4478   ovs-vsctl \
4479      set Interface br0 options:ifindex=1002 -- \
4480      set Interface p1 options:ifindex=1004 -- \
4481      set Interface p2 options:ifindex=1003 -- \
4482      set Bridge br0 sflow=@sf -- \
4483      --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
4484        header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
4485
4486   dnl open with ARP packets to seed the bridge-learning.  The output
4487   dnl ifIndex numbers should be reported predictably after that.
4488   dnl Since we set sampling=1 we should see all of these packets
4489   dnl reported. Sorting the output by data-source and seqNo makes
4490   dnl it deterministic. Ensuring that we send at least two packets
4491   dnl into each port means we get to check the seq nos are
4492   dnl incrementing correctly.
4493   dnl because packets from different ports can be handled by separate
4494   dnl threads, put some sleeps
4495
4496   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)'
4497   sleep 1
4498   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)'
4499   sleep 1
4500   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)'
4501   sleep 1
4502   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)'
4503   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)'
4504
4505   dnl sleep long enough to get more than one counter sample
4506   dnl from each datasource so we can check sequence numbers
4507   ovs-appctl time/warp 3000 100
4508   OVS_VSWITCHD_STOP
4509   ovs-appctl -t test-sflow exit
4510
4511   AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
4512         /g']], [0], [dnl
4513 HEADER
4514         dgramSeqNo=1
4515         ds=127.0.0.1>2:1000
4516         fsSeqNo=1
4517         in_vlan=0
4518         in_priority=0
4519         out_vlan=0
4520         out_priority=0
4521         meanSkip=1
4522         samplePool=1
4523         dropEvents=0
4524         in_ifindex=1004
4525         in_format=0
4526         out_ifindex=2
4527         out_format=2
4528         hdr_prot=1
4529         pkt_len=64
4530         stripped=4
4531         hdr_len=60
4532         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
4533 HEADER
4534         dgramSeqNo=1
4535         ds=127.0.0.1>2:1000
4536         fsSeqNo=2
4537         in_vlan=0
4538         in_priority=0
4539         out_vlan=0
4540         out_priority=0
4541         meanSkip=1
4542         samplePool=2
4543         dropEvents=0
4544         in_ifindex=1003
4545         in_format=0
4546         out_ifindex=2
4547         out_format=2
4548         hdr_prot=1
4549         pkt_len=64
4550         stripped=4
4551         hdr_len=60
4552         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
4553 HEADER
4554         dgramSeqNo=1
4555         ds=127.0.0.1>2:1000
4556         fsSeqNo=3
4557         in_vlan=0
4558         in_priority=0
4559         out_vlan=0
4560         out_priority=0
4561         meanSkip=1
4562         samplePool=3
4563         dropEvents=0
4564         in_ifindex=1004
4565         in_format=0
4566         out_ifindex=1003
4567         out_format=0
4568         hdr_prot=1
4569         pkt_len=64
4570         stripped=4
4571         hdr_len=60
4572         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
4573 HEADER
4574         dgramSeqNo=1
4575         ds=127.0.0.1>2:1000
4576         fsSeqNo=4
4577         in_vlan=0
4578         in_priority=0
4579         out_vlan=0
4580         out_priority=0
4581         meanSkip=1
4582         samplePool=4
4583         dropEvents=0
4584         in_ifindex=1003
4585         in_format=0
4586         out_ifindex=1004
4587         out_format=0
4588         hdr_prot=1
4589         pkt_len=64
4590         stripped=4
4591         hdr_len=60
4592         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
4593 HEADER
4594         dgramSeqNo=1
4595         ds=127.0.0.1>2:1000
4596         fsSeqNo=5
4597         in_vlan=0
4598         in_priority=0
4599         out_vlan=0
4600         out_priority=0
4601         meanSkip=1
4602         samplePool=5
4603         dropEvents=0
4604         in_ifindex=1003
4605         in_format=0
4606         out_ifindex=1004
4607         out_format=0
4608         hdr_prot=1
4609         pkt_len=64
4610         stripped=4
4611         hdr_len=60
4612         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
4613 ])
4614
4615   AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -18 | sed 's/ /\
4616         /g']], [0], [dnl
4617 IFCOUNTERS
4618         dgramSeqNo=2
4619         ds=127.0.0.1>0:1002
4620         csSeqNo=1
4621         ifindex=1002
4622         type=6
4623         ifspeed=100000000
4624         direction=0
4625         status=0
4626         in_octets=0
4627         in_unicasts=0
4628         in_multicasts=0
4629         in_broadcasts=4294967295
4630         in_discards=0
4631         in_errors=0
4632         in_unknownprotos=4294967295
4633         out_octets=120
4634         out_unicasts=2
4635         out_multicasts=4294967295
4636         out_broadcasts=4294967295
4637         out_discards=0
4638         out_errors=0
4639         promiscuous=0
4640 IFCOUNTERS
4641         dgramSeqNo=2
4642         ds=127.0.0.1>0:1003
4643         csSeqNo=1
4644         ifindex=1003
4645         type=6
4646         ifspeed=100000000
4647         direction=0
4648         status=0
4649         in_octets=138
4650         in_unicasts=3
4651         in_multicasts=0
4652         in_broadcasts=4294967295
4653         in_discards=0
4654         in_errors=0
4655         in_unknownprotos=4294967295
4656         out_octets=120
4657         out_unicasts=2
4658         out_multicasts=4294967295
4659         out_broadcasts=4294967295
4660         out_discards=0
4661         out_errors=0
4662         promiscuous=0
4663 IFCOUNTERS
4664         dgramSeqNo=2
4665         ds=127.0.0.1>0:1004
4666         csSeqNo=1
4667         ifindex=1004
4668         type=6
4669         ifspeed=100000000
4670         direction=0
4671         status=0
4672         in_octets=84
4673         in_unicasts=2
4674         in_multicasts=0
4675         in_broadcasts=4294967295
4676         in_discards=0
4677         in_errors=0
4678         in_unknownprotos=4294967295
4679         out_octets=180
4680         out_unicasts=3
4681         out_multicasts=4294967295
4682         out_broadcasts=4294967295
4683         out_discards=0
4684         out_errors=0
4685         promiscuous=0
4686 IFCOUNTERS
4687         dgramSeqNo=3
4688         ds=127.0.0.1>0:1002
4689         csSeqNo=2
4690         ifindex=1002
4691         type=6
4692         ifspeed=100000000
4693         direction=0
4694         status=0
4695         in_octets=0
4696         in_unicasts=0
4697         in_multicasts=0
4698         in_broadcasts=4294967295
4699         in_discards=0
4700         in_errors=0
4701         in_unknownprotos=4294967295
4702         out_octets=120
4703         out_unicasts=2
4704         out_multicasts=4294967295
4705         out_broadcasts=4294967295
4706         out_discards=0
4707         out_errors=0
4708         promiscuous=0
4709 IFCOUNTERS
4710         dgramSeqNo=3
4711         ds=127.0.0.1>0:1003
4712         csSeqNo=2
4713         ifindex=1003
4714         type=6
4715         ifspeed=100000000
4716         direction=0
4717         status=0
4718         in_octets=138
4719         in_unicasts=3
4720         in_multicasts=0
4721         in_broadcasts=4294967295
4722         in_discards=0
4723         in_errors=0
4724         in_unknownprotos=4294967295
4725         out_octets=120
4726         out_unicasts=2
4727         out_multicasts=4294967295
4728         out_broadcasts=4294967295
4729         out_discards=0
4730         out_errors=0
4731         promiscuous=0
4732 IFCOUNTERS
4733         dgramSeqNo=3
4734         ds=127.0.0.1>0:1004
4735         csSeqNo=2
4736         ifindex=1004
4737         type=6
4738         ifspeed=100000000
4739         direction=0
4740         status=0
4741         in_octets=84
4742         in_unicasts=2
4743         in_multicasts=0
4744         in_broadcasts=4294967295
4745         in_discards=0
4746         in_errors=0
4747         in_unknownprotos=4294967295
4748         out_octets=180
4749         out_unicasts=3
4750         out_multicasts=4294967295
4751         out_broadcasts=4294967295
4752         out_discards=0
4753         out_errors=0
4754         promiscuous=0
4755 OPENFLOWPORT
4756         datapath_id=18364758544493064720
4757         port_no=1
4758 OPENFLOWPORT
4759         datapath_id=18364758544493064720
4760         port_no=1
4761 OPENFLOWPORT
4762         datapath_id=18364758544493064720
4763         port_no=2
4764 OPENFLOWPORT
4765         datapath_id=18364758544493064720
4766         port_no=2
4767 OPENFLOWPORT
4768         datapath_id=18364758544493064720
4769         port_no=65534
4770 OPENFLOWPORT
4771         datapath_id=18364758544493064720
4772         port_no=65534
4773 PORTNAME
4774         portName=br0
4775 PORTNAME
4776         portName=br0
4777 PORTNAME
4778         portName=p1
4779 PORTNAME
4780         portName=p1
4781 PORTNAME
4782         portName=p2
4783 PORTNAME
4784         portName=p2
4785 ])
4786   AT_CLEANUP])
4787
4788 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1], [IPv4])
4789 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]], [IPv6])
4790
4791 dnl Test sFlow LAG structures
4792 AT_SETUP([ofproto-dpif - sFlow LACP structures])
4793 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
4794 OVS_VSWITCHD_START([dnl
4795                     add-bond br0 bond p1 p2 --                          \
4796                     set Port bond lacp=active bond-mode=active-backup   \
4797                     other_config:lacp-time="fast"                       \
4798                     other_config:lacp-system-id=11:22:33:44:55:66       \
4799                     other_config:lacp-system-priority=54321 --          \
4800                     set Interface p1 type=dummy                         \
4801                     other_config:lacp-port-id=11                        \
4802                     other_config:lacp-port-priority=111                 \
4803                     other_config:lacp-aggregation-key=3333 --           \
4804                     set Interface p2 type=dummy                         \
4805                     other_config:lacp-port-id=22                        \
4806                     other_config:lacp-port-priority=222                 \
4807                     other_config:lacp-aggregation-key=3333 ])
4808
4809 ON_EXIT([kill `cat test-sflow.pid`])
4810 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
4811 AT_CAPTURE_FILE([sflow.log])
4812 SFLOW_PORT=`parse_listening_port < test-sflow.log`
4813
4814 ovs-appctl time/stop
4815
4816 ovs-vsctl \
4817       set Interface p1 options:ifindex=1003 --                  \
4818       set Bridge br0 sflow=@sf --                               \
4819       --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\"   \
4820       header=128 sampling=1 polling=1
4821
4822 dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
4823 AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
4824 AT_CHECK([ovs-appctl revalidator/purge], [0])
4825 OVS_VSWITCHD_STOP
4826 ovs-appctl -t test-sflow exit
4827 AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
4828         /g']], [0], [dnl
4829 LACPCOUNTERS
4830         sysID=11:22:33:44:55:66
4831         partnerID=00:00:00:00:00:00
4832         aggID=3333
4833         actorAdmin=0x7
4834         actorOper=0xbf
4835         partnerAdmin=0x0
4836         partnerOper=0x2
4837         LACPUDsRx=0
4838         markerPDUsRx=4294967295
4839         markerRespPDUsRx=4294967295
4840         unknownRx=4294967295
4841         illegalRx=0
4842         LACPUDsTx=1
4843         markerPDUsTx=4294967295
4844         markerRespPDUsTx=4294967295
4845 ])
4846
4847 AT_CLEANUP
4848
4849 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR, IP_VERSION_TYPE)
4850 #
4851 # Test that basic NetFlow reports flow statistics correctly:
4852 # The initial packet of a flow are correctly accounted.
4853 # Later packets within a flow are correctly accounted.
4854 # Flow actions changing (in this case, due to MAC learning)
4855 # cause a record to be sent.
4856 #
4857 # IP_VERSION_TYPE is used in AT_SETUP
4858 m4_define([CHECK_NETFLOW_EXPIRATION],
4859   [AT_SETUP([ofproto-dpif - NetFlow flow expiration - $2 collector])
4860   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
4861   ADD_OF_PORTS([br0], 1, 2)
4862
4863   ovs-appctl time/stop
4864   ON_EXIT([kill `cat test-netflow.pid`])
4865   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
4866   AT_CAPTURE_FILE([netflow.log])
4867   NETFLOW_PORT=`parse_listening_port < test-netflow.log`
4868
4869   ovs-vsctl \
4870      set Bridge br0 netflow=@nf -- \
4871      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
4872        engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
4873
4874   for delay in 1000 30000; do
4875       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)'
4876       sleep 1  # ensure the order in which these two packets are processed
4877       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)'
4878
4879       ovs-appctl time/warp $delay
4880   done
4881
4882   ovs-appctl time/warp 6000
4883   ovs-appctl revalidator/wait
4884   OVS_VSWITCHD_STOP
4885   ovs-appctl -t test-netflow exit
4886
4887   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])
4888
4889   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])
4890
4891   combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 120 bytes, ICMP 0:0" netflow.log | wc -l`
4892   separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 60 bytes, ICMP 0:0" netflow.log | wc -l`
4893   AT_CHECK([test $separate = 2 || test $combined = 1], [0])
4894
4895   AT_CLEANUP])
4896
4897 CHECK_NETFLOW_EXPIRATION([127.0.0.1], [IPv4])
4898 CHECK_NETFLOW_EXPIRATION([[[::1]]], [IPv6])
4899
4900 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR, IP_VERSION_TYPE)
4901 #
4902 # Test that basic NetFlow reports active expirations correctly.
4903 #
4904 # IP_VERSION_TYPE is used in AT_SETUP
4905 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
4906   [AT_SETUP([ofproto-dpif - NetFlow active expiration - $2 collector])
4907
4908   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
4909   ADD_OF_PORTS([br0], 1, 2)
4910
4911   ON_EXIT([kill `cat test-netflow.pid`])
4912   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
4913   AT_CAPTURE_FILE([netflow.log])
4914   NETFLOW_PORT=`parse_listening_port < test-netflow.log`
4915
4916   ovs-vsctl \
4917      set Bridge br0 netflow=@nf -- \
4918      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
4919        engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
4920
4921   AT_CHECK([ovs-appctl time/stop])
4922   n=1
4923   while test $n -le 60; do
4924       n=`expr $n + 1`
4925
4926       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)'
4927       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)'
4928
4929       ovs-appctl time/warp 1000
4930   done
4931
4932   ovs-appctl time/warp 10000
4933
4934   ovs-appctl revalidator/wait
4935   OVS_VSWITCHD_STOP
4936   ovs-appctl -t test-netflow exit
4937
4938   # Count the number of reported packets:
4939   # - From source to destination before MAC learning kicks in (just one).
4940   # - From source to destination after that.
4941   # - From destination to source.
4942   n_learn=0
4943   n_in=0
4944   n_out=0
4945   n_other=0
4946   n_recs=0
4947   none=0
4948   while read line; do
4949       pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
4950       case $pkts in
4951            [[0-9]]*) ;;
4952        *) continue ;;
4953       esac
4954
4955       case $line in
4956           "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
4957               counter=n_learn
4958           ;;
4959       "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
4960           counter=n_in
4961           ;;
4962       "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
4963           counter=n_out
4964           ;;
4965       *)
4966           counter=n_other
4967           ;;
4968       esac
4969       eval $counter=\`expr \$$counter + \$pkts\`
4970       n_recs=`expr $n_recs + 1`
4971   done < netflow.log
4972
4973   # There should be exactly 1 MAC learning packet,
4974   # exactly 59 other packets in that direction,
4975   # and exactly 60 packets in the other direction.
4976   AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
4977 ])
4978
4979   AT_CLEANUP])
4980
4981 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1], [IPv4])
4982 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]], [IPv6])
4983
4984 AT_SETUP([ofproto-dpif - flow stats])
4985 OVS_VSWITCHD_START
4986 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
4987 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
4988
4989 ovs-appctl time/stop
4990
4991 for i in `seq 1 10`; do
4992     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)'
4993 done
4994
4995 AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
4996 AT_CHECK([ovs-appctl revalidator/purge], [0])
4997 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
4998 AT_CHECK([STRIP_XIDS stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
4999  cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
5000  cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
5001 ])
5002 OVS_VSWITCHD_STOP
5003 AT_CLEANUP
5004
5005 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
5006 OVS_VSWITCHD_START
5007 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
5008 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
5009
5010 ovs-appctl time/stop
5011
5012 for i in `seq 1 10`; do
5013     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)'
5014 done
5015
5016 ovs-appctl time/warp 100
5017 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
5018 ovs-appctl time/warp 1000
5019
5020 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5021 AT_CHECK([STRIP_XIDS stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
5022  cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
5023  cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
5024 ])
5025 OVS_VSWITCHD_STOP
5026 AT_CLEANUP
5027
5028 AT_SETUP([idle_age and hard_age increase over time])
5029 OVS_VSWITCHD_START
5030
5031 # get_ages DURATION HARD IDLE
5032 #
5033 # Fetch the flow duration, hard age, and idle age into the variables
5034 # whose names are given as arguments.  Rounds DURATION down to the
5035 # nearest integer.  If hard_age doesn't appear in the output, sets
5036 # HARD to "none".  If idle_age doesn't appear in the output, sets IDLE
5037 # to 0.
5038 get_ages () {
5039     AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5040
5041     duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
5042     AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
5043     AS_VAR_COPY([$1], [duration])
5044
5045     hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
5046     if test X"$hard" = X; then
5047         hard=none
5048     else
5049         AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
5050     fi
5051     AS_VAR_COPY([$2], [hard])
5052
5053     idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
5054     if test X"$idle" = X; then
5055         idle=0
5056     else
5057         AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
5058     fi
5059     AS_VAR_COPY([$3], [idle])
5060 }
5061
5062 # Add a flow and get its initial hard and idle age.
5063 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
5064 get_ages duration1 hard1 idle1
5065
5066 ovs-appctl time/stop
5067 # Warp time forward by 10 seconds, then modify the flow's actions.
5068 ovs-appctl time/warp 10000
5069 get_ages duration2 hard2 idle2
5070 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
5071
5072 # Warp time forward by 10 seconds.
5073 ovs-appctl time/warp 10000
5074 get_ages duration3 hard3 idle3
5075
5076 # Warp time forward 10 more seconds, then pass some packets through the flow,
5077 # then warp forward a few more times because idle times are only updated
5078 # occasionally.
5079 ovs-appctl time/warp 10000
5080 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)'
5081 ovs-appctl time/warp 3000 1000
5082 sleep 1
5083 get_ages duration4 hard4 idle4
5084
5085 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
5086 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
5087 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
5088
5089 # Duration should increase steadily over time.
5090 AT_CHECK([test $duration1 -lt $duration2])
5091 AT_CHECK([test $duration2 -lt $duration3])
5092 AT_CHECK([test $duration3 -lt $duration4])
5093
5094 # Hard age should be "none" initially because it's the same as flow_duration,
5095 # then it should increase.
5096 AT_CHECK([test $hard1 = none])
5097 AT_CHECK([test $hard2 = none])
5098 AT_CHECK([test $hard3 != none])
5099 AT_CHECK([test $hard4 != none])
5100 AT_CHECK([test $hard3 -lt $hard4])
5101
5102 # Idle age should increase from 1 to 2 to 3, then decrease.
5103 AT_CHECK([test $idle1 -lt $idle2])
5104 AT_CHECK([test $idle2 -lt $idle3])
5105 AT_CHECK([test $idle3 -gt $idle4])
5106
5107 # Check some invariant relationships.
5108 AT_CHECK([test $duration1 = $idle1])
5109 AT_CHECK([test $duration2 = $idle2])
5110 AT_CHECK([test $duration3 = $idle3])
5111 AT_CHECK([test $idle3 -gt $hard3])
5112 AT_CHECK([test $idle4 -lt $hard4])
5113 AT_CHECK([test $hard4 -lt $duration4])
5114
5115 OVS_VSWITCHD_STOP
5116 AT_CLEANUP
5117
5118 AT_SETUP([ofproto-dpif - fin_timeout])
5119 OVS_VSWITCHD_START
5120 ovs-appctl time/stop
5121 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
5122 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5123 [NXST_FLOW reply:
5124  idle_timeout=60, actions=fin_timeout(idle_timeout=5)
5125 ])
5126
5127 # Check that a TCP SYN packet does not change the timeout.  (Because
5128 # flow stats updates are mainly what implements the fin_timeout
5129 # feature, we warp forward a couple of times to ensure that flow stats
5130 # run before re-checking the flow table.)
5131 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
5132 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
5133 warped
5134 ])
5135 AT_CHECK([ovs-appctl revalidator/purge], [0])
5136 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5137 [NXST_FLOW reply:
5138  n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
5139 ])
5140 # Check that a TCP FIN packet does change the timeout.
5141 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
5142 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
5143 warped
5144 ])
5145 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5146 [NXST_FLOW reply:
5147  n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
5148 ])
5149 OVS_VSWITCHD_STOP
5150 AT_CLEANUP
5151
5152 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
5153 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
5154 ADD_OF_PORTS([br0], [1], [2])
5155 ADD_OF_PORTS([br1], [3])
5156
5157 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
5158 dummy@br0
5159 dummy@br1
5160 ])
5161 OVS_VSWITCHD_STOP
5162 AT_CLEANUP
5163
5164 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
5165 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
5166 ADD_OF_PORTS([br0], [1], [2])
5167 ADD_OF_PORTS([br1], [3])
5168
5169 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
5170 dummy@ovs-dummy: hit:0 missed:0
5171         br0:
5172                 br0 65534/100: (dummy)
5173                 p1 1/1: (dummy)
5174                 p2 2/2: (dummy)
5175         br1:
5176                 br1 65534/101: (dummy)
5177                 p3 3/3: (dummy)
5178 ])
5179 OVS_VSWITCHD_STOP
5180 AT_CLEANUP
5181
5182 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
5183 # bump max-idle to avoid the flows being reclaimed behind us
5184 OVS_VSWITCHD_START([add-br br1 -- \
5185                     set bridge br1 datapath-type=dummy fail-mode=secure -- \
5186                     set Open_vSwitch . other_config:max-idle=10000])
5187 ADD_OF_PORTS([br0], [1], [2])
5188 ADD_OF_PORTS([br1], [3])
5189
5190 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)'])
5191 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)'])
5192 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)'])
5193 ovs-appctl revalidator/wait
5194 AT_CHECK([ovs-appctl dpif/dump-flows br0 | STRIP_UFID | STRIP_USED | sort], [0], [dnl
5195 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
5196 recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
5197 ])
5198
5199 AT_CHECK([ovs-appctl dpif/dump-flows br1 | STRIP_UFID | STRIP_USED | sort], [0], [dnl
5200 recirc_id(0),in_port(3),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
5201 ])
5202
5203 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | STRIP_UFID | STRIP_USED | sort], [0], [dnl
5204 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
5205 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
5206 ])
5207
5208 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | STRIP_UFID | STRIP_USED | sort], [0], [dnl
5209 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
5210 ])
5211
5212 OVS_VSWITCHD_STOP
5213 AT_CLEANUP
5214
5215 AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow])
5216
5217 OVS_VSWITCHD_START([add-br br1 -- \
5218                     set bridge br1 datapath-type=dummy fail-mode=secure -- \
5219                     set Open_vSwitch . other_config:max-idle=10000])
5220 ADD_OF_PORTS([br0], [1], [2])
5221
5222 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)'])
5223 ovs-appctl revalidator/wait
5224 AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
5225
5226 UFID=`sed -n 's/\(ufid:[[0-9a-fA-F]]*\).*/\1/p' stdout`
5227 AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
5228 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
5229 ])
5230
5231 OVS_VSWITCHD_STOP
5232 AT_CLEANUP
5233
5234 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
5235 OVS_VSWITCHD_START([dnl
5236    add-port br0 p1 -- set Interface p1 type=dummy
5237 ])
5238 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5239 ON_EXIT([kill `cat ovs-ofctl.pid`])
5240
5241 AT_CAPTURE_FILE([ofctl_monitor.log])
5242 AT_DATA([flows.txt], [dnl
5243 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
5244 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8849,controller
5245 ])
5246 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5247
5248 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
5249 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
5250 dnl
5251 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
5252 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)
5253 dnl         (label 20, exp 0, [S], ttl 32)
5254 dnl         (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
5255 dnl     192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
5256
5257 for dl_src in 00 01; do
5258     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"])
5259 done
5260 sleep 1  # wait for the datapath flow installed
5261 AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5262 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))
5263 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))
5264 ])
5265
5266 OVS_VSWITCHD_STOP
5267 AT_CLEANUP
5268
5269
5270 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
5271 OVS_VSWITCHD_START([dnl
5272    add-port br0 p1 -- set Interface p1 type=dummy
5273 ])
5274 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5275 ON_EXIT([kill `cat ovs-ofctl.pid`])
5276
5277 AT_CAPTURE_FILE([ofctl_monitor.log])
5278 AT_DATA([flows.txt], [dnl
5279 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
5280 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8849,controller
5281 ])
5282 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5283
5284 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
5285 dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
5286 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
5287 dnl
5288 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
5289 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)
5290 dnl         (label 20, exp 0, ttl 32)
5291 dnl         (label 20, exp 0, ttl 32)
5292 dnl         (label 20, exp 0, [S], ttl 32)
5293 dnl         (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
5294 dnl     192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
5295
5296 for dl_src in 00 01; do
5297     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"])
5298 done
5299 sleep 1  # wait for the datapath flow installed
5300 AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5301 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))
5302 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))
5303 ])
5304
5305 OVS_VSWITCHD_STOP
5306 AT_CLEANUP
5307
5308 AT_SETUP([ofproto-dpif - patch ports])
5309 OVS_VSWITCHD_START([add-br br1 \
5310 -- set bridge br1 datapath-type=dummy fail-mode=secure \
5311 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
5312 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
5313
5314 ADD_OF_PORTS([br0], [2])
5315 ADD_OF_PORTS([br1], [3])
5316
5317 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
5318 ], [])
5319 AT_CHECK([ovs-appctl time/stop])
5320 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5321
5322 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
5323 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
5324
5325 for i in $(seq 1 10); do
5326     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)'
5327     if [[ $i -eq 1 ]]; then
5328         sleep 1
5329     fi
5330 done
5331
5332 for i in $(seq 1 5); do
5333     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)'
5334     if [[ $i -eq 1 ]]; then
5335         sleep 1
5336     fi
5337 done
5338
5339 AT_CHECK([ovs-appctl time/warp 500], [0],
5340 [warped
5341 ])
5342 sleep 1  # wait for log writer
5343
5344 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
5345 dummy@ovs-dummy: hit:13 missed:2
5346         br0:
5347                 br0 65534/100: (dummy)
5348                 p2 2/2: (dummy)
5349                 pbr0 1/none: (patch: peer=pbr1)
5350         br1:
5351                 br1 65534/101: (dummy)
5352                 p3 3/3: (dummy)
5353                 pbr1 1/none: (patch: peer=pbr0)
5354 ])
5355
5356 AT_CHECK([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5357 recirc_id=0,ip,in_port=100,nw_frag=no, actions:101,3,2
5358 recirc_id=0,ip,in_port=101,nw_frag=no, actions:100,2,3
5359 ])
5360
5361 AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(100).*packets:9' | STRIP_UFID | FILTER_FLOW_DUMP], [0], [dnl
5362 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
5363 ])
5364 AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(101).*packets:4' | STRIP_UFID | FILTER_FLOW_DUMP], [0], [dnl
5365 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
5366 ])
5367
5368 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
5369 OFPST_PORT reply (xid=0x4): 1 ports
5370   port  1: rx pkts=5, bytes=300, drop=0, errs=0, frame=0, over=0, crc=0
5371            tx pkts=10, bytes=600, drop=0, errs=0, coll=0
5372 ])
5373
5374 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
5375 OFPST_PORT reply (xid=0x4): 1 ports
5376   port  1: rx pkts=10, bytes=600, drop=0, errs=0, frame=0, over=0, crc=0
5377            tx pkts=5, bytes=300, drop=0, errs=0, coll=0
5378 ])
5379
5380 OVS_VSWITCHD_STOP
5381 AT_CLEANUP
5382
5383 AT_SETUP([ofproto-dpif - port duration])
5384 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
5385 ADD_OF_PORTS([br0], 1, 2)
5386
5387 ovs-appctl time/stop
5388 ovs-appctl time/warp 10000
5389
5390 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
5391 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
5392 [dnl
5393            duration=?s
5394            duration=?s
5395            duration=?s
5396 ])
5397 OVS_VSWITCHD_STOP
5398 AT_CLEANUP
5399
5400 dnl ----------------------------------------------------------------------
5401 AT_BANNER([ofproto-dpif -- megaflows])
5402
5403 AT_SETUP([ofproto-dpif megaflow - port classification])
5404 OVS_VSWITCHD_START
5405 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5406 ADD_OF_PORTS([br0], [1], [2])
5407 AT_DATA([flows.txt], [dnl
5408 table=0 in_port=1 actions=output(2)
5409 ])
5410 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5411 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)'])
5412 sleep 1
5413 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)'])
5414 sleep 1
5415 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5416 recirc_id=0,ip,in_port=1,nw_frag=no, actions: <del>
5417 ])
5418 OVS_VSWITCHD_STOP
5419 AT_CLEANUP
5420
5421 AT_SETUP([ofproto-dpif megaflow - L2 classification])
5422 OVS_VSWITCHD_START
5423 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5424 ADD_OF_PORTS([br0], [1], [2])
5425 AT_DATA([flows.txt], [dnl
5426 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
5427 ])
5428 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5429 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)'])
5430 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)'])
5431 sleep 1
5432 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5433 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
5434 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>
5435 ])
5436 OVS_VSWITCHD_STOP
5437 AT_CLEANUP
5438
5439 AT_SETUP([ofproto-dpif megaflow - L3 classification])
5440 OVS_VSWITCHD_START
5441 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5442 ADD_OF_PORTS([br0], [1], [2])
5443 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], [])
5444 AT_DATA([flows.txt], [dnl
5445 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
5446 ])
5447 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5448 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)'])
5449 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)'])
5450 sleep 1
5451 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5452 recirc_id=0,icmp,in_port=1,nw_src=10.0.0.4,nw_frag=no, actions: <del>
5453 recirc_id=0,ip,in_port=1,nw_src=10.0.0.2/0.0.0.2,nw_frag=no, actions: <del>
5454 ])
5455 OVS_VSWITCHD_STOP
5456 AT_CLEANUP
5457
5458 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
5459 OVS_VSWITCHD_START
5460 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5461 ADD_OF_PORTS([br0], [1], [2])
5462 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], [])
5463 AT_DATA([flows.txt], [dnl
5464 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
5465 ])
5466 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5467 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)'])
5468 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)'])
5469 sleep 1
5470 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5471 recirc_id=0,ipv6,in_port=1,ipv6_src=2001:db8:3c4d:1:2:3:4:5,nw_frag=no, actions: <del>
5472 recirc_id=0,ipv6,in_port=1,ipv6_src=2001:db8:3c4d:5:4:3:2:1/ffff:ffff:0:4::,nw_frag=no, actions: <del>
5473 ])
5474 OVS_VSWITCHD_STOP
5475 AT_CLEANUP
5476
5477 AT_SETUP([ofproto-dpif megaflow - L4 classification])
5478 OVS_VSWITCHD_START
5479 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5480 ADD_OF_PORTS([br0], [1], [2])
5481 AT_DATA([flows.txt], [dnl
5482 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
5483 ])
5484 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5485 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)'])
5486 sleep 1
5487 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)'])
5488 sleep 1
5489 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5490 recirc_id=0,icmp,in_port=1,nw_frag=no,icmp_type=0x8/0xff, actions: <del>
5491 ])
5492 OVS_VSWITCHD_STOP
5493 AT_CLEANUP
5494
5495 AT_SETUP([ofproto-dpif megaflow - normal])
5496 OVS_VSWITCHD_START
5497 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5498 ADD_OF_PORTS([br0], [1], [2])
5499 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5500 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)'])
5501 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)'])
5502 sleep 1
5503 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5504 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>
5505 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>
5506 ])
5507 OVS_VSWITCHD_STOP
5508 AT_CLEANUP
5509
5510 AT_SETUP([ofproto-dpif megaflow - mpls])
5511 OVS_VSWITCHD_START
5512 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5513 ADD_OF_PORTS([br0], [1], [2])
5514 AT_DATA([flows.txt], [dnl
5515 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
5516 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
5517 ])
5518 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5519 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)'])
5520 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)'])
5521 sleep 1
5522 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5523 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>
5524 recirc_id=0,mpls,in_port=1,dl_src=50:54:00:00:00:0b,mpls_bos=1, actions: <del>
5525 ])
5526 OVS_VSWITCHD_STOP
5527 AT_CLEANUP
5528
5529 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR, IP_VERSION_TYPE)
5530 #
5531 # IP_VERSION_TYPE is used in AT_SETUP
5532 m4_define([CHECK_MEGAFLOW_NETFLOW],
5533   [AT_SETUP([ofproto-dpif megaflow - netflow - $2 collector])
5534   OVS_VSWITCHD_START
5535   AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5536   ADD_OF_PORTS([br0], [1], [2])
5537
5538   dnl NetFlow configuration disables wildcarding relevant fields
5539   ON_EXIT([kill `cat test-netflow.pid`])
5540   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
5541   AT_CAPTURE_FILE([netflow.log])
5542   NETFLOW_PORT=`parse_listening_port < test-netflow.log`
5543   ovs-vsctl \
5544      set Bridge br0 netflow=@nf -- \
5545      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
5546        engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
5547
5548   AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5549   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)'])
5550   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)'])
5551   sleep 1
5552   AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5553 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>
5554 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>
5555 ])
5556   OVS_VSWITCHD_STOP
5557   AT_CLEANUP])
5558
5559 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
5560 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
5561
5562 AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding])
5563 OVS_VSWITCHD_START(
5564   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
5565    add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
5566    set interface p2 type=dummy ofport_request=2 -- \
5567    set interface p3 type=dummy ofport_request=3])
5568 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
5569 ])
5570 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5571
5572 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5573 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)'])
5574 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)'])
5575 sleep 1
5576 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5577 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>
5578 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>
5579 ])
5580 OVS_VSWITCHD_STOP
5581 AT_CLEANUP
5582
5583 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
5584 OVS_VSWITCHD_START(
5585   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
5586    add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
5587    set interface p2 type=dummy ofport_request=2 -- \
5588    set interface p3 type=dummy ofport_request=3])
5589 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
5590 ])
5591 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5592
5593 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5594 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)'])
5595 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)'])
5596 sleep 1
5597 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5598 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>
5599 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>
5600 ])
5601 OVS_VSWITCHD_STOP
5602 AT_CLEANUP
5603
5604 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
5605 # Create bond0 on br0 with interfaces p0 and p1
5606 #    and bond1 on br1 with interfaces p2 and p3
5607 # with p0 patched to p2 and p1 patched to p3.
5608 OVS_VSWITCHD_START(
5609   [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
5610                             other-config:lacp-time=fast \
5611                             other-config:bond-rebalance-interval=0 -- \
5612    set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
5613    set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
5614    add-br br1 -- \
5615    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
5616    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
5617                   fail-mode=secure -- \
5618    add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
5619                             other-config:lacp-time=fast \
5620                             other-config:bond-rebalance-interval=0 -- \
5621    set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
5622    set interface p3 type=patch options:peer=p1 ofport_request=4 --])
5623
5624 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
5625 ])
5626 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5627 ADD_OF_PORTS([br0], [7])
5628 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5629 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
5630 ovs-appctl time/stop
5631 ovs-appctl time/warp 5000
5632 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)'])
5633 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)'])
5634 sleep 1
5635 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5636 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>
5637 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>
5638 ])
5639 OVS_VSWITCHD_STOP
5640 AT_CLEANUP
5641
5642 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
5643 OVS_VSWITCHD_START
5644 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5645 ADD_OF_PORTS([br0], [1], [2])
5646 AT_DATA([flows.txt], [dnl
5647 table=0 in_port=1,ip actions=resubmit(90)
5648 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
5649 ])
5650 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5651 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)'])
5652 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)'])
5653 sleep 1
5654 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5655 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
5656 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>
5657 ])
5658 OVS_VSWITCHD_STOP
5659 AT_CLEANUP
5660
5661 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
5662 OVS_VSWITCHD_START
5663 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5664 ADD_OF_PORTS([br0], [1], [2])
5665 AT_DATA([flows.txt], [dnl
5666 table=0 in_port=1,ip actions=resubmit(,1)
5667 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
5668 ])
5669 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5670 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)'])
5671 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=
5672 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
5673 sleep 1
5674 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5675 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
5676 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
5677 ])
5678 OVS_VSWITCHD_STOP
5679 AT_CLEANUP
5680
5681 AT_SETUP([ofproto-dpif megaflow - goto_table action])
5682 OVS_VSWITCHD_START
5683 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5684 ADD_OF_PORTS([br0], [1], [2])
5685 AT_DATA([flows.txt], [dnl
5686 table=0 in_port=1,ip actions=goto_table(1)
5687 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
5688 ])
5689 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
5690 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)'])
5691 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)'])
5692 sleep 1
5693 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5694 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
5695 recirc_id=0,ip,in_port=1,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
5696 ])
5697 OVS_VSWITCHD_STOP
5698 AT_CLEANUP
5699
5700 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
5701 OVS_VSWITCHD_START
5702 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5703 ADD_OF_PORTS([br0], [1], [2], [3])
5704 ovs-vsctl \
5705         set Bridge br0 mirrors=@m --\
5706         --id=@p3 get Port p3 --\
5707         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
5708
5709 AT_DATA([flows.txt], [dnl
5710 in_port=1 actions=output:2
5711 ])
5712 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5713 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)'])
5714 sleep 1
5715 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)'])
5716 sleep 1
5717 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5718 recirc_id=0,ip,in_port=1,nw_frag=no, actions: <del>
5719 ])
5720 OVS_VSWITCHD_STOP
5721 AT_CLEANUP
5722
5723 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
5724 OVS_VSWITCHD_START
5725 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5726 ADD_OF_PORTS([br0], [1], [2], [3])
5727 ovs-vsctl \
5728         set Bridge br0 mirrors=@m --\
5729         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
5730         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
5731
5732 AT_DATA([flows.txt], [dnl
5733 in_port=1 actions=output:2
5734 ])
5735 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5736 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))'])
5737 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)'])
5738 sleep 1
5739 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5740 recirc_id=0,ip,in_port=1,dl_vlan=11,nw_frag=no, actions: <del>
5741 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,nw_frag=no, actions: <del>
5742 ])
5743 OVS_VSWITCHD_STOP
5744 AT_CLEANUP
5745
5746 AT_SETUP([ofproto-dpif megaflow - move action])
5747 OVS_VSWITCHD_START
5748 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5749 ADD_OF_PORTS([br0], [1], [2])
5750 AT_DATA([flows.txt], [dnl
5751 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
5752 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
5753 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
5754 ])
5755 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5756 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)'])
5757 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)'])
5758 sleep 1
5759 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5760 recirc_id=0,ip,in_port=1,nw_src=10.0.0.2,nw_frag=no, actions: <del>
5761 recirc_id=0,ip,in_port=1,nw_src=10.0.0.4,nw_frag=no, actions: <del>
5762 ])
5763 OVS_VSWITCHD_STOP
5764 AT_CLEANUP
5765
5766 AT_SETUP([ofproto-dpif megaflow - push action])
5767 OVS_VSWITCHD_START
5768 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5769 ADD_OF_PORTS([br0], [1], [2])
5770 AT_DATA([flows.txt], [dnl
5771 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
5772 ])
5773 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5774 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)'])
5775 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)'])
5776 sleep 1
5777 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5778 recirc_id=0,ip,in_port=1,nw_src=10.0.0.2,nw_frag=no, actions: <del>
5779 recirc_id=0,ip,in_port=1,nw_src=10.0.0.4,nw_frag=no, actions: <del>
5780 ])
5781 OVS_VSWITCHD_STOP
5782 AT_CLEANUP
5783
5784 AT_SETUP([ofproto-dpif megaflow - learning])
5785 OVS_VSWITCHD_START
5786 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5787 ADD_OF_PORTS([br0], [1], [2])
5788 AT_DATA([flows.txt], [dnl
5789 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
5790 ])
5791 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5792 ovs-appctl time/stop
5793 # We send each packet twice because the first packet in each flow causes the
5794 # flow table to change and thus revalidations, which (depending on timing)
5795 # can keep a megaflow from being installed.  The revalidations are done by
5796 # the second iteration, allowing the flows to be installed.
5797 for i in 1 2; do
5798     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)'])
5799     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)'])
5800     ovs-appctl time/warp 100
5801 done
5802 sleep 1
5803 dnl The original flow is missing due to a revalidation.
5804 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5805 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x0fff,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
5806 recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x0fff,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
5807 ])
5808 OVS_VSWITCHD_STOP
5809 AT_CLEANUP
5810
5811 AT_SETUP([ofproto-dpif megaflow - tunnels])
5812 OVS_VSWITCHD_START(
5813   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
5814 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5815 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
5816      options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
5817 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
5818           ofport_request=3])
5819 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
5820      options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
5821      ofport_request=4 options:key=flow])
5822 AT_DATA([flows.txt], [dnl
5823 in_port=1,actions=output(2)
5824 in_port=3,actions=output(4)
5825 ])
5826 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5827 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
5828 dnl will cause the packet to be dropped.
5829 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)'])
5830 sleep 1
5831 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)'])
5832 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)'])
5833 sleep 1
5834 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)'])
5835 sleep 1
5836 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5837 recirc_id=0,ip,in_port=1,nw_ecn=1,nw_frag=no, actions: <del>
5838 recirc_id=0,ip,in_port=3,nw_tos=0,nw_ecn=1,nw_ttl=64,nw_frag=no, actions: <del>
5839 recirc_id=0,ip,in_port=3,nw_tos=252,nw_ecn=1,nw_ttl=128,nw_frag=no, actions: <del>
5840 ])
5841 OVS_VSWITCHD_STOP
5842 AT_CLEANUP
5843
5844 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
5845 OVS_VSWITCHD_START
5846 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5847 ADD_OF_PORTS([br0], [1], [2])
5848 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], [])
5849 AT_DATA([flows.txt], [dnl
5850 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
5851 ])
5852 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5853 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)'])
5854 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)'])
5855 sleep 1
5856 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5857 recirc_id=0,icmp,in_port=1,nw_src=10.0.0.4,nw_ttl=64,nw_frag=no, actions: <del>
5858 recirc_id=0,ip,in_port=1,nw_src=10.0.0.2/0.0.0.2,nw_frag=no, actions: <del>
5859 ])
5860 OVS_VSWITCHD_STOP
5861 AT_CLEANUP
5862
5863 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
5864 OVS_VSWITCHD_START
5865 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5866 ADD_OF_PORTS([br0], [1], [2])
5867 AT_DATA([flows.txt], [dnl
5868 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
5869 ])
5870 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5871 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)'])
5872 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)'])
5873 sleep 1
5874 dnl The first packet is essentially a no-op, as the new destination MAC is the
5875 dnl same as the original.  The second entry actually updates the destination
5876 dnl MAC.
5877 AT_CHECK([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5878 recirc_id=0,ip,in_port=1,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions:2
5879 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
5880 ])
5881 OVS_VSWITCHD_STOP
5882 AT_CLEANUP
5883
5884 AT_SETUP([ofproto-dpif megaflow - disabled])
5885 OVS_VSWITCHD_START
5886 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5887 ADD_OF_PORTS([br0], [1], [2])
5888 AT_DATA([flows.txt], [dnl
5889 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
5890 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
5891 ])
5892 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
5893 ], [])
5894 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
5895 ], [])
5896 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
5897 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5898 for i in 1 2 3 4; do
5899     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)'])
5900     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)'])
5901     if [[ $i -eq 1 ]]; then
5902         sleep 1
5903     fi
5904 done
5905 sleep 1
5906 AT_CHECK([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5907 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
5908 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
5909 ])
5910 AT_CHECK([cat ovs-vswitchd.log | STRIP_UFID | FILTER_FLOW_DUMP | grep 'packets:3'], [0], [dnl
5911 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
5912 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
5913 ])
5914 OVS_VSWITCHD_STOP
5915 AT_CLEANUP
5916
5917 AT_SETUP([ofproto-dpif - datapath port number change])
5918 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5919 ADD_OF_PORTS([br0], 1)
5920
5921 # Trace a flow that should output to p1.
5922 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
5923   [0], [stdout])
5924 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
5925 ])
5926
5927 # Change p1's port number to 5.
5928 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
5929
5930 # Trace a flow that should output to p1 in its new location.
5931 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
5932   [0], [stdout])
5933 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
5934 ])
5935 OVS_VSWITCHD_STOP
5936 AT_CLEANUP
5937
5938 # Tests the bundling with various bfd and cfm configurations.
5939 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
5940 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
5941                     add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
5942                     add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
5943                     set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
5944                     set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
5945                     set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
5946                     set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
5947                     set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
5948                     set Interface p0 cfm_mpid=1 -- \
5949                     set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
5950
5951 ovs-appctl time/stop
5952 # advance the clock to stablize everything.
5953 ovs-appctl time/warp 5000 100
5954 # cfm/show should show 'recv' fault.
5955 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
5956         fault: recv
5957 ])
5958 # bfd/show should show 'up'.
5959 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
5960         Local Session State: up
5961         Remote Session State: up
5962         Local Session State: up
5963         Remote Session State: up
5964 ])
5965 # bond/show should show 'may-enable: true' for all slaves.
5966 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
5967         may_enable: true
5968         may_enable: true
5969         may_enable: true
5970         may_enable: true
5971 ])
5972
5973 # now disable the bfd on p1.
5974 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
5975 # advance the clock to stablize everything.
5976 ovs-appctl time/warp 5000 100
5977 # cfm/show should show 'recv' fault.
5978 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
5979         fault: recv
5980 ])
5981 # bfd/show should show 'down'.
5982 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
5983         Local Session State: down
5984         Remote Session State: down
5985 ])
5986 # bond/show should show 'may-enable: false' for p0.
5987 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
5988         may_enable: false
5989         may_enable: true
5990 ])
5991
5992 # now enable the bfd on p1 and disable bfd on p0.
5993 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
5994 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
5995 # advance the clock to stablize everything.
5996 ovs-appctl time/warp 5000 100
5997 # cfm/show should show 'recv' fault.
5998 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
5999         fault: recv
6000 ])
6001 # bfd/show should show 'down'.
6002 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
6003         Local Session State: down
6004         Remote Session State: down
6005 ])
6006 # bond/show should show 'may-enable: false' for p0 and p1.
6007 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
6008         may_enable: false
6009         may_enable: true
6010         may_enable: false
6011         may_enable: true
6012 ])
6013
6014 OVS_VSWITCHD_STOP
6015 AT_CLEANUP
6016
6017 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
6018 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
6019
6020 # enable bfd on p0.
6021 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
6022 # check log.
6023 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
6024 # disable bfd on p0.
6025 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
6026 # check log.
6027 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
6028 AT_CHECK([cat ovs-vswitchd.log | sed -e '/^.*ofproto_dpif_monitor.*$/d' > ovs-vswitchd.log])
6029
6030 # enable cfm on p0.
6031 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
6032 # check log.
6033 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
6034 # disable cfm on p0.
6035 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
6036 # check log.
6037 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
6038 AT_CHECK([cat ovs-vswitchd.log | sed -e '/^.*ofproto_dpif_monitor.*$/d' > ovs-vswitchd.log])
6039
6040 # enable both bfd and cfm on p0.
6041 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
6042 # check log.
6043 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
6044 # disable bfd on p0.
6045 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
6046 # check log, there should not be the log of thread terminated.
6047 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
6048 ])
6049 # reenable bfd on p0.
6050 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
6051 # check log, should still be on log of thread created.
6052 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
6053 monitor thread created
6054 ])
6055 # disable bfd and cfm together.
6056 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
6057 # check log.
6058 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
6059
6060 OVS_VSWITCHD_STOP
6061 AT_CLEANUP
6062
6063 # this test helps avoid the deadlock between the main thread and monitor thread.
6064 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
6065 OVS_VSWITCHD_START
6066
6067 for i in `seq 1 199`
6068 do
6069     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])
6070 done
6071
6072 OVS_VSWITCHD_STOP
6073 AT_CLEANUP
6074 \f
6075 AT_BANNER([ofproto-dpif - flow translation resource limits])
6076
6077 AT_SETUP([ofproto-dpif - infinite resubmit])
6078 OVS_VSWITCHD_START
6079 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
6080 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
6081   [0], [stdout])
6082 AT_CHECK([tail -1 stdout], [0], [Datapath actions: drop
6083 ])
6084 AT_CHECK([grep -c 'resubmit actions recursed over 64 times' ovs-vswitchd.log],
6085   [0], [1
6086 ])
6087 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
6088 AT_CLEANUP
6089
6090 AT_SETUP([ofproto-dpif - exponential resubmit chain])
6091 OVS_VSWITCHD_START
6092 ADD_OF_PORTS([br0], 1)
6093 (for i in `seq 1 64`; do
6094      j=`expr $i + 1`
6095      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
6096  done
6097  echo "in_port=65, actions=local") > flows
6098  AT_CHECK([ovs-ofctl add-flows br0 flows])
6099 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
6100 AT_CHECK([grep -c 'over 4096 resubmit actions' ovs-vswitchd.log], [0], [1
6101 ])
6102 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
6103 AT_CLEANUP
6104
6105 AT_SETUP([ofproto-dpif - too many output actions])
6106 OVS_VSWITCHD_START
6107 ADD_OF_PORTS([br0], 1)
6108 (for i in `seq 1 12`; do
6109      j=`expr $i + 1`
6110      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
6111  done
6112  echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
6113 AT_CHECK([ovs-ofctl add-flows br0 flows])
6114 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
6115 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
6116   [0], [1
6117 ])
6118 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' ovs-vswitchd.log], [0], [1
6119 ])
6120 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
6121 AT_CLEANUP
6122
6123 AT_SETUP([ofproto-dpif - stack too deep])
6124 OVS_VSWITCHD_START
6125 ADD_OF_PORTS([br0], 1)
6126 (for i in `seq 1 12`; do
6127      j=`expr $i + 1`
6128      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
6129  done
6130  push="push:NXM_NX_REG0[[]]"
6131  echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
6132  AT_CHECK([ovs-ofctl add-flows br0 flows])
6133 AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
6134 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' ovs-vswitchd.log], [0], [1
6135 ])
6136 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
6137 AT_CLEANUP
6138
6139
6140 AT_SETUP([ofproto-dpif packet-out controller])
6141 OVS_VSWITCHD_START
6142 ADD_OF_PORTS([br0], 1, 2)
6143
6144 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
6145
6146 AT_CAPTURE_FILE([ofctl_monitor.log])
6147 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6148
6149 for i in 1 2 3; do
6150         AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
6151 done
6152
6153 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
6154 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6155 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
6156 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
6157 dnl
6158 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
6159 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
6160 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 ])
6164
6165 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6166  dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
6167 NXST_FLOW reply:
6168 ])
6169
6170 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
6171   table 0:
6172     active=1, lookup=0, matched=0"
6173  x=1
6174  while test $x -lt 254; do
6175    echo "
6176   table $x:
6177     active=0, lookup=0, matched=0"
6178    x=`expr $x + 1`
6179  done) > expout
6180 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
6181
6182 OVS_VSWITCHD_STOP
6183 AT_CLEANUP
6184
6185 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
6186 OVS_VSWITCHD_START(
6187   [-- \
6188    add-port br0 p1 -- \
6189    set interface p1 type=patch options:peer=p2 -- \
6190    add-br br1 -- \
6191    set bridge br1 datapath-type=dummy -- \
6192    set bridge br1 fail-mode=secure -- \
6193    set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
6194    add-port br1 p2 -- \
6195    set interface p2 type=patch options:peer=p1 --])
6196
6197 AT_CAPTURE_FILE([ofctl_monitor.log])
6198 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6199
6200 for i in 1 2 3; do
6201         AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
6202 done
6203
6204 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
6205 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6206 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
6207 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
6208 dnl
6209 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
6210 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
6211 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 ])
6215
6216 (printf "OFPST_TABLE reply (OF1.3) (xid=0x2):"
6217  x=0
6218  while test $x -lt 254; do
6219    echo "
6220   table $x:
6221     active=0, lookup=0, matched=0"
6222    x=`expr $x + 1`
6223  done) > expout
6224 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
6225
6226 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
6227   table 0:
6228     active=0, lookup=3, matched=0"
6229  x=1
6230  while test $x -lt 254; do
6231    echo "
6232   table $x:
6233     active=0, lookup=0, matched=0"
6234    x=`expr $x + 1`
6235  done) > expout
6236 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
6237
6238 OVS_VSWITCHD_STOP
6239 AT_CLEANUP
6240
6241
6242 AT_SETUP([ofproto-dpif packet-out goto_table])
6243 OVS_VSWITCHD_START
6244 ADD_OF_PORTS([br0], 1, 2)
6245
6246 AT_DATA([flows.txt], [dnl
6247 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
6248 table=1 dl_dst=50:54:00:00:00:0a actions=controller
6249 ])
6250 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
6251
6252 AT_CAPTURE_FILE([ofctl_monitor.log])
6253 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6254
6255 for i in 1 2 3; do
6256     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)'
6257 done
6258
6259 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
6260 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
6261 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6262 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
6263 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
6264 dnl
6265 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
6266 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
6267 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 ])
6271
6272 AT_CHECK([ovs-appctl revalidator/purge], [0])
6273 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6274  n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=goto_table:1
6275  table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
6276 OFPST_FLOW reply (OF1.3):
6277 ])
6278
6279 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
6280   table 0:
6281     active=1, lookup=3, matched=3
6282
6283   table 1:
6284     active=1, lookup=3, matched=3"
6285  x=2
6286  while test $x -lt 254; do
6287    echo "
6288   table $x:
6289     active=0, lookup=0, matched=0"
6290    x=`expr $x + 1`
6291  done) > expout
6292 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
6293
6294 OVS_VSWITCHD_STOP
6295 AT_CLEANUP
6296
6297
6298 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
6299 OVS_VSWITCHD_START
6300 ADD_OF_PORTS([br0], 1, 2)
6301
6302 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
6303 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
6304
6305 AT_CAPTURE_FILE([ofctl_monitor.log])
6306 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6307
6308 for i in 1 2 3; do
6309     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)'
6310 done
6311
6312 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
6313 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
6314 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6315 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
6316 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
6317 dnl
6318 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
6319 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
6320 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 ])
6324
6325 AT_CHECK([ovs-appctl revalidator/purge], [0])
6326 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
6327  table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
6328 OFPST_FLOW reply (OF1.1):
6329 ])
6330
6331 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
6332   table 0:
6333     active=0, lookup=3, matched=0
6334
6335   table 1:
6336     active=1, lookup=3, matched=3"
6337  x=2
6338  while test $x -lt 254; do
6339    echo "
6340   table $x:
6341     active=0, lookup=0, matched=0"
6342    x=`expr $x + 1`
6343  done) > expout
6344 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
6345
6346 OVS_VSWITCHD_STOP
6347 AT_CLEANUP
6348
6349 AT_SETUP([ofproto-dpif - ICMPv6])
6350 OVS_VSWITCHD_START
6351 ADD_OF_PORTS([br0], 1)
6352
6353 AT_CAPTURE_FILE([ofctl_monitor.log])
6354
6355 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6356
6357 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
6358
6359 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
6360
6361 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6362 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
6363 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
6364 ])
6365
6366 OVS_VSWITCHD_STOP
6367 AT_CLEANUP