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