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